use of org.glassfish.api.deployment.archive.ArchiveType in project Payara by payara.
the class WebServiceClientCheckMgrImpl method check.
/**
* Check Ejb for spec. conformance
*
* @param descriptor WebServices descriptor
*/
public void check(Descriptor descriptor) throws Exception {
ServiceReferenceDescriptor rootDescriptor = (ServiceReferenceDescriptor) descriptor;
ArchiveType moduleType = rootDescriptor.getBundleDescriptor().getModuleType();
if (moduleType != null && moduleType.equals(DOLUtils.ejbType()))
moduleName = Result.EJB;
else if (moduleType != null && moduleType.equals(DOLUtils.warType()))
moduleName = Result.WEB;
else if (moduleType != null && moduleType.equals(DOLUtils.carType()))
moduleName = Result.APPCLIENT;
super.check(rootDescriptor);
}
use of org.glassfish.api.deployment.archive.ArchiveType in project Payara by payara.
the class WeldSniffer method handles.
/**
* Returns true if the archive contains beans.xml as defined by packaging rules of Weld
*/
@Override
public boolean handles(DeploymentContext context) {
ArchiveType archiveType = habitat.getService(ArchiveType.class, context.getArchiveHandler().getArchiveType());
if (archiveType != null && !supportsArchiveType(archiveType)) {
return false;
}
ReadableArchive archive = context.getSource();
boolean isWeldArchive = false;
// a Weld archive
if (isEntryPresent(archive, WeldUtils.WEB_INF)) {
isWeldArchive = isArchiveCDIEnabled(context, archive, WeldUtils.WEB_INF_BEANS_XML) || isArchiveCDIEnabled(context, archive, WeldUtils.WEB_INF_CLASSES_META_INF_BEANS_XML);
if (!isWeldArchive) {
// Check jars under WEB_INF/lib
if (isEntryPresent(archive, WeldUtils.WEB_INF_LIB)) {
isWeldArchive = scanLibDir(context, archive, WeldUtils.WEB_INF_LIB);
}
}
}
// TODO This doesn't seem to match the ReadableArchive for a stand-alone ejb-jar.
// It might only be true for an ejb-jar within an .ear. Revisit when officially
// adding support for .ears
String archiveName = archive.getName();
if (!isWeldArchive && archiveName != null && archiveName.endsWith(WeldUtils.EXPANDED_JAR_SUFFIX)) {
isWeldArchive = isArchiveCDIEnabled(context, archive, WeldUtils.META_INF_BEANS_XML);
}
// If stand-alone ejb-jar
if (!isWeldArchive && isArchiveCDIEnabled(context, archive, WeldUtils.META_INF_BEANS_XML)) {
isWeldArchive = true;
}
if (!isWeldArchive && archiveName != null && archiveName.endsWith(WeldUtils.EXPANDED_RAR_SUFFIX)) {
isWeldArchive = isArchiveCDIEnabled(context, archive, WeldUtils.META_INF_BEANS_XML);
if (!isWeldArchive) {
// Check jars in root dir of rar
isWeldArchive = scanLibDir(context, archive, "");
}
}
return isWeldArchive;
}
use of org.glassfish.api.deployment.archive.ArchiveType in project Payara by payara.
the class WebServiceEngineImpl method createEndpointInfo.
private EndpointImpl createEndpointInfo(WebServiceEndpoint endpoint) {
try {
String endpointURL = endpoint.getEndpointAddressUri();
EndpointType endpointType;
ArchiveType moduleType = endpoint.getWebService().getWebServicesDescriptor().getModuleType();
if (moduleType != null && moduleType.equals(ejbType())) {
endpointType = EJB_ENDPOINT;
} else {
endpointType = SERVLET_ENDPOINT;
}
EndpointImpl endpointInfo;
// service
if (endpoint.getWebService().hasMappingFile()) {
endpointInfo = new JAXRPCEndpointImpl(endpointURL, endpointType);
} else {
endpointInfo = new JAXWSEndpointImpl(endpointURL, endpointType);
}
endpointInfo.setDescriptor(endpoint);
return endpointInfo;
} catch (Exception e) {
sLogger.log(SEVERE, EXCEPTION_CREATING_ENDPOINT, e);
}
return null;
}
use of org.glassfish.api.deployment.archive.ArchiveType in project Payara by payara.
the class DOLUtils method getModuleType.
/**
* Utility method to retrieve a {@link ArchiveType} from a stringified module type.
* Since {@link ArchiveType} is an extensible abstraction and implementations are plugged in via HK2 service
* registry, this method returns null if HK2 service registry is not setup.
*
* If null is passed to this method, it returns null instead of returning an arbitrary ArchiveType or throwing
* an exception.
*
* @param moduleType String equivalent of the module type being looked up. null is allowed.
* @return the corresponding ArchiveType, null if no such module type exists or HK2 Service registry is not set up
*/
public static ArchiveType getModuleType(String moduleType) {
if (moduleType == null) {
return null;
}
final ServiceLocator services = Globals.getDefaultHabitat();
ArchiveType result = null;
// This method is called without HK2 being setup when dol unit tests are run, so protect against NPE.
if (services != null) {
result = services.getService(ArchiveType.class, moduleType);
}
return result;
}
use of org.glassfish.api.deployment.archive.ArchiveType in project Payara by payara.
the class BundleDescriptor method isDDWithNoAnnotationAllowed.
/**
* @ return true for following cases:
* a. ejb module and schema version earlier than 3.0;
* b. web module and schema version earlier than 2.5;
* c. appclient module and schema version earlier than 5.0.
* d. connector module and schema version earlier than 1.6
*/
public boolean isDDWithNoAnnotationAllowed() {
ArchiveType mType = getModuleType();
if (mType == null)
return false;
double specVersion = Double.parseDouble(getSpecVersion());
// we do not process annotations for earlier versions of DD
if ((mType.equals(DOLUtils.ejbType()) && specVersion < ANNOTATION_EJB_VER) || (mType.equals(DOLUtils.warType()) && specVersion < ANNOTATION_WAR_VER) || (mType.equals(DOLUtils.carType()) && specVersion < ANNOTATION_CAR_VER) || (mType.equals(DOLUtils.rarType()) && specVersion < ANNOTATION_RAR_VER)) {
return true;
} else {
return false;
}
}
Aggregations