incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1498525 - in /sling/whiteboard/bdelacretaz/adapter-methods: extensions-adapter/src/main/java/org/apache/sling/adapter/internal/ extensions-adapter/src/test/java/org/apache/sling/adapter/internal/ sling-api/src/main/java/org/apache/sling/ap...
Date Mon, 01 Jul 2013 15:37:09 GMT
Author: bdelacretaz
Date: Mon Jul  1 15:37:08 2013
New Revision: 1498525

URL: http://svn.apache.org/r1498525
Log:
SLING-2938 - rename AdapterMethod to Adapter, and move to annotations package

Added:
    sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/
    sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/Adapter.java
      - copied, changed from r1498322, sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/adapter/AdapterMethod.java
    sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/package-info.java
  (with props)
Removed:
    sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/adapter/AdapterMethod.java
Modified:
    sling/whiteboard/bdelacretaz/adapter-methods/extensions-adapter/src/main/java/org/apache/sling/adapter/internal/AdapterMethodsManagerImpl.java
    sling/whiteboard/bdelacretaz/adapter-methods/extensions-adapter/src/test/java/org/apache/sling/adapter/internal/AdapterMethodManagerIT.java

Modified: sling/whiteboard/bdelacretaz/adapter-methods/extensions-adapter/src/main/java/org/apache/sling/adapter/internal/AdapterMethodsManagerImpl.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/adapter-methods/extensions-adapter/src/main/java/org/apache/sling/adapter/internal/AdapterMethodsManagerImpl.java?rev=1498525&r1=1498524&r2=1498525&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/adapter-methods/extensions-adapter/src/main/java/org/apache/sling/adapter/internal/AdapterMethodsManagerImpl.java
(original)
+++ sling/whiteboard/bdelacretaz/adapter-methods/extensions-adapter/src/main/java/org/apache/sling/adapter/internal/AdapterMethodsManagerImpl.java
Mon Jul  1 15:37:08 2013
@@ -29,8 +29,8 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.sling.api.adapter.AdapterFactory;
-import org.apache.sling.api.adapter.AdapterMethod;
 import org.apache.sling.api.adapter.AdapterMethodsProvider;
+import org.apache.sling.api.annotations.Adapter;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
@@ -62,7 +62,7 @@ public class AdapterMethodsManagerImpl {
             // and create an AdapterProxy for each of them
             final AdapterMethodsProvider p = (AdapterMethodsProvider)bundleContext.getService(reference);
             for(Method m : p.getClass().getMethods()) {
-                if(m.getAnnotation(AdapterMethod.class) != null) {
+                if(m.getAnnotation(Adapter.class) != null) {
                     proxies.add(new AdapterProxy(reference, p, m));
                 }
             }

Modified: sling/whiteboard/bdelacretaz/adapter-methods/extensions-adapter/src/test/java/org/apache/sling/adapter/internal/AdapterMethodManagerIT.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/adapter-methods/extensions-adapter/src/test/java/org/apache/sling/adapter/internal/AdapterMethodManagerIT.java?rev=1498525&r1=1498524&r2=1498525&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/adapter-methods/extensions-adapter/src/test/java/org/apache/sling/adapter/internal/AdapterMethodManagerIT.java
(original)
+++ sling/whiteboard/bdelacretaz/adapter-methods/extensions-adapter/src/test/java/org/apache/sling/adapter/internal/AdapterMethodManagerIT.java
Mon Jul  1 15:37:08 2013
@@ -34,9 +34,9 @@ import java.net.URL;
 
 import javax.inject.Inject;
 
-import org.apache.sling.api.adapter.AdapterMethod;
 import org.apache.sling.api.adapter.AdapterMethodsProvider;
 import org.apache.sling.api.adapter.SlingAdaptable;
+import org.apache.sling.api.annotations.Adapter;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Option;
@@ -44,7 +44,7 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 
-/** Test the AdapterMethodsManager */
+/** Test the AdaptersManager */
 @RunWith(PaxExam.class)
 public class AdapterMethodManagerIT {
     
@@ -68,7 +68,7 @@ public class AdapterMethodManagerIT {
             reg = ctx.registerService(AdapterMethodsProvider.class.getName(), this, null);
         }
         
-        @AdapterMethod
+        @Adapter
         public Long adapt(TestAdaptable src) {
             return new Long(src.value);
         }
@@ -87,12 +87,12 @@ public class AdapterMethodManagerIT {
             reg = ctx.registerService(AdapterMethodsProvider.class.getName(), this, null);
         }
         
-        @AdapterMethod
+        @Adapter
         public Integer adaptToInt(TestAdaptable src) {
             return new Integer((int)src.value);
         }
         
-        @AdapterMethod
+        @Adapter
         public URL adaptToURL(TestAdaptable src) {
             final String url = "http://example.com/" + src.value;
             try {
@@ -144,9 +144,12 @@ public class AdapterMethodManagerIT {
         final SingleMethodProvider tamp = new SingleMethodProvider(bundleContext);
         try {
             final long value = System.currentTimeMillis();
-            final Long result = new TestAdaptable(value).adaptTo(Long.class);
+            final TestAdaptable t = new TestAdaptable(value); 
+            final Long result = t.adaptTo(Long.class);
             assertNotNull("Expecting non-null adapted Long", result);
             assertEquals("Expecting correct adapted value", value, result.longValue());
+            assertNull("Expecting no Integer adaptation", t.adaptTo(Integer.class));
+            assertNull("Expecting no URL adaptation", t.adaptTo(URL.class));
         } finally {
             tamp.unregister();
         }
@@ -185,4 +188,4 @@ public class AdapterMethodManagerIT {
             mmp.unregister();
         }
     }
-}
+}
\ No newline at end of file

Copied: sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/Adapter.java
(from r1498322, sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/adapter/AdapterMethod.java)
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/Adapter.java?p2=sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/Adapter.java&p1=sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/adapter/AdapterMethod.java&r1=1498322&r2=1498525&rev=1498525&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/adapter/AdapterMethod.java
(original)
+++ sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/Adapter.java
Mon Jul  1 15:37:08 2013
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.sling.api.adapter;
+package org.apache.sling.api.annotations;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -30,7 +30,7 @@ import java.lang.annotation.Target;
  */
 @Target( { ElementType.METHOD })
 @Retention(RetentionPolicy.RUNTIME)
-public @interface AdapterMethod {
+public @interface Adapter {
 
     /** Optional textual description of the adapter method */
     String description() default "";

Added: sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/package-info.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/package-info.java?rev=1498525&view=auto
==============================================================================
--- sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/package-info.java
(added)
+++ sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/package-info.java
Mon Jul  1 15:37:08 2013
@@ -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
+ *
+ *   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.
+ */
+
+@Version("1.0.0")
+package org.apache.sling.api.annotations;
+
+import aQute.bnd.annotation.Version;
+

Propchange: sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/bdelacretaz/adapter-methods/sling-api/src/main/java/org/apache/sling/api/annotations/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL



Mime
View raw message