Not much time for experimentation... the schedule was really tight. However, I did use a lot of the old standbys: dynamic loading and construction, inspection and access, some proxying... These things really seem to help a framework come up quickly when used in conjunction with the right
patterns.
Ali, from your previous postings ('loading plugins') I know you've done this before, but here's an example for the body of the forum:
- data in the form of XML enters my application remotely. I want to handle these messages to do different things in my application.
- I grab a specific token from the XML and synthesize a class name.
- I check a property file for a property that may overload that specific class.
- I use Class.forName() to load the handler class by that name (or the overloaded version from properties)
- I use newInstance() on the loaded handler class to create a handler instance.
- I pass the handler instance my XML data, and the program continues.
This is classic delegation (Command pattern) with a twist. I can extend my application's capability to handle XML by just writing new classes and dropping them in the classpath. This technique is covered in more detail in Chapter 2 of our book.
Best Regards,
Nate