Package com.sun.enterprise.deployment.util

Examples of com.sun.enterprise.deployment.util.ModuleDescriptor


        return true;
    }

    private String getAbstractArchiveUri(EjbBundleDescriptor desc) {
        String archBase = context.getAbstractArchive().getArchiveUri();
        ModuleDescriptor mdesc = desc.getModuleDescriptor();
        if(mdesc.isStandalone()) {
            return archBase;
        } else {
            return archBase + File.separator +
                    FileUtils.makeFriendlyFileName(mdesc.getArchiveUri());
        }
    }
View Full Code Here


    protected String getAbstractArchiveUri(Descriptor descriptor) {
        String archBase = context.getAbstractArchive().getArchiveUri();
        if (descriptor instanceof Application)
            return archBase;
        ModuleDescriptor mdesc = getBundleDescriptor(descriptor).getModuleDescriptor();
        if(mdesc.isStandalone()) {
            return archBase;
        } else {
            return archBase + File.separator +
                    FileUtils.makeFriendlyFileName(mdesc.getArchiveUri());
        }
    }
View Full Code Here

    }

    protected String getAbstractArchiveUri(ConnectorDescriptor desc) {
        String archBase = getVerifierContext().getAbstractArchive().
                getArchiveUri();
        final ModuleDescriptor moduleDescriptor = desc.getModuleDescriptor();
        if (moduleDescriptor.isStandalone()) {
            return archBase; // it must be a stand-alone module; no such physical dir exists
        } else {
            return archBase + File.separator +
                    FileUtils.makeFriendlyFileName(moduleDescriptor.getArchiveUri());
        }
    }
View Full Code Here

    private static String getClientModuleID(ServiceReferenceDescriptor srd) {

        String rvalue = "#default-client-context#";

        if (srd != null) {
            ModuleDescriptor md = null;
            BundleDescriptor bd = (BundleDescriptor) srd.getBundleDescriptor();

            if (bd != null) {
                md = bd.getModuleDescriptor();
            }

            Application a = bd.getApplication();
            if (a != null) {
                if (a.isVirtual()) {
                    rvalue = a.getRegistrationName();
                } else if (md != null) {
                    rvalue = FileUtils.makeFriendlyFileName(md.getArchiveUri());
                }
            } else if (md != null) {
                rvalue = FileUtils.makeFriendlyFileName(md.getArchiveUri());
            }
        }

        return rvalue;
    }
