Java Code Examples for com.sun.jmx.remote.util.EnvHelp#mapToHashtable()

The following examples show how to use com.sun.jmx.remote.util.EnvHelp#mapToHashtable() . 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: RMIConnector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
 *       <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
 *       <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @param isIiop true if the stub is expected to be an IIOP stub.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
        boolean isIiop)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    if (isIiop)
        return narrowIIOPServer(objref);
    else
        return narrowJRMPServer(objref);
}
 
Example 2
Source File: RMIConnector.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
 *       <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
 *       <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @param isIiop true if the stub is expected to be an IIOP stub.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
        boolean isIiop)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    if (isIiop)
        return narrowIIOPServer(objref);
    else
        return narrowJRMPServer(objref);
}
 
Example 3
Source File: MapNullValuesTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private int mapToHashtableTests() {
    int errorCount = 0;
    echo("");
    echo(dashedMessage("Run MapToHashtable Tests"));
    for (int i = 0; i < maps.length; i++) {
        echo("\n>>> MapToHashtable Test [" + i + "]");
        try {
            echo("\tMap = " + maps[i]);
            Hashtable t = EnvHelp.mapToHashtable(maps[i]);
            echo("\tHashtable = " + t);
            checkContents(maps[i], t);
            echo("\tTest [" + i + "] PASSED!");
        } catch (Exception e) {
            errorCount++;
            echo("\tTest [" + i + "] FAILED!");
            e.printStackTrace(System.out);
        }
    }
    if (errorCount == 0) {
        echo("");
        echo(dashedMessage("MapToHashtable Tests PASSED!"));
    } else {
        echo("");
        echo(dashedMessage("MapToHashtable Tests FAILED!"));
    }
    return errorCount;
}
 
Example 4
Source File: RMIConnector.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
 *       <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
 *       <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @param isIiop true if the stub is expected to be an IIOP stub.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
        boolean isIiop)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    if (isIiop)
        return narrowIIOPServer(objref);
    else
        return narrowJRMPServer(objref);
}
 
Example 5
Source File: RMIConnector.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
 *       <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
 *       <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @param isIiop true if the stub is expected to be an IIOP stub.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
        boolean isIiop)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    if (isIiop)
        return narrowIIOPServer(objref);
    else
        return narrowJRMPServer(objref);
}
 
Example 6
Source File: MapNullValuesTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private int mapToHashtableTests() {
    int errorCount = 0;
    echo("");
    echo(dashedMessage("Run MapToHashtable Tests"));
    for (int i = 0; i < maps.length; i++) {
        echo("\n>>> MapToHashtable Test [" + i + "]");
        try {
            echo("\tMap = " + maps[i]);
            Hashtable t = EnvHelp.mapToHashtable(maps[i]);
            echo("\tHashtable = " + t);
            checkContents(maps[i], t);
            echo("\tTest [" + i + "] PASSED!");
        } catch (Exception e) {
            errorCount++;
            echo("\tTest [" + i + "] FAILED!");
            e.printStackTrace(System.out);
        }
    }
    if (errorCount == 0) {
        echo("");
        echo(dashedMessage("MapToHashtable Tests PASSED!"));
    } else {
        echo("");
        echo(dashedMessage("MapToHashtable Tests FAILED!"));
    }
    return errorCount;
}
 
Example 7
Source File: MapNullValuesTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private int mapToHashtableTests() {
    int errorCount = 0;
    echo("");
    echo(dashedMessage("Run MapToHashtable Tests"));
    for (int i = 0; i < maps.length; i++) {
        echo("\n>>> MapToHashtable Test [" + i + "]");
        try {
            echo("\tMap = " + maps[i]);
            Hashtable t = EnvHelp.mapToHashtable(maps[i]);
            echo("\tHashtable = " + t);
            checkContents(maps[i], t);
            echo("\tTest [" + i + "] PASSED!");
        } catch (Exception e) {
            errorCount++;
            echo("\tTest [" + i + "] FAILED!");
            e.printStackTrace(System.out);
        }
    }
    if (errorCount == 0) {
        echo("");
        echo(dashedMessage("MapToHashtable Tests PASSED!"));
    } else {
        echo("");
        echo(dashedMessage("MapToHashtable Tests FAILED!"));
    }
    return errorCount;
}
 
