[jboss-user] [JNDI and Naming] - Re: JNDI ObjectFactory - run-time registration

olegpv do-not-reply at jboss.com
Mon Sep 28 06:30:32 EDT 2009


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.

  

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4257307#4257307

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4257307



More information about the jboss-user mailing list