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;
}
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();
}
Aggregations