Examples of NestedJarFile


Examples of org.apache.geronimo.deployment.util.NestedJarFile

                    throw new DeploymentException("Could not access rar contents", e);
                }
            } else {
                path = resource.getInternalRar();
                try {
                    connectorFile = new NestedJarFile(moduleFile, path);
                } catch (IOException e) {
                    throw new DeploymentException("Could not locate connector inside ear", e);
                }
            }
            XmlObject connectorPlan = resource.getConnector();
View Full Code Here

Examples of org.apache.geronimo.deployment.util.NestedJarFile

                        } catch (MalformedURLException e) {
                            throw new DeploymentException("Invalid alt sped dd url: " + moduleXml.getAltDd().getStringValue(), e);
                        }
                    }

                    NestedJarFile moduleFile;
                    try {
                        moduleFile = new NestedJarFile(earFile, modulePath);
                    } catch (IOException e) {
                        throw new DeploymentException("Invalid moduleFile: " + modulePath, e);
                    }

                    Module module = builder.createModule(altVendorDDs.get(modulePath),
                            moduleFile,
                            modulePath,
                            altSpecDD,
                            environment,
                            moduleContextInfo,
                            earName,
                            naming, idBuilder);

                    if (module == null) {
                        throw new DeploymentException("Module was not " + moduleTypeName + ": " + modulePath);
                    }

                    modules.add(module);
                }
            }

            //deploy the extension modules
            GerExtModuleType gerExtModuleTypes[] = gerApplication.getExtModuleArray();
            for (int i = 0; i < gerExtModuleTypes.length; i++) {
                GerExtModuleType gerExtModule = gerExtModuleTypes[i];
                String moduleName;
                ModuleBuilder builder;
                Object moduleContextInfo = null;
                String moduleTypeName;

                if (gerExtModule.isSetEjb()) {
                    moduleName = gerExtModule.getEjb().getStringValue();
                    builder = getEjbConfigBuilder();
                    if (builder == null) {
                        throw new DeploymentException("Cannot deploy ejb application; No ejb deployer defined: " + moduleName);
                    }
                    moduleTypeName = "an EJB";
                } else if (gerExtModule.isSetWeb()) {
                    moduleName = gerExtModule.getWeb().getStringValue();
                    if (getWebConfigBuilder() == null) {
                        throw new DeploymentException("Cannot deploy web application; No war deployer defined: " + moduleName);
                    }
                    builder = getWebConfigBuilder();
                    moduleTypeName = "a war";
                    //ext modules must use vendor plan to set context-root
//                    moduleContextInfo = gerExtModule.getWeb().getContextRoot().getStringValue().trim();
                } else if (gerExtModule.isSetConnector()) {
                    moduleName = gerExtModule.getConnector().getStringValue();
                    if (getConnectorConfigBuilder() == null) {
                        throw new DeploymentException("Cannot deploy resource adapter; No rar deployer defined: " + moduleName);
                    }
                    builder = getConnectorConfigBuilder();
                    moduleTypeName = "a connector";
                } else if (gerExtModule.isSetJava()) {
                    moduleName = gerExtModule.getJava().getStringValue();
                    if (getAppClientConfigBuilder() == null) {
                        throw new DeploymentException("Cannot deploy app client; No app client deployer defined: " + moduleName);
                    }
                    builder = getAppClientConfigBuilder();
                    moduleTypeName = "an application client";
                } else {
                    throw new DeploymentException("Could not find a module builder for module: " + gerExtModule);
                }
                //dd is included explicitly
                XmlObject[] anys = gerExtModule.selectChildren(GerExtModuleType.type.qnameSetForWildcardElements());
                if (anys.length != 1) {
                    throw new DeploymentException("Unexpected count of xs:any elements in embedded vendor plan " + anys.length + " qnameset: " + GerExtModuleType.type.qnameSetForWildcardElements());
                }
                Object vendorDD = anys[0];

                JarFile moduleFile;
                if (gerExtModule.isSetInternalPath()) {
                    String modulePath = gerExtModule.getInternalPath().trim();
                    moduleLocations.add(modulePath);
                    try {
                        moduleFile = new NestedJarFile(earFile, modulePath);
                    } catch (IOException e) {
                        throw new DeploymentException("Invalid moduleFile: " + modulePath, e);
                    }
                } else {
                    String path = gerExtModule.getExternalPath().trim();
View Full Code Here

Examples of org.apache.geronimo.deployment.util.NestedJarFile

                                    throw new DeploymentException("Could not access rar contents", e);
                                }
                            } else {
                                path = resource.getInternalRar();
                                try {
                                    connectorFile = new NestedJarFile(appClientModule.getEarFile(), path);
                                } catch (IOException e) {
                                    throw new DeploymentException("Could not locate connector inside ear", e);
                                }
                            }
                            XmlObject connectorPlan = resource.getConnector();
View Full Code Here

