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 [10/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/ScaEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java Fri Aug 11 15:56:46 2006
@@ -1,155 +1,155 @@
-/*
- * 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;
-
-import java.io.StringWriter;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jbi.component.ComponentContext;
-import javax.jbi.messaging.DeliveryChannel;
-import javax.jbi.messaging.ExchangeStatus;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.NormalizedMessage;
-import javax.jbi.messaging.MessageExchange.Role;
-import javax.jbi.servicedesc.ServiceEndpoint;
-import javax.xml.bind.JAXBContext;
-
-import org.apache.servicemix.common.Endpoint;
-import org.apache.servicemix.common.ExchangeProcessor;
-import org.apache.servicemix.jbi.jaxp.StringSource;
-import org.apache.tuscany.core.context.EntryPointContext;
-import org.apache.tuscany.model.assembly.ConfiguredReference;
-import org.apache.tuscany.model.assembly.ConfiguredService;
-import org.apache.tuscany.model.assembly.EntryPoint;
-
-/**
- *
- * @author gnodet
- * @version $Revision: 366467 $
- * @org.apache.xbean.XBean element="endpoint" description="A sca endpoint"
- *
- */
-public class ScaEndpoint extends Endpoint implements ExchangeProcessor {
-
- protected ServiceEndpoint activated;
-
- protected EntryPoint entryPoint;
-
- protected Map<Class, Method> methodMap;
-
- protected JAXBContext jaxbContext;
-
- protected DeliveryChannel channel;
-
- public ScaEndpoint(EntryPoint entryPoint) {
- this.entryPoint = entryPoint;
- }
-
- public Role getRole() {
- return Role.PROVIDER;
- }
-
- public void activate() throws Exception {
- logger = this.serviceUnit.getComponent().getLogger();
- ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
- activated = ctx.activateEndpoint(service, endpoint);
- channel = ctx.getDeliveryChannel();
- // Get the target service
- ConfiguredReference referenceValue = entryPoint.getConfiguredReference();
- ConfiguredService targetServiceEndpoint = referenceValue.getTargetConfiguredServices().get(0);
- // Get the business interface
- Class serviceInterface = targetServiceEndpoint.getService().getServiceContract().getInterface();
- List<Class> classes = new ArrayList<Class>();
- methodMap = new HashMap<Class, Method>();
- for (Method mth : serviceInterface.getMethods()) {
- Class[] params = mth.getParameterTypes();
- if (params.length != 1) {
- throw new IllegalStateException("Supports only methods with one parameter");
- }
- methodMap.put(params[0], mth);
- classes.add(mth.getReturnType());
- classes.add(params[0]);
- }
- jaxbContext = JAXBContext.newInstance(classes.toArray(new Class[0]));
- }
-
- public void deactivate() throws Exception {
- ServiceEndpoint ep = activated;
- activated = null;
- ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
- ctx.deactivateEndpoint(ep);
- }
-
- public ExchangeProcessor getProcessor() {
- return this;
- }
-
- public void process(MessageExchange exchange) throws Exception {
- if (exchange.getStatus() == ExchangeStatus.DONE) {
- return;
- } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
- return;
- }
- Object input = jaxbContext.createUnmarshaller().unmarshal(exchange.getMessage("in").getContent());
- Method method = methodMap.get(input.getClass());
- if (method == null) {
- throw new IllegalStateException("Could not determine invoked web method");
- }
- boolean oneWay = method.getReturnType() == null;
- Object output;
- try {
- EntryPointContext entryPointContext = (EntryPointContext) ((ScaServiceUnit) serviceUnit)
- .getTuscanyRuntime().getModuleContext().getContext(entryPoint.getName());
- InvocationHandler handler = (InvocationHandler) entryPointContext.getImplementationInstance();
- output = handler.invoke(null, method, new Object[] { input });
- } catch (UndeclaredThrowableException e) {
- throw e;
- } catch (RuntimeException e) {
- throw e;
- } catch (Error e) {
- throw e;
- } catch (Exception e) {
- throw e;
- } catch (Throwable e) {
- throw new RuntimeException(e);
- }
- if (oneWay) {
- exchange.setStatus(ExchangeStatus.DONE);
- channel.send(exchange);
- } else {
- NormalizedMessage msg = exchange.createMessage();
- exchange.setMessage(msg, "out");
- StringWriter writer = new StringWriter();
- jaxbContext.createMarshaller().marshal(output, writer);
- msg.setContent(new StringSource(writer.toString()));
- channel.send(exchange);
- }
- }
-
- public void start() throws Exception {
- }
-
- public void stop() throws Exception {
- }
-
-}
+/*
+ * 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;
+
+import java.io.StringWriter;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.jbi.component.ComponentContext;
+import javax.jbi.messaging.DeliveryChannel;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.NormalizedMessage;
+import javax.jbi.messaging.MessageExchange.Role;
+import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.bind.JAXBContext;
+
+import org.apache.servicemix.common.Endpoint;
+import org.apache.servicemix.common.ExchangeProcessor;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.tuscany.core.context.EntryPointContext;
+import org.apache.tuscany.model.assembly.ConfiguredReference;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+
+/**
+ *
+ * @author gnodet
+ * @version $Revision: 366467 $
+ * @org.apache.xbean.XBean element="endpoint" description="A sca endpoint"
+ *
+ */
+public class ScaEndpoint extends Endpoint implements ExchangeProcessor {
+
+ protected ServiceEndpoint activated;
+
+ protected EntryPoint entryPoint;
+
+ protected Map<Class, Method> methodMap;
+
+ protected JAXBContext jaxbContext;
+
+ protected DeliveryChannel channel;
+
+ public ScaEndpoint(EntryPoint entryPoint) {
+ this.entryPoint = entryPoint;
+ }
+
+ public Role getRole() {
+ return Role.PROVIDER;
+ }
+
+ public void activate() throws Exception {
+ logger = this.serviceUnit.getComponent().getLogger();
+ ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
+ activated = ctx.activateEndpoint(service, endpoint);
+ channel = ctx.getDeliveryChannel();
+ // Get the target service
+ ConfiguredReference referenceValue = entryPoint.getConfiguredReference();
+ ConfiguredService targetServiceEndpoint = referenceValue.getTargetConfiguredServices().get(0);
+ // Get the business interface
+ Class serviceInterface = targetServiceEndpoint.getService().getServiceContract().getInterface();
+ List<Class> classes = new ArrayList<Class>();
+ methodMap = new HashMap<Class, Method>();
+ for (Method mth : serviceInterface.getMethods()) {
+ Class[] params = mth.getParameterTypes();
+ if (params.length != 1) {
+ throw new IllegalStateException("Supports only methods with one parameter");
+ }
+ methodMap.put(params[0], mth);
+ classes.add(mth.getReturnType());
+ classes.add(params[0]);
+ }
+ jaxbContext = JAXBContext.newInstance(classes.toArray(new Class[0]));
+ }
+
+ public void deactivate() throws Exception {
+ ServiceEndpoint ep = activated;
+ activated = null;
+ ComponentContext ctx = this.serviceUnit.getComponent().getComponentContext();
+ ctx.deactivateEndpoint(ep);
+ }
+
+ public ExchangeProcessor getProcessor() {
+ return this;
+ }
+
+ public void process(MessageExchange exchange) throws Exception {
+ if (exchange.getStatus() == ExchangeStatus.DONE) {
+ return;
+ } else if (exchange.getStatus() == ExchangeStatus.ERROR) {
+ return;
+ }
+ Object input = jaxbContext.createUnmarshaller().unmarshal(exchange.getMessage("in").getContent());
+ Method method = methodMap.get(input.getClass());
+ if (method == null) {
+ throw new IllegalStateException("Could not determine invoked web method");
+ }
+ boolean oneWay = method.getReturnType() == null;
+ Object output;
+ try {
+ EntryPointContext entryPointContext = (EntryPointContext) ((ScaServiceUnit) serviceUnit)
+ .getTuscanyRuntime().getModuleContext().getContext(entryPoint.getName());
+ InvocationHandler handler = (InvocationHandler) entryPointContext.getImplementationInstance();
+ output = handler.invoke(null, method, new Object[] { input });
+ } catch (UndeclaredThrowableException e) {
+ throw e;
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Error e) {
+ throw e;
+ } catch (Exception e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new RuntimeException(e);
+ }
+ if (oneWay) {
+ exchange.setStatus(ExchangeStatus.DONE);
+ channel.send(exchange);
+ } else {
+ NormalizedMessage msg = exchange.createMessage();
+ exchange.setMessage(msg, "out");
+ StringWriter writer = new StringWriter();
+ jaxbContext.createMarshaller().marshal(output, writer);
+ msg.setContent(new StringSource(writer.toString()));
+ channel.send(exchange);
+ }
+ }
+
+ public void start() throws Exception {
+ }
+
+ public void stop() throws Exception {
+ }
+
+}
Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.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;
-
-import org.apache.servicemix.common.BaseComponent;
-import org.apache.servicemix.common.BaseLifeCycle;
-
-public class ScaLifeCycle extends BaseLifeCycle {
-
- public ScaLifeCycle(BaseComponent component) {
- super(component);
- }
-
-}
+/*
+ * 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;
+
+import org.apache.servicemix.common.BaseComponent;
+import org.apache.servicemix.common.BaseLifeCycle;
+
+public class ScaLifeCycle extends BaseLifeCycle {
+
+ public ScaLifeCycle(BaseComponent component) {
+ super(component);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaLifeCycle.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java Fri Aug 11 15:56:46 2006
@@ -1,111 +1,111 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicemix.sca;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Iterator;
-
-import javax.wsdl.Definition;
-import javax.wsdl.factory.WSDLFactory;
-
-import org.apache.servicemix.common.ServiceUnit;
-import org.apache.servicemix.sca.assembly.JbiBinding;
-import org.apache.servicemix.sca.tuscany.CommonsLoggingMonitorFactory;
-import org.apache.servicemix.sca.tuscany.TuscanyRuntime;
-import org.apache.tuscany.model.assembly.Binding;
-import org.apache.tuscany.model.assembly.EntryPoint;
-import org.apache.tuscany.model.assembly.Module;
-
-public class ScaServiceUnit extends ServiceUnit {
-
- protected static final ThreadLocal<ScaServiceUnit> SERVICE_UNIT = new ThreadLocal<ScaServiceUnit>();
-
- public static ScaServiceUnit getCurrentScaServiceUnit() {
- return SERVICE_UNIT.get();
- }
-
- protected TuscanyRuntime tuscanyRuntime;
- protected ClassLoader classLoader;
-
- public void init() throws Exception {
- SERVICE_UNIT.set(this);
- createScaRuntime();
- createEndpoints();
- SERVICE_UNIT.set(null);
- }
-
- protected void createScaRuntime() throws Exception {
- File root = new File(getRootPath());
- File[] files = root.listFiles(new JarFileFilter());
- URL[] urls = new URL[files.length + 1];
- for (int i = 0; i < files.length; i++) {
- urls[i] = files[i].toURL();
- }
- urls[urls.length - 1] = root.toURL();
- classLoader = new URLClassLoader(urls, getClass().getClassLoader());
-
- tuscanyRuntime = new TuscanyRuntime(getName(), getRootPath(), classLoader, new CommonsLoggingMonitorFactory());
- }
-
- protected void createEndpoints() throws Exception {
- Module module = tuscanyRuntime.getModuleComponent().getModuleImplementation();
- for (Iterator i = module.getEntryPoints().iterator(); i.hasNext();) {
- EntryPoint entryPoint = (EntryPoint) i.next();
- Binding binding = (Binding) entryPoint.getBindings().get(0);
- if (binding instanceof JbiBinding) {
- JbiBinding jbiBinding = (JbiBinding) binding;
- ScaEndpoint endpoint = new ScaEndpoint(entryPoint);
- endpoint.setServiceUnit(this);
- endpoint.setService(jbiBinding.getServiceName());
- endpoint.setEndpoint(jbiBinding.getEndpointName());
- endpoint.setInterfaceName(jbiBinding.getInterfaceName());
- Definition definition = jbiBinding.getDefinition();
- if (definition != null) {
- endpoint.setDefinition(definition);
- endpoint.setDescription(WSDLFactory.newInstance().newWSDLWriter().getDocument(definition));
- }
- addEndpoint(endpoint);
- }
- }
- }
-
- private static class JarFileFilter implements FilenameFilter {
- public boolean accept(File dir, String name) {
- return name.endsWith(".jar");
- }
- }
-
- public TuscanyRuntime getTuscanyRuntime() {
- return tuscanyRuntime;
- }
-
- @Override
- public void start() throws Exception {
- tuscanyRuntime.start();
- super.start();
- }
-
- @Override
- public void stop() throws Exception {
- super.stop();
- tuscanyRuntime.stop();
- }
-
-}
+/*
+ * 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;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+
+import org.apache.servicemix.common.ServiceUnit;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.tuscany.CommonsLoggingMonitorFactory;
+import org.apache.servicemix.sca.tuscany.TuscanyRuntime;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.Module;
+
+public class ScaServiceUnit extends ServiceUnit {
+
+ protected static final ThreadLocal<ScaServiceUnit> SERVICE_UNIT = new ThreadLocal<ScaServiceUnit>();
+
+ public static ScaServiceUnit getCurrentScaServiceUnit() {
+ return SERVICE_UNIT.get();
+ }
+
+ protected TuscanyRuntime tuscanyRuntime;
+ protected ClassLoader classLoader;
+
+ public void init() throws Exception {
+ SERVICE_UNIT.set(this);
+ createScaRuntime();
+ createEndpoints();
+ SERVICE_UNIT.set(null);
+ }
+
+ protected void createScaRuntime() throws Exception {
+ File root = new File(getRootPath());
+ File[] files = root.listFiles(new JarFileFilter());
+ URL[] urls = new URL[files.length + 1];
+ for (int i = 0; i < files.length; i++) {
+ urls[i] = files[i].toURL();
+ }
+ urls[urls.length - 1] = root.toURL();
+ classLoader = new URLClassLoader(urls, getClass().getClassLoader());
+
+ tuscanyRuntime = new TuscanyRuntime(getName(), getRootPath(), classLoader, new CommonsLoggingMonitorFactory());
+ }
+
+ protected void createEndpoints() throws Exception {
+ Module module = tuscanyRuntime.getModuleComponent().getModuleImplementation();
+ for (Iterator i = module.getEntryPoints().iterator(); i.hasNext();) {
+ EntryPoint entryPoint = (EntryPoint) i.next();
+ Binding binding = (Binding) entryPoint.getBindings().get(0);
+ if (binding instanceof JbiBinding) {
+ JbiBinding jbiBinding = (JbiBinding) binding;
+ ScaEndpoint endpoint = new ScaEndpoint(entryPoint);
+ endpoint.setServiceUnit(this);
+ endpoint.setService(jbiBinding.getServiceName());
+ endpoint.setEndpoint(jbiBinding.getEndpointName());
+ endpoint.setInterfaceName(jbiBinding.getInterfaceName());
+ Definition definition = jbiBinding.getDefinition();
+ if (definition != null) {
+ endpoint.setDefinition(definition);
+ endpoint.setDescription(WSDLFactory.newInstance().newWSDLWriter().getDocument(definition));
+ }
+ addEndpoint(endpoint);
+ }
+ }
+ }
+
+ private static class JarFileFilter implements FilenameFilter {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".jar");
+ }
+ }
+
+ public TuscanyRuntime getTuscanyRuntime() {
+ return tuscanyRuntime;
+ }
+
+ @Override
+ public void start() throws Exception {
+ tuscanyRuntime.start();
+ super.start();
+ }
+
+ @Override
+ public void stop() throws Exception {
+ super.stop();
+ tuscanyRuntime.stop();
+ }
+
+}
Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/ScaServiceUnit.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java Fri Aug 11 15:56:46 2006
@@ -1,31 +1,31 @@
-/*
- * 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.assembly;
-
-import org.apache.tuscany.model.assembly.AssemblyFactory;
-
-/**
- * The <b>Factory</b> for the model.
- */
-public interface JbiAssemblyFactory extends AssemblyFactory {
-
- /**
- * Returns a new JbiBinding
- */
- JbiBinding createJbiBinding();
-
-}
+/*
+ * 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.assembly;
+
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+
+/**
+ * The <b>Factory</b> for the model.
+ */
+public interface JbiAssemblyFactory extends AssemblyFactory {
+
+ /**
+ * Returns a new JbiBinding
+ */
+ JbiBinding createJbiBinding();
+
+}
Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiAssemblyFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java Fri Aug 11 15:56:46 2006
@@ -1,83 +1,83 @@
-/*
- * 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.assembly;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.model.assembly.Binding;
-
-public interface JbiBinding extends Binding {
-
- /**
- * Returns the URI of the WSDL port for this binding.
- * @return the URI of the WSDL port for this binding
- */
- String getPortURI();
-
- /**
- * Set the URI of the WSDL port for this binding.
- * @param portURI the URI of the WSDL port
- */
- void setPortURI(String portURI);
-
- /**
- * Returns the service name.
- * @return the service name
- */
- QName getServiceName();
-
- /**
- * Returns the endpoint name.
- * @return the endpoint name
- */
- String getEndpointName();
-
- /**
- * Returns the interface name.
- * @returnthe interface name
- */
- QName getInterfaceName();
-
- /**
- * Returns the WSDL definition containing the WSDL port.
- * @return the WSDL definition containing the WSDL port
- */
- Definition getDefinition();
-
- /**
- * Returns the the WSDL service.
- * @return the WSDL service
- */
- Service getService();
-
- /**
- * Returns the WSDL port defining this binding.
- * @return the WSDL port defining this binding
- */
- Port getPort();
-
- /**
- * Returns the WSDL port type.
- * @return the WSDL port type
- */
- PortType getPortType();
-
-}
+/*
+ * 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.assembly;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.model.assembly.Binding;
+
+public interface JbiBinding extends Binding {
+
+ /**
+ * Returns the URI of the WSDL port for this binding.
+ * @return the URI of the WSDL port for this binding
+ */
+ String getPortURI();
+
+ /**
+ * Set the URI of the WSDL port for this binding.
+ * @param portURI the URI of the WSDL port
+ */
+ void setPortURI(String portURI);
+
+ /**
+ * Returns the service name.
+ * @return the service name
+ */
+ QName getServiceName();
+
+ /**
+ * Returns the endpoint name.
+ * @return the endpoint name
+ */
+ String getEndpointName();
+
+ /**
+ * Returns the interface name.
+ * @returnthe interface name
+ */
+ QName getInterfaceName();
+
+ /**
+ * Returns the WSDL definition containing the WSDL port.
+ * @return the WSDL definition containing the WSDL port
+ */
+ Definition getDefinition();
+
+ /**
+ * Returns the the WSDL service.
+ * @return the WSDL service
+ */
+ Service getService();
+
+ /**
+ * Returns the WSDL port defining this binding.
+ * @return the WSDL port defining this binding
+ */
+ Port getPort();
+
+ /**
+ * Returns the WSDL port type.
+ * @return the WSDL port type
+ */
+ PortType getPortType();
+
+}
Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/JbiBinding.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java Fri Aug 11 15:56:46 2006
@@ -1,42 +1,42 @@
-/*
- * 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.assembly.impl;
-
-import org.apache.servicemix.sca.assembly.JbiAssemblyFactory;
-import org.apache.servicemix.sca.assembly.JbiBinding;
-import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl;
-
-/**
- * An implementation of the model <b>Factory</b>.
- */
-public class JbiAssemblyFactoryImpl extends AssemblyFactoryImpl implements JbiAssemblyFactory {
-
- /**
- * Creates an instance of the factory.
- */
- public JbiAssemblyFactoryImpl() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.apache.servicemix.sca.assembly.JbiAssemblyFactory#createJbiBinding()
- */
- public JbiBinding createJbiBinding() {
- return new JbiBindingImpl();
- }
-
-}
+/*
+ * 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.assembly.impl;
+
+import org.apache.servicemix.sca.assembly.JbiAssemblyFactory;
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl;
+
+/**
+ * An implementation of the model <b>Factory</b>.
+ */
+public class JbiAssemblyFactoryImpl extends AssemblyFactoryImpl implements JbiAssemblyFactory {
+
+ /**
+ * Creates an instance of the factory.
+ */
+ public JbiAssemblyFactoryImpl() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiAssemblyFactory#createJbiBinding()
+ */
+ public JbiBinding createJbiBinding() {
+ return new JbiBindingImpl();
+ }
+
+}
Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiAssemblyFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java Fri Aug 11 15:56:46 2006
@@ -1,164 +1,164 @@
-/*
- * 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.assembly.impl;
-
-import java.util.List;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.xml.namespace.QName;
-
-import org.apache.servicemix.sca.assembly.JbiBinding;
-import org.apache.tuscany.model.assembly.AssemblyModelContext;
-import org.apache.tuscany.model.assembly.impl.BindingImpl;
-
-/**
- * An implementation of the model object '<em><b>Web Service Binding</b></em>'.
- */
-public class JbiBindingImpl extends BindingImpl implements JbiBinding {
-
- private String portURI;
- private QName serviceName;
- private String endpointName;
- private QName interfaceName;
- private Definition definition;
- private Service service;
- private PortType portType;
- private Port port;
-
-
- /**
- * Constructor
- */
- protected JbiBindingImpl() {
- }
-
- /* (non-Javadoc)
- * @see org.apache.servicemix.sca.assembly.JbiBinding#getPortURI()
- */
- public String getPortURI() {
- return portURI;
- }
-
- /* (non-Javadoc)
- * @see org.apache.servicemix.sca.assembly.JbiBinding#setPortURI(java.lang.String)
- */
- public void setPortURI(String portURI) {
- this.portURI = portURI;
- }
-
- /* (non-Javadoc)
- * @see org.apache.servicemix.sca.assembly.JbiBinding#getServiceName()
- */
- public QName getServiceName() {
- return serviceName;
- }
-
- /* (non-Javadoc)
- * @see org.apache.servicemix.sca.assembly.JbiBinding#getEndpointName()
- */
- public String getEndpointName() {
- return endpointName;
- }
-
- /* (non-Javadoc)
- * @see org.apache.servicemix.sca.assembly.JbiBinding#getInterfaceName()
- */
- public QName getInterfaceName() {
- return interfaceName;
- }
-
- /* (non-Javadoc)
- * @see org.apache.servicemix.sca.assembly.JbiBinding#getDefinition()
- */
- public Definition getDefinition() {
- return definition;
- }
-
- /* (non-Javadoc)
- * @see org.apache.servicemix.sca.assembly.JbiBinding#getService()
- */
- public Service getService() {
- return service;
- }
-
- /* (non-Javadoc)
- * @see org.apache.servicemix.sca.assembly.JbiBinding#getPort()
- */
- public Port getPort() {
- return port;
- }
-
- /* (non-Javadoc)
- * @see org.apache.servicemix.sca.assembly.JbiBinding#getPortType()
- */
- public PortType getPortType() {
- return portType;
- }
-
- /**
- * @see org.apache.tuscany.model.assembly.impl.BindingImpl#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
- */
- public void initialize(AssemblyModelContext modelContext) {
- if (isInitialized())
- return;
- super.initialize(modelContext);
-
- // Get the service name and endpoint name
- String[] parts = split(portURI);
- serviceName = new QName(parts[0], parts[1]);
- endpointName = parts[2];
-
- // Load the WSDL definitions for the given namespace
- List<Definition> definitions = modelContext.getAssemblyLoader().loadDefinitions(parts[0]);
- if (definitions != null) {
- for (Definition definition : definitions) {
- Service service = definition.getService(serviceName);
- if (service != null) {
- Port port = service.getPort(endpointName);
- if (port != null) {
- this.service = service;
- this.port = port;
- this.portType = port.getBinding().getPortType();
- this.interfaceName = portType.getQName();
- this.definition = definition;
- return;
- }
- }
- }
- }
- }
-
- protected String[] split(String uri) {
- char sep;
- uri = uri.trim();
- if (uri.indexOf('/') > 0) {
- sep = '/';
- } else {
- sep = ':';
- }
- int idx1 = uri.lastIndexOf(sep);
- int idx2 = uri.lastIndexOf(sep, idx1 - 1);
- String epName = uri.substring(idx1 + 1);
- String svcName = uri.substring(idx2 + 1, idx1);
- String nsUri = uri.substring(0, idx2);
- return new String[] { nsUri, svcName, epName };
- }
-
-}
+/*
+ * 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.assembly.impl;
+
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.impl.BindingImpl;
+
+/**
+ * An implementation of the model object '<em><b>Web Service Binding</b></em>'.
+ */
+public class JbiBindingImpl extends BindingImpl implements JbiBinding {
+
+ private String portURI;
+ private QName serviceName;
+ private String endpointName;
+ private QName interfaceName;
+ private Definition definition;
+ private Service service;
+ private PortType portType;
+ private Port port;
+
+
+ /**
+ * Constructor
+ */
+ protected JbiBindingImpl() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getPortURI()
+ */
+ public String getPortURI() {
+ return portURI;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#setPortURI(java.lang.String)
+ */
+ public void setPortURI(String portURI) {
+ this.portURI = portURI;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getServiceName()
+ */
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getEndpointName()
+ */
+ public String getEndpointName() {
+ return endpointName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getInterfaceName()
+ */
+ public QName getInterfaceName() {
+ return interfaceName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getDefinition()
+ */
+ public Definition getDefinition() {
+ return definition;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getService()
+ */
+ public Service getService() {
+ return service;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getPort()
+ */
+ public Port getPort() {
+ return port;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.servicemix.sca.assembly.JbiBinding#getPortType()
+ */
+ public PortType getPortType() {
+ return portType;
+ }
+
+ /**
+ * @see org.apache.tuscany.model.assembly.impl.BindingImpl#initialize(org.apache.tuscany.model.assembly.AssemblyModelContext)
+ */
+ public void initialize(AssemblyModelContext modelContext) {
+ if (isInitialized())
+ return;
+ super.initialize(modelContext);
+
+ // Get the service name and endpoint name
+ String[] parts = split(portURI);
+ serviceName = new QName(parts[0], parts[1]);
+ endpointName = parts[2];
+
+ // Load the WSDL definitions for the given namespace
+ List<Definition> definitions = modelContext.getAssemblyLoader().loadDefinitions(parts[0]);
+ if (definitions != null) {
+ for (Definition definition : definitions) {
+ Service service = definition.getService(serviceName);
+ if (service != null) {
+ Port port = service.getPort(endpointName);
+ if (port != null) {
+ this.service = service;
+ this.port = port;
+ this.portType = port.getBinding().getPortType();
+ this.interfaceName = portType.getQName();
+ this.definition = definition;
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ protected String[] split(String uri) {
+ char sep;
+ uri = uri.trim();
+ if (uri.indexOf('/') > 0) {
+ sep = '/';
+ } else {
+ sep = ':';
+ }
+ int idx1 = uri.lastIndexOf(sep);
+ int idx2 = uri.lastIndexOf(sep, idx1 - 1);
+ String epName = uri.substring(idx1 + 1);
+ String svcName = uri.substring(idx2 + 1, idx1);
+ String nsUri = uri.substring(0, idx2);
+ return new String[] { nsUri, svcName, epName };
+ }
+
+}
Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/assembly/impl/JbiBindingImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java Fri Aug 11 15:56:46 2006
@@ -1,149 +1,149 @@
-/*
- * 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.builder;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.servicemix.sca.assembly.JbiBinding;
-import org.apache.servicemix.sca.config.ExternalJbiServiceContextFactory;
-import org.apache.servicemix.sca.handler.ExternalJbiServiceClient;
-import org.apache.tuscany.core.builder.BuilderException;
-import org.apache.tuscany.core.builder.ContextFactoryBuilder;
-import org.apache.tuscany.core.config.JavaIntrospectionHelper;
-import org.apache.tuscany.core.context.QualifiedName;
-import org.apache.tuscany.core.injection.SingletonObjectFactory;
-import org.apache.tuscany.core.invocation.InvocationConfiguration;
-import org.apache.tuscany.core.invocation.MethodHashMap;
-import org.apache.tuscany.core.invocation.ProxyConfiguration;
-import org.apache.tuscany.core.invocation.impl.InvokerInterceptor;
-import org.apache.tuscany.core.invocation.spi.ProxyFactory;
-import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory;
-import org.apache.tuscany.core.message.MessageFactory;
-import org.apache.tuscany.core.runtime.RuntimeContext;
-import org.apache.tuscany.core.system.annotation.Autowire;
-import org.apache.tuscany.model.assembly.AssemblyModelObject;
-import org.apache.tuscany.model.assembly.ConfiguredService;
-import org.apache.tuscany.model.assembly.ExternalService;
-import org.apache.tuscany.model.assembly.Service;
-import org.apache.tuscany.model.assembly.ServiceContract;
-import org.apache.tuscany.model.scdl.WebServiceBinding;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Scope;
-
-/**
- * Creates a <code>RuntimeConfigurationBuilder</code> for an external service configured with the {@link WebServiceBinding}
- */
-@Scope("MODULE")
-public class ExternalJbiServiceBuilder implements ContextFactoryBuilder {
-
- private RuntimeContext runtimeContext;
-
- private ProxyFactoryFactory proxyFactoryFactory;
-
- private MessageFactory messageFactory;
-
- private ContextFactoryBuilder policyBuilder;
-
- public ExternalJbiServiceBuilder() {
- }
-
- @Init(eager = true)
- public void init() {
- runtimeContext.addBuilder(this);
- }
-
- /**
- * @param runtimeContext The runtimeContext to set.
- */
- @Autowire
- public void setRuntimeContext(RuntimeContext runtimeContext) {
- this.runtimeContext = runtimeContext;
- }
-
- /**
- * Sets the factory used to construct proxies implmementing the business interface required by a reference
- */
- @Autowire
- public void setProxyFactoryFactory(ProxyFactoryFactory factory) {
- this.proxyFactoryFactory = factory;
- }
-
- /**
- * Sets the factory used to construct invocation messages
- *
- * @param msgFactory
- */
- @Autowire
- public void setMessageFactory(MessageFactory msgFactory) {
- this.messageFactory = msgFactory;
- }
-
- /**
- * Sets a builder responsible for creating source-side and target-side invocation chains for a reference. The
- * reference builder may be hierarchical, containing other child reference builders that operate on specific
- * metadata used to construct and invocation chain.
- *
- * @see org.apache.tuscany.core.builder.impl.HierarchicalBuilder
- */
- public void setPolicyBuilder(ContextFactoryBuilder builder) {
- policyBuilder = builder;
- }
-
- public void build(AssemblyModelObject object) throws BuilderException {
- if (!(object instanceof ExternalService)) {
- return;
- }
- ExternalService externalService = (ExternalService) object;
- if (externalService.getBindings().size() < 1 || !(externalService.getBindings().get(0) instanceof JbiBinding)) {
- return;
- }
-
- ExternalJbiServiceClient externalJbiServiceClient = new ExternalJbiServiceClient(externalService);
- ExternalJbiServiceContextFactory config = new ExternalJbiServiceContextFactory(externalService.getName(), new SingletonObjectFactory<ExternalJbiServiceClient>(externalJbiServiceClient));
-
- ConfiguredService configuredService = externalService.getConfiguredService();
- Service service = configuredService.getService();
- ServiceContract serviceContract = service.getServiceContract();
- Map<Method, InvocationConfiguration> iConfigMap = new MethodHashMap();
- ProxyFactory proxyFactory = proxyFactoryFactory.createProxyFactory();
- Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(serviceContract.getInterface());
- for (Method method : javaMethods) {
- InvocationConfiguration iConfig = new InvocationConfiguration(method);
- iConfigMap.put(method, iConfig);
- }
- QualifiedName qName = new QualifiedName(externalService.getName() + "/" + service.getName());
- ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory);
- proxyFactory.setBusinessInterface(serviceContract.getInterface());
- proxyFactory.setProxyConfiguration(pConfiguration);
- config.addTargetProxyFactory(service.getName(), proxyFactory);
- configuredService.setProxyFactory(proxyFactory);
- if (policyBuilder != null) {
- // invoke the reference builder to handle additional policy metadata
- policyBuilder.build(configuredService);
- }
- // add tail interceptor
- for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) {
- iConfig.addTargetInterceptor(new InvokerInterceptor());
- }
-
- externalService.getConfiguredService().setContextFactory(config);
- }
-
-}
+/*
+ * 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.builder;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.config.ExternalJbiServiceContextFactory;
+import org.apache.servicemix.sca.handler.ExternalJbiServiceClient;
+import org.apache.tuscany.core.builder.BuilderException;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.config.JavaIntrospectionHelper;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.MethodHashMap;
+import org.apache.tuscany.core.invocation.ProxyConfiguration;
+import org.apache.tuscany.core.invocation.impl.InvokerInterceptor;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory;
+import org.apache.tuscany.core.message.MessageFactory;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.apache.tuscany.model.assembly.AssemblyModelObject;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceContract;
+import org.apache.tuscany.model.scdl.WebServiceBinding;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * Creates a <code>RuntimeConfigurationBuilder</code> for an external service configured with the {@link WebServiceBinding}
+ */
+@Scope("MODULE")
+public class ExternalJbiServiceBuilder implements ContextFactoryBuilder {
+
+ private RuntimeContext runtimeContext;
+
+ private ProxyFactoryFactory proxyFactoryFactory;
+
+ private MessageFactory messageFactory;
+
+ private ContextFactoryBuilder policyBuilder;
+
+ public ExternalJbiServiceBuilder() {
+ }
+
+ @Init(eager = true)
+ public void init() {
+ runtimeContext.addBuilder(this);
+ }
+
+ /**
+ * @param runtimeContext The runtimeContext to set.
+ */
+ @Autowire
+ public void setRuntimeContext(RuntimeContext runtimeContext) {
+ this.runtimeContext = runtimeContext;
+ }
+
+ /**
+ * Sets the factory used to construct proxies implmementing the business interface required by a reference
+ */
+ @Autowire
+ public void setProxyFactoryFactory(ProxyFactoryFactory factory) {
+ this.proxyFactoryFactory = factory;
+ }
+
+ /**
+ * Sets the factory used to construct invocation messages
+ *
+ * @param msgFactory
+ */
+ @Autowire
+ public void setMessageFactory(MessageFactory msgFactory) {
+ this.messageFactory = msgFactory;
+ }
+
+ /**
+ * Sets a builder responsible for creating source-side and target-side invocation chains for a reference. The
+ * reference builder may be hierarchical, containing other child reference builders that operate on specific
+ * metadata used to construct and invocation chain.
+ *
+ * @see org.apache.tuscany.core.builder.impl.HierarchicalBuilder
+ */
+ public void setPolicyBuilder(ContextFactoryBuilder builder) {
+ policyBuilder = builder;
+ }
+
+ public void build(AssemblyModelObject object) throws BuilderException {
+ if (!(object instanceof ExternalService)) {
+ return;
+ }
+ ExternalService externalService = (ExternalService) object;
+ if (externalService.getBindings().size() < 1 || !(externalService.getBindings().get(0) instanceof JbiBinding)) {
+ return;
+ }
+
+ ExternalJbiServiceClient externalJbiServiceClient = new ExternalJbiServiceClient(externalService);
+ ExternalJbiServiceContextFactory config = new ExternalJbiServiceContextFactory(externalService.getName(), new SingletonObjectFactory<ExternalJbiServiceClient>(externalJbiServiceClient));
+
+ ConfiguredService configuredService = externalService.getConfiguredService();
+ Service service = configuredService.getService();
+ ServiceContract serviceContract = service.getServiceContract();
+ Map<Method, InvocationConfiguration> iConfigMap = new MethodHashMap();
+ ProxyFactory proxyFactory = proxyFactoryFactory.createProxyFactory();
+ Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(serviceContract.getInterface());
+ for (Method method : javaMethods) {
+ InvocationConfiguration iConfig = new InvocationConfiguration(method);
+ iConfigMap.put(method, iConfig);
+ }
+ QualifiedName qName = new QualifiedName(externalService.getName() + "/" + service.getName());
+ ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory);
+ proxyFactory.setBusinessInterface(serviceContract.getInterface());
+ proxyFactory.setProxyConfiguration(pConfiguration);
+ config.addTargetProxyFactory(service.getName(), proxyFactory);
+ configuredService.setProxyFactory(proxyFactory);
+ if (policyBuilder != null) {
+ // invoke the reference builder to handle additional policy metadata
+ policyBuilder.build(configuredService);
+ }
+ // add tail interceptor
+ for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) {
+ iConfig.addTargetInterceptor(new InvokerInterceptor());
+ }
+
+ externalService.getConfiguredService().setContextFactory(config);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java Fri Aug 11 15:56:46 2006
@@ -1,68 +1,68 @@
-/*
- * 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.builder;
-
-import org.apache.servicemix.sca.config.ExternalJbiServiceContextFactory;
-import org.apache.servicemix.sca.handler.ExternalJbiServiceTargetInvoker;
-import org.apache.tuscany.core.builder.BuilderConfigException;
-import org.apache.tuscany.core.builder.WireBuilder;
-import org.apache.tuscany.core.context.ScopeContext;
-import org.apache.tuscany.core.invocation.InvocationConfiguration;
-import org.apache.tuscany.core.invocation.spi.ProxyFactory;
-import org.apache.tuscany.core.runtime.RuntimeContext;
-import org.apache.tuscany.core.system.annotation.Autowire;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Scope;
-
-@Scope("MODULE")
-public class ExternalJbiServiceWireBuilder implements WireBuilder {
-
- private RuntimeContext runtimeContext;
-
- /**
- * Constructs a new ExternalWebServiceWireBuilder.
- */
- public ExternalJbiServiceWireBuilder() {
- super();
- }
-
- @Autowire
- public void setRuntimeContext(RuntimeContext context) {
- runtimeContext = context;
- }
-
- @Init(eager=true)
- public void init() {
- runtimeContext.addBuilder(this);
- }
-
- public void connect(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope, ScopeContext targetScopeContext) throws BuilderConfigException {
- if (!(ExternalJbiServiceContextFactory.class.isAssignableFrom(targetType))) {
- return;
- }
- for (InvocationConfiguration sourceInvocationConfig : sourceFactory.getProxyConfiguration().getInvocationConfigurations().values()) {
- ExternalJbiServiceTargetInvoker invoker = new ExternalJbiServiceTargetInvoker(sourceFactory.getProxyConfiguration().getTargetName(), sourceInvocationConfig.getMethod(), targetScopeContext);
- sourceInvocationConfig.setTargetInvoker(invoker);
- }
- }
-
- public void completeTargetChain(ProxyFactory targetFactory, Class targetType, ScopeContext targetScopeContext)
- throws BuilderConfigException {
- //TODO implement
- }
-
-}
+/*
+ * 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.builder;
+
+import org.apache.servicemix.sca.config.ExternalJbiServiceContextFactory;
+import org.apache.servicemix.sca.handler.ExternalJbiServiceTargetInvoker;
+import org.apache.tuscany.core.builder.BuilderConfigException;
+import org.apache.tuscany.core.builder.WireBuilder;
+import org.apache.tuscany.core.context.ScopeContext;
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("MODULE")
+public class ExternalJbiServiceWireBuilder implements WireBuilder {
+
+ private RuntimeContext runtimeContext;
+
+ /**
+ * Constructs a new ExternalWebServiceWireBuilder.
+ */
+ public ExternalJbiServiceWireBuilder() {
+ super();
+ }
+
+ @Autowire
+ public void setRuntimeContext(RuntimeContext context) {
+ runtimeContext = context;
+ }
+
+ @Init(eager=true)
+ public void init() {
+ runtimeContext.addBuilder(this);
+ }
+
+ public void connect(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope, ScopeContext targetScopeContext) throws BuilderConfigException {
+ if (!(ExternalJbiServiceContextFactory.class.isAssignableFrom(targetType))) {
+ return;
+ }
+ for (InvocationConfiguration sourceInvocationConfig : sourceFactory.getProxyConfiguration().getInvocationConfigurations().values()) {
+ ExternalJbiServiceTargetInvoker invoker = new ExternalJbiServiceTargetInvoker(sourceFactory.getProxyConfiguration().getTargetName(), sourceInvocationConfig.getMethod(), targetScopeContext);
+ sourceInvocationConfig.setTargetInvoker(invoker);
+ }
+ }
+
+ public void completeTargetChain(ProxyFactory targetFactory, Class targetType, ScopeContext targetScopeContext)
+ throws BuilderConfigException {
+ //TODO implement
+ }
+
+}
Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/ExternalJbiServiceWireBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java Fri Aug 11 15:56:46 2006
@@ -1,167 +1,167 @@
-/*
- * 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.builder;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.servicemix.sca.assembly.JbiBinding;
-import org.apache.servicemix.sca.config.JbiServiceEntryPointContextFactory;
-import org.apache.tuscany.core.builder.BuilderException;
-import org.apache.tuscany.core.builder.ContextFactoryBuilder;
-import org.apache.tuscany.core.builder.impl.EntryPointContextFactory;
-import org.apache.tuscany.core.config.JavaIntrospectionHelper;
-import org.apache.tuscany.core.context.AggregateContext;
-import org.apache.tuscany.core.context.QualifiedName;
-import org.apache.tuscany.core.invocation.Interceptor;
-import org.apache.tuscany.core.invocation.InvocationConfiguration;
-import org.apache.tuscany.core.invocation.InvocationRuntimeException;
-import org.apache.tuscany.core.invocation.ProxyConfiguration;
-import org.apache.tuscany.core.invocation.TargetInvoker;
-import org.apache.tuscany.core.invocation.spi.ProxyFactory;
-import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory;
-import org.apache.tuscany.core.message.Message;
-import org.apache.tuscany.core.message.MessageFactory;
-import org.apache.tuscany.core.runtime.RuntimeContext;
-import org.apache.tuscany.core.system.annotation.Autowire;
-import org.apache.tuscany.model.assembly.AssemblyModelObject;
-import org.apache.tuscany.model.assembly.ConfiguredService;
-import org.apache.tuscany.model.assembly.EntryPoint;
-import org.apache.tuscany.model.assembly.Service;
-import org.apache.tuscany.model.assembly.ServiceContract;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Scope;
-
-@Scope("MODULE")
-public class JbiServiceEntryPointBuilder implements ContextFactoryBuilder<AggregateContext> {
-
- private RuntimeContext runtimeContext;
-
- private ProxyFactoryFactory proxyFactoryFactory;
-
- private MessageFactory messageFactory;
-
- private ContextFactoryBuilder policyBuilder;
-
- public JbiServiceEntryPointBuilder() {
- }
-
- @Init(eager = true)
- public void init() {
- runtimeContext.addBuilder(this);
- }
-
- /**
- * @param runtimeContext The runtimeContext to set.
- */
- @Autowire
- public void setRuntimeContext(RuntimeContext runtimeContext) {
- this.runtimeContext = runtimeContext;
- }
-
- /**
- * Sets the factory used to construct proxies implmementing the business interface required by a reference
- */
- @Autowire
- public void setProxyFactoryFactory(ProxyFactoryFactory factory) {
- this.proxyFactoryFactory = factory;
- }
-
- /**
- * Sets the factory used to construct invocation messages
- *
- * @param msgFactory
- */
- @Autowire
- public void setMessageFactory(MessageFactory msgFactory) {
- this.messageFactory = msgFactory;
- }
-
- /**
- * Sets a builder responsible for creating source-side and target-side invocation chains for a reference. The
- * reference builder may be hierarchical, containing other child reference builders that operate on specific
- * metadata used to construct and invocation chain.
- *
- * @see org.apache.tuscany.core.builder.impl.HierarchicalBuilder
- */
- public void setPolicyBuilder(ContextFactoryBuilder builder) {
- policyBuilder = builder;
- }
-
- public void build(AssemblyModelObject object) throws BuilderException {
- if (!(object instanceof EntryPoint)) {
- return;
- }
- EntryPoint entryPoint = (EntryPoint) object;
- if (entryPoint.getBindings().size() < 1 || !(entryPoint.getBindings().get(0) instanceof JbiBinding)) {
- return;
- }
-
- EntryPointContextFactory config = new JbiServiceEntryPointContextFactory(entryPoint.getName(), entryPoint.getConfiguredService().getService().getName(), messageFactory);
-
- ConfiguredService configuredService = entryPoint.getConfiguredService();
- Service service = configuredService.getService();
- ServiceContract serviceContract = service.getServiceContract();
- Map<Method, InvocationConfiguration> iConfigMap = new HashMap<Method, InvocationConfiguration>();
- ProxyFactory proxyFactory = proxyFactoryFactory.createProxyFactory();
- Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(serviceContract.getInterface());
- for (Method method : javaMethods) {
- InvocationConfiguration iConfig = new InvocationConfiguration(method);
- iConfigMap.put(method, iConfig);
- }
- QualifiedName qName = new QualifiedName(entryPoint.getConfiguredReference().getTargetConfiguredServices().get(0).getAggregatePart().getName() + "/" + service.getName());
- ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory);
- proxyFactory.setBusinessInterface(serviceContract.getInterface());
- proxyFactory.setProxyConfiguration(pConfiguration);
- config.addSourceProxyFactory(service.getName(), proxyFactory);
- configuredService.setProxyFactory(proxyFactory);
- if (policyBuilder != null) {
- // invoke the reference builder to handle additional policy metadata
- policyBuilder.build(configuredService);
- }
- // add tail interceptor
- for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) {
- iConfig.addTargetInterceptor(new EntryPointInvokerInterceptor());
- }
- entryPoint.getConfiguredReference().setContextFactory(config);
- }
-
- //FIXME same as the InvokerInterceptor except that it doesn't throw an exception in setNext
- // For some reason another InvokerInterceptor is added after this one, need Jim to look into it
- // and figure out why.
- public class EntryPointInvokerInterceptor implements Interceptor {
-
- public EntryPointInvokerInterceptor() {
- }
-
- public Message invoke(Message msg) throws InvocationRuntimeException {
- TargetInvoker invoker = msg.getTargetInvoker();
- if (invoker == null) {
- throw new InvocationRuntimeException("No target invoker specified on message");
- }
- return invoker.invoke(msg);
- }
-
- public void setNext(Interceptor next) {
- }
-
- }
-
-}
+/*
+ * 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.builder;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.servicemix.sca.assembly.JbiBinding;
+import org.apache.servicemix.sca.config.JbiServiceEntryPointContextFactory;
+import org.apache.tuscany.core.builder.BuilderException;
+import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.builder.impl.EntryPointContextFactory;
+import org.apache.tuscany.core.config.JavaIntrospectionHelper;
+import org.apache.tuscany.core.context.AggregateContext;
+import org.apache.tuscany.core.context.QualifiedName;
+import org.apache.tuscany.core.invocation.Interceptor;
+import org.apache.tuscany.core.invocation.InvocationConfiguration;
+import org.apache.tuscany.core.invocation.InvocationRuntimeException;
+import org.apache.tuscany.core.invocation.ProxyConfiguration;
+import org.apache.tuscany.core.invocation.TargetInvoker;
+import org.apache.tuscany.core.invocation.spi.ProxyFactory;
+import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory;
+import org.apache.tuscany.core.message.Message;
+import org.apache.tuscany.core.message.MessageFactory;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.apache.tuscany.model.assembly.AssemblyModelObject;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.ServiceContract;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("MODULE")
+public class JbiServiceEntryPointBuilder implements ContextFactoryBuilder<AggregateContext> {
+
+ private RuntimeContext runtimeContext;
+
+ private ProxyFactoryFactory proxyFactoryFactory;
+
+ private MessageFactory messageFactory;
+
+ private ContextFactoryBuilder policyBuilder;
+
+ public JbiServiceEntryPointBuilder() {
+ }
+
+ @Init(eager = true)
+ public void init() {
+ runtimeContext.addBuilder(this);
+ }
+
+ /**
+ * @param runtimeContext The runtimeContext to set.
+ */
+ @Autowire
+ public void setRuntimeContext(RuntimeContext runtimeContext) {
+ this.runtimeContext = runtimeContext;
+ }
+
+ /**
+ * Sets the factory used to construct proxies implmementing the business interface required by a reference
+ */
+ @Autowire
+ public void setProxyFactoryFactory(ProxyFactoryFactory factory) {
+ this.proxyFactoryFactory = factory;
+ }
+
+ /**
+ * Sets the factory used to construct invocation messages
+ *
+ * @param msgFactory
+ */
+ @Autowire
+ public void setMessageFactory(MessageFactory msgFactory) {
+ this.messageFactory = msgFactory;
+ }
+
+ /**
+ * Sets a builder responsible for creating source-side and target-side invocation chains for a reference. The
+ * reference builder may be hierarchical, containing other child reference builders that operate on specific
+ * metadata used to construct and invocation chain.
+ *
+ * @see org.apache.tuscany.core.builder.impl.HierarchicalBuilder
+ */
+ public void setPolicyBuilder(ContextFactoryBuilder builder) {
+ policyBuilder = builder;
+ }
+
+ public void build(AssemblyModelObject object) throws BuilderException {
+ if (!(object instanceof EntryPoint)) {
+ return;
+ }
+ EntryPoint entryPoint = (EntryPoint) object;
+ if (entryPoint.getBindings().size() < 1 || !(entryPoint.getBindings().get(0) instanceof JbiBinding)) {
+ return;
+ }
+
+ EntryPointContextFactory config = new JbiServiceEntryPointContextFactory(entryPoint.getName(), entryPoint.getConfiguredService().getService().getName(), messageFactory);
+
+ ConfiguredService configuredService = entryPoint.getConfiguredService();
+ Service service = configuredService.getService();
+ ServiceContract serviceContract = service.getServiceContract();
+ Map<Method, InvocationConfiguration> iConfigMap = new HashMap<Method, InvocationConfiguration>();
+ ProxyFactory proxyFactory = proxyFactoryFactory.createProxyFactory();
+ Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(serviceContract.getInterface());
+ for (Method method : javaMethods) {
+ InvocationConfiguration iConfig = new InvocationConfiguration(method);
+ iConfigMap.put(method, iConfig);
+ }
+ QualifiedName qName = new QualifiedName(entryPoint.getConfiguredReference().getTargetConfiguredServices().get(0).getAggregatePart().getName() + "/" + service.getName());
+ ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory);
+ proxyFactory.setBusinessInterface(serviceContract.getInterface());
+ proxyFactory.setProxyConfiguration(pConfiguration);
+ config.addSourceProxyFactory(service.getName(), proxyFactory);
+ configuredService.setProxyFactory(proxyFactory);
+ if (policyBuilder != null) {
+ // invoke the reference builder to handle additional policy metadata
+ policyBuilder.build(configuredService);
+ }
+ // add tail interceptor
+ for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) {
+ iConfig.addTargetInterceptor(new EntryPointInvokerInterceptor());
+ }
+ entryPoint.getConfiguredReference().setContextFactory(config);
+ }
+
+ //FIXME same as the InvokerInterceptor except that it doesn't throw an exception in setNext
+ // For some reason another InvokerInterceptor is added after this one, need Jim to look into it
+ // and figure out why.
+ public class EntryPointInvokerInterceptor implements Interceptor {
+
+ public EntryPointInvokerInterceptor() {
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ TargetInvoker invoker = msg.getTargetInvoker();
+ if (invoker == null) {
+ throw new InvocationRuntimeException("No target invoker specified on message");
+ }
+ return invoker.invoke(msg);
+ }
+
+ public void setNext(Interceptor next) {
+ }
+
+ }
+
+}
Propchange: incubator/tuscany/java/sca/bindings/binding.servicemix/src/main/java/org/apache/servicemix/sca/builder/JbiServiceEntryPointBuilder.java
------------------------------------------------------------------------------
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