Java 类javax.naming.spi.ResolveResult 实例源码

项目:OpenJSharp    文件:CNCtx.java   
/**
 * This method is used by the iiop and iiopname URL Context factories.
 */
@SuppressWarnings("unchecked")
public static ResolveResult createUsingURL(String url, Hashtable<?,?> env)
throws NamingException {
    CNCtx ctx = new CNCtx();
    if (env != null) {
        env = (Hashtable<?,?>) env.clone();
    }
    ctx._env = (Hashtable<String, java.lang.Object>)env;
    String rest = ctx.initUsingUrl(
        env != null ?
            (org.omg.CORBA.ORB) env.get("java.naming.corba.orb")
            : null,
        url, env);

    // rest is the INS name
    // Return the parsed form to prevent subsequent lookup
    // from parsing the string as a composite name
    // The caller should be aware that a toString() of the name,
    // which came from the environment will yield its INS syntax,
    // rather than a composite syntax
    return new ResolveResult(ctx, parser.parse(rest));
}
项目:OpenJSharp    文件:dnsURLContext.java   
/**
 * Resolves the host and port of "url" to a root context connected
 * to the named DNS server, and returns the domain name as the
 * remaining name.
 */
protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env)
        throws NamingException {

    DnsUrl dnsUrl;
    try {
        dnsUrl = new DnsUrl(url);
    } catch (MalformedURLException e) {
        throw new InvalidNameException(e.getMessage());
    }

    DnsUrl[] urls = new DnsUrl[] { dnsUrl };
    String domain = dnsUrl.getDomain();

    return new ResolveResult(
            DnsContextFactory.getContext(".", urls, env),
            new CompositeName().add(domain));
}
项目:OpenJSharp    文件:GenericURLContext.java   
public void rename(String oldName, String newName) throws NamingException {
    String oldPrefix = getURLPrefix(oldName);
    String newPrefix = getURLPrefix(newName);
    if (!urlEquals(oldPrefix, newPrefix)) {
        throw new OperationNotSupportedException(
            "Renaming using different URL prefixes not supported : " +
            oldName + " " + newName);
    }

    ResolveResult res = getRootURLContext(oldName, myEnv);
    Context ctx = (Context)res.getResolvedObj();
    try {
        ctx.rename(res.getRemainingName(), getURLSuffix(newPrefix, newName));
    } finally {
        ctx.close();
    }
}
项目:jdk8u-jdk    文件:CNCtx.java   
/**
 * This method is used by the iiop and iiopname URL Context factories.
 */
@SuppressWarnings("unchecked")
public static ResolveResult createUsingURL(String url, Hashtable<?,?> env)
throws NamingException {
    CNCtx ctx = new CNCtx();
    if (env != null) {
        env = (Hashtable<?,?>) env.clone();
    }
    ctx._env = (Hashtable<String, java.lang.Object>)env;
    String rest = ctx.initUsingUrl(
        env != null ?
            (org.omg.CORBA.ORB) env.get("java.naming.corba.orb")
            : null,
        url, env);

    // rest is the INS name
    // Return the parsed form to prevent subsequent lookup
    // from parsing the string as a composite name
    // The caller should be aware that a toString() of the name,
    // which came from the environment will yield its INS syntax,
    // rather than a composite syntax
    return new ResolveResult(ctx, parser.parse(rest));
}
项目:jdk8u-jdk    文件:dnsURLContext.java   
/**
 * Resolves the host and port of "url" to a root context connected
 * to the named DNS server, and returns the domain name as the
 * remaining name.
 */
protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env)
        throws NamingException {

    DnsUrl dnsUrl;
    try {
        dnsUrl = new DnsUrl(url);
    } catch (MalformedURLException e) {
        throw new InvalidNameException(e.getMessage());
    }

    DnsUrl[] urls = new DnsUrl[] { dnsUrl };
    String domain = dnsUrl.getDomain();

    return new ResolveResult(
            DnsContextFactory.getContext(".", urls, env),
            new CompositeName().add(domain));
}
项目:openjdk-jdk10    文件:GenericURLContext.java   
public void rename(String oldName, String newName) throws NamingException {
    String oldPrefix = getURLPrefix(oldName);
    String newPrefix = getURLPrefix(newName);
    if (!urlEquals(oldPrefix, newPrefix)) {
        throw new OperationNotSupportedException(
            "Renaming using different URL prefixes not supported : " +
            oldName + " " + newName);
    }

    ResolveResult res = getRootURLContext(oldName, myEnv);
    Context ctx = (Context)res.getResolvedObj();
    try {
        ctx.rename(res.getRemainingName(), getURLSuffix(newPrefix, newName));
    } finally {
        ctx.close();
    }
}
项目:jdk8u-jdk    文件:GenericURLContext.java   
public void rename(String oldName, String newName) throws NamingException {
    String oldPrefix = getURLPrefix(oldName);
    String newPrefix = getURLPrefix(newName);
    if (!urlEquals(oldPrefix, newPrefix)) {
        throw new OperationNotSupportedException(
            "Renaming using different URL prefixes not supported : " +
            oldName + " " + newName);
    }

    ResolveResult res = getRootURLContext(oldName, myEnv);
    Context ctx = (Context)res.getResolvedObj();
    try {
        ctx.rename(res.getRemainingName(), getURLSuffix(newPrefix, newName));
    } finally {
        ctx.close();
    }
}
项目:openjdk-jdk10    文件:CNCtx.java   
/**
 * This method is used by the iiop and iiopname URL Context factories.
 */
