use of javax.naming.spi.ResolveResult in project jdk8u_jdk by JetBrains.
the class GenericURLContext method createSubcontext.
public Context createSubcontext(String name) throws NamingException {
ResolveResult res = getRootURLContext(name, myEnv);
Context ctx = (Context) res.getResolvedObj();
try {
return ctx.createSubcontext(res.getRemainingName());
} finally {
ctx.close();
}
}
use of javax.naming.spi.ResolveResult in project jdk8u_jdk by JetBrains.
the class GenericURLContext method bind.
public void bind(String name, Object obj) throws NamingException {
ResolveResult res = getRootURLContext(name, myEnv);
Context ctx = (Context) res.getResolvedObj();
try {
ctx.bind(res.getRemainingName(), obj);
} finally {
ctx.close();
}
}
use of javax.naming.spi.ResolveResult in project jdk8u_jdk by JetBrains.
the class GenericURLContext method unbind.
public void unbind(String name) throws NamingException {
ResolveResult res = getRootURLContext(name, myEnv);
Context ctx = (Context) res.getResolvedObj();
try {
ctx.unbind(res.getRemainingName());
} finally {
ctx.close();
}
}
use of javax.naming.spi.ResolveResult in project jdk8u_jdk by JetBrains.
the class GenericURLContext method listBindings.
public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
ResolveResult res = getRootURLContext(name, myEnv);
Context ctx = (Context) res.getResolvedObj();
try {
return ctx.listBindings(res.getRemainingName());
} finally {
ctx.close();
}
}
use of javax.naming.spi.ResolveResult in project wildfly by wildfly.
the class NamingContext method lookup.
public Object lookup(final Name name, boolean dereference) throws NamingException {
check(name, JndiPermission.ACTION_LOOKUP);
if (isEmpty(name)) {
return new NamingContext(prefix, namingStore, environment);
}
final Name absoluteName = getAbsoluteName(name);
Object result;
try {
result = namingStore.lookup(absoluteName, dereference);
} catch (CannotProceedException cpe) {
final Context continuationContext = NamingManager.getContinuationContext(cpe);
if (continuationContext instanceof NamingContext) {
result = ((NamingContext) continuationContext).lookup(cpe.getRemainingName(), dereference);
} else {
result = continuationContext.lookup(cpe.getRemainingName());
}
}
if (result instanceof ResolveResult) {
final ResolveResult resolveResult = (ResolveResult) result;
final Object resolvedObject = resolveResult.getResolvedObj();
Object context;
if (resolvedObject instanceof Context) {
context = resolvedObject;
} else if (resolvedObject instanceof LinkRef) {
context = resolveLink(resolvedObject, dereference);
} else {
context = getObjectInstance(resolvedObject, absoluteName, environment);
}
if (!(context instanceof Context)) {
throw notAContextException(absoluteName.getPrefix(absoluteName.size() - resolveResult.getRemainingName().size()));
}
final Context namingContext = (Context) context;
if (namingContext instanceof NamingContext) {
return ((NamingContext) namingContext).lookup(resolveResult.getRemainingName(), dereference);
} else {
return namingContext.lookup(resolveResult.getRemainingName());
}
} else if (result instanceof LinkRef) {
result = resolveLink(result, dereference);
} else if (result instanceof Reference) {
result = getObjectInstance(result, absoluteName, environment);
if (result instanceof LinkRef) {
result = resolveLink(result, dereference);
}
}
return result;
}
Aggregations