Package javax.naming

Examples of javax.naming.LinkRef


            assertEquals ("abc", (String)initCtx.lookup("java:comp/env/rubbish"));



            //check binding LinkRefs
            LinkRef link = new LinkRef ("java:comp/env/rubbish");
            initCtx.bind ("java:comp/env/poubelle", link);
            assertEquals ("abc", (String)initCtx.lookup("java:comp/env/poubelle"));

            //check binding References
            StringRefAddr addr = new StringRefAddr("blah", "myReferenceable");
View Full Code Here


        Context foo = icontext.createSubcontext("foo");
        NameParser parser = icontext.getNameParser("");
        Name objectNameInNamespace = parser.parse(icontext.getNameInNamespace());
        objectNameInNamespace.addAll(parser.parse("mail/Session"));
       
        NamingUtil.bind(foo, "mail/Session", new LinkRef(objectNameInNamespace.toString()));
       
        Object o = foo.lookup("mail/Session");
        assertNotNull(o);
        Session fooSession = (Session)o;
        assertEquals(props, fooSession.getProperties());
View Full Code Here

    {
        //TODO - check on the whole overriding/non-overriding thing
        InitialContext ic = new InitialContext();
        Context env = (Context)ic.lookup("java:comp/env");
        Log.debug("Binding java:comp/env/"+localName+" to "+objectNameString);
        NamingUtil.bind(env, localName, new LinkRef(objectNameString));
    }
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        //System.setProperty("java.naming.factory.initial", GlobalContextManager.class.getName());
        //System.setProperty("java.naming.factory.url.pkgs", "org.apache.geronimo.naming");

        LinkRef link = new LinkRef("java:comp/env/hello");

        Map bindings = new HashMap();
        bindings.put("comp/env/hello", "Hello");
        bindings.put("comp/env/world", "Hello World");
        bindings.put("comp/env/here/there/anywhere", "long name");
View Full Code Here

            } 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

        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

        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

  
   private void bindORB()
   {
      try
      {
         Util.rebind(getEnc(), "ORB", new LinkRef("java:/JBossCorbaORB"));
      }
      catch(NamingException e)
      {
         throw new RuntimeException(e);
      }
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

    }

    private Object resolveLink(Object result) throws NamingException {
        final Object linkResult;
        try {
            final LinkRef linkRef = (LinkRef) result;
            final String referenceName = linkRef.getLinkName();
            if (referenceName.startsWith("./")) {
                linkResult = lookup(referenceName.substring(2));
            } else {
                linkResult = new InitialContext().lookup(referenceName);
            }
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.