Search in sources :

Example 1 with Singleton

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

the class SingletonHandler 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 ejbSingletonDescriptor = (EjbSessionDescriptor) ejbDesc;
    Class ejbClass = (Class) ainfo.getAnnotatedElement();
    Singleton singleton = (Singleton) ainfo.getAnnotation();
    // set session bean type in case it wasn't set in a sparse ejb-jar.xml.
    if (!ejbSingletonDescriptor.isSessionTypeSet()) {
        ejbSingletonDescriptor.setSessionType(EjbSessionDescriptor.SINGLETON);
    }
    doDescriptionProcessing(singleton.description(), ejbDesc);
    doMappedNameProcessing(singleton.mappedName(), ejbDesc);
    doSingletonSpecificProcessing(ejbSingletonDescriptor, ejbClass);
    return setBusinessAndHomeInterfaces(ejbDesc, ainfo);
}
Also used : Singleton(javax.ejb.Singleton) EjbSessionDescriptor(org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor)

Example 2 with Singleton

use of javax.ejb.Singleton 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

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