Search in sources :

Example 1 with ResolveResult

use of javax.naming.spi.ResolveResult in project wildfly by wildfly.

the class InMemoryNamingStoreTestCase method testBindAndLookupResolveResult.

@Test
public void testBindAndLookupResolveResult() throws Exception {
    final Name name = new CompositeName("test");
    final Reference reference = new Reference(Context.class.getName());
    nameStore.bind(name, reference, Context.class);
    final Object result = nameStore.lookup(new CompositeName("test/value"));
    assertTrue(result instanceof ResolveResult);
}
Also used : Context(javax.naming.Context) Reference(javax.naming.Reference) CompositeName(javax.naming.CompositeName) ResolveResult(javax.naming.spi.ResolveResult) CompositeName(javax.naming.CompositeName) Name(javax.naming.Name) Test(org.junit.Test)

Example 2 with ResolveResult

use of javax.naming.spi.ResolveResult in project jdk8u_jdk by JetBrains.

the class PartialCompositeContext method resolveToClass.

public ResolveResult resolveToClass(Name name, Class<? extends Context> contextType) throws NamingException {
    PartialCompositeContext ctx = this;
    Hashtable<?, ?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);
    ResolveResult answer;
    Name nm = name;
    try {
        answer = ctx.p_resolveToClass(nm, contextType, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_resolveToClass(nm, contextType, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        if (!(cctx instanceof Resolver)) {
            throw e;
        }
        answer = ((Resolver) cctx).resolveToClass(e.getRemainingName(), contextType);
    }
    return answer;
}
Also used : Resolver(javax.naming.spi.Resolver) ResolveResult(javax.naming.spi.ResolveResult)

Example 3 with ResolveResult

use of javax.naming.spi.ResolveResult in project jdk8u_jdk by JetBrains.

the class GenericURLContext method lookup.

public Object lookup(String name) throws NamingException {
    ResolveResult res = getRootURLContext(name, myEnv);
    Context ctx = (Context) res.getResolvedObj();
    try {
        return ctx.lookup(res.getRemainingName());
    } finally {
        ctx.close();
    }
}
Also used : ResolveResult(javax.naming.spi.ResolveResult)

Example 4 with ResolveResult

use of javax.naming.spi.ResolveResult in project jdk8u_jdk by JetBrains.

the class GenericURLContext method lookupLink.

public Object lookupLink(String name) throws NamingException {
    ResolveResult res = getRootURLContext(name, myEnv);
    Context ctx = (Context) res.getResolvedObj();
    try {
        return ctx.lookupLink(res.getRemainingName());
    } finally {
        ctx.close();
    }
}
Also used : ResolveResult(javax.naming.spi.ResolveResult)

Example 5 with ResolveResult

use of javax.naming.spi.ResolveResult in project jdk8u_jdk by JetBrains.

the class GenericURLContext method rename.

public void rename(String oldName, String newName) throws NamingException {
    String oldPrefix = getURLPrefix(oldName);
    String newPrefix = getURLPrefix(newName);
    if (!urlEquals(oldPrefix, newPrefix)) {
        throw new OperationNotSupportedException("Renaming using different URL prefixes not supported : " + oldName + " " + newName);
    }
    ResolveResult res = getRootURLContext(oldName, myEnv);
    Context ctx = (Context) res.getResolvedObj();
    try {
        ctx.rename(res.getRemainingName(), getURLSuffix(newPrefix, newName));
    } finally {
        ctx.close();
    }
}
Also used : ResolveResult(javax.naming.spi.ResolveResult)

Aggregations

ResolveResult (javax.naming.spi.ResolveResult)31 CompositeName (javax.naming.CompositeName)2 Context (javax.naming.Context)2 Name (javax.naming.Name)2 Reference (javax.naming.Reference)2 LdapURL (com.sun.jndi.ldap.LdapURL)1 RegistryContext (com.sun.jndi.rmi.registry.RegistryContext)1 GenericURLContext (com.sun.jndi.toolkit.url.GenericURLContext)1 CannotProceedException (javax.naming.CannotProceedException)1 InitialContext (javax.naming.InitialContext)1 LinkRef (javax.naming.LinkRef)1 NameNotFoundException (javax.naming.NameNotFoundException)1 EventContext (javax.naming.event.EventContext)1 Resolver (javax.naming.spi.Resolver)1 ServiceName (org.jboss.msc.service.ServiceName)1 Test (org.junit.Test)1