Package org.apache.geronimo.deployment.xbeans

Examples of org.apache.geronimo.deployment.xbeans.ServiceDocument


            throw new RuntimeException("Artifacts not supplied");
        }
        if (targetDir == null) {
            throw new RuntimeException("No target directory supplied");
        }
        ServiceDocument serviceDocument = ServiceDocument.Factory.newInstance();
        ServiceType serviceType = serviceDocument.addNewService();
        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
            Artifact artifact = (Artifact) iterator.next();
            Dependency dependency = artifact.getDependency();
            if ("true".equals(dependency.getProperty(DEPENDENCY_PROPERTY))) {
                String groupId = dependency.getGroupId();
                String artifactId = dependency.getArtifactId();
                String type = dependency.getType();
                org.apache.geronimo.deployment.xbeans.ArtifactType dependencyType = serviceType.addNewDependency();
                dependencyType.setGroupId(groupId);
                dependencyType.setArtifactId(artifactId);
                if ("true".equals(dependency.getProperty(KEEP_VERSION_PROPERTY))) {
                    String version = dependency.getVersion();
                    dependencyType.setVersion(version);
                }
                if (type != null && !"jar".equals(type)) {
                    dependencyType.setType(type);
                }
            }
        }

        if (serviceType.getDependencyArray().length > 0) {
            File targetDir = new File(this.targetDir);
            if (targetDir.exists()) {
                if (!targetDir.isDirectory()) {
                    throw new RuntimeException("TargetDir: " + this.targetDir + " exists and is not a directory");
                }
            } else {
                targetDir.mkdirs();
            }
            File output = new File(targetDir, "geronimo-dependency.xml");
            XmlOptions xmlOptions = new XmlOptions();
            xmlOptions.setSavePrettyPrint();
            serviceDocument.save(output, xmlOptions);
        }
    }
View Full Code Here


            }
            ClassLoader depCL = new URLClassLoader(new URL[]{url}, ClassLoader.getSystemClassLoader());
            InputStream is = depCL.getResourceAsStream("META-INF/geronimo-service.xml");
            if (is != null) {
                // it has a geronimo-service.xml file
                ServiceDocument serviceDoc = null;
                try {
                    Collection errors = new ArrayList();
                    serviceDoc = ServiceDocument.Factory.parse(is, XmlBeansUtil.createXmlOptions(errors));
                    if (errors.size() > 0) {
                        throw new DeploymentException("Invalid service doc: " + errors);
                    }
                } catch (XmlException e) {
                    throw new DeploymentException("Invalid geronimo-service.xml file in " + url, e);
                } catch (IOException e) {
                    throw new DeploymentException("Unable to parse geronimo-service.xml file in " + url, e);
                }
                DependencyType[] dependencyDeps = serviceDoc.getService().getDependencyArray();
                if (dependencyDeps != null) {
                    addDependencies(context, dependencyDeps, repository);
                }
            }
        }
View Full Code Here

            throw new RuntimeException("Artifacts not supplied");
        }
        if (targetDir == null) {
            throw new RuntimeException("No target directory supplied");
        }
        ServiceDocument serviceDocument = ServiceDocument.Factory.newInstance();
        ServiceType serviceType = serviceDocument.addNewService();
        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
            Artifact artifact = (Artifact) iterator.next();
            Dependency dependency = artifact.getDependency();
            if ("true".equals(dependency.getProperty(DEPENDENCY_PROPERTY))) {
                String groupId = dependency.getGroupId();
                String artifactId = dependency.getArtifactId();
                String type = dependency.getType();
                org.apache.geronimo.deployment.xbeans.ArtifactType dependencyType = serviceType.addNewDependency();
                dependencyType.setGroupId(groupId);
                dependencyType.setArtifactId(artifactId);
                if ("true".equals(dependency.getProperty(KEEP_VERSION_PROPERTY))) {
                    String version = dependency.getVersion();
                    dependencyType.setVersion(version);
                }
                if (type != null && !"jar".equals(type)) {
                    dependencyType.setType(type);
                }
            }
        }

        if (serviceType.getDependencyArray().length > 0) {
            File targetDir = new File(this.targetDir);
            if (targetDir.exists()) {
                if (!targetDir.isDirectory()) {
                    throw new RuntimeException("TargetDir: " + this.targetDir + " exists and is not a directory");
                }
            } else {
                targetDir.mkdirs();
            }
            File output = new File(targetDir, "geronimo-dependency.xml");
            XmlOptions xmlOptions = new XmlOptions();
            xmlOptions.setSavePrettyPrint();
            serviceDocument.save(output, xmlOptions);
        }
    }
View Full Code Here

            }
            ClassLoader depCL = new URLClassLoader(new URL[]{url}, ClassLoader.getSystemClassLoader());
            InputStream is = depCL.getResourceAsStream("META-INF/geronimo-service.xml");
            if (is != null) {
                // it has a geronimo-service.xml file
                ServiceDocument serviceDoc = null;
                try {
                    serviceDoc = ServiceDocument.Factory.parse(is);
                } catch (org.apache.xmlbeans.XmlException e) {
                    throw new DeploymentException("Invalid geronimo-service.xml file in " + url, e);
                } catch (IOException e) {
                    throw new DeploymentException("Unable to parse geronimo-service.xml file in " + url, e);
                }
                DependencyType[] dependencyDeps = serviceDoc.getService().getDependencyArray();
                if (dependencyDeps != null) {
                    addDependencies(context, dependencyDeps);
                }
            }
        }
