Java Code Examples for com.sun.jmx.mbeanserver.Util#newObjectName()

The following examples show how to use com.sun.jmx.mbeanserver.Util#newObjectName() . 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: DefaultMBeanServerInterceptor.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public String[] getDomains()  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        // Check if the caller has the right to invoke 'getDomains'
        //
        checkMBeanPermission((String) null, null, null, "getDomains");

        // Return domains
        //
        String[] domains = repository.getDomains();

        // Check if the caller has the right to invoke 'getDomains'
        // on each specific domain in the list.
        //
        List<String> result = new ArrayList<String>(domains.length);
        for (int i = 0; i < domains.length; i++) {
            try {
                ObjectName dom = Util.newObjectName(domains[i] + ":x=x");
                checkMBeanPermission((String) null, null, dom, "getDomains");
                result.add(domains[i]);
            } catch (SecurityException e) {
                // OK: Do not add this domain to the list
            }
        }

        // Make an array from result.
        //
        return result.toArray(new String[result.size()]);
    } else {
        return repository.getDomains();
    }
}
 
Example 2
Source File: DefaultMBeanServerInterceptor.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private ObjectName nonDefaultDomain(ObjectName name) {
    if (name == null || name.getDomain().length() > 0)
        return name;

    /* The ObjectName looks like ":a=b", and that's what its
       toString() will return in this implementation.  So
       we can just stick the default domain in front of it
       to get a non-default-domain name.  We depend on the
       fact that toString() works like that and that it
       leaves wildcards in place (so we can detect an error
       if one is supplied where it shouldn't be).  */
    final String completeName = domain + name;

    return Util.newObjectName(completeName);
}
 
Example 3
Source File: DefaultMBeanServerInterceptor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public String[] getDomains()  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        // Check if the caller has the right to invoke 'getDomains'
        //
        checkMBeanPermission((String) null, null, null, "getDomains");

        // Return domains
        //
        String[] domains = repository.getDomains();

        // Check if the caller has the right to invoke 'getDomains'
        // on each specific domain in the list.
        //
        List<String> result = new ArrayList<String>(domains.length);
        for (int i = 0; i < domains.length; i++) {
            try {
                ObjectName dom = Util.newObjectName(domains[i] + ":x=x");
                checkMBeanPermission((String) null, null, dom, "getDomains");
                result.add(domains[i]);
            } catch (SecurityException e) {
                // OK: Do not add this domain to the list
            }
        }

        // Make an array from result.
        //
        return result.toArray(new String[result.size()]);
    } else {
        return repository.getDomains();
    }
}
 
Example 4
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private ObjectName nonDefaultDomain(ObjectName name) {
    if (name == null || name.getDomain().length() > 0)
        return name;

    /* The ObjectName looks like ":a=b", and that's what its
       toString() will return in this implementation.  So
       we can just stick the default domain in front of it
       to get a non-default-domain name.  We depend on the
       fact that toString() works like that and that it
       leaves wildcards in place (so we can detect an error
       if one is supplied where it shouldn't be).  */
    final String completeName = domain + name;

    return Util.newObjectName(completeName);
}
 
Example 5
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public String[] getDomains()  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        // Check if the caller has the right to invoke 'getDomains'
        //
        checkMBeanPermission((String) null, null, null, "getDomains");

        // Return domains
        //
        String[] domains = repository.getDomains();

        // Check if the caller has the right to invoke 'getDomains'
        // on each specific domain in the list.
        //
        List<String> result = new ArrayList<String>(domains.length);
        for (int i = 0; i < domains.length; i++) {
            try {
                ObjectName dom = Util.newObjectName(domains[i] + ":x=x");
                checkMBeanPermission((String) null, null, dom, "getDomains");
                result.add(domains[i]);
            } catch (SecurityException e) {
                // OK: Do not add this domain to the list
            }
        }

        // Make an array from result.
        //
        return result.toArray(new String[result.size()]);
    } else {
        return repository.getDomains();
    }
}
 
