类javax.naming.spi.NamingManager源码实例Demo

下面列出了怎么用javax.naming.spi.NamingManager的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jdk8u-jdk   文件: PartialCompositeContext.java
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;
}
 
源代码2 项目: jdk8u-jdk   文件: RegistryContext.java
/**
 * Encodes an object prior to binding it in the registry.  First,
 * NamingManager.getStateToBind() is invoked.  If the resulting
 * object is Remote, it is returned.  If it is a Reference or
 * Referenceable, the reference is wrapped in a Remote object.
 * Otherwise, an exception is thrown.
 *
 * @param name      The object's name relative to this context.
 */
private Remote encodeObject(Object obj, Name name)
        throws NamingException, RemoteException
{
    obj = NamingManager.getStateToBind(obj, name, this, environment);

    if (obj instanceof Remote) {
        return (Remote)obj;
    }
    if (obj instanceof Reference) {
        return (new ReferenceWrapper((Reference)obj));
    }
    if (obj instanceof Referenceable) {
        return (new ReferenceWrapper(((Referenceable)obj).getReference()));
    }
    throw (new IllegalArgumentException(
            "RegistryContext: " +
            "object to bind must be Remote, Reference, or Referenceable"));
}
 
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());
    }
}
 
源代码4 项目: dragonwell8_jdk   文件: CNCtx.java
static private javax.naming.Context
    getContinuationContext(CannotProceedException cpe)
    throws NamingException {
    try {
        return NamingManager.getContinuationContext(cpe);
    } catch (CannotProceedException e) {
        java.lang.Object resObj = e.getResolvedObj();
        if (resObj instanceof Reference) {
            Reference ref = (Reference)resObj;
            RefAddr addr = ref.get("nns");
            if (addr.getContent() instanceof javax.naming.Context) {
                NamingException ne = new NameNotFoundException(
                    "No object reference bound for specified name");
                ne.setRootCause(cpe.getRootCause());
                ne.setRemainingName(cpe.getRemainingName());
                throw ne;
            }
        }
        throw e;
    }
}
 
源代码5 项目: jdk8u-jdk   文件: CNCtx.java
static private javax.naming.Context
    getContinuationContext(CannotProceedException cpe)
    throws NamingException {
    try {
        return NamingManager.getContinuationContext(cpe);
    } catch (CannotProceedException e) {
        java.lang.Object resObj = e.getResolvedObj();
        if (resObj instanceof Reference) {
            Reference ref = (Reference)resObj;
            RefAddr addr = ref.get("nns");
            if (addr.getContent() instanceof javax.naming.Context) {
                NamingException ne = new NameNotFoundException(
                    "No object reference bound for specified name");
                ne.setRootCause(cpe.getRootCause());
                ne.setRemainingName(cpe.getRemainingName());
                throw ne;
            }
        }
        throw e;
    }
}
 
源代码6 项目: hottub   文件: PartialCompositeContext.java
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());
    }
}
 
源代码7 项目: hottub   文件: PartialCompositeContext.java
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);
    }
}
 
源代码8 项目: openjdk-jdk9   文件: PartialCompositeContext.java
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;
}
 
源代码9 项目: openjdk-jdk8u   文件: PartialCompositeContext.java
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());
    }
}
 
源代码10 项目: dragonwell8_jdk   文件: PartialCompositeContext.java
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());
    }
}
 
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);
    }
}
 
源代码12 项目: jdk8u-dev-jdk   文件: RegistryContext.java
/**
 * Encodes an object prior to binding it in the registry.  First,
 * NamingManager.getStateToBind() is invoked.  If the resulting
 * object is Remote, it is returned.  If it is a Reference or
 * Referenceable, the reference is wrapped in a Remote object.
 * Otherwise, an exception is thrown.
 *
 * @param name      The object's name relative to this context.
 */
private Remote encodeObject(Object obj, Name name)
        throws NamingException, RemoteException
{
    obj = NamingManager.getStateToBind(obj, name, this, environment);

    if (obj instanceof Remote) {
        return (Remote)obj;
    }
    if (obj instanceof Reference) {
        return (new ReferenceWrapper((Reference)obj));
    }
    if (obj instanceof Referenceable) {
        return (new ReferenceWrapper(((Referenceable)obj).getReference()));
    }
    throw (new IllegalArgumentException(
            "RegistryContext: " +
            "object to bind must be Remote, Reference, or Referenceable"));
}
 
源代码13 项目: jdk8u-jdk   文件: RegistryContext.java
/**
 * Encodes an object prior to binding it in the registry.  First,
 * NamingManager.getStateToBind() is invoked.  If the resulting
 * object is Remote, it is returned.  If it is a Reference or
 * Referenceable, the reference is wrapped in a Remote object.
 * Otherwise, an exception is thrown.
 *
 * @param name      The object's name relative to this context.
 */
private Remote encodeObject(Object obj, Name name)
        throws NamingException, RemoteException
{
    obj = NamingManager.getStateToBind(obj, name, this, environment);

    if (obj instanceof Remote) {
        return (Remote)obj;
    }
    if (obj instanceof Reference) {
        return (new ReferenceWrapper((Reference)obj));
    }
    if (obj instanceof Referenceable) {
        return (new ReferenceWrapper(((Referenceable)obj).getReference()));
    }
    throw (new IllegalArgumentException(
            "RegistryContext: " +
            "object to bind must be Remote, Reference, or Referenceable"));
}
 
