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

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


        return appClientUserURI(dc()).toASCIIString();
    }
    protected void copyOriginalAppClientJAR(final DeploymentContext dc) throws IOException {
        ReadableArchive originalSource = ((ExtendedDeploymentContext) dc).getOriginalSource();
        originalSource.open(originalSource.getURI());
        OutputJarArchive target = new OutputJarArchive();
        target.create(appClientServerURI(dc));
        /*
         * Copy the manifest explicitly because ReadableArchive.entries()
         * excludes the manifest.
         */
        Manifest originalManifest = originalSource.getManifest();
        OutputStream os = target.putNextEntry(JarFile.MANIFEST_NAME);
        originalManifest.write(os);
        target.closeEntry();
        copyArchive(originalSource, target, Collections.EMPTY_SET);
        target.close();
        originalSource.close();
    }
View Full Code Here


         * need to add the manifest to it if a manifst is not already in the collection.
         * The client artifacts manager returns an unalterable collection.
         */
        final Collection<Artifacts.FullAndPartURIs> artifacts = new ArrayList<Artifacts.FullAndPartURIs>(clientArtifactsManager.artifacts());
       
        OutputJarArchive generatedClientJAR = new OutputJarArchive();
        try {
            try {
                generatedClientJAR.create(generatedClientJARFile.toURI());

                if ( ! isManifestPresent(artifacts)) {
                    /*
                     * Add a simple manifest.
                     */
                    deplLogger.log(Level.FINER, "Adding a simple manifest; one was not already generated");
                    addManifest(artifacts);
                }

                copyArtifactsToClientJAR(generatedClientJAR, artifacts);
            } finally {
                generatedClientJAR.close();
            }
        } catch (IOException ex) {
            if ( ! generatedClientJARFile.delete()) {
                generatedClientJARFile.deleteOnExit();
            }
View Full Code Here

            final File appScratchDir,
            final String facadeFileName,
            final String appClientGroupList) throws IOException {

        File generatedJar = new File(appScratchDir, facadeFileName);
        OutputJarArchive facadeArchive = new OutputJarArchive();
        facadeArchive.create(generatedJar.toURI());

        Manifest manifest = facadeArchive.getManifest();
        Attributes mainAttrs = manifest.getMainAttributes();

        mainAttrs.put(Attributes.Name.MANIFEST_VERSION, "1.0");
        mainAttrs.put(Attributes.Name.MAIN_CLASS, GLASSFISH_APPCLIENT_GROUP_FACADE_CLASS_NAME);
        mainAttrs.put(GLASSFISH_APPCLIENT_GROUP, appClientGroupList);


        //Now manifest is ready to be written into the facade jar
        final OutputStream manifestOutputStream = facadeArchive.putNextEntry(JarFile.MANIFEST_NAME);
        manifest.write(manifestOutputStream);
        facadeArchive.closeEntry();

        writeMainClass(facadeArchive);

        /*
         * Other deployers' artifacts - such as generated stubs - go into the
         * group facade.  Each of the client's individual facade JARs then refers
         * to the group facade in their Class-Path so they can see the stubs.
         * This also allows Java SE clients to add the group facade JAR to
         * the runtime class path and see the stubs.  (This allows users who
         * did this in v2 to use the same technique.)
         */
        copyArtifactsFromOtherDeployers(facadeArchive, dc);

        facadeArchive.close();

        Set<Artifacts.FullAndPartURIs> downloads =
                    new HashSet<Artifacts.FullAndPartURIs>();
        Artifacts.FullAndPartURIs download =
                new Artifacts.FullAndPartURIs(
View Full Code Here

     * if the classPathElement is for a submodule; null otherwise
     */
    File JAROfExpandedSubmodule(final URI candidateSubmoduleURI) throws IOException {
        ReadableArchive source = new FileArchive();
        source.open(dc().getSource().getParentArchive().getURI().resolve(expandedDirURI(candidateSubmoduleURI)));
        OutputJarArchive target = new OutputJarArchive();
        target.create(dc().getScratchDir("xml").toURI().resolve(candidateSubmoduleURI));
        /*
         * Copy the manifest explicitly because the ReadableArchive
         * entries() method omits it.
         */
        Manifest mf = source.getManifest();
        OutputStream os = target.putNextEntry(JarFile.MANIFEST_NAME);
        mf.write(os);
        target.closeEntry();
        ClientJarMakerUtils.copyArchive(source, target, Collections.EMPTY_SET);
        target.close();
        return new File(target.getURI());
    }
View Full Code Here

        generateAppClientFacade();
    }


    protected final void generateAppClientFacade() throws IOException, URISyntaxException {
        OutputJarArchive facadeArchive = new OutputJarArchive();
        /*
         * Make sure the directory subtree to contain the facade exists.  If the
         * client URI within the EAR contains a directory then that directory
         * probably does not exist in the generated dir for this app...not yet
         * anyway...it is about to exist.
         */
        final File facadeFile = new File(facadeServerURI(dc));
        if ( ! facadeFile.getParentFile().exists()) {
            facadeFile.getParentFile().mkdirs();
        }
        facadeArchive.create(facadeServerURI(dc));
        ReadableArchive source = dc.getSource();
        Manifest sourceManifest = source.getManifest();
        if (sourceManifest == null) {
            final String msg = logger.getResourceBundle().getString("enterprise.deployment.appclient.noManifest");
            throw new IOException(MessageFormat.format(msg, source.getURI().toASCIIString()));
        }
        Manifest facadeManifest = facadeArchive.getManifest();
        initGeneratedManifest(sourceManifest, facadeManifest,
                facadeClassPath(), PUScanTargets(), application);
        /*
         * If the developer's app client JAR contains a splash screen, copy
         * it from the original JAR to the facade so the Java launcher can
         * display it when the app client is launched.
         */
        final Attributes srcMainAttrs = sourceManifest.getMainAttributes();
        if (srcMainAttrs == null) {
            final String msg = logger.getResourceBundle().getString("enterprise.deployment.appclient.noMainAttrs");
            throw new IOException(MessageFormat.format(msg, source.getURI().toASCIIString()));
        }
        String splash = srcMainAttrs.getValue(AppClientDeployer.SPLASH_SCREEN_IMAGE);
        if (splash != null) {
            ClientJarMakerUtils.copy(source, facadeArchive, splash);
        }
        /*
         * Write the manifest to the facade.
         */
        OutputStream os = facadeArchive.putNextEntry(JarFile.MANIFEST_NAME);
        facadeManifest.write(os);
        facadeArchive.closeEntry();
        /*
         * Write the updated descriptors to the facade.
         */
        writeUpdatedDescriptors(facadeArchive, appClientDesc);

        /*
         * Because of how persistence units are discovered and added to the
         * app client DOL object when the archivist reads the descriptor file,
         * add any META-INF/persistence.xml file from the developer's client
         * to the client facade.  (The generated descriptor and the
         * persistence.xml files need to be in the same archive.)
         */
        copyPersistenceUnitXML(source, facadeArchive);

        copyMainClass(facadeArchive);

        facadeArchive.close();
    }
View Full Code Here

        return appClientUserURI(dc()).toASCIIString();
    }
    protected void copyOriginalAppClientJAR(final DeploymentContext dc) throws IOException {
        ReadableArchive originalSource = ((ExtendedDeploymentContext) dc).getOriginalSource();
        originalSource.open(originalSource.getURI());
        OutputJarArchive target = new OutputJarArchive();
        target.create(appClientServerURI(dc));
        /*
         * Copy the manifest explicitly because ReadableArchive.entries()
         * excludes the manifest.
         */
        Manifest originalManifest = originalSource.getManifest();
        OutputStream os = target.putNextEntry(JarFile.MANIFEST_NAME);
        originalManifest.write(os);
        target.closeEntry();
        ClientJarMakerUtils.copyArchive(originalSource, target, Collections.EMPTY_SET);
        target.close();
        originalSource.close();
    }
