FileDocCategorySizeDatePackage
javaURLContextFactory.javaAPI DocJBoss 4.2.12952Fri Jul 13 20:53:48 BST 2007org.jboss.ejb3.naming.client.java

javaURLContextFactory

public class javaURLContextFactory extends Object implements ObjectFactory
Creates objects for in the java:comp namespace.
author
Carlo de Wolf
version
$Revision: $

Fields Summary
Constructors Summary
Methods Summary
public java.lang.ObjectgetObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment)

      if(nameCtx == null)
         nameCtx = new InitialContext(environment); 
      final Context lookupCtx = nameCtx;
      return new BrainlessContext() 
      {
         @Override
         public Object lookup(Name name) throws NamingException
         {
            if (name.size() > 0 && "java:comp".equals(name.get(0)))
            {
               if (name.size() == 2 && "ORB".equals(name.get(1)))
                  return ORBFactory.getORB();
               else if (name.size() == 2 && "HandleDelegate".equals(name.get(1)))
                  return HandleDelegateFactory.getHandleDelegateSingleton();
            }
            throw new NameNotFoundException(name.toString());
         }
         
         @Override
         public Object lookup(String name) throws NamingException
         {
            NameParser parser = lookupCtx.getNameParser("");
            return lookup(parser.parse(name));
         }
      };