You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2010/04/15 09:03:03 UTC

svn commit: r934301 [1/2] - in /geronimo/yoko/trunk: ./ yoko-core/ yoko-core/src/main/java/org/apache/yoko/orb/CORBA/ yoko-core/src/main/java/org/apache/yoko/orb/OB/ yoko-core/src/main/java/org/apache/yoko/orb/OBCORBA/ yoko-core/src/main/java/org/apach...

Author: djencks
Date: Thu Apr 15 07:03:02 2010
New Revision: 934301

URL: http://svn.apache.org/viewvc?rev=934301&view=rev
Log:
GERONIMO-5091 Get locator code cribbed from specs to load yoko classes.  They should be moved to a separate bundle

Added:
    geronimo/yoko/trunk/yoko-core/src/main/resources/
    geronimo/yoko/trunk/yoko-core/src/main/resources/OSGI-INF/
    geronimo/yoko/trunk/yoko-core/src/main/resources/OSGI-INF/blueprint/
    geronimo/yoko/trunk/yoko-core/src/main/resources/OSGI-INF/blueprint/provider.xml   (with props)
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/BundleProviderLoader.java   (with props)
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java   (with props)
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java   (contents, props changed)
      - copied, changed from r932781, geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registry/ProviderRegistryImpl.java
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/Register.java   (with props)
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java   (with props)
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/resources/
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/resources/OSGI-INF/
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/resources/OSGI-INF/blueprint/
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/resources/OSGI-INF/blueprint/provider.xml   (with props)
    geronimo/yoko/trunk/yoko-spec-corba/src/main/java/org/apache/yoko/osgi/
    geronimo/yoko/trunk/yoko-spec-corba/src/main/java/org/apache/yoko/osgi/ProviderLocator.java   (contents, props changed)
      - copied, changed from r932781, geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-locator/src/main/java/org/apache/geronimo/osgi/locator/ProviderLocator.java
    geronimo/yoko/trunk/yoko-spec-corba/src/main/java/org/apache/yoko/osgi/ProviderRegistry.java   (contents, props changed)
      - copied, changed from r932781, geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registry/api/ProviderRegistry.java
Modified:
    geronimo/yoko/trunk/pom.xml
    geronimo/yoko/trunk/yoko-core/pom.xml
    geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/CORBA/ObjectImpl.java
    geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/PluginManager.java
    geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/Util.java
    geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/ValueWriter.java
    geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBCORBA/ORB_impl.java
    geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/ExceptionHolder_impl.java
    geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/UserExceptionRaiseProxy.java
    geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OCI/iiop.java
    geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/csi/SecurityContext.java
    geronimo/yoko/trunk/yoko-core/src/test/java/org/apache/yoko/processmanager/internal/ProcessAgentImpl.java
    geronimo/yoko/trunk/yoko-rmi-impl/pom.xml
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/api/PortableRemoteObjectExt.java
    geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/UtilImpl.java
    geronimo/yoko/trunk/yoko-rmi-spec/src/main/java/org/apache/yoko/rmispec/util/UtilLoader.java
    geronimo/yoko/trunk/yoko-spec-corba/pom.xml
    geronimo/yoko/trunk/yoko-spec-corba/src/main/java/org/omg/CORBA/ORB.java

Modified: geronimo/yoko/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/pom.xml?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/pom.xml (original)
+++ geronimo/yoko/trunk/pom.xml Thu Apr 15 07:03:02 2010
@@ -116,9 +116,9 @@
                 <version>${junit.version}</version>
             </dependency>
             <dependency>
-                <groupId>org.apache.bcel</groupId>
-                <artifactId>bcel</artifactId>
-                <version>${bcel.version}</version>
+                <groupId>org.apache.servicemix.bundles</groupId>
+                <artifactId>org.apache.servicemix.bundles.bcel</artifactId>
+                <version>5.2_2</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.maven</groupId>

Modified: geronimo/yoko/trunk/yoko-core/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/pom.xml?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-core/pom.xml (original)
+++ geronimo/yoko/trunk/yoko-core/pom.xml Thu Apr 15 07:03:02 2010
@@ -33,10 +33,12 @@
     <dependency>
       <groupId>org.apache.yoko</groupId>
       <artifactId>yoko-spec-corba</artifactId>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.yoko</groupId>
       <artifactId>yoko-rmi-spec</artifactId>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>junit</groupId>

Modified: geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/CORBA/ObjectImpl.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/CORBA/ObjectImpl.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/CORBA/ObjectImpl.java (original)
+++ geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/CORBA/ObjectImpl.java Thu Apr 15 07:03:02 2010
@@ -17,6 +17,8 @@
 
 package org.apache.yoko.orb.CORBA;
 
+import org.apache.yoko.osgi.ProviderLocator;
+
 //
 // ObjectImpl is the base class for proprietary stubs with full
 // interceptor support
@@ -186,14 +188,10 @@ abstract public class ObjectImpl extends
 
             // get the appropriate class for the loading.
             ClassLoader loader = Thread.currentThread().getContextClassLoader();
-            if (loader == null) {
-                loader = this.getClass().getClassLoader();
-            }
-
-            Class c = loader.loadClass(className + "Helper");
+            Class c = ProviderLocator.loadClass(className + "Helper", this.getClass(), loader);
             Class[] paramTypes = new Class[2];
-            paramTypes[0] = loader.loadClass("org.omg.CORBA.portable.OutputStream");
-            paramTypes[1] = loader.loadClass(className);
+            paramTypes[0] = ProviderLocator.loadClass("org.omg.CORBA.portable.OutputStream", this.getClass(), loader);
+            paramTypes[1] = ProviderLocator.loadClass(className, this.getClass(), loader);
             java.lang.reflect.Method m = c.getMethod("write", paramTypes);
 
             //

Modified: geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/PluginManager.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/PluginManager.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/PluginManager.java (original)
+++ geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/PluginManager.java Thu Apr 15 07:03:02 2010
@@ -17,7 +17,7 @@
 
 package org.apache.yoko.orb.OB;
 
