PDA

View Full Version : Eclipse RCP questions with case study



alexz1011
March 18th, 2009, 04:18 AM
I am interested to learn about Eclipse RCP, I have got some basic knowledge, but I wanted to know more what it is capable of. So I encouraged my self to create a set of requirements, analyze them, and come up with design decisions about how they can be met using Eclipse RCP as the base framework, and eventually implement them with Eclipse RCP. Now, maybe the requirements are too hard or I just do not understand about Eclipse RCP much yet, I am struggling to come up with proper solutions to meet the requirements!

The following is the summary of the requirements (please excuse the probable lack of details, this is really just some example to encourage myself):

I wanted to have an Eclipse RCP application to monitor some servers. These servers will initially be programs that the application knows about (meaning it knows exactly about their ins and outs). In the future, however, the application should be able to allow users to specify arbitrary programs with different charateristics for the application to monitor as well (so not just known servers, but also some other servers that it did not know about before). The application will also require an XML configuration file that contains all of the details of the servers that need to be monitored (e.g. host, port, username, and password). This XML configuration file will be encoded and decoded using JAXB.

So based on the above requirements, I have come up with the following details:

The XML will look something like this:


<configuration>
<components>
<serverA>
<host></host>
<port></port>
<username></username>
<password></password>
</serverA>
<serverB>
<host></host>
<port></port>
<username></username>
<password></password>
</serverB>
<!--- this will be the place for other components specified by user -->
</components>
</configuration>

Where <serverA> and <serverB> are servers that the application knows about.

In the source code, there is the following hierarchy of classes:

Component <--- Server <--- ServerA, ServerB

ServerA and ServerB descend from Server and map to <serverA> and <serverB> element respectively.

The point entry for the configuration is in the class called Configuration that contains a list of ServerA and a list of ServerB. Now, because the application should be able to monitor other programs that it did not know about, the XML configuration file should be extensible as well, so the Configuration class also contains a list of Object which maps to any other component specified by user in the configuration file.

Configuration.java


public class Configuration
{
@XmlElement
private List<ServerA> serveras;

@XmlElement
private List<ServerB> serverbs;

@XmlAnyElement
private List<Object> otherServers;
}

Now, is this something that you guys will do as well to approach the problems? I guess, I do not know, I am just confused about the requirement for the application to be able to monitor other programs specified by user. I know I set it up in the first place, but I did it having in mind saying that "this looks like something that can utilize Eclipse RCP's extension points", but now having jumped into the configuration file, I am not clear about how should the configuration file relate to the plugin.xml?

In the back of my mind, I wanted configuration file to specify the details (host, port, username, and password) of the programs that the application needs to monitor. The plugin.xml is used to specify the extension points and extensions for user-defined programs that the application also needs to monitor. So does this mean, that in the end, for the user-defined programs, users need to configure them as extensions in plugin.xml, and then specify their other details in configuration file?

Does anyone have any better idea how to approach this? Thanks. I know this is a long post.