Example 6
Source File: DefaultMBeanServerInterceptor.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public String[] getDomains()  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        // Check if the caller has the right to invoke 'getDomains'
        //
        checkMBeanPermission((String) null, null, null, "getDomains");

        // Return domains
        //
        String[] domains = repository.getDomains();

        // Check if the caller has the right to invoke 'getDomains'
        // on each specific domain in the list.
        //
        List<String> result = new ArrayList<String>(domains.length);
        for (int i = 0; i < domains.length; i++) {
            try {
                ObjectName dom = Util.newObjectName(domains[i] + ":x=x");
                checkMBeanPermission((String) null, null, dom, "getDomains");
                result.add(domains[i]);
            } catch (SecurityException e) {
                // OK: Do not add this domain to the list
            }
        }

        // Make an array from result.
        //
        return result.toArray(new String[result.size()]);
    } else {
        return repository.getDomains();
    }
}
 
Example 7
Source File: DefaultMBeanServerInterceptor.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public String[] getDomains()  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        // Check if the caller has the right to invoke 'getDomains'
        //
        checkMBeanPermission((String) null, null, null, "getDomains");

        // Return domains
        //
        String[] domains = repository.getDomains();

        // Check if the caller has the right to invoke 'getDomains'
        // on each specific domain in the list.
        //
        List<String> result = new ArrayList<String>(domains.length);
        for (int i = 0; i < domains.length; i++) {
            try {
                ObjectName dom = Util.newObjectName(domains[i] + ":x=x");
                checkMBeanPermission((String) null, null, dom, "getDomains");
                result.add(domains[i]);
            } catch (SecurityException e) {
                // OK: Do not add this domain to the list
            }
        }

        // Make an array from result.
        //
        return result.toArray(new String[result.size()]);
    } else {
        return repository.getDomains();
    }
}
 
Example 8
Source File: DefaultMBeanServerInterceptor.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private ObjectName nonDefaultDomain(ObjectName name) {
    if (name == null || name.getDomain().length() > 0)
        return name;

    /* The ObjectName looks like ":a=b", and that's what its
       toString() will return in this implementation.  So
       we can just stick the default domain in front of it
       to get a non-default-domain name.  We depend on the
       fact that toString() works like that and that it
       leaves wildcards in place (so we can detect an error
       if one is supplied where it shouldn't be).  */
    final String completeName = domain + name;

    return Util.newObjectName(completeName);
}
 
Example 9
Source File: DefaultMBeanServerInterceptor.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public String[] getDomains()  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        // Check if the caller has the right to invoke 'getDomains'
        //
        checkMBeanPermission((String) null, null, null, "getDomains");

        // Return domains
        //
        String[] domains = repository.getDomains();

        // Check if the caller has the right to invoke 'getDomains'
        // on each specific domain in the list.
        //
        List<String> result = new ArrayList<String>(domains.length);
        for (int i = 0; i < domains.length; i++) {
            try {
                ObjectName dom = Util.newObjectName(domains[i] + ":x=x");
                checkMBeanPermission((String) null, null, dom, "getDomains");
                result.add(domains[i]);
            } catch (SecurityException e) {
                // OK: Do not add this domain to the list
            }
        }

        // Make an array from result.
        //
        return result.toArray(new String[result.size()]);
    } else {
        return repository.getDomains();
    }
}
 
Example 10
Source File: DefaultMBeanServerInterceptor.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public String[] getDomains()  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        // Check if the caller has the right to invoke 'getDomains'
        //
        checkMBeanPermission((String) null, null, null, "getDomains");

        // Return domains
        //
        String[] domains = repository.getDomains();

        // Check if the caller has the right to invoke 'getDomains'
        // on each specific domain in the list.
        //
        List<String> result = new ArrayList<String>(domains.length);
        for (int i = 0; i < domains.length; i++) {
            try {
                ObjectName dom = Util.newObjectName(domains[i] + ":x=x");
                checkMBeanPermission((String) null, null, dom, "getDomains");
                result.add(domains[i]);
            } catch (SecurityException e) {
                // OK: Do not add this domain to the list
            }
        }

        // Make an array from result.
        //
        return result.toArray(new String[result.size()]);
    } else {
        return repository.getDomains();
    }
}
 
Example 11
Source File: ObjectName.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Return an instance of ObjectName that can be used anywhere
 * the given object can be used.  The returned object may be of a
 * subclass of ObjectName.  If <code>name</code> is of a subclass
 * of ObjectName, it is not guaranteed that the returned object
 * will be of the same class.</p>
 *
 * <p>The returned value may or may not be identical to
 * <code>name</code>.  Calling this method twice with the same
 * parameters may return the same object or two equal but not
 * identical objects.</p>
 *
 * <p>Since ObjectName is immutable, it is not usually useful to
 * make a copy of an ObjectName.  The principal use of this method
 * is to guard against a malicious caller who might pass an
 * instance of a subclass with surprising behavior to sensitive
 * code.  Such code can call this method to obtain an ObjectName
 * that is known not to have surprising behavior.</p>
 *
 * @param name an instance of the ObjectName class or of a subclass
 *
 * @return an instance of ObjectName or a subclass that is known to
 * have the same semantics.  If <code>name</code> respects the
 * semantics of ObjectName, then the returned object is equal
 * (though not necessarily identical) to <code>name</code>.
 *
 * @exception NullPointerException The <code>name</code> is null.
 *
 */
public static ObjectName getInstance(ObjectName name) {
    if (name.getClass().equals(ObjectName.class))
        return name;
    return Util.newObjectName(name.getSerializedNameString());
}
 
Example 12
Source File: ObjectName.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Return an instance of ObjectName that can be used anywhere
 * the given object can be used.  The returned object may be of a
 * subclass of ObjectName.  If <code>name</code> is of a subclass
 * of ObjectName, it is not guaranteed that the returned object
 * will be of the same class.</p>
 *
 * <p>The returned value may or may not be identical to
 * <code>name</code>.  Calling this method twice with the same
 * parameters may return the same object or two equal but not
 * identical objects.</p>
 *
 * <p>Since ObjectName is immutable, it is not usually useful to
 * make a copy of an ObjectName.  The principal use of this method
 * is to guard against a malicious caller who might pass an
 * instance of a subclass with surprising behavior to sensitive
 * code.  Such code can call this method to obtain an ObjectName
 * that is known not to have surprising behavior.</p>
 *
 * @param name an instance of the ObjectName class or of a subclass
 *
 * @return an instance of ObjectName or a subclass that is known to
 * have the same semantics.  If <code>name</code> respects the
 * semantics of ObjectName, then the returned object is equal
 * (though not necessarily identical) to <code>name</code>.
 *
 * @exception NullPointerException The <code>name</code> is null.
 *
 */
public static ObjectName getInstance(ObjectName name) {
    if (name.getClass().equals(ObjectName.class))
        return name;
    return Util.newObjectName(name.getSerializedNameString());
}
 
Example 13
Source File: ObjectName.java    From jdk8u_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Return an instance of ObjectName that can be used anywhere
 * the given object can be used.  The returned object may be of a
 * subclass of ObjectName.  If <code>name</code> is of a subclass
 * of ObjectName, it is not guaranteed that the returned object
 * will be of the same class.</p>
 *
 * <p>The returned value may or may not be identical to
 * <code>name</code>.  Calling this method twice with the same
 * parameters may return the same object or two equal but not
 * identical objects.</p>
 *
 * <p>Since ObjectName is immutable, it is not usually useful to
 * make a copy of an ObjectName.  The principal use of this method
 * is to guard against a malicious caller who might pass an
 * instance of a subclass with surprising behavior to sensitive
 * code.  Such code can call this method to obtain an ObjectName
 * that is known not to have surprising behavior.</p>
 *
 * @param name an instance of the ObjectName class or of a subclass
 *
 * @return an instance of ObjectName or a subclass that is known to
 * have the same semantics.  If <code>name</code> respects the
 * semantics of ObjectName, then the returned object is equal
 * (though not necessarily identical) to <code>name</code>.
 *
 * @exception NullPointerException The <code>name</code> is null.
 *
 */
public static ObjectName getInstance(ObjectName name) {
    if (name.getClass().equals(ObjectName.class))
        return name;
    return Util.newObjectName(name.getSerializedNameString());
}
 
Example 14
Source File: ObjectName.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Return an instance of ObjectName that can be used anywhere
 * the given object can be used.  The returned object may be of a
 * subclass of ObjectName.  If <code>name</code> is of a subclass
 * of ObjectName, it is not guaranteed that the returned object
 * will be of the same class.</p>
 *
 * <p>The returned value may or may not be identical to
 * <code>name</code>.  Calling this method twice with the same
 * parameters may return the same object or two equal but not
 * identical objects.</p>
 *
 * <p>Since ObjectName is immutable, it is not usually useful to
 * make a copy of an ObjectName.  The principal use of this method
 * is to guard against a malicious caller who might pass an
 * instance of a subclass with surprising behavior to sensitive
 * code.  Such code can call this method to obtain an ObjectName
 * that is known not to have surprising behavior.</p>
 *
 * @param name an instance of the ObjectName class or of a subclass
 *
 * @return an instance of ObjectName or a subclass that is known to
 * have the same semantics.  If <code>name</code> respects the
 * semantics of ObjectName, then the returned object is equal
 * (though not necessarily identical) to <code>name</code>.
 *
 * @exception NullPointerException The <code>name</code> is null.
 *
 */
