| [news.eclipse.technology.ecf] Re: makeSharedObjectContainer & org.eclipse.ecf.containerFactory extension point |
Hi Li-Te,
Hi,
Started to try out the initial provider implementation. Thanks for making it available so quickly! So far it works pretty well, and I'll probably have more comments later after digging into it some more...
Something that struck me immediately was the pattern to set up a server versus the pattern to set up a client, i.e.
Here is some example/test code that creates a client instance of this new provider:
client pattern:
ISharedObjectContainer clients[i] = SharedObjectContainerFactory.makeSharedObjectContainer("org.eclipse.ecf.provider.generic.ContainerInstantiator");
server pattern:
ID serverID = IDFactory.makeStringID("ecftcp://localhost:3282/server");
Object [] args = new Object [] { new Boolean(false), serverID };
server = SharedObjectContainerFactory.makeSharedObjectContainer("org.eclipse.ecf.provider.generic.ContainerInstantiator",args);
1. The documentation on makeSharedObjectContainer says
"@param descriptionName = the SharedObjectContainerDescription name to lookup"
It might be helpful to note the mapping between descriptionName and the "name" field in extension to org.eclipse.ecf.containerFactory in the plugin.xml. e.g. "SharedObjectContainerDescription names can be found in the 'name' field of any extension to the org.eclipse.ecf.containerFactory extension point. If there is no name field defined, the ContainerInstantiator class name is used."
Yes...good point. Will do.
2. The server pattern involves some extra "configuration" steps (setting up an ID, setting up arguments). It might be nice to ALSO allow alternate extensions to the org.eclipse.ecf.containerFactory extension point to provide default arguments. e.g. something like...
<extension point="org.eclipse.ecf.containerFactory"> <containerFactory class="org.eclipse.ecf.provider.generic.ContainerInstantiator" description="Generic Container Instantiator" name="client"/> <containerFactory class="org.eclipse.ecf.provider.generic.ContainerInstantiator" description="Generic Container Instantiator" name="server"> <arg type="boolean">false</arg> <arg type="stringID">ecftcp://localhost:3282/server</arg> </containerFactory> </extension>
This way, the you can set up a server as quickly as a client:
server = SharedObjectContainerFactory.makeSharedObjectContainer("server",args);
Also, this pushes server configuration information into plugin.xml, so you can tweak this info without touching sourcecode.
Plus, others can extend org.eclipse.ecf.containerFactory with the same ContainerInstantiator class, use a different name, and define different default arguments.
This might also be useful for different client configurations as well.
Li-Te
The two classes are:
org.eclipse.ecf.provider.app.ServerApplication org.eclipse.ecf.provider.app.ClientApplication
See the javadocs or the source for the (opt) command line parameters.
Scott