}
// Initialize the annotations
if (classClass.isAnnotationPresent(Resource.class)) {
Resource annotation = (Resource)
classClass.getAnnotation(Resource.class);
addResource(context, annotation);
}
/* Process Resources annotation.
* Ref JSR 250
*/
if (classClass.isAnnotationPresent(Resources.class)) {
Resources annotation = (Resources)
classClass.getAnnotation(Resources.class);
for (int i = 0; annotation.value() != null && i < annotation.value().length; i++) {
addResource(context, annotation.value()[i]);
}
}
/* Process EJB annotation.
* Ref JSR 224, equivalent to the ejb-ref or ejb-local-ref
* element in the deployment descriptor.
if (classClass.isAnnotationPresent(EJB.class)) {
EJB annotation = (EJB)
classClass.getAnnotation(EJB.class);
if ((annotation.mappedName().length() == 0) ||
annotation.mappedName().equals("Local")) {
ContextLocalEjb ejb = new ContextLocalEjb();
ejb.setName(annotation.name());
ejb.setType(annotation.beanInterface().getCanonicalName());
ejb.setDescription(annotation.description());
ejb.setHome(annotation.beanName());
context.getNamingResources().addLocalEjb(ejb);
} else if (annotation.mappedName().equals("Remote")) {
ContextEjb ejb = new ContextEjb();
ejb.setName(annotation.name());
ejb.setType(annotation.beanInterface().getCanonicalName());
ejb.setDescription(annotation.description());
ejb.setHome(annotation.beanName());
context.getNamingResources().addEjb(ejb);
}
}
*/
/* Process WebServiceRef annotation.
* Ref JSR 224, equivalent to the service-ref element in
* the deployment descriptor.
* The service-ref registration is not implemented
if (classClass.isAnnotationPresent(WebServiceRef.class)) {
WebServiceRef annotation = (WebServiceRef)
classClass.getAnnotation(WebServiceRef.class);
ContextService service = new ContextService();
service.setName(annotation.name());
service.setWsdlfile(annotation.wsdlLocation());
service.setType(annotation.type().getCanonicalName());
if (annotation.value() == null)
service.setServiceinterface(annotation.type().getCanonicalName());
if (annotation.type().getCanonicalName().equals("Service"))
service.setServiceinterface(annotation.type().getCanonicalName());
if (annotation.value().getCanonicalName().equals("Endpoint"))
service.setServiceendpoint(annotation.type().getCanonicalName());
service.setPortlink(annotation.type().getCanonicalName());
context.getNamingResources().addService(service);
}
*/
/* Process DeclareRoles annotation.
* Ref JSR 250, equivalent to the security-role element in
* the deployment descriptor
*/
if (classClass.isAnnotationPresent(DeclareRoles.class)) {
DeclareRoles annotation = (DeclareRoles)
classClass.getAnnotation(DeclareRoles.class);
for (int i = 0; annotation.value() != null && i < annotation.value().length; i++) {
context.addSecurityRole(annotation.value()[i]);
}
}
}