Examples of ConfigurationStore


Examples of org.apache.falcon.entity.store.ConfigurationStore

    private Feed modifiableFeed;

    @BeforeMethod
    public void setUp() throws Exception {
        cleanupStore();
        ConfigurationStore store = ConfigurationStore.get();

        Unmarshaller unmarshaller = EntityType.CLUSTER.getUnmarshaller();
        Cluster cluster = (Cluster) unmarshaller.unmarshal(this.getClass()
                .getResourceAsStream(CLUSTER_XML));
        cluster.setName("testCluster");
        store.publish(EntityType.CLUSTER, cluster);

        cluster = (Cluster) unmarshaller.unmarshal(this.getClass()
                .getResourceAsStream(CLUSTER_XML));
        cluster.setName("backupCluster");
        store.publish(EntityType.CLUSTER, cluster);

        modifiableFeed = parser.parseAndValidate(this.getClass()
                .getResourceAsStream(FEED_XML));
    }
View Full Code Here

Examples of org.apache.falcon.entity.store.ConfigurationStore

            long feedCutOffPeriod = evaluator.evaluate(lateCutOff, Long.class);
            endTime = addTime(endTime, feedCutOffPeriod);
            return endTime;
        } else if (entity.getEntityType() == EntityType.PROCESS) {
            Process process = (Process) entity;
            ConfigurationStore store = ConfigurationStore.get();
            for (LateInput lp : process.getLateProcess().getLateInputs()) {
                Feed feed = null;
                String endInstanceTime = "";
                for (Input input : process.getInputs().getInputs()) {
                    if (input.getName().equals(lp.getInput())) {
                        endInstanceTime = input.getEnd();
                        feed = store.get(EntityType.FEED, input.getFeed());
                        break;
                    }
                }
                if (feed == null) {
                    throw new IllegalStateException("No such feed: " + lp.getInput());
View Full Code Here

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

            throw new ServletException("No configId specified for CAR download");
        }
        Artifact artifact = Artifact.create(configId);
        Kernel kernel = KernelRegistry.getSingleKernel();
        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
        ConfigurationStore store = mgr.getStoreForConfiguration(artifact);
        try {
            response.setContentType("application/zip");
            String filename = artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getType();
            response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(filename, "UTF-8"));
            store.exportConfiguration(artifact, response.getOutputStream());
        } catch (NoSuchConfigException e) {
            throw new ServletException("No such configuration '"+configId+"'");
        }
    }
