You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by al...@apache.org on 2017/02/01 21:59:39 UTC

svn commit: r1781322 - in /aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation: ./ src/main/java/org/apache/aries/blueprint/annotation/bean/

Author: alien11689
Date: Wed Feb  1 21:59:39 2017
New Revision: 1781322

URL: http://svn.apache.org/viewvc?rev=1781322&view=rev
Log:
[ARIES-1676] Add bean annotation

Added:
    aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/
    aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Activation.java
      - copied, changed from r1781298, aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/referencelistener/Availability.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Bean.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Scope.java
Modified:
    aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/pom.xml

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/pom.xml?rev=1781322&r1=1781321&r2=1781322&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/pom.xml (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/pom.xml Wed Feb  1 21:59:39 2017
@@ -41,6 +41,7 @@
 
     <properties>
         <aries.osgi.export.pkg>
+            org.apache.aries.blueprint.annotation.bean,
             org.apache.aries.blueprint.annotation.config,
             org.apache.aries.blueprint.annotation.referencelistener
         </aries.osgi.export.pkg>

Copied: aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Activation.java (from r1781298, aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/referencelistener/Availability.java)
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Activation.java?p2=aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Activation.java&p1=aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/referencelistener/Availability.java&r1=1781298&r2=1781322&rev=1781322&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/referencelistener/Availability.java (original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Activation.java Wed Feb  1 21:59:39 2017
@@ -16,9 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.aries.blueprint.annotation.referencelistener;
+package org.apache.aries.blueprint.annotation.bean;
 
-public enum Availability {
-    MANDATORY,
-    OPTIONAL
+public enum Activation {
+    LAZY,
+    EAGER,
+    DEFAULT
 }

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Bean.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Bean.java?rev=1781322&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Bean.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Bean.java Wed Feb  1 21:59:39 2017
@@ -0,0 +1,65 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.annotation.bean;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotating any class or method will create a bean.
+ */
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Bean {
+
+    /**
+     * @return id or auto generated name from class name when id is empty
+     */
+    String id() default "";
+
+    /**
+     * @return activation of bean: eager, lazy or defaut for whole blueprint file
+     */
+    Activation activation() default Activation.DEFAULT;
+
+    /**
+     * @return array of bean ids on which this bean depends
+     */
+    String[] dependsOn() default {};
+
+    /**
+     * @return bean scope
+     */
+    Scope scope() default Scope.SINGLETON;
+
+    /**
+     * @return init method name, if empty then bean has no init method.
+     * Warning: if bean has another annotation which selects another init-method then cannot determine which method will be selected.
+     */
+    String initMethod() default "";
+
+    /**
+     * @return destroy method name, if empty then bean has no destroy method
+     * * Warning: if bean has another annotation which selects another destroy-method then cannot determine which method will be selected.
+     */
+    String destroyMethod() default "";
+}

Added: aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Scope.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Scope.java?rev=1781322&view=auto
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Scope.java (added)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/Scope.java Wed Feb  1 21:59:39 2017
@@ -0,0 +1,24 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.annotation.bean;
+
+public enum Scope {
+    SINGLETON,
+    PROTOTYPE
+}