deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rafab...@apache.org
Subject deltaspike git commit: DELTASPIKE-905 refactored ProxyClassGeneratorLookup to inner class
Date Thu, 04 Jun 2015 19:00:56 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 1aa0d1be8 -> 4a990b50e


DELTASPIKE-905 refactored ProxyClassGeneratorLookup to inner class


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/4a990b50
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/4a990b50
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/4a990b50

Branch: refs/heads/master
Commit: 4a990b50ec6c292be8f1f1d66a42aab94f94dc38
Parents: 1aa0d1b
Author: Harald Wellmann <harald.wellmann@gmx.de>
Authored: Thu Jun 4 19:47:15 2015 +0200
Committer: Rafael Benevides <rafabene@gmail.com>
Committed: Thu Jun 4 14:56:02 2015 -0400

----------------------------------------------------------------------
 .../proxy/api/DeltaSpikeProxyFactory.java       | 34 +++++++++++---------
 .../main/resources/OSGI-INF/GeneratorHolder.xml | 24 ++++++++++++++
 .../OSGI-INF/ProxyClassGeneratorLookup.xml      | 24 --------------
 3 files changed, 43 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/4a990b50/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java
b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java
index d66947e..7cb24b3 100644
--- a/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java
+++ b/deltaspike/modules/proxy/api/src/main/java/org/apache/deltaspike/proxy/api/DeltaSpikeProxyFactory.java
@@ -37,7 +37,22 @@ public abstract class DeltaSpikeProxyFactory
 {
     private static final String SUPER_ACCESSOR_METHOD_SUFFIX = "$super";
     
-    private static ProxyClassGenerator generator;
+    public static class GeneratorHolder
+    {
+        private static ProxyClassGenerator generator;
+
+        /**
+         * Setter invoked by OSGi Service Component Runtime.
+         *
+         * @param generator
+         *            generator service
+         */
+        public void setGenerator(ProxyClassGenerator generator)
+        {
+            GeneratorHolder.generator = generator;
+        }
+    }
+
 
     /**
      * Looks up a unique service implementation.
@@ -46,7 +61,7 @@ public abstract class DeltaSpikeProxyFactory
      */
     private static ProxyClassGenerator lookupService()
     {
-        if (generator == null)
+        if (GeneratorHolder.generator == null)
         {
             List<ProxyClassGenerator> proxyClassGeneratorList = ServiceUtils
                 .loadServiceImplementations(ProxyClassGenerator.class);
@@ -57,20 +72,9 @@ public abstract class DeltaSpikeProxyFactory
                     + " implementations of " + ProxyClassGenerator.class.getName()
                     + " found. Expected exactly one implementation.");
             }
-            generator = proxyClassGeneratorList.get(0);
+            GeneratorHolder.generator = proxyClassGeneratorList.get(0);
         }
-        return generator;
-    }
-
-    /**
-     * Setter invoked by OSGi Service Component Runtime
-     *
-     * @param generator
-     *            generator service
-     */
-    public void setGenerator(ProxyClassGenerator generator)
-    {
-        DeltaSpikeProxyFactory.generator = generator;
+        return GeneratorHolder.generator;
     }
 
     public <T> Class<T> getProxyClass(Class<T> targetClass,

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/4a990b50/deltaspike/modules/proxy/api/src/main/resources/OSGI-INF/GeneratorHolder.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy/api/src/main/resources/OSGI-INF/GeneratorHolder.xml
b/deltaspike/modules/proxy/api/src/main/resources/OSGI-INF/GeneratorHolder.xml
new file mode 100644
index 0000000..b75d0a2
--- /dev/null
+++ b/deltaspike/modules/proxy/api/src/main/resources/OSGI-INF/GeneratorHolder.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="GeneratorHolder"
immediate="true">
+   <implementation class="org.apache.deltaspike.proxy.api.DeltaSpikeProxyFactory$GeneratorHolder"/>
+   <reference bind="setGenerator" cardinality="1..1" interface="org.apache.deltaspike.proxy.spi.ProxyClassGenerator"

+       name="Generator" policy="static" unbind="setGenerator"/>
+</scr:component>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/4a990b50/deltaspike/modules/proxy/api/src/main/resources/OSGI-INF/ProxyClassGeneratorLookup.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy/api/src/main/resources/OSGI-INF/ProxyClassGeneratorLookup.xml
b/deltaspike/modules/proxy/api/src/main/resources/OSGI-INF/ProxyClassGeneratorLookup.xml
deleted file mode 100644
index ff1e6fe..0000000
--- a/deltaspike/modules/proxy/api/src/main/resources/OSGI-INF/ProxyClassGeneratorLookup.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    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.
--->
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="DeltaSpikeProxyFactory">
-   <implementation class="org.apache.deltaspike.proxy.api.DeltaSpikeProxyFactory"/>
-   <reference bind="setGenerator" cardinality="1..1" interface="org.apache.deltaspike.proxy.spi.DeltaSpikeProxyFactory"

-       name="DeltaSpikeProxyFactory" policy="static" unbind="setGenerator"/>
-</scr:component>


Mime
View raw message