Package org.apache.geronimo.xbeans.javaee

Examples of org.apache.geronimo.xbeans.javaee.ApplicationType


                null);
    }

    private ApplicationInfo getEarPlan(File planFile, JarFile earFile, ModuleIDBuilder idBuilder) throws DeploymentException {
        String specDD;
        ApplicationType application = null;
        if (earFile != null) {
            try {
                URL applicationXmlUrl = DeploymentUtil.createJarURL(earFile, "META-INF/application.xml");
                specDD = DeploymentUtil.readAll(applicationXmlUrl);
                //we found something called application.xml in the right place, if we can't parse it it's an error
                XmlObject xmlObject = XmlBeansUtil.parse(specDD);
                application = convertToApplicationSchema(xmlObject).getApplication();
            } catch (XmlException e) {
                throw new DeploymentException("Could not parse application.xml", e);
            } catch (Exception e) {
                //ee5 spec allows optional application.xml, continue with application == null
                if (!earFile.getName().endsWith(".ear")) {
                    return null;
                }
                //TODO return application.xml that we can make metadata complete?
            }
        }

        GerApplicationType gerApplication = null;
        try {
            // load the geronimo-application.xml from either the supplied plan or from the earFile
            XmlObject rawPlan;
            try {
                if (planFile != null) {
                    rawPlan = XmlBeansUtil.parse(planFile.toURL(), getClass().getClassLoader());
                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
                    if (gerApplication == null) {
                        return null;
                    }
                } else {
                    URL path = DeploymentUtil.createJarURL(earFile, "META-INF/geronimo-application.xml");
                    rawPlan = XmlBeansUtil.parse(path, getClass().getClassLoader());
                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
                }
            } catch (IOException e) {
                //TODO isn't this an error?
            }

            // if we got one extract the validate it otherwise create a default one
            if (gerApplication == null) {
                gerApplication = createDefaultPlan(application, earFile);
            }
        } catch (XmlException e) {
            throw new DeploymentException(e);
        }

        EnvironmentType environmentType = gerApplication.getEnvironment();
        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
        idBuilder.resolve(environment, earFile == null ? planFile.getName() : new File(earFile.getName()).getName(), "ear");
        // Make this EAR's settings the default for child modules
        idBuilder.setDefaultGroup(environment.getConfigId().getGroupId());
        idBuilder.setDefaultVersion(environment.getConfigId().getVersion());

        Artifact artifact = environment.getConfigId();
        AbstractName earName = naming.createRootName(artifact, artifact.toString(), NameFactory.J2EE_APPLICATION);

        // get the modules either the application plan or for a stand alone module from the specific deployer
        // todo change module so you can extract the real module path back out.. then we can eliminate
        // the moduleLocations and have addModules return the modules
        ModuleList moduleLocations = new ModuleList();
        LinkedHashSet<Module> modules = new LinkedHashSet<Module>();
        try {
            addModules(earFile, application, gerApplication, moduleLocations, modules, environment, earName, idBuilder);
            if (application == null && modules.isEmpty()) {
                //if no application.xml and no modules detected, return null for stand-alone module processing
                return null;
            }
        } catch (Throwable e) {
            // close all the modules
            for (Module module : modules) {
                module.close();
            }

            if (e instanceof DeploymentException) {
                throw (DeploymentException) e;
            } else if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            } else if (e instanceof Error) {
                throw (Error) e;
            }
            throw new DeploymentException(e);
        }

        return new ApplicationInfo(ConfigurationModuleType.EAR,
                environment,
                earName,
                earFile,
                application,
                gerApplication,
                modules,
                moduleLocations,
                application == null ? null : application.toString());
    }
