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

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


     * @param sbd
     * @throws java.lang.Exception
     */
    public void readRuntimeDeploymentDescriptors(File moduleRootDirectory,
        SipBundleDescriptor sbd) throws Exception {
        FileArchive archive = new FileArchive();

        try {
            archive.open(moduleRootDirectory.getAbsolutePath());
        } catch (IOException io) {
            throw new Exception(io.getCause());
        }

        String ddFileEntryName = getRuntimeDeploymentDescriptorPath();

        if (ddFileEntryName == null) {
            return;
        }

        InputStream is = null;

        try {
            // apply the runtime settings if any
            is = archive.getEntry(ddFileEntryName);

            DeploymentDescriptorFile confDD = new SipRuntimeDDFile();

            if (archive.getArchiveUri() != null) {
                confDD.setErrorReportingString(archive.getArchiveUri());
            }

            if ((is != null) && (confDD != null)) {
                confDD.setXMLValidation(super.getRuntimeXMLValidation());
                confDD.setXMLValidationLevel(super.getRuntimeXMLValidationLevel());
View Full Code Here


     * @param sbd the SipBundleDescriptor object for the entire bundle
     */
    public void readSipDeploymentDescriptors(File moduleRootDirectory)
         throws Exception {
       
        FileArchive archive = new FileArchive();

        try {
            archive.open(moduleRootDirectory.getAbsolutePath());
        } catch (IOException io) {
           String msg =
                   newLocalStrings.getString("enterprise.deployment.backend.sip.ioexception")
                   + io.getMessage();
           Exception e = new Exception(msg);
           e.initCause(io);
           throw e;
        }

        String ddFileEntryName = getSipDeploymentDescriptorPath();

        if (ddFileEntryName == null) {
            return;
        }

        InputStream is = null;

        try {
            // apply the runtime settings if any
            is = archive.getEntry(ddFileEntryName);

            DeploymentDescriptorFile confDD = new SipDeploymentDescriptorFile();

            if (archive.getArchiveUri() != null) {
                confDD.setErrorReportingString(archive.getArchiveUri());
            }

            if ((is != null) && (confDD != null)) {
                confDD.setXMLValidation(super.getRuntimeXMLValidation());
                confDD.setXMLValidationLevel(super.getRuntimeXMLValidationLevel());
View Full Code Here

   * @param archiveFile
   * @return Class-Path attribute. Null if not present.
   * @throws IOException
   */
  private static String extractClassPathAttribute(File archiveFile) throws IOException {
      FileArchive archive = new FileArchive();
 
      try {
          archive.open(archiveFile.getAbsolutePath());
          Manifest m = archive.getManifest();
          if (m != null) {
              m.getMainAttributes();
              Attributes attrs = m.getMainAttributes();
              return attrs.getValue("Class-Path");
          }
          return null;
      } finally {
          archive.close();
      }
  }
View Full Code Here

                String appDir =
                    request.getDeployedDirectory().getCanonicalPath();
          String generatedXMLDir =
                    request.getGeneratedXMLDirectory().getCanonicalPath();

           FileArchive srcArchive = new FileArchive();
           srcArchive.open(appDir);
      
               FileArchive destArchive = new FileArchive();
           destArchive.open(generatedXMLDir);

                Archivist.copyExtraElements(srcArchive, destArchive);
      } catch (Exception e) {
                throw new IASDeploymentException(e.getCause());
            }
View Full Code Here

    throws IOException, IASDeploymentException {
       
        File explodedManifest = null;
        File preservedManifestFromArchive = null;
       
        FileArchive target = new FileArchive();
        target.create(directory.getAbsolutePath());
       
        explodeJar(new File(source.getArchiveUri()), directory);
        //archivist.copyInto(source, target);
       
        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);
                try {
                    if (OS.isWindows()) {
                        FileUtils.validateWindowsFilePathLength(preservedManifestFromArchive);
                    }
                } catch (IOException ioe) {
                    IOException newIOE = new IOException(localStrings.getString(
                            "enterprise.deployment.backend.error_saving_manifest",
                            new Object[]
                                { explodedManifest.getAbsolutePath(),
                                          preservedManifestFromArchive.getAbsolutePath()
                                }
                            ));
                    newIOE.initCause(ioe);
                    throw newIOE;
                }
                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
            // optionalPkgDependencyLogic(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);
                   
                    File targetDirectory = directory;
                   
                    ZipFile zip = new ZipFile(f, targetDirectory);
                    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

        explodeJar(source, destination);
       
        // now we need to load the application standard deployment descriptor.
        ApplicationArchivist archivist = new ApplicationArchivist();
        archivist.setXMLValidationLevel(getValidationLevel());
        FileArchive appArchive = new FileArchive();
        appArchive.open(destination.getAbsolutePath());
       
        archivist.setManifest(appArchive.getManifest());
       
        // read the standard deployment descriptors
        Application appDesc = null;
        if (archivist.hasStandardDeploymentDescriptor(appArchive)) {
            appDesc = (Application)
View Full Code Here

        try {
            Application app = null;
            BaseManager emMgr =
               (BaseManager)PluggableDeploymentInfo.
                    getExtensionModuleDeployer(moduleType).getConfigManager();
            FileArchive archive = emMgr.openDDArchive(moduleName,
                                         moduleRootDirectory.getAbsolutePath());          

            WebArchivist webArchivist = new WebArchivist();
            app = ApplicationArchivist.openArchive(moduleName,
                                               webArchivist, archive, true);
View Full Code Here

                                                        ClassLoader classLoader)
                                                           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);
        return descriptor;
View Full Code Here

                               throws ConnectorRuntimeException
    {

        try {

            FileArchive fileArchive = new FileArchive();
            fileArchive.open(moduleDir)// directory where rar is exploded
            ConnectorArchivist connectorArchivist = new ConnectorArchivist();
            ConnectorDescriptor connectorDescriptor =
                   (ConnectorDescriptor) connectorArchivist.open(fileArchive);
            return connectorDescriptor;
        } catch(IOException ex) {
View Full Code Here

        // ---- END OF EJB DEPLOYMENT DESCRIPTORS --------------------------

        // ---- LOCAL HOME & OBJECT ----------------------------------------

        FileArchive dArchive = new FileArchive();
        dArchive.open(gnrtrTMP);
        DeploymentContext context = new DeploymentContext(dArchive,application);

        // Generate code for Remote EJB 30 business interfaces
        Vector remote30Files = new Vector();
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.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.