Package javax.naming

Examples of javax.naming.LinkRef


            } catch (Exception e) {
                throw (NamingException)new NamingException("could not look up : " + name).initCause(e);
            }
        }
        if (result instanceof LinkRef) {
            LinkRef ref = (LinkRef) result;
            result = lookup(ref.getLinkName());
        }
        if (result instanceof Reference) {
            try {
                result = NamingManager.getObjectInstance(result, null, null, this.env);
            } catch (NamingException e) {
View Full Code Here


            if (URL.class.equals(type)) {
                reference = new URLReference(referenceInfo.resourceID);
            } else if (type.isAnnotationPresent(ManagedBean.class)) {
                ManagedBean managed = type.getAnnotation(ManagedBean.class);
                String name = managed.value().length() == 0 ? type.getSimpleName() : managed.value();
                reference = new LinkRef("module/" + name);
            } else if (Request.class.equals(type)) {
                reference = new ObjectReference(ThreadLocalContextManager.REQUEST);
            } else if (UriInfo.class.equals(type)) {
                reference = new ObjectReference(ThreadLocalContextManager.URI_INFO);
            } else if (HttpHeaders.class.equals(type)) {
                reference = new ObjectReference(ThreadLocalContextManager.HTTP_HEADERS);
            } else if (SecurityContext.class.equals(type)) {
                reference = new ObjectReference(ThreadLocalContextManager.SECURITY_CONTEXT);
            } else if (ContextResolver.class.equals(type)) {
                reference = new ObjectReference(ThreadLocalContextManager.CONTEXT_RESOLVER);
            } else if (referenceInfo.resourceID != null) {
                String jndiName = "openejb/Resource/" + referenceInfo.resourceID;
                reference = new IntraVmJndiReference(jndiName);
            } else {
                String jndiName = "openejb/Resource/" + referenceInfo.referenceName;
                reference = new IntraVmJndiReference(jndiName);
            }
            bindings.put(normalize(referenceInfo.referenceName), reference);
        }

        for (ResourceEnvReferenceInfo referenceInfo : jndiEnc.resourceEnvRefs) {

            if (referenceInfo.location != null) {
                Reference reference = buildReferenceLocation(referenceInfo.location);
                bindings.put(normalize(referenceInfo.referenceName), reference);
                continue;
            }

            final Class<?> type = getType(referenceInfo.resourceEnvRefType, referenceInfo);
            final Object reference;

            if (EJBContext.class.isAssignableFrom(type)) {
                String jndiName = "comp/EJBContext";
                reference = new LinkRef(jndiName);

                // Let the container bind this into JNDI
                if (jndiName.equals(referenceInfo.referenceName)) continue;
            } else if (Validator.class.equals(type)) {
                String jndiName = "comp/Validator";
                reference = new LinkRef(jndiName);
            } else if (ValidatorFactory.class.equals(type)) {
                String jndiName = "comp/ValidatorFactory";
                reference = new LinkRef(jndiName);
            } else if (WebServiceContext.class.equals(type)) {
                String jndiName = "comp/WebServiceContext";
                reference = new LinkRef(jndiName);
            } else if (TimerService.class.equals(type)) {
                String jndiName = "comp/TimerService";
                reference = new LinkRef(jndiName);

                // TODO Bind the BeanManager
            } else if (BeanManager.class.equals(type)) {
                String jndiName = "java:app/BeanManager";
                reference = new LinkRef(jndiName);

            } else if (UserTransaction.class.equals(type)) {
                reference = new IntraVmJndiReference("comp/UserTransaction");
            } else if (referenceInfo.resourceID != null) {
                String jndiName = "openejb/Resource/" + referenceInfo.resourceID;
View Full Code Here

        envBinding.put("hello", "Hello");
        bind("env/world", "Hello World");
        envBinding.put("world", "Hello World");
        bind("env/here/there/anywhere", "long name");
        envBinding.put("here", readOnlyContext.lookup("env/here"));
        LinkRef link = new LinkRef("java:comp/env/hello");
        bind("env/link", link);
        envBinding.put("link", link);

        RootContext.setComponentContext(readOnlyContext);
View Full Code Here

        System.setProperty("java.naming.provider.url", "rmi://localhost:1099");

        ReadOnlyContext readOnlyContext = new ReadOnlyContext();
        readOnlyContext.internalBind("env/hello", "Hello");
        readOnlyContext.internalBind("env/world", "Hello World");
        readOnlyContext.internalBind("env/link", new LinkRef("java:comp/env/hello"));
        RootContext.setComponentContext(readOnlyContext);
    }
View Full Code Here

//         Reference ref = new Reference(EJBContext.class.getName(), EJBContextFactory.class.getName(), null);
//         ref.add(new StringRefAddr("containerGuid", Ejb3Registry.guid(this)));
//         ref.add(new StringRefAddr("containerClusterUid", Ejb3Registry.clusterUid(this)));
//         ref.add(new StringRefAddr("isClustered", Boolean.toString(isClustered())));
         // TODO: a temporary measure until jboss-injection is in place
         LinkRef ref = new LinkRef("java:internal/EJBContext");
         Util.rebind(getEnc(), "EJBContext", ref);
      }
      catch (NamingException e)
      {
         throw new RuntimeException(e);
View Full Code Here

   @Deprecated
   private void bindORB()
   {
      try
      {
         Util.rebind(getEnc(), "ORB", new LinkRef("java:/JBossCorbaORB"));
      }
      catch(NamingException e)
      {
         throw new RuntimeException(e);
      }
View Full Code Here

   @Deprecated
   private void bindTimerService() throws NamingException
   {
      // link to java:internal/TimerService (which is setup by
      // org.jboss.ejb3.timerservice.naming.TimerServiceBinder)
      LinkRef timerServiceLinkRef = new LinkRef("java:internal/TimerService");
      // bind to java:comp/TimerService
      Util.rebind(getEnc(), "TimerService", timerServiceLinkRef);
   }
View Full Code Here

            namingException.setRootCause(e);
            throw namingException;
         }
         try
         {
            Util.rebind(getEnc(), "TransactionSynchronizationRegistry", new LinkRef("java:TransactionSynchronizationRegistry"));
            log.debug("Linked java:comp/TransactionSynchronizationRegistry to JNDI name: java:TransactionSynchronizationRegistry");
         }
         catch (NamingException e)
         {
            NamingException namingException = new NamingException("Could not bind TransactionSynchronizationRegistry for ejb name " + ejbName + " into JNDI under jndiName: " + getEnc().getNameInNamespace() + "/" + "TransactionSynchronizationRegistry");
View Full Code Here

//         Reference ref = new Reference(EJBContext.class.getName(), EJBContextFactory.class.getName(), null);
//         ref.add(new StringRefAddr("containerGuid", Ejb3Registry.guid(this)));
//         ref.add(new StringRefAddr("containerClusterUid", Ejb3Registry.clusterUid(this)));
//         ref.add(new StringRefAddr("isClustered", Boolean.toString(isClustered())));
         // TODO: a temporary measure until jboss-injection is in place
         LinkRef ref = new LinkRef("java:internal/EJBContext");
         Util.rebind(getEnc(), "EJBContext", ref);
      }
      catch (NamingException e)
      {
         throw new RuntimeException(e);
View Full Code Here

  
   private void bindORB()
   {
      try
      {
         Util.rebind(getEnc(), "ORB", new LinkRef("java:/JBossCorbaORB"));
      }
      catch(NamingException e)
      {
         throw new RuntimeException(e);
      }
View Full Code Here

TOP

Related Classes of javax.naming.LinkRef

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.