private static String getGeneralPid(List<String> allJmxAclPids, String pid) {
        String[] pidStrArray = pid.split(Pattern.quote("."));
        Set<String[]> rets = new TreeSet<>(WILDCARD_PID_COMPARATOR);
        for (String id : allJmxAclPids) {
            String[] idStrArray = id.split(Pattern.quote("."));
            if (idStrArray.length == pidStrArray.length) {
                boolean match = true;
                for (int i = 0; i < idStrArray.length; i++) {
                    if (!(idStrArray[i].equals(JMX_OBJECTNAME_PROPERTY_WILDCARD)
                        || idStrArray[i].equals(pidStrArray[i]))) {
                        match = false;
                        break;
                    }
                }
                if (match) {
                    rets.add(idStrArray);
                }
            }
        }

        Iterator<String[]> it = rets.iterator();
        if (!it.hasNext()) {
            return "";
        } else {
            StringBuilder buffer = new StringBuilder();
            for (String segment : it.next()) {
                if (buffer.length() > 0) {
                    buffer.append(".");
                }
                buffer.append(segment);
            }
            return buffer.toString();
        }
    }
private static String getGeneralPid ( List < String > allJmxAclPids , String pid ) { String [ ] pidStrArray = pid . split ( Pattern . quote ( "." ) ) ; Set < String [ ] > rets = new TreeSet < > ( WILDCARD_PID_COMPARATOR ) ; for ( String id : allJmxAclPids ) { String [ ] idStrArray = id . split ( Pattern . quote ( "." ) ) ; if ( idStrArray . length == pidStrArray . length ) { boolean match = true ; for ( int i = 0 ; i < idStrArray . length ; i ++ ) { if ( ! ( idStrArray [ i ] . equals ( JMX_OBJECTNAME_PROPERTY_WILDCARD ) || idStrArray [ i ] . equals ( pidStrArray [ i ] ) ) ) { match = false ; break ; } } if ( match ) { rets . add ( idStrArray ) ; } } } Iterator < String [ ] > it = rets . iterator ( ) ; if ( ! it . hasNext ( ) ) { return "" ; } else { StringBuilder buffer = new StringBuilder ( ) ; for ( String segment : it . next ( ) ) { if ( buffer . length ( ) > 0 ) { buffer . append ( "." ) ; } buffer . append ( segment ) ; } return buffer . toString ( ) ; } }
<p>see: <code>org.apache.karaf.management.KarafMBeanServerGuard#getGeneralPid(java.util.List, java.lang.String)</code></p>

<p>Given a list of all available configadmin PIDs that define RBAC information, return a real PID that'll be
used to fetch information about particular, non wildcard <code>pid</code>.</p>

<p>Here, the PID returned may use wildcards ("_"), which means that general PID will be used to check particular
<code>pid</code> (one of possible PIDs derived from {@link ObjectName})</p>
@param allJmxAclPids
@param pid one of the PIDs returned from {@link #iterateDownPids(List)}
@return