View Full Code Here

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

    private boolean produceDownloadFile(Kernel kernel, Artifact configId, HttpServletResponse response, boolean reply) throws IOException {
        //todo: replace kernel mumbo jumbo with JSR-77 navigation
        // Step 1: check if it's in a configuration store
        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
        if(mgr.isConfiguration(configId)) {
            ConfigurationStore store = mgr.getStoreForConfiguration(configId);
            response.setContentType("application/zip");
            if(!reply) {
                return true;
            }
            try {
                store.exportConfiguration(configId, response.getOutputStream());
                return true;
            } catch (NoSuchConfigException e) {
                log.error("Inconsistent ConfigurationStore data; ConfigManager claims it has configuration "+configId+" but store claims it doesn't",e);
                throw new IOException("Unable to write ZIP file; see server log for details");
            }
View Full Code Here

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

                manifestConfigurations,
                classPath,
                endorsedDirs,
                extensionDirs);

            ConfigurationStore store = getConfigurationStore(targetConfigurationStore);

            // It's our responsibility to close this context, once we're done with it...
            DeploymentContext context = builder.buildConfiguration(inPlace, configID, plan, module, stores, artifactResolver, store);
           
            return install(targetFile, install, manifest, store, context);
View Full Code Here

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

            }

            if (stores.isEmpty()) {
                throw new DeploymentException("No ConfigurationStores!");
            }
            ConfigurationStore store;
            if (targetConfigurationStore != null) {
                AbstractName targetStoreName = new AbstractName(new URI(targetConfigurationStore));
                store = (ConfigurationStore) kernel.getGBean(targetStoreName);
            } else {
                store = (ConfigurationStore) stores.iterator().next();
            }

            // It's our responsibility to close this context, once we're done with it...
            DeploymentContext context = builder.buildConfiguration(inPlace, configID, plan, module, stores, artifactResolver, store);
            List configurations = new ArrayList();
            boolean configsCleanupRequired = false;
            configurations.add(context.getConfigurationData());
            configurations.addAll(context.getAdditionalDeployment());

            if (configurations.isEmpty()) {
                throw new DeploymentException("Deployer did not create any configurations");
            }

            // Set TCCL to the classloader for the configuration being deployed
            // so that any static blocks invoked during the loading of classes
            // during serialization of the configuration have the correct TCCL
            // ( a TCCL that is consistent with what is set when the same
            // classes are loaded when the configuration is started.
            Thread thread = Thread.currentThread();
            ClassLoader oldCl = thread.getContextClassLoader();
            thread.setContextClassLoader( context.getConfiguration().getConfigurationClassLoader());
            try {
                if (targetFile != null) {
                    if (configurations.size() > 1) {
                        throw new DeploymentException("Deployer created more than one configuration");
                    }
                    ConfigurationData configurationData = (ConfigurationData) configurations.get(0);
                    ExecutableConfigurationUtil.createExecutableConfiguration(configurationData, manifest, targetFile);
                }
                if (install) {
                    List deployedURIs = new ArrayList();
                    for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
                        ConfigurationData configurationData = (ConfigurationData) iterator.next();
                        store.install(configurationData);
                        deployedURIs.add(configurationData.getId().toString());
                    }
                    notifyWatchers(deployedURIs);
                    return deployedURIs;
                } else {
View Full Code Here

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

            }

            if (stores.isEmpty()) {
                throw new DeploymentException("No ConfigurationStores!");
            }
            ConfigurationStore store;
            if (targetConfigurationStore != null) {
                AbstractName targetStoreName = new AbstractName(new URI(targetConfigurationStore));
                store = (ConfigurationStore) kernel.getGBean(targetStoreName);
            } else {
                store = (ConfigurationStore) stores.iterator().next();
            }

            // It's our responsibility to close this context, once we're done with it...
            DeploymentContext context = builder.buildConfiguration(inPlace, configID, plan, module, stores, artifactResolver, store);
            List configurations = new ArrayList();
            configurations.add(context.getConfigurationData());
            configurations.addAll(context.getAdditionalDeployment());

            if (configurations.isEmpty()) {
                throw new DeploymentException("Deployer did not create any configurations");
            }
            try {
                if (targetFile != null) {
                    if (configurations.size() > 1) {
                        throw new DeploymentException("Deployer created more than one configuration");
                    }
                    ConfigurationData configurationData = (ConfigurationData) configurations.get(0);
                    ExecutableConfigurationUtil.createExecutableConfiguration(configurationData, manifest, targetFile);
                }
                if (install) {
                    List deployedURIs = new ArrayList();
                    for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
                        ConfigurationData configurationData = (ConfigurationData) iterator.next();
                        store.install(configurationData);
                        deployedURIs.add(configurationData.getId().toString());
                    }
                    notifyWatchers(deployedURIs);
                    return deployedURIs;
                } else {
View Full Code Here

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

        List stores = mgr.listStores();
        for (int i = 0; i < stores.size(); i++) {
            AbstractName name = (AbstractName) stores.get(i);
            //todo: this is bad!!!
            if(name.getName().get(NameFactory.J2EE_NAME).equals("Local")) {
                ConfigurationStore store = (ConfigurationStore) kernel.getProxyManager().createProxy(name, ConfigurationStore.class);
                if(store.containsConfiguration(configId)) {
                    response.setContentType("application/zip");
                    if(!reply) {
                        return true;
                    }
                    try {
View Full Code Here

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

            throw new ServletException("No configId specified for CAR download");
        }
        Artifact artifact = Artifact.create(configId);
        Kernel kernel = KernelRegistry.getSingleKernel();
        ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
        ConfigurationStore store = mgr.getStoreForConfiguration(artifact);
        try {
            response.setContentType("application/zip");
            store.exportConfiguration(artifact, response.getOutputStream());
        } catch (NoSuchConfigException e) {
            throw new ServletException("No such configuration '"+configId+"'");
        }
    }
View Full Code Here

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

            ClassLoader cl = this.getClass().getClassLoader();

            Class sourceRepoClass = cl.loadClass(sourceRepositoryClass);
            WritableListableRepository sourceRepository = (WritableListableRepository) sourceRepoClass.getDeclaredConstructor(REPO_ARGS).newInstance(new Object[] {sourceRepositoryLocation});
            Class sourceConfigStoreClass = cl.loadClass(sourceConfigurationStoreClass);
            ConfigurationStore sourceConfigStore = (ConfigurationStore) sourceConfigStoreClass.getDeclaredConstructor(STORE_ARGS).newInstance(new Object[] {sourceRepository});

            Class targetRepoClass = cl.loadClass(targetRepositoryClass);
            WritableListableRepository targetRepository = (WritableListableRepository) targetRepoClass.getDeclaredConstructor(REPO_ARGS).newInstance(new Object[] {targetRepositoryLocation});
            Class targetConfigStoreClass = cl.loadClass(targetConfigurationStoreClass);
            ConfigurationStore targetConfigStore = (ConfigurationStore) targetConfigStoreClass.getDeclaredConstructor(STORE_ARGS).newInstance(new Object[] {targetRepository});

            List configs = sourceConfigStore.listConfigurations();
            for (Iterator iterator = configs.iterator(); iterator.hasNext();) {
                ConfigurationInfo configInfo = (ConfigurationInfo) iterator.next();
                Artifact configId = configInfo.getConfigID();
                ConfigurationData configData = sourceConfigStore.loadConfiguration(configId);
                if (targetConfigStore.containsConfiguration(configId)) {
                    targetConfigStore.uninstall(configId);
                }
                targetConfigStore.install(configData);
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.