View Full Code Here

     * if the classPathElement is for a submodule; null otherwise
     */
    File JAROfExpandedSubmodule(final URI candidateSubmoduleURI) throws IOException {
        ReadableArchive source = new FileArchive();
        source.open(dc().getSource().getParentArchive().getURI().resolve(expandedDirURI(candidateSubmoduleURI)));
        OutputJarArchive target = new OutputJarArchive();
        target.create(dc().getScratchDir("xml").toURI().resolve(candidateSubmoduleURI));
        /*
         * Copy the manifest explicitly because the ReadableArchive
         * entries() method omits it.
         */
        Manifest mf = source.getManifest();
        OutputStream os = target.putNextEntry(JarFile.MANIFEST_NAME);
        mf.write(os);
        target.closeEntry();
        copyArchive(source, target, Collections.EMPTY_SET);
        target.close();
        return new File(target.getURI());
    }
View Full Code Here

    }
   
    protected abstract void copyFileToTopLevelJAR(final OutputJarArchive clientFacadeArchive, final File f, final String path) throws IOException;
   
    protected final void generateAppClientFacade() throws IOException, URISyntaxException {
        OutputJarArchive facadeArchive = new OutputJarArchive();
        /*
         * Make sure the directory subtree to contain the facade exists.  If the
         * client URI within the EAR contains a directory then that directory
         * probably does not exist in the generated dir for this app...not yet
         * anyway...it is about to exist.
         */
        final File facadeFile = new File(facadeServerURI(dc));
        if ( ! facadeFile.getParentFile().exists()) {
            if ( ! facadeFile.getParentFile().mkdirs()) {
                final String msg = logger.getResourceBundle().getString("enterprise.deployment.appclient.errormkdirs");
                throw new IOException(MessageFormat.format(msg, facadeFile.getAbsolutePath()));
            }
        }
        facadeArchive.create(facadeServerURI(dc));
        ReadableArchive source = dc.getSource();
        Manifest sourceManifest = source.getManifest();
        if (sourceManifest == null) {
            final String msg = logger.getResourceBundle().getString("enterprise.deployment.appclient.noManifest");
            throw new IOException(MessageFormat.format(msg, source.getURI().toASCIIString()));
        }
        Manifest facadeManifest = facadeArchive.getManifest();
        initGeneratedManifest(sourceManifest, facadeManifest,
                facadeClassPath(), PUScanTargets(), application);
        /*
         * If the developer's app client JAR contains a splash screen, copy
         * it from the original JAR to the facade so the Java launcher can
         * display it when the app client is launched.
         */
        final Attributes srcMainAttrs = sourceManifest.getMainAttributes();
        if (srcMainAttrs == null) {
            final String msg = logger.getResourceBundle().getString("enterprise.deployment.appclient.noMainAttrs");
            throw new IOException(MessageFormat.format(msg, source.getURI().toASCIIString()));
        }
        String splash = srcMainAttrs.getValue(AppClientDeployer.SPLASH_SCREEN_IMAGE);
        if (splash != null) {
            copy(source, facadeArchive, splash);
        }
        /*
         * Write the manifest to the facade.
         */
        OutputStream os = facadeArchive.putNextEntry(JarFile.MANIFEST_NAME);
        facadeManifest.write(os);
        facadeArchive.closeEntry();
        /*
         * Write the updated descriptors to the facade.
         */
        writeUpdatedDescriptors(source, facadeArchive, appClientDesc);

        /*
         * Because of how persistence units are discovered and added to the
         * app client DOL object when the archivist reads the descriptor file,
         * add any META-INF/persistence.xml file from the developer's client
         * to the client facade.  (The generated descriptor and the
         * persistence.xml files need to be in the same archive.)
         */
        copyPersistenceUnitXML(source, facadeArchive);

        copyMainClass(facadeArchive);
       
        addTopLevelContentToClientFacade(facadeArchive);
       
        facadeArchive.close();
    }
