You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2007/10/29 12:26:58 UTC

svn commit: r589585 - in /incubator/tuscany/java/sca/modules: core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/ implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/ implem...

Author: svkrish
Date: Mon Oct 29 04:26:57 2007
New Revision: 589585

URL: http://svn.apache.org/viewvc?rev=589585&view=rev
Log:
modified java-impl-runtime to contribute an interceptor to handle policies

Added:
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.PolicySetHandlers
      - copied unchanged from r589350, incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicySetHandlers
Removed:
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PoliciedJavaImplementationInvoker.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicySetHandlers
Modified:
    incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
    incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java
    incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java
    incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicySetHandlerUtil.java

Modified: incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java?rev=589585&r1=589584&r2=589585&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java Mon Oct 29 04:26:57 2007
@@ -23,6 +23,7 @@
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
@@ -31,6 +32,8 @@
 import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
 import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
 import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
 
 /**
@@ -57,6 +60,7 @@
     private long maxAge = -1;
     private long maxIdleTime = -1;
     private JavaScopeImpl scope = JavaScopeImpl.STATELESS;
+    private Map<PolicySet, PolicyHandler> policyHandlers = new Hashtable<PolicySet, PolicyHandler>();
 
     protected BeanJavaImplementationImpl(BeanDefinitionRegistry beanRegistry) {
         super(beanRegistry);
@@ -160,5 +164,9 @@
 
     public void setMaxIdleTime(long maxIdleTime) {
         this.maxIdleTime = maxIdleTime;
+    }
+    
+    public Map<PolicySet, PolicyHandler> getPolicyHandlers() {
+        return policyHandlers;
     }
 }

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java?rev=589585&r1=589584&r2=589585&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java Mon Oct 29 04:26:57 2007
@@ -277,12 +277,12 @@
 
         Method method = JavaInterfaceUtil.findMethod(implClass, operation);
         
-        if ( component.getImplementation() instanceof PolicySetAttachPoint  &&
+        /*if ( component.getImplementation() instanceof PolicySetAttachPoint  &&
               !((PolicySetAttachPoint)component.getImplementation()).getPolicySets().isEmpty() ) {
             return new PoliciedJavaImplementationInvoker(operation, method, component, policyHandlers);
-        } else {
+        } else {*/
             return new JavaImplementationInvoker(operation, method, component);
-        }
+        //}
     }
 
     private static class OptimizedObjectFactory<T> implements ObjectFactory<T> {

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java?rev=589585&r1=589584&r2=589585&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java Mon Oct 29 04:26:57 2007
@@ -19,7 +19,6 @@
 
 package org.apache.tuscany.sca.implementation.java.invocation;
 
-import java.util.Hashtable;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
@@ -57,7 +56,7 @@
     private JavaImplementation implementation;
     private JavaComponentContextProvider componentContextProvider;
     private RequestContextFactory requestContextFactory;
-    private Map<PolicySet, PolicyHandler> policyHandlers = new Hashtable<PolicySet, PolicyHandler>();
+    private Map<QName, String> policyHandlerClassNames = null;
     
     public JavaImplementationProvider(RuntimeComponent component,
                                       JavaImplementation implementation,
@@ -74,7 +73,7 @@
             configuration.setProxyFactory(proxyService);
             componentContextProvider =
                 new JavaComponentContextProvider(component, configuration, dataBindingRegistry, propertyValueObjectFactory,
-                                      componentContextFactory, requestContextFactory, policyHandlers);
+                                      componentContextFactory, requestContextFactory, implementation.getPolicyHandlers());
 
             Scope scope = getScope();
 
@@ -103,24 +102,31 @@
 
             componentContextProvider.configureProperties(component.getProperties());
             handleResources(implementation, proxyService);
-            loadPolicyHandlers();
+            loadPolicyHandlers(implementation);
         } catch (Exception e) {
             throw new IllegalStateException(e);
         }
         
     }
     
