plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoV21ServerInfo.java [219:272]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void updateDeployedCredentialStores() {
        credentialStores = new ArrayList<org.apache.geronimo.jee.deployment.Pattern>();
        credentialStoreAttributes = new HashMap<org.apache.geronimo.jee.deployment.Pattern,HashMap<String,ArrayList<String>>> ();
        Map map = Collections.singletonMap("j2eeType", "GBean");
        AbstractNameQuery query = new AbstractNameQuery(null, map,
                Collections.EMPTY_SET);
        for (int i = 0; i < kernels.size(); i++) {
        	Kernel kernel = (Kernel)kernels.get(i);
            Set beans = kernel.listGBeans(query);
            try {
                for (Iterator it = beans.iterator(); it.hasNext();) {
                    AbstractName abstractName = (AbstractName) it.next();
                    try {
                        GBeanInfo info = kernel.getGBeanInfo(abstractName);
                        GAttributeInfo attribInfo = info.getAttribute("credentialStore");
                        if (attribInfo != null) {
                            Artifact artifact = abstractName.getArtifact();
                            Object name = abstractName.getName().get("name");
                            org.apache.geronimo.jee.deployment.Pattern pattern = new org.apache.geronimo.jee.deployment.Pattern();
                            pattern.setArtifactId(artifact.getArtifactId());
                            pattern.setGroupId(artifact.getGroupId());
                            pattern.setType(artifact.getType());
                            pattern.setVersion(artifact.getVersion().toString());
                            pattern.setCustomFoo((String) name);
                            if (!credentialStores.contains(pattern)) {
                                credentialStores.add(pattern);
                            }

                            // update attributes of credentialStore
                            Map attributeMap = (Map) kernel.getAttribute(abstractName, "credentialStore");
                            if (attributeMap != null) {
                                HashMap<String, ArrayList<String>> realmMap = new HashMap<String, ArrayList<String>>();
                                for (Object obj : attributeMap.keySet()) {
                                    String realmName = (String) obj;
                                    Map idMap = (Map) attributeMap.get(obj);
                                    ArrayList<String> idList = new ArrayList<String>();
                                    idList.addAll(idMap.keySet());

                                    realmMap.put(realmName, idList);
                                }
                                credentialStoreAttributes.put(pattern, realmMap);
                            }
                        }
                    } catch (GBeanNotFoundException e) {
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            } 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);
            }
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22ServerInfo.java [224:277]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    private void updateDeployedCredentialStores() {
        credentialStores = new ArrayList<org.apache.geronimo.jee.deployment.Pattern>();
        credentialStoreAttributes = new HashMap<org.apache.geronimo.jee.deployment.Pattern,HashMap<String,ArrayList<String>>> ();
        Map map = Collections.singletonMap("j2eeType", "GBean");
        AbstractNameQuery query = new AbstractNameQuery(null, map,
                Collections.EMPTY_SET);
        for (int i = 0; i < kernels.size(); i++) {
        	Kernel kernel = (Kernel)kernels.get(i);
            Set beans = kernel.listGBeans(query);
            try {
                for (Iterator it = beans.iterator(); it.hasNext();) {
                    AbstractName abstractName = (AbstractName) it.next();
                    try {
                        GBeanInfo info = kernel.getGBeanInfo(abstractName);
                        GAttributeInfo attribInfo = info.getAttribute("credentialStore");
                        if (attribInfo != null) {
                            Artifact artifact = abstractName.getArtifact();
                            Object name = abstractName.getName().get("name");
                            org.apache.geronimo.jee.deployment.Pattern pattern = new org.apache.geronimo.jee.deployment.Pattern();
                            pattern.setArtifactId(artifact.getArtifactId());
                            pattern.setGroupId(artifact.getGroupId());
                            pattern.setType(artifact.getType());
                            pattern.setVersion(artifact.getVersion().toString());
                            pattern.setCustomFoo((String) name);
                            if (!credentialStores.contains(pattern)) {
                                credentialStores.add(pattern);
                            }

                            // update attributes of credentialStore
                            Map attributeMap = (Map) kernel.getAttribute(abstractName, "credentialStore");
                            if (attributeMap != null) {
                                HashMap<String, ArrayList<String>> realmMap = new HashMap<String, ArrayList<String>>();
                                for (Object obj : attributeMap.keySet()) {
                                    String realmName = (String) obj;
                                    Map idMap = (Map) attributeMap.get(obj);
                                    ArrayList<String> idList = new ArrayList<String>();
                                    idList.addAll(idMap.keySet());

                                    realmMap.put(realmName, idList);
                                }
                                credentialStoreAttributes.put(pattern, realmMap);
                            }
                        }
                    } catch (GBeanNotFoundException e) {
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            } 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);
            }
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