-import org.apache.yoko.orb.OB.Logger;
+import org.apache.yoko.osgi.ProviderLocator;
 
 public final class PluginManager {
     //
@@ -124,11 +124,8 @@ public final class PluginManager {
             try {
                 // get the appropriate class for the loading.
                 ClassLoader loader = Thread.currentThread().getContextClassLoader();
-                if (loader == null) {
-                    loader = this.getClass().getClassLoader();
-                }
 
-                Class c = loader.loadClass(className);
+                Class c = ProviderLocator.loadClass(className, this.getClass(), loader);
                 pi = (org.apache.yoko.orb.OCI.PluginInit) c.newInstance();
             } catch (org.omg.CORBA.SystemException ex) {
                 throw ex;

Modified: geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/Util.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/Util.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/Util.java (original)
+++ geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/Util.java Thu Apr 15 07:03:02 2010
@@ -17,14 +17,13 @@
 
 package org.apache.yoko.orb.OB;
 
+import org.apache.yoko.osgi.ProviderLocator;
+import org.omg.IOP.ServiceContext;
+import org.omg.SendingContext.CodeBase;
+
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-
 import java.util.logging.Logger;
-import java.util.logging.Level;
-
-import org.omg.IOP.ServiceContext;
-import org.omg.SendingContext.CodeBase;
 
 public final class Util {
     static final Logger logger = Logger.getLogger(Util.class.getName());
@@ -309,10 +308,8 @@ public final class Util {
             String className = exClass.getName();
             String id = null;
             try {
-                // get the appropriate class for the loading.
-                ClassLoader loader = exClass.getClassLoader();
 
-                Class c = loader.loadClass(className + "Helper");
+                Class c = ProviderLocator.loadClass(className + "Helper", exClass, null);
                 java.lang.reflect.Method m = c.getMethod("id", new Class[0]);
                 id = (String) m.invoke(null, new Object[0]);
             } catch (ClassNotFoundException e) {
@@ -598,11 +595,7 @@ public final class Util {
             Class exClass = ex.getClass();
             String helper = exClass.getName() + "Helper";
             // get the appropriate class for the loading.
-            ClassLoader loader = exClass.getClassLoader();
-            if(loader == null) {
-            	loader = Thread.currentThread().getContextClassLoader();
-            }
-        	Class c = loader.loadClass(helper);
+        	Class c = ProviderLocator.loadClass(helper, exClass, Thread.currentThread().getContextClassLoader());
             final Class[] paramTypes = { org.omg.CORBA.Any.class, exClass };
             java.lang.reflect.Method m = c.getMethod("insert", paramTypes);
             final java.lang.Object[] args = { any, ex };

Modified: geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/ValueWriter.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/ValueWriter.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/ValueWriter.java (original)
+++ geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OB/ValueWriter.java Thu Apr 15 07:03:02 2010
@@ -22,6 +22,7 @@ import java.io.Serializable;
 import javax.rmi.CORBA.ValueHandler;
 
 import org.apache.yoko.orb.CORBA.ORB;
+import org.apache.yoko.osgi.ProviderLocator;
 import org.omg.CORBA.portable.BoxedValueHelper;
 
 final public class ValueWriter {
@@ -193,11 +194,7 @@ final public class ValueWriter {
         try {
             String name = value.getClass().getName() + "Helper";
             // get the appropriate class for the loading.
-            ClassLoader loader = value.getClass().getClassLoader();
-            if(loader == null) {
-            	loader = Thread.currentThread().getContextClassLoader();
-            }
-            Class c = loader.loadClass(name);
+            Class c = ProviderLocator.loadClass(name, value.getClass(), Thread.currentThread().getContextClassLoader());
             if (BoxedValueHelper.class.isAssignableFrom(c))
                 helperClass = c;
         } catch (ClassNotFoundException ex) {

Modified: geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBCORBA/ORB_impl.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBCORBA/ORB_impl.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBCORBA/ORB_impl.java (original)
+++ geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBCORBA/ORB_impl.java Thu Apr 15 07:03:02 2010
@@ -20,6 +20,7 @@ package org.apache.yoko.orb.OBCORBA;
 import java.security.AccessController;
 import java.util.Properties;
 import org.apache.yoko.orb.util.GetSystemPropertyAction;
+import org.apache.yoko.osgi.ProviderLocator;
 
 // This class must be public and not final
 public class ORB_impl extends org.apache.yoko.orb.CORBA.ORBSingleton {
@@ -787,13 +788,8 @@ public class ORB_impl extends org.apache
                     try {
                         // get the appropriate class for the loading.
                         ClassLoader loader = Thread.currentThread().getContextClassLoader();
-                        if (loader == null) {
-                            loader = this.getClass().getClassLoader();
-                        }
-
-                        Class c = loader.loadClass(initClass);
-                        org.omg.PortableInterceptor.ORBInitializer init = (org.omg.PortableInterceptor.ORBInitializer) c
-                                .newInstance();
+                        org.omg.PortableInterceptor.ORBInitializer init = (org.omg.PortableInterceptor.ORBInitializer) 
+                                ProviderLocator.loadClass(initClass, getClass(), loader).newInstance();
                         orbInitializers_.put(initClass, init);
                     }
                     // Exceptions have to be ignored here
@@ -1487,21 +1483,26 @@ public class ORB_impl extends org.apache
         final String propName = "org.omg.CORBA.ORBClass";
         String orbClassName = null;
 
-        if (props != null)
-            orbClassName = props.getProperty(propName);
+        ORB_impl orb;
 
-        if (orbClassName == null)
-            orbClassName = getSystemProperty(propName);
+        try {
+            orb = (ORB_impl) ProviderLocator.getService(propName, ORB_impl.class, Thread.currentThread().getContextClassLoader());
+            if (orb == null) {
 
-        if (orbClassName == null)
-            orbClassName = "org.apache.yoko.orb.CORBA.ORB";
+                if (props != null)
+                    orbClassName = props.getProperty(propName);
 
-        ORB_impl orb;
+                try {
+                    if (orbClassName == null)
+                        orbClassName = getSystemProperty(propName);
+                } catch (SecurityException ex) {
+                    // ignore
+                }
 
-        try {
-            // get the appropriate class for the loading.
-            ClassLoader loader = Thread.currentThread().getContextClassLoader();
-            orb = (ORB_impl) loader.loadClass(orbClassName).newInstance();
+                if (orbClassName == null)
+                    orbClassName = "org.apache.yoko.orb.CORBA.ORB";
+                orb = (ORB_impl) ProviderLocator.loadClass(orbClassName, ORB_impl.class, Thread.currentThread().getContextClassLoader()).newInstance();
+            }
         } catch (Throwable ex) {
             throw (org.omg.CORBA.INITIALIZE)new org.omg.CORBA.INITIALIZE("Invalid ORB class: "
                     + orbClassName + '\n' + ex.getMessage()).initCause(ex);
@@ -1523,26 +1524,26 @@ public class ORB_impl extends org.apache
 
         final String propName = "org.omg.CORBA.ORBClass";
         String orbClassName = null;
-
-        if (props != null)
-            orbClassName = props.getProperty(propName);
+        ORB_impl orb;
 
         try {
-            if (orbClassName == null)
-                orbClassName = getSystemProperty(propName);
-        } catch (SecurityException ex) {
-            // ignore
-        }
+            orb = (ORB_impl) ProviderLocator.getService(propName, ORB_impl.class, Thread.currentThread().getContextClassLoader());
+            if (orb == null) {
 
-        if (orbClassName == null)
-            orbClassName = "org.apache.yoko.orb.CORBA.ORB";
+                if (props != null)
+                    orbClassName = props.getProperty(propName);
 
-        ORB_impl orb;
+                try {
+                    if (orbClassName == null)
+                        orbClassName = getSystemProperty(propName);
+                } catch (SecurityException ex) {
+                    // ignore
+                }
 
-        try {
-            // get the appropriate class for the loading.
-            ClassLoader loader = Thread.currentThread().getContextClassLoader();
-            orb = (ORB_impl) loader.loadClass(orbClassName).newInstance();
+                if (orbClassName == null)
+                    orbClassName = "org.apache.yoko.orb.CORBA.ORB";
+                orb = (ORB_impl) ProviderLocator.loadClass(orbClassName, ORB_impl.class, Thread.currentThread().getContextClassLoader()).newInstance();
+            }
         } catch (Throwable ex) {
             throw (org.omg.CORBA.INITIALIZE)new org.omg.CORBA.INITIALIZE("Invalid ORB class: "
                     + orbClassName + '\n' + ex.getMessage()).initCause(ex);

Modified: geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/ExceptionHolder_impl.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/ExceptionHolder_impl.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/ExceptionHolder_impl.java (original)
+++ geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/ExceptionHolder_impl.java Thu Apr 15 07:03:02 2010
@@ -16,6 +16,7 @@
  */
 
 package org.apache.yoko.orb.OBMessaging;
+import org.apache.yoko.osgi.ProviderLocator;
 import org.omg.CORBA.Any;
 
 public class ExceptionHolder_impl extends org.omg.Messaging._ExceptionHolder {
@@ -210,7 +211,7 @@ public class ExceptionHolder_impl extend
                 //
                 // get the appropriate class for the loading.
                 ClassLoader loader = exClass.getClassLoader();
-                Class c = loader.loadClass(className + "Helper");
+                Class c = ProviderLocator.loadClass(className + "Helper", exClass);
                 Class[] paramTypes = new Class[2];
                 paramTypes[0] = org.omg.CORBA.Any.class;
                 paramTypes[1] = exClass;

Modified: geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/UserExceptionRaiseProxy.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/UserExceptionRaiseProxy.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/UserExceptionRaiseProxy.java (original)
+++ geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OBMessaging/UserExceptionRaiseProxy.java Thu Apr 15 07:03:02 2010
@@ -17,6 +17,8 @@
 
 package org.apache.yoko.orb.OBMessaging;
 
+import org.apache.yoko.osgi.ProviderLocator;
+
 public class UserExceptionRaiseProxy {
     public void raise(org.omg.Messaging._ExceptionHolder execptHolder)
             throws org.omg.CORBA.UserException {
@@ -39,8 +41,7 @@ public class UserExceptionRaiseProxy {
                 // appropriate parameter types
                 //
                 // get the appropriate class for the loading.
-                ClassLoader loader = exClass.getClassLoader();
-                Class c = loader.loadClass(className + "Helper");
+                Class c = ProviderLocator.loadClass(className + "Helper", exClass);
                 Class[] paramTypes = new Class[2];
                 paramTypes[0] = org.omg.CORBA.Any.class;
                 paramTypes[1] = exClass;

Modified: geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OCI/iiop.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OCI/iiop.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OCI/iiop.java (original)
+++ geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/OCI/iiop.java Thu Apr 15 07:03:02 2010
@@ -21,6 +21,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.yoko.orb.OCI.IIOP.ConnectionHelper;
+import org.apache.yoko.osgi.ProviderLocator;
 
 public class iiop implements PluginInit {
     static final Logger logger = Logger.getLogger(iiop.class.getName());
@@ -55,11 +56,8 @@ public class iiop implements PluginInit 
         try {
             // get the appropriate class for the loading.
             ClassLoader loader = Thread.currentThread().getContextClassLoader();
-            if (loader == null) {
-                loader = this.getClass().getClassLoader();
-            }
 
-            Class c = loader.loadClass(connectionHelper);
+            Class c = ProviderLocator.loadClass(connectionHelper, getClass(), loader);
             helper = (org.apache.yoko.orb.OCI.IIOP.ConnectionHelper) c.newInstance();
             // give this a chance to initializer
             helper.init(orb, helperArgs);

Modified: geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/csi/SecurityContext.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/csi/SecurityContext.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/csi/SecurityContext.java (original)
+++ geronimo/yoko/trunk/yoko-core/src/main/java/org/apache/yoko/orb/csi/SecurityContext.java Thu Apr 15 07:03:02 2010
@@ -22,6 +22,7 @@ import javax.security.auth.login.LoginEx
 
 import java.security.AccessController;
 import org.apache.yoko.orb.util.GetSystemPropertyAction;
+import org.apache.yoko.osgi.ProviderLocator;
 
 public abstract class SecurityContext {
 
@@ -49,7 +50,7 @@ public abstract class SecurityContext {
         try {
             // get the appropriate class for the loading.
             ClassLoader loader = Thread.currentThread().getContextClassLoader();
-            Class c = loader.loadClass(className);
+            Class c = ProviderLocator.loadClass(className, SecurityContext.class, loader);
             return (SecurityContextDelegate) c.newInstance();
         }
         catch (Exception ex) {

Added: geronimo/yoko/trunk/yoko-core/src/main/resources/OSGI-INF/blueprint/provider.xml
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/src/main/resources/OSGI-INF/blueprint/provider.xml?rev=934301&view=auto
==============================================================================
--- geronimo/yoko/trunk/yoko-core/src/main/resources/OSGI-INF/blueprint/provider.xml (added)
+++ geronimo/yoko/trunk/yoko-core/src/main/resources/OSGI-INF/blueprint/provider.xml Thu Apr 15 07:03:02 2010
@@ -0,0 +1,100 @@
+<?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.
+-->
+<!--
+
+  blueprint configuration for jndi providers
+  -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+
+    <reference id="register" interface="org.apache.yoko.osgi.locator.Register" component-name="yokoRegistryBean"/>
+
+    <bean class="org.apache.yoko.osgi.locator.ServiceBean"
+          activation="eager"
+          init-method="start"
+          destroy-method="stop">
+        <argument>
+            <value>org.omg.CORBA.ORBClass</value>
+        </argument>
+        <argument>
+            <value>org.apache.yoko.orb.CORBA.ORB</value>
+        </argument>
+        <argument>
+            <ref component-id="blueprintBundle"/>
+        </argument>
+        <argument>
+            <ref component-id="register"/>
+        </argument>
+    </bean>
+    <bean class="org.apache.yoko.osgi.locator.ServiceBean"
+          activation="eager"
+          init-method="start"
+          destroy-method="stop">
+        <argument>
+            <value>org.omg.CORBA.ORBSingleton</value>
+        </argument>
+        <argument>
+            <value>org.apache.yoko.orb.CORBA.ORBSingleton</value>
+        </argument>
+        <argument>
+            <ref component-id="blueprintBundle"/>
+        </argument>
+        <argument>
+            <ref component-id="register"/>
+        </argument>
+    </bean>
+
+    <bean class="org.apache.yoko.osgi.locator.ProviderBean"
+          activation="eager"
+          init-method="start"
+          destroy-method="stop">
+        <argument>
+            <value>org.apache.yoko.orb.CORBA.ORB</value>
+        </argument>
+        <argument>
+            <value>org.apache.yoko.orb.CORBA.ORB</value>
+        </argument>
+        <argument>
+            <ref component-id="blueprintBundle"/>
+        </argument>
+        <argument>
+            <ref component-id="register"/>
+        </argument>
+    </bean>
+    <bean class="org.apache.yoko.osgi.locator.ProviderBean"
+          activation="eager"
+          init-method="start"
+          destroy-method="stop">
+        <argument>
+            <value>org.apache.yoko.orb.CORBA.ORBSingleton</value>
+        </argument>
+        <argument>
+            <value>org.apache.yoko.orb.CORBA.ORBSingleton</value>
+        </argument>
+        <argument>
+            <ref component-id="blueprintBundle"/>
+        </argument>
+        <argument>
+            <ref component-id="register"/>
+        </argument>
+    </bean>
+
+
+</blueprint>
\ No newline at end of file

Propchange: geronimo/yoko/trunk/yoko-core/src/main/resources/OSGI-INF/blueprint/provider.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/yoko/trunk/yoko-core/src/main/resources/OSGI-INF/blueprint/provider.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/yoko/trunk/yoko-core/src/main/resources/OSGI-INF/blueprint/provider.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/yoko/trunk/yoko-core/src/test/java/org/apache/yoko/processmanager/internal/ProcessAgentImpl.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-core/src/test/java/org/apache/yoko/processmanager/internal/ProcessAgentImpl.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-core/src/test/java/org/apache/yoko/processmanager/internal/ProcessAgentImpl.java (original)
+++ geronimo/yoko/trunk/yoko-core/src/test/java/org/apache/yoko/processmanager/internal/ProcessAgentImpl.java Thu Apr 15 07:03:02 2010
@@ -26,6 +26,7 @@ import java.rmi.registry.Registry;
 import java.rmi.server.UnicastRemoteObject;
 
 import EDU.oswego.cs.dl.util.concurrent.CountDown;
+import org.apache.yoko.osgi.ProviderLocator;
 
 public class ProcessAgentImpl extends UnicastRemoteObject implements ProcessAgent {
 
@@ -144,11 +145,8 @@ public class ProcessAgentImpl extends Un
             }
             // get the appropriate class for the loading.
             ClassLoader loader = Thread.currentThread().getContextClassLoader();
-            if (loader == null) {
-                loader = this.getClass().getClassLoader();
-            }
 
-            Class cl = loader.loadClass(className);
+            Class cl = ProviderLocator.loadClass(className, getClass(), loader);
             Method method = cl.getMethod(methodName, parameters);
             return method.invoke(null, args);
         }

Modified: geronimo/yoko/trunk/yoko-rmi-impl/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-rmi-impl/pom.xml?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-rmi-impl/pom.xml (original)
+++ geronimo/yoko/trunk/yoko-rmi-impl/pom.xml Thu Apr 15 07:03:02 2010
@@ -32,14 +32,16 @@
         <dependency>
             <groupId>org.apache.yoko</groupId>
             <artifactId>yoko-spec-corba</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.yoko</groupId>
             <artifactId>yoko-rmi-spec</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.bcel</groupId>
-            <artifactId>bcel</artifactId>
+            <groupId>org.apache.servicemix.bundles</groupId>
+            <artifactId>org.apache.servicemix.bundles.bcel</artifactId>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
@@ -55,7 +57,14 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.apache.yoko.rmi.impl*,*</Export-Package>
+                        <Export-Package>
+                            org.apache.yoko.osgi.locator,
+                            org.apache.yoko.rmi.impl,
+                            org.apache.yoko.rmi.api,
+                            org.apache.yoko.rmi.util,
+                            org.apache.yoko.rmi.util.corba,
+                            org.apache.yoko.rmi.util.stub
+                        </Export-Package>
                     </instructions>
                 </configuration>
             </plugin>

Added: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/BundleProviderLoader.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/BundleProviderLoader.java?rev=934301&view=auto
==============================================================================
--- geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/BundleProviderLoader.java (added)
+++ geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/BundleProviderLoader.java Thu Apr 15 07:03:02 2010
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+
+package org.apache.yoko.osgi.locator;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * Holder class for located services information.
+ */
+public class BundleProviderLoader {
+    // the class name for this provider
+    private final String providerId;
+    // the mapped class name of the provider.
+    private final String providerClass;
+    // the hosting bundle.
+    private final Bundle bundle;
+
+    /**
+     * Create a loader for this registered provider.
+     *
+     * @param providerId The provider ID
+     * @param providerClass The mapped class name of the provider.
+     * @param bundle    The hosting bundle.
+     */
+    public BundleProviderLoader(String providerId, String providerClass, Bundle bundle) {
+        this.providerId = providerId;
+        this.providerClass = providerClass;
+        this.bundle = bundle;
+    }
+
+    /**
+     * Load a provider class.
+     *
+     * @return The provider class from the target bundle.
+     * @exception Exception
+     */
+    public Class<?> loadClass() throws ClassNotFoundException {
+        try {
+//                log(LogService.LOG_DEBUG, "loading class for: " + this);
+            return bundle.loadClass(providerClass);
+        } catch (ClassNotFoundException e) {
+//                log(LogService.LOG_DEBUG, "exception caught while loading " + this, e);
+            throw e;
+        }
+    }
+
+    /**
+     * Create an instance of the registred service.
+     *
+     * @return The created instance.  A new instance is created on each call.
+     * @exception Exception
+     */
+    public Object createInstance() throws Exception {
+        // get the class object
+        Class <?> cls = loadClass();
+        try {
+            // just create an instance using the default constructor
+            return cls.newInstance();
+        } catch (Exception e) {
+//                log(LogService.LOG_DEBUG, "exception caught while creating " + this, e);
+            throw e;
+        } catch (Error e) {
+//                log(LogService.LOG_DEBUG, "error caught while creating " + this, e);
+            throw e;
+        }
+    }
+
+
+    public String id() {
+        return providerId;
+    }
+
+    @Override
+    public String toString() {
+        return "Provider interface=" + providerId + " , provider class=" + providerClass + ", bundle=" + bundle;
+    }
+
+    @Override
+    public int hashCode() {
+        return providerId.hashCode() + providerClass.hashCode() + (int)bundle.getBundleId();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof BundleProviderLoader) {
+            return providerId.equals(((BundleProviderLoader)obj).providerId) &&
+                   providerClass.equals(((BundleProviderLoader)obj).providerClass) &&
+                   bundle.getBundleId() == ((BundleProviderLoader)obj).bundle.getBundleId();
+        } else {
+            return false;
+        }
+    }
+}

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/BundleProviderLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/BundleProviderLoader.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/BundleProviderLoader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java?rev=934301&view=auto
==============================================================================
--- geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java (added)
+++ geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java Thu Apr 15 07:03:02 2010
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+
+package org.apache.yoko.osgi.locator;
+
+import java.util.logging.Logger;
+
+import org.apache.yoko.osgi.ProviderRegistry;
+import org.osgi.framework.Bundle;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ProviderBean {
+    private static final Logger log = Logger.getLogger(ProviderBean.class.getName());
+
+    private Register providerRegistry;
+
+    private BundleProviderLoader bundleProviderLoader;
+
+    public ProviderBean(String key,
+                        String className,
+                        Bundle bundle,
+                        Register providerRegistry) {
+        bundleProviderLoader = new BundleProviderLoader(key, className, bundle);
+        log.finer("ProviderBean: " + bundleProviderLoader);
+        this.providerRegistry = providerRegistry;
+    }
+
+
+
+    public void start() {
+        providerRegistry.registerProvider(bundleProviderLoader);
+    }
+
+    public void stop() {
+        providerRegistry.unregisterProvider(bundleProviderLoader);
+    }
+}

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java (from r932781, geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registry/ProviderRegistryImpl.java)
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java?p2=geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java&p1=geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registry/ProviderRegistryImpl.java&r1=932781&r2=934301&rev=934301&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-osgi-support/geronimo-osgi-registry/src/main/java/org/apache/geronimo/osgi/registry/ProviderRegistryImpl.java (original)
+++ geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java Thu Apr 15 07:03:02 2010
@@ -14,28 +14,24 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.osgi.registry;
+package org.apache.yoko.osgi.locator;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
 import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
+import java.util.logging.Logger;
 
-import org.osgi.framework.Bundle;
+import org.apache.yoko.osgi.ProviderLocator;
 import org.osgi.service.log.LogService;
 
 /**
  * The implementation of the provider registry used to store
  * the bundle registrations.
  */
-public class ProviderRegistryImpl implements org.apache.geronimo.osgi.registry.api.ProviderRegistry {
+public class ProviderRegistryImpl implements org.apache.yoko.osgi.ProviderRegistry, Register {
+
+    private static final Logger log = Logger.getLogger(ProviderRegistryImpl.class.getName());
     // indicates a bundle wishes to opt in to the META-INF/services registration and tracking.
     public static final String OPT_IN_HEADER = "SPI-Provider";
     // provider classes exported via a header.
@@ -47,13 +43,21 @@ public class ProviderRegistryImpl implem
     // might be a one-to-many relationship between the ids and implementing classes.
     private SPIRegistry serviceProviders = new SPIRegistry();
 
-    // our base Activator (used as a service source)
-    private Activator activator;
+    public void start() {
+        ProviderLocator.setRegistry(this);
+    }
 
-    public ProviderRegistryImpl(Activator activator) {
-        this.activator = activator;
+    public void stop() {
+        ProviderLocator.setRegistry(null);
     }
 
+    // our base Activator (used as a service source)
+//    private Activator activator;
+
+//    public ProviderRegistryImpl(Activator activator) {
+//        this.activator = activator;
+//    }
+
     /**
      * Add a bundle to the provider registry.  This searches
      * for services information in the OSGI-INF/providers
@@ -67,16 +71,16 @@ public class ProviderRegistryImpl implem
      * @return A map of the located registrations.  Returns null if
      *         this bundle does not contain any providers.
      */
-    public Object addBundle(Bundle bundle) {
-        log(LogService.LOG_DEBUG, "adding bundle " + bundle);
-        // create a tracker item for this bundle.  This will record all of the information
-        // that's relevent to this bundle
-        BundleResources tracker = new BundleResources(bundle);
-
-        // if the tracker found information of interest, return it to the
-        // BundleTracker to let it know we need to watch this one.
-        return tracker.needsTracking() ? tracker : null;
-    }
+//    public Object addBundle(Bundle bundle) {
+//        log(LogService.LOG_DEBUG, "adding bundle " + bundle);
+//        // create a tracker item for this bundle.  This will record all of the information
+//        // that's relevent to this bundle
+//        BundleResources tracker = new BundleResources(bundle);
+//
+//        // if the tracker found information of interest, return it to the
+//        // BundleTracker to let it know we need to watch this one.
+//        return tracker.needsTracking() ? tracker : null;
+//    }
 
 
     /**
@@ -84,22 +88,21 @@ public class ProviderRegistryImpl implem
      *
      * @param bundle The target bundle.
      */
-    public void removeBundle(Bundle bundle, Object obj) {
-        log(LogService.LOG_DEBUG, "removing bundle " + bundle);
-        BundleResources tracker = (BundleResources)obj;
-        if (tracker != null) {
-            tracker.remove();
-        }
-    }
+//    public void removeBundle(Bundle bundle, Object obj) {
+//        log(LogService.LOG_DEBUG, "removing bundle " + bundle);
+//        BundleResources tracker = (BundleResources)obj;
+//        if (tracker != null) {
+//            tracker.remove();
+//        }
+//    }
 
 
     /**
      * Register an individual provivider item by its provider identifier.
      *
-     * @param id      The provider id.
      * @param provider The loader used to resolve the provider class.
      */
-    protected void registerProvider(BundleProviderLoader provider) {
+    public void registerProvider(BundleProviderLoader provider) {
         log(LogService.LOG_DEBUG, "registering provider " + provider);
         providers.register(provider);
     }
@@ -107,10 +110,9 @@ public class ProviderRegistryImpl implem
     /**
      * Removed a provider registration for a named provider id.
      *
-     * @param id      The target id
      * @param provider The provider registration instance
      */
-    protected void unregisterProvider(BundleProviderLoader provider) {
+    public void unregisterProvider(BundleProviderLoader provider) {
         log(LogService.LOG_DEBUG, "unregistering provider " + provider);
         providers.unregister(provider);
     }
@@ -119,10 +121,9 @@ public class ProviderRegistryImpl implem
     /**
      * Register an individual provivider item by its provider identifier.
      *
-     * @param id      The provider id.
      * @param provider The loader used to resolve the provider class.
      */
-    protected void registerService(BundleProviderLoader provider) {
+    public void registerService(BundleProviderLoader provider) {
         log(LogService.LOG_DEBUG, "registering service " + provider);
         serviceProviders.register(provider);
     }
@@ -130,10 +131,9 @@ public class ProviderRegistryImpl implem
     /**
      * Removed a provider registration for a named provider id.
      *
-     * @param id      The target id
      * @param provider The provider registration instance
      */
-    protected void unregisterService(BundleProviderLoader provider) {
+    public void unregisterService(BundleProviderLoader provider) {
         log(LogService.LOG_DEBUG, "unregistering service " + provider);
         serviceProviders.unregister(provider);
     }
@@ -295,206 +295,208 @@ public class ProviderRegistryImpl implem
     }
 
     private void log(int level, String message) {
-        activator.log(level, message);
+        log.fine(message);
+//        activator.log(level, message);
     }
 
     private void log(int level, String message, Throwable th) {
-        activator.log(level, message, th);
+//        log.fine(message, th);
+//        activator.log(level, message, th);
     }
 
 
-    private class BundleResources {
-        // the bundle we're attached to.
-        private Bundle bundle;
-        // our map of providers maintained for the META-INF/services design pattern.
-        // this is an interface-to-provider instance mapping.
-        private List<BundleProviderLoader> serviceProviders;
-        // the defined mapping for provider classes...not maintained as an
-        // interface-to-provider mapping.
-        private List<BundleProviderLoader> providers;
-
-        public BundleResources(Bundle b) {
-            bundle = b;
-            // go locate any services we need
-            locateProviders();
-            locateServices();
-        }
-
-        public boolean needsTracking() {
-            return serviceProviders != null || providers != null;
-        }
-
-        // locate and process any providers defined in the OSGI-INF/providers directory
-        private void locateProviders() {
-            // we accumulate from the headers and the providers directory.  The headers
-            // are simpler if there is no class mapping and is easier to use when
-            // converting a simple jar to a bundle.
-            Set<BundleProviderLoader> locatedProviders = new LinkedHashSet<BundleProviderLoader>();
-            List<BundleProviderLoader> headerProviders = locateHeaderProviderDefinitions();
-            if (headerProviders != null) {
-                locatedProviders.addAll(headerProviders);
-            }
-
-            List<BundleProviderLoader> directoryProviders = processDefinitions("OSGI-INF/providers/");
-            if (directoryProviders != null) {
-                locatedProviders.addAll(directoryProviders);
-            }
-            // if we have anything, add to global registry
-            if (!locatedProviders.isEmpty()) {
-                // process the registrations for each item
-                for (BundleProviderLoader loader: locatedProviders) {
-                    // add to the mapping table
-                    registerProvider(loader);
-                }
-                // remember this list so we can unregister when the bundle is stopped
-                providers = new ArrayList(locatedProviders);
-            }
-        }
-
-        /**
-         * Parse the Export-Provider: header to create a list of
-         * providers that are exported via the header syntax
-         * rather than via a provider mapping file.
-         *
-         * @return A list of providers defined on the header, or null if
-         *         no providers were exported.
-         */
-        private List<BundleProviderLoader> locateHeaderProviderDefinitions() {
-            // check the header to see if there's anything defined here.
-            String exportedProviders = (String)bundle.getHeaders().get(EXPORT_PROVIDER_HEADER);
-            if (exportedProviders == null) {
-                return null;
-            }
-
-            List<BundleProviderLoader>providers = new ArrayList<BundleProviderLoader>();
-            // split on the separator
-            String[] classNames = exportedProviders.split(",");
-
-            for (String name : classNames) {
-                name = name.trim();
-                // this is a simple mapping
-                providers.add(new BundleProviderLoader(name, name, bundle));
-            }
-            return providers;
-        }
-
-        // now process any services
-        private void locateServices() {
-            // we only process these if there is a header indicating this
-            // bundle wants to opt-in to this registration process.
-            if (bundle.getHeaders().get(OPT_IN_HEADER) == null) {
-                return;
-            }
-
-            log(LogService.LOG_INFO, OPT_IN_HEADER + " Manifest header found in bundle: " + bundle.getSymbolicName());
-
-            serviceProviders = processDefinitions("META-INF/services/");
-            // if we have anything, add to global registry
-            if (serviceProviders != null) {
-                // process the registrations for each item
-                for (BundleProviderLoader loader: serviceProviders) {
-                    // add to the mapping table
-                    registerService(loader);
-                }
-            }
-        }
-
-
-        /**
-         * Remove all resources associated with this bundle from the
-         * global registry.
-         */
-        public void remove() {
-            log(LogService.LOG_DEBUG, "removing bundle " + bundle);
-            if (providers != null) {
-                for (BundleProviderLoader loader : providers) {
-                    // unregistry the individual entry
-                    unregisterProvider(loader);
-                }
-            }
-
-            if (serviceProviders != null) {
-                for (BundleProviderLoader loader : serviceProviders) {
-                    // unregistry the individual entry
-                    unregisterService(loader);
-                }
-            }
-        }
-
-
-        /**
-         * Process all of the service definition files in a given
-         * target path.  This is used to process both the
-         * META-INF/services files and the OSGI-INF/providers files.
-         *
-         * @param path   The target path location.
-         *
-         * @return The list of matching service definitions.  Returns null if
-         *         no matches were found.
-         */
-        private List<BundleProviderLoader> processDefinitions(String path) {
-            List<BundleProviderLoader> mappings = new ArrayList<BundleProviderLoader>();
-
-            // look for services definitions in the bundle...we accumulate these as provider class
-            // definitions.
-            Enumeration e = bundle.findEntries(path, "*", false);
-            if (e != null) {
-                while (e.hasMoreElements()) {
-                    final URL u = (URL) e.nextElement();
-                    // go parse out the control file
-                    parseServiceFile(u, mappings);
-                }
-            }
-            // only return this if we have something associated with this bundle
-            return mappings.isEmpty() ? null : mappings;
-        }
-
-
-        /**
-         * Parse a provider definition file and create loaders
-         * for all definitions contained within the file.
-         *
-         * @param u      The URL of the file
-         *
-         * @return A list of the defined mappings.
-         */
-        private void parseServiceFile(URL u, List<BundleProviderLoader>mappings) {
-            final String url = u.toString();
-            // ignore directories
-            if (url.endsWith("/")) {
-                return;
-            }
-
-            // the identifier used for the provider is the last item in the URL.
-            final String providerId = url.substring(url.lastIndexOf("/") + 1);
-            try {
-                BufferedReader br = new BufferedReader(new InputStreamReader(u.openStream(), "UTF-8"));
-                String providerClassName = null;
-                // the file can be multiple lines long, with comments.  A single file can define multiple providers
-                // for a single key, so we might need to create multiple entries.  If the file does not contain any
-                // definition lines, then as a default, we use the providerId as an implementation class also.
-                String line = br.readLine();
-                while (line != null) {
-                    // we allow comments on these lines, and a line can be all comment
-                    int comment = line.indexOf('#');
-                    if (comment != -1) {
-                        line = line.substring(0, comment);
-                    }
-                    line = line.trim();
-                    // if there is nothing left on the line after stripping white space and comments, skip this
-                    if (line.length() > 0) {
-                        // add this to our list
-                        mappings.add(new BundleProviderLoader(providerId, line, bundle));
-                    }
-                    // keep reading until the end.
-                    line = br.readLine();
-                }
-                br.close();
-            } catch (IOException e) {
-                // ignore errors and handle as default
-            }
-        }
-    }
+//    private class BundleResources {
+//        // the bundle we're attached to.
+//        private Bundle bundle;
+//        // our map of providers maintained for the META-INF/services design pattern.
+//        // this is an interface-to-provider instance mapping.
+//        private List<BundleProviderLoader> serviceProviders;
+//        // the defined mapping for provider classes...not maintained as an
+//        // interface-to-provider mapping.
+//        private List<BundleProviderLoader> providers;
+//
+//        public BundleResources(Bundle b) {
+//            bundle = b;
+//            // go locate any services we need
+//            locateProviders();
+//            locateServices();
+//        }
+//
+//        public boolean needsTracking() {
+//            return serviceProviders != null || providers != null;
+//        }
+//
+//        // locate and process any providers defined in the OSGI-INF/providers directory
+//        private void locateProviders() {
+//            // we accumulate from the headers and the providers directory.  The headers
+//            // are simpler if there is no class mapping and is easier to use when
+//            // converting a simple jar to a bundle.
+//            Set<BundleProviderLoader> locatedProviders = new LinkedHashSet<BundleProviderLoader>();
+//            List<BundleProviderLoader> headerProviders = locateHeaderProviderDefinitions();
+//            if (headerProviders != null) {
+//                locatedProviders.addAll(headerProviders);
+//            }
+//
+//            List<BundleProviderLoader> directoryProviders = processDefinitions("OSGI-INF/providers/");
+//            if (directoryProviders != null) {
+//                locatedProviders.addAll(directoryProviders);
+//            }
+//            // if we have anything, add to global registry
+//            if (!locatedProviders.isEmpty()) {
+//                // process the registrations for each item
+//                for (BundleProviderLoader loader: locatedProviders) {
+//                    // add to the mapping table
+//                    registerProvider(loader);
+//                }
+//                // remember this list so we can unregister when the bundle is stopped
+//                providers = new ArrayList(locatedProviders);
+//            }
+//        }
+//
+//        /**
+//         * Parse the Export-Provider: header to create a list of
+//         * providers that are exported via the header syntax
+//         * rather than via a provider mapping file.
+//         *
+//         * @return A list of providers defined on the header, or null if
+//         *         no providers were exported.
+//         */
+//        private List<BundleProviderLoader> locateHeaderProviderDefinitions() {
+//            // check the header to see if there's anything defined here.
+//            String exportedProviders = (String)bundle.getHeaders().get(EXPORT_PROVIDER_HEADER);
+//            if (exportedProviders == null) {
+//                return null;
+//            }
+//
+//            List<BundleProviderLoader>providers = new ArrayList<BundleProviderLoader>();
+//            // split on the separator
+//            String[] classNames = exportedProviders.split(",");
+//
+//            for (String name : classNames) {
+//                name = name.trim();
+//                // this is a simple mapping
+//                providers.add(new BundleProviderLoader(name, name, bundle));
+//            }
+//            return providers;
+//        }
+//
+//        // now process any services
+//        private void locateServices() {
+//            // we only process these if there is a header indicating this
+//            // bundle wants to opt-in to this registration process.
+//            if (bundle.getHeaders().get(OPT_IN_HEADER) == null) {
+//                return;
+//            }
+//
+//            log(LogService.LOG_INFO, OPT_IN_HEADER + " Manifest header found in bundle: " + bundle.getSymbolicName());
+//
+//            serviceProviders = processDefinitions("META-INF/services/");
+//            // if we have anything, add to global registry
+//            if (serviceProviders != null) {
+//                // process the registrations for each item
+//                for (BundleProviderLoader loader: serviceProviders) {
+//                    // add to the mapping table
+//                    registerService(loader);
+//                }
+//            }
+//        }
+//
+//
+//        /**
+//         * Remove all resources associated with this bundle from the
+//         * global registry.
+//         */
+//        public void remove() {
+//            log(LogService.LOG_DEBUG, "removing bundle " + bundle);
+//            if (providers != null) {
+//                for (BundleProviderLoader loader : providers) {
+//                    // unregistry the individual entry
+//                    unregisterProvider(loader);
+//                }
+//            }
+//
+//            if (serviceProviders != null) {
+//                for (BundleProviderLoader loader : serviceProviders) {
+//                    // unregistry the individual entry
+//                    unregisterService(loader);
+//                }
+//            }
+//        }
+//
+//
+//        /**
+//         * Process all of the service definition files in a given
+//         * target path.  This is used to process both the
+//         * META-INF/services files and the OSGI-INF/providers files.
+//         *
+//         * @param path   The target path location.
+//         *
+//         * @return The list of matching service definitions.  Returns null if
+//         *         no matches were found.
+//         */
+//        private List<BundleProviderLoader> processDefinitions(String path) {
+//            List<BundleProviderLoader> mappings = new ArrayList<BundleProviderLoader>();
+//
+//            // look for services definitions in the bundle...we accumulate these as provider class
+//            // definitions.
+//            Enumeration e = bundle.findEntries(path, "*", false);
+//            if (e != null) {
+//                while (e.hasMoreElements()) {
+//                    final URL u = (URL) e.nextElement();
+//                    // go parse out the control file
+//                    parseServiceFile(u, mappings);
+//                }
+//            }
+//            // only return this if we have something associated with this bundle
+//            return mappings.isEmpty() ? null : mappings;
+//        }
+//
+//
+//        /**
+//         * Parse a provider definition file and create loaders
+//         * for all definitions contained within the file.
+//         *
+//         * @param u      The URL of the file
+//         *
+//         * @return A list of the defined mappings.
+//         */
+//        private void parseServiceFile(URL u, List<BundleProviderLoader>mappings) {
+//            final String url = u.toString();
+//            // ignore directories
+//            if (url.endsWith("/")) {
+//                return;
+//            }
+//
+//            // the identifier used for the provider is the last item in the URL.
+//            final String providerId = url.substring(url.lastIndexOf("/") + 1);
+//            try {
+//                BufferedReader br = new BufferedReader(new InputStreamReader(u.openStream(), "UTF-8"));
+//                String providerClassName = null;
+//                // the file can be multiple lines long, with comments.  A single file can define multiple providers
+//                // for a single key, so we might need to create multiple entries.  If the file does not contain any
+//                // definition lines, then as a default, we use the providerId as an implementation class also.
+//                String line = br.readLine();
+//                while (line != null) {
+//                    // we allow comments on these lines, and a line can be all comment
+//                    int comment = line.indexOf('#');
+//                    if (comment != -1) {
+//                        line = line.substring(0, comment);
+//                    }
+//                    line = line.trim();
+//                    // if there is nothing left on the line after stripping white space and comments, skip this
+//                    if (line.length() > 0) {
+//                        // add this to our list
+//                        mappings.add(new BundleProviderLoader(providerId, line, bundle));
+//                    }
+//                    // keep reading until the end.
+//                    line = br.readLine();
+//                }
+//                br.close();
+//            } catch (IOException e) {
+//                // ignore errors and handle as default
+//            }
+//        }
+//    }
 
 
     /**
@@ -509,7 +511,6 @@ public class ProviderRegistryImpl implem
         /**
          * Register an individual provivider item by its provider identifier.
          *
-         * @param id      The provider id.
          * @param provider The loader used to resolve the provider class.
          */
         public synchronized void register(BundleProviderLoader provider) {
@@ -550,6 +551,7 @@ public class ProviderRegistryImpl implem
         private synchronized BundleProviderLoader getLoader(String id) {
             // synchronize on the registry instance
             if (registry != null) {
+                log.fine("registry: " + registry);
                 // return the first match, if any
                 List<BundleProviderLoader> list = registry.get(id);
                 if (list != null && !list.isEmpty()) {
@@ -576,91 +578,4 @@ public class ProviderRegistryImpl implem
     }
 
 
-    /**
-     * Holder class for located services information.
-     */
-    private class BundleProviderLoader {
-        // the class name for this provider
-        private final String providerId;
-        // the mapped class name of the provider.
-        private final String providerClass;
-        // the hosting bundle.
-        private final Bundle bundle;
-
-        /**
-         * Create a loader for this registered provider.
-         *
-         * @param providerId The provider ID
-         * @param providerClass The mapped class name of the provider.
-         * @param bundle    The hosting bundle.
-         */
-        public BundleProviderLoader(String providerId, String providerClass, Bundle bundle) {
-            this.providerId = providerId;
-            this.providerClass = providerClass;
-            this.bundle = bundle;
-        }
-
-        /**
-         * Load a provider class.
-         *
-         * @return The provider class from the target bundle.
-         * @exception Exception
-         */
-        public Class<?> loadClass() throws ClassNotFoundException {
-            try {
-                log(LogService.LOG_DEBUG, "loading class for: " + this);
-                return bundle.loadClass(providerClass);
-            } catch (ClassNotFoundException e) {
-                log(LogService.LOG_DEBUG, "exception caught while loading " + this, e);
-                throw e;
-            }
-        }
-
-        /**
-         * Create an instance of the registred service.
-         *
-         * @return The created instance.  A new instance is created on each call.
-         * @exception Exception
-         */
-        public Object createInstance() throws Exception {
-            // get the class object
-            Class <?> cls = loadClass();
-            try {
-                // just create an instance using the default constructor
-                return cls.newInstance();
-            } catch (Exception e) {
-                log(LogService.LOG_DEBUG, "exception caught while creating " + this, e);
-                throw e;
-            } catch (Error e) {
-                log(LogService.LOG_DEBUG, "error caught while creating " + this, e);
-                throw e;
-            }
-        }
-
-
-        public String id() {
-            return providerId;
-        }
-
-        @Override
-        public String toString() {
-            return "Provider interface=" + providerId + " , provider class=" + providerClass + ", bundle=" + bundle;
-        }
-
-        @Override
-        public int hashCode() {
-            return providerId.hashCode() + providerClass.hashCode() + (int)bundle.getBundleId();
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof BundleProviderLoader) {
-                return providerId.equals(((BundleProviderLoader)obj).providerId) &&
-                       providerClass.equals(((BundleProviderLoader)obj).providerClass) &&
-                       bundle.getBundleId() == ((BundleProviderLoader)obj).bundle.getBundleId();
-            } else {
-                return false;
-            }
-        }
-    }
 }

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ProviderRegistryImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/Register.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/Register.java?rev=934301&view=auto
==============================================================================
--- geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/Register.java (added)
+++ geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/Register.java Thu Apr 15 07:03:02 2010
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+
+package org.apache.yoko.osgi.locator;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Register {
+
+    void registerProvider(BundleProviderLoader provider);
+
+    void unregisterProvider(BundleProviderLoader provider);
+
+    void registerService(BundleProviderLoader provider);
+
+    void unregisterService(BundleProviderLoader provider);
+
+}

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/Register.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/Register.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/Register.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java?rev=934301&view=auto
==============================================================================
--- geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java (added)
+++ geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java Thu Apr 15 07:03:02 2010
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+
+package org.apache.yoko.osgi.locator;
+
+import java.util.logging.Logger;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceBean {
+    private static final Logger log = Logger.getLogger(ServiceBean.class.getName());
+
+    private Register providerRegistry;
+
+    private BundleProviderLoader bundleProviderLoader;
+
+    public ServiceBean(String key,
+                        String className,
+                        Bundle bundle,
+                        Register providerRegistry) {
+        bundleProviderLoader = new BundleProviderLoader(key, className, bundle);
+        log.finer("ServiceBean: " + bundleProviderLoader);
+        this.providerRegistry = providerRegistry;
+    }
+
+
+
+    public void start() {
+        providerRegistry.registerService(bundleProviderLoader);
+    }
+
+    public void stop() {
+        providerRegistry.unregisterService(bundleProviderLoader);
+    }
+}
\ No newline at end of file

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/osgi/locator/ServiceBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/api/PortableRemoteObjectExt.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/api/PortableRemoteObjectExt.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/api/PortableRemoteObjectExt.java (original)
+++ geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/api/PortableRemoteObjectExt.java Thu Apr 15 07:03:02 2010
@@ -19,6 +19,8 @@
 package org.apache.yoko.rmi.api;
 
 import java.security.AccessController;
+
+import org.apache.yoko.osgi.ProviderLocator;
 import org.apache.yoko.rmi.util.GetSystemPropertyAction;
 
 public class PortableRemoteObjectExt {
@@ -29,40 +31,32 @@ public class PortableRemoteObjectExt {
         if (delegate != null)
             return;
 
-        String name = (String)AccessController.doPrivileged(new GetSystemPropertyAction(
-                "org.apache.yoko.rmi.PortableRemoteObjectExtClass",
-                "org.apache.yoko.rmi.impl.PortableRemoteObjectExtImpl"));
-
-        Class clz = null;
         try {
-            clz = Thread.currentThread().getContextClassLoader()
-                    .loadClass(name);
-        } catch (ClassNotFoundException ex) {
-
+            delegate = (PortableRemoteObjectExtDelegate) ProviderLocator.getService("org.apache.yoko.rmi.PortableRemoteObjectExtClass", PortableRemoteObjectExt.class, Thread.currentThread().getContextClassLoader());
+        } catch (Exception ex) {
+            throw new RuntimeException("internal problem: " + ex.getMessage(), ex);
         }
 
-        if (clz == null) {
+        if (delegate == null) {
+            String name = (String)AccessController.doPrivileged(new GetSystemPropertyAction(
+                    "org.apache.yoko.rmi.PortableRemoteObjectExtClass",
+                    "org.apache.yoko.rmi.impl.PortableRemoteObjectExtImpl"));
+
             try {
-                clz = Class.forName(name);
+                delegate = (PortableRemoteObjectExtDelegate)ProviderLocator.loadClass(name, PortableRemoteObjectExt.class, Thread.currentThread().getContextClassLoader()).newInstance();
+            } catch (InstantiationException ex) {
+                throw new RuntimeException(ex.getMessage(), ex);
+            } catch (IllegalAccessException ex) {
+                throw new RuntimeException(ex.getMessage(), ex);
             } catch (ClassNotFoundException ex) {
                 throw new RuntimeException(ex.getMessage(), ex);
             }
         }
-
-        try {
-            delegate = (PortableRemoteObjectExtDelegate) clz.newInstance();
-
-        } catch (InstantiationException ex) {
-            throw new RuntimeException("internal problem: " + ex.getMessage(), ex);
-
-        } catch (IllegalAccessException ex) {
-            throw new RuntimeException("internal problem: " + ex.getMessage(), ex);
-        }
     }
 
     /** Return the currently active state for this thread */
     public static PortableRemoteObjectState getState() {
-	init();
-	return delegate.getCurrentState();
-     }
+        init();
+        return delegate.getCurrentState();
+    }
 }

Modified: geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/UtilImpl.java
URL: http://svn.apache.org/viewvc/geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/UtilImpl.java?rev=934301&r1=934300&r2=934301&view=diff
==============================================================================
--- geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/UtilImpl.java (original)
+++ geronimo/yoko/trunk/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/UtilImpl.java Thu Apr 15 07:03:02 2010
@@ -42,6 +42,7 @@ import javax.rmi.CORBA.UtilDelegate;
 import javax.rmi.CORBA.ValueHandler;
 import javax.rmi.PortableRemoteObject;
 
+import org.apache.yoko.osgi.ProviderLocator;
 import org.apache.yoko.rmi.util.GetSystemPropertyAction;
 import org.omg.CORBA.Any;
 import org.omg.CORBA.MARSHAL;
@@ -202,7 +203,7 @@ public class UtilImpl implements UtilDel
      * Generic function for reflective instantiation
      */
     private Object newInstance(final Class cls, final Class[] arg_types,
-            final Object[] args) {
+                               final Object[] args) {
         return java.security.AccessController
                 .doPrivileged(new java.security.PrivilegedAction() {
                     public Object run() {
@@ -285,8 +286,8 @@ public class UtilImpl implements UtilDel
                 corba_obj = (org.omg.CORBA.Object) PortableRemoteObject
                         .toStub(ro);
             } catch (java.rmi.NoSuchObjectException ex) {
-                throw (org.omg.CORBA.MARSHAL)new org.omg.CORBA.MARSHAL(
-                    "object not exported " + ro).initCause(ex);
+                throw (org.omg.CORBA.MARSHAL) new org.omg.CORBA.MARSHAL(
+                        "object not exported " + ro).initCause(ex);
             }
 
             any.insert_Object((org.omg.CORBA.Object) corba_obj);
@@ -352,7 +353,7 @@ public class UtilImpl implements UtilDel
      * instances of java.rmi.Remote for objects that have already been exported.
      */
     public void writeRemoteObject(org.omg.CORBA.portable.OutputStream out,
-            Object obj) throws org.omg.CORBA.SystemException {
+                                  Object obj) throws org.omg.CORBA.SystemException {
         org.omg.CORBA.Object objref = null;
 
         if (obj == null) {
@@ -377,7 +378,7 @@ public class UtilImpl implements UtilDel
                     objref = (javax.rmi.CORBA.Stub) PortableRemoteObject
                             .toStub((java.rmi.Remote) obj);
                 } catch (java.rmi.RemoteException ex) {
-                    throw (MARSHAL)new MARSHAL("cannot convert Remote to Object").initCause(ex);
+                    throw (MARSHAL) new MARSHAL("cannot convert Remote to Object").initCause(ex);
                 }
             }
 
@@ -391,7 +392,7 @@ public class UtilImpl implements UtilDel
     }
 
     public void writeAbstractObject(org.omg.CORBA.portable.OutputStream out,
-            Object obj) {
+                                    Object obj) {
         logger.finer("writeAbstractObject.1 " + " out=" + out);
 
         if (obj instanceof org.omg.CORBA.Object || obj instanceof Serializable) {
@@ -414,10 +415,10 @@ public class UtilImpl implements UtilDel
                     objref = (org.omg.CORBA.Object) PortableRemoteObject
                             .toStub((Remote) obj);
                 } catch (RemoteException ex) {
-                    throw (MARSHAL)new MARSHAL("unable to export object").initCause(ex);
+                    throw (MARSHAL) new MARSHAL("unable to export object").initCause(ex);
                 }
             }
-            obj = objref; 
+            obj = objref;
         }
 
         org.omg.CORBA_2_3.portable.OutputStream out_ = (org.omg.CORBA_2_3.portable.OutputStream) out;
@@ -528,36 +529,30 @@ public class UtilImpl implements UtilDel
         try {
             return loadClass0(name, codebase, loader);
         } catch (ClassNotFoundException ex) {
-            logger.log(Level.FINER, "cannot load from " + codebase + " " + 
-                ex.getMessage(), ex);
+            logger.log(Level.FINER, "cannot load from " + codebase + " " +
+                    ex.getMessage(), ex);
             throw ex;
         }
     }
 
     static public Class loadClass0(String name, String codebase, ClassLoader loader)
             throws ClassNotFoundException {
-        Class result = null;
-
-        if (loader != null) {
-            try {
-                result = loader.loadClass(name);
-            } catch (ClassNotFoundException ex) {
-                // skip //
-            }
 
-            if (result != null)
-                return result;
+        try {
+            return ProviderLocator.loadClass(name, null, loader);
+        } catch (ClassNotFoundException e) {
+            //skip
         }
+        Class result = null;
 
         ClassLoader stackLoader = null;
-        ClassLoader thisLoader = Util.class.getClassLoader(); 
+        ClassLoader thisLoader = Util.class.getClassLoader();
         Class[] stack = _secman.getClassContext();
         for (int i = 1; i < stack.length; i++) {
             ClassLoader testLoader = stack[i].getClassLoader();
-            if (testLoader != null && testLoader != thisLoader)
-            {
-                stackLoader = thisLoader; 
-                break; 
+            if (testLoader != null && testLoader != thisLoader) {
+                stackLoader = thisLoader;
+                break;
             }
         }
 
@@ -890,40 +885,41 @@ public class UtilImpl implements UtilDel
     static final Class[] RMI_TO_CORBA_EXCEPTION;
 
 //  We want to avoid a dependency on JTA, so we add these classes only if JTA is available.
+
     static {
-	Class[] rmiToCorba;
-	try {
-	    rmiToCorba = new Class[] {
-		    Util.loadClass("javax.transaction.HeuresticMixedException", null, null),
-		    org.omg.CosTransactions.HeuristicMixed.class,
-
-		    Util.loadClass("javax.transaction.HeuristicRollbackException", null, null),
-		    org.omg.CosTransactions.HeuristicRollback.class,
-
-	            Util.loadClass("javax.transaction.HeuristicCommitException", null, null),
-	            org.omg.CosTransactions.HeuristicCommit.class,
-
-	            Util.loadClass("javax.transaction.NotSupportedException", null, null),
-	            org.omg.CosTransactions.SubtransactionsUnavailable.class,
-
-	            Util.loadClass("javax.transaction.InvalidTransactionException", null, null),
-	            org.omg.CORBA.INVALID_TRANSACTION.class,
-
-	            Util.loadClass("javax.transaction.TransactionRequiredException", null, null),
-	            org.omg.CORBA.TRANSACTION_REQUIRED.class,
-
-	            Util.loadClass("javax.transaction.TransactionRolledbackException", null, null),
-	            org.omg.CORBA.TRANSACTION_ROLLEDBACK.class,
-
-	            Util.loadClass("javax.transaction.RollbackException", null, null),
-	            org.omg.CORBA.TRANSACTION_ROLLEDBACK.class
-	    };
-
-	}
-	catch(ClassNotFoundException e) {
-	    rmiToCorba = new Class[0];
-	}
-	RMI_TO_CORBA_EXCEPTION = rmiToCorba;
+        Class[] rmiToCorba;
+        try {
+            rmiToCorba = new Class[]{
+                    Util.loadClass("javax.transaction.HeuristicMixedException", null, null),
+                    org.omg.CosTransactions.HeuristicMixed.class,
+
+                    Util.loadClass("javax.transaction.HeuristicRollbackException", null, null),
+                    org.omg.CosTransactions.HeuristicRollback.class,
+
+                    Util.loadClass("javax.transaction.HeuristicCommitException", null, null),
+                    org.omg.CosTransactions.HeuristicCommit.class,
+
+                    Util.loadClass("javax.transaction.NotSupportedException", null, null),
+                    org.omg.CosTransactions.SubtransactionsUnavailable.class,
+
+                    Util.loadClass("javax.transaction.InvalidTransactionException", null, null),
+                    org.omg.CORBA.INVALID_TRANSACTION.class,
+
+                    Util.loadClass("javax.transaction.TransactionRequiredException", null, null),
+                    org.omg.CORBA.TRANSACTION_REQUIRED.class,
+
+                    Util.loadClass("javax.transaction.TransactionRolledbackException", null, null),
+                    org.omg.CORBA.TRANSACTION_ROLLEDBACK.class,
+
+                    Util.loadClass("javax.transaction.RollbackException", null, null),
+                    org.omg.CORBA.TRANSACTION_ROLLEDBACK.class
+            };
+
+        }
+        catch (ClassNotFoundException e) {
+            rmiToCorba = new Class[0];
+        }
+        RMI_TO_CORBA_EXCEPTION = rmiToCorba;
     }
 
     static final Class[] CORBA_TO_RMI_EXCEPTION = {