plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21ServerInfo.java [328:400]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private ArrayList<Pattern> getByTypeAttributeValues(String type,
            String attribute, String[] acceptedValues) {
        ArrayList<Pattern> result = new ArrayList<Pattern>();
        Map map = Collections.singletonMap("j2eeType", type);
        AbstractNameQuery query = new AbstractNameQuery(null, map,
                Collections.EMPTY_SET);
        for (int i = 0; i < kernels.size(); i++) {
            Set beans = kernels.get(i).listGBeans(query);
            try {
                for (Iterator it = beans.iterator(); it.hasNext();) {
                    AbstractName abstractName = (AbstractName) it.next();
                    try {
                        Object value = kernels.get(i).getAttribute(abstractName,
                                attribute);
                        if (value != null) {
                            if (value instanceof String[]) {
                                List<String> interfaces = Arrays
                                .asList((String[]) value);
                                for (int j = 0; j < acceptedValues.length; j++) {
                                    if (interfaces.contains(acceptedValues[j])) {
                                        Pattern pattern = new Pattern();
                                        Artifact artifact = abstractName
                                        .getArtifact();
                                        pattern.setArtifactId(artifact
                                                .getArtifactId());
                                        pattern.setGroupId(artifact.getGroupId());
                                        pattern.setVersion(artifact.getVersion()
                                                .toString());
                                        pattern.setName((String) abstractName
                                                .getName().get("name"));
                                        if (!result.contains(pattern)) {
                                            result.add(pattern);
                                        }
                                        break;
                                    }
                                }
                            }
                            if (value instanceof String) {
                                String interfaces = (String) value;
                                for (int j = 0; j < acceptedValues.length; j++) {
                                    if (interfaces.contains(acceptedValues[j])) {
                                        Pattern pattern = new Pattern();
                                        Artifact artifact = abstractName
                                        .getArtifact();
                                        pattern.setArtifactId(artifact
                                                .getArtifactId());
                                        pattern.setGroupId(artifact.getGroupId());
                                        pattern.setVersion(artifact.getVersion()
                                                .toString());
                                        pattern.setName((String) abstractName
                                                .getName().get("name"));
                                        if (!result.contains(pattern)) {
                                            result.add(pattern);
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    } catch (GBeanNotFoundException e) {
                    } catch (NoSuchAttributeException e) {
                    } catch (Exception e) {
                        Trace.trace(Trace.WARNING, "Kernel connection failed. "
                                + e.getMessage(), Activator.logCore);
                    }
                }
            } catch(ClassCastException e) {
                // Just ignore as could be 2.1's AbstractName even in 2.2
                Trace.trace(Trace.INFO, "The class is not match: "  + e.getMessage(), Activator.logCore);
            }
        }
        return result;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22ServerInfo.java [333:405]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private ArrayList<Pattern> getByTypeAttributeValues(String type,
            String attribute, String[] acceptedValues) {
        ArrayList<Pattern> result = new ArrayList<Pattern>();
        Map map = Collections.singletonMap("j2eeType", type);
        AbstractNameQuery query = new AbstractNameQuery(null, map,
                Collections.EMPTY_SET);
        for (int i = 0; i < kernels.size(); i++) {
            Set beans = kernels.get(i).listGBeans(query);
            try {
                for (Iterator it = beans.iterator(); it.hasNext();) {
                    AbstractName abstractName = (AbstractName) it.next();
                    try {
                        Object value = kernels.get(i).getAttribute(abstractName,
                                attribute);
                        if (value != null) {
                            if (value instanceof String[]) {
                                List<String> interfaces = Arrays
                                .asList((String[]) value);
                                for (int j = 0; j < acceptedValues.length; j++) {
                                    if (interfaces.contains(acceptedValues[j])) {
                                        Pattern pattern = new Pattern();
                                        Artifact artifact = abstractName
                                        .getArtifact();
                                        pattern.setArtifactId(artifact
                                                .getArtifactId());
                                        pattern.setGroupId(artifact.getGroupId());
                                        pattern.setVersion(artifact.getVersion()
                                                .toString());
                                        pattern.setName((String) abstractName
                                                .getName().get("name"));
                                        if (!result.contains(pattern)) {
                                            result.add(pattern);
                                        }
                                        break;
                                    }
                                }
                            }
                            if (value instanceof String) {
                                String interfaces = (String) value;
                                for (int j = 0; j < acceptedValues.length; j++) {
                                    if (interfaces.contains(acceptedValues[j])) {
                                        Pattern pattern = new Pattern();
                                        Artifact artifact = abstractName
                                        .getArtifact();
                                        pattern.setArtifactId(artifact
                                                .getArtifactId());
                                        pattern.setGroupId(artifact.getGroupId());
                                        pattern.setVersion(artifact.getVersion()
                                                .toString());
                                        pattern.setName((String) abstractName
                                                .getName().get("name"));
                                        if (!result.contains(pattern)) {
                                            result.add(pattern);
                                        }
                                        break;
                                    }
                                }
                            }
                        }
                    } catch (GBeanNotFoundException e) {
                    } catch (NoSuchAttributeException e) {
                    } catch (Exception e) {
                        Trace.trace(Trace.WARNING, "Kernel connection failed. "
                                + e.getMessage(), Activator.logCore);
                    }
                }
            } catch(ClassCastException e) {
                // Just ignore as could be 2.1's AbstractName even in 2.2
                Trace.trace(Trace.INFO, "The class is not match: "  + e.getMessage(), Activator.logCore);
            }
        }
        return result;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



