javax.naming.spi.ResolveResult Java Examples

The following examples show how to use javax.naming.spi.ResolveResult. 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: dnsURLContext.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #2
Source File: GenericURLContext.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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();
    }
}
 
Example #3
Source File: GenericURLContext.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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();
    }
}
 
Example #4
Source File: GenericURLContext.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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();
    }
}
 
Example #5
Source File: CNCtx.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #6
Source File: CNCtx.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #7
Source File: GenericURLDirContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #8
Source File: GenericURLContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #9
Source File: GenericURLDirContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #10
Source File: GenericURLContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #11
Source File: GenericURLContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #12
Source File: GenericURLContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #13
Source File: GenericURLDirContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #14
Source File: GenericURLContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #15
Source File: GenericURLDirContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #16
Source File: GenericURLContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #17
Source File: GenericURLDirContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #18
Source File: GenericURLDirContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #19
Source File: GenericURLDirContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #20
Source File: GenericURLDirContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #21
Source File: GenericURLDirContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #22
Source File: GenericURLContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #23
Source File: GenericURLDirContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #24
Source File: GenericURLDirContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #25
Source File: GenericURLDirContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #26
Source File: GenericURLDirContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #27
Source File: GenericURLDirContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void rebind(String name, Object obj, Attributes attrs)
    throws NamingException {
        ResolveResult res = getRootURLContext(name, myEnv);
        DirContext ctx = (DirContext)res.getResolvedObj();
        try {
            ctx.rebind(res.getRemainingName(), obj, attrs);
        } finally {
            ctx.close();
        }
}
 
Example #28
Source File: GenericURLContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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();
    }
}
 
Example #29
Source File: GenericURLDirContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}
 
Example #30
Source File: GenericURLDirContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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();
        }
}