Examples of Deployments


Examples of org.apache.openejb.config.sys.Deployments

        public Properties getProperties() {
            return properties;
        }

        public File deploymentsDir(final String dir) {
            openejb.getDeployments().add(new Deployments().dir(dir));
            return Files.mkdir(base, dir);
        }
View Full Code Here

Examples of org.apache.openejb.config.sys.Deployments

            openejb.getDeployments().add(new Deployments().dir(dir));
            return Files.mkdir(base, dir);
        }

        public File deploymentsFile(final String file) {
            openejb.getDeployments().add(new Deployments().file(file));
            return Files.path(base, file);
        }
View Full Code Here

Examples of org.apache.openejb.config.sys.Deployments

    @Test
    public void testToConfigDeclaration() throws Exception {
        final String path = ".";
        final ConfigurationFactory factory = new ConfigurationFactory();
        final Deployments deployments = (Deployments) factory.toConfigDeclaration("", new URI("new://Deployments?classpath="
            + path));
        final URLClassLoader cl = (URLClassLoader) deployments.getClasspath();
        final URL[] urls = cl.getURLs();
        assertEquals(urls[0], new File(path).toURI().normalize().toURL());
    }
View Full Code Here

Examples of org.apache.openejb.config.sys.Deployments

                    }
                }

                service.getProperties().putAll(map);
            } else if (object instanceof Deployments) {
                final Deployments deployments = (Deployments) object;
                deployments.setDir(map.remove("dir"));
                deployments.setFile(map.remove("jar"));
                final String cp = map.remove("classpath");
                if (cp != null) {
                    final String[] paths = cp.split(File.pathSeparator);
                    final List<URL> urls = new ArrayList<>();
                    for (final String path : paths) {
                        final Set<String> values = ProvisioningUtil.realLocation(PropertyPlaceHolderHelper.value(path));
                        for (final String v : values) {
                            urls.add(new File(v).toURI().normalize().toURL());
                        }
                    }
                    deployments.setClasspath(new URLClassLoaderFirst(urls.toArray(new URL[urls.size()]), ParentClassLoaderFinder.Helper.get()));
                }
            } else if (SystemProperty.class.isInstance(object)) {
                final SystemProperty sp = SystemProperty.class.cast(object);
                sp.setName(map.remove("name"));
                sp.setValue(map.remove("value"));
View Full Code Here

Examples of org.apache.openejb.config.sys.Deployments

        }
        return dump;
    }

    private synchronized void saveDeployment(final File file, final boolean add) {
        final Deployments deps = new Deployments();
        if (file.isDirectory()) {
            deps.setDir(file.getAbsolutePath());
        } else {
            deps.setFile(file.getAbsolutePath());
        }

        File config;
        try {
            config = SystemInstance.get().getBase().getFile(ADDITIONAL_DEPLOYMENTS, false);
        } catch (final IOException e) {
            config = null;
        }
        if (config == null || !config.getParentFile().exists()) {
            LOGGER.info("can't save the added app because the conf folder doesn't exist, it will not be present next time you'll start");
            return;
        }

        // dump it
        OutputStream os = null;
        try {
            final AdditionalDeployments additionalDeployments;
            if (config.exists() && config.length() > 0) {
                final InputStream fis = IO.read(config);
                try {
                    additionalDeployments = JaxbOpenejb.unmarshal(AdditionalDeployments.class, fis);
                } finally {
                    IO.close(fis);
                }
            } else {
                additionalDeployments = new AdditionalDeployments();
            }

            if (add) {
                if (!additionalDeployments.getDeployments().contains(deps)) {
                    additionalDeployments.getDeployments().add(deps);
                }
            } else {
                final Iterator<Deployments> it = additionalDeployments.getDeployments().iterator();
                while (it.hasNext()) {
                    final Deployments current = it.next();
                    if (deps.getDir() != null && deps.getDir().equals(current.getDir())) {
                        it.remove();
                        break;
                    } else if (deps.getFile() != null && deps.getFile().equals(current.getFile())) {
                        it.remove();
                        break;
                    } else { // exploded dirs
                        final String jar = deps.getFile();
                        if (jar != null && jar.length() > 3 && jar.substring(0, jar.length() - 4).equals(deps.getDir())) {
View Full Code Here

Examples of org.apache.openejb.config.sys.Deployments

    @Test
    public void testToConfigDeclaration() throws Exception {
        final String path = ".";
        ConfigurationFactory factory = new ConfigurationFactory();
        Deployments deployments = (Deployments) factory.toConfigDeclaration("", new URI("new://Deployments?classpath="
                + path));
        URLClassLoader cl = (URLClassLoader) deployments.getClasspath();
        URL[] urls = cl.getURLs();
        assertEquals(urls[0], new File(path).toURI().normalize().toURL());
    }
View Full Code Here

Examples of org.apache.openejb.config.sys.Deployments

                    }
                }

                service.getProperties().putAll(map);
            } else if (object instanceof Deployments) {
                final Deployments deployments = (Deployments) object;
                deployments.setDir(map.remove("dir"));
                deployments.setFile(map.remove("jar"));
                final String cp = map.remove("classpath");
                if (cp != null) {
                    final String[] paths = cp.split(File.pathSeparator);
                    final List<URL> urls = new ArrayList<URL>();
                    for (final String path : paths) {
                        urls.add(new File(path).toURI().normalize().toURL());
                    }
                    deployments.setClasspath(new URLClassLoaderFirst(urls.toArray(new URL[urls.size()]), ParentClassLoaderFinder.Helper.get()));
                }
            }

            return object;
        } catch (Exception e) {
View Full Code Here

Examples of org.apache.openejb.config.sys.Deployments

                }
            }
        }

        /* Create a new Deployments entry */
        Deployments dep = JaxbOpenejb.createDeployments();
        dep.setFile(jarLocation);
        config.getDeployments().add(dep);
        return true;
    }
View Full Code Here

Examples of org.apache.openejb.config.sys.Deployments

        public Properties getProperties() {
            return properties;
        }

        public File deploymentsDir(final String dir) {
            openejb.getDeployments().add(new Deployments().dir(dir));
            return Files.mkdir(base, dir);
        }
View Full Code Here

Examples of org.apache.openejb.config.sys.Deployments

            openejb.getDeployments().add(new Deployments().dir(dir));
            return Files.mkdir(base, dir);
        }

        public File deploymentsFile(final String file) {
            openejb.getDeployments().add(new Deployments().file(file));
            return Files.path(base, file);
        }
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.