View Full Code Here

            }
            ClassLoader depCL = new URLClassLoader(new URL[]{url}, ClassLoader.getSystemClassLoader());
            InputStream is = depCL.getResourceAsStream("META-INF/geronimo-service.xml");
            if (is != null) {
                // it has a geronimo-service.xml file
                ServiceDocument serviceDoc = null;
                try {
                    serviceDoc = ServiceDocument.Factory.parse(is);
                } catch (org.apache.xmlbeans.XmlException e) {
                    throw new DeploymentException("Invalid geronimo-service.xml file in " + url, e);
                } catch (IOException e) {
                    throw new DeploymentException("Unable to parse geronimo-service.xml file in " + url, e);
                }
                DependencyType[] dependencyDeps = serviceDoc.getService().getDependencyArray();
                if (dependencyDeps != null) {
                    addDependencies(context, dependencyDeps);
                }
            }
        }
View Full Code Here

            }
            ClassLoader depCL = new URLClassLoader(new URL[]{url}, ClassLoader.getSystemClassLoader());
            InputStream is = depCL.getResourceAsStream("META-INF/geronimo-service.xml");
            if (is != null) {
                // it has a geronimo-service.xml file
                ServiceDocument serviceDoc = null;
                try {
                    serviceDoc = ServiceDocument.Factory.parse(is);
                } catch (org.apache.xmlbeans.XmlException e) {
                    throw new DeploymentException("Invalid geronimo-service.xml file in " + url, e);
                } catch (IOException e) {
                    throw new DeploymentException("Unable to parse geronimo-service.xml file in " + url, e);
                }
                DependencyType[] dependencyDeps = serviceDoc.getService().getDependencyArray();
                if (dependencyDeps != null) {
                    addDependencies(context, dependencyDeps);
                }
            }
        }
View Full Code Here

            }
            ClassLoader depCL = new URLClassLoader(new URL[]{url}, ClassLoader.getSystemClassLoader());
            InputStream is = depCL.getResourceAsStream("META-INF/geronimo-service.xml");
            if (is != null) {
                // it has a geronimo-service.xml file
                ServiceDocument serviceDoc = null;
                try {
                    Collection errors = new ArrayList();
                    serviceDoc = ServiceDocument.Factory.parse(is, XmlBeansUtil.createXmlOptions(errors));
                    if (errors.size() > 0) {
                        throw new DeploymentException("Invalid service doc: " + errors);
                    }
                } catch (XmlException e) {
                    throw new DeploymentException("Invalid geronimo-service.xml file in " + url, e);
                } catch (IOException e) {
                    throw new DeploymentException("Unable to parse geronimo-service.xml file in " + url, e);
                }
                DependencyType[] dependencyDeps = serviceDoc.getService().getDependencyArray();
                if (dependencyDeps != null) {
                    addDependencies(context, dependencyDeps, repository);
                }
            }
        }
View Full Code Here

            throw new RuntimeException("Artifacts not supplied");
        }
        if (targetDir == null) {
            throw new RuntimeException("No target directory supplied");
        }
        ServiceDocument serviceDocument = ServiceDocument.Factory.newInstance();
        ServiceType serviceType = serviceDocument.addNewService();
        for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
            Artifact artifact = (Artifact) iterator.next();
            Dependency dependency = (Dependency) artifact.getDependency();
            if ("true".equals(dependency.getProperty(DEPENDENCY_PROPERTY))) {
                String groupId = dependency.getGroupId();
                String artifactId = dependency.getArtifactId();
                String version = dependency.getVersion();
                String type = dependency.getType();
                org.apache.geronimo.deployment.xbeans.DependencyType dependencyType = serviceType.addNewDependency();
                dependencyType.setGroupId(groupId);
                dependencyType.setArtifactId(artifactId);
                dependencyType.setVersion(version);
                if (type != null && !"jar".equals(type)) {
                    dependencyType.setType(type);
                }
            }
        }

        if (serviceType.getDependencyArray().length > 0) {
            File targetDir = new File(this.targetDir);
            if (targetDir.exists()) {
                if (!targetDir.isDirectory()) {
                    throw new RuntimeException("TargetDir: " + this.targetDir + " exists and is not a directory");
                }
            } else {
                targetDir.mkdirs();
            }
            File output = new File(targetDir, "geronimo-service.xml");
            XmlOptions xmlOptions = new XmlOptions();
            xmlOptions.setSavePrettyPrint();
            serviceDocument.save(output, xmlOptions);
        }
    }
View Full Code Here

            }
            ClassLoader depCL = new URLClassLoader(new URL[]{url}, ClassLoader.getSystemClassLoader());
            InputStream is = depCL.getResourceAsStream("META-INF/geronimo-service.xml");
            if (is != null) {
                // it has a geronimo-service.xml file
                ServiceDocument serviceDoc = null;
                try {
                    serviceDoc = ServiceDocument.Factory.parse(is);
                } catch (org.apache.xmlbeans.XmlException e) {
                    throw new DeploymentException("Invalid geronimo-service.xml file in " + url, e);
                } catch (IOException e) {
                    throw new DeploymentException("Unable to parse geronimo-service.xml file in " + url, e);
                }
                DependencyType[] dependencyDeps = serviceDoc.getService().getDependencyArray();
                if (dependencyDeps != null) {
                    addDependencies(context, dependencyDeps, repository);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.deployment.xbeans.ServiceDocument

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.