Examples of AbstractArchive


Examples of com.sun.enterprise.deployment.deploy.shared.AbstractArchive

    static void copyDeploymentDescriptors(
        Archivist archivist, AbstractArchive original,
        AbstractArchive generated, AbstractArchive target)
        throws IOException {

        AbstractArchive source = (generated == null) ? original : generated;
        //standard dd
        copy(source, target,
             archivist.getStandardDDFile().getDeploymentDescriptorPath());
        //runtime dd
        copy(source, target,
View Full Code Here

Examples of com.sun.enterprise.deployment.deploy.shared.AbstractArchive

        Properties props) throws IOException {
       
        // in all cases we copy the stubs file in the target archive
        ClientJarMakerUtils.populateStubs(target, stubs);

        AbstractArchive appclientSource = null;
        AbstractArchive appclientSource2 = null;

        // abstract out the one and only appclient content from ear file
        if (descriptor.isApplication()) {

            // copy and expand library files here
            // @@@ need to clean up to handle manifest override problem
            // @@@ for multiple library jar files
            List<String> libraries = ClientJarMakerUtils.getLibraryEntries(
                    Application.class.cast(descriptor), source);

            for (String entryName : libraries) {
                AbstractArchive subSource = null;
                try {
                    subSource = source.getEmbeddedArchive(entryName);
                    for (Enumeration subEntries = subSource.entries();
                                subEntries.hasMoreElements();) {
                        String subEntryName =
                                String.class.cast(subEntries.nextElement());
                        ClientJarMakerUtils.copy(
                                subSource, target, subEntryName);
                    }
                } finally {
                    if (subSource != null) {
                        source.closeEntry(subSource);
                    }
                }
            }

            //there should only be one appclient in this ear file
            for (Iterator modules = Application.class.cast(descriptor).getModules();
                    modules.hasNext();) {
                ModuleDescriptor md = ModuleDescriptor.class.cast(modules.next());
                if (md.getModuleType().equals(ModuleType.CAR)) {
                    appclientSource = source.getEmbeddedArchive(md.getArchiveUri());
                    if (source2 != null) {
                        appclientSource2 =
                            source2.getEmbeddedArchive(md.getArchiveUri());
                    }
                    break;
                }
            }
        } else {
            appclientSource = source;
            appclientSource2 = source2;
        }

        //copy over all content of the appclient
        if (appclientSource != null) {
            ClientJarMakerUtils.populateModuleJar(
                appclientSource, appclientSource2, target);
        } else {
            //this is a workaround because otherwise the appclient jar could
            //be empty which causes problems when closing the archive (there is
            //a requirement on having at least one entry in the archive before
            //closing)
            ClientJarMakerUtils.copyDeploymentDescriptors(
                new ApplicationArchivist(), source, source2, target);
        }

        // for backward compatibility, we need to include the content
        // of the ejb module as well, since many clients currently are
        // packaged without their ejb dependencies.  We will copy the
        // .class entries only.  We copy them here _after_ the appclient
        // classes have been copied so that if any duplicates exist,
        // the class in the original appclient jar prevails.
        if (descriptor.isApplication()) {
            for (Iterator modules = Application.class.cast(descriptor).getModules();
                    modules.hasNext();) {
                ModuleDescriptor md = ModuleDescriptor.class.cast(modules.next());
                if (md.getModuleType().equals(ModuleType.EJB)) {
                    AbstractArchive subSource =
                        source.getEmbeddedArchive(md.getArchiveUri());
                    for (Enumeration e = subSource.entries();e.hasMoreElements();) {
                        String entryName = String.class.cast(e.nextElement());
                        if (!entryName.endsWith(".class")) {
                            continue;
                        }
                        try {
View Full Code Here

Examples of com.sun.enterprise.deployment.deploy.shared.AbstractArchive

     * @param the name of the embedded archive.
     */
    public AbstractArchive getEmbeddedArchive(String name) throws IOException {
        InputStream is = getEntry(name);
        if (is!=null) {
            AbstractArchive archive = new MemoryMappedArchive(is);
            is.close();
            return archive;
        }
        return null;
    }
View Full Code Here

Examples of com.sun.enterprise.deployment.deploy.shared.AbstractArchive

                    out.closeEntry();
                }
               
            } else {
                // Create a new jar file inside the application .ear
                AbstractArchive internalJar = out.getEmbeddedArchive(aModule.getArchiveUri());
               
                // we need to copy the old archive to a temp file so
                // the save method can copy its original contents from
                InputStream is = in.getEntry(aModule.getArchiveUri());
                File tmpFile=null;
                try {
                    if (in.supportsElementsOverwriting()) {
                        subArchivist.setArchiveUri(internalJar.getArchiveUri());
                    } else {
                        tmpFile = getTempFile(path);
                        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(tmpFile));
                        ArchivistUtils.copy(is, bos);
                       
View Full Code Here

Examples of com.sun.enterprise.deployment.deploy.shared.AbstractArchive

                DOLUtils.getDefaultLogger().fine("Opening sub-module " + aModule);
            }
            Descriptor descriptor = null;
            ArchiveDescriptor archiveDesc = null;
            Archivist newArchivist = null;
            AbstractArchive embeddedArchive =
                    appArchive.getEmbeddedArchive(aModule.getArchiveUri());
            if(ModuleType.WAR.equals(aModule.getModuleType())){
                // Check if this is an extension module.If there is an IOException
                // thrown then this means that we cannot determine the archivist
                // using the archive, and also that this is not an extension
                // module.
                try {
                    newArchivist =
                                getPluggableArchivists().getArchivistForArchive(
                                                               embeddedArchive);
                } catch (IOException ioe) {                                         
                    // This has to be a Web Module now.
                    newArchivist = getPluggableArchivists().getArchivistForType(
                                                       aModule.getModuleType());
                }
            } else {
                newArchivist = getPluggableArchivists().getArchivistForType(
                                                       aModule.getModuleType());
            }
           
            newArchivist.initializeContext(this);
            newArchivist.setRuntimeXMLValidation(this.getRuntimeXMLValidation());
            newArchivist.setRuntimeXMLValidationLevel(
                this.getRuntimeXMLValidationLevel());

            //AbstractArchive embeddedArchive = appArchive.getEmbeddedArchive(aModule.getArchiveUri());               
            if (aModule.getAlternateDescriptor()!=null) {
                // the module use alternate deployement descriptor, ignore the
                // DDs in the archive.
                InputStream is = appArchive.getEntry(aModule.getAlternateDescriptor());
                DeploymentDescriptorFile ddFile = newArchivist.getStandardDDFile();
                ddFile.setXMLValidation(newArchivist.getXMLValidation());
                ddFile.setXMLValidationLevel(newArchivist.getXMLValidationLevel());
                if (appArchive.getArchiveUri()!=null) {
                    ddFile.setErrorReportingString(appArchive.getArchiveUri());
                }

                descriptor = ddFile.read(is);
                is.close();
                newArchivist.readWebServicesDescriptor(embeddedArchive, descriptor);
                newArchivist.readPersistenceDeploymentDescriptors(embeddedArchive, descriptor);
                newArchivist.postStandardDDsRead((RootDeploymentDescriptor) descriptor, embeddedArchive);
                newArchivist.readAnnotations(embeddedArchive, (BundleDescriptor)descriptor);
                newArchivist.postAnnotationProcess((BundleDescriptor)descriptor, embeddedArchive);
                newArchivist.postOpen((RootDeploymentDescriptor) descriptor, embeddedArchive);
                // now reads the runtime deployment descriptor...
                if (isHandlingRuntimeInfo()) {
                    is = appArchive.getEntry("sun-" + aModule.getAlternateDescriptor());
                    if (is!=null) {
                        DeploymentDescriptorFile confDD =
                            newArchivist.getConfigurationDDFile();
                        confDD.setXMLValidation(
                            newArchivist.getRuntimeXMLValidation());
                        confDD.setXMLValidationLevel(
                            newArchivist.getRuntimeXMLValidationLevel());
                        if (appArchive.getArchiveUri()!=null) {
                            confDD.setErrorReportingString(
                                appArchive.getArchiveUri());
                        }

                        confDD.read(descriptor, is);
                        is.close();
                        newArchivist.postRuntimeDDsRead((RootDeploymentDescriptor)descriptor, embeddedArchive);
                    } else {
                        if (embeddedArchive!=null) {
                            newArchivist.readRuntimeDeploymentDescriptor(embeddedArchive,descriptor);
                        }
                    }
                }
            } else {
                // open the subarchive to get the deployment descriptor...
                if (embeddedArchive!=null) {
                    if(newArchivist instanceof ExtensionModuleArchivist) {
                        try{
                            ((ExtensionModuleArchivist)newArchivist).
                                    setJ2eeApplication(true);
                            archiveDesc =
                                  ((ExtensionModuleArchivist)newArchivist).openArchive(
                                            embeddedArchive.getArchiveUri(),
                                                null,
                                                    this.classLoader,
                                                        false);
                        } catch (Exception ex) {
                            //log this message
                            DOLUtils.getDefaultLogger().severe(
                                "Exception thrown while processing module "
                                + aModule.getDescriptor().getModuleID()
                                + ex.getMessage());
                            ex.printStackTrace();
                                       
                        }
                    } else {
                        descriptor = newArchivist.open(embeddedArchive);
                    }
                } else {
                    DOLUtils.getDefaultLogger().info(localStrings.getLocalString(
                        "enterprise.deployment.cannotfindmodule",
                        "Cannot find module {0} in application bundle",
                        new Object[] {aModule.getArchiveUri()}));
                    return false;
                }
            }
            if (embeddedArchive!=null) {
                embeddedArchive.close();
            }
            if (descriptor != null && descriptor instanceof BundleDescriptor) {
                aModule.setDescriptor((BundleDescriptor) descriptor);
                ((BundleDescriptor) descriptor).setApplication(app);
                aModule.setManifest(newArchivist.getManifest());
View Full Code Here

Examples of com.sun.enterprise.deployment.deploy.shared.AbstractArchive

                }
                // if is variable is null, it means that we are either
                // not using alternate deployment descriptors or we could
                // not find the appropriate sun-???.xml alternate DD.
                if (is==null) {
                    AbstractArchive subArchive = archive.getEmbeddedArchive(md.getArchiveUri());
                    archivist.readRuntimeDeploymentDescriptor(subArchive,  md.getDescriptor());
                }
            }
        }
        // for the application
View Full Code Here

Examples of com.sun.enterprise.deployment.deploy.shared.AbstractArchive

     * the ones in the jar file.
     */
    public ModuleDescriptor addArchive(String archivePath, Set libraryJars, String externalDD)
        throws SAXParseException, IOException {
       
        AbstractArchive newArchive = abstractArchiveFactory.openArchive(archivePath);
        return addArchive(newArchive, libraryJars, externalDD);
    }
View Full Code Here

Examples of com.sun.enterprise.deployment.deploy.shared.AbstractArchive

        // let's create a tmp file to store the new application .ear
        File outputFile=null;
        ModuleDescriptor newModule = null;
        try {
            outputFile = getTempFile(path);
            AbstractArchive out = abstractArchiveFactory.createArchive(outputFile.getAbsolutePath());
       
            // let's create a new module descriptor for this module
            newModule = getModuleFor(out, newArchive, libraryJars, externalDD);
            application.addModule(newModule);
                   
            // this should take care of writing the sub modules with the right
            // manifests and deployment descriptors settings...
            AbstractArchive in = abstractArchiveFactory.openArchive(path);       
            Vector filesToSkip = new Vector();
            filesToSkip.add(newModule.getArchiveUri());
            writeContents(in, out, filesToSkip);
            in.close();

            out.close();
       
            // rename the tmp file
            renameTmp(outputFile.getAbsolutePath(), path);
View Full Code Here

Examples of com.sun.enterprise.deployment.deploy.shared.AbstractArchive

            Attributes atts = manifest.getMainAttributes();
            atts.putValue(Attributes.Name.CLASS_PATH.toString(), classPath.toString());
        }   
       
        // now include the new module in the output archive
        AbstractArchive newModuleJar = out.getEmbeddedArchive(newModule.getArchiveUri());
       
        // write and close
        newArchivist.writeContents(newModuleJar);
        out.closeEntry(newModuleJar);       
               
View Full Code Here

Examples of com.sun.enterprise.deployment.deploy.shared.AbstractArchive

        }
        Iterator<ModuleDescriptor> modulesItr = application.getModules();
        boolean returnValue = true;
        while(modulesItr.hasNext()) {
            ModuleDescriptor md = modulesItr.next();
            AbstractArchive sub = archive.getEmbeddedArchive(md.getArchiveUri());
            if (sub!=null) {
                Archivist subArchivist = getPluggableArchivists().getArchivistForType(md.getModuleType());
                if (!subArchivist.performOptionalPkgDependenciesCheck(sub))
                    returnValue = false;
            }
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.