Search in sources :

Example 21 with ResolveResult

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

the class ServiceBasedNamingStore method lookup.

public Object lookup(final Name name, boolean dereference) throws NamingException {
    if (name.isEmpty()) {
        return new NamingContext(EMPTY_NAME, this, null);
    }
    final ServiceName lookupName = buildServiceName(name);
    Object obj = lookup(name.toString(), lookupName, dereference);
    if (obj == null) {
        final ServiceName lower = boundServices.lower(lookupName);
        if (lower != null && lower.isParentOf(lookupName)) {
            // Parent might be a reference or a link
            obj = lookup(name.toString(), lower, dereference);
            //infinite loop
            if (!(obj instanceof NamingContext)) {
                checkReferenceForContinuation(name, obj);
                return new ResolveResult(obj, suffix(lower, lookupName));
            }
        }
        final ServiceName ceiling = boundServices.ceiling(lookupName);
        if (ceiling != null && lookupName.isParentOf(ceiling)) {
            if (lookupName.equals(ceiling)) {
                //the binder service returned null
                return null;
            }
            return new NamingContext((Name) name.clone(), this, null);
        }
        throw new NameNotFoundException(name.toString() + " -- " + lookupName);
    }
    return obj;
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) NameNotFoundException(javax.naming.NameNotFoundException) ResolveResult(javax.naming.spi.ResolveResult)

Example 22 with ResolveResult

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

the class ComponentContext method p_resolveToClass.

// ------ implementations of p_ Resolver and Context methods using
// ------ corresponding c_ and c_*_nns methods
/* implementation for Resolver method */
protected ResolveResult p_resolveToClass(Name name, Class<?> contextType, Continuation cont) throws NamingException {
    if (contextType.isInstance(this)) {
        cont.setSuccess();
        return (new ResolveResult(this, name));
    }
    ResolveResult ret = null;
    HeadTail res = p_resolveIntermediate(name, cont);
    switch(res.getStatus()) {
        case TERMINAL_NNS_COMPONENT:
            Object obj = p_lookup(name, cont);
            if (!cont.isContinue() && contextType.isInstance(obj)) {
                ret = new ResolveResult(obj, _EMPTY_NAME);
            }
            break;
        case TERMINAL_COMPONENT:
            // no contextType found; return null
            cont.setSuccess();
            break;
        default:
            /* pcont already set or exception thrown */
            break;
    }
    return ret;
}
Also used : ResolveResult(javax.naming.spi.ResolveResult)

Example 23 with ResolveResult

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

the class GenericURLContext method list.

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

Example 24 with ResolveResult

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

the class GenericURLContext method rebind.

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

Example 25 with ResolveResult

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

the class GenericURLContext method getNameParser.

public NameParser getNameParser(String name) throws NamingException {
    ResolveResult res = getRootURLContext(name, myEnv);
    Context ctx = (Context) res.getResolvedObj();
    try {
        return ctx.getNameParser(res.getRemainingName());
    } 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