aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lin...@apache.org
Subject svn commit: r941493 - in /incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation: ./ src/main/java/org/apache/aries/blueprint/sample/
Date Wed, 05 May 2010 21:13:29 GMT
Author: linsun
Date: Wed May  5 21:13:22 2010
New Revision: 941493

URL: http://svn.apache.org/viewvc?rev=941493&view=rev
Log:
[blueprint annotation] update sample for newly defined annotation

Added:
    incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java
  (with props)
Modified:
    incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/pom.xml
    incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/Bar.java
    incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/BindingListener.java
    incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/CurrencyTypeConverter.java
    incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/DateTypeConverter.java
    incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/Foo.java
    incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/FooRegistrationListener.java
    incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/InterfaceA.java
    incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/InterfaceB.java

Modified: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/pom.xml?rev=941493&r1=941492&r2=941493&view=diff
==============================================================================
--- incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/pom.xml (original)
+++ incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/pom.xml Wed May 
5 21:13:22 2010
@@ -36,6 +36,10 @@
         <aries.osgi.activator>
             org.apache.aries.blueprint.sample.Activator
         </aries.osgi.activator>
+        <aries.osgi.import>
+            org.apache.aries.blueprint.annotation,
+            *
+        </aries.osgi.import>
     </properties>
 
     <dependencies>
@@ -55,4 +59,28 @@
         </dependency>
     </dependencies>
 
+	<build>
+		<pluginManagement>
+			<plugins>
+				<plugin>
+					<groupId>org.apache.felix</groupId>
+					<artifactId>maven-bundle-plugin</artifactId>
+					<extensions>true</extensions>
+					<inherited>true</inherited>
+					<configuration>
+						<excludeDependencies>${aries.osgi.exclude.dependencies}</excludeDependencies>
+						<instructions>
+							<Bundle-Blueprint-Annotation>true</Bundle-Blueprint-Annotation>
+						</instructions>
+						<versions>
+							<aries.osgi.version.clean>${project.version}</aries.osgi.version.clean>
+						</versions>
+					</configuration>
+				</plugin>
+
+			</plugins>
+		</pluginManagement>
+	</build>
+    
+
 </project>

Modified: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/Bar.java
URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/Bar.java?rev=941493&r1=941492&r2=941493&view=diff
==============================================================================
--- incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/Bar.java
(original)
+++ incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/Bar.java
Wed May  5 21:13:22 2010
@@ -25,21 +25,21 @@ import org.apache.aries.blueprint.annota
 import org.apache.aries.blueprint.annotation.Element;
 import org.apache.aries.blueprint.annotation.Element.ElementType;
 
