incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lin...@apache.org
Subject svn commit: r944309 - in /incubator/aries/trunk/blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint: annotation/impl/BlueprintAnnotationScannerImpl.java jaxb/Tservice.java
Date Fri, 14 May 2010 15:11:04 GMT
Author: linsun
Date: Fri May 14 15:11:04 2010
New Revision: 944309

URL: http://svn.apache.org/viewvc?rev=944309&view=rev
Log:
[blueprint annotation] support simple service properties in @Service annotation

Modified:
    incubator/aries/trunk/blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/annotation/impl/BlueprintAnnotationScannerImpl.java
    incubator/aries/trunk/blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/Tservice.java

Modified: incubator/aries/trunk/blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/annotation/impl/BlueprintAnnotationScannerImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/annotation/impl/BlueprintAnnotationScannerImpl.java?rev=944309&r1=944308&r2=944309&view=diff
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/annotation/impl/BlueprintAnnotationScannerImpl.java
(original)
+++ incubator/aries/trunk/blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/annotation/impl/BlueprintAnnotationScannerImpl.java
Fri May 14 15:11:04 2010
@@ -45,6 +45,7 @@ import org.apache.aries.blueprint.annota
 import org.apache.aries.blueprint.annotation.Register;
 import org.apache.aries.blueprint.annotation.RegistrationListener;
 import org.apache.aries.blueprint.annotation.Service;
+import org.apache.aries.blueprint.annotation.ServiceProperty;
 import org.apache.aries.blueprint.annotation.Unbind;
 import org.apache.aries.blueprint.annotation.Unregister;
 import org.apache.aries.blueprint.annotation.service.BlueprintAnnotationScanner;
@@ -59,6 +60,8 @@ import org.apache.aries.blueprint.jaxb.T
 import org.apache.aries.blueprint.jaxb.TreferenceListener;
 import org.apache.aries.blueprint.jaxb.TregistrationListener;
 import org.apache.aries.blueprint.jaxb.Tservice;
+import org.apache.aries.blueprint.jaxb.TserviceProperties;
+import org.apache.aries.blueprint.jaxb.TservicePropertyEntry;
 import org.apache.aries.blueprint.jaxb.TtypeConverters;
 import org.apache.aries.blueprint.jaxb.Tvalue;
 import org.apache.xbean.finder.BundleAnnotationFinder;
@@ -647,6 +650,7 @@ public class BlueprintAnnotationScannerI
         Class<?>[] interfaces = service.interfaces();
         int ranking = service.ranking();
         String autoExport = service.autoExport();
+        ServiceProperty[] serviceProperties = service.serviceProperties();
         RegistrationListener[] regListeners = service.registerationListeners();
         
         Tservice tservice = new Tservice();
@@ -671,6 +675,21 @@ public class BlueprintAnnotationScannerI
             tservice.setInterfaces(tInterfaces);
         }
         
+        // process service property.  only key value as string are supported for now
+        for (ServiceProperty sp : serviceProperties) {
+            if (sp != null) {
+                String key = sp.key();
+                String value = sp.value();
+                if (key.length() > 0 && value.length() > 0) {
+                    TservicePropertyEntry tsp = new TservicePropertyEntry();
+                    tsp.setKey(key);
+                    tsp.setValueAttribute(value);
+                    tservice.getServiceProperties().getEntry().add(tsp);
+                }
+                
+            }
+        }
+        
         for (RegistrationListener regListener : regListeners) {
             String ref = regListener.ref();
             if (ref.length() > 0) {

Modified: incubator/aries/trunk/blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/Tservice.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/Tservice.java?rev=944309&r1=944308&r2=944309&view=diff
==============================================================================
--- incubator/aries/trunk/blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/Tservice.java
(original)
+++ incubator/aries/trunk/blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/Tservice.java
Fri May 14 15:11:04 2010
@@ -152,6 +152,9 @@ public class Tservice
      *     
      */
     public TserviceProperties getServiceProperties() {
+        if (serviceProperties == null) {
+            serviceProperties = new TserviceProperties();
+        }
         return serviceProperties;
     }
 



Mime
View raw message