annotation.type().getCanonicalName().equals("java.lang.Short") ||
annotation.type().getCanonicalName().equals("java.lang.Long") ||
annotation.type().getCanonicalName().equals("java.lang.Float")) {
// env-ref element
ContextEnvironment resource = new ContextEnvironment();
resource.setName(annotation.name());
resource.setType(annotation.type().getCanonicalName());
resource.setDescription(annotation.description());
resource.setValue(annotation.mappedName());
context.getNamingResources().addEnvironment(resource);
} else if (annotation.type().getCanonicalName().equals("javax.xml.rpc.Service")) {
// service-ref element
ContextService service = new ContextService();
service.setName(annotation.name());
service.setWsdlfile(annotation.mappedName());
service.setType(annotation.type().getCanonicalName());
service.setDescription(annotation.description());
context.getNamingResources().addService(service);
} else if (annotation.type().getCanonicalName().equals("javax.sql.DataSource") ||
annotation.type().getCanonicalName().equals("javax.jms.ConnectionFactory") ||
annotation.type().getCanonicalName()
.equals("javax.jms.QueueConnectionFactory") ||
annotation.type().getCanonicalName()
.equals("javax.jms.TopicConnectionFactory") ||
annotation.type().getCanonicalName().equals("javax.mail.Session") ||
annotation.type().getCanonicalName().equals("java.net.URL") ||
annotation.type().getCanonicalName()
.equals("javax.resource.cci.ConnectionFactory") ||
annotation.type().getCanonicalName().equals("org.omg.CORBA_2_3.ORB") ||
annotation.type().getCanonicalName().endsWith("ConnectionFactory")) {
// resource-ref element
ContextResource resource = new ContextResource();
resource.setName(annotation.name());
resource.setType(annotation.type().getCanonicalName());
if (annotation.authenticationType()
== Resource.AuthenticationType.CONTAINER) {
resource.setAuth("Container");
}
else if (annotation.authenticationType()
== Resource.AuthenticationType.APPLICATION) {
resource.setAuth("Application");
}
resource.setScope(annotation.shareable() ? "Shareable" : "Unshareable");
resource.setProperty("mappedName", annotation.mappedName());
resource.setDescription(annotation.description());
context.getNamingResources().addResource(resource);
} else if (annotation.type().getCanonicalName().equals("javax.jms.Queue") ||
annotation.type().getCanonicalName().equals("javax.jms.Topic")) {
// message-destination-ref
MessageDestinationRef resource = new MessageDestinationRef();
resource.setName(annotation.name());
resource.setType(annotation.type().getCanonicalName());
resource.setUsage(annotation.mappedName());
resource.setDescription(annotation.description());
context.getNamingResources().addMessageDestinationRef(resource);
} else if (annotation.type().getCanonicalName()
.equals("javax.resource.cci.InteractionSpec") ||
annotation.type().getCanonicalName()
.equals("javax.transaction.UserTransaction") ||
true) {
// resource-env-ref
ContextResourceEnvRef resource = new ContextResourceEnvRef();
resource.setName(annotation.name());
resource.setType(annotation.type().getCanonicalName());
resource.setProperty("mappedName", annotation.mappedName());
resource.setDescription(annotation.description());
context.getNamingResources().addResourceEnvRef(resource);
}