Figure 9-4. Java implementation of the plug and play Simulator-Controller (Part 4 of 4).

Plugging a new class/component into an existing system can be implemented in different ways. One can be organizing the class/component as an executable file that inserts the class/component into the right directory and makes the necessary changes to the configuration file. The next time the system runs, it will activate the newly added class/component. The configuration file can be implemented in several ways. We have selected to use Java's resource bundle, as it is simple and sufficient to demonstrate an example of the plug and play architecture. Other possible implementation for the configuration file is to use an XML file, holding the names of the classes to be created. XML parsers will be needed to extract the information from the XML file and, in combination with the Builder pattern [GHJ95], create the required classes.

The advantage of this solution is that it allows development of frameworks for creating complex objects. Information about the interfaces that define the behavior to be implemented by other potential classes can be found in the corresponding UML models. UML allows for creating well-organized and easily-understandable documentation, which can be published on the Web and is available to developers from different groups and locations to coordinate their efforts [PSH04].

0 0

Post a comment