Package com.sun.enterprise.deployment.deploy.shared

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


        if (archive.isDirectory()) {
            factory = new FileArchiveFactory();
        } else {
            factory = new JarArchiveFactory();
        }
        AbstractArchive source = factory.openArchive(archive.getAbsolutePath());
       
        // now copy the archive, let the archivist do the job...
        Archivist archivist = null;
        try {
            archivist = ArchivistFactory.getArchivistForArchive(source);
View Full Code Here


                                                           throws IOException,
                                                             SAXParseException {
       
        RootDeploymentDescriptor descriptor = null;
        FileArchive modArchive = new FileArchive();
        AbstractArchive embeddedArchive =
                modArchive.getEmbeddedArchive(modRoot);
        WebArchivist webArchivist = new WebArchivist();
        webArchivist.setAnnotationProcessingRequested(true);
        webArchivist.setClassLoader(classLoader);
        descriptor = webArchivist.open(embeddedArchive);
View Full Code Here

*/
public class VerifierUtils {

    public static void copyArchiveToDir(File source, File dest)
            throws IOException {
        AbstractArchive in = null;
        try {
            in =
                    (new JarArchiveFactory()).openArchive(
                            source.getAbsolutePath());
            copyArchiveToDir(in, dest);
        } finally {
            if (in != null)
                in.close();
        }
    }
View Full Code Here

            InstanceEnvironment iEnv = new InstanceEnvironment(mInstanceName);
            Applications applicationsConfigBean =
                (Applications) ConfigBeansFactory.getConfigBeanByXPath(
                    serverContext, ServerXPathHelper.XPATH_APPLICATIONS);
            String appLocation = null;
            AbstractArchive moduleArchive = null;
            switch (appType)
            {
                case DeploymentConstants.EAR :
                    AppsManager appsManager = new AppsManager(iEnv);
                    appLocation = appsManager.getGeneratedXMLLocation(appName);
                    if (appLocation == null || !FileUtils.safeIsDirectory(appLocation)) {
                        J2eeApplication app = applicationsConfigBean.
                                            getJ2eeApplicationByName(appName);
                        appLocation = app.getLocation();
                    }
                    break;
                case DeploymentConstants.EJB :
                    EjbModulesManager ejbManager = new EjbModulesManager(iEnv);
                    appLocation = ejbManager.getGeneratedXMLLocation(appName);
                    if (appLocation == null || !FileUtils.safeIsDirectory(appLocation)) {
                        EjbModule module = applicationsConfigBean.
                                            getEjbModuleByName(appName);
                        appLocation = module.getLocation();
                    }
                    break;
                case DeploymentConstants.WAR:
                    WebModulesManager webManager = new WebModulesManager(iEnv);
                    appLocation = webManager.getGeneratedXMLLocation(appName);
                    if (appLocation == null || !FileUtils.safeIsDirectory(appLocation)) {
                        WebModule webModule = applicationsConfigBean.
                                            getWebModuleByName(appName);
                        appLocation = webModule.getLocation();
                    }
                    break;
            }
           
            FileArchive appArchive = new FileArchive();
            appArchive.open(appLocation);
            if (moduleName!=null) {
                moduleArchive = appArchive.getEmbeddedArchive(moduleName);           
            } else {
                moduleArchive = appArchive;
            }
            wsdlFileLocation = moduleArchive.getArchiveUri() + java.io.File.separator +
                                wsdlFileUri.replace('/', java.io.File.separatorChar);
        }
        catch (Exception e)
        {
            throw new AFException(e.getLocalizedMessage());
View Full Code Here

    }

    protected void setRuntimeDDPresent(String uri) {
        InputStream is = null;
        try {
            AbstractArchive abstractArchive = new FileArchiveFactory().openArchive(
                    uri);
            Archivist archivist = ArchivistFactory.getArchivistForArchive(
                    abstractArchive);
            if(archivist != null) {
                String ddFileEntryName = archivist.getRuntimeDeploymentDescriptorPath();
                is = abstractArchive.getEntry(ddFileEntryName);
                if (is != null) {
                    isDDPresent = true;
                }
            }
View Full Code Here

        defaultArchivists.registerArchivist(new ApplicationArchivist());
        defaultArchivists.registerArchivist(new WebArchivist());
        defaultArchivists.registerArchivist(new EjbArchivist());
        defaultArchivists.registerArchivist(new ConnectorArchivist());
        defaultArchivists.registerArchivist(new AppClientArchivist());
        AbstractArchive abstractArchive =
                new FileArchiveFactory().openArchive(
                        frameworkContext.getExplodedArchivePath());
        frameworkContext.setAbstractArchive(abstractArchive);
        archivist.setPluggableArchivists(defaultArchivists);
        archivist.setXMLValidationLevel("full");
        archivist.setRuntimeXMLValidation(true);
        archivist.setRuntimeXMLValidationLevel("full");
        archivist.setAnnotationProcessingRequested(true);
        archivist.setAnnotationErrorHandler(new VerifierErrorHandler(resultManager));

        String jarName = new File(abstractArchive.getArchiveUri()).getName();
        createApplicationDescriptor0(abstractArchive, jarName);
    }
View Full Code Here

                        appDesc = (ApplicationClientDescriptor) arch.open(appClientFile.getAbsolutePath());
                    }

                    if (className!=null) {
                        // post masssaging
                        AbstractArchive archive;
                        if (appClientFile.isDirectory()) {
                            archive = new FileArchive();
                            ((FileArchive) archive).open(appClientFile.getAbsolutePath());
                        } else {
                            archive = new InputJarArchive();
View Full Code Here

            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();) {
                    String entryName = (String) itr.next();
                    copyWithOverride(subSource, subSource2, subTarget, entryName);
                }

                copy(subSource, subSource2, subTarget,
                    moduleArchivist.getStandardDDFile().getDeploymentDescriptorPath(),
                    embeddedFiles);

                // every module may not have a sun descriptor, e.g. par file does not have one.
                if(moduleArchivist.getConfigurationDDFile()!=null) {
                    copy(subSource, subSource2, subTarget,
                        moduleArchivist.getConfigurationDDFile().getDeploymentDescriptorPath(),
                        embeddedFiles);
                }

                // and the manifest file since it does not appear in the list of files...
                copy(subSource, subTarget, JarFile.MANIFEST_NAME);
               
                // we do not need to copy anything else from the source embedded module
                // since all .class files and resources have moved at the top level of the target
                // application client container jar, so we can close out both subarchives
                target.closeEntry(subTarget);
                source.closeEntry(subSource);
                source2.closeEntry(subSource2);
            }
        }
        // standalone modules and .ear file level entries fall back here, we
        // just need to copy the original archive file elements at the root level
        // of the target application client container jar file.
        Archivist archivist = ArchivistFactory.getArchivistForType(descriptor.getModuleType());

        // because of the backend layout, the appclient jar file appears in the list of files
        // in the source archive (which is the exploded directory where we started writing
        // the appclient file... this is also true when doing deploydir deployment
        String appClientFileName = target.getArchiveUri().substring(target.getArchiveUri().lastIndexOf(File.separatorChar)+1);

        // and the manifest file since it does not appear in the
        // list of files...
        copy(source, target, JarFile.MANIFEST_NAME);
       
        List xmlFiles = new ArrayList();
        String libDir = computeLibraryDirectory(descriptor);
        for (Enumeration e = source.entries(moduleNames.elements());e.hasMoreElements();) {
            String entryName = (String) e.nextElement();
           
            // if this is the appclient we are creating, we pass
            if (entryName.equals(appClientFileName)) {
                continue;
            }
           
            // now we need to write the elements in the target file and explode
            // if it is a utility jar file
            if (entryName.endsWith(".jar") && ! inLibDirSubdirectory(libDir, entryName)) {
                // explode
                AbstractArchive subSource = null;
                try {
                    subSource = source.getEmbeddedArchive(entryName);
                    for (Enumeration subEntries = subSource.entries();subEntries.hasMoreElements();) {
                        String subEntryName = (String) subEntries.nextElement();
                        if(DescriptorConstants.PERSISTENCE_DD_ENTRY.equals(subEntryName)){
                            // If we copy DescriptorConstants.PAR_DD_ENTRY into
                            // *Client.jar then during subsequent app loading time
                            // server will treat that jar as another PU Root and try to load it.
View Full Code Here

            //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
View Full Code Here

                descriptor = request.getDescriptor().getStandaloneBundleDescriptor();
            } else {
                descriptor = request.getDescriptor();
            }
           
            AbstractArchive source = new FileArchive();
            ((FileArchive) source).open(request.getDeployedDirectory().getAbsolutePath());
            PEDeploymentFactoryImpl pe = new PEDeploymentFactoryImpl();
            Properties props = getPropertiesForClientJarMaker(
                CLIENT_JAR_CHOICES.getClientJarChoice(clientJarChoice),
                request, descriptor);
            ClientJarMaker jarMaker = pe.getClientJarMaker(props);

            // copy xml files from generated directory archive to original
            // directory archive so the created client jar contain
            // processed xml files.
            if (FileUtils.safeIsDirectory(
                request.getGeneratedXMLDirectory())) {
                AbstractArchive source2 = new FileArchive();
                ((FileArchive) source2).open(
                    request.getGeneratedXMLDirectory().getAbsolutePath());
                jarMaker.create(descriptor, source, source2, target, clientStubs,
                    null);
                source2.close();
            } else {
                jarMaker.create(descriptor, source, target, clientStubs,null);
            }
            source.close();
            target.close();
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.deploy.shared.AbstractArchive

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.