Search in sources :

Example 96 with ReadableArchive

use of org.glassfish.api.deployment.archive.ReadableArchive in project Payara by payara.

the class JPACompositeSniffer method handles.

/**
 * Decides whether we have any pu roots at ear level
 */
public boolean handles(DeploymentContext context) {
    ArchiveType archiveType = habitat.getService(ArchiveType.class, context.getArchiveHandler().getArchiveType());
    if (archiveType != null && !supportsArchiveType(archiveType)) {
        return false;
    }
    // Scans for pu roots in the "lib" dir of an application.
    // We do not scan for PU roots in root of .ear. JPA 2.0 spec will clarify that it is  not a portable use case.
    // It is not portable use case because JavaEE spec implies that jars in root of ears are not visible by default
    // to components (Unless an explicit Class-Path manifest entry is present) and can potentially be loaded by
    // different class loaders (corresponding to each component that refers to it) thus residing in different name
    // space. It does not make sense to make them visible at ear level (and thus in a single name space)
    boolean isJPAApplication = false;
    ApplicationHolder holder = context.getModuleMetaData(ApplicationHolder.class);
    ReadableArchive appRoot = context.getSource();
    if (holder != null && holder.app != null) {
        isJPAApplication = scanForPURootsInLibDir(appRoot, holder.app.getLibraryDirectory());
        if (!isJPAApplication) {
            if (DeploymentUtils.useV2Compatibility(context)) {
                // Scan for pu roots in root of ear
                isJPAApplication = scanForPURRootsInEarRoot(context, holder.app.getModules());
            }
        }
    }
    return isJPAApplication;
}
Also used : ApplicationHolder(org.glassfish.javaee.core.deployment.ApplicationHolder) ArchiveType(org.glassfish.api.deployment.archive.ArchiveType) ReadableArchive(org.glassfish.api.deployment.archive.ReadableArchive)

Example 97 with ReadableArchive

use of org.glassfish.api.deployment.archive.ReadableArchive in project Payara by payara.

the class ServerProviderContainerContractInfo method getApplicationLocation.

@Override
public String getApplicationLocation() {
    // Get source for current bundle. If it has not parent, it is the top level application
    // else continue traversing up till we find one with not parent.
    ReadableArchive archive = deploymentContext.getSource();
    boolean appRootFound = false;
    while (!appRootFound) {
        ReadableArchive parentArchive = archive.getParentArchive();
        if (parentArchive != null) {
            archive = parentArchive;
        } else {
            appRootFound = true;
        }
    }
    return archive.getURI().getPath();
}
Also used : ReadableArchive(org.glassfish.api.deployment.archive.ReadableArchive)

Aggregations

ReadableArchive (org.glassfish.api.deployment.archive.ReadableArchive)97 IOException (java.io.IOException)46 File (java.io.File)28 URI (java.net.URI)18 ActionReport (org.glassfish.api.ActionReport)17 ExtendedDeploymentContext (org.glassfish.internal.deployment.ExtendedDeploymentContext)14 DeployCommandParameters (org.glassfish.api.deployment.DeployCommandParameters)12 WritableArchive (org.glassfish.api.deployment.archive.WritableArchive)12 Application (com.sun.enterprise.deployment.Application)10 JarFile (java.util.jar.JarFile)10 ArchiveHandler (org.glassfish.api.deployment.archive.ArchiveHandler)10 ApplicationInfo (org.glassfish.internal.data.ApplicationInfo)10 ArrayList (java.util.ArrayList)9 ModuleDescriptor (org.glassfish.deployment.common.ModuleDescriptor)9 ConfigurationDeploymentDescriptorFile (com.sun.enterprise.deployment.io.ConfigurationDeploymentDescriptorFile)8 Logger (java.util.logging.Logger)8 DeploymentDescriptorFile (com.sun.enterprise.deployment.io.DeploymentDescriptorFile)7 Manifest (java.util.jar.Manifest)7 HashSet (java.util.HashSet)6 HashMap (java.util.HashMap)5