Examples of org.apache.geronimo.deployment.util.NestedJarFile

        configuration.addToClassPath(targetPath.toString());
    }

    public void addInclude(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
        if (zipFile instanceof NestedJarFile) {
            NestedJarFile nestedJarFile = (NestedJarFile) zipFile;
            if (nestedJarFile.isPacked()) {
                zipFilesToExpand.add(zipFile);
            }
        }
       
        configuration.addToClassPath(targetPath.toString());
View Full Code Here

Examples of org.apache.geronimo.deployment.util.NestedJarFile

        configuration.addToClassPath(targetPath.toString());
    }

    public void addFile(URI targetPath, ZipFile zipFile, ZipEntry zipEntry) throws IOException {
        if (zipFile instanceof NestedJarFile) {
            NestedJarFile nestedJarFile = (NestedJarFile) zipFile;
            if (nestedJarFile.isPacked()) {
                zipFilesToExpand.add(zipFile);
            }
        }
    }
View Full Code Here

Examples of org.apache.geronimo.deployment.util.NestedJarFile

                }
                path = artifact.toString();
            } else {
                path = resource.getInternalRar();
                try {
                    connectorFile = new NestedJarFile(moduleFile, path);
                } catch (IOException e) {
                    throw new DeploymentException("Could not locate connector inside ear", e);
                }
            }
            XmlObject connectorPlan = resource.getConnector();
View Full Code Here

Examples of org.apache.geronimo.deployment.util.NestedJarFile

            }
            ClassPathList libClasspath = (ClassPathList) earContext.getGeneralData().get(ClassPathList.class);
            if (libClasspath != null) {
                for (String libEntryPath : libClasspath) {
                    try {
                        NestedJarFile library = new NestedJarFile(earFile, libEntryPath);
                        appClientDeploymentContext.addIncludeAsPackedJar(URI.create(libEntryPath), library);
                    } catch (IOException e) {
                        throw new DeploymentException("Could not add to app client library classpath: " + libEntryPath, e);
                    }
                }
View Full Code Here

Examples of org.apache.geronimo.deployment.util.NestedJarFile

                            addEntry = false;
                            break;
                        }
                    }
                    if (libDir != null && entry.getName().startsWith(libDir) && entry.getName().endsWith(".jar")) {
                        NestedJarFile library = new NestedJarFile(earFile, entry.getName());
                        earContext.addIncludeAsPackedJar(URI.create(entry.getName()), library);
                        libClasspath.add(entry.getName());
                    } else if (addEntry) {
                        earContext.addFile(URI.create(entry.getName()), earFile, entry);
                    }
View Full Code Here