Example 8
Source File: MapNullValuesTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private int mapToHashtableTests() {
    int errorCount = 0;
    echo("");
    echo(dashedMessage("Run MapToHashtable Tests"));
    for (int i = 0; i < maps.length; i++) {
        echo("\n>>> MapToHashtable Test [" + i + "]");
        try {
            echo("\tMap = " + maps[i]);
            Hashtable t = EnvHelp.mapToHashtable(maps[i]);
            echo("\tHashtable = " + t);
            checkContents(maps[i], t);
            echo("\tTest [" + i + "] PASSED!");
        } catch (Exception e) {
            errorCount++;
            echo("\tTest [" + i + "] FAILED!");
            e.printStackTrace(System.out);
        }
    }
    if (errorCount == 0) {
        echo("");
        echo(dashedMessage("MapToHashtable Tests PASSED!"));
    } else {
        echo("");
        echo(dashedMessage("MapToHashtable Tests FAILED!"));
    }
    return errorCount;
}
 
Example 9
Source File: MapNullValuesTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private int mapToHashtableTests() {
    int errorCount = 0;
    echo("");
    echo(dashedMessage("Run MapToHashtable Tests"));
    for (int i = 0; i < maps.length; i++) {
        echo("\n>>> MapToHashtable Test [" + i + "]");
        try {
            echo("\tMap = " + maps[i]);
            Hashtable t = EnvHelp.mapToHashtable(maps[i]);
            echo("\tHashtable = " + t);
            checkContents(maps[i], t);
            echo("\tTest [" + i + "] PASSED!");
        } catch (Exception e) {
            errorCount++;
            echo("\tTest [" + i + "] FAILED!");
            e.printStackTrace(System.out);
        }
    }
    if (errorCount == 0) {
        echo("");
        echo(dashedMessage("MapToHashtable Tests PASSED!"));
    } else {
        echo("");
        echo(dashedMessage("MapToHashtable Tests FAILED!"));
    }
    return errorCount;
}
 
Example 10
Source File: RMIConnector.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
 *       <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
 *       <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @param isIiop true if the stub is expected to be an IIOP stub.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
        boolean isIiop)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    if (isIiop)
        return narrowIIOPServer(objref);
    else
        return narrowJRMPServer(objref);
}
 
Example 11
Source File: MapNullValuesTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private int mapToHashtableTests() {
    int errorCount = 0;
    echo("");
    echo(dashedMessage("Run MapToHashtable Tests"));
    for (int i = 0; i < maps.length; i++) {
        echo("\n>>> MapToHashtable Test [" + i + "]");
        try {
            echo("\tMap = " + maps[i]);
            Hashtable t = EnvHelp.mapToHashtable(maps[i]);
            echo("\tHashtable = " + t);
            checkContents(maps[i], t);
            echo("\tTest [" + i + "] PASSED!");
        } catch (Exception e) {
            errorCount++;
            echo("\tTest [" + i + "] FAILED!");
            e.printStackTrace(System.out);
        }
    }
    if (errorCount == 0) {
        echo("");
        echo(dashedMessage("MapToHashtable Tests PASSED!"));
    } else {
        echo("");
        echo(dashedMessage("MapToHashtable Tests FAILED!"));
    }
    return errorCount;
}
 
Example 12
Source File: RMIConnector.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
 *       <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
 *       <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @param isIiop true if the stub is expected to be an IIOP stub.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
        boolean isIiop)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    if (isIiop)
        return narrowIIOPServer(objref);
    else
        return narrowJRMPServer(objref);
}
 
Example 13
Source File: RMIConnector.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
 *       <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
 *       <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @param isIiop true if the stub is expected to be an IIOP stub.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
        boolean isIiop)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    if (isIiop)
        return narrowIIOPServer(objref);
    else
        return narrowJRMPServer(objref);
}
 