View Full Code Here


            // Copy over all files that are _NOT_ modules (e.g. META-INF and APP-INF files)
            Set moduleLocations = applicationInfo.getModuleLocations();
            ClassPathList libClasspath = new ClassPathList();
            if (ConfigurationModuleType.EAR == applicationType && earFile != null) {
                //get the value of the library-directory element in spec DD
                ApplicationType specDD = (ApplicationType) applicationInfo.getSpecDD();
                String libDir = getLibraryDirectory(specDD);
                for (Enumeration<JarEntry> e = earFile.entries(); e.hasMoreElements();) {
                    ZipEntry entry = e.nextElement();
                    String entryName = entry.getName();
                    boolean addEntry = true;
View Full Code Here

                null);
    }

    private ApplicationInfo getEarPlan(File planFile, JarFile earFile, ModuleIDBuilder idBuilder) throws DeploymentException {
        String specDD;
        ApplicationType application = null;
        if (earFile != null) {
            try {
                URL applicationXmlUrl = DeploymentUtil.createJarURL(earFile, "META-INF/application.xml");
                specDD = DeploymentUtil.readAll(applicationXmlUrl);
                //we found something called application.xml in the right place, if we can't parse it it's an error
                XmlObject xmlObject = XmlBeansUtil.parse(specDD);
                application = convertToApplicationSchema(xmlObject).getApplication();
            } catch (XmlException e) {
                throw new DeploymentException("Could not parse application.xml", e);
            } catch (Exception e) {
                //ee5 spec allows optional application.xml, continue with application == null
                if (!earFile.getName().endsWith(".ear")) {
                    return null;
                }
                //TODO return application.xml that we can make metadata complete?
            }
        }

        GerApplicationType gerApplication = null;
        try {
            // load the geronimo-application.xml from either the supplied plan or from the earFile
            XmlObject rawPlan;
            try {
                if (planFile != null) {
                    rawPlan = XmlBeansUtil.parse(planFile.toURL(), getClass().getClassLoader());
                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
                    if (gerApplication == null) {
                        return null;
                    }
                } else {
                    URL path = DeploymentUtil.createJarURL(earFile, "META-INF/geronimo-application.xml");
                    rawPlan = XmlBeansUtil.parse(path, getClass().getClassLoader());
                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
                }
            } catch (IOException e) {
                //TODO isn't this an error?
            }

            // if we got one extract the validate it otherwise create a default one
            if (gerApplication == null) {
                gerApplication = createDefaultPlan(application, earFile);
            }
        } catch (XmlException e) {
            throw new DeploymentException(e);
        }

        EnvironmentType environmentType = gerApplication.getEnvironment();
        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
        idBuilder.resolve(environment, earFile == null ? planFile.getName() : new File(earFile.getName()).getName(), "ear");
        // Make this EAR's settings the default for child modules
        idBuilder.setDefaultGroup(environment.getConfigId().getGroupId());
        idBuilder.setDefaultVersion(environment.getConfigId().getVersion());

        Artifact artifact = environment.getConfigId();
        AbstractName earName = naming.createRootName(artifact, artifact.toString(), NameFactory.J2EE_APPLICATION);

        // get the modules either the application plan or for a stand alone module from the specific deployer
        // todo change module so you can extract the real module path back out.. then we can eliminate
        // the moduleLocations and have addModules return the modules
        ModuleList moduleLocations = new ModuleList();
        LinkedHashSet<Module> modules = new LinkedHashSet<Module>();
        try {
            addModules(earFile, application, gerApplication, moduleLocations, modules, environment, earName, idBuilder);
            if (application == null && modules.isEmpty()) {
                //if no application.xml and no modules detected, return null for stand-alone module processing
                return null;
            }
        } catch (Throwable e) {
            // close all the modules
            for (Module module : modules) {
                module.close();
            }

            if (e instanceof DeploymentException) {
                throw (DeploymentException) e;
            } else if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            } else if (e instanceof Error) {
                throw (Error) e;
            }
            throw new DeploymentException(e);
        }

        return new ApplicationInfo(ConfigurationModuleType.EAR,
                environment,
                earName,
                earFile,
                application,
                gerApplication,
                modules,
                moduleLocations,
                application == null ? null : application.toString());
    }
