The deployer should never need the TCCL to be adjusted. What is the issue with Axis during the deployment phase that requires this to be set?

--
Jeremy

On Aug 8, 2006, at 5:47 PM, [EMAIL PROTECTED] wrote:

Author: rineholt
Date: Tue Aug  8 17:47:33 2006
New Revision: 429905

URL: http://svn.apache.org/viewvc?rev=429905&view=rev
Log:
Switched the Launcher context thread so it the same as the current loader. This is so axis has stax provider... maybe a better way in the future For axis reference use the java inteface specified in the reference scdl for the interface for autowire .. this is a bad hack.. I think need a way to opt out of autowire where it may not make sense.


Modified:
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ org/apache/tuscany/binding/axis2/Axis2Reference.java incubator/tuscany/java/sca/core/src/main/java/org/apache/ tuscany/core/launcher/Launcher.java

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/ main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/ bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/ axis2/Axis2BindingBuilder.java? rev=429905&r1=429904&r2=429905&view=diff ====================================================================== ======== --- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java (original) +++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java Tue Aug 8 17:47:33 2006
@@ -19,6 +19,7 @@
 import org.apache.tuscany.spi.extension.BindingBuilderExtension;
 import org.apache.tuscany.spi.model.BoundReferenceDefinition;
 import org.apache.tuscany.spi.model.BoundServiceDefinition;
