/** * Returns the manifest file for this archive, this file is usually located at * the META-INF/MANIFEST location, however, certain archive type can change this * default location or use another mean of expressing manifest information. * * @param archive file * @return manifest instance or null if this archive has no manifest */ public Manifest getManifest(ReadableArchive archive) throws IOException { return archive.getManifest(); }
@Override public Manifest getManifest() throws IOException { for (ReadableArchive ra : archives) { final Manifest mf = ra.getManifest(); if (mf != null) { return mf; } } return null; }
@Override public Manifest getManifest() throws IOException { return archive.getManifest(); }
/** * Returns the manifest file for this archive, this file is usually located at * the META-INF/MANIFEST location, however, certain archive type can change this * default location or use another mean of expressing manifest information. * * @param archive file * @return manifest instance or null if this archive has no manifest */ public Manifest getManifest(ReadableArchive archive) throws IOException { return archive.getManifest(); }
public Manifest getManifest() throws IOException { return delegate.getManifest(); }
@Override protected boolean postHandles(ReadableArchive archive) throws IOException { //check the main-class attribute if (getMainClassName(archive.getManifest()) != null) { return true; } return false; }
protected String getObjectType(DeploymentContext context) { try{ Manifest manifest = context.getSource().getManifest(); if(manifest==null) return null; Attributes attrs = manifest.getMainAttributes(); return attrs.getValue(APPLICATION_TYPE); }catch(IOException e){ // by default resource-type will be assigned "user". return null; } }
@Override protected boolean postHandles(ReadableArchive archive) throws IOException { //check the main-class attribute if (getMainClassName(archive.getManifest()) != null) { return true; } return false; }
public static List<URL> getManifestLibraries(ReadableArchive archive) throws IOException { return getManifestLibraries(archive, archive.getManifest()); }
private URI clientURI(final ReadableArchive archive, final ApplicationClientDescriptor acDesc) throws IOException { if (archive instanceof MultiReadableArchive) { /* * Getting the manifest from a MultiReadableArchive returns the * manifest from the facade. */ final Manifest facadeMF = archive.getManifest(); final Attributes facadeMainAttrs = facadeMF.getMainAttributes(); final URI clientRelativeURI = URI.create( facadeMainAttrs.getValue(AppClientArchivist.GLASSFISH_APPCLIENT)); if (isDeployedClientAlsoStandAlone(facadeMainAttrs)) { return clientRelativeURI; } /* * We need the relative URI to the developer's client JAR within * the download directory. */ final URI absURIToClient = ((MultiReadableArchive) archive).getURI(1); final String relativeURIPathToAnchorDir = facadeMainAttrs.getValue(AppClientArchivist.GLASSFISH_ANCHOR_DIR); final URI absURIToAnchorDir = archive.getURI().resolve(relativeURIPathToAnchorDir); return absURIToAnchorDir.relativize(absURIToClient); } return archive.getURI(); }
private URI clientURI(final ReadableArchive archive, final ApplicationClientDescriptor acDesc) throws IOException { if (archive instanceof MultiReadableArchive) { /* * Getting the manifest from a MultiReadableArchive returns the * manifest from the facade. */ final Manifest facadeMF = archive.getManifest(); final Attributes facadeMainAttrs = facadeMF.getMainAttributes(); final URI clientRelativeURI = URI.create( facadeMainAttrs.getValue(AppClientArchivist.GLASSFISH_APPCLIENT)); if (isDeployedClientAlsoStandAlone(facadeMainAttrs)) { return clientRelativeURI; } /* * We need the relative URI to the developer's client JAR within * the download directory. */ final URI absURIToClient = ((MultiReadableArchive) archive).getURI(1); final String relativeURIPathToAnchorDir = facadeMainAttrs.getValue(AppClientArchivist.GLASSFISH_ANCHOR_DIR); final URI absURIToAnchorDir = archive.getURI().resolve(relativeURIPathToAnchorDir); return absURIToAnchorDir.relativize(absURIToClient); } return archive.getURI(); }
/** * open a new application archive file, read all the deployment descriptors * * @param appArchive the file path for the J2EE Application archive */ @Override public Application open(ReadableArchive appArchive) throws IOException, SAXException { setManifest(appArchive.getManifest()); // read the standard deployment descriptors Application appDesc = readStandardDeploymentDescriptor(appArchive); return openWith(appDesc, appArchive); }
/** * open a new application archive file, read all the deployment descriptors * * @param appArchive the file path for the J2EE Application archive */ @Override public Application open(ReadableArchive appArchive) throws IOException, SAXParseException { setManifest(appArchive.getManifest()); // read the standard deployment descriptors Application appDesc = readStandardDeploymentDescriptor(appArchive); return openWith(appDesc, appArchive); }
/** * Copy this archivist to a new abstract archive * * @param source the source archive to copy from * @param target the target archive to copy to * @param entriesToSkip the entries that will be skipped by target archive * @param overwriteManifest if true, the manifest in source archive * overwrites the one in target archive */ public void copyInto(ReadableArchive source, WritableArchive target, Vector entriesToSkip, boolean overwriteManifest) throws IOException { copyJarElements(source, target, entriesToSkip); if (overwriteManifest) { Manifest m = source.getManifest(); if (m != null) { OutputStream os = target.putNextEntry(JarFile.MANIFEST_NAME); m.write(os); target.closeEntry(); } } }
/** * Copy this archivist to a new abstract archive * * @param source the source archive to copy from * @param target the target archive to copy to * @param entriesToSkip the entries that will be skipped by target archive * @param overwriteManifest if true, the manifest in source archive * overwrites the one in target archive */ public void copyInto(ReadableArchive source, WritableArchive target, Vector entriesToSkip, boolean overwriteManifest) throws IOException { copyJarElements(source, target, entriesToSkip); if (overwriteManifest) { Manifest m = source.getManifest(); if (m != null) { OutputStream os = target.putNextEntry(JarFile.MANIFEST_NAME); m.write(os); target.closeEntry(); } } }
/** * perform any action after all standard DDs is read * * @param descriptor the deployment descriptor for the module * @param archive the module archive * @param extensions map of extension archivists */ @Override protected void postStandardDDsRead(ApplicationClientDescriptor descriptor, ReadableArchive archive, Map<ExtensionsArchivist, RootDeploymentDescriptor> extensions) throws IOException { super.postStandardDDsRead(descriptor, archive, extensions); // look for MAIN_CLASS if (mainClassNameToRun == null) { Manifest m = archive.getManifest(); mainClassNameToRun = getMainClassName(m); } descriptor.setMainClassName(mainClassNameToRun); }
/** * perform any action after all standard DDs is read * * @param descriptor the deployment descriptor for the module * @param archive the module archive * @param extensions map of extension archivists */ @Override protected void postStandardDDsRead(ApplicationClientDescriptor descriptor, ReadableArchive archive, Map<ExtensionsArchivist, RootDeploymentDescriptor> extensions) throws IOException { super.postStandardDDsRead(descriptor, archive, extensions); // look for MAIN_CLASS if (mainClassNameToRun == null) { Manifest m = archive.getManifest(); mainClassNameToRun = getMainClassName(m); } descriptor.setMainClassName(mainClassNameToRun); }
/** * Creates the DOL object graph for an app for which the descriptor(s) * reside in one archive and the content resides in another. * <p> * This allows the app client container to use both the generated JAR * which contains the descriptors that are filled in during deployment and * also the developer's original JAR which contains the classes that * might be subject to annotation processing. * * @param descriptorArchive archive containing the descriptor(s) * @param contentArchive archive containing the classes, etc. * @param app owning DOL application (if any) * @return DOL object graph for the application * * @throws IOException * @throws SAXException */ public T open(final ReadableArchive descriptorArchive, final ReadableArchive contentArchive, final Application app) throws IOException, SAXException { setManifest(contentArchive.getManifest()); T descriptor = readDeploymentDescriptors(descriptorArchive, contentArchive, app); if (descriptor != null) { postOpen(descriptor, contentArchive); } return descriptor; }
public Application openWith(Application app, ReadableArchive archive) throws IOException, SAXException { setManifest(archive.getManifest()); // application archivist will override this method if (app.isVirtual()) { T descriptor = readRestDeploymentDescriptors((T)app.getStandaloneBundleDescriptor(), archive, archive, app); if (descriptor != null) { postOpen(descriptor, archive); descriptor.setApplication(app); } } return app; }
public Application openWith(Application app, ReadableArchive archive) throws IOException, SAXParseException { setManifest(archive.getManifest()); // application archivist will override this method if (app.isVirtual()) { T descriptor = readRestDeploymentDescriptors((T)app.getStandaloneBundleDescriptor(), archive, archive, app); if (descriptor != null) { postOpen(descriptor, archive); } if (descriptor instanceof BundleDescriptor) { ((BundleDescriptor)descriptor).setApplication(app); } } return app; }