View Full Code Here

        // explode the sub modules, skipping the ones that do not exist since
        // the generated appclient jar files do not contain web content
        Iterator<ModuleDescriptor> bundles = appDesc.getModules();
        while (bundles.hasNext()) {

            ModuleDescriptor bundle = bundles.next();
           
            String moduleName = bundle.getArchiveUri();
            File srcArchive = new File(tmpDir, moduleName);

            if (srcArchive.exists()) {
                String massagedModuleName = 
                    FileUtils.makeFriendlyFilename(moduleName);
View Full Code Here

        if (appDesc != null) {
            //add all module roots
            Iterator<ModuleDescriptor> bundles = appDesc.getModules();
            while (bundles.hasNext()) {
                ModuleDescriptor bundle = bundles.next();
                String moduleRoot = appRoot + File.separator +
                    FileUtils.makeFriendlyFilename(bundle.getArchiveUri());
                paths.add(moduleRoot);
               
                // Because the app client submodule - like any submodule - is
                // expanded into a directory, the normal manifest processing
                // done for JARs will not be applied to it when this directory is added to
                // the class path of the EJBClassLoader.  So we need to explicitly
                // add the Class-Path elements from the manifest to the class path now.
                File manifestFile = new File(moduleRoot, JarFile.MANIFEST_NAME);
                if ( ! manifestFile.exists()) {
                    continue;
                }
                Manifest mf = null;
                InputStream manifestIS = null;
                try {
                    manifestIS = new FileInputStream(manifestFile);
                    mf = new Manifest(manifestIS);
                    Attributes mainAttrs = mf.getMainAttributes();
                    if (mainAttrs != null) {
                        String classPathString = mainAttrs.getValue(Attributes.Name.CLASS_PATH);
                        if (classPathString != null) {
                            URI appRootURI = new File(appRoot).toURI();
                            String bundleURIString = bundle.getArchiveUri();
                            int lastSlash = bundleURIString.lastIndexOf("/");
                            String parentURIString;
                            if (lastSlash >=0) {
                                parentURIString = bundleURIString.substring(0, lastSlash);
                            } else {
                                parentURIString = "";
                            }
                            String parentDirPath = new File(appRootURI.resolve(parentURIString)).getAbsolutePath();
                            for (String classPathElement : classPathString.split(" ")) {
                                paths.add(parentDirPath + File.separator + classPathElement.replace("/",File.separator));
                            }
                        }
                    }
                } catch (Exception e) {
                    throw new RuntimeException(localStrings.getString("appclient.cannotOpenModuleManifest", bundle.getArchiveUri()), e);
                } finally {
                    if (manifestIS != null) {
                        try {
                            manifestIS.close();
                        } catch (IOException ioe) {
                            throw new RuntimeException(localStrings.getString("appclient.cannotCloseModuleManifest", bundle.getArchiveUri()), ioe);
                        }
                    }
                }
            }
        } else {
View Full Code Here

        Vector moduleNames = new Vector();
       
        if (descriptor.isApplication()) {
            Application app = (Application) descriptor;
            for (Iterator modules = app.getModules();modules.hasNext();) {
                ModuleDescriptor md = (ModuleDescriptor) modules.next();
                Archivist moduleArchivist = ArchivistFactory.getArchivistForType(md.getModuleType());
               
                AbstractArchive subSource = source.getEmbeddedArchive(md.getArchiveUri());
                AbstractArchive subSource2 = source2.getEmbeddedArchive(md.getArchiveUri());
                moduleNames.add(md.getArchiveUri());
               
                // any file that needs to be kept in the sub module should be
                // calculated here
                Vector subEntries = new Vector();
                // manifest file always stay in embedded jar
                subEntries.add(JarFile.MANIFEST_NAME);
               
                // all mapping file stay within the embedded jar
                WebServicesDescriptor wsd = md.getDescriptor().getWebServices();
                if (wsd!=null) {
                    for (Iterator itr = wsd.getWebServices().iterator();itr.hasNext();) {
                        WebService ws = (WebService) itr.next();
                        subEntries.add(ws.getMappingFileUri());
                    }               
                }
               
                Set refs = md.getDescriptor().getServiceReferenceDescriptors();
                for (Iterator itr = refs.iterator();itr.hasNext();) {
                    ServiceReferenceDescriptor srd = (ServiceReferenceDescriptor) itr.next();
                    subEntries.add(srd.getMappingFileUri());
                }
               
                // first copy original module files in the root on the target
                // except for .rar files contents.
                // We need to do it first so we save the list of files to be saved in the
                // embedded archive (for proper deployment descriptor loading)
                List embeddedFiles = new ArrayList();
                for (Enumeration e = subSource.entries();e.hasMoreElements();) {
                   
                    String entryName = (String) e.nextElement();
                   
                    // Deployment Descriptors (and associated) go in the embedded files
                    if (entryName.endsWith(".xml"||
                        subEntries.contains(entryName) ||
                        entryName.startsWith(md.getDescriptor().getWsdlDir())) {
                       
                          embeddedFiles.add(entryName);
                    } else {
                        try {
                            copy(subSource, target, entryName);
                        } catch(IOException ioe) {
                            // dup, we ignore
                        }
                    }
                }
               
                // now we need to copy the files we saved inside the embedded
                // archive file
               
                AbstractArchive subTarget = target.getEmbeddedArchive(md.getArchiveUri());
               
                // and copy the list of identified files inside it

                // copy deployment descriptor files from generated xml directory
                for (Iterator itr = embeddedFiles.iterator();itr.hasNext();) {
View Full Code Here

         *use in the warning if needed.
         */
        boolean result = true;
        StringBuilder sb = new StringBuilder();
        for (Iterator it = request.getDescriptor().getModules(); it != null && it.hasNext(); ) {
            ModuleDescriptor md = (ModuleDescriptor) it.next();
            if (md.getModuleType() == ModuleType.CAR) {
                String archiveURI = md.getArchiveUri();
                ApplicationClientDescriptor acd = (ApplicationClientDescriptor) md.getDescriptor();
                String mainClassName = acd.getMainClassName();
                if (mainClassName == null || mainClassName.length() == 0) {
                    result = false;
                    logger.log(Level.WARNING, localStrings.getString("enterprise.deployment.backend.no_main_class"), archiveURI);
                    if (sb.length() > 0) {
View Full Code Here

        ArrayList<String> libraries = new ArrayList<String>();
        URI appURI = new File(source.getArchiveUri()).toURI();
       
        Application app = Application.class.cast(descriptor);
        for (Iterator modules = app.getModules(); modules.hasNext();) {
            ModuleDescriptor md = ModuleDescriptor.class.cast(modules.next());

            //ignore the war and rar modules, include both appclient and ejb
            if ( ! (md.getModuleType().equals(ModuleType.WAR)
                || md.getModuleType().equals(ModuleType.RAR)) ){

                AbstractArchive subSource = source.getEmbeddedArchive(md.getArchiveUri());
                AbstractArchive subSource2 = null;
                if (source2 != null) {
                    subSource2 = source2.getEmbeddedArchive(md.getArchiveUri());
                }
                AbstractArchive subTarget = target.getEmbeddedArchive(md.getArchiveUri());
               
                /*
                 * populateModuleJar will add URIs for any JARs mentioned in
                 * the module JAR's manifest Class-Path, but to do so it needs
                 * to know the URI of the app and the URI of the parent of the module
                 * since Class-Path entries are relative to the parent of the
                 * referring JAR.  So compute the parentURI.
                 */
                String archiveUri = md.getArchiveUri().replace('\\','/');
                URI parentURI = null;
                try {
                    parentURI = ClientJarMakerUtils.getParent(archiveUri);
                } catch (URISyntaxException ex) {
                    IOException ioe = new IOException();
                    ioe.initCause(ex);
                    throw ioe;
                }
               
                //copy over all content of the appclient - also updates 'libraries' as needed
                ClientJarMakerUtils.populateModuleJar(subSource, subSource2, subTarget, libraries, appURI, parentURI);

                target.closeEntry(subTarget);
                source.closeEntry(subSource);
                if (source2 != null) {
                    source2.closeEntry(subSource2);
                }
            }

            //copy over the alternative deployment descriptors
            //Do this even for web or resource adapter submodules because
            //the application.xml which will be copied into the client jar
            //will still refer to those alt. DD files.  So even though the
            //web or RA submodules will not be included, include the alt. DDs
            //so the generated app client jar archive will load correctly
            //on the client.
            if (md.getAlternateDescriptor() != null) {
                String ddPath = md.getAlternateDescriptor();
                String runtimeDDPath = "sun-" + ddPath;
                if (source2 != null) {
                    ClientJarMakerUtils.copy(source2, target, ddPath);
                    ClientJarMakerUtils.copy(source2, target, runtimeDDPath);
                } else {
View Full Code Here

                }
            }
        }

        for (Iterator modules = app.getModules(); modules.hasNext();) {
            ModuleDescriptor md = ModuleDescriptor.class.cast(modules.next());

            // checks to see if any of the sub modules uses altDD
            // if so, use the application package format.  we could
            // also choose to override the original dd with the altDD,
            // but that might get very confusing when someone is trying
            // to debug.
            if (md.getAlternateDescriptor() != null) {
                return false;
            }
        }

        return true;
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.util.ModuleDescriptor

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.