Search in sources :

Example 1 with Stateless

use of javax.ejb.Stateless in project Payara by payara.

the class StatelessHandler method setEjbDescriptorInfo.

/**
 * Set Annotation information to Descriptor.
 * This method will also be invoked for an existing descriptor with
 * annotation as user may not specific a complete xml.
 * @param ejbDesc
 * @param ainfo
 * @return HandlerProcessingResult
 */
protected HandlerProcessingResult setEjbDescriptorInfo(EjbDescriptor ejbDesc, AnnotationInfo ainfo) throws AnnotationProcessorException {
    EjbSessionDescriptor ejbSessionDesc = (EjbSessionDescriptor) ejbDesc;
    // set session bean type in case it wasn't set in a sparse ejb-jar.xml.
    if (!ejbSessionDesc.isSessionTypeSet()) {
        ejbSessionDesc.setSessionType(EjbSessionDescriptor.STATELESS);
    }
    Stateless sless = (Stateless) ainfo.getAnnotation();
    doDescriptionProcessing(sless.description(), ejbDesc);
    doMappedNameProcessing(sless.mappedName(), ejbDesc);
    return setBusinessAndHomeInterfaces(ejbDesc, ainfo);
}
Also used : Stateless(javax.ejb.Stateless) EjbSessionDescriptor(org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor)

Example 2 with Stateless

use of javax.ejb.Stateless in project Payara by payara.

the class WebServiceUtils method getEjbName.

static String getEjbName(AnnotatedElement annElem) {
    Stateless stateless = null;
    try {
        stateless = annElem.getAnnotation(javax.ejb.Stateless.class);
    } catch (Exception e) {
        if (logger.isLoggable(Level.FINE)) {
            // This can happen in the web.zip installation where there is no ejb
            // Just logging the error
            logger.log(Level.FINE, LogUtils.EXCEPTION_THROWN, e);
        }
    }
    Singleton singleton = null;
    try {
        singleton = annElem.getAnnotation(javax.ejb.Singleton.class);
    } catch (Exception e) {
        if (logger.isLoggable(Level.FINE)) {
            // This can happen in the web.zip installation where there is no ejb
            // Just logging the error
            logger.log(Level.FINE, LogUtils.EXCEPTION_THROWN, e);
        }
    }
    String name;
    if ((stateless != null) && ((stateless).name() == null || stateless.name().length() > 0)) {
        name = stateless.name();
    } else if ((singleton != null) && ((singleton).name() == null || singleton.name().length() > 0)) {
        name = singleton.name();
    } else {
        name = ((Class) annElem).getSimpleName();
    }
    return name;
}
Also used : Stateless(javax.ejb.Stateless) Singleton(javax.ejb.Singleton)

Aggregations

Stateless (javax.ejb.Stateless)2 Singleton (javax.ejb.Singleton)1 EjbSessionDescriptor (org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor)1