View Full Code Here

            // Copy over all files that are _NOT_ modules (e.g. META-INF and APP-INF files)
            Set moduleLocations = applicationInfo.getModuleLocations();
            ClassPathList libClasspath = new ClassPathList();
            if (ConfigurationModuleType.EAR == applicationType && earFile != null) {
                //get the value of the library-directory element in spec DD
                ApplicationType specDD = (ApplicationType) applicationInfo.getSpecDD();
                String libDir = getLibraryDirectory(specDD);
                for (Enumeration<JarEntry> e = earFile.entries(); e.hasMoreElements();) {
                    ZipEntry entry = e.nextElement();
                    String entryName = entry.getName();
                    boolean addEntry = true;
View Full Code Here

                null);
    }

    private ApplicationInfo getEarPlan(File planFile, JarFile earFile, ModuleIDBuilder idBuilder) throws DeploymentException {
        String specDD;
        ApplicationType application = null;
        if (earFile != null) {
            try {
                URL applicationXmlUrl = DeploymentUtil.createJarURL(earFile, "META-INF/application.xml");
                specDD = DeploymentUtil.readAll(applicationXmlUrl);
                //we found something called application.xml in the right place, if we can't parse it it's an error
                XmlObject xmlObject = XmlBeansUtil.parse(specDD);
                application = convertToApplicationSchema(xmlObject).getApplication();
            } catch (XmlException e) {
              throw new DeploymentException("Could not parse application.xml", e);
            } catch (Exception e) {
              //ee5 spec allows optional application.xml, continue with application == null
            }
        }

        GerApplicationType gerApplication = null;
        try {
            // load the geronimo-application.xml from either the supplied plan or from the earFile
            XmlObject rawPlan;
            try {
                if (planFile != null) {
                    rawPlan = XmlBeansUtil.parse(planFile.toURL(), getClass().getClassLoader());
                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
                    if (gerApplication == null) {
                        return null;
                    }
                } else {
                    URL path = DeploymentUtil.createJarURL(earFile, "META-INF/geronimo-application.xml");
                    rawPlan = XmlBeansUtil.parse(path, getClass().getClassLoader());
                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
                }
            } catch (IOException e) {
                //TODO isn't this an error?
            }

            // if we got one extract the validate it otherwise create a default one
            if (gerApplication == null) {
                gerApplication = createDefaultPlan(application, earFile);
            }
        } catch (XmlException e) {
            throw new DeploymentException(e);
        }

        EnvironmentType environmentType = gerApplication.getEnvironment();
        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
        idBuilder.resolve(environment, earFile == null ? planFile.getName() : new File(earFile.getName()).getName(), "ear");
        // Make this EAR's settings the default for child modules
        idBuilder.setDefaultGroup(environment.getConfigId().getGroupId());
        idBuilder.setDefaultVersion(environment.getConfigId().getVersion());

        Artifact artifact = environment.getConfigId();
        AbstractName earName = naming.createRootName(artifact, artifact.toString(), NameFactory.J2EE_APPLICATION);

        // get the modules either the application plan or for a stand alone module from the specific deployer
        // todo change module so you can extract the real module path back out.. then we can eliminate
        // the moduleLocations and have addModules return the modules
        Set<String> moduleLocations = new HashSet<String>();
        LinkedHashSet<Module> modules = new LinkedHashSet<Module>();
        try {
            addModules(earFile, application, gerApplication, moduleLocations, modules, environment, earName, idBuilder);
            if(application == null && modules.isEmpty()) {
              //if no application.xml and no modules detected, return null for stand-alone module processing
              return null;
            }
        } catch (Throwable e) {
            // close all the modules
            for (Module module : modules) {
                module.close();
            }

            if (e instanceof DeploymentException) {
                throw (DeploymentException) e;
            } else if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            } else if (e instanceof Error) {
                throw (Error) e;
            }
            throw new DeploymentException(e);
        }

        return new ApplicationInfo(ConfigurationModuleType.EAR,
                environment,
                earName,
                application,
                gerApplication,
                modules,
                moduleLocations,
                application == null ? null : application.toString());
    }
