Examples of FileArchive


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

        // first explode the top level jar
        J2EEModuleExploder.explodeJar(file, tmpDir);

        // now we need to load the application standard deployment descriptor.
        FileArchive appArchive = new FileArchive();
        appArchive.open(tmpDir.getAbsolutePath());

        ApplicationArchivist archivist = new ApplicationArchivist();
        if (archivist.hasStandardDeploymentDescriptor(appArchive)) {
            appDesc = (Application)
            archivist.readStandardDeploymentDescriptor(appArchive);
View Full Code Here

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

      try {
    Archivist archivist = ArchivistFactory.getArchivistForType(request.getType().getModuleType());
                archivist.setAnnotationProcessingRequested(true);

    String appDir = request.getDeployedDirectory().getAbsolutePath();
    FileArchive in = new FileArchive();
    in.open(appDir);

    if (request.isVerifying()) {
        archivist.setRuntimeXMLValidation(true);
        archivist.setRuntimeXMLValidationLevel("full");
    }
    if (validationLevel.equals("none")) {
        archivist.setXMLValidation(false);
    } else {
        archivist.setXMLValidation(true);
        archivist.setXMLValidationLevel(validationLevel);
    }   

                //Note in copying of deployment plan to the portable archive,
                //we should make sure the manifest in the deployment plan jar
                //file does not overwrite the one in the original archive
                //NOTE. We are not checking the size of the deploymentPlan file
                //here, since it looks like on windows the size of this tmp
                //file is always zero when we attempt to query its size. 
                //Instead, we are making sure the 0 length deployment plan is
                //not uploaded in DeploymentFacility implementation.
                if (request.getDeploymentPlan() != null) {
                    DeploymentPlanArchive dpa = new DeploymentPlanArchive();
                    dpa.open(request.getDeploymentPlan().getAbsolutePath());

                    if (request.isApplication()) {
                        ApplicationArchivist aa = (ApplicationArchivist)archivist;
                        aa.copyInto(request.getDescriptor(), dpa, in, false);
                    } else {
                        archivist.copyInto(dpa, in, false);
                    }
                }
   
    // now let's create a class loader for this module
   
    // parent class loader (from admin server)
        ClassLoader parent =
            (Boolean.getBoolean(com.sun.enterprise.server.PELaunch.USE_NEW_CLASSLOADER_PROPERTY))
                    ? com.sun.enterprise.server.PELaunch.getAppServerChain()
                    : ClassLoader.getSystemClassLoader();

    // sets the parent class loader and class paths in deployment req   
              DeploymentUtils.setParentClassLoader(parent, getManager(), request);
    // parent class paths for this deployment request
    List allClassPaths = request.getParentClasspath();

    // parent class loader for this deployment request
    ClassLoader sharedClassLoader = request.getParentClassLoader();

    List moduleClasspath = getModuleClasspath(archivist, in);

                // add the libraries from --libraries option to module classpath
                String libs = request.getLibraries();
                URL[] deployTimeLibraries =
                    ASClassLoaderUtil.getLibraries(libs);
                if (deployTimeLibraries != null) {
                    for (int i=0; i< deployTimeLibraries.length; i++) {
                        String libPath = new File(
                            deployTimeLibraries[i].toURI()).getPath();
                        moduleClasspath.add(libPath);
                    }
                }

          request.setModuleClasspath(moduleClasspath);
    allClassPaths.addAll(moduleClasspath);

    final ClassLoader ejbClassLoader = DeploymentUtils.getClassLoader(
                                        moduleClasspath, sharedClassLoader, null);

    // sets the ejb class loader & class paths - used during jspc
    request.setEjbClassLoader(ejbClassLoader);
    request.setCompleteClasspath(allClassPaths);

                // set classloader used for annotation processing
                archivist.setClassLoader(ejbClassLoader);
     
                // set the context classloader to ejbClassLoader for DD
                // processing
                ClassLoader origContextClassLoader =
                    Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(ejbClassLoader);

                Application application = request.getDescriptor();
                if (application!=null && ModuleType.EAR.equals(archivist.getModuleType())) {
                    archivist.readPersistenceDeploymentDescriptors(in, application);
                    // Now process standard DDs, do this before runtime DDs
                    archivist.setHandleRuntimeInfo(false);
                    boolean modulesReadSuccess = ((ApplicationArchivist) archivist).readModulesDescriptors(application, in);
                    if (modulesReadSuccess ) {
                        // now process runtime DDs
                        archivist.setHandleRuntimeInfo(true);
                        archivist.readRuntimeDeploymentDescriptor(in, application);
                    } else {
                        // it failed reading sub modules, I null our application which will trigger
                        // deployment failure handling
                        application=null;
                    }
                } else {
                    application = ApplicationArchivist.openArchive(archivist, in, true);
                }
                if (application==null) {
                    throw new IASDeploymentException(localStrings.getString(
                            "enterprise.deployment.backend.error_loading_dds",
                            new Object[] { request.getName(), " " }));
                }
    application.setRegistrationName(request.getName());
   
    application.setClassLoader(ejbClassLoader);
                archivist.setDescriptor(application);
 
                // let's check for optional dependencies
                if (!archivist.performOptionalPkgDependenciesCheck(in)) {
                    throw new IASDeploymentException(localStrings.getString("enterprise.deployment.backend.archive_opt_dep_not_satisfied", new Object[] {in.getArchiveUri()}));
                }
                               
    archivist.validate(ejbClassLoader);
   
    if (!application.getWebServiceDescriptors().isEmpty()) {
View Full Code Here

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

        }      
        try {
           
            JarArchiveFactory jaf = new JarArchiveFactory();
            FileArchiveFactory faf = new FileArchiveFactory();
            FileArchive farc = (FileArchive)faf.openArchive(new File(new File(new File(sourceDir, appDir), earDirName), moduleDirName).getAbsolutePath());
            String suffix = ".jar"; //default to .jar
            //File temp;
            Enumeration e = farc.entries();
            //figure out what type of module this is by the existance of the standard dd's
            while(e.hasMoreElements()) {
                String entry = (String)e.nextElement();
                if (entry.equalsIgnoreCase("WEB-INF/web.xml")) {
                    suffix = ".war";
                } else if (entry.equalsIgnoreCase("META-INF/ra.xml")) {
                    suffix = ".rar";
                }
            }
            //temp = File.createTempFile(moduleName, suffix);
            File tempJar = new File(targetDir, moduleName + suffix);
            String path = tempJar.getAbsolutePath();
            //temp.delete();
            OutputJarArchive targetModule = (OutputJarArchive)jaf.createArchive(path);
            logger.fine(stringManager.getString("upgrade.deployment.addingInfoMsg") + targetModule.getArchiveUri());
            e = farc.entries();
            while(e.hasMoreElements()) {
                String entry = (String)e.nextElement();
                InputStream in = farc.getEntry(entry);
                if (entry.equals("WEB-INF/web.xml")) {
                    InputStream fixedDescriptor = fixWebServiceDescriptor(farc);
                    if(fixedDescriptor != null) {
                        in = fixedDescriptor;
                    }
                }
            //start RFE 6389864
                if(entry.equals("WEB-INF/sun-web.xml")) {
                    checkDescriptors(farc, "sun-web.xml", "WEB-INF");
                        }
                if(entry.equals("META-INF/sun-ejb-jar.xml")) {
                    checkDescriptors(farc, "sun-ejb-jar.xml", "META-INF");
                }
    //end RFE 6389864
                OutputStream out = null;
                try {
                    out = targetModule.putNextEntry(entry);
                    int i = in.read();
                    while (i > -1) {
                        out.write(i);
                        i = in.read();
                    }
                } catch(java.util.zip.ZipException z) {
                    logger.warning(stringManager.getString("upgrade.deployment.zipExceptionMsg")+z.getMessage());
                }catch (IOException ioe) {
                    logger.severe(stringManager.getString("upgrade.deployment.ioExceptionMsg")+ioe.getMessage());
                }
                finally {
                    targetModule.closeEntry();
                    if (in != null) in.close();
                    //if (out != null) out.close();
                }

            }
            InputStream in = farc.getEntry(JarFile.MANIFEST_NAME);
            OutputStream out = null;
            try {
                  if(in != null){
                    out = targetModule.putNextEntry(JarFile.MANIFEST_NAME);
                    int i = in.read();
View Full Code Here

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

                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

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

                getStubsDir().mkdirs();

                // construct the standard application.xml if omitted
                ApplicationArchivist appArchivist = new ApplicationArchivist();
            String dir = request.getDeployedDirectory().getAbsolutePath();
                FileArchive appArchive = new FileArchive();
                appArchive.open(dir);
                if (!appArchivist.hasStandardDeploymentDescriptor(appArchive)) {
                    Application appDesc =
                        Application.createApplication(appArchive,true,true);
                    request.setDescriptor(appDesc);
                }
View Full Code Here

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

                getStubsDir().mkdirs();

                // construct the standard application.xml if omitted
                ApplicationArchivist appArchivist = new ApplicationArchivist();
            String dir = request.getDeployedDirectory().getAbsolutePath();
                FileArchive appArchive = new FileArchive();
                appArchive.open(dir);
                if (!appArchivist.hasStandardDeploymentDescriptor(appArchive)) {
                    Application appDesc =
                        Application.createApplication(appArchive,true,true);
                    request.setDescriptor(appDesc);
                }
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.io.FileArchive

        VaultFsApp.log.info("Importing {} to {}", localFile.getCanonicalPath(), vaultFile.getPath());
        Archive archive;
        if (localFile.isFile()) {
            archive = new ZipArchive(localFile);
        } else {
            archive = new FileArchive(localFile);
        }
        Importer importer = new Importer();
        if (verbose) {
            importer.getOptions().setListener(new DefaultProgressListener());
        }
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.io.FileArchive

            archive = new ZipArchive(localFile);
        } else {
            if (cl.hasOption(optSync)) {
                VaultFsApp.log.warn("--sync is not supported yet");
            }
            archive = new FileArchive(localFile);
        }
        archive.open(false);
        try {
            Importer importer = new Importer();
            if (verbose) {
View Full Code Here

Examples of org.apache.xbean.finder.archive.FileArchive

        final URLClassLoader loader = createClassLoader(providedDependenciesClassLoader());
        if (war && useAggregatedArchiveIfWar) {
            archive = new ClasspathArchive(loader, loader.getURLs());
            getLog().info("using an aggregated archive");
        } else {
            archive = new FileArchive(loader, module);
            getLog().info("using a file archive");
        }

        // the result
        final Set<String> classes = new TreeSet<String>();
View Full Code Here

Examples of org.apache.xbean.finder.archive.FileArchive

public class FinderTest extends WeaverTestBase {

    private Finder finder() {
        final ClassLoader classLoader = new URLClassLoader(URLArray.fromPaths(getClassPathEntries()));
        return new Finder(new FileArchive(classLoader, getTargetFolder()));
    }
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.