Package com.sun.enterprise.deploy.shared

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


                parent = new File(webService.getClientPublishUrl().getPath());
            }

            // Collect the names of all entries in or below the
            // dedicated wsdl directory.
            FileArchive archive = new FileArchive();
            archive.open(sourceDir.toURI());


            Enumeration entries = archive.entries(bundle.getWsdlDir());


            while (entries.hasMoreElements()) {
                String name = (String) entries.nextElement();
                String wsdlName = stripWsdlDir(name, bundle);
View Full Code Here


                parent = new File(webService.getClientPublishUrl().getPath());
            }

            // Collect the names of all entries in or below the
            // dedicated wsdl directory.
            FileArchive archive = new FileArchive();
            archive.open(sourceDir.toURI());


            Enumeration entries = archive.entries(bundle.getWsdlDir());


            while (entries.hasMoreElements()) {
                String name = (String) entries.nextElement();
                String wsdlName = stripWsdlDir(name, bundle);
View Full Code Here

        this.processServiceReferences = processServiceReferences;
    }

    @Override
    public void run(ServiceLocator habitat, DeploymentContext context, String cp) throws Exception {
        rootLocation_ = new FileArchive();
        BundleDescriptor bundle = DOLUtils.getCurrentBundleForContext(context);
        if (bundle.hasWebServiceClients() && (bundle instanceof ApplicationClientDescriptor)) {
            hasWebServiceClients = true;
        }
        if(bundle.isStandalone()) {
View Full Code Here

  try {
//      File applicationJarFile = Verifier.getJarFile(descriptor.getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri());
//            if (applicationJarFile == null) {
               String uri = getAbstractArchiveUri(descriptor);
               try {
                 FileArchive arch = new FileArchive();
                 arch.open(uri);
                 deploymentEntry = arch.getEntry(
                                   DescriptorConstants.EJB_DD_ENTRY);
               }catch (IOException e) { throw e;}
//            }
//            else {
//        jarFile = new JarFile(applicationJarFile);
View Full Code Here

        this.processServiceReferences = processServiceReferences;
    }

    @Override
    public void run(ServiceLocator habitat, DeploymentContext context, String cp) throws Exception {
        rootLocation_ = new FileArchive();
        BundleDescriptor bundle = DOLUtils.getCurrentBundleForContext(context);
        if (bundle.hasWebServiceClients() && (bundle instanceof ApplicationClientDescriptor)) {
            hasWebServiceClients = true;
        }
        if(bundle.isStandalone()) {
View Full Code Here

                    InputStream deploymentEntry=null;
                    try{
//                        if (f==null){
                            String uri = getAbstractArchiveUri(descriptor);
                            try {
                                FileArchive arch = new FileArchive();
                                arch.open(uri);
                                deploymentEntry = arch.getEntry(value);
                            }catch (Exception e) { }
//                        }else{
//                            try{
//                            jarFile = new JarFile(f);
//                            ZipEntry deploymentEntry1 = jarFile.getEntry(value);
View Full Code Here

    throws IOException, DeploymentException {

        File explodedManifest = null;
        File preservedManifestFromArchive = null;

        FileArchive target = new FileArchive();
        target.create(directory.toURI());

        explodeJar(new File(source.getURI()), directory);

        if (preserveManifest) {
            explodedManifest = new File(directory, java.util.jar.JarFile.MANIFEST_NAME);
            if (explodedManifest.exists()) {
                /* Rename the manifest so it can be restored later. */
                preservedManifestFromArchive = new File(directory, PRESERVED_MANIFEST_NAME);
                if ( ! explodedManifest.renameTo(preservedManifestFromArchive)) {
                    throw new RuntimeException(localStrings.getString(
                            "enterprise.deployment.backend.error_saving_manifest",
                            new Object[]
                    { explodedManifest.getAbsolutePath(),
                              preservedManifestFromArchive.getAbsolutePath()
                    } ) ) ;
                }
            }
        }
        // now explode all top level jar files and delete them.
        // this cannot be done before since the optionalPkgDependency
        // require access to the manifest file of each .jar file.
        for (Enumeration itr = source.entries();itr.hasMoreElements();) {
            String fileName = (String) itr.nextElement();


            // check for optional packages depencies
            // XXX : JEROME look if this is still done
            // resolveDependencies(new File(directory, fileName));

             /*
              *Expand the file only if it is a jar and only if it does not lie in WEB-INF/lib.
              */
            if (fileName.toLowerCase().endsWith(".jar") && ( ! fileName.replace('\\', '/').toUpperCase().startsWith(WEB_INF_PREFIX)) ) {

                try {
                    File f = new File(directory, fileName);

                    ZipFile zip = new ZipFile(f, directory);
                    zip.explode();
                } catch(ZipFileException e) {
                    IOException ioe = new IOException(e.getMessage());
                    ioe.initCause(e);
                    throw ioe;
                }
            }
        }
         /*
          *If the archive's manifest was renamed to protect it from being overwritten by manifests from
          *jar files, then rename it back.  Delete an existing manifest file first if needed.
          */
        if (preservedManifestFromArchive != null) {
            if (explodedManifest.exists()) {
                if ( ! explodedManifest.delete()) {
                    throw new RuntimeException(localStrings.getString(
                            "enterprise.deployment.backend.error_deleting_manifest",
                            new Object []
                    { explodedManifest.getAbsolutePath(),
                              preservedManifestFromArchive.getAbsolutePath()
                    }
                    ) );
                }
            }

            if ( ! preservedManifestFromArchive.renameTo(explodedManifest)) {
                throw new RuntimeException(localStrings.getString(
                        "enterprise.deployment.backend.error_restoring_manifest",
                        new Object []
                { preservedManifestFromArchive.getAbsolutePath(),
                          explodedManifest.getAbsolutePath()
                }
                ) );
            }
        }

        source.close();
        target.close();
    }
View Full Code Here

    /**
     * This method populates the Application object from a ReadableArchive
     * @param archive the archive for the application
     */
    public Application processDeploymentMetaData(ReadableArchive archive) throws Exception {
        FileArchive expandedArchive = null;
        File tmpFile = null;
        ExtendedDeploymentContext context = null;
        Logger logger = Logger.getAnonymousLogger();
        ClassLoader cl = null;
        try {
            String archiveName = Util.getURIName(archive.getURI());
            ArchiveHandler archiveHandler = deployment.getArchiveHandler(archive);
            if (archiveHandler==null) {
                throw new IllegalArgumentException(localStrings.getLocalString("deploy.unknownarchivetype","Archive type of {0} was not recognized", archiveName));
            }

            DeployCommandParameters parameters = new DeployCommandParameters(new File(archive.getURI()));
            ActionReport report = new HTMLActionReporter();
            context = new DeploymentContextImpl(report, archive, parameters, env);
            context.setArchiveHandler(archiveHandler);
            String appName = archiveHandler.getDefaultApplicationName(archive, context);
            parameters.name = appName;

            if (archive instanceof InputJarArchive) {
                // we need to expand the archive first in this case
                tmpFile = File.createTempFile(
                    archiveName,"");
                String path = tmpFile.getAbsolutePath();
                if (!tmpFile.delete()) {
                    logger.log(Level.WARNING, "cannot.delete.temp.file", new Object[] {path});
                }
                File tmpDir = new File(path);
                tmpDir.deleteOnExit();

                if (!tmpDir.exists() && !tmpDir.mkdirs()) {
                  throw new IOException("Unable to create directory " + tmpDir.getAbsolutePath());
                }
                expandedArchive = (FileArchive)archiveFactory.createArchive(tmpDir);
                archiveHandler.expand(archive, expandedArchive, context);
                context.setSource(expandedArchive);
            }

            context.setPhase(DeploymentContextImpl.Phase.PREPARE);
            ClassLoaderHierarchy clh = clhProvider.get();
            context.createDeploymentClassLoader(clh, archiveHandler);
            cl = context.getClassLoader();
            deployment.getDeployableTypes(context);
            deployment.getSniffers(archiveHandler, null, context);
            return processDOL(context);
        } finally  {
            if (cl != null && cl instanceof PreDestroy) {
                try {
                    PreDestroy.class.cast(cl).preDestroy();
                } catch (Exception e) {
                    // ignore
                }
            }
            if (context != null) {
                context.postDeployClean(true);
            }
            if (expandedArchive != null) {
                try {
                    expandedArchive.close();
                } catch (Exception e) {
                    // ignore
                }
            }
            if (tmpFile != null && tmpFile.exists()) {
View Full Code Here

//      File applicationJarFile = Verifier.getArchiveFile(descriptor.getModuleDescriptor().getArchiveUri());
    
//            if (applicationJarFile == null) {
               String uri = getAbstractArchiveUri(descriptor);
               try {
                 FileArchive arch = new FileArchive();
                 arch.open(uri);
                 deploymentEntry = arch.getEntry("WEB-INF/web.xml");
               }catch (IOException e) { throw e;}
/*
            }
            else {
         jarFile = new JarFile(applicationJarFile);
View Full Code Here

       
//        File f =  Verifier.getArchiveFile(descriptor.getModuleDescriptor().getArchiveUri());
        result = loadWarFile(descriptor);
       
//        ZipFile zip = null;
        FileArchive arch = null;
        Enumeration entries= null;
        //ZipEntry entry;
        Object entry;

        try {
//            if (f == null) {
              String uri = getAbstractArchiveUri(descriptor);
              try {
                 arch = new FileArchive();
                 arch.open(uri);
                 entries = arch.entries();
               }catch (Exception e) { throw e; }
//            }
//            else {
//              zip = new ZipFile(f);
//              entries = zip.entries();
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deploy.shared.FileArchive

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.