Java 8 LinkRef - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 LinkRef class.

This code example shows how to use the following methods:
        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());
        assertTrue(fooSession.getDebug());
 
        icontext.destroySubcontext("mail");
        icontext.destroySubcontext("foo");
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
    { 
        //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));
    } 
     
    /** 
     * Unbind this NamingEntry from a java:comp/env 
     */ 
    public void unbindENC () 
    { 
        try 
        { 
            InitialContext ic = new InitialContext();
            Context env = (Context)ic.lookup("java:comp/env");
            __log.debug("Unbinding java:comp/env/"+getJndiName()); 
            env.unbind(getJndiName());
        } 
6
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
    { 
        //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));
    } 
     
    /** 
     * Unbind this NamingEntry from a java:comp/env 
     */ 
    public void unbindENC () 
    { 
        try 
        { 
            InitialContext ic = new InitialContext();
            Context env = (Context)ic.lookup("java:comp/env");
            Log.debug("Unbinding java:comp/env/"+getJndiName());
            env.unbind(getJndiName());
        } 
5
CodeRank
This code example shows how to use the following methods:
 
	@XNode("@type") 
	protected String type;
 
    public void bindSelf(Context namingContext) throws NamingException {
        namingContext.bind(name, new LinkRef(global));
    } 
 
    public void unbindSelf(Context namingContext) throws NamingException {
        namingContext.unbind(name);
    } 
 
} 
4
CodeRank
This code example shows how to use the following methods:
        final InitialContext context = new InitialContext();
 
        final Context javaContext = (Context) context.lookup("java:");
 
        javaContext.bind("java:TransactionManager", new JndiUrlReference("java:comp/TransactionManager"));
        javaContext.bind("java:TransactionManagerLink", new LinkRef("java:comp/TransactionManager"));
 
        assertTrue(context.lookup("java:TransactionManager") instanceof TransactionManager);
        assertTrue(context.lookup("java:TransactionManagerLink") instanceof TransactionManager);
 
        new InitialContext().bind("java:foo", new LinkRef("java:comp/TransactionManager"));
 
        assertTrue(context.lookup("java:foo") instanceof TransactionManager);
 
 
    } 
 
} 
4
CodeRank
This code example shows how to use the following methods:
    } 
 
    @Test
    public void testLookupLink() throws Exception {
        localContext.bind("test", "testValue");
        localContext.bind("link", new LinkRef("./test"));
        assertTrue(remoteContext.lookupLink("link") instanceof LinkRef);
        localContext.unbind("test");
        localContext.unbind("link");
    } 
 
    @Test
    public void testWithExistingEndpoint() throws Exception {
        final Xnio xnio = Xnio.getInstance();
        final Endpoint endpoint = Remoting.createEndpoint("RemoteNaming", xnio, OptionMap.EMPTY);
        endpoint.addConnectionProvider("remote", new RemoteConnectionProviderFactory(), OptionMap.create(SSL_ENABLED, false));
 
        final Properties env = new Properties();
        env.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName());
        env.put(Context.PROVIDER_URL, "remote://localhost:7999");
3
CodeRank
See Code Examples for Java 8 LinkRef Methods: