當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectName.getCanonicalKeyPropertyListString方法代碼示例

本文整理匯總了Java中javax.management.ObjectName.getCanonicalKeyPropertyListString方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectName.getCanonicalKeyPropertyListString方法的具體用法?Java ObjectName.getCanonicalKeyPropertyListString怎麽用?Java ObjectName.getCanonicalKeyPropertyListString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.management.ObjectName的用法示例。


在下文中一共展示了ObjectName.getCanonicalKeyPropertyListString方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ObjectNamePattern

import javax.management.ObjectName; //導入方法依賴的package包/類
/**
 * Builds a new ObjectNamePattern object from an ObjectName pattern.
 * @param pattern The ObjectName pattern under examination.
 **/
public ObjectNamePattern(ObjectName pattern) {
    this(pattern.isPropertyListPattern(),
         pattern.isPropertyValuePattern(),
         pattern.getCanonicalKeyPropertyListString(),
         pattern.getKeyPropertyList(),
         pattern);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:Repository.java

示例2: addNewDomMoi

import javax.management.ObjectName; //導入方法依賴的package包/類
private void addNewDomMoi(final DynamicMBean object,
                          final String dom,
                          final ObjectName name,
                          final RegistrationContext context) {
    final Map<String,NamedObject> moiTb =
        new HashMap<String,NamedObject>();
    final String key = name.getCanonicalKeyPropertyListString();
    addMoiToTb(object,name,key,moiTb,context);
    domainTb.put(dom, moiTb);
    nbElements++;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:Repository.java

示例3: matchKeys

import javax.management.ObjectName; //導入方法依賴的package包/類
/**
 * Return true if the given ObjectName matches the ObjectName pattern
 * for which this object has been built.
 * WARNING: domain name is not considered here because it is supposed
 *          not to be wildcard when called. PropertyList is also
 *          supposed not to be zero-length.
 * @param name The ObjectName we want to match against the pattern.
 * @return true if <code>name</code> matches the pattern.
 **/
public boolean matchKeys(ObjectName name) {
    // If key property value pattern but not key property list
    // pattern, then the number of key properties must be equal
    //
    if (isPropertyValuePattern &&
        !isPropertyListPattern &&
        (name.getKeyPropertyList().size() != keys.length))
        return false;

    // If key property value pattern or key property list pattern,
    // then every property inside pattern should exist in name
    //
    if (isPropertyValuePattern || isPropertyListPattern) {
        for (int i = keys.length - 1; i >= 0 ; i--) {
            // Find value in given object name for key at current
            // index in receiver
            //
            String v = name.getKeyProperty(keys[i]);
            // Did we find a value for this key ?
            //
            if (v == null) return false;
            // If this property is ok (same key, same value), go to next
            //
            if (isPropertyValuePattern &&
                pattern.isPropertyValuePattern(keys[i])) {
                // wildmatch key property values
                // values[i] is the pattern;
                // v is the string
                if (Util.wildmatch(v,values[i]))
                    continue;
                else
                    return false;
            }
            if (v.equals(values[i])) continue;
            return false;
        }
        return true;
    }

    // If no pattern, then canonical names must be equal
    //
    final String p1 = name.getCanonicalKeyPropertyListString();
    final String p2 = properties;
    return (p1.equals(p2));
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:55,代碼來源:Repository.java

示例4: addMBean

import javax.management.ObjectName; //導入方法依賴的package包/類
/**
 * Stores an MBean associated with its object name in the repository.
 *
 * @param object  MBean to be stored in the repository.
 * @param name    MBean object name.
 * @param context A registration context. If non null, the repository
 *                will call {@link RegistrationContext#registering()
 *                context.registering()} from within the repository
 *                lock, when it has determined that the {@code object}
 *                can be stored in the repository with that {@code name}.
 *                If {@link RegistrationContext#registering()
 *                context.registering()} throws an exception, the
 *                operation is abandonned, the MBean is not added to the
 *                repository, and a {@link RuntimeOperationsException}
 *                is thrown.
 */
public void addMBean(final DynamicMBean object, ObjectName name,
        final RegistrationContext context)
    throws InstanceAlreadyExistsException {

    if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
        MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(),
                "addMBean", "name = " + name);
    }

    // Extract the domain name.
    String dom = name.getDomain().intern();
    boolean to_default_domain = false;

    // Set domain to default if domain is empty and not already set
    if (dom.length() == 0)
        name = Util.newObjectName(domain + name.toString());

    // Do we have default domain ?
    if (dom == domain) {  // ES: OK (dom & domain are interned)
        to_default_domain = true;
        dom = domain;
    } else {
        to_default_domain = false;
    }

    // Validate name for an object
    if (name.isPattern()) {
        throw new RuntimeOperationsException(
         new IllegalArgumentException("Repository: cannot add mbean for " +
                                      "pattern name " + name.toString()));
    }

    lock.writeLock().lock();
    try {
        // Domain cannot be JMImplementation if entry does not exist
        if ( !to_default_domain &&
                dom.equals("JMImplementation") &&
                domainTb.containsKey("JMImplementation")) {
            throw new RuntimeOperationsException(
                    new IllegalArgumentException(
                    "Repository: domain name cannot be JMImplementation"));
        }

        // If domain does not already exist, add it to the hash table
        final Map<String,NamedObject> moiTb = domainTb.get(dom);
        if (moiTb == null) {
            addNewDomMoi(object, dom, name, context);
            return;
        } else {
            // Add instance if not already present
            String cstr = name.getCanonicalKeyPropertyListString();
            NamedObject elmt= moiTb.get(cstr);
            if (elmt != null) {
                throw new InstanceAlreadyExistsException(name.toString());
            } else {
                nbElements++;
                addMoiToTb(object,name,cstr,moiTb,context);
            }
        }

    } finally {
        lock.writeLock().unlock();
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:81,代碼來源:Repository.java

示例5: addMBean

import javax.management.ObjectName; //導入方法依賴的package包/類
/**
 * Stores an MBean associated with its object name in the repository.
 *
 * @param object  MBean to be stored in the repository.
 * @param name    MBean object name.
 * @param context A registration context. If non null, the repository
 *                will call {@link RegistrationContext#registering()
 *                context.registering()} from within the repository
 *                lock, when it has determined that the {@code object}
 *                can be stored in the repository with that {@code name}.
 *                If {@link RegistrationContext#registering()
 *                context.registering()} throws an exception, the
 *                operation is abandonned, the MBean is not added to the
 *                repository, and a {@link RuntimeOperationsException}
 *                is thrown.
 */
public void addMBean(final DynamicMBean object, ObjectName name,
        final RegistrationContext context)
    throws InstanceAlreadyExistsException {

    if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
        MBEANSERVER_LOGGER.log(Level.TRACE, "name = " + name);
    }

    // Extract the domain name.
    String dom = name.getDomain().intern();
    boolean to_default_domain = false;

    // Set domain to default if domain is empty and not already set
    if (dom.length() == 0)
        name = Util.newObjectName(domain + name.toString());

    // Do we have default domain ?
    if (dom == domain) {  // ES: OK (dom & domain are interned)
        to_default_domain = true;
        dom = domain;
    } else {
        to_default_domain = false;
    }

    // Validate name for an object
    if (name.isPattern()) {
        throw new RuntimeOperationsException(
         new IllegalArgumentException("Repository: cannot add mbean for " +
                                      "pattern name " + name.toString()));
    }

    lock.writeLock().lock();
    try {
        // Domain cannot be JMImplementation if entry does not exist
        if ( !to_default_domain &&
                dom.equals("JMImplementation") &&
                domainTb.containsKey("JMImplementation")) {
            throw new RuntimeOperationsException(
                    new IllegalArgumentException(
                    "Repository: domain name cannot be JMImplementation"));
        }

        // If domain does not already exist, add it to the hash table
        final Map<String,NamedObject> moiTb = domainTb.get(dom);
        if (moiTb == null) {
            addNewDomMoi(object, dom, name, context);
            return;
        } else {
            // Add instance if not already present
            String cstr = name.getCanonicalKeyPropertyListString();
            NamedObject elmt= moiTb.get(cstr);
            if (elmt != null) {
                throw new InstanceAlreadyExistsException(name.toString());
            } else {
                nbElements++;
                addMoiToTb(object,name,cstr,moiTb,context);
            }
        }

    } finally {
        lock.writeLock().unlock();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:80,代碼來源:Repository.java


注:本文中的javax.management.ObjectName.getCanonicalKeyPropertyListString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。