View Full Code Here

            // Copy over all files that are _NOT_ modules (e.g. META-INF and APP-INF files)
            Set moduleLocations = applicationInfo.getModuleLocations();
            if (ConfigurationModuleType.EAR == applicationType && earFile != null) {
              //get the value of the library-directory element in spec DD
              ApplicationType specDD = (ApplicationType) applicationInfo.getSpecDD();
              String libDir = null;
              //value 'lib' is used if element not set or ear does not contain a dd
              if(specDD == null || !specDD.isSetLibraryDirectory()) {
                libDir = "lib";
              } else {
                String value = specDD.getLibraryDirectory().getStringValue().trim();
                //only set if not empty value, empty value implies no library directory
                if(value.length() > 0) {
                  libDir = value;
                }
              }
View Full Code Here

                null);
    }

    private ApplicationInfo getEarPlan(File planFile, JarFile earFile, ModuleIDBuilder idBuilder) throws DeploymentException {
        String specDD;
        ApplicationType application = null;
        if (earFile != null) {
            try {
                URL applicationXmlUrl = DeploymentUtil.createJarURL(earFile, "META-INF/application.xml");
                specDD = DeploymentUtil.readAll(applicationXmlUrl);
                //we found something called application.xml in the right place, if we can't parse it it's an error
                XmlObject xmlObject = XmlBeansUtil.parse(specDD);
                application = convertToApplicationSchema(xmlObject).getApplication();
            } catch (XmlException e) {
                throw new DeploymentException("Could not parse application.xml", e);
            } catch (Exception e) {
                //ee5 spec allows optional application.xml, continue with application == null
                if (!earFile.getName().endsWith(".ear")) {
                    return null;
                }
                //TODO return application.xml that we can make metadata complete?
            }
        }

        GerApplicationType gerApplication = null;
        try {
            // load the geronimo-application.xml from either the supplied plan or from the earFile
            XmlObject rawPlan;
            try {
                if (planFile != null) {
                    rawPlan = XmlBeansUtil.parse(planFile.toURL(), getClass().getClassLoader());
                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
                    if (gerApplication == null) {
                        return null;
                    }
                } else {
                    URL path = DeploymentUtil.createJarURL(earFile, "META-INF/geronimo-application.xml");
                    rawPlan = XmlBeansUtil.parse(path, getClass().getClassLoader());
                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
                }
            } catch (IOException e) {
                //TODO isn't this an error?
            }

            // if we got one extract the validate it otherwise create a default one
            if (gerApplication == null) {
                gerApplication = createDefaultPlan(application, earFile);
            }
        } catch (XmlException e) {
            throw new DeploymentException(e);
        }

        EnvironmentType environmentType = gerApplication.getEnvironment();
        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
        idBuilder.resolve(environment, earFile == null ? planFile.getName() : new File(earFile.getName()).getName(), "ear");
        // Make this EAR's settings the default for child modules
        idBuilder.setDefaultGroup(environment.getConfigId().getGroupId());
        idBuilder.setDefaultVersion(environment.getConfigId().getVersion());

        Artifact artifact = environment.getConfigId();
        AbstractName earName = naming.createRootName(artifact, artifact.toString(), NameFactory.J2EE_APPLICATION);

        // get the modules either the application plan or for a stand alone module from the specific deployer
        // todo change module so you can extract the real module path back out.. then we can eliminate
        // the moduleLocations and have addModules return the modules
        ModuleList moduleLocations = new ModuleList();
        LinkedHashSet<Module> modules = new LinkedHashSet<Module>();
        try {
            addModules(earFile, application, gerApplication, moduleLocations, modules, environment, earName, idBuilder);
            if (application == null && modules.isEmpty()) {
                //if no application.xml and no modules detected, return null for stand-alone module processing
                return null;
            }
        } catch (Throwable e) {
            // close all the modules
            for (Module module : modules) {
                module.close();
            }

            if (e instanceof DeploymentException) {
                throw (DeploymentException) e;
            } else if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            } else if (e instanceof Error) {
                throw (Error) e;
            }
            throw new DeploymentException(e);
        }

        return new ApplicationInfo(ConfigurationModuleType.EAR,
                environment,
                earName,
                earFile,
                application,
                gerApplication,
                modules,
                moduleLocations,
                application == null ? null : application.toString());
    }