public static ObjectName getInstance(ObjectName name) {
    if (name.getClass().equals(ObjectName.class))
        return name;
    return Util.newObjectName(name.getSerializedNameString());
}
 
Example 15
Source File: ObjectName.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Return an instance of ObjectName that can be used anywhere
 * the given object can be used.  The returned object may be of a
 * subclass of ObjectName.  If <code>name</code> is of a subclass
 * of ObjectName, it is not guaranteed that the returned object
 * will be of the same class.</p>
 *
 * <p>The returned value may or may not be identical to
 * <code>name</code>.  Calling this method twice with the same
 * parameters may return the same object or two equal but not
 * identical objects.</p>
 *
 * <p>Since ObjectName is immutable, it is not usually useful to
 * make a copy of an ObjectName.  The principal use of this method
 * is to guard against a malicious caller who might pass an
 * instance of a subclass with surprising behavior to sensitive
 * code.  Such code can call this method to obtain an ObjectName
 * that is known not to have surprising behavior.</p>
 *
 * @param name an instance of the ObjectName class or of a subclass
 *
 * @return an instance of ObjectName or a subclass that is known to
 * have the same semantics.  If <code>name</code> respects the
 * semantics of ObjectName, then the returned object is equal
 * (though not necessarily identical) to <code>name</code>.
 *
 * @exception NullPointerException The <code>name</code> is null.
 *
 */
public static ObjectName getInstance(ObjectName name) {
    if (name.getClass().equals(ObjectName.class))
        return name;
    return Util.newObjectName(name.getSerializedNameString());
}
 
Example 16
Source File: ObjectName.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * <p>Return an instance of ObjectName that can be used anywhere
 * the given object can be used.  The returned object may be of a
 * subclass of ObjectName.  If <code>name</code> is of a subclass
 * of ObjectName, it is not guaranteed that the returned object
 * will be of the same class.</p>
 *
 * <p>The returned value may or may not be identical to
 * <code>name</code>.  Calling this method twice with the same
 * parameters may return the same object or two equal but not
 * identical objects.</p>
 *
 * <p>Since ObjectName is immutable, it is not usually useful to
 * make a copy of an ObjectName.  The principal use of this method
 * is to guard against a malicious caller who might pass an
 * instance of a subclass with surprising behavior to sensitive
 * code.  Such code can call this method to obtain an ObjectName
 * that is known not to have surprising behavior.</p>
 *
 * @param name an instance of the ObjectName class or of a subclass
 *
 * @return an instance of ObjectName or a subclass that is known to
 * have the same semantics.  If <code>name</code> respects the
 * semantics of ObjectName, then the returned object is equal
 * (though not necessarily identical) to <code>name</code>.
 *
 * @exception NullPointerException The <code>name</code> is null.
 *
 */
public static ObjectName getInstance(ObjectName name) {
    if (name.getClass().equals(ObjectName.class))
        return name;
    return Util.newObjectName(name.getSerializedNameString());
}
 
Example 17
Source File: ObjectName.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * <p>Return an instance of ObjectName that can be used anywhere
 * the given object can be used.  The returned object may be of a
 * subclass of ObjectName.  If <code>name</code> is of a subclass
 * of ObjectName, it is not guaranteed that the returned object
 * will be of the same class.</p>
 *
 * <p>The returned value may or may not be identical to
 * <code>name</code>.  Calling this method twice with the same
 * parameters may return the same object or two equal but not
 * identical objects.</p>
 *
 * <p>Since ObjectName is immutable, it is not usually useful to
 * make a copy of an ObjectName.  The principal use of this method
 * is to guard against a malicious caller who might pass an
 * instance of a subclass with surprising behavior to sensitive
 * code.  Such code can call this method to obtain an ObjectName
 * that is known not to have surprising behavior.</p>
 *
 * @param name an instance of the ObjectName class or of a subclass
 *
 * @return an instance of ObjectName or a subclass that is known to
 * have the same semantics.  If <code>name</code> respects the
 * semantics of ObjectName, then the returned object is equal
 * (though not necessarily identical) to <code>name</code>.
 *
 * @exception NullPointerException The <code>name</code> is null.
 *
 */
public static ObjectName getInstance(ObjectName name) {
    if (name.getClass().equals(ObjectName.class))
        return name;
    return Util.newObjectName(name.getSerializedNameString());
}
 
Example 18
Source File: ObjectName.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Return an instance of ObjectName that can be used anywhere
 * the given object can be used.  The returned object may be of a
 * subclass of ObjectName.  If <code>name</code> is of a subclass
 * of ObjectName, it is not guaranteed that the returned object
 * will be of the same class.</p>
 *
 * <p>The returned value may or may not be identical to
 * <code>name</code>.  Calling this method twice with the same
 * parameters may return the same object or two equal but not
 * identical objects.</p>
 *
 * <p>Since ObjectName is immutable, it is not usually useful to
 * make a copy of an ObjectName.  The principal use of this method
 * is to guard against a malicious caller who might pass an
 * instance of a subclass with surprising behavior to sensitive
 * code.  Such code can call this method to obtain an ObjectName
 * that is known not to have surprising behavior.</p>
 *
 * @param name an instance of the ObjectName class or of a subclass
 *
 * @return an instance of ObjectName or a subclass that is known to
 * have the same semantics.  If <code>name</code> respects the
 * semantics of ObjectName, then the returned object is equal
 * (though not necessarily identical) to <code>name</code>.
 *
 * @exception NullPointerException The <code>name</code> is null.
 *
 */
public static ObjectName getInstance(ObjectName name) {
    if (name.getClass().equals(ObjectName.class))
        return name;
    return Util.newObjectName(name.getSerializedNameString());
}
 
Example 19
Source File: ObjectName.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Return an instance of ObjectName that can be used anywhere
 * the given object can be used.  The returned object may be of a
 * subclass of ObjectName.  If <code>name</code> is of a subclass
 * of ObjectName, it is not guaranteed that the returned object
 * will be of the same class.</p>
 *
 * <p>The returned value may or may not be identical to
 * <code>name</code>.  Calling this method twice with the same
 * parameters may return the same object or two equal but not
 * identical objects.</p>
 *
 * <p>Since ObjectName is immutable, it is not usually useful to
 * make a copy of an ObjectName.  The principal use of this method
 * is to guard against a malicious caller who might pass an
 * instance of a subclass with surprising behavior to sensitive
 * code.  Such code can call this method to obtain an ObjectName
 * that is known not to have surprising behavior.</p>
 *
 * @param name an instance of the ObjectName class or of a subclass
 *
 * @return an instance of ObjectName or a subclass that is known to
 * have the same semantics.  If <code>name</code> respects the
 * semantics of ObjectName, then the returned object is equal
 * (though not necessarily identical) to <code>name</code>.
 *
 * @exception NullPointerException The <code>name</code> is null.
 *
 */
public static ObjectName getInstance(ObjectName name) {
    if (name.getClass().equals(ObjectName.class))
        return name;
    return Util.newObjectName(name.getSerializedNameString());
}
 
Example 20
Source File: ObjectName.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 * <p>Return an instance of ObjectName that can be used anywhere
 * the given object can be used.  The returned object may be of a
 * subclass of ObjectName.  If <code>name</code> is of a subclass
 * of ObjectName, it is not guaranteed that the returned object
 * will be of the same class.</p>
 *
 * <p>The returned value may or may not be identical to
 * <code>name</code>.  Calling this method twice with the same
 * parameters may return the same object or two equal but not
 * identical objects.</p>
 *
 * <p>Since ObjectName is immutable, it is not usually useful to
 * make a copy of an ObjectName.  The principal use of this method
 * is to guard against a malicious caller who might pass an
 * instance of a subclass with surprising behavior to sensitive
 * code.  Such code can call this method to obtain an ObjectName
 * that is known not to have surprising behavior.</p>
 *
 * @param name an instance of the ObjectName class or of a subclass
 *
 * @return an instance of ObjectName or a subclass that is known to
 * have the same semantics.  If <code>name</code> respects the
 * semantics of ObjectName, then the returned object is equal
 * (though not necessarily identical) to <code>name</code>.
 *
 * @exception NullPointerException The <code>name</code> is null.
 *
 */
public static ObjectName getInstance(ObjectName name) {
    if (name.getClass().equals(ObjectName.class))
        return name;
    return Util.newObjectName(name.getSerializedNameString());
}