tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1147843 - in /tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl: ./ src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java src/main/java/org/apache/tuscany/sca/client/impl/SCAClientModuleActivator.java
Date Mon, 18 Jul 2011 12:58:10 GMT
Author: antelder
Date: Mon Jul 18 12:58:09 2011
New Revision: 1147843

URL: http://svn.apache.org/viewvc?rev=1147843&view=rev
Log:
Merge the TUSCANY-3896 fix from trunk to beta3

Modified:
    tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/   (props changed)
    tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java
    tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientModuleActivator.java

Propchange: tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Jul 18 12:58:09 2011
@@ -0,0 +1,2 @@
+/tuscany/branches/sca-java-1.3/modules/sca-client-impl:671193
+/tuscany/sca-java-2.x/trunk/modules/sca-client-impl:1147839

Modified: tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java?rev=1147843&r1=1147842&r2=1147843&view=diff
==============================================================================
--- tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java
(original)
+++ tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java
Mon Jul 18 12:58:09 2011
@@ -22,6 +22,8 @@ package org.apache.tuscany.sca.client.im
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
 import java.net.URI;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.List;
 
 import org.apache.tuscany.sca.assembly.Endpoint;
@@ -37,12 +39,16 @@ import org.oasisopen.sca.client.SCAClien
 
 public class SCAClientFactoryImpl extends SCAClientFactory {
 
-    private ExtensionPointRegistry extensionPointRegistry;
-    private DomainRegistry domainRegistry;
-    private boolean remoteClient;
+    protected ExtensionPointRegistry extensionPointRegistry;
+    protected DomainRegistry domainRegistry;
+    protected boolean remoteClient;
     
     public static URI default_domainURI = URI.create("default");
     
+    public static SCAClientFactoryFinder getSCAClientFactoryFinder() {
+        return SCAClientFactory.factoryFinder;
+    }
+
     public static void setSCAClientFactoryFinder(SCAClientFactoryFinder factoryFinder) {
         SCAClientFactory.factoryFinder = factoryFinder;
     }
@@ -52,7 +58,7 @@ public class SCAClientFactoryImpl extend
         findLocalRuntime();
     }   
     
-    private void findLocalRuntime() throws NoSuchDomainException {
+    protected void findLocalRuntime() throws NoSuchDomainException {
         String domainURI = getDomainURI().toString();
         for (ExtensionPointRegistry xpr : ExtensionPointRegistryLocator.getExtensionPointRegistries())
{
             ExtensibleDomainRegistryFactory drf = ExtensibleDomainRegistryFactory.getInstance(xpr);
@@ -105,6 +111,13 @@ public class SCAClientFactoryImpl extend
             serviceInterface = (Class<T>)((RemoteServiceInvocationHandler)handler).serviceInterface;
         }
 
-        return (T)Proxy.newProxyInstance(serviceInterface.getClassLoader(), new Class[]{serviceInterface},
handler);
+        final Class _serviceInterface = serviceInterface;
+        ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
+            public ClassLoader run() {
+               return _serviceInterface.getClassLoader();
+            }
+        });
+
+        return (T)Proxy.newProxyInstance(cl, new Class[]{serviceInterface}, handler);
     }    
 }

Modified: tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientModuleActivator.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientModuleActivator.java?rev=1147843&r1=1147842&r2=1147843&view=diff
==============================================================================
--- tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientModuleActivator.java
(original)
+++ tuscany/sca-java-2.x/branches/2.0-Beta3/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientModuleActivator.java
Mon Jul 18 12:58:09 2011
@@ -24,7 +24,10 @@ import org.apache.tuscany.sca.core.Modul
 public class SCAClientModuleActivator implements ModuleActivator {
     
     public void start() { 
-        SCAClientFactoryImpl.setSCAClientFactoryFinder(new SCAClientFactoryFinderImpl());
+        // Do not replace the finder if it's already been set by some other means
+        if (SCAClientFactoryImpl.getSCAClientFactoryFinder() == null) {
+            SCAClientFactoryImpl.setSCAClientFactoryFinder(new SCAClientFactoryFinderImpl());
+        }
     }
 
     public void stop() {



Mime
View raw message