Examples of org.apache.geronimo.deployment.util.NestedJarFile

                            throw new DeploymentException("Could not find a module builder for module: " + moduleXml);
                        }

                        moduleLocations.add(modulePath);

                        NestedJarFile moduleFile;
                        try {
                            moduleFile = new NestedJarFile(earFile, modulePath);
                        } catch (IOException e) {
                            throw new DeploymentException("Invalid moduleFile: " + modulePath, e);
                        }

                        Module module = builder.createModule(altVendorDDs.get(modulePath),
                                moduleFile,
                                modulePath,
                                getAltSpecDDURL(earFile, moduleXml),
                                environment,
                                moduleContextInfo,
                                earName,
                                naming, idBuilder);

                        if (module == null) {
                            throw new DeploymentException("Module was not " + moduleTypeName + ": " + modulePath);
                        }

                        modules.add(module);
                    }
                } else {
                    //no application.xml available, must inspect ear to locate and process modules
                    Enumeration<JarEntry> entries = earFile.entries();
                    while (entries.hasMoreElements()) {
                        ModuleBuilder builder;
                        Object moduleContextInfo = null;
                        String moduleTypeName;
                        ZipEntry entry = entries.nextElement();
                        if (entry.getName().endsWith(".war")) {
                            if (getWebConfigBuilder() == null) {
                                throw new DeploymentException("Cannot deploy web application; No war deployer defined: " + entry.getName());
                            }
                            builder = getWebConfigBuilder();
                            moduleTypeName = "a war";
                            moduleContextInfo = entry.getName().split(".war")[0];
                        } else if (entry.getName().endsWith(".rar")) {
                            if (getConnectorConfigBuilder() == null) {
                                throw new DeploymentException("Cannot deploy resource adapter; No rar deployer defined: " + entry.getName());
                            }
                            builder = getConnectorConfigBuilder();
                            moduleTypeName = "a connector";
                        } else if (entry.getName().endsWith(".jar") && !isLibraryEntry(application, entry)) {
                            try {
                                NestedJarFile moduleFile = new NestedJarFile(earFile, entry.getName());
                                Manifest mf = moduleFile.getManifest();

                                if (mf.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS) != null) {
                                    if (getAppClientConfigBuilder() == null) {
                                        throw new DeploymentException("Cannot deploy app client; No app client deployer defined: " + entry.getName());
                                    }
                                    builder = getAppClientConfigBuilder();
                                    moduleTypeName = "an application client";
                                } else {
                                    //ask the ejb builder if its an ejb module
                                    builder = getEjbConfigBuilder();
                                    if (builder == null) {
//                                        throw new DeploymentException("Cannot deploy ejb application; No ejb deployer defined: " + entry.getName());
                                        continue;
                                    }

                                    Module module = builder.createModule(altVendorDDs.get(entry.getName()),
                                            moduleFile,
                                            entry.getName(),
                                            null,
                                            environment,
                                            moduleContextInfo,
                                            earName,
                                            naming, idBuilder);

                                    if (module != null) {
                                        moduleLocations.add(entry.getName());
                                        modules.add(module);
                                    }
                                    continue;
                                }
                                //TODO if no ejb-jar.xml inspect classes for EJB component annotations to identify as EJBJar module
                            } catch (IOException e) {
                                throw new DeploymentException("Invalid moduleFile: " + entry.getName(), e);
                            }
                        } else {
                            continue;
                        }

                        moduleLocations.add(entry.getName());

                        NestedJarFile moduleFile;
                        try {
                            moduleFile = new NestedJarFile(earFile, entry.getName());
                        } catch (IOException e) {
                            throw new DeploymentException("Invalid moduleFile: " + entry.getName(), e);
                        }

                        Module module = builder.createModule(altVendorDDs.get(entry.getName()),
                                moduleFile,
                                entry.getName(),
                                null,
                                environment,
                                moduleContextInfo,
                                earName,
                                naming, idBuilder);

                        if (module == null) {
                            throw new DeploymentException("Module was not " + moduleTypeName + ": " + entry.getName());
                        }

                        modules.add(module);
                    }
                }
            }

            //all the modules in the geronimo plan should have been found by now.
            if (!moduleLocations.containsAll(altVendorDDs.keySet())) {
                throw new DeploymentException("Geronimo ear plan contains modules that aren't in the ear: " + new HashSet<String>(moduleLocations).removeAll(altVendorDDs.keySet()));
            }
            //deploy the extension modules
            for (GerExtModuleType gerExtModule : gerApplication.getExtModuleArray()) {
                String moduleName;
                ModuleBuilder builder;
                Object moduleContextInfo = null;
                String moduleTypeName;

                if (gerExtModule.isSetEjb()) {
                    moduleName = gerExtModule.getEjb().getStringValue();
                    builder = getEjbConfigBuilder();
                    if (builder == null) {
                        throw new DeploymentException("Cannot deploy ejb application; No ejb deployer defined: " + moduleName);
                    }
                    moduleTypeName = "an EJB";
                } else if (gerExtModule.isSetWeb()) {
                    moduleName = gerExtModule.getWeb().getStringValue();
                    if (getWebConfigBuilder() == null) {
                        throw new DeploymentException("Cannot deploy web application; No war deployer defined: " + moduleName);
                    }
                    builder = getWebConfigBuilder();
                    moduleTypeName = "a war";
                    //ext modules must use vendor plan to set context-root
                } else if (gerExtModule.isSetConnector()) {
                    moduleName = gerExtModule.getConnector().getStringValue();
                    if (getConnectorConfigBuilder() == null) {
                        throw new DeploymentException("Cannot deploy resource adapter; No rar deployer defined: " + moduleName);
                    }
                    builder = getConnectorConfigBuilder();
                    moduleTypeName = "a connector";
                } else if (gerExtModule.isSetJava()) {
                    moduleName = gerExtModule.getJava().getStringValue();
                    if (getAppClientConfigBuilder() == null) {
                        throw new DeploymentException("Cannot deploy app client; No app client deployer defined: " + moduleName);
                    }
                    builder = getAppClientConfigBuilder();
                    moduleTypeName = "an application client";
                } else {
                    throw new DeploymentException("Could not find a module builder for module: " + gerExtModule);
                }
                //dd is included explicitly
                XmlObject[] anys = gerExtModule.selectChildren(GerExtModuleType.type.qnameSetForWildcardElements());
                if (anys.length != 1) {
                    throw new DeploymentException("Unexpected count of xs:any elements in embedded vendor plan " + anys.length + " qnameset: " + GerExtModuleType.type.qnameSetForWildcardElements());
                }
                Object vendorDD = anys[0];

                JarFile moduleFile;
                if (gerExtModule.isSetInternalPath()) {
                    String modulePath = gerExtModule.getInternalPath().trim();
                    moduleLocations.add(modulePath);
                    try {
                        moduleFile = new NestedJarFile(earFile, modulePath);
                    } catch (IOException e) {
                        throw new DeploymentException("Invalid moduleFile: " + modulePath, e);
                    }
                } else {
                    PatternType patternType = gerExtModule.getExternalPath();
View Full Code Here

Examples of org.apache.geronimo.deployment.util.NestedJarFile

                            addEntry = false;
                            break;
                        }
                    }
                    if (libDir != null && entry.getName().startsWith(libDir) && entry.getName().endsWith(".jar")) {
                        NestedJarFile library = new NestedJarFile(earFile, entry.getName());
                        earContext.addIncludeAsPackedJar(URI.create(entry.getName()), library);
                        libClasspath.add(entry.getName());
                    } else if (addEntry) {
                        earContext.addFile(URI.create(entry.getName()), earFile, entry);
                    }
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.