This content has been marked as final.
Show 1 reply
-
1. Re: JNDI ObjectFactory - run-time registration
olegpv Sep 28, 2009 6:30 AM (in response to olegpv)OK, everything turned out to be simple, as always...
Method bind(String name, Object object) of javax.naming.Context can accept objects of type javax.naming.Reference as well, so this API enables the following code for binding ObjectFactory implementation to JNDI names:Reference ref = new Reference(myFactoryClassName, myFactoryClassName, null); Context context = new InitialContext(); context.bind("services/serviceName1", ref); context.bind("services/serviceName2", ref); context.bind("services/serviceName3", ref);
And every time the client code will lookup any of the above example JNDI names via context.lookup(...) our ObjectFactory will return the necessary proxy objects for accessing the target services.