Package org.apache.geronimo.system.configuration

Examples of org.apache.geronimo.system.configuration.LocalConfigStore$ConfigStoreReaper


            // parse the deployment-system and j2ee-deployer plans
            ConfigurationType deployerSystemConfig = ConfigurationDocument.Factory.parse(new File(deployerSystemPlan)).getConfiguration();
            ConfigurationType j2eeDeployerConfig = ConfigurationDocument.Factory.parse(new File(j2eeDeployerPlan)).getConfiguration();

            // create the service builder, repository and config store objects
            LocalConfigStore configStore = new LocalConfigStore(new File(storeDir));
            ReadOnlyRepository repository = new ReadOnlyRepository(new File(repositoryDir));

            //TODO should the defaultParentId be null??
            ServiceConfigBuilder builder = new ServiceConfigBuilder(null, repository);

            // create the manifext
            Manifest manifest = new Manifest();
            Attributes mainAttributes = manifest.getMainAttributes();
            mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
            mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(), "org.apache.geronimo.deployment.cli.DeployTool");
            mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(), deployerClassPath);
            mainAttributes.putValue(CommandLineManifest.MAIN_GBEAN.toString(), deployerGBean);
            mainAttributes.putValue(CommandLineManifest.MAIN_METHOD.toString(), "deploy");
            mainAttributes.putValue(CommandLineManifest.CONFIGURATIONS.toString(), j2eeDeployerConfig.getConfigId());
            mainAttributes.putValue(CommandLineManifest.ENDORSED_DIRS.toString(), deployerEndorsedDirs);
            mainAttributes.putValue(CommandLineManifest.EXTENSION_DIRS.toString(), deployerExtensionDirs);

            // attribute that indicates to a JSR-88 tool that we have a Deployment factory
            mainAttributes.putValue("J2EE-DeploymentFactory-Implementation-Class", deploymentFactory);

            // write the deployer system out to a jar

            // create a temp directory to build into
            File configurationDir = null;
            try {
                configurationDir = configStore.createNewConfigurationDir();

                // build the deployer-system configuration into the configurationDir
                ConfigurationData configurationData = builder.buildConfiguration(deployerSystemConfig, null, configurationDir);

                ExecutableConfigurationUtil.createExecutableConfiguration(configurationData, manifest, configurationDir, new File(deployerJar));

                // install the configuration
                configStore.install(configurationData, configurationDir);
            } catch (Throwable e) {
                DeploymentUtil.recursiveDelete(configurationDir);
                if (e instanceof Error) {
                    throw (Error) e;
                } else if (e instanceof Exception) {
                    throw (Exception) e;
                }
                throw new Error(e);
            }

            //get the domain and server from the parent xml config
            String domain = deployerSystemConfig.getDomain();
            String server = deployerSystemConfig.getServer();

            // build and install the j2ee-deployer configuration
            try {
                configurationDir = configStore.createNewConfigurationDir();

                // build the j2ee-deployer configuration into the configurationDir
                ConfigurationData configurationData = builder.buildConfiguration(j2eeDeployerConfig, domain, server, configurationDir);

                // install the configuration
                configStore.install(configurationData, configurationDir);
            } catch (Throwable e) {
                DeploymentUtil.recursiveDelete(configurationDir);
                if (e instanceof Error) {
                    throw (Error) e;
                } else if (e instanceof Exception) {
View Full Code Here


    public void setArtifact(File artifact) {
        this.artifact = artifact;
    }

    public void execute() throws Exception {
        LocalConfigStore store = new LocalConfigStore(root);
        store.doStart();
        try {
            URI uri = store.install(artifact.toURL());
            System.out.println("Installed configuration " + uri);
        } finally{
            store.doStop();
        }
    }
View Full Code Here

     * @param testName
     */
    public AbstractWebServiceTest(String testName) throws FileNotFoundException, WaitingException, IOException {
        super(testName);
        j2eeManager = new J2EEManager();
        store = new LocalConfigStore(outFile);
        store.doStart();
    }
View Full Code Here

            // parse the deployment-system and j2ee-deployer plans
            ConfigurationType deployerSystemConfig = ConfigurationDocument.Factory.parse(new File(deployerSystemPlan)).getConfiguration();
            ConfigurationType j2eeDeployerConfig = ConfigurationDocument.Factory.parse(new File(j2eeDeployerPlan)).getConfiguration();

            // create the service builder, repository and config store objects
            LocalConfigStore configStore = new LocalConfigStore(new File(storeDir));
            ReadOnlyRepository repository = new ReadOnlyRepository(new File(repositoryDir));

            //TODO should the defaultParentId be null??
            ServiceConfigBuilder builder = new ServiceConfigBuilder(null, repository);

            // create the manifext
            Manifest manifest = new Manifest();
            Attributes mainAttributes = manifest.getMainAttributes();
            mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
            mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(), "org.apache.geronimo.deployment.cli.DeployTool");
            mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(), deployerClassPath);
            mainAttributes.putValue(CommandLineManifest.MAIN_GBEAN.toString(), deployerGBean);
            mainAttributes.putValue(CommandLineManifest.MAIN_METHOD.toString(), "deploy");
            mainAttributes.putValue(CommandLineManifest.CONFIGURATIONS.toString(), j2eeDeployerConfig.getConfigId());

            // attribute that indicates to a JSR-88 tool that we have a Deployment factory
            mainAttributes.putValue("J2EE-DeploymentFactory-Implementation-Class", deploymentFactory);

            // write the deployer system out to a jar

            // create a temp directory to build into
            File configurationDir = null;
            try {
                configurationDir = configStore.createNewConfigurationDir();

                // build the deployer-system configuration into the configurationDir
                builder.buildConfiguration(deployerSystemConfig, null, configurationDir);

                // Write the manifest
                File metaInf = new File(configurationDir, "META-INF");
                metaInf.mkdirs();
                FileOutputStream out = null;
                try {
                    out = new FileOutputStream(new File(metaInf, "MANIFEST.MF"));
                    manifest.write(out);
                } finally {
                    DeploymentUtil.close(out);
                }

                // add the startup file which allows us to locate the startup directory
                File startupJarTag = new File(metaInf, "startup-jar");
                startupJarTag.createNewFile();

                // jar up the directory
                DeploymentUtil.jarDirectory(configurationDir,  new File(deployerJar));

                // delete the startup file before moving this to the config store
                startupJarTag.delete();

                // install the configuration
                configStore.install(configurationDir);
            } catch(Throwable e) {
                DeploymentUtil.recursiveDelete(configurationDir);
                if (e instanceof Error) {
                    throw (Error)e;
                } else if (e instanceof Exception) {
                    throw (Exception)e;
                }
                throw new Error(e);
            }

            // build and install the j2ee-deployer configuration
            try {
                configurationDir = configStore.createNewConfigurationDir();

                // build the j2ee-deployer configuration into the configurationDir
                builder.buildConfiguration(j2eeDeployerConfig, null, configurationDir);

                // install the configuration
                configStore.install(configurationDir);
            } catch(Throwable e) {
                DeploymentUtil.recursiveDelete(configurationDir);
                if (e instanceof Error) {
                    throw (Error)e;
                } else if (e instanceof Exception) {
View Full Code Here

    protected void setUp() throws Exception {
        root = new File(System.getProperty("java.io.tmpdir") + "/config-store");
        root.mkdir();

        store = new LocalConfigStore(root);
        store.doStart();

        GBeanMBean gbean = new GBeanMBean(Configuration.GBEAN_INFO);
        uri = new URI("test");
        gbean.setAttribute("ID", uri);
View Full Code Here

            XmlObject deployerSystemXML = XmlBeans.getContextTypeLoader().parse(new File(deployerSystemPlan), null, null);
            XmlObject j2eeDeployerXML = XmlBeans.getContextTypeLoader().parse(new File(j2eeDeployerPlan), null, null);
            ConfigurationType j2eeDeployerConfig = ((ConfigurationDocument) j2eeDeployerXML).getConfiguration();

            // create the service builder, repository and config store objects
            LocalConfigStore configStore = new LocalConfigStore(new File(storeDir));
            ReadOnlyRepository repository = new ReadOnlyRepository(new File(repositoryDir));
            ServiceConfigBuilder builder = new ServiceConfigBuilder(repository);

            // create the manifext
            Manifest manifest = new Manifest();
            Attributes mainAttributes = manifest.getMainAttributes();
            mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
            mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(), "org.apache.geronimo.system.main.CommandLine");
            mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(), deployerClassPath);
            mainAttributes.putValue(CommandLineManifest.MAIN_GBEAN.toString(), deployerGBean);
            mainAttributes.putValue(CommandLineManifest.MAIN_METHOD.toString(), "deploy");
            mainAttributes.putValue(CommandLineManifest.CONFIGURATIONS.toString(), j2eeDeployerConfig.getConfigId());

            // build and install the deployer-system configuration
            // write the deployer system out to a jar
            File outputFile = new File(deployerJar);
            JarOutputStream jos = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(outputFile)), manifest);
            try {
                // add the startup jar entry which allows us to locat the startup directory
                jos.putNextEntry(new ZipEntry("META-INF/startup-jar"));
                jos.closeEntry();

                // add the deployment system configuration to the jar
                builder.buildConfiguration(jos, deployerSystemXML);
            } finally {
                jos.close();
            }
            configStore.install(outputFile.toURL());

            // build and install the j2ee-deployer configuration
            File tempFile = File.createTempFile("j2ee-deployer", ".car");
            try {
                builder.buildConfiguration(tempFile, manifest, (InputStream)null, j2eeDeployerXML);
                configStore.install(tempFile.toURL());
            } finally {
                tempFile.delete();
            }
        } finally {
            Thread.currentThread().setContextClassLoader(oldCL);
View Full Code Here

            XmlObject deployerSystemXML = XmlBeans.getContextTypeLoader().parse(new File(deployerSystemPlan), null, null);
            XmlObject j2eeDeployerXML = XmlBeans.getContextTypeLoader().parse(new File(j2eeDeployerPlan), null, null);
            ConfigurationType j2eeDeployerConfig = ((ConfigurationDocument) j2eeDeployerXML).getConfiguration();

            // create the service builder, repository and config store objects
            LocalConfigStore configStore = new LocalConfigStore(new File(storeDir));
            ReadOnlyRepository repository = new ReadOnlyRepository(new File(repositoryDir));
            ServiceConfigBuilder builder = new ServiceConfigBuilder(repository);

            // create the manifext
            Manifest manifest = new Manifest();
            Attributes mainAttributes = manifest.getMainAttributes();
            mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
            mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(), "org.apache.geronimo.system.main.CommandLine");
            mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(), deployerClassPath);
            mainAttributes.putValue(CommandLineManifest.MAIN_GBEAN.toString(), deployerGBean);
            mainAttributes.putValue(CommandLineManifest.MAIN_METHOD.toString(), "deploy");
            mainAttributes.putValue(CommandLineManifest.CONFIGURATIONS.toString(), j2eeDeployerConfig.getConfigId());

            // attribute that indicates to a JSR-88 tool that we have a Deployment factory
            mainAttributes.putValue("J2EE-DeploymentFactory-Implementation-Class", deploymentFactory);

            // build and install the deployer-system configuration
            // write the deployer system out to a jar
            File outputFile = new File(deployerJar);
            JarOutputStream jos = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(outputFile)), manifest);
            try {
                // add the startup jar entry which allows us to locate the startup directory
                jos.putNextEntry(new ZipEntry("META-INF/startup-jar"));
                jos.closeEntry();

                // add the deployment system configuration to the jar
                builder.buildConfiguration(jos, deployerSystemXML);
            } finally {
                jos.close();
            }
            configStore.install(outputFile.toURL());

            // build and install the j2ee-deployer configuration
            File tempFile = File.createTempFile("j2ee-deployer", ".car");
            try {
                builder.buildConfiguration(tempFile, manifest, (InputStream)null, j2eeDeployerXML);
                configStore.install(tempFile.toURL());
            } finally {
                tempFile.delete();
            }
        } finally {
            Thread.currentThread().setContextClassLoader(oldCL);
View Full Code Here

* @version $Rev: 356034 $ $Date: 2005-12-11 13:41:23 -0800 (Sun, 11 Dec 2005) $
*/
public class LocalConfigInstaller extends BaseConfigInstaller {

    public void execute() throws Exception {
        final LocalConfigStore store = new LocalConfigStore(new File(targetRoot, targetConfigStore));
        store.doStart();
        InstallAdapter installAdapter = new InstallAdapter() {

            public GBeanData install(Repository sourceRepo, URI configId) throws IOException, InvalidConfigException {
                URL artifact = sourceRepo.getURL(configId);
                GBeanData config = store.install2(artifact);
                return config;
            }

            public boolean containsConfiguration(URI configID) {
                return store.containsConfiguration(configID);
            }
        };
        Repository sourceRepo = new InnerRepository();
        URI rootURI = targetRoot.toURI().resolve(targetRepository);
        FileSystemRepository targetRepo = new FileSystemRepository(rootURI, null);
        targetRepo.doStart();

        try {
            try {
                execute(installAdapter, sourceRepo, targetRepo);
            } finally {
                store.doStop();
            }
        } finally {
            targetRepo.doStop();
        }

View Full Code Here

            // parse the deployment-system and j2ee-deployer plans
            ConfigurationType deployerSystemConfig = ConfigurationDocument.Factory.parse(new File(deployerSystemPlan)).getConfiguration();
            ConfigurationType j2eeDeployerConfig = ConfigurationDocument.Factory.parse(new File(j2eeDeployerPlan)).getConfiguration();

            // create the service builder, repository and config store objects
            LocalConfigStore configStore = new LocalConfigStore(new File(storeDir));
            ReadOnlyRepository repository = new ReadOnlyRepository(new File(repositoryDir));

            //TODO should the defaultParentId be null??
            ServiceConfigBuilder builder = new ServiceConfigBuilder(null, repository);

            // create the manifext
            Manifest manifest = new Manifest();
            Attributes mainAttributes = manifest.getMainAttributes();
            mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
            mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(), "org.apache.geronimo.deployment.cli.DeployTool");
            mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(), deployerClassPath);
            mainAttributes.putValue(CommandLineManifest.MAIN_GBEAN.toString(), deployerGBean);
            mainAttributes.putValue(CommandLineManifest.MAIN_METHOD.toString(), "deploy");
            mainAttributes.putValue(CommandLineManifest.CONFIGURATIONS.toString(), j2eeDeployerConfig.getConfigId());
            mainAttributes.putValue(CommandLineManifest.ENDORSED_DIRS.toString(), deployerEndorsedDirs);

            // attribute that indicates to a JSR-88 tool that we have a Deployment factory
            mainAttributes.putValue("J2EE-DeploymentFactory-Implementation-Class", deploymentFactory);

            // write the deployer system out to a jar

            // create a temp directory to build into
            File configurationDir = null;
            try {
                configurationDir = configStore.createNewConfigurationDir();

                // build the deployer-system configuration into the configurationDir
                ConfigurationData configurationData = builder.buildConfiguration(deployerSystemConfig, null, configurationDir);

                ExecutableConfigurationUtil.createExecutableConfiguration(configurationData, manifest, configurationDir, new File(deployerJar));

                // install the configuration
                configStore.install(configurationData, configurationDir);
            } catch (Throwable e) {
                DeploymentUtil.recursiveDelete(configurationDir);
                if (e instanceof Error) {
                    throw (Error) e;
                } else if (e instanceof Exception) {
                    throw (Exception) e;
                }
                throw new Error(e);
            }
           
            //get the domain and server from the parent xml config
            String domain = deployerSystemConfig.getDomain();
            String server = deployerSystemConfig.getServer();

            // build and install the j2ee-deployer configuration
            try {
                configurationDir = configStore.createNewConfigurationDir();

                // build the j2ee-deployer configuration into the configurationDir
                ConfigurationData configurationData = builder.buildConfiguration(j2eeDeployerConfig, domain, server, configurationDir);

                // install the configuration
                configStore.install(configurationData, configurationDir);
            } catch (Throwable e) {
                DeploymentUtil.recursiveDelete(configurationDir);
                if (e instanceof Error) {
                    throw (Error) e;
                } else if (e instanceof Exception) {
View Full Code Here

TOP

Related Classes of org.apache.geronimo.system.configuration.LocalConfigStore$ConfigStoreReaper

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.