View Full Code Here

            // Copy over all files that are _NOT_ modules (e.g. META-INF and APP-INF files)
            Set moduleLocations = applicationInfo.getModuleLocations();
            ClassPathList libClasspath = new ClassPathList();
            if (ConfigurationModuleType.EAR == applicationType && earFile != null) {
                //get the value of the library-directory element in spec DD
                ApplicationType specDD = (ApplicationType) applicationInfo.getSpecDD();
                String libDir = getLibraryDirectory(specDD);
                for (Enumeration<JarEntry> e = earFile.entries(); e.hasMoreElements();) {
                    ZipEntry entry = e.nextElement();
                    String entryName = entry.getName();
                    boolean addEntry = true;
View Full Code Here

                null);
    }

    private ApplicationInfo getEarPlan(File planFile, JarFile earFile, ModuleIDBuilder idBuilder) throws DeploymentException {
        String specDD;
        ApplicationType application = null;
        if (earFile != null) {
            try {
                URL applicationXmlUrl = DeploymentUtil.createJarURL(earFile, "META-INF/application.xml");
                specDD = DeploymentUtil.readAll(applicationXmlUrl);
                //we found something called application.xml in the right place, if we can't parse it it's an error
                XmlObject xmlObject = XmlBeansUtil.parse(specDD);
                application = convertToApplicationSchema(xmlObject).getApplication();
            } catch (XmlException e) {
                throw new DeploymentException("Could not parse application.xml", e);
            } catch (Exception e) {
                //ee5 spec allows optional application.xml, continue with application == null
                if (!earFile.getName().endsWith(".ear")) {
                    return null;
                }
                //TODO return application.xml that we can make metadata complete?
            }
        }

        GerApplicationType gerApplication = null;
        try {
            // load the geronimo-application.xml from either the supplied plan or from the earFile
            XmlObject rawPlan;
            try {
                if (planFile != null) {
                    rawPlan = XmlBeansUtil.parse(planFile.toURL(), getClass().getClassLoader());
                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
                    if (gerApplication == null) {
                        return null;
                    }
                } else {
                    URL path = DeploymentUtil.createJarURL(earFile, "META-INF/geronimo-application.xml");
                    rawPlan = XmlBeansUtil.parse(path, getClass().getClassLoader());
                    gerApplication = (GerApplicationType) SchemaConversionUtils.fixGeronimoSchema(rawPlan, APPLICATION_QNAME, GerApplicationType.type);
                }
            } catch (IOException e) {
                //TODO isn't this an error?
            }

            // if we got one extract the validate it otherwise create a default one
            if (gerApplication == null) {
                gerApplication = createDefaultPlan(application, earFile);
            }
        } catch (XmlException e) {
            throw new DeploymentException(e);
        }

        EnvironmentType environmentType = gerApplication.getEnvironment();
        Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
        idBuilder.resolve(environment, earFile == null ? planFile.getName() : new File(earFile.getName()).getName(), "ear");
        // Make this EAR's settings the default for child modules
        idBuilder.setDefaultGroup(environment.getConfigId().getGroupId());
        idBuilder.setDefaultVersion(environment.getConfigId().getVersion());

        Artifact artifact = environment.getConfigId();
        AbstractName earName = naming.createRootName(artifact, artifact.toString(), NameFactory.J2EE_APPLICATION);

        // get the modules either the application plan or for a stand alone module from the specific deployer
        // todo change module so you can extract the real module path back out.. then we can eliminate
        // the moduleLocations and have addModules return the modules
        ModuleList moduleLocations = new ModuleList();
        LinkedHashSet<Module> modules = new LinkedHashSet<Module>();
        try {
            addModules(earFile, application, gerApplication, moduleLocations, modules, environment, earName, idBuilder);
            if (application == null && modules.isEmpty()) {
                //if no application.xml and no modules detected, return null for stand-alone module processing
                return null;
            }
        } catch (Throwable e) {
            // close all the modules
            for (Module module : modules) {
                module.close();
            }

            if (e instanceof DeploymentException) {
                throw (DeploymentException) e;
            } else if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            } else if (e instanceof Error) {
                throw (Error) e;
            }
            throw new DeploymentException(e);
        }

        return new ApplicationInfo(ConfigurationModuleType.EAR,
                environment,
                earName,
                earFile,
                application,
                gerApplication,
                modules,
                moduleLocations,
                application == null ? null : application.toString());
    }
View Full Code Here

            // Copy over all files that are _NOT_ modules (e.g. META-INF and APP-INF files)
            Set moduleLocations = applicationInfo.getModuleLocations();
            ClassPathList libClasspath = new ClassPathList();
            if (ConfigurationModuleType.EAR == applicationType && earFile != null) {
                //get the value of the library-directory element in spec DD
                ApplicationType specDD = (ApplicationType) applicationInfo.getSpecDD();
                String libDir = getLibraryDirectory(specDD);
                for (Enumeration<JarEntry> e = earFile.entries(); e.hasMoreElements();) {
                    ZipEntry entry = e.nextElement();
                    String entryName = entry.getName();
                    boolean addEntry = true;
View Full Code Here

TOP

Related Classes of org.apache.geronimo.xbeans.javaee.ApplicationType

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.