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