Search in sources :

Example 6 with ApplicationHolder

use of org.glassfish.javaee.core.deployment.ApplicationHolder in project Payara by payara.

the class WeldCompositeSniffer method handles.

public boolean handles(DeploymentContext context) {
    ArchiveType archiveType = habitat.getService(ArchiveType.class, context.getArchiveHandler().getArchiveType());
    if (archiveType != null && !supportsArchiveType(archiveType)) {
        return false;
    }
    boolean isWeldApplication = false;
    ApplicationHolder holder = context.getModuleMetaData(ApplicationHolder.class);
    ReadableArchive appRoot = context.getSource();
    if ((holder != null) && (holder.app != null)) {
        isWeldApplication = scanLibDir(appRoot, holder.app.getLibraryDirectory(), context);
    }
    return isWeldApplication;
}
Also used : ApplicationHolder(org.glassfish.javaee.core.deployment.ApplicationHolder) ArchiveType(org.glassfish.api.deployment.archive.ArchiveType) ReadableArchive(org.glassfish.api.deployment.archive.ReadableArchive)

Example 7 with ApplicationHolder

use of org.glassfish.javaee.core.deployment.ApplicationHolder 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)

Aggregations

ApplicationHolder (org.glassfish.javaee.core.deployment.ApplicationHolder)7 ReadableArchive (org.glassfish.api.deployment.archive.ReadableArchive)5 IOException (java.io.IOException)4 AbstractArchiveHandler (com.sun.enterprise.deploy.shared.AbstractArchiveHandler)2 DeployCommandParameters (org.glassfish.api.deployment.DeployCommandParameters)2 ArchiveHandler (org.glassfish.api.deployment.archive.ArchiveHandler)2 ArchiveType (org.glassfish.api.deployment.archive.ArchiveType)2 ModuleDescriptor (org.glassfish.deployment.common.ModuleDescriptor)2 SAXParseException (org.xml.sax.SAXParseException)2 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)1 ApplicationArchivist (com.sun.enterprise.deployment.archivist.ApplicationArchivist)1 InputJarArchive (com.sun.enterprise.deployment.deploy.shared.InputJarArchive)1 DDPermissionsLoader (com.sun.enterprise.security.integration.DDPermissionsLoader)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 PrivilegedAction (java.security.PrivilegedAction)1 PrivilegedActionException (java.security.PrivilegedActionException)1 XMLStreamException (javax.xml.stream.XMLStreamException)1