Java Code Examples for javax.naming.spi.NamingManager#getContinuationContext()

The following examples show how to use javax.naming.spi.NamingManager#getContinuationContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PartialCompositeContext.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public NamingEnumeration<NameClassPair> list(Name name)
    throws NamingException
{
    PartialCompositeContext ctx = this;
    Name nm = name;
    NamingEnumeration<NameClassPair> answer;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        answer = ctx.p_list(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_list(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        answer = cctx.list(e.getRemainingName());
    }
    return answer;
}
 
Example 2
Source File: PartialCompositeContext.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void destroySubcontext(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Name nm = name;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        ctx.p_destroySubcontext(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            ctx.p_destroySubcontext(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        cctx.destroySubcontext(e.getRemainingName());
    }
}
 
Example 3
Source File: PartialCompositeContext.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void rebind(Name name, Object newObj) throws NamingException {
    PartialCompositeContext ctx = this;
    Name nm = name;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        ctx.p_rebind(nm, newObj, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            ctx.p_rebind(nm, newObj, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        cctx.rebind(e.getRemainingName(), newObj);
    }
}
 
Example 4
Source File: PartialCompositeContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void destroySubcontext(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Name nm = name;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        ctx.p_destroySubcontext(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            ctx.p_destroySubcontext(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        cctx.destroySubcontext(e.getRemainingName());
    }
}
 
Example 5
Source File: PartialCompositeContext.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Object lookup(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);
    Object answer;
    Name nm = name;

    try {
        answer = ctx.p_lookup(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_lookup(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        answer = cctx.lookup(e.getRemainingName());
    }
    return answer;
}
 
Example 6
Source File: PartialCompositeContext.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public NameParser getNameParser(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Name nm = name;
    NameParser answer;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        answer = ctx.p_getNameParser(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_getNameParser(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        answer = cctx.getNameParser(e.getRemainingName());
    }
    return answer;
}
 
Example 7
Source File: PartialCompositeContext.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public NamingEnumeration<NameClassPair> list(Name name)
    throws NamingException
{
    PartialCompositeContext ctx = this;
    Name nm = name;
    NamingEnumeration<NameClassPair> answer;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        answer = ctx.p_list(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_list(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        answer = cctx.list(e.getRemainingName());
    }
    return answer;
}
 
Example 8
Source File: PartialCompositeContext.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void destroySubcontext(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Name nm = name;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        ctx.p_destroySubcontext(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            ctx.p_destroySubcontext(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        cctx.destroySubcontext(e.getRemainingName());
    }
}
 
Example 9
Source File: PartialCompositeContext.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void rebind(Name name, Object newObj) throws NamingException {
    PartialCompositeContext ctx = this;
    Name nm = name;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        ctx.p_rebind(nm, newObj, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            ctx.p_rebind(nm, newObj, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        cctx.rebind(e.getRemainingName(), newObj);
    }
}
 
Example 10
Source File: PartialCompositeContext.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Object lookupLink(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);
    Object answer;
    Name nm = name;

    try {
        answer = ctx.p_lookupLink(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_lookupLink(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        answer = cctx.lookupLink(e.getRemainingName());
    }
    return answer;
}
 
Example 11
Source File: PartialCompositeContext.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public Object lookupLink(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);
    Object answer;
    Name nm = name;

    try {
        answer = ctx.p_lookupLink(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_lookupLink(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        answer = cctx.lookupLink(e.getRemainingName());
    }
    return answer;
}
 
Example 12
Source File: PartialCompositeContext.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public void rebind(Name name, Object newObj) throws NamingException {
    PartialCompositeContext ctx = this;
    Name nm = name;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        ctx.p_rebind(nm, newObj, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            ctx.p_rebind(nm, newObj, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        cctx.rebind(e.getRemainingName(), newObj);
    }
}
 
Example 13
Source File: PartialCompositeContext.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public NamingEnumeration<Binding> listBindings(Name name)
    throws NamingException
{
    PartialCompositeContext ctx = this;
    Name nm = name;
    NamingEnumeration<Binding> answer;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        answer = ctx.p_listBindings(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_listBindings(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        answer = cctx.listBindings(e.getRemainingName());
    }
    return answer;
}
 
Example 14
Source File: PartialCompositeContext.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void unbind(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Name nm = name;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        ctx.p_unbind(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            ctx.p_unbind(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        cctx.unbind(e.getRemainingName());
    }
}
 
Example 15
Source File: PartialCompositeContext.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public Context createSubcontext(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Name nm = name;
    Context answer;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        answer = ctx.p_createSubcontext(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_createSubcontext(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        answer = cctx.createSubcontext(e.getRemainingName());
    }
    return answer;
}
 
Example 16
Source File: PartialCompositeContext.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void rename(Name oldName, Name newName)
    throws NamingException
{
    PartialCompositeContext ctx = this;
    Name nm = oldName;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(oldName, env);

    try {
        ctx.p_rename(nm, newName, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            ctx.p_rename(nm, newName, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        if (e.getRemainingNewName() != null) {
            // %%% e.getRemainingNewName() should never be null
            newName = e.getRemainingNewName();
        }
        cctx.rename(e.getRemainingName(), newName);
    }
}
 
Example 17
Source File: PartialCompositeContext.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 18
Source File: PartialCompositeContext.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 19
Source File: GenericURLContext.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Gets the context in which to continue the operation. This method
 * is called when this context is asked to process a multicomponent
 * Name in which the first component is a URL.
 * Treat the first component like a junction: resolve it and then use
 * NamingManager.getContinuationContext() to get the target context in
 * which to operate on the remainder of the name (n.getSuffix(1)).
 */
protected Context getContinuationContext(Name n) throws NamingException {
    Object obj = lookup(n.get(0));
    CannotProceedException cpe = new CannotProceedException();
    cpe.setResolvedObj(obj);
    cpe.setEnvironment(myEnv);
    return NamingManager.getContinuationContext(cpe);
}
 
Example 20
Source File: GenericURLContext.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Gets the context in which to continue the operation. This method
 * is called when this context is asked to process a multicomponent
 * Name in which the first component is a URL.
 * Treat the first component like a junction: resolve it and then use
 * NamingManager.getContinuationContext() to get the target context in
 * which to operate on the remainder of the name (n.getSuffix(1)).
 */
protected Context getContinuationContext(Name n) throws NamingException {
    Object obj = lookup(n.get(0));
    CannotProceedException cpe = new CannotProceedException();
    cpe.setResolvedObj(obj);
    cpe.setEnvironment(myEnv);
    return NamingManager.getContinuationContext(cpe);
}