View Full Code Here

        return appClientUserURI(dc()).toASCIIString();
    }
    protected void copyOriginalAppClientJAR(final DeploymentContext dc) throws IOException {
        ReadableArchive originalSource = ((ExtendedDeploymentContext) dc).getOriginalSource();
        originalSource.open(originalSource.getURI());
        OutputJarArchive target = new OutputJarArchive();
        target.create(appClientServerURI(dc));
        /*
         * Copy the manifest explicitly because ReadableArchive.entries()
         * excludes the manifest.
         */
        Manifest originalManifest = originalSource.getManifest();
        OutputStream os = target.putNextEntry(JarFile.MANIFEST_NAME);
        originalManifest.write(os);
        target.closeEntry();
        copyArchive(originalSource, target, Collections.EMPTY_SET);
        target.close();
        originalSource.close();
    }
View Full Code Here

        generateAppClientFacade();
    }


    protected final void generateAppClientFacade() throws IOException, URISyntaxException {
        OutputJarArchive facadeArchive = new OutputJarArchive();
        /*
         * Make sure the directory subtree to contain the facade exists.  If the
         * client URI within the EAR contains a directory then that directory
         * probably does not exist in the generated dir for this app...not yet
         * anyway...it is about to exist.
         */
        final File facadeFile = new File(facadeServerURI(dc));
        if ( ! facadeFile.getParentFile().exists()) {
            if ( ! facadeFile.getParentFile().mkdirs()) {
                final String msg = logger.getResourceBundle().getString("enterprise.deployment.appclient.errormkdirs");
                throw new IOException(MessageFormat.format(msg, facadeFile.getAbsolutePath()));
            }
        }
        facadeArchive.create(facadeServerURI(dc));
        ReadableArchive source = dc.getSource();
        Manifest sourceManifest = source.getManifest();
        if (sourceManifest == null) {
            final String msg = logger.getResourceBundle().getString("enterprise.deployment.appclient.noManifest");
            throw new IOException(MessageFormat.format(msg, source.getURI().toASCIIString()));
        }
        Manifest facadeManifest = facadeArchive.getManifest();
        initGeneratedManifest(sourceManifest, facadeManifest,
                facadeClassPath(), PUScanTargets(), application);
        /*
         * If the developer's app client JAR contains a splash screen, copy
         * it from the original JAR to the facade so the Java launcher can
         * display it when the app client is launched.
         */
        final Attributes srcMainAttrs = sourceManifest.getMainAttributes();
        if (srcMainAttrs == null) {
            final String msg = logger.getResourceBundle().getString("enterprise.deployment.appclient.noMainAttrs");
            throw new IOException(MessageFormat.format(msg, source.getURI().toASCIIString()));
        }
        String splash = srcMainAttrs.getValue(AppClientDeployer.SPLASH_SCREEN_IMAGE);
        if (splash != null) {
            copy(source, facadeArchive, splash);
        }
        /*
         * Write the manifest to the facade.
         */
        OutputStream os = facadeArchive.putNextEntry(JarFile.MANIFEST_NAME);
        facadeManifest.write(os);
        facadeArchive.closeEntry();
        /*
         * Write the updated descriptors to the facade.
         */
        writeUpdatedDescriptors(source, facadeArchive, appClientDesc);

        /*
         * Because of how persistence units are discovered and added to the
         * app client DOL object when the archivist reads the descriptor file,
         * add any META-INF/persistence.xml file from the developer's client
         * to the client facade.  (The generated descriptor and the
         * persistence.xml files need to be in the same archive.)
         */
        copyPersistenceUnitXML(source, facadeArchive);

        copyMainClass(facadeArchive);

        facadeArchive.close();
    }
View Full Code Here

TOP

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

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.