@SuppressWarnings("unchecked")
public static ResolveResult createUsingURL(String url, Hashtable<?,?> env)
throws NamingException {
    CNCtx ctx = new CNCtx();
    if (env != null) {
        env = (Hashtable<?,?>) env.clone();
    }
    ctx._env = (Hashtable<String, java.lang.Object>)env;
    String rest = ctx.initUsingUrl(
        env != null ?
            (org.omg.CORBA.ORB) env.get("java.naming.corba.orb")
            : null,
        url, env);

    // rest is the INS name
    // Return the parsed form to prevent subsequent lookup
    // from parsing the string as a composite name
    // The caller should be aware that a toString() of the name,
    // which came from the environment will yield its INS syntax,
    // rather than a composite syntax
    return new ResolveResult(ctx, parser.parse(rest));
}
项目:openjdk-jdk10    文件:GenericURLContext.java   
public void rename(String oldName, String newName) throws NamingException {
    String oldPrefix = getURLPrefix(oldName);
    String newPrefix = getURLPrefix(newName);
    if (!urlEquals(oldPrefix, newPrefix)) {
        throw new OperationNotSupportedException(
                "Renaming using different URL prefixes not supported : " +
                        oldName + " " + newName);
    }

    ResolveResult res = getRootURLContext(oldName, myEnv);
    Context ctx = (Context)res.getResolvedObj();
    try {
        ctx.rename(res.getRemainingName(), getURLSuffix(newPrefix, newName));
    } finally {
        ctx.close();
    }
}
项目:openjdk-jdk10    文件:dnsURLContext.java   
/**
 * Resolves the host and port of "url" to a root context connected
 * to the named DNS server, and returns the domain name as the
 * remaining name.
 */
protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env)
        throws NamingException {

    DnsUrl dnsUrl;
    try {
        dnsUrl = new DnsUrl(url);
    } catch (MalformedURLException e) {
        throw new InvalidNameException(e.getMessage());
    }

    DnsUrl[] urls = new DnsUrl[] { dnsUrl };
    String domain = dnsUrl.getDomain();

    return new ResolveResult(
            DnsContextFactory.getContext(".", urls, env),
            new CompositeName().add(domain));
}
项目:openjdk-jdk10    文件:GenericURLContext.java   
public Object lookup(String name) throws NamingException {
    ResolveResult res = getRootURLContext(name, myEnv);
    Context ctx = (Context)res.getResolvedObj();
    try {
        return ctx.lookup(res.getRemainingName());
    } finally {
        ctx.close();
    }
}
项目:OpenJSharp    文件:GenericURLDirContext.java   
public Attributes getAttributes(String name) throws NamingException {
    ResolveResult res = getRootURLContext(name, myEnv);
    DirContext ctx = (DirContext)res.getResolvedObj();
    try {
        return ctx.getAttributes(res.getRemainingName());
    } finally {
        ctx.close();
    }
}
项目:openjdk-jdk10    文件:GenericURLContext.java   
public void destroySubcontext(String name) throws NamingException {
    ResolveResult res = getRootURLContext(name, myEnv);
    Context ctx = (Context)res.getResolvedObj();
    try {
        ctx.destroySubcontext(res.getRemainingName());
    } finally {
        ctx.close();
    }
}
项目:OpenJSharp    文件:GenericURLDirContext.java   
public void modifyAttributes(String name, int mod_op, Attributes attrs)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            ctx.modifyAttributes(res.getRemainingName(), mod_op, attrs);
        } finally {
            ctx.close();
        }
}
项目:OpenJSharp    文件:GenericURLDirContext.java   
public void modifyAttributes(String name, ModificationItem[] mods)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            ctx.modifyAttributes(res.getRemainingName(), mods);
        } finally {
            ctx.close();
        }
}
项目:OpenJSharp    文件:GenericURLDirContext.java   
public void bind(String name, Object obj, Attributes attrs)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            ctx.bind(res.getRemainingName(), obj, attrs);
        } finally {
            ctx.close();
        }
}
项目:openjdk-jdk10    文件:GenericURLContext.java   
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();
    }
}
项目:OpenJSharp    文件:GenericURLDirContext.java   
public DirContext createSubcontext(String name, Attributes attrs)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            return ctx.createSubcontext(res.getRemainingName(), attrs);
        } finally {
            ctx.close();
        }
}
项目:OpenJSharp    文件:GenericURLDirContext.java   
public DirContext getSchemaClassDefinition(String name)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            return ctx.getSchemaClassDefinition(res.getRemainingName());
        } finally {
            ctx.close();
        }
}
项目:OpenJSharp    文件:GenericURLDirContext.java   
public NamingEnumeration<SearchResult> search(String name,
    Attributes matchingAttributes)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            return ctx.search(res.getRemainingName(), matchingAttributes);
        } finally {
            ctx.close();
        }
}
项目:OpenJSharp    文件:GenericURLDirContext.java   
public NamingEnumeration<SearchResult> search(String name,
    Attributes matchingAttributes,
    String[] attributesToReturn)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            return ctx.search(res.getRemainingName(),
                matchingAttributes, attributesToReturn);
        } finally {
            ctx.close();
        }
}
项目:OpenJSharp    文件:GenericURLDirContext.java   
public NamingEnumeration<SearchResult> search(String name,
    String filter,
    SearchControls cons)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            return ctx.search(res.getRemainingName(), filter, cons);
        } finally {
            ctx.close();
        }
}
项目:OpenJSharp    文件:GenericURLDirContext.java   
public NamingEnumeration<SearchResult> search(String name,
    String filterExpr,
    Object[] filterArgs,
    SearchControls cons)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            return
                ctx.search(res.getRemainingName(), filterExpr, filterArgs, cons);
        } finally {
            ctx.close();
        }
}
项目:OpenJSharp    文件:GenericURLContext.java   
public Object lookup(String name) throws NamingException {
    ResolveResult res = getRootURLContext(name, myEnv);
    Context ctx = (Context)res.getResolvedObj();
    try {
        return ctx.lookup(res.getRemainingName());
    } finally {
        ctx.close();
    }
}
项目:OpenJSharp    文件:GenericURLContext.java   
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();
    }
}
项目:OpenJSharp    文件:GenericURLContext.java   
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();
    }
}
项目:OpenJSharp    文件:GenericURLContext.java   
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();
    }
}
项目:OpenJSharp    文件:GenericURLContext.java   
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();
    }
}
项目:OpenJSharp    文件:GenericURLContext.java   
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();
    }
}
项目:OpenJSharp    文件:GenericURLContext.java   
public void destroySubcontext(String name) throws NamingException {
    ResolveResult res = getRootURLContext(name, myEnv);
    Context ctx = (Context)res.getResolvedObj();
    try {
        ctx.destroySubcontext(res.getRemainingName());
    } finally {
        ctx.close();
    }
}
项目:OpenJSharp    文件:GenericURLContext.java   
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();
    }
}
项目:OpenJSharp    文件:GenericURLContext.java   
public Object lookupLink(String name) throws NamingException {
    ResolveResult res = getRootURLContext(name, myEnv);
    Context ctx = (Context)res.getResolvedObj();
    try {
        return ctx.lookupLink(res.getRemainingName());
    } finally {
        ctx.close();
    }
}
项目:OpenJSharp    文件:GenericURLContext.java   
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();
    }
}
项目:OpenJSharp    文件:PartialCompositeContext.java   
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;
}
项目:jdk8u-jdk    文件:ldapURLContext.java   
private NamingEnumeration<SearchResult> searchUsingURL(String name)
    throws NamingException {

    LdapURL url = new LdapURL(name);

    ResolveResult res = getRootURLContext(name, myEnv);
    DirContext ctx = (DirContext)res.getResolvedObj();
    try {
        return ctx.search(res.getRemainingName(),
                          setFilterUsingURL(url),
                          setSearchControlsUsingURL(url));
    } finally {
        ctx.close();
    }
}
项目:openjdk-jdk10    文件:GenericURLContext.java   
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();
    }
}
项目:jdk8u-jdk    文件:GenericURLDirContext.java   
public Attributes getAttributes(String name, String[] attrIds)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            return ctx.getAttributes(res.getRemainingName(), attrIds);
        } finally {
            ctx.close();
        }
}
项目:jdk8u-jdk    文件:GenericURLDirContext.java   
public void modifyAttributes(String name, int mod_op, Attributes attrs)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            ctx.modifyAttributes(res.getRemainingName(), mod_op, attrs);
        } finally {
            ctx.close();
        }
}
项目:jdk8u-jdk    文件:GenericURLDirContext.java   
public void modifyAttributes(String name, ModificationItem[] mods)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            ctx.modifyAttributes(res.getRemainingName(), mods);
        } finally {
            ctx.close();
        }
}
项目:jdk8u-jdk    文件:GenericURLDirContext.java   
public void bind(String name, Object obj, Attributes attrs)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            ctx.bind(res.getRemainingName(), obj, attrs);
        } finally {
            ctx.close();
        }
}