You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2006/08/12 00:56:56 UTC

svn commit: r430912 [11/17] - in /incubator/tuscany/java: samples/sca/ samples/sca/bigbank/src/main/resources/META-INF/ samples/sca/bigbank/src/main/resources/META-INF/sca/ samples/sca/calculator/src/main/resources/META-INF/ samples/sca/calculator/src/...

Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java Fri Aug 11 15:56:46 2006
@@ -1,28 +1,28 @@
-/*
- * 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.servicemix.sca.config;
-
-import org.apache.tuscany.core.builder.ObjectFactory;
-import org.apache.tuscany.core.builder.impl.BaseExternalServiceContextFactory;
-
-public class ExternalJbiServiceContextFactory extends BaseExternalServiceContextFactory {
-
-    public ExternalJbiServiceContextFactory(String name, ObjectFactory objectFactory) {
-        super(name, objectFactory);
-    }
-
-}
+/*
+ * 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.servicemix.sca.config;
+
+import org.apache.tuscany.core.builder.ObjectFactory;
+import org.apache.tuscany.core.builder.impl.BaseExternalServiceContextFactory;
+
+public class ExternalJbiServiceContextFactory extends BaseExternalServiceContextFactory {
+
+    public ExternalJbiServiceContextFactory(String name, ObjectFactory objectFactory) {
+        super(name, objectFactory);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/ExternalJbiServiceContextFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java Fri Aug 11 15:56:46 2006
@@ -1,28 +1,28 @@
-/*
- * 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.servicemix.sca.config;
-
-import org.apache.tuscany.core.builder.impl.EntryPointContextFactory;
-import org.apache.tuscany.core.message.MessageFactory;
-
-public class JbiServiceEntryPointContextFactory extends EntryPointContextFactory {
-
-    public JbiServiceEntryPointContextFactory(String name, String referenceName, MessageFactory msgFactory) {
-        super(name, referenceName, msgFactory);
-    }
-
-}
+/*
+ * 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.servicemix.sca.config;
+
+import org.apache.tuscany.core.builder.impl.EntryPointContextFactory;
+import org.apache.tuscany.core.message.MessageFactory;
+
+public class JbiServiceEntryPointContextFactory extends EntryPointContextFactory {
+
+    public JbiServiceEntryPointContextFactory(String name, String referenceName, MessageFactory msgFactory) {
+        super(name, referenceName, msgFactory);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/config/JbiServiceEntryPointContextFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java Fri Aug 11 15:56:46 2006
@@ -1,92 +1,92 @@
-/*
- * 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.servicemix.sca.handler;
-
-import java.io.ByteArrayOutputStream;
-import java.lang.reflect.Method;
-
-import javax.jbi.messaging.DeliveryChannel;
-import javax.jbi.messaging.ExchangeStatus;
-import javax.jbi.messaging.InOut;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.xml.bind.JAXBContext;
-
-import org.apache.servicemix.jbi.jaxp.StringSource;
-import org.apache.servicemix.sca.ScaServiceUnit;
-import org.apache.servicemix.sca.assembly.JbiBinding;
-import org.apache.tuscany.model.assembly.ExternalService;
-
-public class ExternalJbiServiceClient {
-
-    private ExternalService externalService;
-    
-    private JbiBinding jbiBinding;
-
-    private ScaServiceUnit serviceUnit;
-
-    /**
-     * Constructs a new ExternalWebServiceClient.
-     * 
-     * @param externalService
-     * @param wsBinding
-     */
-    public ExternalJbiServiceClient(ExternalService externalService) {
-        this.serviceUnit = ScaServiceUnit.getCurrentScaServiceUnit();
-        this.externalService = externalService;
-        this.jbiBinding = (JbiBinding) this.externalService.getBindings().get(0);
-    }
-
-    /**
-     * Invoke an operation on the external Web service.
-     * 
-     * @param method
-     * @param args
-     * @return
-     */
-    public Object invoke(Method method, Object[] args) {
-        if (args == null || args.length != 1) {
-            throw new IllegalStateException("args should have exactly one object");
-        }
-        try {
-            Object payload = args[0];
-            Class inputClass = method.getParameterTypes()[0];
-            Class outputClass = method.getReturnType();
-            JAXBContext context = JAXBContext.newInstance(inputClass, outputClass);
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            context.createMarshaller().marshal(payload, baos);
-            
-            DeliveryChannel channel = serviceUnit.getComponent().getComponentContext().getDeliveryChannel();
-            // TODO: in-only case ?
-            // TODO: interface based routing ?
-            // TODO: explicit endpoint selection ?
-            InOut inout = channel.createExchangeFactory().createInOutExchange();
-            inout.setService(jbiBinding.getServiceName());
-            NormalizedMessage in = inout.createMessage();
-            inout.setInMessage(in);
-            in.setContent(new StringSource(baos.toString()));
-            boolean sent = channel.sendSync(inout);
-            // TODO: check for error ?
-            NormalizedMessage out = inout.getOutMessage();
-            Object response = context.createUnmarshaller().unmarshal(out.getContent());
-            inout.setStatus(ExchangeStatus.DONE);
-            channel.send(inout);
-            return response;
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-}
+/*
+ * 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.servicemix.sca.handler;
+
+import java.io.ByteArrayOutputStream;
+import java.lang.reflect.Method;
+
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.InOut;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.bind.JAXBContext;
+
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.sca.ScaServiceUnit;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.tuscany.model.assembly.ExternalService;
+
+public class ExternalJbiServiceClient {
+
+    private ExternalService externalService;
+    
+    private JbiBinding jbiBinding;
+
+    private ScaServiceUnit serviceUnit;
+
+    /**
+     * Constructs a new ExternalWebServiceClient.
+     * 
+     * @param externalService
+     * @param wsBinding
+     */
+    public ExternalJbiServiceClient(ExternalService externalService) {
+        this.serviceUnit = ScaServiceUnit.getCurrentScaServiceUnit();
+        this.externalService = externalService;
+        this.jbiBinding = (JbiBinding) this.externalService.getBindings().get(0);
+    }
+
+    /**
+     * Invoke an operation on the external Web service.
+     * 
+     * @param method
+     * @param args
+     * @return
+     */
+    public Object invoke(Method method, Object[] args) {
+        if (args == null || args.length != 1) {
+            throw new IllegalStateException("args should have exactly one object");
+        }
+        try {
+            Object payload = args[0];
+            Class inputClass = method.getParameterTypes()[0];
+            Class outputClass = method.getReturnType();
+            JAXBContext context = JAXBContext.newInstance(inputClass, outputClass);
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            context.createMarshaller().marshal(payload, baos);
+            
+            DeliveryChannel channel = serviceUnit.getComponent().getComponentContext().getDeliveryChannel();
+            // TODO: in-only case ?
+            // TODO: interface based routing ?
+            // TODO: explicit endpoint selection ?
+            InOut inout = channel.createExchangeFactory().createInOutExchange();
+            inout.setService(jbiBinding.getServiceName());
+            NormalizedMessage in = inout.createMessage();
+            inout.setInMessage(in);
+            in.setContent(new StringSource(baos.toString()));
+            boolean sent = channel.sendSync(inout);
+            // TODO: check for error ?
+            NormalizedMessage out = inout.getOutMessage();
+            Object response = context.createUnmarshaller().unmarshal(out.getContent());
+            inout.setStatus(ExchangeStatus.DONE);
+            channel.send(inout);
+            return response;
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java Fri Aug 11 15:56:46 2006
@@ -1,108 +1,108 @@
-/*
- * 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.servicemix.sca.handler;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.core.context.ExternalServiceContext;
-import org.apache.tuscany.core.context.InstanceContext;
-import org.apache.tuscany.core.context.QualifiedName;
-import org.apache.tuscany.core.context.ScopeContext;
-import org.apache.tuscany.core.context.TargetException;
-import org.apache.tuscany.core.invocation.Interceptor;
-import org.apache.tuscany.core.invocation.TargetInvoker;
-import org.apache.tuscany.core.message.Message;
-
-public class ExternalJbiServiceTargetInvoker implements TargetInvoker {
-
-    private QualifiedName serviceName;
-    private String esName;
-    private Method method;
-    private ScopeContext container;
-
-    private ExternalServiceContext context;
-
-    /**
-     * Constructs a new ExternalJbiServiceTargetInvoker.
-     * @param esName
-     * @param container
-     */
-    public ExternalJbiServiceTargetInvoker(QualifiedName serviceName, Method method, ScopeContext container) {
-        assert (serviceName != null) : "No service name specified";
-        assert (method != null) : "No method specified";
-        assert (container != null) : "No scope container specified";
-        this.serviceName = serviceName;
-        this.esName = serviceName.getPartName();
-        this.method = method;
-        this.container = container;
-    }
-
-    public Object invokeTarget(Object payload) throws InvocationTargetException {
-        if (context == null) {
-            InstanceContext iContext = container.getContext(esName);
-            if (!(iContext instanceof ExternalServiceContext)) {
-                TargetException te = new TargetException("Unexpected target context type");
-                te.setIdentifier(iContext.getClass().getName());
-                te.addContextName(iContext.getName());
-                throw te;
-            }
-            context = (ExternalServiceContext) iContext;
-        }
-        ExternalJbiServiceClient client = (ExternalJbiServiceClient) context.getImplementationInstance(true);
-        if (payload != null) {
-            return client.invoke(method, (Object[])payload);
-        } else {
-            return client.invoke(method, null);
-        }
-    }
-
-    public boolean isCacheable() {
-        return false;
-    }
-
-    public Message invoke(Message msg) {
-        try {
-            Object resp = invokeTarget(msg.getBody());
-            msg.setBody(resp);
-        } catch (InvocationTargetException e) {
-            msg.setBody(e.getCause());
-        } catch (Throwable e) {
-            msg.setBody(e);
-        }
-        return msg;
-    }
-
-    public void setNext(Interceptor next) {
-        throw new UnsupportedOperationException();
-    }
-
-    public Object clone() {
-        try {
-            ExternalJbiServiceTargetInvoker invoker = (ExternalJbiServiceTargetInvoker) super.clone();
-            invoker.container = container;
-            invoker.context = this.context;
-            invoker.esName = this.esName;
-            invoker.method = this.method;
-            invoker.serviceName = this.serviceName;
-            return invoker;
-        } catch (CloneNotSupportedException e) {
-            return null; // will not happen
-        }
-    }  
-    
-}
+/*
+ * 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.servicemix.sca.handler;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.core.context.ExternalServiceContext;
+import org.apache.tuscany.core.context.InstanceContext;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.context.ScopeContext;
+import org.apache.tuscany.core.context.TargetException;
+import org.apache.tuscany.core.invocation.Interceptor;
+import org.apache.tuscany.core.invocation.TargetInvoker;
+import org.apache.tuscany.core.message.Message;
+
+public class ExternalJbiServiceTargetInvoker implements TargetInvoker {
+
+    private QualifiedName serviceName;
+    private String esName;
+    private Method method;
+    private ScopeContext container;
+
+    private ExternalServiceContext context;
+
+    /**
+     * Constructs a new ExternalJbiServiceTargetInvoker.
+     * @param esName
+     * @param container
+     */
+    public ExternalJbiServiceTargetInvoker(QualifiedName serviceName, Method method, ScopeContext container) {
+        assert (serviceName != null) : "No service name specified";
+        assert (method != null) : "No method specified";
+        assert (container != null) : "No scope container specified";
+        this.serviceName = serviceName;
+        this.esName = serviceName.getPartName();
+        this.method = method;
+        this.container = container;
+    }
+
+    public Object invokeTarget(Object payload) throws InvocationTargetException {
+        if (context == null) {
+            InstanceContext iContext = container.getContext(esName);
+            if (!(iContext instanceof ExternalServiceContext)) {
+                TargetException te = new TargetException("Unexpected target context type");
+                te.setIdentifier(iContext.getClass().getName());
+                te.addContextName(iContext.getName());
+                throw te;
+            }
+            context = (ExternalServiceContext) iContext;
+        }
+        ExternalJbiServiceClient client = (ExternalJbiServiceClient) context.getImplementationInstance(true);
+        if (payload != null) {
+            return client.invoke(method, (Object[])payload);
+        } else {
+            return client.invoke(method, null);
+        }
+    }
+
+    public boolean isCacheable() {
+        return false;
+    }
+
+    public Message invoke(Message msg) {
+        try {
+            Object resp = invokeTarget(msg.getBody());
+            msg.setBody(resp);
+        } catch (InvocationTargetException e) {
+            msg.setBody(e.getCause());
+        } catch (Throwable e) {
+            msg.setBody(e);
+        }
+        return msg;
+    }
+
+    public void setNext(Interceptor next) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Object clone() {
+        try {
+            ExternalJbiServiceTargetInvoker invoker = (ExternalJbiServiceTargetInvoker) super.clone();
+            invoker.container = container;
+            invoker.context = this.context;
+            invoker.esName = this.esName;
+            invoker.method = this.method;
+            invoker.serviceName = this.serviceName;
+            return invoker;
+        } catch (CloneNotSupportedException e) {
+            return null; // will not happen
+        }
+    }  
+    
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/handler/ExternalJbiServiceTargetInvoker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java Fri Aug 11 15:56:46 2006
@@ -1,73 +1,73 @@
-/*
- * 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.servicemix.sca.loader;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.servicemix.sca.assembly.JbiAssemblyFactory;
-import org.apache.servicemix.sca.assembly.JbiBinding;
-import org.apache.servicemix.sca.assembly.impl.JbiAssemblyFactoryImpl;
-import org.apache.tuscany.common.resource.ResourceLoader;
-import org.apache.tuscany.core.config.ConfigurationLoadException;
-import org.apache.tuscany.core.loader.StAXElementLoader;
-import org.apache.tuscany.core.loader.StAXLoaderRegistry;
-import org.apache.tuscany.core.system.annotation.Autowire;
-import org.osoa.sca.annotations.Destroy;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Scope;
-
-@Scope("MODULE")
-public class JbiBindingLoader implements StAXElementLoader<JbiBinding>{
-
-    public static final QName BINDING_JBI = new QName("http://www.osoa.org/xmlns/sca/0.9", "binding.jbi");
-
-    private static final JbiAssemblyFactory jbiFactory = new JbiAssemblyFactoryImpl();
-
-    private StAXLoaderRegistry registry;
-
-    @Autowire
-    public void setRegistry(StAXLoaderRegistry registry) {
-        this.registry = registry;
-    }
-
-    @Init(eager = true)
-    public void start() {
-        registry.registerLoader(this);
-    }
-
-    @Destroy
-    public void stop() {
-        registry.unregisterLoader(this);
-    }
-
-    public QName getXMLType() {
-        return BINDING_JBI;
-    }
-
-    public Class<JbiBinding> getModelType() {
-        return JbiBinding.class;
-    }
-
-    public JbiBinding load(XMLStreamReader reader, ResourceLoader resourceLoader) throws XMLStreamException, ConfigurationLoadException {
-        JbiBinding binding = jbiFactory.createJbiBinding();
-        binding.setURI(reader.getAttributeValue(null, "uri"));
-        binding.setPortURI(reader.getAttributeValue(null, "port"));
-        return binding;
-    }
-}
+/*
+ * 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.servicemix.sca.loader;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.servicemix.sca.assembly.JbiAssemblyFactory;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.assembly.impl.JbiAssemblyFactoryImpl;
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.core.loader.StAXElementLoader;
+import org.apache.tuscany.core.loader.StAXLoaderRegistry;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("MODULE")
+public class JbiBindingLoader implements StAXElementLoader<JbiBinding>{
+
+    public static final QName BINDING_JBI = new QName("http://www.osoa.org/xmlns/sca/0.9", "binding.jbi");
+
+    private static final JbiAssemblyFactory jbiFactory = new JbiAssemblyFactoryImpl();
+
+    private StAXLoaderRegistry registry;
+
+    @Autowire
+    public void setRegistry(StAXLoaderRegistry registry) {
+        this.registry = registry;
+    }
+
+    @Init(eager = true)
+    public void start() {
+        registry.registerLoader(this);
+    }
+
+    @Destroy
+    public void stop() {
+        registry.unregisterLoader(this);
+    }
+
+    public QName getXMLType() {
+        return BINDING_JBI;
+    }
+
+    public Class<JbiBinding> getModelType() {
+        return JbiBinding.class;
+    }
+
+    public JbiBinding load(XMLStreamReader reader, ResourceLoader resourceLoader) throws XMLStreamException, ConfigurationLoadException {
+        JbiBinding binding = jbiFactory.createJbiBinding();
+        binding.setURI(reader.getAttributeValue(null, "uri"));
+        binding.setPortURI(reader.getAttributeValue(null, "port"));
+        return binding;
+    }
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/loader/JbiBindingLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java Fri Aug 11 15:56:46 2006
@@ -1,123 +1,123 @@
-/*
- * 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.servicemix.sca.tuscany;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.stream.XMLInputFactory;
-
-import org.apache.tuscany.common.resource.ResourceLoader;
-import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl;
-import org.apache.tuscany.core.builder.ContextFactoryBuilder;
-import org.apache.tuscany.core.config.ConfigurationException;
-import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader;
-import org.apache.tuscany.core.config.impl.ModuleComponentConfigurationLoaderImpl;
-import org.apache.tuscany.core.config.impl.StAXModuleComponentConfigurationLoaderImpl;
-import org.apache.tuscany.core.context.AggregateContext;
-import org.apache.tuscany.core.context.EventContext;
-import org.apache.tuscany.core.context.SystemAggregateContext;
-import org.apache.tuscany.core.loader.StAXLoaderRegistry;
-import org.apache.tuscany.core.loader.StAXUtil;
-import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl;
-import org.apache.tuscany.core.system.builder.SystemContextFactoryBuilder;
-import org.apache.tuscany.core.system.builder.SystemEntryPointBuilder;
-import org.apache.tuscany.core.system.builder.SystemExternalServiceBuilder;
-import org.apache.tuscany.core.system.loader.SystemSCDLModelLoader;
-import org.apache.tuscany.model.assembly.AssemblyFactory;
-import org.apache.tuscany.model.assembly.AssemblyModelContext;
-import org.apache.tuscany.model.assembly.ModuleComponent;
-import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl;
-import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader;
-import org.apache.tuscany.model.scdl.loader.SCDLModelLoader;
-import org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl;
-
-public class BootstrapHelper {
-    
-    /**
-     * Returns a default AssemblyModelContext.
-     *
-     * @param classLoader the classloader to use for application artifacts
-     * @return a default AssemblyModelContext
-     */
-    public static AssemblyModelContext getModelContext(ClassLoader classLoader) {
-        // Create an assembly model factory
-        AssemblyFactory modelFactory = new SystemAssemblyFactoryImpl();
-
-        // Create a default assembly model loader
-        List<SCDLModelLoader> scdlLoaders = new ArrayList<SCDLModelLoader>();
-        scdlLoaders.add(new SystemSCDLModelLoader());
-        AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl(scdlLoaders);
-
-        // Create a resource loader from the supplied classloader
-        ResourceLoader resourceLoader = new ResourceLoaderImpl(classLoader);
-
-        // Create an assembly model context
-        return new AssemblyModelContextImpl(modelFactory, modelLoader, resourceLoader);
-    }
-
-    /**
-     * Returns a default list of configuration builders.
-     *
-     * @return a default list of configuration builders
-     */
-    public static List<ContextFactoryBuilder> getBuilders() {
-        List<ContextFactoryBuilder> configBuilders = new ArrayList<ContextFactoryBuilder>();
-        configBuilders.add((new SystemContextFactoryBuilder()));
-        configBuilders.add(new SystemEntryPointBuilder());
-        configBuilders.add(new SystemExternalServiceBuilder());
-        return configBuilders;
-    }
-
-    private static final boolean useStax = true;
-    private static final String SYSTEM_LOADER_COMPONENT = "tuscany.loader";
-
-    /**
-     * Returns the default module configuration loader.
-     *
-     * @param systemContext the runtime's system context
-     * @param modelContext  the model context the loader will use
-     * @return the default module configuration loader
-     */
-    public static ModuleComponentConfigurationLoader getConfigurationLoader(SystemAggregateContext systemContext, AssemblyModelContext modelContext) throws ConfigurationException {
-        if (useStax) {
-            // Bootstrap the StAX loader module
-            bootstrapStaxLoader(systemContext, modelContext);
-            return new StAXModuleComponentConfigurationLoaderImpl(modelContext, XMLInputFactory.newInstance(), systemContext.resolveInstance(StAXLoaderRegistry.class));
-        } else {
-            return new ModuleComponentConfigurationLoaderImpl(modelContext);
-        }
-    }
-
-    private static AggregateContext bootstrapStaxLoader(SystemAggregateContext systemContext, AssemblyModelContext modelContext) throws ConfigurationException {
-        AggregateContext loaderContext = (AggregateContext) systemContext.getContext(SYSTEM_LOADER_COMPONENT);
-        if (loaderContext == null) {
-            ModuleComponent loaderComponent = StAXUtil.bootstrapLoader(SYSTEM_LOADER_COMPONENT, modelContext);
-            loaderContext = registerModule(systemContext, loaderComponent);
-            loaderContext.fireEvent(EventContext.MODULE_START, null);
-        }
-        return loaderContext;
-    }
-
-    public static AggregateContext registerModule(AggregateContext parent, ModuleComponent component) throws ConfigurationException {
-        // register the component
-        parent.registerModelObject(component);
-
-        // Get the aggregate context representing the component
-        return (AggregateContext) parent.getContext(component.getName());
-    }
-}
\ No newline at end of file
+/*
+ * 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.servicemix.sca.tuscany;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.config.ConfigurationException;
+import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader;
+import org.apache.tuscany.core.config.impl.ModuleComponentConfigurationLoaderImpl;
+import org.apache.tuscany.core.config.impl.StAXModuleComponentConfigurationLoaderImpl;
+import org.apache.tuscany.core.context.AggregateContext;
+import org.apache.tuscany.core.context.EventContext;
+import org.apache.tuscany.core.context.SystemAggregateContext;
+import org.apache.tuscany.core.loader.StAXLoaderRegistry;
+import org.apache.tuscany.core.loader.StAXUtil;
+import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl;
+import org.apache.tuscany.core.system.builder.SystemContextFactoryBuilder;
+import org.apache.tuscany.core.system.builder.SystemEntryPointBuilder;
+import org.apache.tuscany.core.system.builder.SystemExternalServiceBuilder;
+import org.apache.tuscany.core.system.loader.SystemSCDLModelLoader;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl;
+import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader;
+import org.apache.tuscany.model.scdl.loader.SCDLModelLoader;
+import org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl;
+
+public class BootstrapHelper {
+    
+    /**
+     * Returns a default AssemblyModelContext.
+     *
+     * @param classLoader the classloader to use for application artifacts
+     * @return a default AssemblyModelContext
+     */
+    public static AssemblyModelContext getModelContext(ClassLoader classLoader) {
+        // Create an assembly model factory
+        AssemblyFactory modelFactory = new SystemAssemblyFactoryImpl();
+
+        // Create a default assembly model loader
+        List<SCDLModelLoader> scdlLoaders = new ArrayList<SCDLModelLoader>();
+        scdlLoaders.add(new SystemSCDLModelLoader());
+        AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl(scdlLoaders);
+
+        // Create a resource loader from the supplied classloader
+        ResourceLoader resourceLoader = new ResourceLoaderImpl(classLoader);
+
+        // Create an assembly model context
+        return new AssemblyModelContextImpl(modelFactory, modelLoader, resourceLoader);
+    }
+
+    /**
+     * Returns a default list of configuration builders.
+     *
+     * @return a default list of configuration builders
+     */
+    public static List<ContextFactoryBuilder> getBuilders() {
+        List<ContextFactoryBuilder> configBuilders = new ArrayList<ContextFactoryBuilder>();
+        configBuilders.add((new SystemContextFactoryBuilder()));
+        configBuilders.add(new SystemEntryPointBuilder());
+        configBuilders.add(new SystemExternalServiceBuilder());
+        return configBuilders;
+    }
+
+    private static final boolean useStax = true;
+    private static final String SYSTEM_LOADER_COMPONENT = "tuscany.loader";
+
+    /**
+     * Returns the default module configuration loader.
+     *
+     * @param systemContext the runtime's system context
+     * @param modelContext  the model context the loader will use
+     * @return the default module configuration loader
+     */
+    public static ModuleComponentConfigurationLoader getConfigurationLoader(SystemAggregateContext systemContext, AssemblyModelContext modelContext) throws ConfigurationException {
+        if (useStax) {
+            // Bootstrap the StAX loader module
+            bootstrapStaxLoader(systemContext, modelContext);
+            return new StAXModuleComponentConfigurationLoaderImpl(modelContext, XMLInputFactory.newInstance(), systemContext.resolveInstance(StAXLoaderRegistry.class));
+        } else {
+            return new ModuleComponentConfigurationLoaderImpl(modelContext);
+        }
+    }
+
+    private static AggregateContext bootstrapStaxLoader(SystemAggregateContext systemContext, AssemblyModelContext modelContext) throws ConfigurationException {
+        AggregateContext loaderContext = (AggregateContext) systemContext.getContext(SYSTEM_LOADER_COMPONENT);
+        if (loaderContext == null) {
+            ModuleComponent loaderComponent = StAXUtil.bootstrapLoader(SYSTEM_LOADER_COMPONENT, modelContext);
+            loaderContext = registerModule(systemContext, loaderComponent);
+            loaderContext.fireEvent(EventContext.MODULE_START, null);
+        }
+        return loaderContext;
+    }
+
+    public static AggregateContext registerModule(AggregateContext parent, ModuleComponent component) throws ConfigurationException {
+        // register the component
+        parent.registerModelObject(component);
+
+        // Get the aggregate context representing the component
+        return (AggregateContext) parent.getContext(component.getName());
+    }
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/BootstrapHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java Fri Aug 11 15:56:46 2006
@@ -1,88 +1,88 @@
-/*
- * 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.servicemix.sca.tuscany;
-
-import java.lang.ref.WeakReference;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tuscany.common.monitor.MonitorFactory;
-
-public class CommonsLoggingMonitorFactory implements MonitorFactory {
-
-    private final Map<Class<?>, WeakReference<?>> proxies = new WeakHashMap<Class<?>, WeakReference<?>>();
-    
-    public CommonsLoggingMonitorFactory() {
-    }
-
-    public <T> T getMonitor(Class<T> monitorInterface) {
-        T proxy = getCachedMonitor(monitorInterface);
-        if (proxy == null) {
-            proxy = createMonitor(monitorInterface);
-            proxies.put(monitorInterface, new WeakReference<T>(proxy));
-        }
-        return proxy;
-    }
-
-    private <T>T getCachedMonitor(Class<T> monitorInterface) {
-        WeakReference<T> ref = (WeakReference<T>) proxies.get(monitorInterface);
-        return (ref != null) ? ref.get() : null;
-    }
-
-    private <T>T createMonitor(Class<T> monitorInterface) {
-        String className = monitorInterface.getName();
-        Log logger = LogFactory.getLog(className);
-        InvocationHandler handler = new LoggingHandler(logger);
-        return (T) Proxy.newProxyInstance(monitorInterface.getClassLoader(), new Class<?>[]{monitorInterface}, handler);
-    }
-
-    private static final class LoggingHandler implements InvocationHandler {
-        private final Log logger;
-
-        public LoggingHandler(Log logger) {
-            this.logger = logger;
-        }
-
-        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-            String sourceMethod = method.getName();
-            if (logger.isDebugEnabled()) {
-                // if the only argument is a Throwable use the special logger for it
-                if (args != null && args.length == 1 && args[0] instanceof Throwable) {
-                    logger.debug(sourceMethod, (Throwable) args[0]);
-                } else {
-                    StringBuilder sb = new StringBuilder();
-                    sb.append(sourceMethod);
-                    sb.append("(");
-                    for (int i = 0; i < args.length; i++) {
-                        if (i > 0) {
-                            sb.append(", ");
-                        }
-                        sb.append(args[i]);
-                    }
-                    sb.append(")");
-                    logger.debug(sb.toString());
-                }
-            }
-            return null;
-        }
-    }
-}
+/*
+ * 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.servicemix.sca.tuscany;
+
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tuscany.common.monitor.MonitorFactory;
+
+public class CommonsLoggingMonitorFactory implements MonitorFactory {
+
+    private final Map<Class<?>, WeakReference<?>> proxies = new WeakHashMap<Class<?>, WeakReference<?>>();
+    
+    public CommonsLoggingMonitorFactory() {
+    }
+
+    public <T> T getMonitor(Class<T> monitorInterface) {
+        T proxy = getCachedMonitor(monitorInterface);
+        if (proxy == null) {
+            proxy = createMonitor(monitorInterface);
+            proxies.put(monitorInterface, new WeakReference<T>(proxy));
+        }
+        return proxy;
+    }
+
+    private <T>T getCachedMonitor(Class<T> monitorInterface) {
+        WeakReference<T> ref = (WeakReference<T>) proxies.get(monitorInterface);
+        return (ref != null) ? ref.get() : null;
+    }
+
+    private <T>T createMonitor(Class<T> monitorInterface) {
+        String className = monitorInterface.getName();
+        Log logger = LogFactory.getLog(className);
+        InvocationHandler handler = new LoggingHandler(logger);
+        return (T) Proxy.newProxyInstance(monitorInterface.getClassLoader(), new Class<?>[]{monitorInterface}, handler);
+    }
+
+    private static final class LoggingHandler implements InvocationHandler {
+        private final Log logger;
+
+        public LoggingHandler(Log logger) {
+            this.logger = logger;
+        }
+
+        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+            String sourceMethod = method.getName();
+            if (logger.isDebugEnabled()) {
+                // if the only argument is a Throwable use the special logger for it
+                if (args != null && args.length == 1 && args[0] instanceof Throwable) {
+                    logger.debug(sourceMethod, (Throwable) args[0]);
+                } else {
+                    StringBuilder sb = new StringBuilder();
+                    sb.append(sourceMethod);
+                    sb.append("(");
+                    for (int i = 0; i < args.length; i++) {
+                        if (i > 0) {
+                            sb.append(", ");
+                        }
+                        sb.append(args[i]);
+                    }
+                    sb.append(")");
+                    logger.debug(sb.toString());
+                }
+            }
+            return null;
+        }
+    }
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/CommonsLoggingMonitorFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java Fri Aug 11 15:56:46 2006
@@ -1,172 +1,172 @@
-/*
- * 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.servicemix.sca.tuscany;
-
-import java.util.List;
-
-import org.apache.tuscany.common.monitor.MonitorFactory;
-import org.apache.tuscany.common.monitor.impl.NullMonitorFactory;
-import org.apache.tuscany.core.builder.ContextFactoryBuilder;
-import org.apache.tuscany.core.builder.impl.DefaultWireBuilder;
-import org.apache.tuscany.core.config.ConfigurationException;
-import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader;
-import org.apache.tuscany.core.context.AggregateContext;
-import org.apache.tuscany.core.context.CoreRuntimeException;
-import org.apache.tuscany.core.context.EventContext;
-import org.apache.tuscany.core.context.SystemAggregateContext;
-import org.apache.tuscany.core.runtime.RuntimeContext;
-import org.apache.tuscany.core.runtime.RuntimeContextImpl;
-import org.apache.tuscany.model.assembly.AssemblyModelContext;
-import org.apache.tuscany.model.assembly.ModuleComponent;
-import org.apache.tuscany.model.scdl.loader.SCDLModelLoader;
-import org.osoa.sca.ModuleContext;
-import org.osoa.sca.SCA;
-import org.osoa.sca.ServiceRuntimeException;
-
-public class TuscanyRuntime extends SCA {
-    private final TuscanyRuntime.Monitor monitor;
-    private final Object sessionKey = new Object();
-
-    private final RuntimeContext runtime;
-    private final AggregateContext moduleContext;
-    
-    private final ModuleComponent moduleComponent;
-
-    private static final String SYSTEM_MODULE_COMPONENT = "org.apache.tuscany.core.system";
-
-    /**
-     * Construct a runtime using a null MonitorFactory.
-     *
-     * @param name the name of the module component
-     * @param uri  the URI to assign to the module component
-     * @throws ConfigurationException if there was a problem loading the SCA configuration
-     * @see TuscanyRuntime#TuscanyRuntime(String, String, org.apache.tuscany.common.monitor.MonitorFactory)
-     */
-    public TuscanyRuntime(String name, String uri) throws ConfigurationException {
-        this(name, uri, 
-             Thread.currentThread().getContextClassLoader(), 
-             new NullMonitorFactory());
-    }
-
-    /**
-     * Construct a runtime containing a single module component with the
-     * specified name. The module definition is loaded from a "/sca.module"
-     * resource found on the classpath of the current Thread context classloader.
-     *
-     * @param name           the name of the module component
-     * @param uri            the URI to assign to the module component
-     * @param classLoader    the class loader to use for the assembly
-     * @param monitorFactory the MonitorFactory for this runtime
-     * @throws ConfigurationException if there was a problem loading the SCA configuration
-     */
-    public TuscanyRuntime(String name, String uri, ClassLoader classLoader, MonitorFactory monitorFactory) throws ConfigurationException {
-        this.monitor = monitorFactory.getMonitor(TuscanyRuntime.Monitor.class);
-
-        // Create an assembly model context
-        AssemblyModelContext modelContext = BootstrapHelper.getModelContext(classLoader);
-
-        // Create a runtime context and start it
-        List<SCDLModelLoader> loaders = modelContext.getAssemblyLoader().getLoaders();
-        List<ContextFactoryBuilder> configBuilders = BootstrapHelper.getBuilders();
-        runtime = new RuntimeContextImpl(monitorFactory, loaders, configBuilders, new DefaultWireBuilder());
-        runtime.start();
-        monitor.started(runtime);
-
-        // Load and start the system configuration
-        SystemAggregateContext systemContext = runtime.getSystemContext();
-        ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext);
-        ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT);
-        AggregateContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent);
-        context.fireEvent(EventContext.MODULE_START, null);
-
-        // Load the SCDL configuration of the application module
-        AggregateContext rootContext = runtime.getRootContext();
-        moduleComponent = loader.loadModuleComponent(name, uri);
-        moduleContext = BootstrapHelper.registerModule(rootContext, moduleComponent);
-    }
-
-    public ModuleComponent getModuleComponent() {
-        return moduleComponent;
-    }
-    
-    public AggregateContext getModuleContext() {
-        return moduleContext;
-    }
-    
-    /**
-     * Start the runtime and associate the module context with the calling thread.
-     */
-    @Override
-    public void start() {
-        setModuleContext((ModuleContext) moduleContext);
-        try {
-            //moduleContext.start();
-            moduleContext.fireEvent(EventContext.MODULE_START, null);
-            moduleContext.fireEvent(EventContext.REQUEST_START, null);
-            moduleContext.fireEvent(EventContext.SESSION_NOTIFY, sessionKey);
-            monitor.started(moduleContext);
-        } catch (CoreRuntimeException e) {
-            setModuleContext(null);
-            monitor.startFailed(moduleContext, e);
-            //FIXME throw a better exception
-            throw new ServiceRuntimeException(e);
-        }
-    }
-
-    /**
-     * Disassociate the module context from the current thread and shut down the runtime.
-     */
-    @Override
-    public void stop() {
-        setModuleContext(null);
-        moduleContext.fireEvent(EventContext.REQUEST_END, null);
-        moduleContext.fireEvent(EventContext.SESSION_END, sessionKey);
-        moduleContext.fireEvent(EventContext.MODULE_STOP, null);
-        moduleContext.stop();
-        monitor.stopped(moduleContext);
-        runtime.stop();
-        monitor.stopped(runtime);
-    }
-
-    /**
-     * Monitor interface for a TuscanyRuntime.
-     */
-    public static interface Monitor {
-        /**
-         * Event emitted after the runtime has been started.
-         *
-         * @param ctx the runtime's module component context
-         */
-        void started(AggregateContext ctx);
-
-        /**
-         * Event emitted when an attempt to start the runtime failed.
-         *
-         * @param ctx the runtime's module component context
-         * @param e   the exception that caused the failure
-         */
-        void startFailed(AggregateContext ctx, CoreRuntimeException e);
-
-        /**
-         * Event emitted after the runtime has been stopped.
-         *
-         * @param ctx the runtime's module component context
-         */
-        void stopped(AggregateContext ctx);
-    }
-
-}
\ No newline at end of file
+/*
+ * 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.servicemix.sca.tuscany;
+
+import java.util.List;
+
+import org.apache.tuscany.common.monitor.MonitorFactory;
+import org.apache.tuscany.common.monitor.impl.NullMonitorFactory;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.builder.impl.DefaultWireBuilder;
+import org.apache.tuscany.core.config.ConfigurationException;
+import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader;
+import org.apache.tuscany.core.context.AggregateContext;
+import org.apache.tuscany.core.context.CoreRuntimeException;
+import org.apache.tuscany.core.context.EventContext;
+import org.apache.tuscany.core.context.SystemAggregateContext;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.runtime.RuntimeContextImpl;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+import org.apache.tuscany.model.scdl.loader.SCDLModelLoader;
+import org.osoa.sca.ModuleContext;
+import org.osoa.sca.SCA;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class TuscanyRuntime extends SCA {
+    private final TuscanyRuntime.Monitor monitor;
+    private final Object sessionKey = new Object();
+
+    private final RuntimeContext runtime;
+    private final AggregateContext moduleContext;
+    
+    private final ModuleComponent moduleComponent;
+
+    private static final String SYSTEM_MODULE_COMPONENT = "org.apache.tuscany.core.system";
+
+    /**
+     * Construct a runtime using a null MonitorFactory.
+     *
+     * @param name the name of the module component
+     * @param uri  the URI to assign to the module component
+     * @throws ConfigurationException if there was a problem loading the SCA configuration
+     * @see TuscanyRuntime#TuscanyRuntime(String, String, org.apache.tuscany.common.monitor.MonitorFactory)
+     */
+    public TuscanyRuntime(String name, String uri) throws ConfigurationException {
+        this(name, uri, 
+             Thread.currentThread().getContextClassLoader(), 
+             new NullMonitorFactory());
+    }
+
+    /**
+     * Construct a runtime containing a single module component with the
+     * specified name. The module definition is loaded from a "/sca.module"
+     * resource found on the classpath of the current Thread context classloader.
+     *
+     * @param name           the name of the module component
+     * @param uri            the URI to assign to the module component
+     * @param classLoader    the class loader to use for the assembly
+     * @param monitorFactory the MonitorFactory for this runtime
+     * @throws ConfigurationException if there was a problem loading the SCA configuration
+     */
+    public TuscanyRuntime(String name, String uri, ClassLoader classLoader, MonitorFactory monitorFactory) throws ConfigurationException {
+        this.monitor = monitorFactory.getMonitor(TuscanyRuntime.Monitor.class);
+
+        // Create an assembly model context
+        AssemblyModelContext modelContext = BootstrapHelper.getModelContext(classLoader);
+
+        // Create a runtime context and start it
+        List<SCDLModelLoader> loaders = modelContext.getAssemblyLoader().getLoaders();
+        List<ContextFactoryBuilder> configBuilders = BootstrapHelper.getBuilders();
+        runtime = new RuntimeContextImpl(monitorFactory, loaders, configBuilders, new DefaultWireBuilder());
+        runtime.start();
+        monitor.started(runtime);
+
+        // Load and start the system configuration
+        SystemAggregateContext systemContext = runtime.getSystemContext();
+        ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext);
+        ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT);
+        AggregateContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent);
+        context.fireEvent(EventContext.MODULE_START, null);
+
+        // Load the SCDL configuration of the application module
+        AggregateContext rootContext = runtime.getRootContext();
+        moduleComponent = loader.loadModuleComponent(name, uri);
+        moduleContext = BootstrapHelper.registerModule(rootContext, moduleComponent);
+    }
+
+    public ModuleComponent getModuleComponent() {
+        return moduleComponent;
+    }
+    
+    public AggregateContext getModuleContext() {
+        return moduleContext;
+    }
+    
+    /**
+     * Start the runtime and associate the module context with the calling thread.
+     */
+    @Override
+    public void start() {
+        setModuleContext((ModuleContext) moduleContext);
+        try {
+            //moduleContext.start();
+            moduleContext.fireEvent(EventContext.MODULE_START, null);
+            moduleContext.fireEvent(EventContext.REQUEST_START, null);
+            moduleContext.fireEvent(EventContext.SESSION_NOTIFY, sessionKey);
+            monitor.started(moduleContext);
+        } catch (CoreRuntimeException e) {
+            setModuleContext(null);
+            monitor.startFailed(moduleContext, e);
+            //FIXME throw a better exception
+            throw new ServiceRuntimeException(e);
+        }
+    }
+
+    /**
+     * Disassociate the module context from the current thread and shut down the runtime.
+     */
+    @Override
+    public void stop() {
+        setModuleContext(null);
+        moduleContext.fireEvent(EventContext.REQUEST_END, null);
+        moduleContext.fireEvent(EventContext.SESSION_END, sessionKey);
+        moduleContext.fireEvent(EventContext.MODULE_STOP, null);
+        moduleContext.stop();
+        monitor.stopped(moduleContext);
+        runtime.stop();
+        monitor.stopped(runtime);
+    }
+
+    /**
+     * Monitor interface for a TuscanyRuntime.
+     */
+    public static interface Monitor {
+        /**
+         * Event emitted after the runtime has been started.
+         *
+         * @param ctx the runtime's module component context
+         */
+        void started(AggregateContext ctx);
+
+        /**
+         * Event emitted when an attempt to start the runtime failed.
+         *
+         * @param ctx the runtime's module component context
+         * @param e   the exception that caused the failure
+         */
+        void startFailed(AggregateContext ctx, CoreRuntimeException e);
+
+        /**
+         * Event emitted after the runtime has been stopped.
+         *
+         * @param ctx the runtime's module component context
+         */
+        void stopped(AggregateContext ctx);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/tuscany/TuscanyRuntime.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/DISCLAIMER?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/DISCLAIMER (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/DISCLAIMER Fri Aug 11 15:56:46 2006
@@ -1,6 +1,6 @@
-Apache ServiceMix is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Geronimo PMC. 
-Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, 
-communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. 
-
-While incubation status is not necessarily a reflection of the completeness or stability of the code, it does 
-indicate that the project has yet to be fully endorsed by the ASF.
+Apache ServiceMix is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Geronimo PMC. 
+Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, 
+communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. 
+
+While incubation status is not necessarily a reflection of the completeness or stability of the code, it does 
+indicate that the project has yet to be fully endorsed by the ASF.

Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/jbi/META-INF/DISCLAIMER
------------------------------------------------------------------------------
    svn:eol-style = native



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