+import org.apache.tuscany.spi.model.ServiceContract;

 /**
* Builds a [EMAIL PROTECTED] org.osoa.sca.annotations.Service} or [EMAIL PROTECTED] org.apache.tuscany.spi.component.Reference} configured
@@ -47,11 +48,13 @@
BoundReferenceDefinition<WebServiceBinding> boundReferenceDefinition,
                            DeploymentContext deploymentContext) {
WebServiceBinding wsBinding = boundReferenceDefinition.getBinding();
+
         return new Axis2Reference(
             boundReferenceDefinition.getName(),
             parent,
             wireService,
-            wsBinding);
+            wsBinding,
+            boundReferenceDefinition.getServiceContract());
     }

     protected Class<WebServiceBinding> getBindingType() {

Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/ main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/ bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/ axis2/Axis2Reference.java?rev=429905&r1=429904&r2=429905&view=diff ====================================================================== ======== --- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ org/apache/tuscany/binding/axis2/Axis2Reference.java (original) +++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/ org/apache/tuscany/binding/axis2/Axis2Reference.java Tue Aug 8 17:47:33 2006
@@ -23,6 +23,7 @@

 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.extension.ReferenceExtension;
+import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 import org.apache.tuscany.spi.wire.WireService;

@@ -50,13 +51,23 @@

     private WebServicePortMetaData wsPortMetaData;
     private ServiceClient serviceClient;
+
+    public Axis2Reference(String theName,
+            CompositeComponent<?> parent,
+            WireService wireService,
+            WebServiceBinding wsBinding) {
+        this(theName,parent, wireService, wsBinding, null);
+    }

     public Axis2Reference(String theName,
                           CompositeComponent<?> parent,
                           WireService wireService,
-                          WebServiceBinding wsBinding) {
+ WebServiceBinding wsBinding, ServiceContract contract) {
         super(theName, parent, wireService);
         try {
+            if(null != contract){
+                setInterface((Class<T>)contract.getInterfaceClass());
+            }
Definition wsdlDefinition = wsBinding.getWSDLDefinition ();
             wsPortMetaData =
new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getURI(), false);

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/ tuscany/core/launcher/Launcher.java URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/ src/main/java/org/apache/tuscany/core/launcher/Launcher.java? rev=429905&r1=429904&r2=429905&view=diff ====================================================================== ======== --- incubator/tuscany/java/sca/core/src/main/java/org/apache/ tuscany/core/launcher/Launcher.java (original) +++ incubator/tuscany/java/sca/core/src/main/java/org/apache/ tuscany/core/launcher/Launcher.java Tue Aug 8 17:47:33 2006
@@ -37,32 +37,35 @@

 /**
  * Basic launcher implementation.
- *
+ *
* @version $Rev: 417136 $ $Date: 2006-06-26 03:54:48 -0400 (Mon, 26 Jun 2006) $
  */
 public class Launcher {
     /**
      * A conventional META-INF based location for the system SCDL.
-     *
+     *
      * @see #bootRuntime(URL, MonitorFactory)
      */
public static final String METAINF_SYSTEM_SCDL_PATH = "META- INF/tuscany/system.scdl";

     /**
* A conventional META-INF based location for the application SCDL.
-     *
+     *
      * @see #bootApplication(URL)
      */
public static final String METAINF_APPLICATION_SCDL_PATH = "META-INF/sca/default.scdl";

     private ClassLoader applicationLoader;
+
     private RuntimeComponent runtime;
+
     private Deployer deployer;
+
     private CompositeComponent<?> composite;

     /**
      * Returns the classloader for application classes.
-     *
+     *
      * @return the classloader for application classes
      */
     public ClassLoader getApplicationLoader() {
@@ -70,10 +73,11 @@
     }

     /**
- * Set the classloader to be used for application classes. You should almost always supply your own - * application classloader, based on the hosting environment that the runtime is embedded in.
-     *
- * @param applicationLoader the classloader to be used for application classes + * Set the classloader to be used for application classes. You should almost always supply your own application classloader, based on the hosting
+     * environment that the runtime is embedded in.
+     *
+     * @param applicationLoader
+     *            the classloader to be used for application classes
      */
     public void setApplicationLoader(ClassLoader applicationLoader) {
         this.applicationLoader = applicationLoader;
@@ -81,8 +85,9 @@

     /**
      * Boots the runtime defined by the specified SCDL.
-     *
- * @param systemScdl a resource path to the SCDL defining the system.
+     *
+     * @param systemScdl
+     *            a resource path to the SCDL defining the system.
* @return a CompositeComponent for the newly booted runtime system
      * @throws LoaderException
      */
@@ -109,9 +114,8 @@
SystemCompositeImplementation moduleImplementation = new SystemCompositeImplementation();
         moduleImplementation.setScdlLocation(systemScdl);
         moduleImplementation.setClassLoader(systemClassLoader);
- ComponentDefinition<SystemCompositeImplementation> moduleDefinition = - new ComponentDefinition<SystemCompositeImplementation> (ComponentNames.TUSCANY_SYSTEM, - moduleImplementation); + ComponentDefinition<SystemCompositeImplementation> moduleDefinition = new ComponentDefinition<SystemCompositeImplementation>(
+                ComponentNames.TUSCANY_SYSTEM, moduleImplementation);

// deploy the component into the runtime under the system parent composite = (CompositeComponent<?>) bootDeployer.deploy (parent, moduleDefinition);
@@ -140,9 +144,10 @@

     /**
      * Boots the application defined by the specified SCDL.
-     *
-     * @see   METAINF_APPLICATION_SCDL_PATH
-     * @param appScdl URL to the SCDL defining the application
+     *
+     * @see METAINF_APPLICATION_SCDL_PATH
+     * @param appScdl
+     *            URL to the SCDL defining the application
      * @return a CompositeComponent for the newly booted application
      * @throws LoaderException
      */
@@ -156,12 +161,21 @@
         CompositeImplementation impl = new CompositeImplementation();
         impl.setScdlLocation(appScdl);
         impl.setClassLoader(applicationLoader);
- ComponentDefinition<CompositeImplementation> moduleDefinition = - new ComponentDefinition<CompositeImplementation> (ComponentNames.TUSCANY_SYSTEM, impl); + ComponentDefinition<CompositeImplementation> moduleDefinition = new ComponentDefinition<CompositeImplementation>(
+                ComponentNames.TUSCANY_SYSTEM, impl);

// deploy the component into the runtime under the system parent
         CompositeComponent parent = runtime.getRootComponent();
- return (CompositeComponent<?>) deployer.deploy(parent, moduleDefinition); + ClassLoader ccl = Thread.currentThread ().getContextClassLoader();
+
+        try {
+
+ Thread.currentThread().setContextClassLoader(getClass ().getClassLoader());
+
+ return (CompositeComponent<?>) deployer.deploy(parent, moduleDefinition);
+        } finally {
+            Thread.currentThread().setContextClassLoader(ccl);
+        }
     }

     public File getInstallDirectory() {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to