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;
}
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;
}
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();
}
}
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();
}
}
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();
}
}
Aggregations