Package org.apache.geronimo.kernel.config

Examples of org.apache.geronimo.kernel.config.ConfigurationInfo


          // Ignore
        }

        List infos = configManager.listConfigurations();
        for (Iterator infoIterator = infos.iterator(); infoIterator.hasNext();) {
            ConfigurationInfo info = (ConfigurationInfo) infoIterator.next();
            Configuration conf = configManager.getConfiguration(info.getConfigID());
            if (conf != null) {
                TreeEntry curr = new TreeEntry(info.getConfigID().toString(), NORMAL_TYPE);
                switch (info.getType().getValue()) {
                case 0:// EAR
                {
                    treeEAR.addChild(curr);
                    break;
                }
                case 1:// EJB
                {
                    treeEJB.addChild(curr);
                    break;
                }
                case 2:// CAR
                {
                    treeCLI.addChild(curr);
                    break;
                }

                case 3:// RAR
                {
                    treeRAR.addChild(curr);
                    break;
                }
                case 4:// WAR
                {
                    treeWeb.addChild(curr);
                    break;
                }
                case 5:// SERVICE
                {
                    treeSys.addChild(curr);
                    break;
                }
                }

                addDependencies(curr, conf);

                if (info.getType().getValue() == ConfigurationModuleType.EAR.getValue()) {
                    TreeEntry nodeEJB = new TreeEntry("EJBModule", NOT_LEAF_TYPE);
                    curr.addChild(nodeEJB);

                    TreeEntry nodeWeb = new TreeEntry("WebModule", NOT_LEAF_TYPE);
                    curr.addChild(nodeWeb);

                    TreeEntry nodeRAR = new TreeEntry("ResourceAdapterModule", NOT_LEAF_TYPE);
                    curr.addChild(nodeRAR);

                    TreeEntry nodeCLI = new TreeEntry("AppClientModule", NOT_LEAF_TYPE);
                    curr.addChild(nodeCLI);

                    Map<String, String> query = new HashMap<String, String>();
                    query.put("j2eeType", "EJBModule");
                    query.put("J2EEApplication", info.getConfigID().toString());
                    Set<AbstractName> setEnt = kernel.listGBeans(new AbstractNameQuery(null, query));
                    for (AbstractName gb : setEnt) {
                        TreeEntry subCurr = new TreeEntry(info.getConfigID().getGroupId() + "/"
                                + info.getConfigID().getArtifactId() + "_" + gb.getNameProperty("name") + "/"
                                + info.getConfigID().getVersion() + "/" + info.getConfigID().getType(), NORMAL_TYPE);
                        nodeEJB.addChild(subCurr);
                        addDependencies(subCurr, configManager.getConfiguration(gb.getArtifact()));
                    }

                    Map<String, String> query1 = new HashMap<String, String>();
                    query1.put("j2eeType", "ResourceAdapterModule");
                    query1.put("J2EEApplication", info.getConfigID().toString());
                    Set<AbstractName> setEnt1 = kernel.listGBeans(new AbstractNameQuery(null, query1));

                    for (AbstractName gb : setEnt1) {
                        TreeEntry subCurr = new TreeEntry(info.getConfigID().getGroupId() + "/"
                                + info.getConfigID().getArtifactId() + "_" + gb.getNameProperty("name") + "/"
                                + info.getConfigID().getVersion() + "/" + info.getConfigID().getType(), NORMAL_TYPE);
                        nodeRAR.addChild(subCurr);
                        addDependencies(subCurr, configManager.getConfiguration(gb.getArtifact()));
                    }

                    for (Configuration config : conf.getChildren()) {
View Full Code Here


            for (int i = 0; i < targetList.length; i++) {
                TargetImpl target = (TargetImpl) targetList[i];
                ObjectName storeName = target.getObjectName();
                List infos = configurationManager.listConfigurations(storeName);
                for (int j = 0; j < infos.size(); j++) {
                    ConfigurationInfo info = (ConfigurationInfo) infos.get(j);
                    if (filter.accept(info)) {
                        String name = info.getConfigID().toString();
                        List list = CommandSupport.loadChildren(kernel, name);
                        TargetModuleIDImpl moduleID = new TargetModuleIDImpl(target, name, (String[]) list.toArray(new String[list.size()]));
                        moduleID.setType(CommandSupport.convertModuleType(info.getType()));
                        if(moduleID.getChildTargetModuleID() != null) {
                            for (int k = 0; k < moduleID.getChildTargetModuleID().length; k++) {
                                TargetModuleIDImpl child = (TargetModuleIDImpl) moduleID.getChildTargetModuleID()[k];
                                if(CommandSupport.isWebApp(kernel, child.getModuleID())) {
                                    child.setType(ModuleType.WAR);
View Full Code Here

    public void uninstall(Artifact configId) throws NoSuchConfigException, IOException {
        if(!configId.isResolved()) {
            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
        }
        ConfigurationInfo configurationInfo = null;
        try {
            configurationInfo = loadConfigurationInfo(configId);
        } catch (IOException e) {
            // don't really care
        }
        File location = repository.getLocation(configId);
        IOUtil.recursiveDelete(location);
        // Number of directory levels up, to check and delete empty parent directories in the repo
        int dirDepth = 0;

        // FIXME: Determine the repository type
        // For now assume the repo is a Maven2Repository.  This should not cause any harm even if it is an
        // Maven1Repository, for it would be deleting the 'repository' directory if it happens to be empty.
        boolean m2repo = true;
        if(m2repo) {
            // Check version, artifact and group directories, i.e. 3 levels up
            dirDepth = 3;
        }

        File temp = location;
        for(int i = 0; i < dirDepth; ++i) {
            if((temp = temp.getParentFile()).listFiles().length == 0) {
                // Directory is empty.  Remove it.
                temp.delete();
            } else {
                // Directory is not empty.  No need to check any more parent directories
                break;
            }
        }

        try {
            // Is this the right way to get hold of PersistentConfigurationList?
            PersistentConfigurationList configList = (PersistentConfigurationList) kernel.getGBean(PersistentConfigurationList.class);
            if(!configList.hasGBeanAttributes(configId)) configList.removeConfiguration(configId);
        } catch (Exception e) {
            log.warn("Unable to remove configuration from persistent configurations. id = "+configId, e);
        }

        if (configurationInfo != null) {
            IOException ioException = null;
            for (Iterator iterator = configurationInfo.getOwnedConfigurations().iterator(); iterator.hasNext();) {
                Artifact ownedConfiguration = (Artifact) iterator.next();
                try {
                    uninstall(ownedConfiguration);
                } catch (NoSuchConfigException e) {
                    // ignored - already deleted or never installed
View Full Code Here

                File ser = new File(meta, "config.ser");
                if(!ser.isFile() || !ser.canRead() || ser.length() == 0) {
                    continue;
                }
                try {
                    ConfigurationInfo configurationInfo = loadConfigurationInfo(configId);
                    configs.add(configurationInfo);
                } catch (NoSuchConfigException e) {
                    log.error("Unexpected error: found META-INF/config.ser for "+configId+" but couldn't load ConfigurationInfo", e);
                } catch (IOException e) {
                    log.error("Unable to load ConfigurationInfo for "+configId, e);
View Full Code Here

            throw new NoSuchConfigException(configId);
        }

        File inPlaceLocation = inPlaceConfUtil.readInPlaceLocation(location);

        ConfigurationInfo configurationInfo;
        if (location.isDirectory()) {
            File infoFile = new File(location, "META-INF");
            infoFile = new File(infoFile, "config.info");

            InputStream in = new FileInputStream(infoFile);
View Full Code Here

    }
   
    public void testListConfigurationFilterNoneMasterConfigIds() throws Exception {
        List<ConfigurationInfo> configurationInfos = new ArrayList<ConfigurationInfo>();

        ConfigurationInfo configurationInfo =  newConfigurationInfo(configId);
        configurationInfos.add(configurationInfo);
       
        Artifact configId2 = new Artifact("groupId", "artifactId2", "2.0", "car");
        ConfigurationInfo configurationInfo2 =  newConfigurationInfo(configId2);
        configurationInfos.add(configurationInfo2);
       
        delegate.listConfigurations();
        modify().returnValue(configurationInfos);
       
View Full Code Here

        MasterConfigurationStore store = newMasterConfigurationStore();
        store.install(configurationData);
    }
   
    private ConfigurationInfo newConfigurationInfo(Artifact configId) {
        return new ConfigurationInfo(
            clusterInfoName,
            configId,
            ConfigurationModuleType.CAR,
            1l,
            Collections.EMPTY_SET,
View Full Code Here

        for (AbstractName store : stores) {
            List infos;
            try {
                infos = configurationManager.listConfigurations(store);
                for (Object info : infos) {
                    ConfigurationInfo configInfo = (ConfigurationInfo) info;
                   
                    if (ConfigurationModuleType.EBA.equals(configInfo.getType())) {
                        result.add(configInfo.getConfigID());
                    }
                }
            } catch (NoSuchStoreException e) {
                e.printStackTrace();
            }
View Full Code Here

    public void uninstall(Artifact configId) throws NoSuchConfigException, IOException {
        if(!configId.isResolved()) {
            throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
        }
        ConfigurationInfo configurationInfo = null;
        try {
            configurationInfo = loadConfigurationInfo(configId);
        } catch (IOException e) {
            // don't really care
        }
        File location = repository.getLocation(configId);
        FileUtils.recursiveDelete(location);
        // Number of directory levels up, to check and delete empty parent directories in the repo
        int dirDepth = 0;

        // FIXME: Determine the repository type
        // For now assume the repo is a Maven2Repository.  This should not cause any harm even if it is an
        // Maven1Repository, for it would be deleting the 'repository' directory if it happens to be empty.
        boolean m2repo = true;
        if(m2repo) {
            // Check version, artifact and group directories, i.e. 3 levels up
            dirDepth = 3;
        }

        File temp = location;
        for(int i = 0; i < dirDepth; ++i) {
            if((temp = temp.getParentFile()).listFiles().length == 0) {
                // Directory is empty.  Remove it.
                temp.delete();
            } else {
                // Directory is not empty.  No need to check any more parent directories
                break;
            }
        }

        if (configurationInfo != null) {
            IOException ioException = null;
            for (Iterator iterator = configurationInfo.getOwnedConfigurations().iterator(); iterator.hasNext();) {
                Artifact ownedConfiguration = (Artifact) iterator.next();
                try {
                    uninstall(ownedConfiguration);
                } catch (NoSuchConfigException e) {
                    // ignored - already deleted or never installed
View Full Code Here

        List<ConfigurationInfo> configs= new ArrayList<ConfigurationInfo>();
        synchronized (this) {
            for (Artifact configId : artifacts) {
                try {
                    ConfigurationInfo configurationInfo = loadConfigurationInfo(configId);
                    configs.add(configurationInfo);
                } catch (NoSuchConfigException e) {
                    continue;
                } catch (IOException e) {
                    log.error("Unable to load ConfigurationInfo for " + configId, e);
View Full Code Here

TOP

Related Classes of org.apache.geronimo.kernel.config.ConfigurationInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.