-    private void loadPolicyHandlers() throws Exception {
-        Map<QName, PolicyHandler> availablePolicyHandlers = 
-            PolicySetHandlerUtil.getPolicyHandlers(Thread.currentThread().getContextClassLoader(), 
-                                                    "org.apache.tuscany.sca.policy.PolicySetHandlers");
+    private void loadPolicyHandlers(JavaImplementation javaImpl) throws Exception {
+        if ( policyHandlerClassNames == null ) {
+            policyHandlerClassNames = 
+                PolicySetHandlerUtil.getPolicyHandlers(Thread.currentThread().getContextClassLoader(), 
+                                                        "org.apache.tuscany.sca.implementation.java.PolicySetHandlers");
+        }
+        
         if ( implementation instanceof PolicySetAttachPoint ) {
             PolicyHandler aHandler = null;
             PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
             for ( PolicySet policySet : policiedImpl.getPolicySets() ) {
-                if ( ( aHandler = availablePolicyHandlers.get(policySet.getName()) ) != null ) {
+                String handlerClassName = policyHandlerClassNames.get(policySet.getName());
+                
+                if ( handlerClassName != null ) {
+                    aHandler = 
+                        (PolicyHandler)Class.forName(handlerClassName, true, Thread.currentThread().getContextClassLoader()).newInstance();
                     aHandler.setApplicablePolicySet(policySet);
-                    policyHandlers.put(policySet, aHandler);
+                    javaImpl.getPolicyHandlers().put(policySet, aHandler);
                 } else {
                     //FIXME : maybe there must be a warning thrown here
                 }

Added: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java?rev=589585&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java Mon Oct 29 04:26:57 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.tuscany.sca.implementation.java.invocation;
+
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+
+/**
+ * Processor to inject policy handling interceptor wheneve PolicySets are specified in a Java Implementation 
+ */
+public class JavaPolicyHandlingRuntimeWireProcessor implements RuntimeWireProcessor {
+    public JavaPolicyHandlingRuntimeWireProcessor() {
+        super();
+    }
+
+    public void process(RuntimeWire wire) {
+        Contract contract = wire.getSource().getContract();
+        if (!(contract instanceof RuntimeComponentReference)) {
+            return;
+        }
+        
+        RuntimeComponent component = wire.getTarget().getComponent();
+        if ( component != null && component.getImplementation() instanceof JavaImplementation ) {
+            JavaImplementation javaImpl = (JavaImplementation)component.getImplementation();
+            
+            //if the implementation has policysets specified and if there are 
+            //handlers for those policysets
+            if ( !javaImpl.getPolicyHandlers().isEmpty() ) {
+                //TODO: Right now we assume policy handlers are to be applied for all operations
+                //... need to modify this if certain policies apply only to select operations 
+                for (InvocationChain chain : wire.getInvocationChains() ) { 
+                    chain.addInterceptor(0, new PolicyHandlingInterceptor(chain.getTargetOperation(),
+                                                                       javaImpl.getPolicyHandlers()));
+                }   
+            }
+        }
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java?rev=589585&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java Mon Oct 29 04:26:57 2007
@@ -0,0 +1,71 @@
+/*
+ * 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.tuscany.sca.implementation.java.invocation;
+
+import java.util.Map;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
+
+/**
+ * An interceptor to invoke policy handlers before and after the invocation of operations on 
+ * an implementation.
+ */
+public class PolicyHandlingInterceptor implements Interceptor {
+    private Invoker next;
+    private Map<PolicySet, PolicyHandler> policyHandlers = null;
+    private Operation targetOperation = null;
+
+    public PolicyHandlingInterceptor(Operation targetOperation,
+                                     Map<PolicySet, PolicyHandler> policyHandlers) {
+        this.policyHandlers = policyHandlers;
+        this.targetOperation = targetOperation;
+    }
+
+    public Message invoke(Message msg) {
+        applyPreInvocationPolicies(targetOperation, msg);
+        msg = next.invoke(msg);
+        applyPostInvocationPolices(targetOperation, msg);
+        return msg;
+    }
+
+    public void setNext(Invoker next) {
+        this.next = next;
+    }
+
+    public Invoker getNext() {
+        return next;
+    }
+    
+    private void applyPreInvocationPolicies(Object... context) {
+        for ( PolicyHandler policyHandler : policyHandlers.values() ) {
+            policyHandler.beforeInvoke(context);
+        }
+    }
+    
+    private void applyPostInvocationPolices(Object...  context) {
+        for ( PolicyHandler policyHandler : policyHandlers.values() ) {
+            policyHandler.afterInvoke(context);
+        }
+    }
+}

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java?rev=589585&r1=589584&r2=589585&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java Mon Oct 29 04:26:57 2007
@@ -53,6 +53,8 @@
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
 import org.apache.tuscany.sca.implementation.java.invocation.JavaCallbackRuntimeWireProcessor;
 import org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProviderFactory;
+import org.apache.tuscany.sca.implementation.java.invocation.JavaPolicyHandlingRuntimeWireProcessor;
+import org.apache.tuscany.sca.implementation.java.invocation.PolicyHandlingInterceptor;
 import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
 import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -123,6 +125,7 @@
         RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint = registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
         if (wireProcessorExtensionPoint != null) {
             wireProcessorExtensionPoint.addWireProcessor(new JavaCallbackRuntimeWireProcessor(interfaceContractMapper, javaFactory));
+            wireProcessorExtensionPoint.addWireProcessor(new JavaPolicyHandlingRuntimeWireProcessor());
         }        
     }
 

Modified: incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java?rev=589585&r1=589584&r2=589585&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java Mon Oct 29 04:26:57 2007
@@ -29,6 +29,8 @@
 import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
 import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
 import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
 
 /**
  * Represents a Java implementation.
@@ -182,5 +184,10 @@
      * @param maxIdleTime the maxIdleTime to set
      */
     public void setMaxIdleTime(long maxIdleTime);
+    
+    /**
+     * @return the map of policy handlers that need to be applied to the implementation instance
+     */
+    public Map<PolicySet, PolicyHandler> getPolicyHandlers();
 
 }

Modified: incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java?rev=589585&r1=589584&r2=589585&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java Mon Oct 29 04:26:57 2007
@@ -23,10 +23,13 @@
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.util.PolicyHandler;
 
 /**
  * A component type specialization for POJO implementations
@@ -49,6 +52,7 @@
     private long maxAge = -1;
     private long maxIdleTime = -1;
     private JavaScopeImpl scope = JavaScopeImpl.STATELESS;
+    private Map<PolicySet, PolicyHandler> policyHandlers = new Hashtable<PolicySet, PolicyHandler>();
 
     protected JavaImplementationImpl() {
         super();
@@ -152,5 +156,9 @@
 
     public void setMaxIdleTime(long maxIdleTime) {
         this.maxIdleTime = maxIdleTime;
+    }
+
+    public Map<PolicySet, PolicyHandler> getPolicyHandlers() {
+        return policyHandlers;
     }
 }

Modified: incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicySetHandlerUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicySetHandlerUtil.java?rev=589585&r1=589584&r2=589585&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicySetHandlerUtil.java (original)
+++ incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicySetHandlerUtil.java Mon Oct 29 04:26:57 2007
@@ -36,24 +36,21 @@
     private final static Logger logger = Logger.getLogger(PolicySetHandlerUtil.class.getName());
 
     /**
-     * Read the service name from a configuration file
+     * Read the PolicyHandler class names from a configuration file
      * 
      * @param classLoader
-     * @param name The name of the service class
-     * @return A class name which extends/implements the service class
+     * @param name The name of the configuration file 
+     * @return A map of policyset handlers keyed against the QName of the policyset
      * @throws IOException
      */
-    public static Map<QName, PolicyHandler> getPolicyHandlers(ClassLoader classLoader, 
-                                                             String name) throws IllegalAccessException, 
-                                                                                 InstantiationException,
-                                                                                 ClassNotFoundException,
-                                                                                 IOException {
+    public static Map<QName, String> getPolicyHandlers(ClassLoader classLoader, 
+                                                             String name) throws IOException {
         boolean debug = logger.isLoggable(Level.FINE);
         if (debug) {
             logger.fine("Discovering service providers using class loader " + classLoader);
         }
         
-        Map<QName, PolicyHandler> policyHandlersMap = new Hashtable<QName, PolicyHandler>();
+        Map<QName, String> policyHandlersMap = new Hashtable<QName, String>();
         for (URL url : Collections.list(classLoader.getResources("META-INF/services/" + name))) {
             if (debug) {
                 logger.fine("Reading service provider file: " + url.toExternalForm());
@@ -68,20 +65,20 @@
                 Enumeration keys = policyHanlderInfo.keys();
                 String policySetName;
                 String policyHandlerClassName;
-                PolicyHandler policyHandler;
+                //PolicyHandler policyHandler;
                 
                 while ( keys.hasMoreElements() ) {
                     policySetName = (String)keys.nextElement();
                     policyHandlerClassName = policyHanlderInfo.getProperty(policySetName);
                     
-                    policyHandler = 
-                        (PolicyHandler)Class.forName(policyHandlerClassName, true, classLoader).newInstance();
+                    //policyHandler = 
+                    //    (PolicyHandler)Class.forName(policyHandlerClassName, true, classLoader).newInstance();
                     
                     if (debug) {
-                        logger.fine("Registering policyset handler : " + policySetName + " = " + policyHandlerClassName);;
+                        logger.fine("Registering policyset handler classname : " + policySetName + " = " + policyHandlerClassName);;
                     }
                 
-                    policyHandlersMap.put(getQName(policySetName), policyHandler);
+                    policyHandlersMap.put(getQName(policySetName), policyHandlerClassName);
                 }
             } finally {
                 if (is != null) {



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org