源代码14 项目: dragonwell8_jdk   文件: PartialCompositeContext.java
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());
    }
}
 
源代码15 项目: dragonwell8_jdk   文件: PartialCompositeContext.java
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;
}
 
源代码16 项目: openjdk-jdk9   文件: PartialCompositeContext.java
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;
}
 
源代码17 项目: TencentKona-8   文件: CNCtx.java
static private javax.naming.Context
    getContinuationContext(CannotProceedException cpe)
    throws NamingException {
    try {
        return NamingManager.getContinuationContext(cpe);
    } catch (CannotProceedException e) {
        java.lang.Object resObj = e.getResolvedObj();
        if (resObj instanceof Reference) {
            Reference ref = (Reference)resObj;
            RefAddr addr = ref.get("nns");
            if (addr.getContent() instanceof javax.naming.Context) {
                NamingException ne = new NameNotFoundException(
                    "No object reference bound for specified name");
                ne.setRootCause(cpe.getRootCause());
                ne.setRemainingName(cpe.getRemainingName());
                throw ne;
            }
        }
        throw e;
    }
}
 
源代码18 项目: TencentKona-8   文件: RegistryContext.java
/**
 * Encodes an object prior to binding it in the registry.  First,
 * NamingManager.getStateToBind() is invoked.  If the resulting
 * object is Remote, it is returned.  If it is a Reference or
 * Referenceable, the reference is wrapped in a Remote object.
 * Otherwise, an exception is thrown.
 *
 * @param name      The object's name relative to this context.
 */
private Remote encodeObject(Object obj, Name name)
        throws NamingException, RemoteException
{
    obj = NamingManager.getStateToBind(obj, name, this, environment);

    if (obj instanceof Remote) {
        return (Remote)obj;
    }
    if (obj instanceof Reference) {
        return (new ReferenceWrapper((Reference)obj));
    }
    if (obj instanceof Referenceable) {
        return (new ReferenceWrapper(((Referenceable)obj).getReference()));
    }
    throw (new IllegalArgumentException(
            "RegistryContext: " +
            "object to bind must be Remote, Reference, or Referenceable"));
}
 
源代码19 项目: TencentKona-8   文件: PartialCompositeContext.java
public void bind(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_bind(nm, newObj, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            ctx.p_bind(nm, newObj, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        cctx.bind(e.getRemainingName(), newObj);
    }
}
 
源代码20 项目: TencentKona-8   文件: PartialCompositeContext.java
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;
}
 
源代码21 项目: jdk8u_jdk   文件: PartialCompositeContext.java
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());
    }
}
 
源代码22 项目: jdk8u-jdk   文件: PartialCompositeContext.java
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;
}
 
源代码23 项目: hottub   文件: PartialCompositeContext.java
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;
}
 
源代码24 项目: openjdk-jdk8u   文件: PartialCompositeContext.java
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;
}
 
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;
}
 
源代码26 项目: jdk8u-dev-jdk   文件: PartialCompositeContext.java
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;
}
 
源代码27 项目: jdk8u60   文件: CNCtx.java
static private javax.naming.Context
    getContinuationContext(CannotProceedException cpe)
    throws NamingException {
    try {
        return NamingManager.getContinuationContext(cpe);
    } catch (CannotProceedException e) {
        java.lang.Object resObj = e.getResolvedObj();
        if (resObj instanceof Reference) {
            Reference ref = (Reference)resObj;
            RefAddr addr = ref.get("nns");
            if (addr.getContent() instanceof javax.naming.Context) {
                NamingException ne = new NameNotFoundException(
                    "No object reference bound for specified name");
                ne.setRootCause(cpe.getRootCause());
                ne.setRemainingName(cpe.getRemainingName());
                throw ne;
            }
        }
        throw e;
    }
}
 
源代码28 项目: jdk8u60   文件: RegistryContext.java
/**
 * Encodes an object prior to binding it in the registry.  First,
 * NamingManager.getStateToBind() is invoked.  If the resulting
 * object is Remote, it is returned.  If it is a Reference or
 * Referenceable, the reference is wrapped in a Remote object.
 * Otherwise, an exception is thrown.
 *
 * @param name      The object's name relative to this context.
 */
private Remote encodeObject(Object obj, Name name)
        throws NamingException, RemoteException
{
    obj = NamingManager.getStateToBind(obj, name, this, environment);

    if (obj instanceof Remote) {
        return (Remote)obj;
    }
    if (obj instanceof Reference) {
        return (new ReferenceWrapper((Reference)obj));
    }
    if (obj instanceof Referenceable) {
        return (new ReferenceWrapper(((Referenceable)obj).getReference()));
    }
    throw (new IllegalArgumentException(
            "RegistryContext: " +
            "object to bind must be Remote, Reference, or Referenceable"));
}
 
源代码29 项目: openjdk-8   文件: PartialCompositeContext.java
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;
}
 
源代码30 项目: jdk8u60   文件: PartialCompositeContext.java
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;
}
 
 类所在包
 同包方法