-@Blueprint
+@Blueprint(defaultActivation="eager", defaultTimeout=300, defaultAvailability="optional")
 @Bean(id="bar")
 public class Bar {
     
     @Inject(value="Hello Bar")
     private String value;
 
-    @Inject
+    @Inject(ref="blueprintBundleContext")
     private BundleContext context;
 
-    @Inject 
+    /*@Inject 
     @org.apache.aries.blueprint.annotation.List ({ 
         @Element(value="a list element"), 
         @Element(value="5", type=ElementType.INTEGER) 
-    })
+    })*/
     private List list;
 
     public BundleContext getContext() {

Modified: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/BindingListener.java
URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/BindingListener.java?rev=941493&r1=941492&r2=941493&view=diff
==============================================================================
--- incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/BindingListener.java
(original)
+++ incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/BindingListener.java
Wed May  5 21:13:22 2010
@@ -25,7 +25,7 @@ import org.apache.aries.blueprint.annota
 import org.apache.aries.blueprint.annotation.Init;
 import org.apache.aries.blueprint.annotation.Bind;
 import org.apache.aries.blueprint.annotation.Unbind;
-@Blueprint
+
 @Bean(id="bindingListener")
 public class BindingListener {
 
@@ -58,24 +58,20 @@ public class BindingListener {
     public void init() {
     }
 
-    @Bind
     public void bind(InterfaceA a, Map props) {
         this.a = a;
         this.props = props;
     }
 
-    @Bind
     public void bind(ServiceReference ref) {
         this.reference = ref;
     }
 
-    @Unbind
     public void unbind(InterfaceA a, Map props) {
         this.a = null;
         this.props = null;
     }
 
-    @Unbind
     public void unbind(ServiceReference ref) {
         this.reference = null;
     }

Modified: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/CurrencyTypeConverter.java
URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/CurrencyTypeConverter.java?rev=941493&r1=941492&r2=941493&view=diff
==============================================================================
--- incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/CurrencyTypeConverter.java
(original)
+++ incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/CurrencyTypeConverter.java
Wed May  5 21:13:22 2010
@@ -23,7 +23,6 @@ import org.apache.aries.blueprint.annota
 import org.osgi.service.blueprint.container.Converter;
 import org.osgi.service.blueprint.container.ReifiedType;
 
-@Blueprint
 @Bean(id="converter2")
 public class CurrencyTypeConverter implements Converter {
 

Modified: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/DateTypeConverter.java
URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/DateTypeConverter.java?rev=941493&r1=941492&r2=941493&view=diff
==============================================================================
--- incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/DateTypeConverter.java
(original)
+++ incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/DateTypeConverter.java
Wed May  5 21:13:22 2010
@@ -26,19 +26,18 @@ import org.apache.aries.blueprint.annota
 import org.osgi.service.blueprint.container.Converter;
 import org.osgi.service.blueprint.container.ReifiedType;
 
-@Blueprint
 @Bean(id="converter1")
 public class DateTypeConverter implements Converter {
 
-    DateFormat dateFormat;
-    
     @Inject(value="yyyy.MM.dd")
+    DateFormat format;
+    
     public void setFormat(String format) {
-        dateFormat = new SimpleDateFormat(format);
+        this.format = new SimpleDateFormat(format);
     }
     
     public Object convert(Object source, ReifiedType toType) throws Exception {
-        return dateFormat.parse(source.toString());
+        return format.parse(source.toString());
     }
 
     public boolean canConvert(Object fromValue, ReifiedType toType) {

Modified: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/Foo.java
URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/Foo.java?rev=941493&r1=941492&r2=941493&view=diff
==============================================================================
--- incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/Foo.java
(original)
+++ incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/Foo.java
Wed May  5 21:13:22 2010
@@ -22,22 +22,22 @@ import java.util.Date;
 import java.util.Map;
 
 import org.apache.aries.blueprint.annotation.Bean;
-import org.apache.aries.blueprint.annotation.Blueprint;
 import org.apache.aries.blueprint.annotation.Destroy;
 import org.apache.aries.blueprint.annotation.Init;
 import org.apache.aries.blueprint.annotation.Inject;
 import org.apache.aries.blueprint.annotation.RegistrationListener;
 import org.apache.aries.blueprint.annotation.Service;
 
-@Blueprint
 @Bean(id="foo")
-@Service(autoExport="all-classes",  registerationListener = @RegistrationListener(id="fooRegistrationListener"),
ranking=0)
+@Service(autoExport="all-classes",  
+        registerationListener = @RegistrationListener(id="fooRegistrationListener", register="serviceRegistered",
unregister="serviceUnregistered"), 
+        ranking=0)
 public class Foo implements Serializable {
     
     @Inject(value="5")
     private int a;
     
-    @Inject(value="${key.b}")
+    //@Inject(value="${key.b}")
     private int b;
     
     @Inject(ref="bar")

Modified: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/FooRegistrationListener.java
URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/FooRegistrationListener.java?rev=941493&r1=941492&r2=941493&view=diff
==============================================================================
--- incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/FooRegistrationListener.java
(original)
+++ incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/FooRegistrationListener.java
Wed May  5 21:13:22 2010
@@ -21,19 +21,15 @@ import java.util.Map;
 
 import org.apache.aries.blueprint.annotation.Bean;
 import org.apache.aries.blueprint.annotation.Blueprint;
-import org.apache.aries.blueprint.annotation.Register;
-import org.apache.aries.blueprint.annotation.Unregister;
 
-@Blueprint
+
 @Bean(id="fooRegistrationListener")
 public class FooRegistrationListener {
         
-    @Register
     public void serviceRegistered(Serializable foo, Map props) {
         System.out.println("Service registration notification: " + foo + " " + props);
     }
     
-    @Unregister
     public void serviceUnregistered(Foo foo, Map props) {
         System.out.println("Service unregistration notification: " + foo + " " + props);
     }

Modified: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/InterfaceA.java
URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/InterfaceA.java?rev=941493&r1=941492&r2=941493&view=diff
==============================================================================
--- incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/InterfaceA.java
(original)
+++ incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/InterfaceA.java
Wed May  5 21:13:22 2010
@@ -19,7 +19,9 @@ package org.apache.aries.blueprint.sampl
 import org.apache.aries.blueprint.annotation.Reference;
 import org.apache.aries.blueprint.annotation.ReferenceListener;
 
-@Reference (referenceListener = {@ReferenceListener(ref="bindingListener")})
+@Reference (id="ref2", 
+        referenceListener = {@ReferenceListener(ref="bindingListener", bind="bind", unbind="unbind")},

+        timeout=100)
 public interface InterfaceA {
 
     String hello(String msg);

Modified: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/InterfaceB.java
URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/InterfaceB.java?rev=941493&r1=941492&r2=941493&view=diff
==============================================================================
--- incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/InterfaceB.java
(original)
+++ incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/InterfaceB.java
Wed May  5 21:13:22 2010
@@ -19,7 +19,8 @@ package org.apache.aries.blueprint.sampl
 import org.apache.aries.blueprint.annotation.ReferenceList;
 import org.apache.aries.blueprint.annotation.ReferenceListener;
 
-@ReferenceList (referenceListener = @ReferenceListener(ref="bindingListener"))
+@ReferenceList (id="ref-list", 
+        referenceListener = @ReferenceListener(ref="listBindingListener", bind="bind", unbind="unbind"))
 public interface InterfaceB {
 
     String hello(String msg);

Added: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java
URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java?rev=941493&view=auto
==============================================================================
--- incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java
(added)
+++ incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java
Wed May  5 21:13:22 2010
@@ -0,0 +1,78 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.aries.blueprint.sample;
+
+import java.util.Map;
+import java.util.List;
+
+import org.osgi.framework.ServiceReference;
+import org.apache.aries.blueprint.annotation.Bean;
+import org.apache.aries.blueprint.annotation.Blueprint;
+import org.apache.aries.blueprint.annotation.Init;
+import org.apache.aries.blueprint.annotation.Bind;
+import org.apache.aries.blueprint.annotation.Unbind;
+
+@Bean(id="listBindingListener")
+public class ListBindingListener {
+
+    private InterfaceA a;
+    private Map props;
+    private ServiceReference reference;
+    private List list;
+
+    public InterfaceA getA() {
+        return a;
+    }
+
+    public Map getProps() {
+        return props;
+    }
+
+    public ServiceReference getReference() {
+        return reference;
+    }
+
+    public List getList() {
+        return list;
+    }
+
+    public void setList(List list) {
+        this.list = list;
+    }
+
+    @Init
+    public void init() {
+    }
+
+    public void bind(InterfaceA a, Map props) {
+        this.a = a;
+        this.props = props;
+    }
+
+    public void bind(ServiceReference ref) {
+        this.reference = ref;
+    }
+
+    public void unbind(InterfaceA a, Map props) {
+        this.a = null;
+        this.props = null;
+    }
+
+    public void unbind(ServiceReference ref) {
+        this.reference = null;
+    }
+}

Propchange: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/sandbox/linsun/blueprint/blueprint-sample-annotation/src/main/java/org/apache/aries/blueprint/sample/ListBindingListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message