dont ask, why i need to write a program like this but first i try to explain:
imagine a 3-tier software for managing user data. the architecture shall be to have
various clients (swing-application, jsp etc) which connect to a remote application
layer and get a pre-configured gui.
so as an administrator your able to configure a xml-file which list so called “plugins”.
these are no more than classes describing which gui elements should be present
on all clients (e.g. Plugin1: 2 labels, a Textfield and a Combobox) and provide validation
control.
the application layer loads all plugins and the plugins can ask the layer to create their
gui elements. the application layer contacts different deployment adapters to build the
guis: the-swing adapter builds components on containers, the jsp-adapter creates the
http-file etc.
at least, theres a persistance-layer for saving the dynamic value objects to a db, an xml
file whatever.
jsp swing-app (Thin Clients) [via http] [via rmi] | | | | jsp-adapter rmi-adapter [application layer] ----------[xml:loads]-------------------> Plugin1 .. PluginN (with validation control) | | [xml-DAO] [db-DAO] (....)
up to now this is not a dynamical process so a system is not reconfigured at
runtime.
now to the problem:
- a plugin is loaded (1 textfield, 1 combobox, 1 label)
- app-layer calls deployment adapters which create concrete guis
- guis are transferred by request of http or rmi
- user enters data into gui and sends them back
but which is the best way to store the data in a value object?
you could store them into a collection type via wrapper classes
(textfield:String, combobox:Integer, label:String). too complex gui
elements are not supported (table etc.). this collection would be
returned and should be validated by the correct plugin (the ‘source’),
this can only happen by marking gui elements and plugins with ids,
so that it is clear which set of user data is from which plugin, and
which object belongs to a certains gui element.
i dont think its a good solution so far, but if you need to pass this
value object to the persistence layer the IDs are no help anymore.
because without the knowledge of the plugins i see no good way
to know which datatype which object within the collection has …
to clear it, its not my idea of software but it has to be done. but im open
for suggestions on techniques, patterns, frameworks!!