Search in sources :

Example 1 with ArchiveType

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);
}
Also used : ArchiveType(org.glassfish.api.deployment.archive.ArchiveType) ServiceReferenceDescriptor(com.sun.enterprise.deployment.ServiceReferenceDescriptor)

Example 2 with ArchiveType

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;
}
Also used : ArchiveType(org.glassfish.api.deployment.archive.ArchiveType) ReadableArchive(org.glassfish.api.deployment.archive.ReadableArchive)

Example 3 with ArchiveType

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;
}
Also used : ArchiveType(org.glassfish.api.deployment.archive.ArchiveType)

Example 4 with ArchiveType

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;
}
Also used : ServiceLocator(org.glassfish.hk2.api.ServiceLocator) ArchiveType(org.glassfish.api.deployment.archive.ArchiveType)

Example 5 with ArchiveType

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;
    }
}
Also used : ArchiveType(org.glassfish.api.deployment.archive.ArchiveType)

Aggregations

ArchiveType (org.glassfish.api.deployment.archive.ArchiveType)15 ReadableArchive (org.glassfish.api.deployment.archive.ReadableArchive)4 Application (com.sun.enterprise.deployment.Application)2 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)2 Iterator (java.util.Iterator)2 ModuleDescriptor (org.glassfish.deployment.common.ModuleDescriptor)2 RootDeploymentDescriptor (org.glassfish.deployment.common.RootDeploymentDescriptor)2 ApplicationHolder (org.glassfish.javaee.core.deployment.ApplicationHolder)2 ArchiveFactory (com.sun.enterprise.deploy.shared.ArchiveFactory)1 FileArchive (com.sun.enterprise.deploy.shared.FileArchive)1 ApplicationClientDescriptor (com.sun.enterprise.deployment.ApplicationClientDescriptor)1 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)1 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)1 PersistenceUnitDescriptor (com.sun.enterprise.deployment.PersistenceUnitDescriptor)1 ServiceReferenceDescriptor (com.sun.enterprise.deployment.ServiceReferenceDescriptor)1 WebServiceEndpoint (com.sun.enterprise.deployment.WebServiceEndpoint)1 AppClientArchivist (com.sun.enterprise.deployment.archivist.AppClientArchivist)1 Archivist (com.sun.enterprise.deployment.archivist.Archivist)1 ArchivistFactory (com.sun.enterprise.deployment.archivist.ArchivistFactory)1 Method (java.lang.reflect.Method)1