Example 14
Source File: MapNullValuesTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private int mapToHashtableTests() {
    int errorCount = 0;
    echo("");
    echo(dashedMessage("Run MapToHashtable Tests"));
    for (int i = 0; i < maps.length; i++) {
        echo("\n>>> MapToHashtable Test [" + i + "]");
        try {
            echo("\tMap = " + maps[i]);
            Hashtable t = EnvHelp.mapToHashtable(maps[i]);
            echo("\tHashtable = " + t);
            checkContents(maps[i], t);
            echo("\tTest [" + i + "] PASSED!");
        } catch (Exception e) {
            errorCount++;
            echo("\tTest [" + i + "] FAILED!");
            e.printStackTrace(System.out);
        }
    }
    if (errorCount == 0) {
        echo("");
        echo(dashedMessage("MapToHashtable Tests PASSED!"));
    } else {
        echo("");
        echo(dashedMessage("MapToHashtable Tests FAILED!"));
    }
    return errorCount;
}
 
Example 15
Source File: RMIConnector.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
 *       <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
 *       <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @param isIiop true if the stub is expected to be an IIOP stub.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
        boolean isIiop)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    if (isIiop)
        return narrowIIOPServer(objref);
    else
        return narrowJRMPServer(objref);
}
 
Example 16
Source File: RMIConnector.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
 *       <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
 *       <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @param isIiop true if the stub is expected to be an IIOP stub.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
        boolean isIiop)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    if (isIiop)
        return narrowIIOPServer(objref);
    else
        return narrowJRMPServer(objref);
}
 
Example 17
Source File: RMIConnector.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
 *       <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
 *       <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @param isIiop true if the stub is expected to be an IIOP stub.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
        boolean isIiop)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    if (isIiop)
        return narrowIIOPServer(objref);
    else
        return narrowJRMPServer(objref);
}
 
Example 18
Source File: MapNullValuesTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private int mapToHashtableTests() {
    int errorCount = 0;
    echo("");
    echo(dashedMessage("Run MapToHashtable Tests"));
    for (int i = 0; i < maps.length; i++) {
        echo("\n>>> MapToHashtable Test [" + i + "]");
        try {
            echo("\tMap = " + maps[i]);
            Hashtable t = EnvHelp.mapToHashtable(maps[i]);
            echo("\tHashtable = " + t);
            checkContents(maps[i], t);
            echo("\tTest [" + i + "] PASSED!");
        } catch (Exception e) {
            errorCount++;
            echo("\tTest [" + i + "] FAILED!");
            e.printStackTrace(System.out);
        }
    }
    if (errorCount == 0) {
        echo("");
        echo(dashedMessage("MapToHashtable Tests PASSED!"));
    } else {
        echo("");
        echo(dashedMessage("MapToHashtable Tests FAILED!"));
    }
    return errorCount;
}
 
Example 19
Source File: RMIConnector.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
 *       <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
 *       <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @param isIiop true if the stub is expected to be an IIOP stub.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env,
        boolean isIiop)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    if (isIiop)
        return narrowIIOPServer(objref);
    else
        return narrowJRMPServer(objref);
}
 
Example 20
Source File: RMIConnector.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Lookup the RMIServer stub in a directory.
 * @param jndiURL A JNDI URL indicating the location of the Stub
 *                (see {@link javax.management.remote.rmi}), e.g.:
 *   <ul><li>{@code rmi://registry-host:port/rmi-stub-name}</li>
 *       <li>or {@code ldap://ldap-host:port/java-container-dn}</li>
 *   </ul>
 * @param env the environment Map passed to the connector.
 * @return The retrieved RMIServer stub.
 * @exception NamingException if the stub couldn't be found.
 **/
private RMIServer findRMIServerJNDI(String jndiURL, Map<String, ?> env)
        throws NamingException {

    InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env));

    Object objref = ctx.lookup(jndiURL);
    ctx.close();

    return narrowJRMPServer(objref);
}