felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1001605 - in /felix/trunk/ipojo: annotations/src/main/java/org/apache/felix/ipojo/annotations/ manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/ tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scen...
Date Mon, 27 Sep 2010 07:18:08 GMT
Author: clement
Date: Mon Sep 27 07:18:08 2010
New Revision: 1001605

URL: http://svn.apache.org/viewvc?rev=1001605&view=rev
Log:
Fix FELIX-2630 Rename @Component attributes to follow the java naming conventions

Added:
    felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryDeprecated.java
      - copied, changed from r999267, felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java
    felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethodDeprecated.java
      - copied, changed from r999267, felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
Modified:
    felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
    felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
    felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java
    felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java

Modified: felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java?rev=1001605&r1=1001604&r2=1001605&view=diff
==============================================================================
--- felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
(original)
+++ felix/trunk/ipojo/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
Mon Sep 27 07:18:08 2010
@@ -1,4 +1,4 @@
-/* 
+/*
  * 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
@@ -32,10 +32,17 @@ public @interface Component {
     /**
      * Set if the component type is public.
      * Default: true
+     * @deprecated renamed to publicFactory.
      */
     boolean public_factory() default true;
 
     /**
+     * Set if the component type is public.
+     * Default: true
+     */
+    boolean publicFactory() default true;
+
+    /**
      * Set the component type name.
      * Default : implementation class name.
      */
@@ -70,10 +77,19 @@ public @interface Component {
      * from a static method. The specified method must be a static
      * method and return a pojo object.
      * By default, iPOJO uses the 'regular' constructor.
+     * @deprecated now is called <tt>factoryMethod</tt>.
      */
     String factory_method() default "";
 
     /**
+     * Set the factory-method, if the pojo has to be created
+     * from a static method. The specified method must be a static
+     * method and return a pojo object.
+     * By default, iPOJO uses the 'regular' constructor.
+     */
+    String factoryMethod() default "";
+
+    /**
      * Set the version of the component type.
      */
     String version() default "";

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java?rev=1001605&r1=1001604&r2=1001605&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
(original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
Mon Sep 27 07:18:08 2010
@@ -65,6 +65,9 @@ public class MetadataCollector extends E
      */
     private boolean m_containsComponentAnnotation = false;
 
+    /**
+     * True if the visited class does not have the @Component annotation.
+     */
     private boolean m_ignoredBecauseOfMissingComponent = false;
 
     /**
@@ -460,7 +463,8 @@ public class MetadataCollector extends E
          * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
          */
         public void visit(String arg0, Object arg1) {
-            if (arg0.equals("public_factory")) {
+            if (arg0.equals("public_factory")  || arg0.equals("publicFactory")) {
+            	// public_factory is deprecated, but must sill be supported
                 m_factory = arg1.toString();
                 return;
             }
@@ -484,7 +488,8 @@ public class MetadataCollector extends E
                 m_managedservice = arg1.toString();
                 return;
             }
-            if (arg0.equals("factory_method")) {
+            if (arg0.equals("factory_method")  || arg0.equals("factoryMethod")) {
+            	// factory_method is deprecated, but must still be supported.
                 m_method = arg1.toString();
                 return;
             }

Modified: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java?rev=1001605&r1=1001604&r2=1001605&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
(original)
+++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/annotations/Factory.java
Mon Sep 27 07:18:08 2010
@@ -12,6 +12,16 @@ public class Factory extends OSGiTestCas
         helper = new IPOJOHelper(this);
     }
 
+    public void testArchDeprecated() {
+        Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.FactoryDeprecated");
+        String fact = meta.getAttribute("public");
+        String name = meta.getAttribute("name");
+        assertNotNull("Factory exists ", fact);
+        assertEquals("Factory value", "true", fact);
+        assertNotNull("Name exists ", name);
+        assertEquals("Name value", "org.apache.felix.ipojo.test.scenarios.component.FactoryDeprecated",
name);
+    }
+
     public void testArch() {
         Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.Factory");
         String fact = meta.getAttribute("public");
@@ -39,6 +49,13 @@ public class Factory extends OSGiTestCas
         assertEquals("Method value", "create", method);
     }
 
+    public void testFactoryMethodDeprecated() {
+        Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.FactoryMethodDeprecated");
+        String method = meta.getAttribute("factory-method");
+        assertNotNull("Method exists ", method);
+        assertEquals("Method value", "create", method);
+    }
+
     public void testVersion() {
         Element meta = helper.getMetadata("org.apache.felix.ipojo.test.scenarios.component.ComponentTypeVersion");
         String version = meta.getAttribute("version");

Modified: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java?rev=1001605&r1=1001604&r2=1001605&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java
(original)
+++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java
Mon Sep 27 07:18:08 2010
@@ -2,6 +2,6 @@ package org.apache.felix.ipojo.test.scen
 
 import org.apache.felix.ipojo.annotations.Component;
 
-@Component(name="factory", public_factory=true)
+@Component(name="factory", publicFactory=true)
 public class Factory {
 }

Copied: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryDeprecated.java
(from r999267, felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryDeprecated.java?p2=felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryDeprecated.java&p1=felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java&r1=999267&r2=1001605&rev=1001605&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/Factory.java
(original)
+++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryDeprecated.java
Mon Sep 27 07:18:08 2010
@@ -2,6 +2,6 @@ package org.apache.felix.ipojo.test.scen
 
 import org.apache.felix.ipojo.annotations.Component;
 
-@Component(name="factory", public_factory=true)
-public class Factory {
+@Component(public_factory=true)
+public class FactoryDeprecated {
 }

Modified: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java?rev=1001605&r1=1001604&r2=1001605&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
(original)
+++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
Mon Sep 27 07:18:08 2010
@@ -2,9 +2,9 @@ package org.apache.felix.ipojo.test.scen
 
 import org.apache.felix.ipojo.annotations.Component;
 
-@Component(factory_method="create")
+@Component(factoryMethod="create")
 public class FactoryMethod {
-    
+
     public static FactoryMethod create() {
         return new FactoryMethod();
     }

Copied: felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethodDeprecated.java
(from r999267, felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java)
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethodDeprecated.java?p2=felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethodDeprecated.java&p1=felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java&r1=999267&r2=1001605&rev=1001605&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethod.java
(original)
+++ felix/trunk/ipojo/tests/core/annotations/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FactoryMethodDeprecated.java
Mon Sep 27 07:18:08 2010
@@ -3,9 +3,9 @@ package org.apache.felix.ipojo.test.scen
 import org.apache.felix.ipojo.annotations.Component;
 
 @Component(factory_method="create")
-public class FactoryMethod {
+public class FactoryMethodDeprecated {
     
-    public static FactoryMethod create() {
-        return new FactoryMethod();
+    public static FactoryMethodDeprecated create() {
+        return new FactoryMethodDeprecated();
     }
 }



Mime
View raw message