summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-18 17:51:54 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-18 17:51:54 +0000
commit2ee1a61be35c4ae0a017bf65f4ac6779c59b4388 (patch)
tree6f55766d771ba974f2e958d2d990a727bb89d1dd /java
parenta92080aba82552b035a046e4c1be3b9256e3c695 (diff)
Minor clean up
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@826475 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java25
1 files changed, 12 insertions, 13 deletions
diff --git a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
index 51f2678f55..9753e4eff0 100644
--- a/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
+++ b/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
@@ -20,7 +20,6 @@ package org.apache.tuscany.sca.implementation.java.introspect.impl;
import static org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper.getAllInterfaces;
-import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -77,7 +76,7 @@ public class ServiceProcessor extends BaseJavaClassVisitor {
) {
Service service;
try {
- service = createService(interfaze);
+ service = createService(interfaze, null);
} catch (InvalidInterfaceException e) {
throw new IntrospectionException(e);
}
@@ -104,10 +103,9 @@ public class ServiceProcessor extends BaseJavaClassVisitor {
//validate no scope on servce interface
for (Class<?> iface : interfaces) {
- for (Annotation aaa : iface.getAnnotations()) {
- if (iface.getAnnotation(org.oasisopen.sca.annotation.Scope.class) != null) {
- throw new IntrospectionException("JCA90041 @Scope annotation not allowed on service interface " + iface.getName());
- }
+ if (iface.getAnnotation(org.oasisopen.sca.annotation.Scope.class) != null) {
+ throw new IntrospectionException("JCA90041 @Scope annotation not allowed on service interface " + iface
+ .getName());
}
}
@@ -123,10 +121,8 @@ public class ServiceProcessor extends BaseJavaClassVisitor {
for (int i=0; i < interfaces.length; i++) {
try {
- Service service = createService(interfaces[i]);
- if (annotation.names().length > 0) {
- service.setName(annotation.names()[i]);
- }
+ String name = (annotation.names().length > 0) ? annotation.names()[i] : null;
+ Service service = createService(interfaces[i], name);
type.getServices().add(service);
} catch (InvalidInterfaceException e) {
throw new IntrospectionException(e);
@@ -182,13 +178,16 @@ public class ServiceProcessor extends BaseJavaClassVisitor {
createCallback(type, element);
}
- public Service createService(Class<?> interfaze) throws InvalidInterfaceException {
+ public Service createService(Class<?> interfaze, String name) throws InvalidInterfaceException {
Service service = assemblyFactory.createService();
JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
service.setInterfaceContract(interfaceContract);
- // create a relative URI
- service.setName(interfaze.getSimpleName());
+ if (name == null) {
+ service.setName(interfaze.getSimpleName());
+ } else {
+ service.setName(name);
+ }
JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
service.getInterfaceContract().setInterface(callInterface);