diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:11:40 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:11:40 +0000 |
commit | 76e9f96ca7f494088fe3af5a46ad0d153e961008 (patch) | |
tree | e44436205dcb28d3d8c6352fa7b36a90f59db2a1 /branches/java-M1/java/sca | |
parent | f9be2165328dc76f562938566057e89c0723fe08 (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835139 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/java-M1/java/sca')
881 files changed, 0 insertions, 83478 deletions
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/pom.xml b/branches/java-M1/java/sca/bindings/binding.axis2/pom.xml deleted file mode 100644 index f35a4735fb..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/pom.xml +++ /dev/null @@ -1,150 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<project>
-
- <parent>
- <groupId>org.apache.tuscany.sca.bindings</groupId>
- <artifactId>tuscany-sca-bindings</artifactId>
- <version>incubating-M1</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>tuscany-binding-axis2</artifactId>
- <name>Tuscany Axis2 Binding</name>
- <description>Implementation of the SCA Web Services binding using Axis2.</description>
- <version>incubating-M1</version>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>${pom.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.databinding</groupId>
- <artifactId>tuscany-databinding-sdo</artifactId> <!-- Reqd for E4X -->
- <version>${pom.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca.containers</groupId>
- <artifactId>tuscany-container-java</artifactId>
- <version>${pom.version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- axis 2.0 -->
- <dependency>
- <groupId>axis2</groupId>
- <artifactId>axis2-kernel</artifactId>
- <version>1.0</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>ws-commons</groupId>
- <artifactId>axiom-api</artifactId>
- <version>1.0</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>ws-commons</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.0</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>ws-commons</groupId>
- <artifactId>neethi</artifactId>
- <version>1.0.1</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons</groupId>
- <artifactId>XmlSchema</artifactId>
- <version>1.0.2</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.0</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.3</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- <version>1.5.2</version>
- </dependency>
-
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>2.9.3</version>
- <scope>runtime</scope>
- </dependency>
-
- <!-- end of axis 2.0 -->
-
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>servlet-api</artifactId>
- <version>5.0.18</version>
- <scope>provided</scope>
- </dependency>
-
- </dependencies>
- <!-- buildSource>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- <excludes>
- <exclude>**/org/apache/tuscany/binding/axis/engine/config/AxisEngineConfigurationFactory.java</exclude>
- <exclude>**/org/apache/tuscany/binding/axis/handler/WebServiceEntryPointBean.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
-
- </buildSource -->
-</project>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceAssemblyFactory.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceAssemblyFactory.java deleted file mode 100644 index 8114b348d1..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceAssemblyFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly; - -import org.apache.tuscany.model.assembly.AssemblyFactory; - -/** - * The <b>Factory</b> for the model. - */ -public interface WebServiceAssemblyFactory extends AssemblyFactory { - - /** - * Returns a new WebServiceBinding. - */ - WebServiceBinding createWebServiceBinding(); - -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceBinding.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceBinding.java deleted file mode 100644 index ea9f3f116f..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceBinding.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly; - -import javax.wsdl.Definition; -import javax.wsdl.Port; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.Binding; - -import commonj.sdo.helper.TypeHelper; - -/** - * Represents a Web service binding. - */ -public interface WebServiceBinding extends Binding { - - /** - * Set the URI of the WSDL port for this binding. - * - * @param portURI - * the URI of the WSDL port - */ - void setPortURI(String portURI); - - /** - * Returns the WSDL port defining this binding. - */ - Port getWSDLPort(); - - /** - * Returns the WSDL definition containing the WSDL port. - * - * @return the WSDL definition containing the WSDL port - */ - Definition getWSDLDefinition(); - - /** - * Sets the WSDL port defining this binding. - */ - void setWSDLPort(Port value); - - /** - * Sets the WSDL definition containing the WSDL port. - * - * @param definition - */ - void setWSDLDefinition(Definition definition); - - TypeHelper getTypeHelper(); - - void setTypeHelper(TypeHelper typeHelper); - - ResourceLoader getResourceLoader(); - - void setResourceLoader(ResourceLoader resourceLoader); - - public void setWebAppName(String webAppName); - - public String getWebAppName(); -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceAssemblyFactoryImpl.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceAssemblyFactoryImpl.java deleted file mode 100644 index 5523d8fdc0..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceAssemblyFactoryImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.impl; - -import org.apache.tuscany.binding.axis2.assembly.WebServiceAssemblyFactory; -import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; -import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; - -/** - * An implementation of the model <b>Factory</b>. - */ -public class WebServiceAssemblyFactoryImpl extends AssemblyFactoryImpl implements WebServiceAssemblyFactory { - - /** - * Creates an instance of the factory. - */ - public WebServiceAssemblyFactoryImpl() { - super(); - } - - /** - * @see org.apache.tuscany.binding.axis2.assembly.WebServiceAssemblyFactory#createWebServiceBinding() - */ - public WebServiceBinding createWebServiceBinding() { - return new WebServiceBindingImpl(); - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceBindingImpl.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceBindingImpl.java deleted file mode 100644 index 5be1b87e01..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceBindingImpl.java +++ /dev/null @@ -1,176 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.impl; - -import java.util.Collection; -import java.util.List; - -import javax.wsdl.Definition; -import javax.wsdl.Port; -import javax.wsdl.Service; - -import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.impl.BindingImpl; - -import commonj.sdo.helper.TypeHelper; - -/** - * An implementation of WebServiceBinding. - */ -public class WebServiceBindingImpl extends BindingImpl implements WebServiceBinding { - - private Definition definition; - - private Port port; - - private String portURI; - - private TypeHelper typeHelper; - - private ResourceLoader resourceLoader; - - private String webAppName; - - /** - * Constructor - */ - protected WebServiceBindingImpl() { - } - - public TypeHelper getTypeHelper() { - return typeHelper; - } - - public void setTypeHelper(TypeHelper typeHelper) { - this.typeHelper = typeHelper; - } - - public ResourceLoader getResourceLoader() { - return resourceLoader; - } - - public void setResourceLoader(ResourceLoader resourceLoader) { - this.resourceLoader = resourceLoader; - } - - /** - * @see org.apache.tuscany.binding.axis2.assembly.WebServiceBinding#getWSDLPort() - */ - public Port getWSDLPort() { - return port; - } - - /** - * @see org.apache.tuscany.binding.axis2.assembly.WebServiceBinding#setWSDLPort(javax.wsdl.Port) - */ - public void setWSDLPort(Port value) { - checkNotFrozen(); - this.port = value; - } - - /** - * @see org.apache.tuscany.binding.axis2.assembly.WebServiceBinding#getWSDLDefinition() - */ - public Definition getWSDLDefinition() { - return definition; - } - - /** - */ - public void setWSDLDefinition(Definition pdefinition) { - checkNotFrozen(); - this.definition = pdefinition; - } - - /** - * @param portURI - * The portURI to set. - */ - public void setPortURI(String portURI) { - this.portURI = portURI; - } - - public void setWebAppName(String webAppName) { - this.webAppName = webAppName; - } - - public String getWebAppName() { - return webAppName; - } - - /** - */ - @SuppressWarnings("unchecked") - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) { - return; - } - super.initialize(modelContext); - - // Get the WSDL port namespace and name - // We currently support two syntaxes for specifying a WSDL port: - // namespace#portName, this is what we supported in the initial contribution, we will - // deprecate this after M1 - // namespace#wsdl.endpoint(serviceName/portName), this is the WSDL 2.0 syntax - if (port == null && portURI != null) { - int h = portURI.indexOf('#'); - String portNamespace = portURI.substring(0, h); - String serviceName; - String portName; - - String fragment = portURI.substring(h + 1); - if (fragment.startsWith("wsdl.endpoint(") && fragment.endsWith(")")) { - fragment = fragment.substring(14, fragment.length()-1); - int slash = fragment.indexOf('/'); - if (slash != -1) { - serviceName = fragment.substring(0, slash); - portName = fragment.substring(slash+1); - } else { - serviceName = null; - portName = fragment; - } - } else { - serviceName = null; - portName = fragment; - } - - // Load the WSDL definitions for the given namespace - List<Definition> definitions = modelContext.getAssemblyLoader().loadDefinitions(portNamespace); - if (definitions == null) { - throw new IllegalArgumentException("Cannot find WSDL definition for " + portNamespace); - } - for (Definition def : definitions) { - - // Find the port with the given name - for (Service service : (Collection<Service>) def.getServices().values()) { - if (serviceName != null && !serviceName.equals(service.getQName().getLocalPart())) - continue; - Port prt = service.getPort(portName); - if (prt != null) { - this.definition = def; - this.port = prt; - return; - } - } - } - throw new IllegalArgumentException("Cannot find WSDL port " + portURI); - } - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java deleted file mode 100644 index 9b428f8be8..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java +++ /dev/null @@ -1,146 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.builder; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.wsdl.Definition; -import javax.xml.namespace.QName; - -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.soap.SOAPFactory; -import org.apache.axis2.AxisFault; -import org.apache.axis2.addressing.EndpointReference; -import org.apache.axis2.client.Options; -import org.apache.axis2.client.ServiceClient; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.MessageContextConstants; -import org.apache.axis2.description.AxisService; -import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; -import org.apache.tuscany.binding.axis2.config.WSExternalServiceContextFactory; -import org.apache.tuscany.binding.axis2.externalservice.Axis2OperationInvoker; -import org.apache.tuscany.binding.axis2.externalservice.Axis2ServiceInvoker; -import org.apache.tuscany.binding.axis2.util.SDODataBinding; -import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator; -import org.apache.tuscany.binding.axis2.util.WebServiceOperationMetaData; -import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.extension.ExternalServiceBuilderSupport; -import org.apache.tuscany.core.extension.ExternalServiceContextFactory; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.model.assembly.ExternalService; -import org.osoa.sca.annotations.Scope; - -import commonj.sdo.helper.TypeHelper; - -/** - * Creates a <code>ContextFactory</code> for an external service configured with the {@link WebServiceBinding} - */ -@Scope("MODULE") -public class ExternalWebServiceBuilder extends ExternalServiceBuilderSupport<WebServiceBinding> { - - /* - * (non-Javadoc) - * - * @see org.apache.tuscany.core.extension.ExternalServiceBuilderSupport#createExternalServiceContextFactory(org.apache.tuscany.model.assembly.ExternalService) - */ - @Override - protected ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService) { - - WebServiceBinding wsBinding = (WebServiceBinding) externalService.getBindings().get(0); - Definition wsdlDefinition = wsBinding.getWSDLDefinition(); - WebServicePortMetaData wsPortMetaData = new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getURI(), false); - - ServiceClient serviceClient = createServiceClient(externalService.getName(), wsdlDefinition, wsPortMetaData); - - TypeHelper typeHelper = wsBinding.getTypeHelper(); - ClassLoader cl = wsBinding.getResourceLoader().getClassLoader(); - Class serviceInterface = externalService.getConfiguredService().getPort().getServiceContract().getInterface(); - Map<String, Axis2OperationInvoker> invokers = createOperationInvokers(serviceInterface, typeHelper, cl, wsPortMetaData); - - Axis2ServiceInvoker axis2Client = new Axis2ServiceInvoker(serviceClient, invokers); - - return new WSExternalServiceContextFactory(externalService.getName(), new SingletonObjectFactory<Axis2ServiceInvoker>(axis2Client)); - - } - - /** - * Create an Axis2 ServiceClient configured for the externalService - */ - protected ServiceClient createServiceClient(String externalServiceName, Definition wsdlDefinition, WebServicePortMetaData wsPortMetaData) { - - TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator(null, null); - ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext(); - - QName serviceQName = wsPortMetaData.getServiceName(); - String portName = wsPortMetaData.getPortName().getLocalPart(); - - ServiceClient serviceClient; - try { - - AxisService axisService = AxisService.createClientSideAxisService(wsdlDefinition, serviceQName, portName, new Options()); - serviceClient = new ServiceClient(configurationContext, axisService); - - } catch (AxisFault e) { - BuilderConfigException bce = new BuilderConfigException("AxisFault creating external service", e); - bce.addContextName(externalServiceName); - throw bce; - } - - return serviceClient; - } - - /** - * Create and configure an Axis2OperationInvoker for each operation in the externalService - */ - protected Map<String, Axis2OperationInvoker> createOperationInvokers(Class sc, TypeHelper typeHelper, ClassLoader cl, WebServicePortMetaData wsPortMetaData) { - SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory(); - String portTypeNS = wsPortMetaData.getPortTypeName().getNamespaceURI(); - Map<String, Axis2OperationInvoker> invokers = new HashMap<String, Axis2OperationInvoker>(); - - for (Method m : sc.getMethods()) { - String methodName = m.getName(); - - WebServiceOperationMetaData operationMetaData = wsPortMetaData.getOperationMetaData(methodName); - boolean isWrapped = operationMetaData.isDocLitWrapped(); - List<?> sig = operationMetaData.getOperationSignature(); - SDODataBinding dataBinding = new SDODataBinding(cl, typeHelper, sig.size() > 0 ? (QName) sig.get(0) : null, isWrapped); - - Options options = new Options(); - options.setTo(new EndpointReference(wsPortMetaData.getEndpoint())); - options.setProperty(MessageContextConstants.CHUNKED, Boolean.FALSE); - - String wsdlOperationName = operationMetaData.getBindingOperation().getOperation().getName(); - - String soapAction = wsPortMetaData.getOperationMetaData(wsdlOperationName).getSOAPAction(); - if (soapAction != null && soapAction.length() > 1) { - options.setAction(soapAction); - } - - QName wsdlOperationQName = new QName(portTypeNS, wsdlOperationName); - Axis2OperationInvoker invoker = new Axis2OperationInvoker(wsdlOperationQName, options, dataBinding, soapFactory); - - invokers.put(methodName, invoker); - } - - return invokers; - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java deleted file mode 100644 index be526a2a9a..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.builder; - -import java.lang.reflect.Method; - -import org.apache.tuscany.binding.axis2.config.WSExternalServiceContextFactory; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.extension.ExternalServiceTargetInvoker; -import org.apache.tuscany.core.extension.WireBuilderSupport; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.osoa.sca.annotations.Scope; - -@Scope("MODULE") -public class ExternalWebServiceWireBuilder extends WireBuilderSupport<WSExternalServiceContextFactory> { - - @Override - protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) { - return new ExternalServiceTargetInvoker(targetName, operation, context); - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java deleted file mode 100644 index de0d54f505..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.builder; - -import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; -import org.apache.tuscany.binding.axis2.config.WSEntryPointContextFactory; -import org.apache.tuscany.core.extension.EntryPointBuilderSupport; -import org.apache.tuscany.core.extension.EntryPointContextFactory; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.webapp.ServletHost; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.osoa.sca.annotations.Scope; - -/** - * Creates a <code>ContextFactory</code> for an entry point configured with the {@link WebServiceBinding} - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class WebServiceEntryPointBuilder extends EntryPointBuilderSupport<WebServiceBinding> { - - private ServletHost tomcatHost; - - @Autowire - public void setTomcatHost(ServletHost tomcatHost) { - this.tomcatHost = tomcatHost; - } - - protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) { - WebServiceBinding wsBinding = (WebServiceBinding) entryPoint.getBindings().get(0); - return new WSEntryPointContextFactory(entryPoint.getName(), messageFactory, tomcatHost, wsBinding); - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSEntryPointContextFactory.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSEntryPointContextFactory.java deleted file mode 100644 index 9e836b43e5..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSEntryPointContextFactory.java +++ /dev/null @@ -1,276 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.config; - -import java.io.InputStream; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Enumeration; -import java.util.Set; -import java.util.Vector; - -import javax.servlet.RequestDispatcher; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.wsdl.Definition; -import javax.wsdl.Operation; -import javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.description.AxisOperation; -import org.apache.axis2.description.AxisService; -import org.apache.axis2.description.WSDL2AxisServiceBuilder; -import org.apache.axis2.wsdl.WSDLConstants; -import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; -import org.apache.tuscany.binding.axis2.entrypoint.WebServiceEntryPointInOutSyncMessageReceiver; -import org.apache.tuscany.binding.axis2.entrypoint.WebServiceEntryPointServlet; -import org.apache.tuscany.binding.axis2.util.SDODataBinding; -import org.apache.tuscany.binding.axis2.util.WebServiceOperationMetaData; -import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.context.EntryPointContext; -import org.apache.tuscany.core.extension.EntryPointContextFactory; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.webapp.ServletHost; - -import commonj.sdo.helper.TypeHelper; - -/** - * Creates instances of {@link org.apache.tuscany.core.context.EntryPointContext} configured with the appropriate wire chains and bindings. This - * implementation serves as a marker for - * - * @version $Rev$ $Date$ - */ -public class WSEntryPointContextFactory extends EntryPointContextFactory { - - private ServletHost tomcatHost; - - private WebServiceBinding wsBinding; - - public WSEntryPointContextFactory(String name, MessageFactory messageFactory, ServletHost tomcatHost, WebServiceBinding wsBinding) { - super(name, messageFactory); - this.tomcatHost = tomcatHost; - this.wsBinding = wsBinding; - } - - public EntryPointContext createContext() throws ContextCreationException { - EntryPointContext epc = super.createContext(); - initServlet(epc); - return epc; - } - - private void initServlet(EntryPointContext epc) { - AxisService axisService; - try { - axisService = createAxisService(epc, wsBinding); - } catch (AxisFault e) { - throw new BuilderConfigException(e); - } - WebServiceEntryPointServlet servlet = new WebServiceEntryPointServlet(axisService); - ServletConfig sc = createDummyServletConfig(); - try { - servlet.init(sc ); - } catch (ServletException e) { - throw new BuilderConfigException(e); - } - - String servletMapping = wsBinding.getWebAppName() + "/services/" + epc.getName(); - tomcatHost.registerMapping(servletMapping, servlet); - } - - private ServletConfig createDummyServletConfig() { - ServletConfig sc = new ServletConfig() { - - public String getServletName() { - return "TuscanyWSServlet"; - } - - public ServletContext getServletContext() { - return new ServletContext() { - - public ServletContext getContext(String arg0) { - return null; - } - - public int getMajorVersion() { - return 0; - } - - public int getMinorVersion() { - return 0; - } - - public String getMimeType(String arg0) { - return null; - } - - public Set getResourcePaths(String arg0) { - return null; - } - - public URL getResource(String arg0) throws MalformedURLException { - return null; - } - - public InputStream getResourceAsStream(String arg0) { - return null; - } - - public RequestDispatcher getRequestDispatcher(String arg0) { - return null; - } - - public RequestDispatcher getNamedDispatcher(String arg0) { - return null; - } - - public Servlet getServlet(String arg0) throws ServletException { - return null; - } - - public Enumeration getServlets() { - return null; - } - - public Enumeration getServletNames() { - return null; - } - - public void log(String arg0) { - } - - public void log(Exception arg0, String arg1) { - } - - public void log(String arg0, Throwable arg1) { - } - - public String getRealPath(String arg0) { - return null; - } - - public String getServerInfo() { - return null; - } - - public String getInitParameter(String arg0) { - return null; - } - - public Enumeration getInitParameterNames() { - return null; - } - - public Object getAttribute(String arg0) { - return null; - } - - public Enumeration getAttributeNames() { - return null; - } - - public void setAttribute(String arg0, Object arg1) { - } - - public void removeAttribute(String arg0) { - } - - public String getServletContextName() { - return null; - }}; - } - - public String getInitParameter(String arg0) { - return null; - } - - public Enumeration getInitParameterNames() { - return new Vector().elements(); - }}; - return sc; - } - - private AxisService createAxisService(EntryPointContext entryPointContext, WebServiceBinding wsBinding) throws AxisFault { - - String entryPointName = entryPointContext.getName(); - - Definition definition = wsBinding.getWSDLDefinition(); - WebServicePortMetaData wsdlPortInfo = new WebServicePortMetaData(definition, wsBinding.getWSDLPort(), null, false); - - // AxisServiceGroup serviceGroup = new AxisServiceGroup(axisConfig); - // serviceGroup.setServiceGroupName(wsdlPortInfo.getServiceName().getLocalPart()); - // axisConfig.addServiceGroup(serviceGroup); - - WSDL2AxisServiceBuilder builder = new WSDL2AxisServiceBuilder(definition, wsdlPortInfo.getServiceName(), wsdlPortInfo.getPort().getName()); - builder.setServerSide(true); - AxisService axisService = builder.populateService(); - - axisService.setName(entryPointName); - // axisService.setParent(serviceGroup); - axisService.setServiceDescription("Tuscany configured AxisService for EntryPoint: '" + entryPointName + '\''); - - TypeHelper typeHelper = wsBinding.getTypeHelper(); - ClassLoader cl = wsBinding.getResourceLoader().getClassLoader(); - - Class<?> serviceInterface = entryPointContext.getServiceInterface(); - - PortType wsdlPortType = wsdlPortInfo.getPortType(); - for (Object o : wsdlPortType.getOperations()) { - Operation wsdlOperation = (Operation) o; - String operationName = wsdlOperation.getName(); - QName operationQN = new QName(definition.getTargetNamespace(), operationName); - Object entryPointProxy = entryPointContext.getInstance(null); - - WebServiceOperationMetaData omd = wsdlPortInfo.getOperationMetaData(operationName); - QName responseTypeQN = omd.getOutputPart(0).getElementName(); - - Method operationMethod = getMethod(serviceInterface, operationName); - SDODataBinding dataBinding = new SDODataBinding(cl, typeHelper, responseTypeQN, omd.isDocLitWrapped()); - WebServiceEntryPointInOutSyncMessageReceiver msgrec = new WebServiceEntryPointInOutSyncMessageReceiver(entryPointProxy, operationMethod, - dataBinding, cl); - - AxisOperation axisOp = axisService.getOperation(operationQN); - axisOp.setMessageExchangePattern(WSDLConstants.MEP_URI_IN_OUT); - axisOp.setMessageReceiver(msgrec); - } - - return axisService; - } - - protected Method getMethod(Class<?> serviceInterface, String operationName) { - // Note: this doesn't support overloaded operations - Method[] methods = serviceInterface.getMethods(); - for (Method m : methods) { - if (m.getName().equals(operationName)) { - return m; - } - // tolerate WSDL with capatalized operation name - StringBuilder sb = new StringBuilder(operationName); - sb.setCharAt(0, Character.toLowerCase(sb.charAt(0))); - if (m.getName().equals(sb.toString())) { - return m; - } - } - throw new BuilderConfigException("no operation named " + operationName + " found on service interface: " + serviceInterface.getName()); - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSExternalServiceContextFactory.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSExternalServiceContextFactory.java deleted file mode 100644 index 0a2e308587..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSExternalServiceContextFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.config; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.extension.ExternalServiceContextFactory; - -/** - * Creates instances of {@link org.apache.tuscany.core.context.ExternalServiceContext} configured with the appropriate wire chains and bindings. This - * implementation serves as a marker for {@link org.apache.tuscany.binding.axis2.builder.ExternalWebServiceWireBuilder} - * - * @version $Rev$ $Date$ - */ -public class WSExternalServiceContextFactory extends ExternalServiceContextFactory { - - public WSExternalServiceContextFactory(String name, ObjectFactory objectFactory) { - super(name, objectFactory); - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointInOutSyncMessageReceiver.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointInOutSyncMessageReceiver.java deleted file mode 100644 index bb9f0e307a..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointInOutSyncMessageReceiver.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.entrypoint; - -import java.lang.reflect.Method; - -import org.apache.axiom.om.OMElement; -import org.apache.axiom.soap.SOAPEnvelope; -import org.apache.axis2.AxisFault; -import org.apache.axis2.Constants; -import org.apache.axis2.context.MessageContext; -import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver; -import org.apache.tuscany.binding.axis2.util.SDODataBinding; -import org.apache.tuscany.core.wire.InvocationRuntimeException; - -public class WebServiceEntryPointInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver { - - private Object entryPointProxy; - - protected Method operationMethod; - - protected SDODataBinding dataBinding; - - protected ClassLoader classLoader; - - public WebServiceEntryPointInOutSyncMessageReceiver(Object entryPointProxy, Method operationMethod, SDODataBinding dataBinding, ClassLoader classLoader) { - this.entryPointProxy = entryPointProxy; - this.operationMethod = operationMethod; - this.dataBinding = dataBinding; - this.classLoader = classLoader; - } - - @Override - public void invokeBusinessLogic(MessageContext inMC, MessageContext outMC) throws AxisFault { - try { - - OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement(); - Object[] request; - if (requestOM != null) { - request = dataBinding.fromOMElement(requestOM); - } else { - request = new Object[0]; - } - - Object response; - ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - try { - if (tccl != classLoader) { - Thread.currentThread().setContextClassLoader(classLoader); - } - - response = operationMethod.invoke(entryPointProxy, request); - - } finally { - if (tccl != classLoader) { - Thread.currentThread().setContextClassLoader(tccl); - } - } - - SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope(); - - OMElement responseOM = null; - if (response != null) { - responseOM = dataBinding.toOMElement(new Object[] { response }); - soapEnvelope.getBody().addChild(responseOM); - } - - outMC.setEnvelope(soapEnvelope); - outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE); - - } catch (InvocationRuntimeException e) { - // throw new InvocationRuntimeException(e); - Throwable t = e.getCause(); - if(t instanceof Exception) { - - throw AxisFault.makeFault((Exception)t); - - } - throw e; - - - } catch (Exception e) { - throw AxisFault.makeFault(e); - } - - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java deleted file mode 100644 index 4e6173b671..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.tuscany.binding.axis2.entrypoint; - -import java.io.IOException; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.axis2.description.AxisService; -import org.apache.axis2.transport.http.AxisServlet; - -/** - * @version $Rev: 383148 $ $Date: 2006-03-04 08:07:17 -0800 (Sat, 04 Mar 2006) $ - */ -public class WebServiceEntryPointServlet extends AxisServlet { - - private static final long serialVersionUID = 1L; - - private AxisService axisService; - - public WebServiceEntryPointServlet(AxisService axisService) { - this.axisService = axisService; - } - - public void init(final ServletConfig config) throws ServletException { - ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - ClassLoader scl = this.getClass().getClassLoader(); - try { - if (tccl != scl) { - Thread.currentThread().setContextClassLoader(scl); - } - - try { - - super.init(config); - - configContext.getAxisConfiguration().addService(axisService); - - } catch (Exception e) { - throw new ServletException(e); - } - - } finally { - if (tccl != scl) { - Thread.currentThread().setContextClassLoader(tccl); - } - } - } - - @Override - protected void doGet(final HttpServletRequest arg0, final HttpServletResponse arg1) throws ServletException, IOException { - ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - ClassLoader scl = this.getClass().getClassLoader(); - try { - if (tccl != scl) { - Thread.currentThread().setContextClassLoader(scl); - } - - try { - super.doGet(arg0, arg1); - } catch (Exception e) { - e.printStackTrace(); - throw new ServletException(e); - } - - } finally { - if (tccl != scl) { - Thread.currentThread().setContextClassLoader(tccl); - } - } - } - - @Override - protected void doPost(final HttpServletRequest arg0, final HttpServletResponse arg1) throws ServletException, IOException { - ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - ClassLoader scl = this.getClass().getClassLoader(); - try { - if (tccl != scl) { - Thread.currentThread().setContextClassLoader(scl); - } - - try { - super.doPost(arg0, arg1); - } catch (Exception e) { - e.printStackTrace(); - throw new ServletException(e); - } - - } finally { - if (tccl != scl) { - Thread.currentThread().setContextClassLoader(tccl); - } - } - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2OperationInvoker.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2OperationInvoker.java deleted file mode 100644 index 32767012df..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2OperationInvoker.java +++ /dev/null @@ -1,114 +0,0 @@ -/**
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.axis2.externalservice;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.tuscany.binding.axis2.util.SDODataBinding;
-
-/**
- * Axis2OperationInvoker uses an Axis2 OperationClient to invoke a remote web service
- */
-public class Axis2OperationInvoker {
-
- public QName wsdlOperationName;
-
- public Options options;
-
- public SDODataBinding dataBinding;
-
- private SOAPFactory soapFactory;
-
- public Axis2OperationInvoker(QName wsdlOperationName, Options options, SDODataBinding dataBinding, SOAPFactory soapFactory) {
- this.wsdlOperationName = wsdlOperationName;
- this.options = options;
- this.dataBinding = dataBinding;
- this.soapFactory = soapFactory;
- }
-
- /**
- * Invoke a WS operation
- *
- * @param operationClient
- * @param args
- * @return
- * @throws AxisFault
- */
- protected Object invokeOperation(OperationClient operationClient, Object[] args) throws AxisFault {
-
- operationClient.setOptions(options);
-
- SOAPEnvelope env = soapFactory.getDefaultEnvelope();
-
- if (args != null && args.length > 0) {
- OMElement requestOM = dataBinding.toOMElement(args);
- env.getBody().addChild(requestOM);
- }
-
- MessageContext requestMC = new MessageContext();
- requestMC.setEnvelope(env);
-
- operationClient.addMessageContext(requestMC);
-
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- ClassLoader scl = this.getClass().getClassLoader();
- try {
- if (tccl != scl) {
- Thread.currentThread().setContextClassLoader(scl);
- }
-
- operationClient.execute(true);
-
- } finally {
- if (tccl != scl) {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
-
- MessageContext responseMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- OMElement responseOM = responseMC.getEnvelope().getBody().getFirstElement();
-
- Object[] os = null;
- if (responseOM != null) {
- os = dataBinding.fromOMElement(responseOM);
- }
-
- Object response;
- if (os == null || os.length < 1) {
- response = null;
- } else {
- response = os[0];
- }
-
- return response;
- }
-
- /**
- * Get the WSDL operation name that this can invoke
- */
- public QName getWSDLOperationName() {
- return wsdlOperationName;
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2ServiceInvoker.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2ServiceInvoker.java deleted file mode 100644 index 38b9e40d2e..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2ServiceInvoker.java +++ /dev/null @@ -1,60 +0,0 @@ -/**
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.axis2.externalservice;
-
-import java.util.Map;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.tuscany.core.extension.ExternalServiceInvoker;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Axis2ServiceInvoker uses Axis2 to invoke a remote web service
- */
-public class Axis2ServiceInvoker implements ExternalServiceInvoker {
-
- private ServiceClient serviceClient;
-
- private Map<String, Axis2OperationInvoker> operationInvokers;
-
- public Axis2ServiceInvoker(ServiceClient serviceClient, Map<String, Axis2OperationInvoker> operationInvokers) {
- this.serviceClient = serviceClient;
- this.operationInvokers = operationInvokers;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.axis2.handler.ExternalServiceInvoker#invoke(java.lang.String, java.lang.Object[])
- */
- public Object invoke(String methodName, Object[] args) {
- try {
-
- Axis2OperationInvoker invoker = operationInvokers.get(methodName);
-
- // Axis2 operationClients can not be shared so create a new one for each request
- OperationClient operationClient = serviceClient.createClient(invoker.getWSDLOperationName());
-
- return invoker.invokeOperation(operationClient, args);
-
- } catch (AxisFault e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/loader/WebServiceBindingLoader.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/loader/WebServiceBindingLoader.java deleted file mode 100644 index b4a67d1ab2..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/loader/WebServiceBindingLoader.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.loader; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.binding.axis2.assembly.WebServiceAssemblyFactory; -import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; -import org.apache.tuscany.binding.axis2.assembly.impl.WebServiceAssemblyFactoryImpl; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.LoaderContext; -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; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class WebServiceBindingLoader implements StAXElementLoader<WebServiceBinding> { - public static final QName BINDING_WS = new QName("http://www.osoa.org/xmlns/sca/0.9", "binding.ws"); - - private static final WebServiceAssemblyFactory WS_FACTORY = new WebServiceAssemblyFactoryImpl(); - - protected StAXLoaderRegistry registry; - - @Autowire - public void setRegistry(StAXLoaderRegistry registry) { - this.registry = registry; - } - - @Init(eager = true) - public void start() { - registry.registerLoader(BINDING_WS, this); - } - - @Destroy - public void stop() { - registry.unregisterLoader(BINDING_WS, this); - } - - @SuppressWarnings("deprecation") - public WebServiceBinding load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - - WebServiceBinding binding = WS_FACTORY.createWebServiceBinding(); - binding.setURI(reader.getAttributeValue(null, "uri")); - binding.setPortURI(reader.getAttributeValue(null, "port")); - binding.setTypeHelper(registry.getContext().getTypeHelper()); - binding.setWebAppName(registry.getContext().getWebAppName()); - binding.setResourceLoader(loaderContext.getResourceLoader()); - return binding; - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java deleted file mode 100644 index 0caf2293d6..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java +++ /dev/null @@ -1,104 +0,0 @@ -/**
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.axis2.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.tuscany.core.wire.InvocationRuntimeException;
-import org.apache.tuscany.databinding.sdo.SDOXMLHelper;
-import org.apache.tuscany.sdo.util.SDOUtil;
-import org.osoa.sca.ServiceRuntimeException;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.helper.XMLHelper;
-
-/**
- * DataBinding for converting between AXIOM OMElement and Java Objects
- */
-public class SDODataBinding {
-
- private ClassLoader classLoader;
-
- private TypeHelper typeHelper;
-
- private QName elementQName;
-
- private boolean isWrapped;
-
- public SDODataBinding(ClassLoader classLoader, TypeHelper typeHelper, QName elementQName, boolean isWrapped) {
- this.classLoader = classLoader;
- this.typeHelper = typeHelper;
- this.elementQName = elementQName;
- this.isWrapped = isWrapped;
- }
-
- public Object[] fromOMElement(OMElement omElement) {
- try {
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- omElement.serialize(baos);
-
- baos.flush();
- baos.close();
-
- return SDOXMLHelper.toObjects(classLoader,typeHelper, baos.toByteArray(), isWrapped);
-
- } catch (IOException e) {
- throw new InvocationRuntimeException(e);
- } catch (XMLStreamException e) {
- throw new InvocationRuntimeException(e);
- }
- }
-
- public OMElement toOMElement(Object[] os) {
- try {
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- DataObject dataObject = SDOXMLHelper.toDataObject(classLoader, typeHelper, os, elementQName, isWrapped);
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
- xmlHelper.save(dataObject, elementQName.getNamespaceURI(), elementQName.getLocalPart(), baos);
- baos.close();
-
- XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray()));
- OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), xsr);
- OMElement omElement = builder.getDocumentElement();
-
- return omElement;
-
- } catch (IOException e) {
- throw new ServiceRuntimeException(e);
- } catch (XMLStreamException e) {
- throw new ServiceRuntimeException(e);
- } catch (FactoryConfigurationError e) {
- throw new ServiceRuntimeException(e);
- }
- }
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java deleted file mode 100644 index a5795d076e..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java +++ /dev/null @@ -1,88 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.axis2.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.deployment.AxisConfigBuilder;
-import org.apache.axis2.deployment.DeploymentEngine;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisConfigurator;
-import org.apache.tuscany.common.resource.ResourceLoader;
-import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Helps configure Axis2 from a resource in binding.axis2 instead of Axis2.xml
- *
- * TODO: Review: should there be a single global Axis ConfigurationContext
- */
-public class TuscanyAxisConfigurator implements AxisConfigurator {
-
- protected AxisConfiguration axisConfiguration;
-
- protected final ResourceLoader resourceLoader;
-
- /**
- * @param resourceLoader
- * desired resource loader if null use thread context.
- * @param axisConfiguration
- * Starting axis configuration, null then use uninitialized configuration.
- */
- public TuscanyAxisConfigurator(ResourceLoader resourceLoader, AxisConfiguration axisConfiguration) {
- this.resourceLoader = resourceLoader != null ? resourceLoader : new ResourceLoaderImpl(getClass().getClassLoader());
- this.axisConfiguration = axisConfiguration == null ? new AxisConfiguration() : axisConfiguration;
- }
-
- public AxisConfiguration getAxisConfiguration() {
-
- return axisConfiguration;
- }
-
- public ConfigurationContext getConfigurationContext() throws ServiceRuntimeException {
-
- try {
- URL url = resourceLoader.getResource("org/apache/tuscany/binding/axis2/engine/config/axis2.xml");
-
- InputStream serviceInputStream = url.openStream();
- AxisConfigBuilder axisConfigBuilder = new AxisConfigBuilder(serviceInputStream, new DeploymentEngine(), axisConfiguration);
- axisConfigBuilder.populateConfig();
- serviceInputStream.close();
- return ConfigurationContextFactory.createConfigurationContext(this);
- } catch (IOException e) {
-
- throw new ServiceRuntimeException(e);
- }
-
- }
-
- public void loadServices() {
- // TODO Auto-generated method stub
-
- }
-
- public void engageGlobalModules() throws AxisFault {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java deleted file mode 100644 index 1ebca5d3fc..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java +++ /dev/null @@ -1,499 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import javax.wsdl.Binding; -import javax.wsdl.BindingInput; -import javax.wsdl.BindingOperation; -import javax.wsdl.BindingOutput; -import javax.wsdl.Input; -import javax.wsdl.Message; -import javax.wsdl.Operation; -import javax.wsdl.Output; -import javax.wsdl.Part; -import javax.wsdl.extensions.soap.SOAPBinding; -import javax.wsdl.extensions.soap.SOAPHeader; -import javax.wsdl.extensions.soap.SOAPOperation; -import javax.xml.namespace.QName; - -/** - * Metadata for a WSDL operation - * - */ -public class WebServiceOperationMetaData { - // WSDL Binding and BindingOperation - private Binding binding; - - private BindingOperation bindingOperation; - - // Fields to cache derived metadata - private transient Set<Part> inputHeaderParts; - - private transient Set<Part> outputHeaderParts; - - private transient String style; - - private transient String use; - - private transient String soapAction; - - private transient List<Object> signature; - - private String encoding; - - private transient QName rpcOperationName; - - public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation) { - this.binding = binding; - this.bindingOperation = bindingOperation; - } - - public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation, String style, String use, String encoding, - String soapAction) { - this.binding = binding; - this.bindingOperation = bindingOperation; - this.style = style; - this.use = use; - this.encoding = encoding; - this.soapAction = soapAction; - } - - public Set<Part> getInputHeaderParts() { - if (inputHeaderParts == null) { - // Build a set of header parts that we need to exclude - inputHeaderParts = new HashSet<Part>(); - BindingInput bindingInput = bindingOperation.getBindingInput(); - - if (bindingInput != null) { - Operation operation = bindingOperation.getOperation(); - javax.wsdl.Message message = operation.getInput().getMessage(); - List elements = bindingInput.getExtensibilityElements(); - for (Iterator i = elements.iterator(); i.hasNext();) { - Object extensibilityElement = i.next(); - Part part = getPartFromSOAPHeader(message, extensibilityElement); - if (part != null) { - inputHeaderParts.add(part); - } - } - } - } - return inputHeaderParts; - } - - public Set<Part> getOutputHeaderParts() { - if (outputHeaderParts == null) { - // Build a set of header parts that we need to exclude - outputHeaderParts = new HashSet<Part>(); - BindingOutput bindingOutput = bindingOperation.getBindingOutput(); - - if (bindingOutput != null) { - Operation operation = bindingOperation.getOperation(); - javax.wsdl.Message message = operation.getOutput().getMessage(); - List elements = bindingOutput.getExtensibilityElements(); - for (Iterator i = elements.iterator(); i.hasNext();) { - Object extensibilityElement = i.next(); - Part part = getPartFromSOAPHeader(message, extensibilityElement); - if (part != null) { - outputHeaderParts.add(part); - } - } - } - } - return outputHeaderParts; - } - - private Part getPartFromSOAPHeader(Message message, Object extensibilityElement) { - Part part = null; - if (extensibilityElement instanceof SOAPHeader) { - SOAPHeader soapHeader = (SOAPHeader) extensibilityElement; - QName msgName = soapHeader.getMessage(); - if (message.getQName().equals(msgName)) { - part = message.getPart(soapHeader.getPart()); - } - } else if (extensibilityElement instanceof SOAPHeader) { - SOAPHeader soapHeader = (SOAPHeader) extensibilityElement; - QName msgName = soapHeader.getMessage(); - if (message.getQName().equals(msgName)) { - part = message.getPart(soapHeader.getPart()); - } - } - return part; - } - - public String getStyle() { - if (style == null) { - SOAPOperation soapOperation = (SOAPOperation) WebServicePortMetaData.getExtensibilityElement(bindingOperation.getExtensibilityElements(), - SOAPOperation.class); - if (soapOperation != null) { - style = soapOperation.getStyle(); - } - if (style == null) { - SOAPBinding soapBinding = WebServicePortMetaData.getExtensibilityElement(binding.getExtensibilityElements(), SOAPBinding.class); - if (soapBinding != null) { - style = soapBinding.getStyle(); - } - } - if (style == null) { - style = "document"; - } - } - return style; - } - - /** - * Returns the SOAP action for the given operation. - * - * @param wsdlBindingOperation - * @return - */ - public String getSOAPAction() { - if (soapAction == null) { - final List wsdlBindingOperationExtensions = bindingOperation.getExtensibilityElements(); - final SOAPOperation soapOp = WebServicePortMetaData.getExtensibilityElement(wsdlBindingOperationExtensions, SOAPOperation.class); - if (soapOp != null) { - soapAction = soapOp.getSoapActionURI(); - } - } - return soapAction; - } - - public QName getRPCOperationName() { - if (rpcOperationName == null) { - javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); - String ns = (soapBody != null) ? soapBody.getNamespaceURI() : binding.getPortType().getQName().getNamespaceURI(); - String name = bindingOperation.getOperation().getName(); - rpcOperationName = new QName(ns, name); - } - return rpcOperationName; - } - - private List<String> getSOAPBodyParts(boolean input) { - javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(input); - if (soapBody != null) { - List parts = soapBody.getParts(); - if (parts != null) { - List<String> names = new ArrayList<String>(); - for (Iterator i = parts.iterator(); i.hasNext();) { - Object part = i.next(); - if (part instanceof String) { - names.add((String) part); - } else if (part instanceof Part) { - names.add(((Part) part).getName()); - } - } - return names; - } else { - return null; - } - } else { - return null; - } - } - - private javax.wsdl.extensions.soap.SOAPBody getSOAPBody(boolean input) { - List elements = null; - if (input) { - BindingInput bindingInput = bindingOperation.getBindingInput(); - if (bindingInput == null) { - return null; - } - elements = bindingInput.getExtensibilityElements(); - } else { - BindingOutput bindingOutput = bindingOperation.getBindingOutput(); - if (bindingOutput == null) { - return null; - } - elements = bindingOutput.getExtensibilityElements(); - } - javax.wsdl.extensions.soap.SOAPBody soapBody = WebServicePortMetaData.getExtensibilityElement(elements, - javax.wsdl.extensions.soap.SOAPBody.class); - return soapBody; - } - - /** - * Returns the use attribute - * - * @param wsdlOperation - * @return - */ - public String getUse() { - if (use == null) { - javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); - if (soapBody != null) { - use = soapBody.getUse(); - } - if (use == null) { - use = "literal"; - } - } - return use; - } - - @SuppressWarnings("unchecked") - public String getEncoding() { - if (encoding == null) { - javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); - if (soapBody != null) { - List<String> styles = (List<String>) soapBody.getEncodingStyles(); - if (styles != null && !styles.isEmpty()) { - encoding = styles.get(0); - } - } - if (encoding == null) { - encoding = ""; - } - } - return encoding; - } - - public boolean isDocLitWrapped() { - boolean flag = getStyle().equals("document") && getUse().equals("literal"); - if (!flag) { - return false; - } - Message msg = getMessage(true); - if (msg == null) { - return false; - } - List parts = msg.getOrderedParts(null); - if (parts.size() != 1) { - return false; - } - Part part = (Part) parts.get(0); - QName element = part.getElementName(); - if (element == null) { - return false; - } - return element.getLocalPart().equals(bindingOperation.getOperation().getName()); - } - - /* - * public SOAPMediator createMediator(boolean serverMode) throws SOAPException { // create a new mediator for each invoke for thread-safety - * boolean rpcStyle = getStyle().equals("rpc"); boolean rpcEncoded = isEncoded(); - * - * SOAPMediator mediator = null; - * - * if (!rpcStyle) { // Document mediator = new SOAPDocumentLiteralMediatorImpl(this, serverMode); } else { if (!rpcEncoded) mediator = new - * SOAPRPCLiteralMediatorImpl(this, serverMode); // RPC-literal else mediator = new SOAPRPCEncodedMediatorImpl(this, serverMode); // RPC-encoded } - * return mediator; } - */ - - /** - * Get the operation signature from the WSDL operation - * - * @param wsdlBinding - * @param bindingOperation - * @return - */ - public List<?> getOperationSignature() { - if (signature == null) { - signature = new ArrayList<Object>(); - - Operation operation = bindingOperation.getOperation(); - if (operation == null) { - return signature; - } - - final Input input = operation.getInput(); - if (input == null) { - return signature; - } - - String sstyle = getStyle(); - - if ("rpc".equals(sstyle)) { - Collection partNames = input.getMessage().getParts().values(); - for (Iterator i = partNames.iterator(); i.hasNext();) { - Part part = (Part) i.next(); - signature.add(part.getName()); - } - } else { - /* - * WS-I Basic Profile 1.1 4.7.6 Operation Signatures Definition: operation signature - * - * The profile defines the "operation signature" to be the fully qualified name of the child element of SOAP body of the SOAP input - * message described by an operation in a WSDL binding. - * - * In the case of rpc-literal binding, the operation name is used as a wrapper for the part accessors. In the document-literal case, - * since a wrapper with the operation name is not present, the message signatures must be correctly designed so that they meet this - * requirement. - * - * An endpoint that supports multiple operations must unambiguously identify the operation being invoked based on the input message - * that it receives. This is only possible if all the operations specified in the wsdl:binding associated with an endpoint have a - * unique operation signature. - * - * R2710 The operations in a wsdl:binding in a DESCRIPTION MUST result in operation signatures that are different from one another. - */ - List<String> bodyParts = getSOAPBodyParts(true); - - Collection<?> parts = input.getMessage().getParts().values(); - // Exclude the parts to be transmitted in SOAP header - if (bodyParts == null) { - parts.removeAll(getInputHeaderParts()); - } - for (Iterator i = parts.iterator(); i.hasNext();) { - Part part = (Part) i.next(); - if (bodyParts == null) { - // All parts - QName elementName = part.getElementName(); - if (elementName == null) { - elementName = new QName("", part.getName()); - // TODO: [rfeng] throw new - // ServiceRuntimeException("Message part for - // document style must refer to an XSD element - // using a QName: " + part); - } - signature.add(elementName); - } else { - // "parts" in soap:body - if (bodyParts.contains(part.getName())) { - QName elementName = part.getElementName(); - if (elementName == null) { - elementName = new QName("", part.getName()); - // TODO: [rfeng] throw new - // ServiceRuntimeException("Message part for - // document style must refer to an XSD - // element using a QName: " + part); - } - signature.add(elementName); - } - - } - } - } - } - return signature; - } - - public Message getMessage(boolean isInput) { - Operation operation = bindingOperation.getOperation(); - if (operation == null) { - return null; - } - - if (isInput) { - final Input input = operation.getInput(); - return input == null ? null : input.getMessage(); - } else { - final Output output = operation.getOutput(); - return output == null ? null : output.getMessage(); - } - } - - public Part getInputPart(int index) { - Part part = null; - Message message = getMessage(true); - if (message == null) { - return part; - } - - List parts = message.getOrderedParts(null); - return (Part) parts.get(index); - - } - - public Part getOutputPart(int index) { - Part part = null; - Message message = getMessage(false); - if (message == null) { - return part; - } - - List parts = message.getOrderedParts(null); - return (Part) parts.get(index); - - } - - /** - * Get a list of indexes for each part in the SOAP body - * - * @param isInput - * TODO - * @return - */ - public List<Integer> getBodyPartIndexes(boolean isInput) { - List<Integer> indexes = new ArrayList<Integer>(); - - Message message = getMessage(isInput); - if (message == null) { - return indexes; - } - - List<String> bodyParts = getSOAPBodyParts(isInput); - List parts = message.getOrderedParts(null); - Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts(); - - int index = 0; - for (Iterator i = parts.iterator(); i.hasNext(); index++) { - Part part = (Part) i.next(); - if (headerParts.contains(part)) { - continue; - } - if (bodyParts == null) { - // All parts - indexes.add(index); - } else { - // "parts" in soap:body - if (bodyParts.contains(part.getName())) { - indexes.add(index); - } - } - } - return indexes; - } - - /** - * Get the corresponding index for a part in the SOAP header by element name - * - * @param elementName - * @param isInput - * TODO - * @return - */ - public int getHeaderPartIndex(QName elementName, boolean isInput) { - - Message message = getMessage(isInput); - if (message == null) { - return -1; - } - - List parts = message.getOrderedParts(null); - Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts(); - - int index = 0; - for (Iterator i = parts.iterator(); i.hasNext(); index++) { - Part part = (Part) i.next(); - // Test if the part is in header section - if (headerParts.contains(part) && elementName.equals(part.getElementName())) { - return index; - } - } - return -1; - } - - public BindingOperation getBindingOperation() { - return bindingOperation; - } - -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java deleted file mode 100644 index 694a8fbf5f..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java +++ /dev/null @@ -1,400 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import javax.wsdl.Binding; -import javax.wsdl.BindingOperation; -import javax.wsdl.Definition; -import javax.wsdl.Operation; -import javax.wsdl.Port; -import javax.wsdl.PortType; -import javax.wsdl.Service; -import javax.wsdl.extensions.soap.SOAPAddress; -import javax.wsdl.extensions.soap.SOAPBinding; -import javax.xml.namespace.QName; - -import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; - -/** - * Metadata for a WSDL port - * - */ -public class WebServicePortMetaData { - - private Service wsdlService; - - private QName wsdlServiceName; - - private Port wsdlPort; - - private Binding wsdlBinding; - - private QName wsdlPortName; - - private PortType wsdlPortType; - - private QName wsdlPortTypeName; - - private String endpoint; - - private boolean managed; - - private List<WebServiceOperationMetaData> allOperationMetaData; - - private WSDLServiceContract interfaceType; - - /** - * Constructor - * - * @param wsdlDefinition - * @param portName - */ - public WebServicePortMetaData(Definition wsdlDefinition, Port wsdlPort, String endpoint, boolean managed) { - - // Lookup the named port - this.wsdlPort = wsdlPort; - wsdlPortName = new QName(wsdlDefinition.getTargetNamespace(), wsdlPort.getName()); - - Collection services = wsdlDefinition.getServices().values(); - for (Object serviceObj : services) { - Service service = (Service) serviceObj; - if (service.getPorts().containsValue(wsdlPort)) { - wsdlService = service; - wsdlServiceName = service.getQName(); - break; - } - } - - // Save the binding - wsdlBinding = wsdlPort.getBinding(); - if (wsdlBinding == null) { - throw new IllegalArgumentException("WSDL binding cannot be found for " + wsdlPortName); - } - - // Save the portType - wsdlPortType = wsdlBinding.getPortType(); - if (wsdlPortType == null) { - throw new IllegalArgumentException("WSDL portType cannot be found for " + wsdlPortName); - } - wsdlPortTypeName = wsdlPortType.getQName(); - - // Save the endpoint - this.endpoint = endpoint; - - // Track if this endpoint is managed or not - this.managed = managed; - } - - /** - * Constructor - * - * @param serviceName - * @param portName - * @param portType - */ - public WebServicePortMetaData(QName serviceName, String portName, QName portTypeName, String endpoint) { - wsdlServiceName = serviceName; - wsdlPortName = new QName(serviceName.getNamespaceURI(), portName); - wsdlPortTypeName = portTypeName; - this.endpoint = endpoint; - } - - /** - * @return Returns the wsdlPort. - */ - public javax.wsdl.Port getPort() { - return wsdlPort; - } - - /** - * @return Returns the wsdlService. - */ - public QName getServiceName() { - return wsdlServiceName; - } - - /** - * @return Returns the wsdlService. - */ - public javax.wsdl.Service getService() { - return wsdlService; - } - - /** - * @return Returns the wsdlPortType. - */ - public PortType getPortType() { - return wsdlPortType; - } - - /** - * @return Returns the wsdlPortType. - */ - public QName getPortTypeName() { - return wsdlPortTypeName; - } - - /** - * @return Returns the wsdlBinding. - */ - public Binding getBinding() { - return wsdlBinding; - } - - /** - * @return Returns the wsdlPortName. - */ - public QName getPortName() { - return wsdlPortName; - } - - /** - * Returns the endpoint of a given port. - * - * @param wsdlPort - * @return - */ - public String getEndpoint() { - - // Return the specified endpoint - if (endpoint != null) { - return endpoint; - } - - // Find the target endpoint on the port - if (wsdlPort != null) { - final List wsdlPortExtensions = wsdlPort.getExtensibilityElements(); - for (Iterator i = wsdlPortExtensions.iterator(); i.hasNext();) { - final Object extension = i.next(); - if (extension instanceof SOAPAddress) { - return ((SOAPAddress) extension).getLocationURI(); - } - } - } - - return null; - } - - /** - * Returns the SOAP binding style. - * - * @return - */ - public String getStyle() { - - // Find the binding style - String style = null; - if (wsdlBinding != null) { - final List wsdlBindingExtensions = wsdlBinding.getExtensibilityElements(); - SOAPBinding soapBinding = getExtensibilityElement(wsdlBindingExtensions, SOAPBinding.class); - if (soapBinding != null) { - style = soapBinding.getStyle(); - } - } - - // Default to document - return (style == null) ? "document" : style; - } - - /** - * Returns the use attribute - * - * @return - */ - public String getUse() { - List<WebServiceOperationMetaData> list = getAllOperationMetaData(); - return list.get(0).getUse(); - } - - /** - * Returns the encoding attribute - * - * @return - */ - public String getEncoding() { - List<WebServiceOperationMetaData> list = getAllOperationMetaData(); - return list.get(0).getEncoding(); - } - - /** - * @return Returns true if this is a managed web service. - */ - public boolean isManaged() { - return managed; - } - - /** - * Returns the first extensibility element of the given type. - * - * @param elements - * @param type - * @return - */ - public static <T> T getExtensibilityElement(List elements, Class<T> type) { - for (Iterator i = elements.iterator(); i.hasNext();) { - Object element = i.next(); - if (type.isInstance(element)) { - return type.cast(element); - } - } - return null; - } - - /** - * Returns the extensibility elements of the given type. - * - * @param elements - * @param type - * @return - */ - public static <T> List<T> getExtensibilityElements(List elements, Class<T> type) { - List<T> result = new ArrayList<T>(); - for (Iterator i = elements.iterator(); i.hasNext();) { - Object element = i.next(); - if (type.isInstance(element)) { - result.add(type.cast(element)); - } - } - return result; - } - - /** - * Get the operation signature from the SOAP Body - * - * @param body - * @return A list of QNames - */ - // public static List getOperationSignature(javax.xml.soap.SOAPBody body) { - // List signature = new ArrayList(); - // for (Iterator i = body.getChildElements(); i.hasNext();) { - // Object child = i.next(); - // if (child instanceof SOAPBodyElement) { - // Name name = ((SOAPBodyElement) child).getElementName(); - // QName qname = new QName(name.getURI(), name.getLocalName(), name.getPrefix()); - // signature.add(qname); - // } - // } - // return signature; - // } - // public static List getRPCOperationSignature(javax.xml.soap.SOAPBody body) { - // List signature = new ArrayList(); - // for (Iterator i = body.getChildElements(); i.hasNext();) { - // Object child = i.next(); - // if (child instanceof SOAPBodyElement) { - // SOAPBodyElement op = ((SOAPBodyElement) child); - // for (Iterator j = op.getChildElements(); j.hasNext();) { - // Object part = i.next(); - // if (part instanceof SOAPElement) { - // SOAPElement p = (SOAPElement) part; - // signature.add(p.getLocalName()); - // } - // } - // } - // } - // return signature; - // } - // public WebServiceOperationMetaData getOperationMetaData(javax.xml.soap.SOAPBody body) { - // List s1 = getOperationSignature(body); - // // List rpcParts = getRPCOperationSignature(body); - // for (Iterator it = getAllOperationMetaData().iterator(); it.hasNext();) { - // WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) it.next(); - // - // String style = descriptor.getStyle(); - // - // if (style.equals("document")) { - // List s2 = descriptor.getOperationSignature(); - // if (s1.equals(s2)) - // return descriptor; - // } else { - // QName op1 = (QName) s1.get(0); - // QName op2 = descriptor.getRPCOperationName(); - // if (op1.equals(op2)) { - // /* - // * // FIXME: [rfeng] We don't support method overloading - // * List partNames = getOperationSignature(binding, - // * bindingOperation); if (rpcParts.equals(partNames)) - // */ - // return descriptor; - // } - // } - // } - // return null; - // } - public List<WebServiceOperationMetaData> getAllOperationMetaData() { - if (allOperationMetaData == null) { - allOperationMetaData = new ArrayList<WebServiceOperationMetaData>(); - for (Iterator it = wsdlBinding.getBindingOperations().iterator(); it.hasNext();) { - final BindingOperation bindingOperation = (BindingOperation) it.next(); - if (bindingOperation.getOperation() != null) { - allOperationMetaData.add(new WebServiceOperationMetaData(wsdlBinding, bindingOperation)); - } - } - } - return allOperationMetaData; - } - - public WebServiceOperationMetaData getOperationMetaData(String operationName) { - StringBuilder sb = new StringBuilder(operationName); - sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); - String capatalizedOpName = sb.toString(); - - for (Iterator it = getAllOperationMetaData().iterator(); it.hasNext();) { - WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) it.next(); - String opName = descriptor.getBindingOperation().getOperation().getName(); - - if (opName.equals(operationName) || opName.equals(capatalizedOpName)) { - return descriptor; - } - } - return null; - } - - /** - * Returns the WSDL service contract - * - * @return - */ - public WSDLServiceContract getInterfaceType() { - return interfaceType; - } - - /** - * Get the WSDL operation name for a Java method name - */ - public String getWSDLOperationName(String methodName) { - StringBuilder sb = new StringBuilder(methodName); - sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); - String capatalizedOpName = sb.toString(); - for (Object o : wsdlPortType.getOperations()) { - Operation operation = (Operation) o; - String wsdlOpName = operation.getName(); - if (wsdlOpName.equals(methodName)) { - return wsdlOpName; - } - if (wsdlOpName.equals(capatalizedOpName)) { - return wsdlOpName; - } - } - return null; - } - -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml deleted file mode 100644 index 3c9e2988ef..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml +++ /dev/null @@ -1,183 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<axisconfig name="AxisJava2.0">
- <!-- ================================================= -->
- <!-- Parameters -->
- <!-- ================================================= -->
- <parameter name="hotdeployment" locked="false">false</parameter>
- <parameter name="hotupdate" locked="false">false</parameter>
- <parameter name="enableMTOM" locked="false">false</parameter>
- <!-- Uncomment this to enable REST support -->
- <!-- <parameter name="enableREST" locked="false">true</parameter>-->
-
-
- <parameter name="userName" locked="false">admin</parameter>
- <parameter name="password" locked="false">axis2</parameter>
-
- <parameter name="seralizeLocation" locked="false">.</parameter>
- <hostConfiguration>
- <ip>127.0.0.1</ip>
- <port>5555</port>
- </hostConfiguration>
-
-
- <!--if you want to extract the service archive file and work with that please uncomment this-->
- <!--else , it wont extract archive file or does not take into consideration if someone drop-->
- <!--exploded directory into /service directory-->
- <!--<parameter name="extractServiceArchive" locked="false">true</parameter>-->
-
-
- <!-- The way of adding listener to the system-->
- <!-- <listener class="org.apache.axis2.ObserverIMPL">-->
- <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
- <!-- </listener>-->
-
- <!-- ================================================= -->
- <!-- Message Receivers -->
- <!-- ================================================= -->
- <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for -->
- <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
- <!--any operation -->
- <!--Note : You can ovride this for particular service by adding the same element with your requirement-->
- <messageReceivers>
- <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
- class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
- <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
- class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
- </messageReceivers>
- <!-- ================================================= -->
- <!-- Transport Ins -->
- <!-- ================================================= -->
- <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer">
- <parameter name="port" locked="false">6060</parameter>
- </transportReceiver>
-
- <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
- <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">
- <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>
- <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>
- <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>
- <parameter name="transport.mail.pop3.port" locked="false">110</parameter>
- <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>
- </transportReceiver> -->
-
- <!--REMOVED FOR TUSCANY transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
- <parameter name="port" locked="false">6060</parameter>
- </transportReceiver -->
-
- <!--REMOVED FOR TUSCANY transportReceiver name="jms" class="org.apache.axis2.transport.jms.SimpleJMSListener">
- <parameter name="transport.jms.Destination" locked="false">dynamicQueues/FOO</parameter>
- <parameter name="java.naming.factory.initial" locked="false">
- org.activemq.jndi.ActiveMQInitialContextFactory</parameter>
- <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
- </transportReceiver>
- -->
-
- <!-- ================================================= -->
- <!-- Transport Outs -->
- <!-- ================================================= -->
-
- <!--REMOVED FOR TUSCANY transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/> -->
- <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/>
- <!--REMOVED FOR TUSCANY transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/> -->
- <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
- <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
- <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
- </transportSender>
- <transportSender name="https"
- class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
- <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
- <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
- </transportSender>
-
- <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
- <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
- <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
- <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
- <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
- <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
- </transportSender>
- -->
-
- <!-- ================================================= -->
- <!-- Global Modules -->
- <!-- ================================================= -->
- <!-- Comment this to disable Addressing -->
- <!--REMOVED FOR TUSCANY module ref="addressing"/> -->
-
-
- <!--Configuring module , providing parameters for modules whether they refer or not-->
- <!--<moduleConfig name="addressing">-->
- <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
- <!--</moduleConfig>-->
-
- <!-- ================================================= -->
- <!-- Phases -->
- <!-- ================================================= -->
- <phaseOrder type="inflow">
- <!-- System pre defined phases -->
- <phase name="TransportIn"/>
- <phase name="PreDispatch"/>
- <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
- <handler name="AddressingBasedDispatcher"
- class="org.apache.axis2.engine.AddressingBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
-
- <handler name="RequestURIBasedDispatcher"
- class="org.apache.axis2.engine.RequestURIBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
-
- <handler name="SOAPActionBasedDispatcher"
- class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
-
- <handler name="SOAPMessageBodyBasedDispatcher"
- class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
- <order phase="Dispatch"/>
- </handler>
- <handler name="InstanceDispatcher"
- class="org.apache.axis2.engine.InstanceDispatcher">
- <order phase="PostDispatch"/>
- </handler>
- </phase>
- <!-- System pre defined phases -->
- <!-- After Postdispatch phase module author or or service author can add any phase he want -->
- <phase name="userphase1"/>
- </phaseOrder>
- <phaseOrder type="outflow">
- <!-- user can add his own phases to this area -->
- <phase name="userphase1"/>
- <!--system predefined phase-->
- <!--these phase will run irrespective of the service-->
- <phase name="PolicyDetermination"/>
- <phase name="MessageOut"/>
- </phaseOrder>
- <phaseOrder type="INfaultflow">
- <!-- user can add his own phases to this area -->
- <phase name="userphase1"/>
- </phaseOrder>
- <phaseOrder type="Outfaultflow">
- <!-- user can add his own phases to this area -->
- <phase name="userphase1"/>
- <phase name="PolicyDetermination"/>
- <phase name="MessageOut"/>
- </phaseOrder>
-</axisconfig>
-
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/system.fragment b/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/system.fragment deleted file mode 100644 index 716019992b..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/main/resources/system.fragment +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" - xmlns:tuscany="http://org.apache.tuscany/xmlns/system/0.9" - name="org.apache.tuscany.binding.axis"> - - <component name="org.apache.tuscany.binding.axis2.builder.ExternalWebServiceBuilder"> - <tuscany:implementation.system class="org.apache.tuscany.binding.axis2.builder.ExternalWebServiceBuilder"/> - </component> - - <component name="org.apache.tuscany.binding.axis2.builder.ExternalWebServiceWireBuilder"> - <tuscany:implementation.system class="org.apache.tuscany.binding.axis2.builder.ExternalWebServiceWireBuilder"/> - </component> - - <component name="org.apache.tuscany.binding.axis2.builder.WebServiceEntryPointBuilder"> - <tuscany:implementation.system class="org.apache.tuscany.binding.axis2.builder.WebServiceEntryPointBuilder"/> - </component> - - <component name="org.apache.tuscany.binding.axis2.loader.WebServiceBindingLoaderr"> - <tuscany:implementation.system class="org.apache.tuscany.binding.axis2.loader.WebServiceBindingLoader"/> - </component> - -</moduleFragment> diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountReport.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountReport.java deleted file mode 100644 index 0600e14f8d..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountReport.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account; - -import java.util.List; - -/** - * @model - */ - -public interface AccountReport { - - /** - * @model type="services.account.AccountSummary" - */ - - List getAccountSummaries(); -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.java deleted file mode 100644 index b605d19f09..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account; - -import org.osoa.sca.annotations.Remotable; - -@Remotable -public interface AccountService { - - AccountReport getAccountReport(String customerID); -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java deleted file mode 100644 index cd3fcfe1f5..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account; - - -import org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata.AccountDataService; -import org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.stockquote.StockQuoteService; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; - -public class AccountServiceImpl implements AccountService { - - @Property - private String currency = "USD"; - @Reference - private AccountDataService accountDataService; - @Reference - private StockQuoteService stockQuoteService; - - public AccountServiceImpl() { - } - - public AccountReport getAccountReport(String customerID) { - return null; - } - - - //methods to access the fields - protected StockQuoteService getStockQuoteService() { - return stockQuoteService; - } - protected AccountDataService getAccountDataService() { - return accountDataService; - } - protected String getCurrency() { - return currency; - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountSummary.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountSummary.java deleted file mode 100644 index 9000e4ba19..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountSummary.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account; - -/** - * @model - */ - -public interface AccountSummary { - - /** - * @model - */ - String getAccountNumber(); - - void setAccountNumber(String accountNumber); - - /** - * @model - */ - String getAccountType(); - - void setAccountType(String accountType); - - /** - * @model - */ - float getBalance(); - - void setBalance(float balance); -} - diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java deleted file mode 100644 index d2dc72e868..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata; - -public interface AccountDataService { - - CheckingAccount getCheckingAccount(String customerID); - - SavingsAccount getSavingsAccount(String customerID); - - StockAccount getStockAccount(String customerID); -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java deleted file mode 100644 index d945ee1f34..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata; - -public class AccountDataServiceImpl implements AccountDataService { - - public CheckingAccount getCheckingAccount(String customerID) { - - CheckingAccount checkingAccount = new CheckingAccount(); - checkingAccount.setAccountNumber(customerID + "_" + "CHA12345"); - checkingAccount.setBalance(1500.0f); - - return checkingAccount; - } - - public SavingsAccount getSavingsAccount(String customerID) { - - SavingsAccount savingsAccount = new SavingsAccount(); - savingsAccount.setAccountNumber(customerID + "_" + "SAA12345"); - savingsAccount.setBalance(1500.0f); - - return savingsAccount; - } - - public StockAccount getStockAccount(String customerID) { - - StockAccount stockAccount = new StockAccount(); - stockAccount.setAccountNumber(customerID + "_" + "STA12345"); - stockAccount.setSymbol("IBM"); - stockAccount.setQuantity(100); - - return stockAccount; - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java deleted file mode 100644 index 6b75194b98..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata; - -public class CheckingAccount { - - private String accountNumber; - private float balance; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - public float getBalance() { - return balance; - } - - public void setBalance(float balance) { - this.balance = balance; - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java deleted file mode 100644 index a37b504829..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata; - -public class SavingsAccount { - - private String accountNumber; - private float balance; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - public float getBalance() { - return balance; - } - - public void setBalance(float balance) { - this.balance = balance; - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/StockAccount.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/StockAccount.java deleted file mode 100644 index 2a5ac5f4a3..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/StockAccount.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata; - -public class StockAccount { - - private String accountNumber; - private String symbol; - private int quantity; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - public int getQuantity() { - return quantity; - } - - public void setQuantity(int quantity) { - this.quantity = quantity; - } - - public String getSymbol() { - return symbol; - } - - public void setSymbol(String symbol) { - this.symbol = symbol; - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java deleted file mode 100644 index 021b19d14d..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.stockquote; - -public interface StockQuoteService { - - float getQuote(String symbol); -} - -
\ No newline at end of file diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilderTestCase.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilderTestCase.java deleted file mode 100644 index d040b87b86..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilderTestCase.java +++ /dev/null @@ -1,379 +0,0 @@ -/**
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.axis2.builder;
-
-import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding;
-import org.apache.tuscany.binding.axis2.externalservice.Axis2OperationInvoker;
-import org.apache.tuscany.binding.axis2.externalservice.Axis2ServiceInvoker;
-import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData;
-import org.apache.tuscany.common.resource.ResourceLoader;
-import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl;
-import org.apache.tuscany.core.extension.ExternalServiceContextFactory;
-import org.apache.tuscany.model.assembly.AssemblyContext;
-import org.apache.tuscany.model.assembly.AssemblyInitializationException;
-import org.apache.tuscany.model.assembly.AssemblyVisitor;
-import org.apache.tuscany.model.assembly.Binding;
-import org.apache.tuscany.model.assembly.Composite;
-import org.apache.tuscany.model.assembly.ConfiguredService;
-import org.apache.tuscany.model.assembly.ExternalService;
-import org.apache.tuscany.model.assembly.OverrideOption;
-import org.apache.tuscany.model.assembly.Part;
-import org.apache.tuscany.model.assembly.Scope;
-import org.apache.tuscany.model.assembly.Service;
-import org.apache.tuscany.model.assembly.ServiceContract;
-
-import commonj.sdo.helper.TypeHelper;
-
-public class ExternalWebServiceBuilderTestCase extends TestCase {
-
- private Definition definition;
-
- private static final QName SERVICE_NAME = new QName("http://helloworldaxis.samples.tuscany.apache.org", "HelloWorldServiceImplService");
-
- private static final String PORTNAME = "helloworld";
-
- private static final QName GET_GREETINGS_QN = new QName(SERVICE_NAME.getNamespaceURI(), "getGreetings");
-
- public void testCreateOperationInvokers() {
- ExternalWebServiceBuilder builder = new ExternalWebServiceBuilder();
-
- Port port = definition.getService(SERVICE_NAME).getPort(PORTNAME);
- WebServicePortMetaData wspmd = new WebServicePortMetaData(definition, port, null, false);
-
- Map<String, Axis2OperationInvoker> invokers = builder.createOperationInvokers(Foo.class, null, getClass().getClassLoader(),wspmd);
- assertNotNull(invokers);
- assertEquals(1, invokers.size());
-
- Axis2OperationInvoker opInvoker = invokers.get(GET_GREETINGS_QN.getLocalPart());
- assertNotNull(opInvoker);
- assertEquals(GET_GREETINGS_QN, opInvoker.getWSDLOperationName());
- }
-
- public void testCreateExternalServiceContextFactory() {
- ExternalWebServiceBuilder builder = new ExternalWebServiceBuilder();
- ExternalService es = createMockExternalService();
- ExternalServiceContextFactory cf = builder.createExternalServiceContextFactory(es);
- assertNotNull(cf);
- Axis2ServiceInvoker si = (Axis2ServiceInvoker) cf.createContext().getHandler();
- assertNotNull(si);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
- reader.setFeature("javax.wsdl.verbose", false);
- URL url = getClass().getResource("helloworld.wsdl");
- this.definition = reader.readWSDL(url.toString());
- }
-
- interface Foo {
- public void getGreetings();
- };
-
- private ExternalService createMockExternalService() {
- ExternalService es = new ExternalService() {
-
- public List<Binding> getBindings() {
- return Arrays.asList(new Binding[] { createMockBinding() });
- }
-
- public OverrideOption getOverrideOption() {
-
- return null;
- }
-
- public void setOverrideOption(OverrideOption value) {
-
- }
-
- public ConfiguredService getConfiguredService() {
- return new ConfiguredService() {
-
- public String getName() {
-
- return null;
- }
-
- public void setName(String name) {
-
- }
-
- public Service getPort() {
- return new Service() {
-
- public ServiceContract getServiceContract() {
- return new ServiceContract() {
-
- public Class getInterface() {
- return Foo.class;
- }
-
- public void setInterface(Class value) {
-
- }
-
- public Class getCallbackInterface() {
-
- return null;
- }
-
- public void setCallbackInterface(Class value) {
-
- }
-
- public Scope getScope() {
-
- return null;
- }
-
- public void setScope(Scope scope) {
-
- }
-
- public List<Object> getExtensibilityElements() {
-
- return null;
- }
-
- public List<Object> getExtensibilityAttributes() {
-
- return null;
- }
-
- public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException {
-
- }
-
- public void freeze() {
-
- }
-
- public boolean accept(AssemblyVisitor visitor) {
-
- return false;
- }
- };
- }
-
- public void setServiceContract(ServiceContract contract) {
-
- }
-
- public String getName() {
-
- return null;
- }
-
- public void setName(String name) {
-
- }
-
- public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException {
-
- }
-
- public void freeze() {
-
- }
-
- public boolean accept(AssemblyVisitor visitor) {
-
- return false;
- }
- };
- }
-
- public void setPort(Service port) {
-
- }
-
- public Part getPart() {
-
- return null;
- }
-
- public void setPart(Part part) {
-
- }
-
- public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException {
-
- }
-
- public void freeze() {
-
- }
-
- public boolean accept(AssemblyVisitor visitor) {
-
- return false;
- }
-
- public void setProxyFactory(Object proxyFactory) {
-
- }
-
- public Object getProxyFactory() {
-
- return null;
- }
- };
- }
-
- public void setConfiguredService(ConfiguredService configuredService) {
-
- }
-
- public String getName() {
-
- return "myService";
- }
-
- public void setName(String value) {
-
- }
-
- public Composite getComposite() {
-
- return null;
- }
-
- public void setComposite(Composite composite) {
-
- }
-
- public List<Object> getExtensibilityElements() {
-
- return null;
- }
-
- public List<Object> getExtensibilityAttributes() {
-
- return null;
- }
-
- public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException {
-
- }
-
- public void freeze() {
-
- }
-
- public boolean accept(AssemblyVisitor visitor) {
-
- return false;
- }
-
- public void setContextFactory(Object contextFactory) {
-
- }
-
- public Object getContextFactory() {
-
- return null;
- }
- };
- return es;
- }
-
- private Binding createMockBinding() {
- WebServiceBinding b = new WebServiceBinding() {
-
- public void setPortURI(String portURI) {
-
- }
-
- public Port getWSDLPort() {
- return definition.getService(SERVICE_NAME).getPort(PORTNAME);
- }
-
- public Definition getWSDLDefinition() {
- return definition;
- }
-
- public void setWSDLPort(Port value) {
-
- }
-
- public void setWSDLDefinition(Definition definition) {
-
- }
-
- public TypeHelper getTypeHelper() {
-
- return null;
- }
-
- public void setTypeHelper(TypeHelper typeHelper) {
-
- }
-
- public ResourceLoader getResourceLoader() {
- return new ResourceLoaderImpl(Thread.currentThread().getContextClassLoader());
- }
-
- public void setResourceLoader(ResourceLoader resourceLoader) {
-
- }
-
- public String getURI() {
-
- return null;
- }
-
- public void setURI(String value) {
-
- }
-
- public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException {
-
- }
-
- public void freeze() {
-
- }
-
- public boolean accept(AssemblyVisitor visitor) {
-
- return false;
- }
-
- public void setWebAppName(String webAppName) {
- }
-
- public String getWebAppName() {
- return null;
- }
-
- };
- return b;
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldService.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldService.java deleted file mode 100644 index 6d046d84c4..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldService.java +++ /dev/null @@ -1,26 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.axis2.handler;
-
-/**
- * This is the business interface of the HelloWorld service component.
- */
-public interface HelloWorldService {
-
- String getGreetings(String name);
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldServiceComponentImpl.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldServiceComponentImpl.java deleted file mode 100644 index 972b94e5a7..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldServiceComponentImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.axis2.handler;
-
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * This class implements the HelloWorld service component.
- */
-@Service(HelloWorldService.class)
-//FIXME workaround for JIRA TUSCANY-41
-@Scope("MODULE")
-public class HelloWorldServiceComponentImpl implements HelloWorldService {
-
- @Reference
- // Injected by the SCA container.
- private HelloWorldService hellowWorldService;
-
- /**
- * @see org.apache.tuscany.samples.helloworldwsclient.HelloWorldService#getGreetings(java.lang.String)
- */
- public String getGreetings(final String name) {
- assert null != hellowWorldService : "helloWorldService was not set by the SCA runtime!";
-
- return hellowWorldService.getGreetings(name);
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/util/SDODataBindingTestCase.java b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/util/SDODataBindingTestCase.java deleted file mode 100644 index 621f12068c..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/util/SDODataBindingTestCase.java +++ /dev/null @@ -1,123 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.axis2.util;
-
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sdo.util.DataObjectUtil;
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.DataFactory;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.helper.XSDHelper;
-
-public class SDODataBindingTestCase extends TestCase {
- public static final QName DOCLITWRAPPED_QN = new QName("http://www.example.org/creditscore/doclitwrapped/", "getCreditScore");
-
- public static final QName DOCLIT_QN = new QName("http://www.example.org/creditscore/doclit/", "getCreditScoreRequest");
-
- public static final QName GREETING_QN = new QName("http://helloworldaxis.samples.tuscany.apache.org", "getGreetings");
-
- private TypeHelper typeHelper;
-
- private SDODataBinding docLitWrappedDB;
-
- private SDODataBinding docLitDB;
-
- private SDODataBinding greetingDB;
-
- public void testToOMElement() {
- String s = "petra";
-
- OMElement omElement = greetingDB.toOMElement(new Object[] { s });
- assertNotNull(omElement);
-
- Object[] os = greetingDB.fromOMElement(omElement);
- assertNotNull(os);
- assertEquals(1, os.length);
- assertEquals(s, os[0]);
- }
-
- public void testDocLit() {
- DataFactory dataFactory = SDOUtil.createDataFactory(typeHelper);
- DataObject dataObject = dataFactory.create("http://www.example.org/creditscore/doclit/", "Customer");
- dataObject.setString(0, "111-22-3333");
- dataObject.setString(1, "John");
- dataObject.setString(2, "Smith");
-
- OMElement omElement = docLitDB.toOMElement(new Object[] { dataObject });
- assertNotNull(omElement);
-
- Object[] os = docLitDB.fromOMElement(omElement);
- assertNotNull(os);
- assertEquals(os.length, 1);
- assertTrue(os[0] instanceof DataObject);
-
- dataObject = (DataObject) os[0];
- assertEquals(dataObject.getString(0), "111-22-3333");
- assertEquals(dataObject.getString(1), "John");
- assertEquals(dataObject.getString(2), "Smith");
- }
-
- public void testDocLitWrapped() {
- Object[] args = new Object[] { "111-22-3333", "John", "Smith" };
-
- OMElement omElement = docLitWrappedDB.toOMElement(args);
- assertNotNull(omElement);
-
- Object[] os = docLitWrappedDB.fromOMElement(omElement);
- assertNotNull(os);
- assertEquals(os.length, 3);
-
- assertEquals(os[0], "111-22-3333");
- assertEquals(os[1], "John");
- assertEquals(os[2], "Smith");
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- DataObjectUtil.initRuntime();
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
- typeHelper = SDOUtil.createTypeHelper();
- XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
- URL url = getClass().getResource("helloworld.wsdl");
- xsdHelper.define(url.openStream(), null);
- url = getClass().getResource("CreditScoreDocLitWrapped.wsdl");
- xsdHelper.define(url.openStream(), null);
- url = getClass().getResource("CreditScoreDocLit.wsdl");
- xsdHelper.define(url.openStream(), null);
-
- this.greetingDB = new SDODataBinding(getClass().getClassLoader(),typeHelper, GREETING_QN, true);
- this.docLitWrappedDB = new SDODataBinding(getClass().getClassLoader(),typeHelper, DOCLITWRAPPED_QN, true);
-
- this.docLitDB = new SDODataBinding(getClass().getClassLoader(),typeHelper, DOCLIT_QN, false);
-
- } finally {
- Thread.currentThread().setContextClassLoader(cl);
- }
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.wsdl b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.wsdl deleted file mode 100644 index b62a2c09da..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.wsdl +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.bigbank.com/AccountService/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.bigbank.com/AccountService/"
-
- name="AccountService">
-
- <wsdl:types>
- <xsd:schema targetNamespace="http://www.bigbank.com/AccountService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <xsd:element name="customerID" type="xsd:string"/>
- <xsd:element name="getAccountReportResponse" type="tns:AccountReport"/>
-
- <xsd:complexType name="AccountReport">
- <xsd:sequence>
- <xsd:element name="accountSummary" type="tns:AccountSummary" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="AccountSummary">
- <xsd:sequence>
- <xsd:element name="accountNumber" type="xsd:string"/>
- <xsd:element name="accountType" type="xsd:string"/>
- <xsd:element name="balance" type="xsd:float"/>
- </xsd:sequence>
- </xsd:complexType>
-
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="getAccountReportRequest">
- <wsdl:part element="tns:customerID" name="getAccountReportRequest"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportResponse">
- <wsdl:part element="tns:getAccountReportResponse" name="getAccountReportResponse"/>
- </wsdl:message>
- <wsdl:portType name="AccountService">
- <wsdl:operation name="getAccountReport">
- <wsdl:input message="tns:getAccountReportRequest"/>
- <wsdl:output message="tns:getAccountReportResponse"/>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="AccountServiceSOAP" type="tns:AccountService">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getAccountReport">
- <soap:operation
- soapAction="http://www.bigbank.com/AccountService/getAccountReport"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="AccountService">
- <wsdl:port binding="tns:AccountServiceSOAP"
- name="AccountServiceSOAP">
- <soap:address location="http://localhost:8080/tuscany-binding-axis2/services/AccountService"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl deleted file mode 100644 index 6af61ef80e..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl +++ /dev/null @@ -1,98 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions targetNamespace="http://webservice.stockquote" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice.stockquote" xmlns:intf="http://webservice.stockquote" xmlns:tns1="http://stockquote" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="stockquote">
- <!--WSDL created by Apache Axis version: 1.2.1
-Built on Jun 14, 2005 (09:15:57 EDT)-->
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
- <complexType name="GetQuoteRequest">
- <sequence>
- <element name="symbol" nillable="true" type="xsd:string"/>
- </sequence>
- </complexType>
- <complexType name="GetQuoteResponse">
- <sequence>
- <element name="price" type="xsd:float"/>
- </sequence>
- </complexType>
- </schema>
- <schema elementFormDefault="qualified" targetNamespace="http://webservice.stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
- <import namespace="http://stockquote"/>
- <element name="request" type="tns1:GetQuoteRequest"/>
- <element name="getQuoteReturn" type="tns1:GetQuoteResponse"/>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getQuoteResponse">
-
- <wsdl:part element="impl:getQuoteReturn" name="getQuoteReturn"/>
-
- </wsdl:message>
-
- <wsdl:message name="getQuoteRequest">
-
- <wsdl:part element="impl:request" name="request"/>
-
- </wsdl:message>
-
- <wsdl:portType name="StockQuoteWebService">
-
- <wsdl:operation name="getQuote" parameterOrder="request">
-
- <wsdl:input message="impl:getQuoteRequest" name="getQuoteRequest"/>
-
- <wsdl:output message="impl:getQuoteResponse" name="getQuoteResponse"/>
-
- </wsdl:operation>
-
- </wsdl:portType>
-
- <wsdl:binding name="StockQuoteWebServiceSoapBinding" type="impl:StockQuoteWebService">
-
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <wsdl:operation name="getQuote">
-
- <wsdlsoap:operation soapAction=""/>
-
- <wsdl:input name="getQuoteRequest">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:input>
-
- <wsdl:output name="getQuoteResponse">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:output>
-
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:service name="StockQuoteWebServiceService">
-
- <wsdl:port binding="impl:StockQuoteWebServiceSoapBinding" name="StockQuoteWebService">
-
- <wsdlsoap:address location="http://localhost:8123/StockQuoteWebService/services/StockQuoteWebService"/>
-
- </wsdl:port>
-
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/sca.module b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/sca.module deleted file mode 100644 index 6c0b70b25e..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/sca.module +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- name="tuscany.binding.axis2.assembly.tests.bigbank.account">
-
- <import.wsdl wsdlLocation="org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.wsdl"/>
- <import.wsdl wsdlLocation="org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl"/>
-
- <entryPoint name="AccountService">
- <interface.java interface="org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account.AccountService"/>
- <binding.ws port="http://www.bigbank.com/AccountService/#wsdl.endpoint(AccountService/AccountServiceSOAP)"/>
- <reference>AccountExternalService</reference>
- </entryPoint>
-
- <entryPoint name="AccountService2"> - <interface.wsdl interface="http://www.bigbank.com/AccountService/#wsdl.interface(AccountService)"/> - <binding.ws port="http://www.bigbank.com/AccountService/#wsdl.endpoint(AccountService/AccountServiceSOAP)"/> - <reference>AccountExternalService</reference> - </entryPoint> - - <component name="AccountServiceComponent">
- <implementation.java class="org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account.AccountServiceImpl"/>
- </component>
-
- <component name="AccountDataServiceComponent">
- <implementation.java class="org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata.AccountDataServiceImpl"/>
- </component>
-
- <!--
- <component name="StockQuoteService">
- <implementation.java class="org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.stockquote.StockQuoteServiceImpl"/>
- </component>
- -->
-
- <externalService name="AccountExternalService"> - <interface.wsdl interface="http://www.bigbank.com/AccountService/#wsdl.interface(AccountService)"/> - <binding.ws port="http://www.bigbank.com/AccountService/#wsdl.endpoint(AccountService/AccountServiceSOAP)"/> - </externalService> - - <externalService name="StockQuoteService">
- <interface.java interface="org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.stockquote.StockQuoteService"/>
- <binding.ws port="http://webservice.stockquote#wsdl.endpoint(StockQuoteWebServiceService/StockQuoteWebService)"/>
- </externalService> - -</module>
-
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/builder/helloworld.wsdl b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/builder/helloworld.wsdl deleted file mode 100644 index 465f1fd4af..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/builder/helloworld.wsdl +++ /dev/null @@ -1,103 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
- <!--WSDL created by Apache Axis version: 1.2.1
-Built on Jun 14, 2005 (09:15:57 EDT)-->
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="in0" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
-
- <wsdl:part element="impl:getGreetings" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
-
- <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:portType name="HelloWorldServiceImpl">
-
- <wsdl:operation name="getGreetings">
-
- <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
-
- <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
-
- </wsdl:operation>
-
- </wsdl:portType>
-
- <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
-
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <wsdl:operation name="getGreetings">
-
- <wsdlsoap:operation soapAction=""/>
-
- <wsdl:input name="getGreetingsRequest">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:input>
-
- <wsdl:output name="getGreetingsResponse">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:output>
-
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldServiceImplService">
-
- <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
-
- <!-- Tuscany SCA Service --> - <wsdlsoap:address location="http://localhost:8080/sample-helloworldws/services/HelloWorldService"/> -
- <!-- Axis Web Service -->
- <!-- - <wsdlsoap:address location="http://localhost:8081/helloworldaxissvc/services/helloworld"/>
- --> -
- </wsdl:port>
-
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/helloworld.wsdl b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/helloworld.wsdl deleted file mode 100644 index 465f1fd4af..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/helloworld.wsdl +++ /dev/null @@ -1,103 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
- <!--WSDL created by Apache Axis version: 1.2.1
-Built on Jun 14, 2005 (09:15:57 EDT)-->
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="in0" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
-
- <wsdl:part element="impl:getGreetings" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
-
- <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:portType name="HelloWorldServiceImpl">
-
- <wsdl:operation name="getGreetings">
-
- <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
-
- <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
-
- </wsdl:operation>
-
- </wsdl:portType>
-
- <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
-
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <wsdl:operation name="getGreetings">
-
- <wsdlsoap:operation soapAction=""/>
-
- <wsdl:input name="getGreetingsRequest">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:input>
-
- <wsdl:output name="getGreetingsResponse">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:output>
-
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldServiceImplService">
-
- <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
-
- <!-- Tuscany SCA Service --> - <wsdlsoap:address location="http://localhost:8080/sample-helloworldws/services/HelloWorldService"/> -
- <!-- Axis Web Service -->
- <!-- - <wsdlsoap:address location="http://localhost:8081/helloworldaxissvc/services/helloworld"/>
- --> -
- </wsdl:port>
-
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/sca.module b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/sca.module deleted file mode 100644 index f1433f4648..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/sca.module +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- name="org.apache.tuscany.binding.axis2.handler.helloworld">
-
- <import.wsdl wsdlLocation="org/apache/tuscany/binding/axis2/handler/helloworld.wsdl"/>
-
- <component name="HelloWorldServiceComponent">
- <implementation.java class="org.apache.tuscany.binding.axis2.handler.HelloWorldServiceComponentImpl"/>
- <references>
- <v:hellowWorldService>HelloWorldService</v:hellowWorldService>
- </references>
- </component>
-
- <externalService name="HelloWorldService">
- <interface.wsdl interface="http://helloworldaxis.samples.tuscany.apache.org#wsdl.interface(HelloWorldServiceImpl)"/>
- <binding.ws port="http://helloworldaxis.samples.tuscany.apache.org#wsdl.endpoint(HelloWorldServiceImplService/helloworld)"/>
- </externalService> - -</module>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLit.wsdl b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLit.wsdl deleted file mode 100644 index 4aec526803..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLit.wsdl +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.example.org/Test/DocLit"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Test"
- targetNamespace="http://www.example.org/Test/DocLit">
- <wsdl:types>
- <xsd:schema targetNamespace="http://www.example.org/Test/DocLit"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="http://www.example.org/Test/DocLit">
- <xsd:element name="source" type="xsd:string"/>
- <xsd:element name="target" type="xsd:string"/>
- <xsd:element name="context" type="xsd:string"/>
- <xsd:element name="index" type="xsd:int"/>
- <xsd:element name="exception" type="xsd:string"/>
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="testRequest">
- <wsdl:part element="tns:source" name="part1"/>
- <wsdl:part element="tns:target" name="part2"/>
- <wsdl:part element="tns:context" name="part3"/>
- </wsdl:message>
- <wsdl:message name="testResponse">
- <wsdl:part element="tns:index" name="part1"/>
- </wsdl:message>
- <wsdl:message name="testFault">
- <wsdl:part name="testFault" element="tns:exception"></wsdl:part>
- </wsdl:message>
- <wsdl:portType name="Test">
- <wsdl:operation name="indexOf">
- <wsdl:input name="input" message="tns:testRequest"/>
- <wsdl:output name="output" message="tns:testResponse"/>
- <wsdl:fault name="fault" message="tns:testFault"/>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="TestSOAP" type="tns:Test">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="indexOf">
- <soap:operation
- soapAction="http://www.example.org/Test/indexOf"/>
- <wsdl:input>
- <soap:body parts="part1 part2" use="literal"/>
- <soap:header message="tns:testRequest" part="part3" use="literal"></soap:header>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- <wsdl:fault name="fault">
- <soap:fault namespace="http://www.example.org/Test/"
- use="literal" name="fault"/>
- </wsdl:fault>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="Test">
- <wsdl:port binding="tns:TestSOAP" name="TestSOAP">
- <soap:address
- location="http://localhost:8080/TestWebServiceMediator/services/Test"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLitWrapped.wsdl b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLitWrapped.wsdl deleted file mode 100644 index 7839d3ea71..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLitWrapped.wsdl +++ /dev/null @@ -1,83 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.example.org/Test/DocLitWrapped"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Test"
- targetNamespace="http://www.example.org/Test/DocLitWrapped">
- <wsdl:types>
- <xsd:schema targetNamespace="http://www.example.org/Test/DocLitWrapped"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/Test/DocLitWrapped">
- <xsd:element name="indexOf">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="source" type="xsd:string"/>
- <xsd:element name="target" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="indexOfResponse">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="index" type="xsd:int"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="exception" type="xsd:string"/>
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="testRequest">
- <wsdl:part element="tns:indexOf" name="part1"/>
- </wsdl:message>
- <wsdl:message name="testResponse">
- <wsdl:part element="tns:indexOfResponse" name="part1"/>
- </wsdl:message>
- <wsdl:message name="testFault">
- <wsdl:part name="testFault" element="tns:exception"></wsdl:part>
- </wsdl:message>
- <wsdl:portType name="Test">
- <wsdl:operation name="indexOf">
- <wsdl:input name="input" message="tns:testRequest"/>
- <wsdl:output name="output" message="tns:testResponse"/>
- <wsdl:fault name="fault" message="tns:testFault"/>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="TestSOAP" type="tns:Test">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="indexOf">
- <soap:operation
- soapAction="http://www.example.org/Test/indexOf"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- <wsdl:fault name="fault">
- <soap:fault namespace="http://www.example.org/Test/"
- use="literal" name="fault"/>
- </wsdl:fault>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="Test">
- <wsdl:port binding="tns:TestSOAP" name="TestSOAP">
- <soap:address
- location="http://localhost:8080/TestWebServiceMediator/services/Test"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/RpcLit.wsdl b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/RpcLit.wsdl deleted file mode 100644 index 8f94f9c66f..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/RpcLit.wsdl +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.example.org/Test/RpcLit"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Test"
- targetNamespace="http://www.example.org/Test/RpcLit">
- <wsdl:types>
- <xsd:schema targetNamespace="http://www.example.org/Test/RpcLit"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="http://www.example.org/Test/RpcLit">
- <!--
- <xsd:element name="source" type="xsd:string"/>
- <xsd:element name="target" type="xsd:string"/>
- <xsd:element name="index" type="xsd:int" />
- -->
- <xsd:element name="exception" type="xsd:string"/>
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="testRequest">
- <wsdl:part type="xsd:string" name="part1"/>
- <wsdl:part type="xsd:string" name="part2"/>
- </wsdl:message>
- <wsdl:message name="testResponse">
- <wsdl:part type="xsd:int" name="part1"/>
- </wsdl:message>
- <wsdl:message name="testFault">
- <wsdl:part name="testFault" element="tns:exception"></wsdl:part>
- </wsdl:message>
- <wsdl:portType name="Test">
- <wsdl:operation name="indexOf">
- <wsdl:input name="input" message="tns:testRequest"/>
- <wsdl:output name="output" message="tns:testResponse"/>
- <wsdl:fault name="fault" message="tns:testFault"/>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="TestSOAP" type="tns:Test">
- <soap:binding style="rpc"
- transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="indexOf">
- <soap:operation
- soapAction="http://www.example.org/Test/indexOf"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- <wsdl:fault name="fault">
- <soap:fault namespace="http://www.example.org/Test/"
- use="literal" name="fault"/>
- </wsdl:fault>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="Test">
- <wsdl:port binding="tns:TestSOAP" name="TestSOAP">
- <soap:address
- location="http://localhost:8080/TestWebServiceMediator/services/Test"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/sca.module b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/sca.module deleted file mode 100644 index 7d8bb7861f..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/sca.module +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- name="TestModule">
-
-</module>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLit.wsdl b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLit.wsdl deleted file mode 100644 index 09d1a58589..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLit.wsdl +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.example.org/creditscore/doclit/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditScore"
- targetNamespace="http://www.example.org/creditscore/doclit/">
- <wsdl:types>
- <xsd:schema
- targetNamespace="http://www.example.org/creditscore/doclit/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:element name="getCreditScoreRequest" type="tns:Customer" />
- <xsd:complexType name="Customer">
- <xsd:sequence>
- <xsd:element name="ssn" type="xsd:string" />
- <xsd:element name="firstName" type="xsd:string" />
- <xsd:element name="lastName" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:element name="getCreditScoreResponse" type="tns:CreditReport"/>
- <xsd:complexType name="CreditReport">
- <xsd:sequence>
- <xsd:element name="score" type="xsd:int"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="getCreditScoreResponse">
- <wsdl:part element="tns:getCreditScoreResponse"
- name="getCreditScoreResponse" />
- </wsdl:message>
- <wsdl:message name="getCreditScoreRequest">
- <wsdl:part element="tns:getCreditScoreRequest"
- name="getCreditScoreRequest" />
- </wsdl:message>
- <wsdl:portType name="CreditScoreDocLit">
- <wsdl:operation name="getCreditScore">
- <wsdl:input message="tns:getCreditScoreRequest" />
- <wsdl:output message="tns:getCreditScoreResponse" />
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="CreditScoreDocLitSOAP" type="tns:CreditScoreDocLit">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getCreditScore">
- <soap:operation
- soapAction="http://www.example.org/creditscore/doclit/getCreditScore" />
- <wsdl:input>
- <soap:body parts="getCreditScoreRequest" use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body parts="getCreditScoreResponse" use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="CreditScore">
- <wsdl:port binding="tns:CreditScoreDocLitSOAP"
- name="CreditScoreDocLitSOAP">
- <soap:address location="http://www.example.org/" />
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLitWrapped.wsdl b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLitWrapped.wsdl deleted file mode 100644 index 3952c74809..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLitWrapped.wsdl +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.example.org/creditscore/doclitwrapped/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditScore"
- targetNamespace="http://www.example.org/creditscore/doclitwrapped/">
- <wsdl:types>
- <xsd:schema
- targetNamespace="http://www.example.org/creditscore/doclitwrapped/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:element name="getCreditScoreResponse">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="score" type="xsd:int" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="getCreditScore">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="ssn" type="xsd:string" />
- <xsd:element name="firstName" type="xsd:string" />
- <xsd:element name="lastName" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="getCreditScoreResponse">
- <wsdl:part element="tns:getCreditScoreResponse"
- name="getCreditScoreResponse" />
- </wsdl:message>
- <wsdl:message name="getCreditScoreRequest">
- <wsdl:part element="tns:getCreditScore"
- name="getCreditScoreRequest" />
- </wsdl:message>
- <wsdl:portType name="CreditScoreDocLitWrapped">
- <wsdl:operation name="getCreditScore">
- <wsdl:input message="tns:getCreditScoreRequest" />
- <wsdl:output message="tns:getCreditScoreResponse" />
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="CreditScoreDocLitWrappedSOAP" type="tns:CreditScoreDocLitWrapped">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getCreditScore">
- <soap:operation
- soapAction="http://www.example.org/creditscore/doclitwrapped/getCreditScore" />
- <wsdl:input>
- <soap:body parts="getCreditScoreRequest" use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body parts="getCreditScoreResponse" use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="CreditScore">
- <wsdl:port binding="tns:CreditScoreDocLitWrappedSOAP"
- name="CreditScoreDocLitWrappedSOAP">
- <soap:address location="http://localhost:8080/CreditScoreService/services/CreditScoreDocLitWrappedSOAP"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/helloworld.wsdl b/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/helloworld.wsdl deleted file mode 100644 index c1d4cdccda..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/helloworld.wsdl +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="stockquote">
- <!--WSDL created by Apache Axis version: 1.2.1
-Built on Jun 14, 2005 (09:15:57 EDT)-->
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="in0" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
-
- <wsdl:part element="impl:getGreetings" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
-
- <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:portType name="HelloWorldServiceImpl">
-
- <wsdl:operation name="getGreetings">
-
- <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
-
- <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
-
- </wsdl:operation>
-
- </wsdl:portType>
-
- <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
-
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <wsdl:operation name="getGreetings">
-
- <wsdlsoap:operation soapAction=""/>
-
- <wsdl:input name="getGreetingsRequest">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:input>
-
- <wsdl:output name="getGreetingsResponse">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:output>
-
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldServiceImplService">
-
- <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
-
- <!-- Tuscany SCA Service --> -<!--
- <wsdlsoap:address location="http://localhost:8080/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
---> - <wsdlsoap:address location="http://localhost:9876/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
-
- <!-- Axis Web Service -->
- <!-- - <wsdlsoap:address location="http://localhost:8081/sample-helloworldaxissvc/services/helloworld"/>
- --> -
- </wsdl:port>
-
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/.checkstyle b/branches/java-M1/java/sca/bindings/binding.celtix/.checkstyle deleted file mode 100644 index 048a1cef2e..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/.checkstyle +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<fileset-config file-format-version="1.2.0" simple-config="true"> - <fileset name="all" enabled="true" check-config-name="Tuscany Checks" local="false"> - <file-match-pattern match-pattern="." include-pattern="true"/> - </fileset> -</fileset-config> diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/.pmd b/branches/java-M1/java/sca/bindings/binding.celtix/.pmd deleted file mode 100644 index 03e6ecf065..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/.pmd +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd>
\ No newline at end of file diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/.ruleset b/branches/java-M1/java/sca/bindings/binding.celtix/.ruleset deleted file mode 100644 index 0bead9a61c..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/.ruleset +++ /dev/null @@ -1,172 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ruleset name="pmd-eclipse"> - <description>PMD Plugin preferences rule set</description> - - - <rule ref="rulesets/basic.xml/BooleanInstantiation"/> - <rule ref="rulesets/basic.xml/CollapsibleIfStatements"/> - <rule ref="rulesets/basic.xml/DoubleCheckedLocking"/> -<!--<rule ref="rulesets/basic.xml/EmptyCatchBlock"/>--> -<!--<rule ref="rulesets/basic.xml/EmptyFinallyBlock"/>--> -<!--<rule ref="rulesets/basic.xml/EmptyIfStmt"/>--> - <rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"/> -<!--<rule ref="rulesets/basic.xml/EmptyStaticInitializer"/>--> -<!--<rule ref="rulesets/basic.xml/EmptySwitchStatements"/>--> -<!--<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"/>--> -<!--<rule ref="rulesets/basic.xml/EmptyTryBlock"/>--> -<!--<rule ref="rulesets/basic.xml/EmptyWhileStmt"/>--> - <rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"/> - <rule ref="rulesets/basic.xml/JumbledIncrementer"/> -<!--<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"/>--> - <rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"/> - <rule ref="rulesets/basic.xml/UnconditionalIfStatement"/> - <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/> - <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/> - <rule ref="rulesets/basic.xml/UnnecessaryReturn"/> -<!--<rule ref="rulesets/basic.xml/UselessOverridingMethod"/>--> - -<!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>--> -<!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>--> -<!--<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"/>--> -<!--<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"/>--> - -<!--<rule ref="rulesets/clone.xml/CloneMethodMustImplementCloneable"/>--> -<!--<rule ref="rulesets/clone.xml/CloneThrowsCloneNotSupportedException"/>--> -<!--<rule ref="rulesets/clone.xml/ProperCloneImplementation"/>--> - -<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>--> -<!--<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>--> -<!--<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>--> -<!--<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>--> -<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>--> -<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>--> - -<rule ref="rulesets/controversial.xml/AssignmentInOperand"/> -<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>--> -<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>--> -<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>--> -<!--<rule ref="rulesets/controversial.xml/NullAssignment"/>--> -<!--<rule ref="rulesets/controversial.xml/OnlyOneReturn"/>--> -<!--<rule ref="rulesets/controversial.xml/SingularField"/>--> -<!--<rule ref="rulesets/controversial.xml/SuspiciousOctalEscape"/>--> -<!--<rule ref="rulesets/controversial.xml/UnnecessaryConstructor"/>--> -<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"/> -<!--<rule ref="rulesets/controversial.xml/UnusedModifier"/>--> - -<!--<rule ref="rulesets/coupling.xml/CouplingBetweenObjects"/>--> -<!--<rule ref="rulesets/coupling.xml/ExcessiveImports"/>--> -<!--<rule ref="rulesets/coupling.xml/LooseCoupling"/>--> - -<!--<rule ref="rulesets/design.xml/AbstractClassWithoutAbstractMethod"/>--> -<!--<rule ref="rulesets/design.xml/AccessorClassGeneration"/>--> -<!--<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"/>--> -<!--<rule ref="rulesets/design.xml/AvoidDeeplyNestedIfStmts"/>--> -<!--<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"/>--> -<rule ref="rulesets/design.xml/AvoidProtectedFieldInFinalClass"/> -<!--<rule ref="rulesets/design.xml/AvoidReassigningParameters"/>--> -<!--<rule ref="rulesets/design.xml/AvoidSynchronizedAtMethodLevel"/>--> -<!--<rule ref="rulesets/design.xml/BadComparison"/>--> -<!--<rule ref="rulesets/design.xml/CloseConnection"/>--> -<!--<rule ref="rulesets/design.xml/CompareObjectsWithEquals"/>--> -<!--<rule ref="rulesets/design.xml/ConfusingTernary"/>--> -<rule ref="rulesets/design.xml/ConstructorCallsOverridableMethod"/> -<!--<rule ref="rulesets/design.xml/DefaultLabelNotLastInSwitchStmt"/>--> -<!--<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"/>--> -<rule ref="rulesets/design.xml/IdempotentOperations"/> -<!--<rule ref="rulesets/design.xml/ImmutableField"/>--> -<!--<rule ref="rulesets/design.xml/InstantiationToGetClass"/>--> -<!--<rule ref="rulesets/design.xml/MissingBreakInSwitch"/>--> -<!--<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"/>--> -<!--<rule ref="rulesets/design.xml/NonCaseLabelInSwitchStatement"/>--> -<!--<rule ref="rulesets/design.xml/NonStaticInitializer"/>--> -<rule ref="rulesets/design.xml/OptimizableToArrayCall"/> -<rule ref="rulesets/design.xml/PositionLiteralsFirstInComparisons"/> -<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"/> -<rule ref="rulesets/design.xml/SimplifyBooleanReturns"/> -<rule ref="rulesets/design.xml/SimplifyConditional"/> -<!--<rule ref="rulesets/design.xml/SwitchDensity"/>--> -<!--<rule ref="rulesets/design.xml/SwitchStmtsShouldHaveDefault"/>--> -<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"/> -<!--<rule ref="rulesets/design.xml/UseLocaleWithCaseConversions"/>--> -<!--<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"/>--> -<!--<rule ref="rulesets/design.xml/UseSingleton"/>--> - -<!--<rule ref="rulesets/finalizers.xml/EmptyFinalizer"/>--> -<!--<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>--> -<!--<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"/>--> -<!--<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>--> -<!--<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"/>--> -<!--<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"/>--> - -<!--<rule ref="rulesets/imports.xml/DuplicateImports"/>--> -<!--<rule ref="rulesets/imports.xml/DontImportJavaLang"/>--> -<!--<rule ref="rulesets/imports.xml/UnusedImports"/>--> -<!--<rule ref="rulesets/imports.xml/ImportFromSamePackage"/>--> - -<!--<rule ref="rulesets/javabeans.xml/BeanMembersShouldSerialize"/>--> -<!--<rule ref="rulesets/javabeans.xml/MissingSerialVersionUID"/>--> - -<!--<rule ref="rulesets/junit.xml/JUnitStaticSuite"/>--> -<!--<rule ref="rulesets/junit.xml/JUnitSpelling"/>--> -<!--<rule ref="rulesets/junit.xml/JUnitAssertionsShouldIncludeMessage"/>--> -<!--<rule ref="rulesets/junit.xml/JUnitTestsShouldIncludeAssert"/>--> -<!--<rule ref="rulesets/junit.xml/TestClassWithoutTestCases"/>--> -<!--<rule ref="rulesets/junit.xml/UnnecessaryBooleanAssertion"/>--> -<!--<rule ref="rulesets/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>--> -<!--<rule ref="rulesets/junit.xml/UseAssertSameInsteadOfAssertTrue"/>--> - - <!--<rule ref="rulesets/logging-java.xml/AvoidPrintStackTrace"/>--> - <rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/> - <!--<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"/>--> - <!--<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"/>--> - <!--<rule ref="rulesets/logging-java.xml/LogBlockWithoutIf"/>--> - <!--<rule ref="rulesets/logging-java.xml/SystemPrintln"/>--> - <!--<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>--> - <!--<rule ref="rulesets/logging-jakarta-commons.xml/ProperLogger"/>--> - - <!--<rule ref="rulesets/naming.xml/ShortVariable"/>--> - <!--<rule ref="rulesets/naming.xml/LongVariable"/>--> - <!--<rule ref="rulesets/naming.xml/ShortMethodName"/>--> - <!--<rule ref="rulesets/naming.xml/VariableNamingConventions"/>--> - <!--<rule ref="rulesets/naming.xml/MethodNamingConventions"/>--> - <!--<rule ref="rulesets/naming.xml/ClassNamingConventions"/>--> - <!--<rule ref="rulesets/naming.xml/AbstractNaming"/>--> - <!--<rule ref="rulesets/naming.xml/AvoidDollarSigns"/>--> - <!--<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"/>--> - <!--<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"/>--> - <!--<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"/>--> - <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingTypeName"/>--> - <!--<rule ref="rulesets/naming.xml/AvoidFieldNameMatchingMethodName"/>--> - <!--<rule ref="rulesets/naming.xml/AvoidNonConstructorMethodsWithClassName"/>--> - <!--<rule ref="rulesets/naming.xml/NoPackage"/>--> - <!--<rule ref="rulesets/naming.xml/PackageCase"/>--> - - <!--<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"/>--> - <!--<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"/>--> - <!--<rule ref="rulesets/optimizations.xml/AvoidInstantiatingObjectsInLoops"/>--> - <!--<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"/>--> - <!--<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"/>--> - <!--<rule ref="rulesets/optimizations.xml/UseStringBufferForStringAppends"/>--> - - <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"/>--> - <!--<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"/>--> - <!--<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"/>--> - <!--<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"/>--> - <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"/>--> - <!--<rule ref="rulesets/strictexception.xml/AvoidThrowingNullPointerException"/>--> - - <!--<rule ref="rulesets/strings.xml/AvoidDuplicateLiterals"/>--> - <!--<rule ref="rulesets/strings.xml/StringInstantiation"/>--> - <!--<rule ref="rulesets/strings.xml/StringToString"/>--> - <!--<rule ref="rulesets/strings.xml/AvoidConcatenatingNonLiteralsInStringBuffer"/>--> - <!--<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"/>--> - - <!--<rule ref="rulesets/sunsecure.xml/MethodReturnsInternalArray"/>--> - <!--<rule ref="rulesets/sunsecure.xml/ArrayIsStoredDirectly"/>--> - - <rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/> - <rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/> - <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/> - <!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>--> - -</ruleset> diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/checkstyle.xml b/branches/java-M1/java/sca/bindings/binding.celtix/checkstyle.xml deleted file mode 100644 index 9fa44fb41d..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/checkstyle.xml +++ /dev/null @@ -1,279 +0,0 @@ -<?xml version="1.0"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<!DOCTYPE module PUBLIC - "-//Puppy Crawl//DTD Check Configuration 1.2//EN" - "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> - -<!-- -Checks to make sure the code meets the Tuscany coding guidelines -http://java.sun.com/docs/codeconv/index.html - -It also enforces aa bunch of other "BestPractices like method -lengths, if/try depths, etc... - ---> - -<module name="Checker"> - <!-- Checks whether files end with a new line. --> - <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --> - <!-- - <module name="NewlineAtEndOfFile"/> - --> - - <!-- Checks that property files contain the same keys. --> - <!-- See http://checkstyle.sf.net/config_misc.html#Translation --> - <module name="Translation"/> - - <!--<module name="StrictDuplicateCode"/>--> - - <module name="TreeWalker"> - - <!-- Checks for Javadoc comments. --> - <!-- See http://checkstyle.sf.net/config_javadoc.html --> - <!-- - <module name="PackageHtml"/> - <module name="JavadocMethod"/> - <module name="JavadocType"/> - <module name="JavadocVariable"/> - <module name="JavadocStyle"/> - --> - - - <!-- Checks for Naming Conventions. --> - <!-- See http://checkstyle.sf.net/config_naming.html --> - <module name="AbstractClassName"> - <property name="format" - value="^Abstract.*$|^.*Factory$|^.*Bus$|^.*ConfigurationRepository$|^.*Base$|^Exception$|^.*Builder$"/> - </module> - <module name="ConstantName"/> - <module name="LocalFinalVariableName"/> - <module name="LocalVariableName"/> - <module name="MemberName"/> - <module name="MethodName"/> - <module name="PackageName"/> - <module name="ParameterName"/> - <module name="StaticVariableName"/> - <module name="TypeName"/> - - <!-- Header checks --> - <!-- <module name="Header"/> --> - <!-- <module name="RegexpHeader"/> --> - - - <!-- Checks for imports --> - <!-- See http://checkstyle.sf.net/config_import.html --> - <module name="AvoidStarImport"> - <property name="excludes" - value="java.io,java.util,java.net,java.nio,java.nio.channels,java.lang.reflect,org.w3c.dom,org.xml.sax,java.awt,javax.swing,junit.framework"/> - </module> - <module name="IllegalImport"/> - <!-- defaults to sun.* packages --> - <module name="RedundantImport"/> - <module name="UnusedImports"/> - <module name="ImportOrder"> - <property name="groups" value="java,javax,org.w3c,org.xml,w3c"/> - <property name="ordered" value="true"/> - </module> - <!-- - <module name="ImportControl"> - <property name="file" value="etc/import-control.xml"/> - </module> - --> - - - <!-- Checks for Size Violations. --> - <!-- See http://checkstyle.sf.net/config_sizes.html --> - <module name="AnonInnerLength"> - <property name="max" value="40"/> - </module> - <module name="ExecutableStatementCount"> - <property name="max" value="50"/> - </module> - <module name="FileLength"/> - <module name="LineLength"> - <property name="max" value="115"/> - </module> - <module name="MethodLength"> - <property name="max" value="150"/> - <property name="countEmpty" value="false"/> - </module> - <module name="ParameterNumber"> - <property name="max" value="7"/> - </module> - - <!-- Checks for whitespace --> - <!-- See http://checkstyle.sf.net/config_whitespace.html --> - <module name="EmptyForIteratorPad"/> - <module name="EmptyForInitializerPad"/> - <module name="MethodParamPad"/> - <module name="NoWhitespaceAfter"/> - <module name="NoWhitespaceBefore"/> - <module name="OperatorWrap"/> - <module name="ParenPad"/> - <module name="TypecastParenPad"/> - <module name="TabCharacter"/> - <module name="WhitespaceAfter"> - <property name="tokens" value="COMMA, SEMI"/> - </module> - <module name="WhitespaceAround"> - <property name="tokens" - value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,TYPE_EXTENSION_AND"/> - </module> - - - <!-- Modifier Checks --> - <!-- See http://checkstyle.sf.net/config_modifiers.html --> - <module name="ModifierOrder"/> - <module name="RedundantModifier"/> - - - <!-- Checks for blocks. You know, those {}'s --> - <!-- See http://checkstyle.sf.net/config_blocks.html --> - <module name="AvoidNestedBlocks"> - <property name="allowInSwitchCase" value="true"/> - </module> - <module name="EmptyBlock"> - <property name="option" value="text"/> - </module> - <module name="LeftCurly"/> - <module name="NeedBraces"/> - <module name="RightCurly"/> - - - <!-- Checks for common coding problems --> - <!-- See http://checkstyle.sf.net/config_coding.html --> - <!--<module name="ArrayTrailingComma"/>--> - <!--<module name="AvoidInlineConditionals"/>--> - <module name="CovariantEquals"/> - <module name="DoubleCheckedLocking"/> - <module name="EmptyStatement"/> - <module name="EqualsHashCode"/> - <!--<module name="FinalLocalVariable"/>--> - <module name="HiddenField"> - <property name="ignoreConstructorParameter" value="true"/> - <property name="ignoreSetter" value="true"/> - <property name="ignoreAbstractMethods" value="true"/> - </module> - <module name="IllegalInstantiation"/> - <!--<module name="IllegalToken"/>--> - <!--<module name="IllegalTokenText"/>--> - <!--<module name="InnerAssignment"/>--> - <!--<module name="MagicNumber"/>--> - <module name="MissingSwitchDefault"/> - <module name="ModifiedControlVariable"/> - <module name="SimplifyBooleanExpression"/> - <module name="SimplifyBooleanReturn"/> - <module name="StringLiteralEquality"/> - <module name="NestedIfDepth"> - <property name="max" value="3"/> - </module> - <module name="NestedTryDepth"> - <property name="max" value="3"/> - </module> - <module name="SuperClone"/> - <module name="SuperFinalize"/> - <!--<module name="IllegalCatch"/>--> - <module name="IllegalThrows"> - <property name="illegalClassNames" value="java.lang.Error,java.lang.RuntimeException"/> - </module> - <!--<module name="RedundantThrows"/>--> - <module name="PackageDeclaration"/> - <module name="JUnitTestCase"/> - <module name="ReturnCount"> - <property name="max" value="6"/> - </module> - - <module name="IllegalType"> - <property name="format" value="^xxx$"/> - </module> - <module name="DeclarationOrder"/> - <!--<module name="ParameterAssignment"/>--> - <module name="ExplicitInitialization"/> - <module name="DefaultComesLast"/> - <!--<module name="MissingCtor"/>--> - <module name="FallThrough"/> - <!--<module name="MultipleStringLiterals"/>--> - <module name="MultipleVariableDeclarations"/> - <!--<module name="RequireThis"/>--> - <module name="UnnecessaryParentheses"/> - - - <!-- Checks for class design --> - <!-- See http://checkstyle.sf.net/config_design.html --> - <!--<module name="DesignForExtension"/>--> - <module name="FinalClass"/> - <module name="HideUtilityClassConstructor"/> - <module name="InterfaceIsType"/> - <module name="MutableException"/> - <module name="ThrowsCount"> - <property name="max" value="5"/> - </module> - <module name="VisibilityModifier"> - <property name="protectedAllowed" value="true"/> - <property name="packageAllowed" value="true"/> - </module> - - - <!-- Metrics checks. --> - <!-- See http://checkstyle.sf.net/config_metrics.html --> - <module name="BooleanExpressionComplexity"> - <property name="max" value="6"/> - </module> - <!--<module name="ClassDataAbstractionCoupling"/>--> - <!--<module name="ClassFanOutComplexity"/>--> - <!--<module name="CyclomaticComplexity"/>--> - <!--<module name="NPathComplexity"/>--> - <module name="JavaNCSS"> - <property name="methodMaximum" value="75"/> - </module> - - - <!-- Miscellaneous other checks. --> - <!-- See http://checkstyle.sf.net/config_misc.html --> - <!-- - <module name="ArrayTypeStyle"/> - <module name="FinalParameters"/> - --> - <!-- - <module name="GenericIllegalRegexp"> - <property name="format" value="\s+$"/> - <property name="message" value="Line has trailing spaces."/> - </module> - --> - <module name="TodoComment"> - <property name="format" value="WARNING"/> - </module> - - <module name="UpperEll"/> - - <!--Assert statement may have side effects:--> - <module name="DescendantToken"> - <property name="tokens" value="LITERAL_ASSERT"/> - <property name="limitedTokens" - value="ASSIGN,DEC,INC,POST_DEC,POST_INC,PLUS_ASSIGN,MINUS_ASSIGN,STAR_ASSIGN,DIV_ASSIGN,MOD_ASSIGN,BSR_ASSIGN,SR_ASSIGN,SL_ASSIGN,BAND_ASSIGN,BXOR_ASSIGN,BOR_ASSIGN"/> - <property name="maximumNumber" value="0"/> - </module> - - <!--<module name="UncommentedMain"/>--> - <module name="TrailingComment"/> - <module name="Indentation"> - <property name="caseIndent" value="0"/> - </module> - <!--<module name="RequiredRegexp">--> - </module> - -</module> diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/pom.xml b/branches/java-M1/java/sca/bindings/binding.celtix/pom.xml deleted file mode 100644 index a33141e5f2..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/pom.xml +++ /dev/null @@ -1,165 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project> - - <parent> - <groupId>org.apache.tuscany.sca.bindings</groupId> - <artifactId>tuscany-sca-bindings</artifactId> - <version>incubating-M1</version> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>tuscany-binding-celtix</artifactId> - <name>Tuscany Celtix Binding</name> - <description>Implementation of the SCA Web Services binding using Celtix.</description> - <version>incubating-M1</version> - - <properties> - <celtix.version>1.0</celtix.version> - <compiler.flags>-Xlint:unchecked,deprecation,fallthrough,finally</compiler.flags> - </properties> - <repositories> - <repository> - <id>objectweb</id> - <name>ObjectWeb repo</name> - <url>http://maven.objectweb.org/maven2</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - </repositories> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-core</artifactId> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.tuscany.databinding</groupId> - <artifactId>tuscany-databinding-sdo</artifactId> - <version>${pom.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.tuscany.sca.containers</groupId> - <artifactId>tuscany-container-java</artifactId> - <version>${pom.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - - - <dependency> - <groupId>org.easymock</groupId> - <artifactId>easymockclassextension</artifactId> - <version>2.2</version> - <scope>test</scope> - </dependency> - - <!-- Celtix --> - <dependency> - <groupId>org.objectweb.celtix</groupId> - <artifactId>celtix-rt</artifactId> - <version>${celtix.version}</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - <showDeprecation>true</showDeprecation> - <compilerArgument>${compile.flags}</compilerArgument> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - <executions> - <execution> - <id>process-sources</id> - <phase>process-sources</phase> - <configuration> - <configLocation>${basedir}/checkstyle.xml</configLocation> - <consoleOutput>true</consoleOutput> - <failsOnError>true</failsOnError> - </configuration> - <goals> - <goal>checkstyle</goal> - </goals> - </execution> - </executions> - </plugin> - - <!-- This won't work until 2.0 of PMD plugin is released - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-pmd-plugin</artifactId> - <executions> - <execution> - <id>process-sources</id> - <phase>process-sources</phase> - <configuration> - <targetJdk>1.5</targetJdk> - <rulesets> - <ruleset>.ruleset</ruleset> - </rulesets> - <failOnViolation>true</failOnViolation> - </configuration> - <goals> - <goal>check</goal> - </goals> - </execution> - </executions> - </plugin> - --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-eclipse-plugin</artifactId> - <configuration> - <downloadSources>true</downloadSources> - <buildcommands> - <java.lang.String>org.eclipse.jdt.core.javabuilder</java.lang.String> - <java.lang.String>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</java.lang.String> - <java.lang.String>net.sourceforge.pmd.eclipse.pmdBuilder</java.lang.String> - </buildcommands> - <projectnatures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> - <nature>net.sourceforge.pmd.eclipse.pmdNature</nature> - </projectnatures> - </configuration> - </plugin> - </plugins> - </build> - -</project> diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactory.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactory.java deleted file mode 100644 index 46d5cac4dd..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.assembly; - -import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; -import org.apache.tuscany.model.assembly.AssemblyFactory; - -/** - * The <b>Factory</b> for the model. - */ -public interface WebServiceAssemblyFactory extends AssemblyFactory { - - /** - * Returns a new WebServiceBinding. - */ - WebServiceBinding createWebServiceBinding(WSDLDefinitionRegistry wsdlRegistry); - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java deleted file mode 100644 index 82dd08ef0d..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.assembly; - -import javax.wsdl.Definition; -import javax.wsdl.Port; -import javax.wsdl.Service; - -import commonj.sdo.helper.TypeHelper; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.Binding; -import org.objectweb.celtix.Bus; - -/** - * Represents a Web service binding. - */ -public interface WebServiceBinding extends Binding { - - /** - * Set the URI of the WSDL port for this binding. - * - * @param portURI the URI of the WSDL port - */ - void setPortURI(String portURI); - - /** - * Returns the WSDL port defining this binding. - */ - Port getWSDLPort(); - - /** - * Returns the WSDL service defining this binding. - */ - Service getWSDLService(); - - /** - * Returns the WSDL definition containing the WSDL port. - * - * @return the WSDL definition containing the WSDL port - */ - Definition getWSDLDefinition(); - - /** - * Sets the WSDL port defining this binding. - */ - void setWSDLPort(Port value); - - /** - * Sets the WSDL definition containing the WSDL port. - * - * @param definition - */ - void setWSDLDefinition(Definition definition); - - TypeHelper getTypeHelper(); - - void setTypeHelper(TypeHelper typeHelper); - - ResourceLoader getResourceLoader(); - - void setResourceLoader(ResourceLoader resourceLoader); - - Bus getBus(); - void setBus(Bus b); -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceAssemblyFactoryImpl.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceAssemblyFactoryImpl.java deleted file mode 100644 index 1288f67719..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceAssemblyFactoryImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.assembly.impl; - -import org.apache.tuscany.binding.celtix.assembly.WebServiceAssemblyFactory; -import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; -import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; -import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; - -/** - * An implementation of the model <b>Factory</b>. - */ -public class WebServiceAssemblyFactoryImpl extends AssemblyFactoryImpl implements WebServiceAssemblyFactory { - - /** - * Creates an instance of the factory. - */ - public WebServiceAssemblyFactoryImpl() { - super(); - } - - /** - * @see org.apache.tuscany.binding.celtix.assembly.WebServiceAssemblyFactory#createWebServiceBinding() - */ - public WebServiceBinding createWebServiceBinding(WSDLDefinitionRegistry wsdlRegistry) { - return new WebServiceBindingImpl(wsdlRegistry); - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java deleted file mode 100644 index 477d2b656a..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java +++ /dev/null @@ -1,184 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.assembly.impl; - -import java.util.Collection; -import java.util.List; -import javax.wsdl.Definition; -import javax.wsdl.Port; -import javax.wsdl.Service; -import javax.xml.namespace.QName; - -import commonj.sdo.helper.TypeHelper; -import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.impl.BindingImpl; -import org.objectweb.celtix.Bus; - -/** - * An implementation of WebServiceBinding. - */ -public class WebServiceBindingImpl extends BindingImpl implements WebServiceBinding { - - private WSDLDefinitionRegistry wsdlRegistry; - - private Definition definition; - private Port port; - private Service service; - private String portURI; - private TypeHelper typeHelper; - private ResourceLoader resourceLoader; - private Bus bus; - - /** - * Constructor - */ - protected WebServiceBindingImpl(WSDLDefinitionRegistry reg) { - wsdlRegistry = reg; - } - - /** - * @see org.apache.tuscany.binding.celtix.assembly.WebServiceBinding#getWSDLPort() - */ - public Port getWSDLPort() { - return port; - } - - public Service getWSDLService() { - return service; - } - - - - /** - * @see org.apache.tuscany.binding.celtix.assembly.WebServiceBinding#setWSDLPort(javax.wsdl.Port) - */ - public void setWSDLPort(Port value) { - checkNotFrozen(); - port = value; - } - - /** - * @see org.apache.tuscany.binding.celtix.assembly.WebServiceBinding#getWSDLDefinition() - */ - public Definition getWSDLDefinition() { - return definition; - } - - /** - * @see WebServiceBinding#setWSDLDefinition(javax.wsdl.Definition) - */ - public void setWSDLDefinition(Definition def) { - checkNotFrozen(); - definition = def; - } - - /** - * @param uri The portURI to set. - */ - public void setPortURI(String uri) { - portURI = uri; - } - - public TypeHelper getTypeHelper() { - return typeHelper; - } - - public void setTypeHelper(TypeHelper pTypeHelper) { - this.typeHelper = pTypeHelper; - } - - public ResourceLoader getResourceLoader() { - return resourceLoader; - } - - public void setResourceLoader(ResourceLoader resourceLoader) { - this.resourceLoader = resourceLoader; - } - - /** - * @see BindingImpl#initialize(org.apache.tuscany.model.assembly.AssemblyContext) - */ - @SuppressWarnings("unchecked") - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) { - return; - } - super.initialize(modelContext); - - // Get the WSDL port namespace and name - if (port == null && portURI != null) { - int h = portURI.indexOf('#'); - String portNamespace = portURI.substring(0, h); - String serviceName; - String portName; - - String fragment = portURI.substring(h + 1); - if (fragment.startsWith("wsdl.endpoint(") && fragment.endsWith(")")) { - fragment = fragment.substring(14, fragment.length() - 1); - int slash = fragment.indexOf('/'); - if (slash != -1) { - serviceName = fragment.substring(0, slash); - portName = fragment.substring(slash + 1); - } else { - serviceName = null; - portName = fragment; - } - } else { - serviceName = null; - portName = fragment; - } - - // Load the WSDL definitions for the given namespace - List<Definition> definitions = wsdlRegistry.getDefinitionsForNamespace(portNamespace, resourceLoader); - if (definitions == null) { - throw new IllegalArgumentException("Cannot find WSDL definition for " + portNamespace); - } - for (Definition def : definitions) { - - // Find the port with the given name - for (Service serv : (Collection<Service>)def.getServices().values()) { - QName sqn = serv.getQName(); - if (serviceName != null - && !serviceName.equals(sqn.getLocalPart())) { - continue; - } - - Port p = serv.getPort(portName); - if (p != null) { - service = serv; - definition = def; - port = p; - return; - } - } - } - throw new IllegalArgumentException("Cannot find WSDL port " + portURI); - } - } - - public Bus getBus() { - return bus; - } - - public void setBus(Bus b) { - bus = b; - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceBuilder.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceBuilder.java deleted file mode 100644 index 99ffaa5d8a..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceBuilder.java +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.builder; - -import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; -import org.apache.tuscany.binding.celtix.config.ExternalWebServiceContextFactory; -import org.apache.tuscany.binding.celtix.handler.ExternalWebServiceClient; -import org.apache.tuscany.core.extension.ExternalServiceBuilderSupport; -import org.apache.tuscany.core.extension.ExternalServiceContextFactory; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.model.assembly.ExternalService; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - - -/** - * Creates a <code>ContextFactoryBuilder</code> for an external service configured with the {@link - * WebServiceBinding} - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class ExternalWebServiceBuilder extends ExternalServiceBuilderSupport<WebServiceBinding> { - - @Init(eager = true) - public void init() throws Exception { - super.init(); - } - - protected ExternalServiceContextFactory createExternalServiceContextFactory( - ExternalService externalService) { - ExternalWebServiceClient externalWebServiceClient = new ExternalWebServiceClient(externalService); - return new ExternalWebServiceContextFactory(externalService.getName(), - new SingletonObjectFactory<ExternalWebServiceClient>(externalWebServiceClient)); - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceWireBuilder.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceWireBuilder.java deleted file mode 100644 index e16456f80c..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceWireBuilder.java +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.builder; - -import java.lang.reflect.Method; - -import org.apache.tuscany.binding.celtix.config.ExternalWebServiceContextFactory; -import org.apache.tuscany.binding.celtix.handler.ExternalWebServiceTargetInvoker; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.extension.WireBuilderSupport; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.osoa.sca.annotations.Scope; - - -@Scope("MODULE") -public class ExternalWebServiceWireBuilder extends WireBuilderSupport<ExternalWebServiceContextFactory> { - - protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, - ScopeContext context, boolean downScope) { - return new ExternalWebServiceTargetInvoker(targetName, operation, context); - } -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/WebServiceEntryPointBuilder.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/WebServiceEntryPointBuilder.java deleted file mode 100644 index 705b8c9784..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/WebServiceEntryPointBuilder.java +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.builder; - -import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; -import org.apache.tuscany.binding.celtix.config.WebServiceEntryPointContextFactory; - -import org.apache.tuscany.core.extension.EntryPointBuilderSupport; -import org.apache.tuscany.core.extension.EntryPointContextFactory; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.webapp.ServletHost; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.osoa.sca.annotations.Scope; - -/** - * Creates a <code>ContextFactory</code> for an entry point configured with the {@link WebServiceBinding} - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class WebServiceEntryPointBuilder extends EntryPointBuilderSupport<WebServiceBinding> { - ServletHost tomcatHost; - - @Autowire - public void setTomcatHost(ServletHost tomcatHost) { - this.tomcatHost = tomcatHost; - } - - - protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, - MessageFactory msgFactory) { - return new WebServiceEntryPointContextFactory(tomcatHost, entryPoint, msgFactory); - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/ExternalWebServiceContextFactory.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/ExternalWebServiceContextFactory.java deleted file mode 100644 index 52fedd4b56..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/ExternalWebServiceContextFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.config; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.extension.ExternalServiceContextFactory; - -/** - * Creates instances of {@link org.apache.tuscany.core.context.ExternalServiceContext} configured with the - * appropriate invocation chains and bindings. This implementation serves as a marker for {@link - * org.apache.tuscany.binding.celtix.builder.ExternalWebServiceWireBuilder} - * - * @version $Rev$ $Date$ - */ -public class ExternalWebServiceContextFactory extends ExternalServiceContextFactory { - - public ExternalWebServiceContextFactory(String name, ObjectFactory objectFactory) { - super(name, objectFactory); - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/WebServiceEntryPointContextFactory.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/WebServiceEntryPointContextFactory.java deleted file mode 100644 index 39e0b10053..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/WebServiceEntryPointContextFactory.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.config; - -import org.apache.tuscany.binding.celtix.handler.CeltixEntryPointContextImpl; -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.context.EntryPointContext; -import org.apache.tuscany.core.extension.EntryPointContextFactory; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.webapp.ServletHost; -import org.apache.tuscany.model.assembly.EntryPoint; - -/** - * Creates instances of {@link org.apache.tuscany.core.context.EntryPointContext} configured with the - * appropriate invocation chains and bindings. This implementation serves as a marker for - * - * @version $Rev$ $Date$ - */ -public class WebServiceEntryPointContextFactory extends EntryPointContextFactory { - MessageFactory messageFactory; - EntryPoint entryPoint; - ServletHost servlet; - - public WebServiceEntryPointContextFactory(ServletHost tomcatHost, - EntryPoint entryPoint, - MessageFactory mf) { - super(entryPoint.getName(), mf); - messageFactory = mf; - this.entryPoint = entryPoint; - servlet = tomcatHost; - } - - public EntryPointContext createContext() throws ContextCreationException { - if (servlet == null) { - return new CeltixEntryPointContextImpl(entryPoint, - getSourceWireFactories().get(0), - messageFactory); - } else { - //REVISIT - running in tomcat - return null; - } - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/CeltixEntryPointContextImpl.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/CeltixEntryPointContextImpl.java deleted file mode 100644 index 5b2e0df3d6..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/CeltixEntryPointContextImpl.java +++ /dev/null @@ -1,263 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.handler; - -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executor; - -import javax.jws.soap.SOAPBinding.Style; -import javax.wsdl.Binding; -import javax.wsdl.BindingInput; -import javax.wsdl.BindingOperation; -import javax.wsdl.Definition; -import javax.wsdl.Port; -import javax.wsdl.extensions.ExtensibilityElement; -import javax.wsdl.extensions.soap.SOAPAddress; -import javax.wsdl.extensions.soap.SOAPBody; -import javax.xml.namespace.QName; -import javax.xml.ws.WebServiceProvider; - -import commonj.sdo.helper.TypeHelper; - -import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; -import org.apache.tuscany.binding.celtix.handler.io.SCAServerDataBindingCallback; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.context.ContextInitException; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.impl.EntryPointContextImpl; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.objectweb.celtix.Bus; -import org.objectweb.celtix.bindings.DataBindingCallback; -import org.objectweb.celtix.bindings.ServerBinding; -import org.objectweb.celtix.bindings.ServerBindingEndpointCallback; -import org.objectweb.celtix.bindings.ServerDataBindingCallback; -import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache; -import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; -import org.objectweb.celtix.context.ObjectMessageContext; -import org.objectweb.celtix.ws.addressing.AttributedURIType; -import org.objectweb.celtix.ws.addressing.EndpointReferenceType; -import org.objectweb.celtix.wsdl.EndpointReferenceUtils; -import org.osoa.sca.annotations.Destroy; -import org.xmlsoap.schemas.wsdl.http.AddressType; - -public class CeltixEntryPointContextImpl extends EntryPointContextImpl - implements ServerBindingEndpointCallback { - - EntryPoint entry; - private Bus bus; - private Port port; - private TypeHelper typeHelper; - private WSDLMetaDataCache wsdlCache; - private ServerBinding serverBinding; - private Object entryPointProxy; - private WebServiceBinding wsBinding; - - private Map<QName, ServerDataBindingCallback> opMap = - new ConcurrentHashMap<QName, ServerDataBindingCallback>(); - - - public CeltixEntryPointContextImpl(EntryPoint entry, - SourceWireFactory sourceWireFactory, - MessageFactory messageFactory) - throws ContextInitException { - - super(entry.getName(), sourceWireFactory, messageFactory); - this.entry = entry; - } - - public void start() throws ContextInitException { - super.start(); - - entryPointProxy = getInstance(null); - wsBinding = (WebServiceBinding)entry.getBindings().get(0); - bus = wsBinding.getBus(); - typeHelper = wsBinding.getTypeHelper(); - Definition wsdlDef = wsBinding.getWSDLDefinition(); - port = wsBinding.getWSDLPort(); - wsdlCache = new WSDLMetaDataCache(wsdlDef, wsBinding.getWSDLPort()); - - initOperationMap(wsdlDef); - - String key = wsdlDef.getDocumentBaseURI(); - URL url; - try { - url = new URL(key); - } catch (MalformedURLException e) { - throw new ContextInitException(e); - } - - EndpointReferenceType reference = EndpointReferenceUtils.getEndpointReference(url, - wsBinding.getWSDLService().getQName(), - wsBinding.getWSDLPort().getName()); - - AttributedURIType address = new AttributedURIType(); - - String bindingId = null; - Binding binding = wsBinding.getWSDLPort().getBinding(); - if (null != binding) { - List list = binding.getExtensibilityElements(); - if (!list.isEmpty()) { - bindingId = ((ExtensibilityElement)list.get(0)).getElementType().getNamespaceURI(); - } - } - List<?> list = wsBinding.getWSDLPort().getExtensibilityElements(); - for (Object ep : list) { - ExtensibilityElement ext = (ExtensibilityElement)ep; - if (ext instanceof SOAPAddress) { - if (bindingId == null) { - bindingId = ((SOAPAddress)ext).getLocationURI(); - } - address.setValue(((SOAPAddress)ext).getLocationURI()); - } - if (ext instanceof AddressType) { - if (bindingId == null) { - bindingId = ((AddressType)ext).getLocation(); - } - address.setValue(((AddressType)ext).getLocation()); - } - } - if (reference.getAddress() == null) { - //REVIST - bug in Celtix that the HTTP transport won't find the address correctly - reference.setAddress(address); - } - - try { - serverBinding = bus.getBindingManager().getBindingFactory(bindingId).createServerBinding( - reference, this); - serverBinding.activate(); - } catch (Exception e) { - throw new ContextInitException(e); - } - } - - @Destroy - public void stop() throws CoreRuntimeException { - System.out.println("In stop"); - super.stop(); - } - - private void initOperationMap(Definition def) { - List ops = port.getBinding().getBindingOperations(); - Iterator opIt = ops.iterator(); - while (opIt.hasNext()) { - BindingOperation op = (BindingOperation)opIt.next(); - BindingInput bindingInput = op.getBindingInput(); - List elements = bindingInput.getExtensibilityElements(); - QName qn = new QName(def.getTargetNamespace(), op.getName()); - for (Iterator i = elements.iterator(); i.hasNext();) { - Object element = i.next(); - if (SOAPBody.class.isInstance(element)) { - SOAPBody body = (SOAPBody)element; - if (body.getNamespaceURI() != null) { - qn = new QName(body.getNamespaceURI(), op.getName()); - } - } - } - - ServerDataBindingCallback cb = getDataBindingCallback(qn, null, - DataBindingCallback.Mode.PARTS); - opMap.put(qn, cb); - if (!"".equals(cb.getRequestWrapperQName().getLocalPart())) { - opMap.put(cb.getRequestWrapperQName(), cb); - } - } - } - public ServerDataBindingCallback getDataBindingCallback(QName operationName, - ObjectMessageContext objContext, - DataBindingCallback.Mode mode) { - if (opMap.containsKey(operationName)) { - return opMap.get(operationName); - } - WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName.getLocalPart()); - if (opInfo == null) { - //REVISIT - really map the operation name to a WSDL operation - for (String opName : wsdlCache.getAllOperationInfo().keySet()) { - if (operationName.getLocalPart().equalsIgnoreCase(opName)) { - opInfo = wsdlCache.getOperationInfo(opName); - break; - } - } - } - boolean inout = false; - - - Class<?> serviceInterface = getServiceInterface(); - Method meth = getMethod(serviceInterface, operationName.getLocalPart()); - - return new SCAServerDataBindingCallback(opInfo, - typeHelper, - wsBinding.getResourceLoader(), - inout, - meth, - entryPointProxy); - } - protected Method getMethod(Class<?> serviceInterface, String operationName) { - // Note: this doesn't support overloaded operations - Method[] methods = serviceInterface.getMethods(); - for (Method m : methods) { - if (m.getName().equals(operationName)) { - return m; - } - // tolerate WSDL with capatalized operation name - StringBuilder sb = new StringBuilder(operationName); - sb.setCharAt(0, Character.toLowerCase(sb.charAt(0))); - if (m.getName().equals(sb.toString())) { - return m; - } - } - throw new BuilderConfigException("no operation named " + operationName - + " found on service interface: " + serviceInterface.getName()); - } - - - public DataBindingCallback getFaultDataBindingCallback(ObjectMessageContext objContext) { - // REVISIT - what to do about faults - return null; - } - - public Map<QName, ? extends DataBindingCallback> getOperations() { - return opMap; - } - - public Style getStyle() { - return wsdlCache.getStyle(); - } - public DataBindingCallback.Mode getServiceMode() { - return DataBindingCallback.Mode.PARTS; - } - - public WebServiceProvider getWebServiceProvider() { - //not needed I think - return null; - } - - public Executor getExecutor() { - //Let the transport handle it (or it goes to the Bus default wq - //if the transport cannot handle it - return null; - } - -} - diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java deleted file mode 100644 index 01c571a611..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java +++ /dev/null @@ -1,199 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.handler; - - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import javax.jws.WebParam.Mode; -import javax.wsdl.Binding; -import javax.wsdl.Definition; -import javax.wsdl.WSDLException; -import javax.wsdl.extensions.ExtensibilityElement; -import javax.wsdl.extensions.soap.SOAPAddress; -import javax.xml.ws.Holder; -import javax.xml.ws.ProtocolException; - -import commonj.sdo.helper.TypeHelper; -import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; -import org.apache.tuscany.binding.celtix.handler.io.SCADataBindingCallback; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.BuilderInitException; -import org.apache.tuscany.model.assembly.ExternalService; -import org.objectweb.celtix.Bus; -import org.objectweb.celtix.BusException; -import org.objectweb.celtix.bindings.ClientBinding; -import org.objectweb.celtix.bindings.DataBindingCallback; -import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache; -import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; -import org.objectweb.celtix.context.ObjectMessageContext; -import org.objectweb.celtix.ws.addressing.EndpointReferenceType; -import org.objectweb.celtix.wsdl.EndpointReferenceUtils; -import org.xmlsoap.schemas.wsdl.http.AddressType; - - -/** - * An ExternalWebServiceClient using Celtix - */ -public class ExternalWebServiceClient { - - private Bus bus; - private TypeHelper typeHelper; - private WSDLMetaDataCache wsdlCache; - private ClientBinding clientBinding; - private WebServiceBinding wsBinding; - - - - public ExternalWebServiceClient(ExternalService externalService) throws BuilderException { - wsBinding = (WebServiceBinding)externalService.getBindings().get(0); - bus = wsBinding.getBus(); - typeHelper = wsBinding.getTypeHelper(); - Definition wsdlDef = wsBinding.getWSDLDefinition(); - wsdlCache = new WSDLMetaDataCache(wsdlDef, wsBinding.getWSDLPort()); - - try { - String key = wsdlDef.getDocumentBaseURI(); - URL url = new URL(key); - - EndpointReferenceType reference = EndpointReferenceUtils.getEndpointReference(url, - wsBinding.getWSDLService().getQName(), - wsBinding.getWSDLPort().getName()); - - String bindingId = null; - Binding binding = wsBinding.getWSDLPort().getBinding(); - if (null != binding) { - List list = binding.getExtensibilityElements(); - if (!list.isEmpty()) { - bindingId = ((ExtensibilityElement)list.get(0)).getElementType().getNamespaceURI(); - } - } - if (bindingId == null) { - List<?> list = wsBinding.getWSDLPort().getExtensibilityElements(); - for (Object ep : list) { - ExtensibilityElement ext = (ExtensibilityElement)ep; - if (ext instanceof SOAPAddress) { - bindingId = ((SOAPAddress)ext).getLocationURI(); - } - if (ext instanceof AddressType) { - bindingId = ((AddressType)ext).getLocation(); - } - } - - } - clientBinding = bus.getBindingManager().getBindingFactory(bindingId).createClientBinding( - reference); - } catch (MalformedURLException e) { - throw new BuilderInitException(e); - } catch (BusException e) { - throw new BuilderInitException(e); - } catch (WSDLException e) { - throw new BuilderInitException(e); - } catch (IOException e) { - throw new BuilderInitException(e); - } - } - - /** - * Invoke an operation on the external Web service. - * - * @param operationName the name of the WS operation to invoke - * @param args the Java object arguments to the WS operation - * @return the response from the WS as a Java object - */ - public Object invoke(String operationName, Object[] args) { - WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName); - if (opInfo == null) { - //REVISIT - really map the operation name to a WSDL operation - for (String opName : wsdlCache.getAllOperationInfo().keySet()) { - if (operationName.equalsIgnoreCase(opName)) { - opInfo = wsdlCache.getOperationInfo(opName); - break; - } - } - } - ObjectMessageContext objMsgContext = clientBinding.createObjectContext(); - - boolean hasInOut = false; - int inOutCount = 0; - Object realArgs[] = new Object[args.length]; - if (opInfo.getParamsLength() == 0) { - //REVISIT - opInfo doesn't return the needed info for the wrapped doc/lit case. - //Bug in Celtix - realArgs = args; - } else { - for (int x = 0; x < args.length; x++) { - if (opInfo.getWebParam(x).mode() == Mode.IN) { - realArgs[x] = args[x]; - } else { - realArgs[x] = new Holder<Object>(args[x]); - inOutCount++; - hasInOut = true; - } - } - } - - objMsgContext.setMessageObjects(realArgs); - - boolean isOneway = opInfo.isOneWay(); - DataBindingCallback callback = new SCADataBindingCallback(opInfo, typeHelper, - wsBinding.getResourceLoader(), - hasInOut); - - try { - if (isOneway) { - clientBinding.invokeOneWay(objMsgContext, - callback); - } else { - objMsgContext = clientBinding.invoke(objMsgContext, - callback); - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - if (objMsgContext.getException() != null) { - //REVISIT - Exceptions - /* - if (isValidException(objMsgContext)) { - throw (Exception)objMsgContext.getException(); - } else { - throw new ProtocolException(objMsgContext.getException()); - } - */ - throw new ProtocolException(objMsgContext.getException()); - } - - if (hasInOut) { - Object ret[] = new Object[inOutCount + 1]; - ret[0] = objMsgContext.getReturn(); - inOutCount = 1; - for (int x = 0; x < args.length; x++) { - if (opInfo.getWebParam(x).mode() != Mode.IN) { - Holder<?> holder = (Holder<?>)realArgs[x]; - ret[inOutCount] = holder.value; - inOutCount++; - } - } - return ret; - } - return objMsgContext.getReturn(); - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java deleted file mode 100644 index 06786ca76d..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.handler; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.ExternalServiceContext; -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.message.Message; -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.TargetInvoker; - - -/** - * Responsible for invoking an external web service - * - * @version $Rev$ $Date$ - */ -public class ExternalWebServiceTargetInvoker implements TargetInvoker { - - private QualifiedName serviceName; - private String esName; - private Method method; - private ScopeContext container; - - private ExternalServiceContext context; - - /** - * Constructs a new ExternalWebServiceTargetInvoker. - */ - public ExternalWebServiceTargetInvoker(QualifiedName servicename, - Method meth, - ScopeContext cont) { - assert servicename != null : "No service name specified"; - assert meth != null : "No method specified"; - assert cont != null : "No scope container specified"; - this.serviceName = servicename; - this.esName = serviceName.getPartName(); - this.method = meth; - this.container = cont; - } - - public Object invokeTarget(Object payload) throws InvocationTargetException { - if (context == null) { - Context 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; - } - ExternalWebServiceClient client = (ExternalWebServiceClient)context.getHandler(); - if (payload != null) { - return client.invoke(method.getName(), (Object[])payload); - } else { - return client.invoke(method.getName(), new Object[0]); - } - } - - 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() throws CloneNotSupportedException { - try { - ExternalWebServiceTargetInvoker invoker = (ExternalWebServiceTargetInvoker)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) { - // will not happen - return null; - } - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java deleted file mode 100644 index d1b13f6e17..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java +++ /dev/null @@ -1,170 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.handler.io; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import javax.xml.namespace.QName; -import javax.xml.ws.WebServiceException; - -import org.w3c.dom.Node; -import org.w3c.dom.bootstrap.DOMImplementationRegistry; -import org.w3c.dom.ls.DOMImplementationLS; -import org.w3c.dom.ls.LSOutput; -import org.w3c.dom.ls.LSSerializer; -import commonj.sdo.DataObject; -import commonj.sdo.Property; -import commonj.sdo.helper.XMLDocument; - -import org.apache.tuscany.databinding.sdo.SDOXMLHelper; -import org.apache.tuscany.sdo.helper.XMLHelperImpl; -import org.objectweb.celtix.bindings.DataReader; -import org.objectweb.celtix.context.ObjectMessageContext; - -public class NodeDataReader implements DataReader<Node> { - - SCADataBindingCallback callback; - - public NodeDataReader(SCADataBindingCallback cb) { - callback = cb; - } - - public Object read(int idx, Node input) { - return read(null, idx, input); - } - - public Object read(QName name, int idx, Node input) { - try { - byte bytes[] = getNodeBytes(input); - Object os[] = SDOXMLHelper.toObjects(callback.getResourceClassLoader(), - callback.getTypeHelper(), bytes, false); - return os[0]; - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new WebServiceException(e); - } - - } - - public void readWrapper(ObjectMessageContext objCtx, boolean isOutBound, Node input) { - try { - QName wrapperName; - if (isOutBound) { - wrapperName = callback.getOperationInfo().getResponseWrapperQName(); - } else { - wrapperName = callback.getOperationInfo().getRequestWrapperQName(); - } - - Node nd = input.getFirstChild(); - while (nd != null - && !wrapperName.getNamespaceURI().equals(nd.getNamespaceURI()) - && !wrapperName.getLocalPart().equals(nd.getLocalName())) { - nd = nd.getNextSibling(); - } - - //REVISIT - This is SUCH a HACK. This needs to be done with StAX or something - //a bit better than streaming and reparsing - InputStream in = getNodeStream(nd); - XMLDocument document = new XMLHelperImpl(callback.getTypeHelper()).load(in); - DataObject object = document.getRootObject(); - - List ips = object.getInstanceProperties(); - Object[] os = new Object[object.getInstanceProperties().size()]; - for (int i = 0; i < os.length; i++) { - os[i] = object.get((Property)ips.get(i)); - } - - if (callback.hasInOut()) { - //REVISIT - inOuts - } else { - if (isOutBound) { - objCtx.setReturn(os[0]); - } else { - objCtx.setMessageObjects(os); - } - } - } catch (IOException e) { - throw new WebServiceException(e); - } catch (ClassCastException e) { - throw new WebServiceException(e); - } catch (ClassNotFoundException e) { - throw new WebServiceException(e); - } catch (InstantiationException e) { - throw new WebServiceException(e); - } catch (IllegalAccessException e) { - throw new WebServiceException(e); - } - } - private byte[] getNodeBytes(Node node) - throws ClassCastException, ClassNotFoundException, - InstantiationException, IllegalAccessException { - - //This is also a hack, the JDK should already have this set, but it doesn't - DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); - if (registry == null) { - System.setProperty(DOMImplementationRegistry.PROPERTY, - "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); - registry = DOMImplementationRegistry.newInstance(); - } - DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); - if (impl == null) { - System.setProperty(DOMImplementationRegistry.PROPERTY, - "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); - registry = DOMImplementationRegistry.newInstance(); - impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); - } - LSOutput output = impl.createLSOutput(); - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - output.setByteStream(bout); - LSSerializer writer = impl.createLSSerializer(); - writer.write(node, output); - - return bout.toByteArray(); - } - - private InputStream getNodeStream(Node node) - throws ClassCastException, ClassNotFoundException, - InstantiationException, IllegalAccessException { - - DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); - if (registry == null) { - //This is also a hack, the JDK should already have this set, but it doesn't - System.setProperty(DOMImplementationRegistry.PROPERTY, - "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); - registry = DOMImplementationRegistry.newInstance(); - } - DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); - if (impl == null) { - System.setProperty(DOMImplementationRegistry.PROPERTY, - "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); - registry = DOMImplementationRegistry.newInstance(); - impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); - } - LSOutput output = impl.createLSOutput(); - RawByteArrayOutputStream bout = new RawByteArrayOutputStream(); - output.setByteStream(bout); - LSSerializer writer = impl.createLSSerializer(); - writer.write(node, output); - - return new ByteArrayInputStream(bout.getBytes(), 0, bout.size()); - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java deleted file mode 100644 index 27c2276c2a..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java +++ /dev/null @@ -1,179 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.handler.io; - - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.List; -import javax.xml.namespace.QName; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.ws.Holder; -import javax.xml.ws.WebServiceException; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; -import commonj.sdo.DataObject; -import commonj.sdo.Property; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XSDHelper; - -import org.apache.tuscany.databinding.sdo.SDOXMLHelper; -import org.apache.tuscany.sdo.helper.DataFactoryImpl; -import org.apache.tuscany.sdo.helper.XMLHelperImpl; -import org.apache.tuscany.sdo.helper.XSDHelperImpl; -import org.objectweb.celtix.bindings.DataWriter; -import org.objectweb.celtix.context.ObjectMessageContext; - -public class NodeDataWriter implements DataWriter<Node> { - SCADataBindingCallback callback; - - public NodeDataWriter(SCADataBindingCallback cb) { - callback = cb; - } - - public void write(Object obj, Node output) { - write(obj, null, output); - } - - public void write(Object obj, QName elName, Node output) { - byte bytes[] = SDOXMLHelper.toXMLBytes( - callback.getResourceClassLoader(), - callback.getTypeHelper(), - new Object[] {obj}, - elName, - false); - ByteArrayInputStream bin = new ByteArrayInputStream(bytes); - SAXParserFactory factory = SAXParserFactory.newInstance(); - factory.setNamespaceAware(true); - try { - SAXParser parser = factory.newSAXParser(); - parser.parse(bin, new NodeContentHandler(output)); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new WebServiceException(e); - } - - } - - public void writeWrapper(ObjectMessageContext objCtx, boolean isOutbound, Node nd) { - QName wrapperName; - if (isOutbound) { - wrapperName = callback.getOperationInfo().getResponseWrapperQName(); - } else { - wrapperName = callback.getOperationInfo().getRequestWrapperQName(); - } - - DataObject obj = toWrappedDataObject(callback.getTypeHelper(), - isOutbound ? objCtx.getReturn() : null, - objCtx.getMessageObjects(), - wrapperName); - - try { - //REVISIT - this is SUCH a hack. SDO needs to be able to - //go directly to some formats other than streams. They are working - //on stax, but not there yet. - RawByteArrayOutputStream bout = new RawByteArrayOutputStream(); - new XMLHelperImpl(callback.getTypeHelper()).save(obj, - wrapperName.getNamespaceURI(), - wrapperName.getLocalPart(), - bout); - - ByteArrayInputStream bin = new ByteArrayInputStream(bout.getBytes(), - 0, - bout.size()); - SAXParserFactory factory = SAXParserFactory.newInstance(); - factory.setNamespaceAware(true); - SAXParser parser = factory.newSAXParser(); - parser.parse(bin, new NodeContentHandler(nd)); - } catch (IOException e) { - throw new WebServiceException(e); - } catch (ParserConfigurationException e) { - throw new WebServiceException(e); - } catch (SAXException e) { - throw new WebServiceException(e); - } - } - - - public static DataObject toWrappedDataObject(TypeHelper typeHelper, - Object ret, - Object[] os, - QName typeQN) { - XSDHelper xsdHelper = new XSDHelperImpl(typeHelper); - Property property = xsdHelper.getGlobalProperty(typeQN.getNamespaceURI(), - typeQN.getLocalPart(), true); - DataObject dataObject = new DataFactoryImpl(typeHelper).create(property.getType()); - List ips = dataObject.getInstanceProperties(); - int offset = 0; - if (ret != null) { - dataObject.set(0, ret); - offset = 1; - } - for (int i = offset; i < ips.size(); i++) { - if (os[i - offset] instanceof Holder) { - Holder<?> holder = (Holder<?>)os[i - offset]; - dataObject.set(i, holder.value); - } else { - dataObject.set(i, os[i - offset]); - } - } - return dataObject; - } - - private class NodeContentHandler extends DefaultHandler { - Node current; - Document doc; - - public NodeContentHandler(Node nd) { - doc = nd.getOwnerDocument(); - if (doc == null && nd instanceof Document) { - doc = (Document)nd; - } - current = nd; - } - - public void characters(char[] ch, int start, int length) { - current.appendChild(doc.createTextNode(new String(ch, start, length))); - } - - public void startElement(String uri, String localName, - String qName, Attributes attributes) { - Element newEl = doc.createElementNS(uri, qName); - current.appendChild(newEl); - current = newEl; - for (int x = 0; x < attributes.getLength(); x++) { - newEl.setAttributeNS(attributes.getURI(x), - attributes.getQName(x), - attributes.getValue(x)); - } - } - - public void endElement(String uri, String localName, String qName) { - current = current.getParentNode(); - } - } - - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/RawByteArrayOutputStream.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/RawByteArrayOutputStream.java deleted file mode 100644 index 902a3e618c..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/RawByteArrayOutputStream.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.handler.io; - -import java.io.ByteArrayOutputStream; - -/** - * Just to allow raw access to the byte[] to avoid a copy - */ -class RawByteArrayOutputStream extends ByteArrayOutputStream { - public byte[] getBytes() { - return buf; - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java deleted file mode 100644 index 00dc403f2c..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.handler.io; - - -import org.w3c.dom.Node; -import commonj.sdo.helper.TypeHelper; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.objectweb.celtix.bindings.DataReader; -import org.objectweb.celtix.bindings.DataWriter; -import org.objectweb.celtix.bus.bindings.AbstractWSDLOperationDataBindingCallback; -import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; -import org.objectweb.celtix.context.ObjectMessageContext; - -public class SCADataBindingCallback extends AbstractWSDLOperationDataBindingCallback { - - protected TypeHelper typeHelper; - protected boolean hasInOut; - protected ResourceLoader loader; - - public SCADataBindingCallback(WSDLOperationInfo op, - TypeHelper helper, - ResourceLoader l, - boolean inout) { - super(op); - typeHelper = helper; - hasInOut = inout; - loader = l; - } - - public ResourceLoader getResourceLoader() { - return loader; - } - public ClassLoader getResourceClassLoader() { - return loader.getClassLoader(); - } - - public TypeHelper getTypeHelper() { - return typeHelper; - } - - public boolean hasInOut() { - return hasInOut; - } - - public Mode getMode() { - return Mode.PARTS; - } - - public Class<?>[] getSupportedFormats() { - return new Class<?>[]{Node.class}; - } - - @SuppressWarnings("unchecked") - public <T> DataWriter<T> createWriter(Class<T> cls) { - if (cls == Node.class) { - return (DataWriter<T>)new NodeDataWriter(this); - } - return null; - } - - @SuppressWarnings("unchecked") - public <T> DataReader<T> createReader(Class<T> cls) { - if (cls == Node.class) { - return (DataReader<T>)new NodeDataReader(this); - } - //REVISIT - need to figure out what to do with Faults - return null; - } - - public void initObjectContext(ObjectMessageContext octx) { - //REVISIT - is this even used? - } - - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCAServerDataBindingCallback.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCAServerDataBindingCallback.java deleted file mode 100644 index 5926e066c2..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCAServerDataBindingCallback.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.handler.io; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import commonj.sdo.helper.TypeHelper; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.objectweb.celtix.bindings.ServerDataBindingCallback; -import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; -import org.objectweb.celtix.context.ObjectMessageContext; - -public class SCAServerDataBindingCallback extends SCADataBindingCallback - implements ServerDataBindingCallback { - Method method; - Object targetObject; - - public SCAServerDataBindingCallback(WSDLOperationInfo op, TypeHelper helper, - ResourceLoader l, - boolean inout, Method meth, Object target) { - super(op, helper, l, inout); - method = meth; - targetObject = target; - } - - - public void invoke(ObjectMessageContext octx) throws InvocationTargetException { - Object ret; - try { - ret = method.invoke(targetObject, octx.getMessageObjects()); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new InvocationTargetException(e); - } - octx.setReturn(ret); - } - - public void initObjectContext(ObjectMessageContext octx) { - Object o[] = new Object[method.getParameterTypes().length]; - //REVIST - holders? - octx.setMessageObjects(o); - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/TuscanyWSDLManager.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/TuscanyWSDLManager.java deleted file mode 100644 index 913b43cfeb..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/TuscanyWSDLManager.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.loader; - -import java.io.IOException; -import java.net.URL; - -import javax.wsdl.Definition; -import javax.wsdl.WSDLException; -import javax.wsdl.extensions.ExtensionRegistry; -import javax.wsdl.factory.WSDLFactory; - -import org.w3c.dom.Element; - -import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; - -import org.objectweb.celtix.BusException; -import org.objectweb.celtix.wsdl.WSDLManager; - -public class TuscanyWSDLManager implements WSDLManager { - WSDLDefinitionRegistry wsdlDefinitionRegistry; - - public TuscanyWSDLManager(WSDLDefinitionRegistry w) throws BusException { - wsdlDefinitionRegistry = w; - } - - public WSDLFactory getWSDLFactory() { - //Not supported - return null; - } - - public ExtensionRegistry getExtenstionRegistry() { - return wsdlDefinitionRegistry.getExtensionRegistry(); - } - - public Definition getDefinition(URL url) throws WSDLException { - try { - //FIXME pass the current ResourceLoader - return wsdlDefinitionRegistry.loadDefinition(null, url, null); - } catch (IOException e) { - throw new WSDLException(WSDLException.CONFIGURATION_ERROR, e.getMessage()); - } - } - - public Definition getDefinition(String url) throws WSDLException { - try { - //The namespace is the wsdl targetNamesapce, it is only used - //when the wsdl is created into cache. we are ok here to set it to null. - //FIXME pass the current ResourceLoader - return wsdlDefinitionRegistry.loadDefinition(null, new URL(url), null); - } catch (IOException e) { - throw new WSDLException(WSDLException.CONFIGURATION_ERROR, e.getMessage()); - } - } - - public Definition getDefinition(Element el) throws WSDLException { - //Not supported - return null; - } - - public Definition getDefinition(Class<?> sei) throws WSDLException { - //Not supported - return null; - } - - public void addDefinition(Object key, Definition wsdl) { - //Not supported - } - - public void shutdown() { - } - - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java deleted file mode 100644 index 3520203523..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.loader; - -import java.util.Map; -import java.util.WeakHashMap; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.binding.celtix.assembly.WebServiceAssemblyFactory; -import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; -import org.apache.tuscany.binding.celtix.assembly.impl.WebServiceAssemblyFactoryImpl; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.loader.StAXElementLoader; -import org.apache.tuscany.core.loader.StAXLoaderRegistry; -import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.objectweb.celtix.Bus; -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class WebServiceBindingLoader implements StAXElementLoader<WebServiceBinding> { - public static final QName BINDING_WS = new QName("http://www.osoa.org/xmlns/sca/0.9", "binding.ws"); - - private static final WebServiceAssemblyFactory WS_FACTORY = new WebServiceAssemblyFactoryImpl(); - - protected StAXLoaderRegistry registry; - protected WSDLDefinitionRegistry wsdlRegistry; - - private Bus bus; - - @Autowire - public void setRegistry(StAXLoaderRegistry reg) { - this.registry = reg; - } - - @Autowire - public void setWsdlRegistry(WSDLDefinitionRegistry wsdlReg) { - try { - Map<String, Object> properties = new WeakHashMap<String, Object>(); - properties.put("celtix.WSDLManager", new TuscanyWSDLManager(wsdlReg)); - bus = Bus.init(new String[0], properties); - wsdlRegistry = wsdlReg; - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Init(eager = true) - public void start() { - registry.registerLoader(BINDING_WS, this); - } - - @Destroy - public void stop() { - try { - registry.unregisterLoader(BINDING_WS, this); - bus.shutdown(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @SuppressWarnings("deprecation") - public WebServiceBinding load(XMLStreamReader reader, LoaderContext loaderContext) - throws XMLStreamException, ConfigurationLoadException { - - WebServiceBinding binding = WS_FACTORY.createWebServiceBinding(wsdlRegistry); - binding.setURI(reader.getAttributeValue(null, "uri")); - binding.setPortURI(reader.getAttributeValue(null, "port")); - binding.setTypeHelper(registry.getContext().getTypeHelper()); - binding.setResourceLoader(loaderContext.getResourceLoader()); - binding.setBus(bus); - return binding; - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/system.fragment b/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/system.fragment deleted file mode 100644 index 2c89c47dd0..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/main/resources/system.fragment +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" - xmlns:tuscany="http://org.apache.tuscany/xmlns/system/0.9" - name="org.apache.tuscany.binding.axis"> - - <component name="org.apache.tuscany.binding.celtix.builder.ExternalWebServiceBuilder"> - <tuscany:implementation.system - class="org.apache.tuscany.binding.celtix.builder.ExternalWebServiceBuilder"/> - </component> - - <component name="org.apache.tuscany.binding.celtix.builder.ExternalWebServiceWireBuilder"> - <tuscany:implementation.system - class="org.apache.tuscany.binding.celtix.builder.ExternalWebServiceWireBuilder"/> - </component> - - <component name="org.apache.tuscany.binding.celtix.builder.WebServiceEntryPointBuilder"> - <tuscany:implementation.system - class="org.apache.tuscany.binding.celtix.builder.WebServiceEntryPointBuilder"/> - </component> - - <component name="org.apache.tuscany.binding.celtix.loader.WebServiceBindingLoaderr"> - <tuscany:implementation.system - class="org.apache.tuscany.binding.celtix.loader.WebServiceBindingLoader"/> - </component> - -</moduleFragment> diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java deleted file mode 100644 index dc6389ef93..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.assembly; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import javax.wsdl.Definition; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.binding.celtix.assembly.impl.WebServiceAssemblyFactoryImpl; -import org.apache.tuscany.binding.celtix.assembly.impl.WebServiceBindingImpl; -import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.easymock.EasyMock; - -public class WebServiceAssemblyFactoryTestCase extends TestCase { - - - private void setupMocks(WSDLDefinitionRegistry reg, - List<Definition> wsdlList) { - EasyMock.reset(new Object[] {reg}); - - //FIXME pass the current ResourceLoader - reg.getDefinitionsForNamespace("http://objectweb.org/hello_world_soap_http", null); - EasyMock.expectLastCall().andReturn(wsdlList); - - EasyMock.replay(new Object[] {reg}); - } - - public void testCreate() throws Exception { - WSDLDefinitionRegistry reg = EasyMock.createNiceMock(WSDLDefinitionRegistry.class); - - WebServiceAssemblyFactoryImpl impl = new WebServiceAssemblyFactoryImpl(); - WebServiceBinding bind = impl.createWebServiceBinding(reg); - assertNotNull("Did not create the binding", bind); - assertTrue("bind object wrong class: " + bind.getClass(), - bind instanceof WebServiceBindingImpl); - - assertNull("Should be initialized with null WSDL", bind.getWSDLDefinition()); - assertNull("Should be initialized with null port", bind.getWSDLPort()); - assertNull("Should be initialized with null service", bind.getWSDLService()); - assertNull("Should be initialized with null URI", bind.getURI()); - assertNull("Should be initialized with null TypeHelper", - bind.getTypeHelper()); - assertNull("Should be initialized with null ResourceLoader", - bind.getResourceLoader()); - - bind.setURI("http://objectweb.org/hello_world_soap_http"); - bind.setPortURI("http://objectweb.org/hello_world_soap_http#SoapPort"); - - AssemblyContext modelContext = EasyMock.createNiceMock(AssemblyContext.class); - - WSDLReader reader = WSDLFactory.newInstance().newWSDLReader(); - reader.setFeature("javax.wsdl.verbose", false); - URL url = getClass().getResource("/wsdl/hello_world.wsdl"); - Definition definition = reader.readWSDL(url.toString()); - - List<Definition> wsdlList = new ArrayList<Definition>(); - - setupMocks(reg, wsdlList); - try { - bind.initialize(modelContext); - fail("Should have failed getting the wsdl"); - } catch (IllegalArgumentException ex) { - //expected - } - - setupMocks(reg, wsdlList); - - - wsdlList.add(definition); - bind = impl.createWebServiceBinding(reg); - bind.setURI("http://objectweb.org/hello_world_soap_http"); - bind.setPortURI("http://objectweb.org/hello_world_soap_http#SoapPort"); - bind.initialize(modelContext); - - setupMocks(reg, wsdlList); - - wsdlList.add(definition); - bind = impl.createWebServiceBinding(reg); - bind.setURI("http://objectweb.org/hello_world_soap_http"); - bind.setPortURI("http://objectweb.org/hello_world_soap_http#FooPort"); - - try { - bind.initialize(modelContext); - fail("Should have failed finding the port"); - } catch (IllegalArgumentException ex) { - //expected - } - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java deleted file mode 100644 index be4d910069..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.handler.io; - -import java.net.URL; - -import javax.wsdl.Definition; -import javax.wsdl.Port; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - - -import commonj.sdo.helper.TypeHelper; - -import junit.framework.TestCase; - -import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; -import org.apache.tuscany.sdo.helper.XSDHelperImpl; -import org.apache.tuscany.sdo.util.DataObjectUtil; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.objectweb.celtix.bindings.DataReader; -import org.objectweb.celtix.bindings.DataWriter; -import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache; -import org.objectweb.celtix.context.ObjectMessageContext; -import org.objectweb.celtix.context.ObjectMessageContextImpl; - - - -public class NodeDataWriterTestCase extends TestCase { - - private TypeHelper typeHelper; - - protected void setUp() throws Exception { - super.setUp(); - DataObjectUtil.initRuntime(); - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - try { - Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); - typeHelper = SDOUtil.createTypeHelper(); - URL url = getClass().getResource("/wsdl/hello_world.wsdl"); - new XSDHelperImpl(typeHelper).define(url.openStream(), null); - } finally { - Thread.currentThread().setContextClassLoader(cl); - } - - - } - - public void testWriteWrapper() throws Exception { - WSDLReader wreader = WSDLFactory.newInstance().newWSDLReader(); - wreader.setFeature("javax.wsdl.verbose", false); - URL url = getClass().getResource("/wsdl/hello_world.wsdl"); - Definition definition = wreader.readWSDL(url.toString()); - Port port = definition.getService(new QName("http://objectweb.org/hello_world_soap_http", - "SOAPService")).getPort("SoapPort"); - - WSDLMetaDataCache wsdlCache = new WSDLMetaDataCache(definition, - port); - - - ResourceLoaderImpl loader = new ResourceLoaderImpl(getClass().getClassLoader()); - SCADataBindingCallback callback = new SCADataBindingCallback(wsdlCache.getOperationInfo("greetMe"), - typeHelper, - loader, - false); - - DataWriter<Node> writer = callback.createWriter(Node.class); - Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - Element element = doc.createElement("ROOT"); - - ObjectMessageContext objCtx = new ObjectMessageContextImpl(); - objCtx.setMessageObjects(new Object[] {"Hello"}); - writer.writeWrapper(objCtx , false, element); - - assertEquals("Value not written", "Hello", element.getFirstChild().getTextContent().trim()); - - DataReader<Node> reader = callback.createReader(Node.class); - reader.readWrapper(objCtx , true, element); - - assertEquals("Hello", objCtx.getReturn()); - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java b/branches/java-M1/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java deleted file mode 100644 index a27d866191..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.celtix.loader; - -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.loader.StAXLoaderRegistry; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.easymock.EasyMock; - -public class WebServiceBindingLoaderTestCase extends TestCase { - - @SuppressWarnings("deprecation") - public void testLoad() throws Exception { - - WebServiceBindingLoader loader = new WebServiceBindingLoader(); - StAXLoaderRegistry reg = EasyMock.createNiceMock(StAXLoaderRegistry.class); - reg.getContext(); - EasyMock.expectLastCall().andReturn(EasyMock.createNiceMock(AssemblyContext.class)); - EasyMock.replay(reg); - - loader.setRegistry(reg); - - XMLStreamReader reader = EasyMock.createNiceMock(XMLStreamReader.class); - reader.getAttributeValue(null, "uri"); - EasyMock.expectLastCall().andReturn("http://objectweb.org/hello_world_soap_http"); - reader.getAttributeValue(null, "port"); - EasyMock.expectLastCall().andReturn("SoapPort"); - EasyMock.replay(reader); - - LoaderContext loaderContext = new LoaderContext(null); - - assertNotNull("Did not load binding", loader.load(reader, loaderContext)); - - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world.wsdl b/branches/java-M1/java/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world.wsdl deleted file mode 100644 index a1d40daf26..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world.wsdl +++ /dev/null @@ -1,178 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http" - xmlns="http://schemas.xmlsoap.org/wsdl/" - xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" - xmlns:tns="http://objectweb.org/hello_world_soap_http" - xmlns:x1="http://objectweb.org/hello_world_soap_http/types" - xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <wsdl:types> - <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types" - xmlns="http://www.w3.org/2001/XMLSchema" - xmlns:tns="http://objectweb.org/hello_world_soap_http/types" - elementFormDefault="qualified"> - <simpleType name="MyStringType"> - <restriction base="string"> - <maxLength value="30" /> - </restriction> - </simpleType> - - <element name="sayHi"> - <complexType/> - </element> - <element name="sayHiResponse"> - <complexType> - <sequence> - <element name="responseType" type="string"/> - </sequence> - </complexType> - </element> - <element name="greetMe"> - <complexType> - <sequence> - <element name="requestType" type="tns:MyStringType"/> - </sequence> - </complexType> - </element> - <element name="greetMeResponse"> - <complexType> - <sequence> - <element name="responseType" type="string"/> - </sequence> - </complexType> - </element> - <element name="greetMeOneWay"> - <complexType> - <sequence> - <element name="requestType" type="string"/> - </sequence> - </complexType> - </element> - <element name="pingMe"> - <complexType/> - </element> - <element name="pingMeResponse"> - <complexType/> - </element> - <element name="faultDetail"> - <complexType> - <sequence> - <element name="minor" type="short"/> - <element name="major" type="short"/> - </sequence> - </complexType> - </element> - </schema> - </wsdl:types> - <wsdl:message name="sayHiRequest"> - <wsdl:part element="x1:sayHi" name="in"/> - </wsdl:message> - <wsdl:message name="sayHiResponse"> - <wsdl:part element="x1:sayHiResponse" name="out"/> - </wsdl:message> - <wsdl:message name="greetMeRequest"> - <wsdl:part element="x1:greetMe" name="in"/> - </wsdl:message> - <wsdl:message name="greetMeResponse"> - <wsdl:part element="x1:greetMeResponse" name="out"/> - </wsdl:message> - <wsdl:message name="greetMeOneWayRequest"> - <wsdl:part element="x1:greetMeOneWay" name="in"/> - </wsdl:message> - <wsdl:message name="pingMeRequest"> - <wsdl:part name="in" element="x1:pingMe"/> - </wsdl:message> - <wsdl:message name="pingMeResponse"> - <wsdl:part name="out" element="x1:pingMeResponse"/> - </wsdl:message> - <wsdl:message name="pingMeFault"> - <wsdl:part name="faultDetail" element="x1:faultDetail"/> - </wsdl:message> - - <wsdl:portType name="Greeter"> - <wsdl:operation name="sayHi"> - <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/> - <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/> - </wsdl:operation> - - <wsdl:operation name="greetMe"> - <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/> - <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/> - </wsdl:operation> - - <wsdl:operation name="greetMeOneWay"> - <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/> - </wsdl:operation> - - <wsdl:operation name="pingMe"> - <wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/> - <wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/> - <wsdl:fault name="pingMeFault" message="tns:pingMeFault"/> - </wsdl:operation> - </wsdl:portType> - <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter"> - <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> - - <wsdl:operation name="sayHi"> - <soap:operation soapAction="" style="document"/> - <wsdl:input name="sayHiRequest"> - <soap:body use="literal"/> - </wsdl:input> - <wsdl:output name="sayHiResponse"> - <soap:body use="literal"/> - </wsdl:output> - </wsdl:operation> - - <wsdl:operation name="greetMe"> - <soap:operation soapAction="" style="document"/> - <wsdl:input name="greetMeRequest"> - <soap:body use="literal"/> - </wsdl:input> - <wsdl:output name="greetMeResponse"> - <soap:body use="literal"/> - </wsdl:output> - </wsdl:operation> - - <wsdl:operation name="greetMeOneWay"> - <soap:operation soapAction="" style="document"/> - <wsdl:input name="greetMeOneWayRequest"> - <soap:body use="literal"/> - </wsdl:input> - </wsdl:operation> - - <wsdl:operation name="pingMe"> - <soap:operation style="document"/> - <wsdl:input> - <soap:body use="literal"/> - </wsdl:input> - <wsdl:output> - <soap:body use="literal"/> - </wsdl:output> - <wsdl:fault name="pingMeFault"> - <soap:fault name="pingMeFault" use="literal"/> - </wsdl:fault> - </wsdl:operation> - - </wsdl:binding> - <wsdl:service name="SOAPService"> - <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort"> - <soap:address location="http://localhost:9000/SoapContext/SoapPort"/> - </wsdl:port> - </wsdl:service> -</wsdl:definitions> - diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/pom.xml b/branches/java-M1/java/sca/bindings/binding.jsonrpc/pom.xml deleted file mode 100644 index a97f09375a..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<project>
-
- <parent>
- <groupId>org.apache.tuscany.sca.bindings</groupId>
- <artifactId>tuscany-sca-bindings</artifactId>
- <version>incubating-M1</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>tuscany-binding-jsonrpc</artifactId>
- <name>Tuscany JSON-RPC Binding</name>
- <description>Implementation of an SCA JSON-RPC binding</description>
- <version>incubating-M1</version>
-
- <repositories>
- <repository>
- <id>ant</id>
- <url>http://people.apache.org/~antelder/maven2</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>${pom.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany</groupId>
- <artifactId>tuscany-tomcat</artifactId>
- <version>${pom.version}</version>
- <scope>provided</scope> <!-- use provided so tuscany infrastructue is not inc. in the war-->
- </dependency>
-
- <dependency>
- <groupId>metaparadigm</groupId>
- <artifactId>jsonrpc</artifactId>
- <version>1.0</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>servlet-api</artifactId>
- <version>5.0.18</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-</project>
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/assembly/JSONRPCBinding.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/assembly/JSONRPCBinding.java deleted file mode 100644 index 3629bbe98c..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/assembly/JSONRPCBinding.java +++ /dev/null @@ -1,39 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.assembly;
-
-import org.apache.tuscany.model.assembly.impl.BindingImpl;
-
-/**
- * An Binding implementation for JSON-RPC.
- */
-public class JSONRPCBinding extends BindingImpl {
-
- private String webAppName;
-
- public JSONRPCBinding() {
- }
-
- public void setWebAppName(String webAppName) {
- this.webAppName = webAppName;
- }
-
- public String getWebAppName() {
- return webAppName;
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java deleted file mode 100644 index b0725c464b..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java +++ /dev/null @@ -1,41 +0,0 @@ -/**
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.builder;
-
-import org.apache.tuscany.binding.jsonrpc.assembly.JSONRPCBinding;
-import org.apache.tuscany.binding.jsonrpc.config.JSONEntryPointContextFactory;
-import org.apache.tuscany.core.extension.EntryPointBuilderSupport;
-import org.apache.tuscany.core.extension.EntryPointContextFactory;
-import org.apache.tuscany.core.message.MessageFactory;
-import org.apache.tuscany.core.system.annotation.Autowire;
-import org.apache.tuscany.core.webapp.ServletHost;
-import org.apache.tuscany.model.assembly.EntryPoint;
-import org.osoa.sca.annotations.Scope;
-
-@Scope("MODULE")
-public class JSONRPCEntryPointBuilder extends EntryPointBuilderSupport<JSONRPCBinding> {
-
- private ServletHost tomcatHost;
-
- @Autowire
- public void setTomcatHost(ServletHost tomcatHost) {
- this.tomcatHost = tomcatHost;
- }
-
- @Override
- protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) {
- String webAppName = ((JSONRPCBinding) entryPoint.getBindings().get(0)).getWebAppName();
- return new JSONEntryPointContextFactory(entryPoint.getName(), msgFactory, webAppName, tomcatHost);
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/config/JSONEntryPointContextFactory.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/config/JSONEntryPointContextFactory.java deleted file mode 100644 index 7c36f83e6b..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/config/JSONEntryPointContextFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.binding.jsonrpc.config; - -import org.apache.tuscany.binding.jsonrpc.handler.JSONRPCEntryPointServlet; -import org.apache.tuscany.binding.jsonrpc.handler.ScriptGetterServlet; -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.context.EntryPointContext; -import org.apache.tuscany.core.extension.EntryPointContextFactory; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.webapp.ServletHost; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class JSONEntryPointContextFactory extends EntryPointContextFactory { - - private ServletHost tomcatHost; - - private String webAppName; - - public JSONEntryPointContextFactory(String name, MessageFactory msgFactory, String webAppName, ServletHost tomcatHost) { - super(name, msgFactory); - this.webAppName = webAppName; - this.tomcatHost = tomcatHost; - } - - public EntryPointContext createContext() throws ContextCreationException { - EntryPointContext epc = super.createContext(); - JSONRPCEntryPointServlet jsonrpcServlet = getServlet(); - jsonrpcServlet.addEntryPoint(epc); - return epc; - } - - private JSONRPCEntryPointServlet getServlet() { - String jsonrpcServletMapping = webAppName + "/SCA/jsonrpc"; - JSONRPCEntryPointServlet servlet; - synchronized (tomcatHost) { - servlet = (JSONRPCEntryPointServlet) tomcatHost.getMapping(jsonrpcServletMapping); - if (servlet == null) { - servlet = new JSONRPCEntryPointServlet(); - tomcatHost.registerMapping(jsonrpcServletMapping, servlet); - tomcatHost.registerMapping(webAppName + "/SCA/scripts/*", new ScriptGetterServlet()); - } - } - return servlet; - } - -} diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServlet.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServlet.java deleted file mode 100644 index f59867b725..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServlet.java +++ /dev/null @@ -1,76 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tuscany.binding.jsonrpc.handler;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.tuscany.core.context.EntryPointContext;
-
-import com.metaparadigm.jsonrpc.JSONRPCBridge;
-import com.metaparadigm.jsonrpc.JSONRPCServlet;
-
-/**
- *
- *
- */
-public class JSONRPCEntryPointServlet extends JSONRPCServlet {
- private static final long serialVersionUID = 1L;
-
- private transient List<EntryPointContext> entryPoints;
-
- public JSONRPCEntryPointServlet() {
- entryPoints = new ArrayList<EntryPointContext>();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.metaparadigm.jsonrpc.JSONRPCServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- */
- @Override
- public void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ClassCastException {
-
- /*
- * Create a new bridge for every request to aviod all the problems with JSON-RPC-Java storing the bridge in the session
- */
- HttpSession session = request.getSession();
- try {
-
- JSONRPCBridge jsonrpcBridge = new JSONRPCBridge();
- for (EntryPointContext epc : entryPoints) {
- jsonrpcBridge.registerObject(epc.getName(), epc.getInstance(null));
- }
- session.setAttribute("JSONRPCBridge", jsonrpcBridge);
-
- super.service(request, response);
-
- } finally {
- session.removeAttribute("JSONRPCBridge");
- }
- }
-
- public void addEntryPoint(EntryPointContext epc) {
- entryPoints.add(epc);
- }
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/ScriptGetterServlet.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/ScriptGetterServlet.java deleted file mode 100644 index 9177462de0..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/ScriptGetterServlet.java +++ /dev/null @@ -1,51 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.handler;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class ScriptGetterServlet extends HttpServlet {
-
- private static final long serialVersionUID = 1L;
-
- private static final String SCA_INIT_JS = "SCA = new JSONRpcClient(\"SCA/jsonrpc\");";
-
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
- URL url = getClass().getResource("jsonrpc.js");
- InputStream is = url.openStream();
- writeToStream(response, is);
-
- writeToStream(response, new ByteArrayInputStream(SCA_INIT_JS.getBytes()));
- }
-
- private void writeToStream(HttpServletResponse response, InputStream is) throws IOException {
- ServletOutputStream os = response.getOutputStream();
- int i;
- while ((i = is.read()) != -1) {
- os.write(i);
- }
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/loader/JSONRPCBindingLoader.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/loader/JSONRPCBindingLoader.java deleted file mode 100644 index 64cefc9ea3..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/loader/JSONRPCBindingLoader.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.binding.jsonrpc.loader; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.binding.jsonrpc.assembly.JSONRPCBinding; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.LoaderContext; -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; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class JSONRPCBindingLoader implements StAXElementLoader<JSONRPCBinding> { - - public static final QName BINDING_JSONRPC = new QName("http://org.apache.tuscany/xmlns/jsonrpc/0.9", "binding.jsonrpc"); - - protected StAXLoaderRegistry registry; - - @Autowire - public void setRegistry(StAXLoaderRegistry registry) { - this.registry = registry; - } - - @Init(eager = true) - public void start() { - registry.registerLoader(BINDING_JSONRPC, this); - } - - @Destroy - public void stop() { - registry.unregisterLoader(BINDING_JSONRPC, this); - } - - @SuppressWarnings("deprecation") - public JSONRPCBinding load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - JSONRPCBinding binding = new JSONRPCBinding(); - binding.setURI(reader.getAttributeValue(null, "uri")); - binding.setWebAppName(registry.getContext().getWebAppName()); - return binding; - } -} diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/org/apache/tuscany/binding/jsonrpc/handler/jsonrpc.js b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/org/apache/tuscany/binding/jsonrpc/handler/jsonrpc.js deleted file mode 100644 index 2b9efbb55c..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/org/apache/tuscany/binding/jsonrpc/handler/jsonrpc.js +++ /dev/null @@ -1,484 +0,0 @@ -/* - * JSON-RPC JavaScript client - * - * $Id: jsonrpc.js,v 1.36.2.3 2006/03/08 15:09:37 mclark Exp $ - * - * Copyright (c) 2003-2004 Jan-Klaas Kollhof - * Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd - * - * This code is based on Jan-Klaas' JavaScript o lait library (jsolait). - * - * Licensed 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. - * - */ - - -/* escape a character */ - -escapeJSONChar = -function escapeJSONChar(c) -{ - if(c == "\"" || c == "\\") return "\\" + c; - else if (c == "\b") return "\\b"; - else if (c == "\f") return "\\f"; - else if (c == "\n") return "\\n"; - else if (c == "\r") return "\\r"; - else if (c == "\t") return "\\t"; - var hex = c.charCodeAt(0).toString(16); - if(hex.length == 1) return "\\u000" + hex; - else if(hex.length == 2) return "\\u00" + hex; - else if(hex.length == 3) return "\\u0" + hex; - else return "\\u" + hex; -}; - - -/* encode a string into JSON format */ - -escapeJSONString = -function escapeJSONString(s) -{ - /* The following should suffice but Safari's regex is b0rken - (doesn't support callback substitutions) - return "\"" + s.replace(/([^\u0020-\u007f]|[\\\"])/g, - escapeJSONChar) + "\""; - */ - - /* Rather inefficient way to do it */ - var parts = s.split(""); - for(var i=0; i < parts.length; i++) { - var c =parts[i]; - if(c == '"' || - c == '\\' || - c.charCodeAt(0) < 32 || - c.charCodeAt(0) >= 128) - parts[i] = escapeJSONChar(parts[i]); - } - return "\"" + parts.join("") + "\""; -}; - - -/* Marshall objects to JSON format */ - -toJSON = function toJSON(o) -{ - if(o == null) { - return "null"; - } else if(o.constructor == String) { - return escapeJSONString(o); - } else if(o.constructor == Number) { - return o.toString(); - } else if(o.constructor == Boolean) { - return o.toString(); - } else if(o.constructor == Date) { - return '{javaClass: "java.util.Date", time: ' + o.valueOf() +'}'; - } else if(o.constructor == Array) { - var v = []; - for(var i = 0; i < o.length; i++) v.push(toJSON(o[i])); - return "[" + v.join(", ") + "]"; - } else { - var v = []; - for(attr in o) { - if(o[attr] == null) v.push("\"" + attr + "\": null"); - else if(typeof o[attr] == "function"); /* skip */ - else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr])); - } - return "{" + v.join(", ") + "}"; - } -}; - - -/* JSONRpcClient constructor */ - -JSONRpcClient = -function JSONRpcClient_ctor(serverURL, user, pass, objectID) -{ - this.serverURL = serverURL; - this.user = user; - this.pass = pass; - this.objectID = objectID; - - /* Add standard methods */ - if(this.objectID) { - this._addMethods(["listMethods"]); - var req = this._makeRequest("listMethods", []); - } else { - this._addMethods(["system.listMethods"]); - var req = this._makeRequest("system.listMethods", []); - } - var m = this._sendRequest(req); - this._addMethods(m); -}; - - -/* JSONRpcCLient.Exception */ - -JSONRpcClient.Exception = -function JSONRpcClient_Exception_ctor(code, message, javaStack) -{ - this.code = code; - var name; - if(javaStack) { - this.javaStack = javaStack; - var m = javaStack.match(/^([^:]*)/); - if(m) name = m[0]; - } - if(name) this.name = name; - else this.name = "JSONRpcClientException"; - this.message = message; -}; - -JSONRpcClient.Exception.CODE_REMOTE_EXCEPTION = 490; -JSONRpcClient.Exception.CODE_ERR_CLIENT = 550; -JSONRpcClient.Exception.CODE_ERR_PARSE = 590; -JSONRpcClient.Exception.CODE_ERR_NOMETHOD = 591; -JSONRpcClient.Exception.CODE_ERR_UNMARSHALL = 592; -JSONRpcClient.Exception.CODE_ERR_MARSHALL = 593; - -JSONRpcClient.Exception.prototype = new Error(); - -JSONRpcClient.Exception.prototype.toString = -function JSONRpcClient_Exception_toString(code, msg) -{ - return this.name + ": " + this.message; -}; - - -/* Default top level exception handler */ - -JSONRpcClient.default_ex_handler = -function JSONRpcClient_default_ex_handler(e) { alert(e); }; - - -/* Client settable variables */ - -JSONRpcClient.toplevel_ex_handler = JSONRpcClient.default_ex_handler; -JSONRpcClient.profile_async = false; -JSONRpcClient.max_req_active = 1; -JSONRpcClient.requestId = 1; - - -/* JSONRpcClient implementation */ - -JSONRpcClient.prototype._createMethod = -function JSONRpcClient_createMethod(methodName) -{ - var fn=function() - { - var args = []; - var callback = null; - for(var i=0;i<arguments.length;i++) args.push(arguments[i]); - if(typeof args[0] == "function") callback = args.shift(); - var req = fn.client._makeRequest.call(fn.client, fn.methodName, - args, callback); - if(callback == null) { - return fn.client._sendRequest.call(fn.client, req); - } else { - JSONRpcClient.async_requests.push(req); - JSONRpcClient.kick_async(); - return req.requestId; - } - }; - fn.client = this; - fn.methodName = methodName; - return fn; -}; - -JSONRpcClient.prototype._addMethods = -function JSONRpcClient_addMethods(methodNames) -{ - for(var i=0; i<methodNames.length; i++) { - var obj = this; - var names = methodNames[i].split("."); - for(var n=0; n<names.length-1; n++) { - var name = names[n]; - if(obj[name]) { - obj = obj[name]; - } else { - obj[name] = new Object(); - obj = obj[name]; - } - } - var name = names[names.length-1]; - if(!obj[name]) { - var method = this._createMethod(methodNames[i]); - obj[name] = method; - } - } -}; - -JSONRpcClient._getCharsetFromHeaders = -function JSONRpcClient_getCharsetFromHeaders(http) -{ - try { - var contentType = http.getResponseHeader("Content-type"); - var parts = contentType.split(/\s*;\s*/); - for(var i =0; i < parts.length; i++) { - if(parts[i].substring(0, 8) == "charset=") - return parts[i].substring(8, parts[i].length); - } - } catch (e) {} - return "UTF-8"; /* default */ -}; - -/* Async queue globals */ -JSONRpcClient.async_requests = []; -JSONRpcClient.async_inflight = {}; -JSONRpcClient.async_responses = []; -JSONRpcClient.async_timeout = null; -JSONRpcClient.num_req_active = 0; - -JSONRpcClient._async_handler = -function JSONRpcClient_async_handler() -{ - JSONRpcClient.async_timeout = null; - - while(JSONRpcClient.async_responses.length > 0) { - var res = JSONRpcClient.async_responses.shift(); - if(res.canceled) continue; - if(res.profile) res.profile.dispatch = new Date(); - try { - res.cb(res.result, res.ex, res.profile); - } catch(e) { - JSONRpcClient.toplevel_ex_handler(e); - } - } - - while(JSONRpcClient.async_requests.length > 0 && - JSONRpcClient.num_req_active < JSONRpcClient.max_req_active) { - var req = JSONRpcClient.async_requests.shift(); - if(req.canceled) continue; - req.client._sendRequest.call(req.client, req); - } -}; - -JSONRpcClient.kick_async = -function JSONRpcClient_kick_async() -{ - if(JSONRpcClient.async_timeout == null) - JSONRpcClient.async_timeout = - setTimeout(JSONRpcClient._async_handler, 0); -}; - -JSONRpcClient.cancelRequest = -function JSONRpcClient_cancelRequest(requestId) -{ - /* If it is in flight then mark it as canceled in the inflight map - and the XMLHttpRequest callback will discard the reply. */ - if(JSONRpcClient.async_inflight[requestId]) { - JSONRpcClient.async_inflight[requestId].canceled = true; - return true; - } - - /* If its not in flight yet then we can just mark it as canceled in - the the request queue and it will get discarded before being sent. */ - for(var i in JSONRpcClient.async_requests) { - if(JSONRpcClient.async_requests[i].requestId == requestId) { - JSONRpcClient.async_requests[i].canceled = true; - return true; - } - } - - /* It may have returned from the network and be waiting for its callback - to be dispatched, so mark it as canceled in the response queue - and the response will get discarded before calling the callback. */ - for(var i in JSONRpcClient.async_responses) { - if(JSONRpcClient.async_responses[i].requestId == requestId) { - JSONRpcClient.async_responses[i].canceled = true; - return true; - } - } - - return false; -}; - -JSONRpcClient.prototype._makeRequest = -function JSONRpcClient_makeRequest(methodName, args, cb) -{ - var req = {}; - req.client = this; - req.requestId = JSONRpcClient.requestId++; - - var obj = {}; - obj.id = req.requestId; - if (this.objectID) - obj.method = ".obj#" + this.objectID + "." + methodName; - else - obj.method = methodName; - obj.params = args; - - if (cb) req.cb = cb; - if (JSONRpcClient.profile_async) - req.profile = { "submit": new Date() }; - req.data = toJSON(obj); - - return req; -}; - -JSONRpcClient.prototype._sendRequest = -function JSONRpcClient_sendRequest(req) -{ - if(req.profile) req.profile.start = new Date(); - - /* Get free http object from the pool */ - var http = JSONRpcClient.poolGetHTTPRequest(); - JSONRpcClient.num_req_active++; - - /* Send the request */ - if (typeof(this.user) == "undefined") { - http.open("POST", this.serverURL, (req.cb != null)); - } else { - http.open("POST", this.serverURL, (req.cb != null), this.user, this.pass); - } - - /* setRequestHeader is missing in Opera 8 Beta */ - try { http.setRequestHeader("Content-type", "text/plain"); } catch(e) {} - - /* Construct call back if we have one */ - if(req.cb) { - var self = this; - http.onreadystatechange = function() { - if(http.readyState == 4) { - http.onreadystatechange = function () {}; - var res = { "cb": req.cb, "result": null, "ex": null}; - if (req.profile) { - res.profile = req.profile; - res.profile.end = new Date(); - } - try { res.result = self._handleResponse(http); } - catch(e) { res.ex = e; } - if(!JSONRpcClient.async_inflight[req.requestId].canceled) - JSONRpcClient.async_responses.push(res); - delete JSONRpcClient.async_inflight[req.requestId]; - JSONRpcClient.kick_async(); - } - }; - } else { - http.onreadystatechange = function() {}; - } - - JSONRpcClient.async_inflight[req.requestId] = req; - - try { - http.send(req.data); - } catch(e) { - JSONRpcClient.poolReturnHTTPRequest(http); - JSONRpcClient.num_req_active--; - throw new JSONRpcClient.Exception - (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed"); - } - - if(!req.cb) return this._handleResponse(http); -}; - -JSONRpcClient.prototype._handleResponse = -function JSONRpcClient_handleResponse(http) -{ - /* Get the charset */ - if(!this.charset) { - this.charset = JSONRpcClient._getCharsetFromHeaders(http); - } - - /* Get request results */ - var status, statusText, data; - try { - status = http.status; - statusText = http.statusText; - data = http.responseText; - } catch(e) { - JSONRpcClient.poolReturnHTTPRequest(http); - JSONRpcClient.num_req_active--; - JSONRpcClient.kick_async(); - throw new JSONRpcClient.Exception - (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed"); - } - - /* Return http object to the pool; */ - JSONRpcClient.poolReturnHTTPRequest(http); - JSONRpcClient.num_req_active--; - - /* Unmarshall the response */ - if(status != 200) { - throw new JSONRpcClient.Exception(status, statusText); - } - var obj; - try { - eval("obj = " + data); - } catch(e) { - throw new JSONRpcClient.Exception(550, "error parsing result"); - } - if(obj.error) - throw new JSONRpcClient.Exception(obj.error.code, obj.error.msg, - obj.error.trace); - var res = obj.result; - - /* Handle CallableProxy */ - if(res && res.objectID && res.JSONRPCType == "CallableReference") - return new JSONRpcClient(this.serverURL, this.user, - this.pass, res.objectID); - - return res; -}; - - -/* XMLHttpRequest wrapper code */ - -/* XMLHttpRequest pool globals */ -JSONRpcClient.http_spare = []; -JSONRpcClient.http_max_spare = 8; - -JSONRpcClient.poolGetHTTPRequest = -function JSONRpcClient_pool_getHTTPRequest() -{ - if(JSONRpcClient.http_spare.length > 0) { - return JSONRpcClient.http_spare.pop(); - } - return JSONRpcClient.getHTTPRequest(); -}; - -JSONRpcClient.poolReturnHTTPRequest = -function JSONRpcClient_poolReturnHTTPRequest(http) -{ - if(JSONRpcClient.http_spare.length >= JSONRpcClient.http_max_spare) - delete http; - else - JSONRpcClient.http_spare.push(http); -}; - -JSONRpcClient.msxmlNames = [ "MSXML2.XMLHTTP.5.0", - "MSXML2.XMLHTTP.4.0", - "MSXML2.XMLHTTP.3.0", - "MSXML2.XMLHTTP", - "Microsoft.XMLHTTP" ]; - -JSONRpcClient.getHTTPRequest = -function JSONRpcClient_getHTTPRequest() -{ - /* Mozilla XMLHttpRequest */ - try { - JSONRpcClient.httpObjectName = "XMLHttpRequest"; - return new XMLHttpRequest(); - } catch(e) {} - - /* Microsoft MSXML ActiveX */ - for (var i=0;i < JSONRpcClient.msxmlNames.length; i++) { - try { - JSONRpcClient.httpObjectName = JSONRpcClient.msxmlNames[i]; - return new ActiveXObject(JSONRpcClient.msxmlNames[i]); - } catch (e) {} - } - - /* None found */ - JSONRpcClient.httpObjectName = null; - throw new JSONRpcClient.Exception(0, "Can't create XMLHttpRequest object"); -}; - diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/system.fragment b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/system.fragment deleted file mode 100644 index ee3078a39f..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/main/resources/system.fragment +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" - xmlns:tuscany="http://org.apache.tuscany/xmlns/system/0.9" - name="org.apache.tuscany.binding.jsonrpc"> - - <component name="org.apache.tuscany.binding.jsonrpc.builder.JSONRPCEntryPointBuilder"> - <tuscany:implementation.system class="org.apache.tuscany.binding.jsonrpc.builder.JSONRPCEntryPointBuilder"/> - </component> - - <component name="org.apache.tuscany.binding.jsonrpc.loader.JSONRPCBindingLoaderr"> - <tuscany:implementation.system class="org.apache.tuscany.binding.jsonrpc.loader.JSONRPCBindingLoader"/> - </component> -</moduleFragment> diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServletTestCase.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServletTestCase.java deleted file mode 100644 index bbf2ff4397..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServletTestCase.java +++ /dev/null @@ -1,80 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.handler;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.binding.jsonrpc.mocks.MockConfigUtils;
-import org.apache.tuscany.binding.jsonrpc.mocks.servlet.MockHttpServletRequest;
-import org.apache.tuscany.binding.jsonrpc.mocks.servlet.MockHttpServletResponse;
-
-public class JSONRPCEntryPointServletTestCase extends TestCase {
-
- private static final String JSON_REQUEST = "{\"id\": 2, \"method\": \"MyEntryPoint.concat\", \"params\": [\" world\"]}";
-
- private static final String JSON_RESPONSE = "{\"result\":\"hello world\",\"id\":2}";
-
- public void testService() throws ServletException, ClassCastException, IOException {
-// JSONRPCEntryPointServlet servlet = new JSONRPCEntryPointServlet("MyEntryPoint", "hello");
-// ServletConfig servletConfig = MockConfigUtils.createMockServletConfig("MyEntryPoint", "hello");
-// servlet.init(servletConfig);
-//
-// HttpServletRequest request = new MockHttpServletRequest(JSON_REQUEST.getBytes());
-// ByteArrayOutputStream os = new ByteArrayOutputStream();
-// HttpServletResponse response = new MockHttpServletResponse(os);
-//
-// servlet.service(request, response);
-//
-// String responseString = new String(os.toByteArray());
-// assertEquals(JSON_RESPONSE, responseString);
- }
-
- public void testInit() throws ServletException {
-// JSONRPCEntryPointServlet servlet = new JSONRPCEntryPointServlet("MyEntryPoint", "hello");
-// ServletConfig servletConfig = MockConfigUtils.createMockServletConfig("MyEntryPoint", "hello");
-//
-// servlet.init(servletConfig);
-//
-// assertEquals("MyEntryPoint", servlet.getEntryPointName());
-// assertEquals("hello", servlet.getEntryPointProxy());
- }
-
-// public void testHasJSONRPCBinding() {
-// JSONRPCEntryPointServlet servlet = new JSONRPCEntryPointServlet("MyEntryPoint", "hello");
-//
-// EntryPoint entryPoint = MockConfigUtils.createMockEntryPoint("MyEntryPoint");
-// assertFalse(servlet.hasJSONRPCBinding(entryPoint));
-//
-// MockConfigUtils.addNonJSONRPCBinding(entryPoint);
-// assertFalse(servlet.hasJSONRPCBinding(entryPoint));
-//
-// MockConfigUtils.addJSONRPCBinding(entryPoint);
-// assertTrue(servlet.hasJSONRPCBinding(entryPoint));
-//
-// assertEquals(2, entryPoint.getBindings().size());
-//
-// }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/MockConfigUtils.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/MockConfigUtils.java deleted file mode 100644 index b36330aa19..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/MockConfigUtils.java +++ /dev/null @@ -1,88 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.mocks;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-
-import org.apache.tuscany.binding.jsonrpc.assembly.JSONRPCBinding;
-import org.apache.tuscany.binding.jsonrpc.mocks.servlet.MockServletConfig;
-import org.apache.tuscany.binding.jsonrpc.mocks.tuscany.MockBinding;
-import org.apache.tuscany.binding.jsonrpc.mocks.tuscany.MockCompositeContextImpl;
-import org.apache.tuscany.binding.jsonrpc.mocks.tuscany.MockEntryPointContext;
-import org.apache.tuscany.binding.jsonrpc.mocks.tuscany.MockScopeContext;
-import org.apache.tuscany.core.context.CompositeContext;
-import org.apache.tuscany.core.context.Context;
-import org.apache.tuscany.core.context.ScopeContext;
-import org.apache.tuscany.core.webapp.TuscanyServletListener;
-import org.apache.tuscany.model.assembly.Binding;
-import org.apache.tuscany.model.assembly.EntryPoint;
-import org.apache.tuscany.model.assembly.Module;
-import org.apache.tuscany.model.assembly.impl.EntryPointImpl;
-
-public class MockConfigUtils {
-
- public static ServletConfig createMockServletConfig(String entryPointName, Object instance) {
- ServletConfig servletConfig = new MockServletConfig();
- ServletContext context = servletConfig.getServletContext();
- context.setAttribute(TuscanyServletListener.MODULE_COMPONENT_NAME, createModuleWithJSONRPCEntryPoint(entryPointName, instance));
- return servletConfig;
- }
-
- public static CompositeContext createModuleWithJSONRPCEntryPoint(String entryPointName, Object instance) {
- MockCompositeContextImpl cci = new MockCompositeContextImpl();
- Module module = (Module) cci.getComposite();
- List<EntryPoint> entryPoints = module.getEntryPoints();
- EntryPoint ep = createMockEntryPoint(entryPointName);
- addJSONRPCBinding(ep);
- entryPoints.add(ep);
- cci.start();
-
- Map<String, Context> ics = new HashMap<String, Context>();
- ics.put(entryPointName, new MockEntryPointContext(instance));
-
- ScopeContext sc = new MockScopeContext(ics);
- sc.start();
-
- Map<String, ScopeContext> scopeIndex = cci.getScopeIndex();
- scopeIndex.put(entryPointName, sc);
-
- return cci;
- }
-
- public static EntryPoint createMockEntryPoint(String name) {
- EntryPoint entryPoint = new EntryPointImpl() {
- };
- entryPoint.setName(name);
- return entryPoint;
- }
-
- public static void addJSONRPCBinding(EntryPoint entryPoint) {
- List<Binding> bindings = entryPoint.getBindings();
- bindings.add(new JSONRPCBinding());
- }
-
- public static void addNonJSONRPCBinding(EntryPoint entryPoint) {
- List<Binding> bindings = entryPoint.getBindings();
- bindings.add(new MockBinding());
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletRequest.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletRequest.java deleted file mode 100644 index 707268ec00..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletRequest.java +++ /dev/null @@ -1,263 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.mocks.servlet;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.security.Principal;
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-public class MockHttpServletRequest implements HttpServletRequest {
-
- private byte[] inputBytes;
-
- public MockHttpServletRequest(byte[] inputBytes) {
- this.inputBytes = inputBytes;
- }
-
- public String getAuthType() {
- return null;
- }
-
- public Cookie[] getCookies() {
- return null;
- }
-
- public long getDateHeader(String arg0) {
- return 0;
- }
-
- public String getHeader(String arg0) {
- return null;
- }
-
- public Enumeration getHeaders(String arg0) {
- return null;
- }
-
- public Enumeration getHeaderNames() {
- return null;
- }
-
- public int getIntHeader(String arg0) {
- return 0;
- }
-
- public String getMethod() {
- return null;
- }
-
- public String getPathInfo() {
- return null;
- }
-
- public String getPathTranslated() {
- return null;
- }
-
- public String getContextPath() {
- return null;
- }
-
- public String getQueryString() {
- return null;
- }
-
- public String getRemoteUser() {
- return null;
- }
-
- public boolean isUserInRole(String arg0) {
- return false;
- }
-
- public Principal getUserPrincipal() {
- return null;
- }
-
- public String getRequestedSessionId() {
- return null;
- }
-
- public String getRequestURI() {
- return null;
- }
-
- public StringBuffer getRequestURL() {
- return null;
- }
-
- public String getServletPath() {
- return null;
- }
-
- public HttpSession getSession(boolean arg0) {
- return null;
- }
-
- HttpSession session = new MockHttpSession();
-
- public HttpSession getSession() {
- return session;
- }
-
- public boolean isRequestedSessionIdValid() {
- return false;
- }
-
- public boolean isRequestedSessionIdFromCookie() {
- return false;
- }
-
- public boolean isRequestedSessionIdFromURL() {
- return false;
- }
-
- public boolean isRequestedSessionIdFromUrl() {
- return false;
- }
-
- public Object getAttribute(String arg0) {
- return null;
- }
-
- public Enumeration getAttributeNames() {
- return null;
- }
-
- public String getCharacterEncoding() {
- return null;
- }
-
- public void setCharacterEncoding(String arg0) throws UnsupportedEncodingException {
- }
-
- public int getContentLength() {
- return 0;
- }
-
- public String getContentType() {
- return null;
- }
-
- public ServletInputStream getInputStream() throws IOException {
- final ByteArrayInputStream is = new ByteArrayInputStream(inputBytes);
- ServletInputStream sis = new ServletInputStream() {
- @Override
- public int read() throws IOException {
- return is.read();
- }
- };
- return sis;
- }
-
- public String getParameter(String arg0) {
- return null;
- }
-
- public Enumeration getParameterNames() {
- return null;
- }
-
- public String[] getParameterValues(String arg0) {
- return null;
- }
-
- public Map getParameterMap() {
- return null;
- }
-
- public String getProtocol() {
- return null;
- }
-
- public String getScheme() {
- return null;
- }
-
- public String getServerName() {
- return null;
- }
-
- public int getServerPort() {
- return 0;
- }
-
- public BufferedReader getReader() throws IOException {
- return null;
- }
-
- public String getRemoteAddr() {
- return null;
- }
-
- public String getRemoteHost() {
- return null;
- }
-
- public void setAttribute(String arg0, Object arg1) {
- }
-
- public void removeAttribute(String arg0) {
- }
-
- public Locale getLocale() {
- return null;
- }
-
- public Enumeration getLocales() {
- return null;
- }
-
- public boolean isSecure() {
- return false;
- }
-
- public RequestDispatcher getRequestDispatcher(String arg0) {
- return null;
- }
-
- public String getRealPath(String arg0) {
- return null;
- }
-
- public int getRemotePort() {
- return 0;
- }
-
- public String getLocalName() {
- return null;
- }
-
- public String getLocalAddr() {
- return null;
- }
-
- public int getLocalPort() {
- return 0;
- }
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletResponse.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletResponse.java deleted file mode 100644 index f8aaceff33..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletResponse.java +++ /dev/null @@ -1,180 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.mocks.servlet;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Locale;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-
-public class MockHttpServletResponse implements HttpServletResponse {
-
- ByteArrayOutputStream outputStream;
-
- public MockHttpServletResponse(ByteArrayOutputStream outputStream) {
- this.outputStream = outputStream;
- }
-
- public void addCookie(Cookie arg0) {
-
- }
-
- public boolean containsHeader(String arg0) {
-
- return false;
- }
-
- public String encodeURL(String arg0) {
-
- return null;
- }
-
- public String encodeRedirectURL(String arg0) {
-
- return null;
- }
-
- public String encodeUrl(String arg0) {
-
- return null;
- }
-
- public String encodeRedirectUrl(String arg0) {
-
- return null;
- }
-
- public void sendError(int arg0, String arg1) throws IOException {
-
- }
-
- public void sendError(int arg0) throws IOException {
-
- }
-
- public void sendRedirect(String arg0) throws IOException {
-
- }
-
- public void setDateHeader(String arg0, long arg1) {
-
- }
-
- public void addDateHeader(String arg0, long arg1) {
-
- }
-
- public void setHeader(String arg0, String arg1) {
-
- }
-
- public void addHeader(String arg0, String arg1) {
-
- }
-
- public void setIntHeader(String arg0, int arg1) {
-
- }
-
- public void addIntHeader(String arg0, int arg1) {
-
- }
-
- public void setStatus(int arg0) {
-
- }
-
- public void setStatus(int arg0, String arg1) {
-
- }
-
- public String getCharacterEncoding() {
-
- return null;
- }
-
- public String getContentType() {
-
- return null;
- }
-
- public ServletOutputStream getOutputStream() throws IOException {
- ServletOutputStream sos = new ServletOutputStream() {
- @Override
- public void write(int arg0) throws IOException {
- outputStream.write(arg0);
- }
- };
- return sos;
- }
-
- public PrintWriter getWriter() throws IOException {
-
- return null;
- }
-
- public void setCharacterEncoding(String arg0) {
-
- }
-
- public void setContentLength(int arg0) {
-
- }
-
- public void setContentType(String arg0) {
-
- }
-
- public void setBufferSize(int arg0) {
-
- }
-
- public int getBufferSize() {
-
- return 0;
- }
-
- public void flushBuffer() throws IOException {
-
- }
-
- public void resetBuffer() {
-
- }
-
- public boolean isCommitted() {
-
- return false;
- }
-
- public void reset() {
-
- }
-
- public void setLocale(Locale arg0) {
-
- }
-
- public Locale getLocale() {
-
- return null;
- }
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpSession.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpSession.java deleted file mode 100644 index 542269c52f..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpSession.java +++ /dev/null @@ -1,93 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.mocks.servlet;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpSession;
-
-public class MockHttpSession implements HttpSession {
-
- public long getCreationTime() {
- return 0;
- }
-
- public String getId() {
- return null;
- }
-
- public long getLastAccessedTime() {
- return 0;
- }
-
- public ServletContext getServletContext() {
- return null;
- }
-
- public void setMaxInactiveInterval(int arg0) {
- }
-
- public int getMaxInactiveInterval() {
- return 0;
- }
-
- @SuppressWarnings("deprecation")
- public javax.servlet.http.HttpSessionContext getSessionContext() {
- return null;
- }
-
- public Object getAttribute(String arg0) {
- return attributes.get(arg0);
- }
-
- public Object getValue(String arg0) {
- return null;
- }
-
- public Enumeration getAttributeNames() {
- return null;
- }
-
- public String[] getValueNames() {
- return null;
- }
-
- HashMap<String, Object> attributes = new HashMap<String, Object>();
-
- public void setAttribute(String arg0, Object arg1) {
- attributes.put(arg0, arg1);
- }
-
- public void putValue(String arg0, Object arg1) {
- }
-
- public void removeAttribute(String arg0) {
- }
-
- public void removeValue(String arg0) {
- }
-
- public void invalidate() {
- }
-
- public boolean isNew() {
- return false;
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletConfig.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletConfig.java deleted file mode 100644 index 0ece32ca4a..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletConfig.java +++ /dev/null @@ -1,44 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.mocks.servlet;
-
-import java.util.Enumeration;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-
-public class MockServletConfig implements ServletConfig {
-
- public String getServletName() {
- return null;
- }
-
- ServletContext servletContext = new MockServletContext();
-
- public ServletContext getServletContext() {
- return servletContext;
- }
-
- public String getInitParameter(String arg0) {
- return null;
- }
-
- public Enumeration getInitParameterNames() {
- return null;
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletContext.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletContext.java deleted file mode 100644 index 1d9189805d..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletContext.java +++ /dev/null @@ -1,148 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.mocks.servlet;
-
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Set;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-public class MockServletContext implements ServletContext {
-
- public ServletContext getContext(String arg0) {
-
- return null;
- }
-
- public int getMajorVersion() {
-
- return 0;
- }
-
- public int getMinorVersion() {
-
- return 0;
- }
-
- public String getMimeType(String arg0) {
-
- return null;
- }
-
- public Set getResourcePaths(String arg0) {
-
- return null;
- }
-
- public URL getResource(String arg0) throws MalformedURLException {
-
- return null;
- }
-
- public InputStream getResourceAsStream(String arg0) {
-
- return null;
- }
-
- public RequestDispatcher getRequestDispatcher(String arg0) {
-
- return null;
- }
-
- public RequestDispatcher getNamedDispatcher(String arg0) {
-
- return null;
- }
-
- public Servlet getServlet(String arg0) throws ServletException {
-
- return null;
- }
-
- public Enumeration getServlets() {
-
- return null;
- }
-
- public Enumeration getServletNames() {
-
- return null;
- }
-
- public void log(String arg0) {
-
- }
-
- public void log(Exception arg0, String arg1) {
-
- }
-
- public void log(String arg0, Throwable arg1) {
-
- }
-
- public String getRealPath(String arg0) {
-
- return null;
- }
-
- public String getServerInfo() {
-
- return null;
- }
-
- public String getInitParameter(String arg0) {
-
- return null;
- }
-
- public Enumeration getInitParameterNames() {
-
- return null;
- }
-
- HashMap<String, Object> attributes = new HashMap<String, Object>();
-
- public Object getAttribute(String arg0) {
- return attributes.get(arg0);
- }
-
- public Enumeration getAttributeNames() {
- return null;
- }
-
- public void setAttribute(String arg0, Object arg1) {
- attributes.put(arg0, arg1);
- }
-
- public void removeAttribute(String arg0) {
-
- }
-
- public String getServletContextName() {
-
- return null;
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockBinding.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockBinding.java deleted file mode 100644 index 8f9a556a00..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockBinding.java +++ /dev/null @@ -1,48 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.mocks.tuscany;
-
-import org.apache.tuscany.model.assembly.AssemblyContext;
-import org.apache.tuscany.model.assembly.AssemblyInitializationException;
-import org.apache.tuscany.model.assembly.AssemblyVisitor;
-import org.apache.tuscany.model.assembly.Binding;
-
-public class MockBinding implements Binding {
-
- public String getURI() {
-
- return null;
- }
-
- public void setURI(String value) {
-
- }
-
- public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException {
-
- }
-
- public void freeze() {
-
- }
-
- public boolean accept(AssemblyVisitor visitor) {
-
- return false;
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockCompositeContextImpl.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockCompositeContextImpl.java deleted file mode 100644 index bce958238b..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockCompositeContextImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.mocks.tuscany;
-
-import java.util.Map;
-
-import org.apache.tuscany.core.context.ScopeContext;
-import org.apache.tuscany.core.context.impl.CompositeContextImpl;
-
-public class MockCompositeContextImpl extends CompositeContextImpl {
- public Map<String, ScopeContext> getScopeIndex() {
- return scopeIndex;
- }
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockEntryPointContext.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockEntryPointContext.java deleted file mode 100644 index 48489eca01..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockEntryPointContext.java +++ /dev/null @@ -1,87 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.mocks.tuscany;
-
-import org.apache.tuscany.core.context.CoreRuntimeException;
-import org.apache.tuscany.core.context.EntryPointContext;
-import org.apache.tuscany.core.context.EventFilter;
-import org.apache.tuscany.core.context.QualifiedName;
-import org.apache.tuscany.core.context.RuntimeEventListener;
-import org.apache.tuscany.core.context.TargetException;
-import org.apache.tuscany.core.context.event.Event;
-
-public class MockEntryPointContext implements EntryPointContext {
-
- private Object instance;
-
- public MockEntryPointContext(Object instance) {
- this.instance = instance;
- }
-
- public Object getHandler() throws TargetException {
-
- return null;
- }
-
- public Class getServiceInterface() {
- return null;
- }
-
- public String getName() {
-
- return null;
- }
-
- public void setName(String name) {
-
- }
-
- public int getLifecycleState() {
-
- return 0;
- }
-
- public void start() throws CoreRuntimeException {
-
- }
-
- public void stop() throws CoreRuntimeException {
-
- }
-
- public Object getInstance(QualifiedName qName) throws TargetException {
-
- return instance;
- }
-
- public void publish(Event object) {
-
- }
-
- public void addListener(RuntimeEventListener listener) {
-
- }
-
- public void addListener(EventFilter filter, RuntimeEventListener listener) {
-
- }
-
- public void removeListener(RuntimeEventListener listener) {
-
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockScopeContext.java b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockScopeContext.java deleted file mode 100644 index 71f1a3615c..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockScopeContext.java +++ /dev/null @@ -1,119 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.binding.jsonrpc.mocks.tuscany;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.core.builder.ContextFactory;
-import org.apache.tuscany.core.context.Context;
-import org.apache.tuscany.core.context.CoreRuntimeException;
-import org.apache.tuscany.core.context.EventFilter;
-import org.apache.tuscany.core.context.QualifiedName;
-import org.apache.tuscany.core.context.RuntimeEventListener;
-import org.apache.tuscany.core.context.ScopeContext;
-import org.apache.tuscany.core.context.ScopeRuntimeException;
-import org.apache.tuscany.core.context.TargetException;
-import org.apache.tuscany.core.context.event.Event;
-
-public class MockScopeContext implements ScopeContext {
-
- private Map<String, Context> instanceContexts;
-
- public MockScopeContext(Map<String, Context> instanceContexts) {
- this.instanceContexts = instanceContexts;
- }
-
- public boolean isCacheable() {
-
- return false;
- }
-
- public void registerFactories(List<ContextFactory<Context>> configurations) {
-
- }
-
- public void registerFactory(ContextFactory<Context> configuration) {
-
- }
-
- public Context getContext(String name) {
-
- return instanceContexts.get(name);
- }
-
- public Context getContextByKey(String name, Object key) {
-
- return null;
- }
-
- public void removeContext(String name) throws ScopeRuntimeException {
-
- }
-
- public void removeContextByKey(String name, Object key) throws ScopeRuntimeException {
-
- }
-
- public String getName() {
-
- return null;
- }
-
- public void setName(String name) {
-
- }
-
- public int getLifecycleState() {
-
- return 0;
- }
-
- public void start() throws CoreRuntimeException {
-
- }
-
- public void stop() throws CoreRuntimeException {
-
- }
-
- public Object getInstance(QualifiedName qName) throws TargetException {
-
- return null;
- }
-
- public void publish(Event object) {
-
- }
-
- public void addListener(RuntimeEventListener listener) {
-
- }
-
- public void addListener(EventFilter filter, RuntimeEventListener listener) {
-
- }
-
- public void removeListener(RuntimeEventListener listener) {
-
- }
-
- public void onEvent(Event event) {
-
- }
-
-}
diff --git a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/resources/org/apache/tuscany/binding/jsonrpc/assembly/tests/sca.module b/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/resources/org/apache/tuscany/binding/jsonrpc/assembly/tests/sca.module deleted file mode 100644 index e331f04c5a..0000000000 --- a/branches/java-M1/java/sca/bindings/binding.jsonrpc/src/test/resources/org/apache/tuscany/binding/jsonrpc/assembly/tests/sca.module +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- * Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" - xmlns:jsonrpc="http://org.apache.tuscany/xmlns/jsonrpc/0.9"
-
- name="tuscany.binding.jsonrpc.assembly.tests.bigbank.account">
-
- <entryPoint name="AccountService">
- <jsonrpc:binding.jsonrpc/>
- </entryPoint>
-
-</module>
-
diff --git a/branches/java-M1/java/sca/bindings/pom.xml b/branches/java-M1/java/sca/bindings/pom.xml deleted file mode 100644 index d2aa27a50b..0000000000 --- a/branches/java-M1/java/sca/bindings/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<project>
-
- <parent>
- <groupId>org.apache.tuscany</groupId>
- <artifactId>tuscany-sca</artifactId>
- <version>incubating-M1</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.tuscany.sca.bindings</groupId>
- <artifactId>tuscany-sca-bindings</artifactId>
- <packaging>pom</packaging>
- <name>Tuscany SCA Bindings</name>
- <version>incubating-M1</version>
-
- <modules>
- <!-- temporary project to download and install the celtix required sun jars. The jars
- are all CDDL so will be available on ibiblio when Sun releases them. This is just temporary.
- -->
- <module>sunjars</module>
-
- <module>binding.axis2</module>
- <module>binding.jsonrpc</module>
- <module>binding.celtix</module>
- </modules>
-
-</project>
diff --git a/branches/java-M1/java/sca/bindings/sunjars/build.xml b/branches/java-M1/java/sca/bindings/sunjars/build.xml deleted file mode 100644 index 59b9553bc1..0000000000 --- a/branches/java-M1/java/sca/bindings/sunjars/build.xml +++ /dev/null @@ -1,53 +0,0 @@ -<project name="CeltixSunJarsInstaller"> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> - - <target name="checkinstalled"> - <condition property="already.installed" > - <and> - <available file="${localRepository}/javax/annotation/jsr250-api/2.0-JAXWS-2.0-EA3/jsr250-api-2.0-JAXWS-2.0-EA3.jar"/> - <available file="${localRepository}/javax/jws/jsr181-api/2.0-JAXWS-2.0-EA3/jsr181-api-2.0-JAXWS-2.0-EA3.jar"/> - <available file="${localRepository}/javax/xml/jaxws-api/2.0-JAXWS-2.0-EA3/jaxws-api-2.0-JAXWS-2.0-EA3.jar"/> - <available file="${localRepository}/com/sun/xml/saaj-impl/1.3/saaj-impl-1.3.jar"/> - <available file="${localRepository}/javax/xml/saaj-api/1.3/saaj-api-1.3.jar"/> - </and> - </condition> - <condition property="maven.suffix" value=""> - <os family="unix"/> - </condition> - <condition property="maven.suffix" value=".bat"> - <os family="windows"/> - </condition> - </target> - - <target name="installJars" depends="checkinstalled" unless="already.installed"> - <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false"> - <arg line="install:install-file -DgroupId=javax.annotation -DartifactId=jsr250-api -Dversion=2.0-JAXWS-2.0-EA3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/jsr250-api-2.0-JAXWS-2.0-EA3.jar"/> - </exec> - <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false"> - <arg line="install:install-file -DgroupId=javax.jws -DartifactId=jsr181-api -Dversion=2.0-JAXWS-2.0-EA3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/jsr181-api-2.0-JAXWS-2.0-EA3.jar"/> - </exec> - <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false"> - <arg line="install:install-file -DgroupId=javax.xml -DartifactId=jaxws-api -Dversion=2.0-JAXWS-2.0-EA3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/jaxws-api-2.0-JAXWS-2.0-EA3.jar"/> - </exec> - <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false"> - <arg line="install:install-file -DgroupId=javax.xml -DartifactId=saaj-api -Dversion=1.3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/saaj-api-1.3.jar"/> - </exec> - <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false"> - <arg line="install:install-file -DgroupId=com.sun.xml -DartifactId=saaj-impl -Dversion=1.3 -Dpackaging=jar -DgeneratePom=true -Dfile=${basedir}/target/celtix-install/celtix/lib/saaj-impl-1.3.jar"/> - </exec> - </target> -</project> diff --git a/branches/java-M1/java/sca/bindings/sunjars/pom.xml b/branches/java-M1/java/sca/bindings/sunjars/pom.xml deleted file mode 100644 index 38fe58884f..0000000000 --- a/branches/java-M1/java/sca/bindings/sunjars/pom.xml +++ /dev/null @@ -1,105 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.tuscany.sca.bindings</groupId> - <artifactId>tuscany-sunjars</artifactId> - <packaging>pom</packaging> - <version>incubating-M1</version> - <name>Project to install the Sun jars</name> - - <parent> - <groupId>org.apache.tuscany.sca.bindings</groupId> - <artifactId>tuscany-sca-bindings</artifactId> - <version>incubating-M1</version> - </parent> - - - <properties> - <celtix.version>1.0</celtix.version> - </properties> - <repositories> - <repository> - <id>objectweb</id> - <name>ObjectWeb repo</name> - <url>http://maven.objectweb.org/maven2</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - </repositories> - - - - <build> - <plugins> - <!-- This is a "hack" to overcome the Sun jar issue. Basically, we download a - complete celtix install kit (epl version) and then extract the Sun jars that we - need and install them. We use the dependency plugin to download it from the - objectweb snapshot mirror, then use antrun to fork a build.xml that will conditionally - call mvn to install the jars if they aren't already there. --> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>dependency-maven-plugin</artifactId> - <executions> - <execution> - <id>getdeps</id> - <phase>validate</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/celtix-install</outputDirectory> - <artifactItems> - <artifactItem> - <groupId>org.objectweb.celtix</groupId> - <artifactId>celtix-distribution</artifactId> - <version>${celtix.version}</version> - <classifier>bin-epl</classifier> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <execution> - <id>install</id> - <phase>install</phase> - <goals> - <goal>run</goal> - </goals> - <configuration> - <tasks> - <ant target="installJars"> - <property name="localRepository" value="${settings.localRepository}"/> - </ant> - </tasks> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/branches/java-M1/java/sca/common/pom.xml b/branches/java-M1/java/sca/common/pom.xml deleted file mode 100644 index 861c33c7e1..0000000000 --- a/branches/java-M1/java/sca/common/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project> - <parent> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-sca</artifactId> - <version>incubating-M1</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>tuscany-common</artifactId> - <name>Tuscany Common</name> - <description>Tuscany classes common to runtime and tools.</description> - <version>incubating-M1</version> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyException.java b/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyException.java deleted file mode 100644 index 2bf802520d..0000000000 --- a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyException.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.common; - -import java.util.ArrayList; -import java.util.List; - -/** - * The root checked exception for the Tuscany runtime. - * - * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ - */ -public abstract class TuscanyException extends Exception { - private static final long serialVersionUID = -7847121698339635268L; - private List<String> contextStack; - private String identifier; - - /** - * Override constructor from Exception. - * - * @see Exception - */ - public TuscanyException() { - super(); - } - - /** - * Override constructor from Exception. - * - * @param message passed to Exception - * @see Exception - */ - public TuscanyException(String message) { - super(message); - } - - /** - * Override constructor from Exception. - * - * @param message passed to Exception - * @param cause passed to Exception - * @see Exception - */ - public TuscanyException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Override constructor from Exception. - * - * @param cause passed to Exception - * @see Exception - */ - public TuscanyException(Throwable cause) { - super(cause); - } - - /** - * Returns a collection of names representing the context call stack where the error occured. - * The top of the stack is the first element in the collection. - * - * @return a collection of names representing the context call stack - */ - public List<String> returnContextNames() { - if (contextStack == null) { - contextStack = new ArrayList<String>(); - } - return contextStack; - } - - /** - * Pushes a context name where an error occured onto the call stack. - * - * @param name the name of a context to push on the stack - */ - public void addContextName(String name) { - if (contextStack == null) { - contextStack = new ArrayList<String>(); - } - contextStack.add(name); - } - - /** - * Returns a string representing additional error information referred to in the error message. - * - * @return additional error information - */ - public String getIdentifier() { - return identifier; - } - - /** - * Sets an additional error information referred to in the error message. - * - * @param identifier additional error information - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getMessage() { - if (identifier == null && contextStack == null) { - return super.getMessage(); - } - StringBuilder b = new StringBuilder(256); - b.append(super.getMessage()); - - if (identifier != null) { - b.append(" [").append(identifier).append(']'); - } - if (contextStack != null) { - b.append("\nContext stack trace: "); - for (int i = contextStack.size() - 1; i >= 0; i--) { - b.append('[').append(contextStack.get(i)).append(']'); - } - } - return b.toString(); - } -} diff --git a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyRuntimeException.java b/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyRuntimeException.java deleted file mode 100644 index 60f2e2287a..0000000000 --- a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyRuntimeException.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.common; - -import java.util.ArrayList; -import java.util.List; - -/** - * The root unchecked exception for the Tuscany runtime. - * - * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ - */ - -public abstract class TuscanyRuntimeException extends RuntimeException { - private static final long serialVersionUID = -759677431966121786L; - private List<String> contextStack; - private String identifier; - - /** - * Override constructor from RuntimeException. - * - * @see RuntimeException - */ - public TuscanyRuntimeException() { - super(); - } - - /** - * Override constructor from RuntimeException. - * - * @param message passed to RuntimeException - * @see RuntimeException - */ - public TuscanyRuntimeException(String message) { - super(message); - } - - /** - * Override constructor from RuntimeException. - * - * @param message passed to RuntimeException - * @param cause passed to RuntimeException - * @see RuntimeException - */ - public TuscanyRuntimeException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Override constructor from RuntimeException. - * - * @param cause passed to RuntimeException - * @see RuntimeException - */ - public TuscanyRuntimeException(Throwable cause) { - super(cause); - } - - /** - * Returns a collection of names representing the context call stack where the error occured. - * The top of the stack is the first element in the collection. - * - * @return a collection of names representing the context call stack - */ - public List<String> returnContextNames() { - if (contextStack == null) { - contextStack = new ArrayList<String>(); - } - return contextStack; - } - - /** - * Pushes a context name where an error occured onto the call stack. - * - * @param name the name of a context to push on the stack - */ - public void addContextName(String name) { - if (contextStack == null) { - contextStack = new ArrayList<String>(); - } - contextStack.add(name); - } - - /** - * Returns a string representing additional error information referred to in the error message. - * - * @return additional error information - */ - public String getIdentifier() { - return identifier; - } - - /** - * Sets an additional error information referred to in the error message. - * - * @param identifier additional error information - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getMessage() { - if (identifier == null && contextStack == null) { - return super.getMessage(); - } - StringBuilder b = new StringBuilder(256); - b.append(super.getMessage()); - - if (identifier != null) { - b.append(" [").append(identifier).append(']'); - } - if (contextStack != null) { - b.append("\nContext stack trace: "); - for (int i = contextStack.size() - 1; i >= 0; i--) { - b.append('[').append(contextStack.get(i)).append(']'); - } - } - return b.toString(); - } -} diff --git a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/LogLevel.java b/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/LogLevel.java deleted file mode 100644 index 45134c7556..0000000000 --- a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/LogLevel.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.common.monitor; - -import static java.lang.annotation.ElementType.METHOD; -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import java.lang.annotation.Target; - -/** - * Annotation that can be applied to methods in a monitoring interface - * to indicate to logging frameworks the severity of the event. - * - * @version $Rev$ $Date$ - */ -@Target({METHOD}) -@Retention(RUNTIME) -public @interface LogLevel { - - /** - * The log level as specified by {@link java.util.logging.Level}. - */ - @SuppressWarnings({"JavaDoc"}) String value(); -} diff --git a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/MonitorFactory.java b/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/MonitorFactory.java deleted file mode 100644 index aa92092005..0000000000 --- a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/MonitorFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.common.monitor; - -/** - * A MonitorFactory creates implementations of components' monitor interfaces - * that interface with a its monitoring scheme. For example, a implementation - * may create versions that emit appropriate logging events or which send - * notifications to a management API. - * - * @version $Rev$ $Date$ - */ -public interface MonitorFactory { - /** - * Return a monitor for a component's monitor interface. - * - * @param monitorInterface the component's monitoring interface - * @return an implementation of the monitoring interface; will not be null - */ - <T> T getMonitor(Class<T> monitorInterface); -} diff --git a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/InvalidLevelException.java b/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/InvalidLevelException.java deleted file mode 100644 index baf4e8b7cc..0000000000 --- a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/InvalidLevelException.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.common.monitor.impl; - -/** - * Exception indicating an invalid log level has been passed. - * - * @version $Rev$ $Date$ - */ -public class InvalidLevelException extends IllegalArgumentException { - private static final long serialVersionUID = 7767234706427841915L; - private final String method; - private final String level; - - /** - * Constructor specifying the method name and the level affected. - * - * @param method the name of the method being monitored - * @param level the invalid log level value - */ - public InvalidLevelException(String method, String level) { - super(); - this.method = method; - this.level = level; - } - - /** - * Returns the name of the method being monitored. - * @return the name of the method being monitored - */ - public String getMethod() { - return method; - } - - /** - * Returns the invalid log level specified. - * @return the invalid log level that was specified - */ - public String getLevel() { - return level; - } - - public String getMessage() { - return "Invalid level for method " + method + " : " + level; - } -} diff --git a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/JavaLoggingMonitorFactory.java b/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/JavaLoggingMonitorFactory.java deleted file mode 100644 index daef77d4ae..0000000000 --- a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/JavaLoggingMonitorFactory.java +++ /dev/null @@ -1,186 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.common.monitor.impl; - -import java.lang.ref.WeakReference; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.WeakHashMap; -import java.util.ResourceBundle; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.logging.LogRecord; - -import org.apache.tuscany.common.monitor.LogLevel; -import org.apache.tuscany.common.monitor.MonitorFactory; - -/** - * A factory for monitors that forwards events to a {@link java.util.logging.Logger Java Logging (JSR47) Logger}. - * - * @version $Rev$ $Date$ - * @see java.util.logging - */ -public class JavaLoggingMonitorFactory implements MonitorFactory { - private final String bundleName; - private final Level defaultLevel; - private final Map<String, Level> levels; - - private final Map<Class<?>, WeakReference<?>> proxies = new WeakHashMap<Class<?>, WeakReference<?>>(); - - /** - * Construct a MonitorFactory that will monitor the specified methods at the specified levels - * and generate messages using java.util.logging. - * <p/> - * The supplied Properties can be used to specify custom log levels for specific monitor - * methods. The key should be the method name in form returned by - * <code>Class.getName() + '#' + Method.getName()</code> and the value the log level to use - * as defined by {@link java.util.logging.Level}. - * - * @param levels definition of custom levels for specific monitored methods - * @param defaultLevel the default log level to use - * @param bundleName the name of a resource bundle that will be passed to the logger - * @see java.util.logging.Logger - */ - public JavaLoggingMonitorFactory(Properties levels, Level defaultLevel, String bundleName) { - this.defaultLevel = defaultLevel; - this.bundleName = bundleName; - this.levels = new HashMap<String, Level>(levels.size()); - for (Map.Entry<Object, Object> entry : levels.entrySet()) { - String method = (String) entry.getKey(); - String level = (String) entry.getValue(); - try { - this.levels.put(method, Level.parse(level)); - } catch (IllegalArgumentException e) { - throw new InvalidLevelException(method, level); - } - } - } - - public synchronized <T> T getMonitor(Class<T> monitorInterface) { - T proxy = getCachedMonitor(monitorInterface); - if (proxy == null) { - proxy = createMonitor(monitorInterface, bundleName); - proxies.put(monitorInterface, new WeakReference<T>(proxy)); - } - return proxy; - } - - private <T>T getCachedMonitor(Class<T> monitorInterface) { - WeakReference<?> ref = proxies.get(monitorInterface); - return (ref != null) ? monitorInterface.cast(ref.get()) : null; - } - - private <T>T createMonitor(Class<T> monitorInterface, String bundleName) { - String className = monitorInterface.getName(); - Logger logger = Logger.getLogger(className); - Method[] methods = monitorInterface.getMethods(); - Map<String, Level> levels = new HashMap<String, Level>(methods.length); - for (Method method : methods) { - String key = className + '#' + method.getName(); - Level level = this.levels.get(key); - - // if not specified the in config properties, look for an annotation on the method - if (level == null) { - LogLevel annotation = method.getAnnotation(LogLevel.class); - if (annotation != null && annotation.value() != null) { - try { - level = Level.parse(annotation.value()); - } catch (IllegalArgumentException e) { - // bad value, just use the default - level = defaultLevel; - } - } - } - if (level == null) { - level = defaultLevel; - } - levels.put(method.getName(), level); - } - - ResourceBundle bundle = locateBundle(monitorInterface, bundleName); - - InvocationHandler handler = new LoggingHandler(logger, levels, bundle); - return monitorInterface.cast(Proxy.newProxyInstance(monitorInterface.getClassLoader(), new Class<?>[]{monitorInterface}, handler)); - } - - private static <T>ResourceBundle locateBundle(Class<T> monitorInterface, String bundleName) { - Locale locale = Locale.getDefault(); - ClassLoader cl = monitorInterface.getClassLoader(); - String packageName = monitorInterface.getPackage().getName(); - while (true) { - try { - return ResourceBundle.getBundle(packageName + '.' + bundleName, locale, cl); - } catch (MissingResourceException e) { - } - int index = packageName.lastIndexOf('.'); - if (index == -1) { - break; - } - packageName = packageName.substring(0, index); - } - try { - return ResourceBundle.getBundle(bundleName, locale, cl); - } catch (Exception e) { - return null; - } - } - - private static final class LoggingHandler implements InvocationHandler { - private final Logger logger; - private final Map<String, Level> methodLevels; - private final ResourceBundle bundle; - - public LoggingHandler(Logger logger, Map<String, Level> methodLevels, ResourceBundle bundle) { - this.logger = logger; - this.methodLevels = methodLevels; - this.bundle = bundle; - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - String sourceMethod = method.getName(); - Level level = methodLevels.get(sourceMethod); - if (level != null && logger.isLoggable(level)) { - // construct the key for the resource bundle - String className = logger.getName(); - String key = className + '#' + sourceMethod; - - LogRecord logRecord = new LogRecord(level, key); - logRecord.setLoggerName(className); - logRecord.setSourceClassName(className); - logRecord.setSourceMethodName(sourceMethod); - logRecord.setParameters(args); - if (args != null) { - for (Object o : args) { - if (o instanceof Throwable) { - logRecord.setThrown((Throwable) o); - break; - } - } - } - logRecord.setResourceBundle(bundle); - logger.log(logRecord); - } - return null; - } - } -} diff --git a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/NullMonitorFactory.java b/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/NullMonitorFactory.java deleted file mode 100644 index 827aeec84c..0000000000 --- a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/NullMonitorFactory.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.common.monitor.impl; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -import org.apache.tuscany.common.monitor.MonitorFactory; - -/** - * Implementation of a {@link MonitorFactory} that produces implementations that simply return. - * - * @version $Rev$ $Date$ - */ -public class NullMonitorFactory implements MonitorFactory { - public <T> T getMonitor(Class<T> monitorInterface) { - /* - * This uses a reflection proxy to implement the monitor interface which - * is a simple but perhaps not very performant solution. Performance - * might be improved by code generating an implementation with empty methods. - */ - return monitorInterface.cast(Proxy.newProxyInstance(monitorInterface.getClassLoader(), new Class<?>[]{monitorInterface}, NULL_MONITOR)); - } - - /** - * Singleton wire hander that does nothing. - */ - private static final InvocationHandler NULL_MONITOR = new InvocationHandler() { - public Object invoke(Object proxy, Method method, Object[] args) { - return null; - } - }; -} diff --git a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/resource/ResourceLoader.java b/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/resource/ResourceLoader.java deleted file mode 100644 index 897c5e06c0..0000000000 --- a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/resource/ResourceLoader.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.common.resource; - -import java.io.IOException; -import java.net.URL; -import java.util.Iterator; -import java.util.List; - -/** - * Interface which abstracts the implementation of something that is able to - * load resources (such as a ClassLoader). All Tuscany code should use this - * API rather than a ClassLoader directly in order to reduce the risk of - * memory leaks due to ClassLoader references. - * - * @version $Rev: 379878 $ $Date: 2006-02-22 12:45:50 -0800 (Wed, 22 Feb 2006) $ - */ -public interface ResourceLoader { - - /** - * Returns the parent resource loaders. - * - * @return resource loaders that are parents to this one - */ - List<ResourceLoader> getParents(); - - /** - * Loads the class with the specified binary name. - * - * @param name the binary name of the class - * @return the resulting Class object - * @throws ClassNotFoundException if the class was not found - * @see ClassLoader#loadClass(String) - */ - Class<?> loadClass(String name) throws ClassNotFoundException; - - /** - * Converts an array of bytes into a Class. - * - * @param bytes the bytecode for the class; must match the class file format - * @return a Class defined from the supplied bytecode - */ - Class<?> addClass(byte[] bytes); - - /** - * Finds the first resource with the given name. - * <p/> - * Each parent is searched first (in the order returned by {@link #getParents()}) - * and the first resource located is found. If no parent returns a resource then - * the first resource defined by this ResourceLoader is returned. - * - * @param name the resource name - * @return a {@link URL} that can be used to read the resource, or null if no resource could be found - */ - URL getResource(String name); - - /** - * Find resources with the given name that are available from this - * ResourceLoader or any of its parents. - * - * @param name the resource name - * @return an Iterator of {@link URL} objects for the resource - * @throws IOException if there was a problem locating the resources - */ - Iterator<URL> getResources(String name) throws IOException; - - //FIXME this is temporary to work around classloader problems with SDO when running in Tomcat - - /** - * Returns the underlying classloader this loader is wrapping. - * - * @return the underlying classloader this loader is wrapping - */ - ClassLoader getClassLoader(); - -} diff --git a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/GeneratedClassLoader.java b/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/GeneratedClassLoader.java deleted file mode 100644 index 953908b9f2..0000000000 --- a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/GeneratedClassLoader.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.common.resource.impl; - -/** - * A class loader that allows new classes to be defined from an array of bytes. - * - * @version $Rev: 369102 $ $Date: 2006-01-14 13:48:56 -0800 (Sat, 14 Jan 2006) $ - */ -@SuppressWarnings({"CustomClassloader"}) -class GeneratedClassLoader extends ClassLoader { - - /** - * Constructs a new GeneratedClassLoader. - * @param classLoader the parent classloader - */ - GeneratedClassLoader(ClassLoader classLoader) { - super(classLoader); - } - - /** - * Converts an array of bytes into a Class. - * - * @param bytes the bytecode for the class; must match the class file format - * @return a Class defined from the supplied bytecode - */ - Class<?> addClass(byte[] bytes) { - return defineClass(null, bytes, 0, bytes.length); - } - -} diff --git a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/ResourceLoaderImpl.java b/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/ResourceLoaderImpl.java deleted file mode 100644 index d306edf3b4..0000000000 --- a/branches/java-M1/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/ResourceLoaderImpl.java +++ /dev/null @@ -1,137 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.common.resource.impl; - -import java.io.IOException; -import java.lang.ref.WeakReference; -import java.net.URL; -import java.util.Collections; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; - -import org.apache.tuscany.common.resource.ResourceLoader; - -/** - * Default implementation of the ResourceLoader interface - * - * @version $Rev: 369102 $ $Date: 2006-01-14 13:48:56 -0800 (Sat, 14 Jan 2006) $ - */ -@SuppressWarnings({"ClassLoader2Instantiation"}) -public class ResourceLoaderImpl implements ResourceLoader { - private final WeakReference<ClassLoader> classLoaderReference; - private WeakReference<GeneratedClassLoader> generatedClassLoaderReference; - private final List<ResourceLoader> parents; - - /** - * Constructs a new ResourceLoaderImpl to wrap a ClassLoader. - * - * @param classLoader the classloader to wrap - */ - public ResourceLoaderImpl(ClassLoader classLoader) { - classLoaderReference = new WeakReference<ClassLoader>(classLoader); - generatedClassLoaderReference = new WeakReference<GeneratedClassLoader>(new GeneratedClassLoader(classLoader)); - ClassLoader parentCL = classLoader.getParent(); - if (null == parentCL) { - parents = Collections.emptyList(); - } else { - parents = Collections.singletonList((ResourceLoader) new ResourceLoaderImpl(parentCL)); - } - } - - - public ClassLoader getClassLoader() throws IllegalStateException { - ClassLoader cl = classLoaderReference.get(); - if (cl == null) { - throw new IllegalStateException("Referenced ClassLoader has been garbage collected"); - } - return cl; - } - - public List<ResourceLoader> getParents() { - return parents; - } - - public Class<?> loadClass(String name) throws ClassNotFoundException { - GeneratedClassLoader cl = generatedClassLoaderReference.get(); - if (cl != null) { - return Class.forName(name, true, cl); - } else { - return Class.forName(name, true, getClassLoader()); - } - } - - public Class<?> addClass(byte[] bytes) { - GeneratedClassLoader cl = generatedClassLoaderReference.get(); - if (cl == null) { - cl = new GeneratedClassLoader(getClassLoader()); - generatedClassLoaderReference = new WeakReference<GeneratedClassLoader>(cl); - } - return cl.addClass(bytes); - } - - public Iterator<URL> getResources(String name) throws IOException { - return new EnumerationIterator<URL>(getClassLoader().getResources(name)); - } - - public URL getResource(String name) { - return getClassLoader().getResource(name); - } - - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof ResourceLoaderImpl)) { - return false; - } - final ResourceLoaderImpl other = (ResourceLoaderImpl) obj; - return getClassLoader() == other.getClassLoader(); - } - - public int hashCode() { - return getClassLoader().hashCode(); - } - - private static class EnumerationIterator<E> implements Iterator<E> { - private final Enumeration<E> e; - - public EnumerationIterator(Enumeration<E> e) { - this.e = e; - } - - public boolean hasNext() { - return e.hasMoreElements(); - } - - public E next() { - // the try/catch is needed here to get IDEA to shut up - // there should be no performance overhead here except when the Exception is thrown - // so I am going to leave it in - feel free to remove if there is any issue - try { - return e.nextElement(); - } catch (NoSuchElementException e1) { - throw e1; - } - } - - public void remove() { - throw new UnsupportedOperationException(); - } - } -} diff --git a/branches/java-M1/java/sca/common/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/common/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/common/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/common/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/common/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/common/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/common/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/common/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/common/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.logging.LogProvider b/branches/java-M1/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.logging.LogProvider deleted file mode 100644 index 6cf181502c..0000000000 --- a/branches/java-M1/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.logging.LogProvider +++ /dev/null @@ -1 +0,0 @@ -org.apache.tuscany.common.logging.impl.JSR47LogProviderImpl
\ No newline at end of file diff --git a/branches/java-M1/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.resource.loader.ResourceLoaderProvider b/branches/java-M1/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.resource.loader.ResourceLoaderProvider deleted file mode 100644 index 70456ec1d0..0000000000 --- a/branches/java-M1/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.resource.loader.ResourceLoaderProvider +++ /dev/null @@ -1 +0,0 @@ -org.apache.tuscany.common.resource.loader.impl.ResourceLoaderProviderImpl
\ No newline at end of file diff --git a/branches/java-M1/java/sca/common/src/test/java/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase.java b/branches/java-M1/java/sca/common/src/test/java/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase.java deleted file mode 100644 index 985f7ef9b6..0000000000 --- a/branches/java-M1/java/sca/common/src/test/java/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase.java +++ /dev/null @@ -1,163 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.common.monitor.impl; - -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.LogRecord; -import java.util.logging.Logger; - -import junit.framework.TestCase; - -import org.apache.tuscany.common.monitor.MonitorFactory; -import org.apache.tuscany.common.monitor.LogLevel; - -/** - * Test case for the JavaLoggingMonitorFactory. - * - * @version $Rev$ $Date$ - */ -public class JavaLoggingTestCase extends TestCase { - private static final Logger logger = Logger.getLogger(Monitor.class.getName()); - private static final MockHandler handler = new MockHandler(); - - private MonitorFactory factory; - - /** - * Smoke test to ensure the logger is working. - */ - public void testLogger() { - logger.info("test"); - assertEquals(1, handler.logs.size()); - } - - /** - * Test that no record is logged. - */ - public void testUnloggedEvent() { - Monitor mon = factory.getMonitor(Monitor.class); - mon.eventNotToLog(); - assertEquals(0, handler.logs.size()); - } - - /** - * Test the correct record is written for an event with no arguments. - */ - public void testEventWithNoArgs() { - Monitor mon = factory.getMonitor(Monitor.class); - mon.eventWithNoArgs(); - assertEquals(1, handler.logs.size()); - LogRecord record = handler.logs.get(0); - assertEquals(Level.INFO, record.getLevel()); - assertEquals(logger.getName(), record.getLoggerName()); - assertEquals(Monitor.class.getName() + "#eventWithNoArgs", record.getMessage()); - } - - /** - * Test the correct record is written for an event defined by annotation. - */ - public void testEventWithAnnotation() { - Monitor mon = factory.getMonitor(Monitor.class); - mon.eventWithAnnotation(); - assertEquals(1, handler.logs.size()); - LogRecord record = handler.logs.get(0); - assertEquals(Level.INFO, record.getLevel()); - assertEquals(logger.getName(), record.getLoggerName()); - assertEquals(Monitor.class.getName() + "#eventWithAnnotation", record.getMessage()); - } - - /** - * Test a Throwable is logged when passed to an event. - */ - public void testEventWithThrowable() { - Exception e = new Exception(); - Monitor mon = factory.getMonitor(Monitor.class); - mon.eventWithThrowable(e); - assertEquals(1, handler.logs.size()); - LogRecord record = handler.logs.get(0); - assertEquals(Level.WARNING, record.getLevel()); - assertEquals(logger.getName(), record.getLoggerName()); - assertEquals(Monitor.class.getName() + "#eventWithThrowable", record.getMessage()); - assertSame(e, record.getThrown()); - } - - /** - * Test the argument is logged. - */ - public void testEventWithOneArg() { - Monitor mon = factory.getMonitor(Monitor.class); - mon.eventWithOneArg("ARG"); - assertEquals(1, handler.logs.size()); - LogRecord record = handler.logs.get(0); - assertEquals(Monitor.class.getName() + "#eventWithOneArg", record.getMessage()); - } - - protected void setUp() throws Exception { - super.setUp(); - logger.setUseParentHandlers(false); - logger.addHandler(handler); - handler.flush(); - - String sourceClass = Monitor.class.getName(); - Properties levels = new Properties(); - levels.setProperty(sourceClass + "#eventWithNoArgs", "INFO"); - levels.setProperty(sourceClass + "#eventWithOneArg", "INFO"); - levels.setProperty(sourceClass + "#eventWithThrowable", "WARNING"); - factory = new JavaLoggingMonitorFactory(levels, Level.FINE, "TestMessages"); - } - - protected void tearDown() throws Exception { - logger.removeHandler(handler); - handler.flush(); - super.tearDown(); - } - - /** - * Mock log handler to capture records. - */ - public static class MockHandler extends Handler { - List<LogRecord> logs = new ArrayList<LogRecord>(); - - public void publish(LogRecord record) { - logs.add(record); - } - - public void flush() { - logs.clear(); - } - - public void close() throws SecurityException { - } - } - - @SuppressWarnings({"JavaDoc"}) - public static interface Monitor { - void eventNotToLog(); - - void eventWithNoArgs(); - - void eventWithOneArg(String msg); - - void eventWithThrowable(Exception e); - - @LogLevel("INFO") - void eventWithAnnotation(); - } -} diff --git a/branches/java-M1/java/sca/common/src/test/resources/org/apache/tuscany/common/TestMessages.properties b/branches/java-M1/java/sca/common/src/test/resources/org/apache/tuscany/common/TestMessages.properties deleted file mode 100644 index e765ad2e0f..0000000000 --- a/branches/java-M1/java/sca/common/src/test/resources/org/apache/tuscany/common/TestMessages.properties +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. -# -# Licensed 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. -# -# $Rev$ $Date$ -# diff --git a/branches/java-M1/java/sca/common/src/test/resources/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase$Monitor.properties b/branches/java-M1/java/sca/common/src/test/resources/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase$Monitor.properties deleted file mode 100644 index e16fa437fa..0000000000 --- a/branches/java-M1/java/sca/common/src/test/resources/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase$Monitor.properties +++ /dev/null @@ -1 +0,0 @@ -org.apache.tuscany.common.monitor.impl.JavaLoggingTestCase$Monitor#eventWithOneArg=Log message with arg={0}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.java/pom.xml b/branches/java-M1/java/sca/containers/container.java/pom.xml deleted file mode 100644 index cb33cc90cf..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project> - - <parent> - <groupId>org.apache.tuscany.sca.containers</groupId> - <artifactId>tuscany-sca-containers</artifactId> - <version>incubating-M1</version> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>tuscany-container-java</artifactId> - <name>Tuscany Java IoC Container</name> - <description>Container for managing components as defined by the SCA implementation specification.</description> - <version>incubating-M1</version> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-core</artifactId> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.tuscany.databinding</groupId> - <artifactId>tuscany-databinding-sdo</artifactId> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaAssemblyFactory.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaAssemblyFactory.java deleted file mode 100644 index 90271179d1..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaAssemblyFactory.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly; - -import org.apache.tuscany.model.assembly.AssemblyFactory; - - -/** - * The Factory for the model. - */ -public interface JavaAssemblyFactory extends AssemblyFactory { - /** - * Returns a new JavaImplementation. - */ - JavaImplementation createJavaImplementation(); -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaImplementation.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaImplementation.java deleted file mode 100644 index a87b8ea1bb..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaImplementation.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly; - -import org.apache.tuscany.model.assembly.AtomicImplementation; - - -/** - * Represents a java implementation. - * - * @version $Rev$ $Date$ - */ -public interface JavaImplementation extends AtomicImplementation { - - /** - * Returns the implementation class. - */ - Class<?> getImplementationClass(); - - /** - * Sets the implementation class. - */ - void setImplementationClass(Class<?> value); - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaAssemblyFactoryImpl.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaAssemblyFactoryImpl.java deleted file mode 100644 index 3337c287ac..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaAssemblyFactoryImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.impl; - -import org.osoa.sca.annotations.Service; - -import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; -import org.apache.tuscany.container.java.assembly.JavaImplementation; -import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; - -/** - * A factory for the model. - */ -@Service(interfaces = {JavaAssemblyFactory.class}) -public class JavaAssemblyFactoryImpl extends AssemblyFactoryImpl implements JavaAssemblyFactory { - - /** - * Constructor - */ - public JavaAssemblyFactoryImpl() { - super(); - } - - /** - * @see org.apache.tuscany.container.java.assembly.JavaAssemblyFactory#createJavaImplementation() - */ - public JavaImplementation createJavaImplementation() { - return new JavaImplementationImpl(); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaImplementationImpl.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaImplementationImpl.java deleted file mode 100644 index 57a98f4ad6..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaImplementationImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.impl; - -import org.apache.tuscany.container.java.assembly.JavaImplementation; -import org.apache.tuscany.model.assembly.impl.AtomicImplementationImpl; - -/** - * An implementation of JavaImplementation. - * - * @version $Rev$ $Date$ - */ -public class JavaImplementationImpl extends AtomicImplementationImpl implements JavaImplementation { - private Class<?> implementationClass; - - /** - * Default constructor. - */ - protected JavaImplementationImpl() { - } - - public Class<?> getImplementationClass() { - return implementationClass; - } - - public void setImplementationClass(Class<?> value) { - checkNotFrozen(); - implementationClass = value; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilder.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilder.java deleted file mode 100644 index de915738f9..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilder.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.builder; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.container.java.assembly.JavaImplementation; -import org.apache.tuscany.container.java.config.JavaContextFactory; -import org.apache.tuscany.core.extension.config.extensibility.ComponentNameExtensibilityElement; -import org.apache.tuscany.core.extension.config.extensibility.ContextExtensibilityElement; -import org.apache.tuscany.core.extension.config.extensibility.DestroyInvokerExtensibilityElement; -import org.apache.tuscany.core.extension.config.extensibility.InitInvokerExtensibilityElement; -import org.apache.tuscany.core.extension.config.InjectorExtensibilityElement; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.extension.ContextFactoryBuilderSupport; -import org.apache.tuscany.core.injection.EventInvoker; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Builds context factories for component implementations that map to {@link - * org.apache.tuscany.container.java.assembly.JavaImplementation}. The logical model is then decorated with - * the runtime configuration. - * - * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ - * @see org.apache.tuscany.core.builder.ContextFactory - */ -@org.osoa.sca.annotations.Scope("MODULE") -public class JavaContextFactoryBuilder extends ContextFactoryBuilderSupport<JavaImplementation> { - - /** - * Default constructor - */ - public JavaContextFactoryBuilder() { - super(); - } - - /** - * Constructs a new instance - * - * @param wireFactoryService the system service responsible for creating wire factories - */ - public JavaContextFactoryBuilder(WireFactoryService wireFactoryService) { - super(wireFactoryService); - } - - @SuppressWarnings("unchecked") - protected ContextFactory createContextFactory(String name, JavaImplementation javaImpl, Scope scope) { - Class implClass = null; - JavaContextFactory contextFactory; - try { - implClass = javaImpl.getImplementationClass(); - - contextFactory = new JavaContextFactory(name, JavaIntrospectionHelper - .getDefaultConstructor(implClass), scope); - - List<Injector> injectors = new ArrayList<Injector>(); - List<Object> elements = javaImpl.getComponentType().getExtensibilityElements(); - for (Object element : elements) { - if (element instanceof InitInvokerExtensibilityElement) { - InitInvokerExtensibilityElement invokerElement = (InitInvokerExtensibilityElement) element; - EventInvoker<Object> initInvoker = invokerElement.getEventInvoker(); - boolean eagerInit = invokerElement.isEager(); - contextFactory.setEagerInit(eagerInit); - contextFactory.setInitInvoker(initInvoker); - } else if (element instanceof DestroyInvokerExtensibilityElement) { - DestroyInvokerExtensibilityElement invokerElement = (DestroyInvokerExtensibilityElement) element; - EventInvoker<Object> destroyInvoker = invokerElement.getEventInvoker(); - contextFactory.setDestroyInvoker(destroyInvoker); - } else if (element instanceof ComponentNameExtensibilityElement) { - ComponentNameExtensibilityElement nameElement = (ComponentNameExtensibilityElement) element; - injectors.add(nameElement.getEventInvoker(name)); - } else if (element instanceof ContextExtensibilityElement) { - ContextExtensibilityElement contextElement = (ContextExtensibilityElement) element; - injectors.add(contextElement.getInjector(contextFactory)); - }else if (element instanceof InjectorExtensibilityElement){ - InjectorExtensibilityElement injectorElement = (InjectorExtensibilityElement)element; - injectors.add(injectorElement.getInjector(contextFactory)); - } - } - contextFactory.setSetters(injectors); - return contextFactory; - } catch (BuilderException e) { - e.addContextName(name); - throw e; - } catch (NoSuchMethodException e) { - BuilderConfigException ce = new BuilderConfigException("Class does not have a no-arg constructor", e); - ce.setIdentifier(implClass.getName()); - ce.addContextName(name); - throw ce; - } - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java deleted file mode 100644 index cc66fa54f6..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.builder; - -import org.apache.tuscany.container.java.config.JavaContextFactory; -import org.apache.tuscany.container.java.invocation.ScopedJavaComponentInvoker; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.extension.WireBuilderSupport; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.osoa.sca.annotations.Scope; - -import java.lang.reflect.Method; - -/** - * Completes a wire to a Java-based target component by adding a scoped java invoker to the source chain - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class JavaTargetWireBuilder extends WireBuilderSupport<JavaContextFactory> { - - protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) { - boolean cacheable = !downScope; - return new ScopedJavaComponentInvoker(targetName, operation, context,cacheable); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java deleted file mode 100644 index ff498d851a..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java +++ /dev/null @@ -1,341 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.config; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import commonj.sdo.DataObject; -import org.apache.tuscany.container.java.context.JavaAtomicContext; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.NoAccessorException; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.builder.impl.ArrayMultiplicityObjectFactory; -import org.apache.tuscany.core.builder.impl.ListMultiplicityObjectFactory; -import org.apache.tuscany.core.builder.impl.ProxyObjectFactory; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.injection.EventInvoker; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.injection.PojoObjectFactory; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.databinding.sdo.SDOObjectFactory; -import org.apache.tuscany.model.assembly.Scope; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; - -/** - * A ContextFactory that handles POJO component implementation types - * - * @version $Rev$ $Date$ - */ -public class JavaContextFactory implements ContextFactory<AtomicContext>, ContextResolver { - - // the component name as configured in the hosting module - private String name; - - // the parent context of the component - private CompositeContext parentContext; - - private Map<String, TargetWireFactory> targetProxyFactories = new HashMap<String, TargetWireFactory>(); - - private List<SourceWireFactory> sourceProxyFactories = new ArrayList<SourceWireFactory>(); - - // the implementation type constructor - private Constructor<Object> ctr; - - private Set<Field> fields; - - private Set<Method> methods; - - // injectors for properties, references and other metadata values such as - private List<Injector> setters; - - // an invoker for a method decorated with @Init - private EventInvoker<Object> init; - - // whether the component should be eagerly initialized when its scope starts - private boolean eagerInit; - - // an invoker for a method decorated with @Destroy - private EventInvoker<Object> destroy; - - // the scope of the implementation instance - private Scope scope; - - // whether the component is stateless - private boolean stateless; - - /** - * Creates a new context factory - * - * @param name the SCDL name of the component the context refers to - * @param ctr the implementation type constructor - * @param scope the scope of the component implementation type - */ - public JavaContextFactory(String name, Constructor<Object> ctr, Scope scope) { - assert (name != null) : "Name was null"; - assert (ctr != null) : "Constructor was null"; - this.name = name; - this.ctr = ctr; - this.scope = scope; - stateless = (scope == Scope.INSTANCE); - fields = JavaIntrospectionHelper.getAllFields(ctr.getDeclaringClass()); - methods = JavaIntrospectionHelper.getAllUniqueMethods(ctr.getDeclaringClass()); - } - - public String getName() { - return name; - } - - public Scope getScope() { - return scope; - } - - public AtomicContext createContext() throws ContextCreationException { - PojoObjectFactory<?> objectFactory = new PojoObjectFactory<Object>(ctr, null, setters); - return new JavaAtomicContext(name, objectFactory, eagerInit, init, destroy, stateless); - } - - public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { - targetProxyFactories.put(serviceName, factory); - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - return targetProxyFactories.get(serviceName); - } - - public Map<String, TargetWireFactory> getTargetWireFactories() { - return targetProxyFactories; - } - - public void addProperty(String propertyName, Object value) { - setters.add(createPropertyInjector(propertyName, value)); - } - - public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { - sourceProxyFactories.add(factory); - setters.add(createReferenceInjector(referenceName, factory, false)); - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factories, boolean multiplicity) { - sourceProxyFactories.addAll(factories); - setters.add(createReferenceInjector(referenceName, factories, multiplicity)); - } - - public List<SourceWireFactory> getSourceWireFactories() { - return sourceProxyFactories; - } - - public void setSetters(List<Injector> setters) { - this.setters = setters; - } - - public void setEagerInit(boolean val) { - eagerInit = val; - } - - public void setInitInvoker(EventInvoker<Object> invoker) { - init = invoker; - } - - public void setDestroyInvoker(EventInvoker<Object> invoker) { - destroy = invoker; - } - - public void prepare(CompositeContext parent) { - parentContext = parent; - } - - public CompositeContext getCurrentContext() { - return parentContext; - } - - /** - * Creates an <code>Injector</code> for component properties - */ - private Injector createPropertyInjector(String propertyName, Object value) - throws NoAccessorException { - Class type = value.getClass(); - - // There is no efficient way to do this - Method method = null; - Field field = JavaIntrospectionHelper.findClosestMatchingField(propertyName, type, fields); - if (field == null) { - // hack for TUSCANY-322 - for (Field current : fields) { - Property annot = current.getAnnotation(Property.class); - if (annot != null) { - if (propertyName.equals(annot.name())) { - field = current; - break; - } - } - } - method = JavaIntrospectionHelper.findClosestMatchingMethod(propertyName, new Class[]{type}, methods); - if (method == null) { - // hack for TUSCANY-322 - for (Method current : methods) { - Property annot = current.getAnnotation(Property.class); - if (annot != null) { - if (propertyName.equals(annot.name())) { - method = current; - break; - } - } - } - if (method == null) { - throw new NoAccessorException(propertyName); - } - } - } - Injector injector = null; - if (value instanceof DataObject) { - if (field != null) { - injector = new FieldInjector(field, new SDOObjectFactory((DataObject) value)); - } else { - injector = new MethodInjector(method, new SDOObjectFactory((DataObject) value)); - } - } else if (JavaIntrospectionHelper.isImmutable(type)) { - if (field != null) { - injector = new FieldInjector(field, new SingletonObjectFactory<Object>(value)); - } else { - injector = new MethodInjector(method, new SingletonObjectFactory<Object>(value)); - } - } - return injector; - - } - - /** - * Creates proxy factories that represent target(s) of a reference and an <code>Injector</code> - * responsible for injecting them into the reference - */ - private Injector createReferenceInjector(String refName, List<SourceWireFactory> wireFactories, boolean multiplicity) { - Class refClass = wireFactories.get(0).getBusinessInterface(); //reference.getPort().getServiceContract().getInterface(); - // iterate through the targets - List<ObjectFactory> objectFactories = new ArrayList<ObjectFactory>(); - for (SourceWireFactory wireFactory : wireFactories) { - objectFactories.add(new ProxyObjectFactory(wireFactory)); - } - return createInjector(refName, refClass, multiplicity, objectFactories, fields, methods); - - } - - private Injector createReferenceInjector(String refName, SourceWireFactory wireFactory, boolean multiplicity) { - Class refClass = wireFactory.getBusinessInterface();//reference.getPort().getServiceContract().getInterface(); - List<ObjectFactory> objectFactories = new ArrayList<ObjectFactory>(); - objectFactories.add(new ProxyObjectFactory(wireFactory)); - return createInjector(refName, refClass, multiplicity, objectFactories, fields, methods); - - } - - /** - * Creates an <code>Injector</code> for a set of object factories associated with a reference. - */ - private Injector createInjector(String refName, Class refClass, boolean multiplicity, List<ObjectFactory> objectFactories, - Set<Field> fields, Set<Method> methods) throws NoAccessorException, BuilderConfigException { - Field field; - Method method = null; - if (multiplicity) { - // since this is a multiplicity, we cannot match on business interface type, so scan through the fields, - // matching on name and List or Array - field = JavaIntrospectionHelper.findMultiplicityFieldByName(refName, fields); - if (field == null) { - // No fields found. Again, since this is a multiplicity, we cannot match on business interface type, so - // scan through the fields, matching on name and List or Array - method = JavaIntrospectionHelper.findMultiplicityMethodByName(refName, methods); - if (method == null) { - throw new NoAccessorException(refName); - } - } - Injector injector; - // for multiplicities, we need to inject the reference proxy or proxies using an object factory - // which first delegates to create the proxies and then returns them in the appropriate List or array type - if (field != null) { - if (field.getType().isArray()) { - injector = new FieldInjector(field, new ArrayMultiplicityObjectFactory(refClass, objectFactories)); - } else { - injector = new FieldInjector(field, new ListMultiplicityObjectFactory(objectFactories)); - } - } else { - if (method.getParameterTypes()[0].isArray()) { - injector = new MethodInjector(method, new ArrayMultiplicityObjectFactory(refClass, objectFactories)); - } else { - injector = new MethodInjector(method, new ListMultiplicityObjectFactory(objectFactories)); - } - } - return injector; - } else { - field = JavaIntrospectionHelper.findClosestMatchingField(refName, refClass, fields); - if (field == null) { - // hack for TUSCANY-300 - for (Field current : fields) { - Reference annot = current.getAnnotation(Reference.class); - if (annot != null) { - if (refName.equals(annot.name())) { - field = current; - break; - } - } - } - if (field == null) { - method = JavaIntrospectionHelper.findClosestMatchingMethod(refName, new Class[]{refClass}, methods); - if(method == null){ - // Fix for Tuscany-325 - method = JavaIntrospectionHelper.findClosestMatchingMethod("set"+refName.substring(0,1).toUpperCase()+ refName.substring(1), new Class[]{refClass}, methods); - } - if (method == null) { - // hack for TUSCANY-300 - for (Method current : methods) { - Reference annot = current.getAnnotation(Reference.class); - if (annot != null) { - if (refName.equals(annot.name())) { - method = current; - break; - } - } - } - if (method == null) { - throw new NoAccessorException(refName); - } - } - } - } - Injector injector; - if (field != null) { - injector = new FieldInjector(field, objectFactories.get(0)); - } else { - injector = new MethodInjector(method, objectFactories.get(0)); - } - return injector; - } - } - - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/context/JavaAtomicContext.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/context/JavaAtomicContext.java deleted file mode 100644 index 27581198aa..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/context/JavaAtomicContext.java +++ /dev/null @@ -1,165 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.context; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.ContextInitException; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.context.event.InstanceCreated; -import org.apache.tuscany.core.context.impl.AbstractContext; -import org.apache.tuscany.core.injection.EventInvoker; -import org.apache.tuscany.core.injection.ObjectCallbackException; -import org.apache.tuscany.core.injection.ObjectCreationException; - -/** - * Manages Java component implementation instances - * - * @version $Rev$ $Date$ - */ -public class JavaAtomicContext extends AbstractContext implements AtomicContext { - - private boolean eagerInit; - - private EventInvoker<Object> initInvoker; - - private EventInvoker<Object> destroyInvoker; - - private boolean stateless; - - // the cached target instance - private Object cachedTargetInstance; - - // creates a new implementation instance with injected references and properties - private ObjectFactory objectFactory; - - public JavaAtomicContext(String name, ObjectFactory objectFactory, boolean eagerInit, EventInvoker<Object> initInvoker, - EventInvoker<Object> destroyInvoker, boolean stateless) { - super(name); - assert (objectFactory != null) : "Object factory was null"; - if (eagerInit && initInvoker == null) { - ContextInitException e = new ContextInitException("No intialization method found for implementation"); - e.setIdentifier(getName()); - throw e; - } - this.objectFactory = objectFactory; - - this.eagerInit = eagerInit; - this.initInvoker = initInvoker; - this.destroyInvoker = destroyInvoker; - this.stateless = stateless; - } - - public void setName(String name) { - super.setName(name); - } - - protected int type; - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public void init() throws TargetException { - getInstance(null); - } - - public void destroy() throws TargetException { - if (cachedTargetInstance != null) { - if (destroyInvoker != null) { - try { - destroyInvoker.invokeEvent(cachedTargetInstance); - } catch (ObjectCallbackException e) { - TargetException te = new TargetException(e.getCause()); - te.setIdentifier(getName()); - throw te; - } - } - } - lifecycleState = STARTED; - } - - public synchronized Object getInstance(QualifiedName qName) throws TargetException { - //TODO implement returning of proxy and wire chain for service - if (cachedTargetInstance != null) { - return cachedTargetInstance; // already cached, just return - } - - if (getLifecycleState() == ERROR || getLifecycleState() == CONFIG_ERROR) { - return null; - } - synchronized (this) { - try { - Object instance = objectFactory.getInstance(); - // handle @Init - if (initInvoker != null) { - initInvoker.invokeEvent(instance); - } - publish(new InstanceCreated(this)); - lifecycleState = RUNNING; - if (stateless) { - return instance; - } else { - cachedTargetInstance = instance; // cache the instance - return cachedTargetInstance; - } - } catch (ObjectCreationException e) { - lifecycleState = ERROR; - TargetException te = new TargetException("Error creating component instance", e); - te.setIdentifier(getName()); - throw te; - } - } - - } - - public Object getTargetInstance() throws TargetException { - //TODO refactor when getInstance() returns a proxy - return getInstance(null); - } - - public boolean isEagerInit() { - return eagerInit; - } - - public boolean isDestroyable() { - return (destroyInvoker != null); - } - - public void start() throws ContextInitException { - if (getLifecycleState() != UNINITIALIZED && getLifecycleState() != STOPPED) { - throw new IllegalStateException("Context must be in UNINITIALIZED state [" + getLifecycleState() + "]"); - } - if (objectFactory == null) { - lifecycleState = ERROR; - ContextInitException e = new ContextInitException("Object factory not found"); - e.setIdentifier(getName()); - throw e; - } - lifecycleState = INITIALIZED; - } - - public void stop() { - lifecycleState = STOPPED; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/AbstractJavaComponentInvoker.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/AbstractJavaComponentInvoker.java deleted file mode 100644 index 33fa9238b6..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/AbstractJavaComponentInvoker.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.invocation; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Set; - -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.InvocationRuntimeException; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.apache.tuscany.core.message.Message; - -/** - * Base class for dispatching to a Java based component implementation. Subclasses implement a strategy for resolving - * implementation instances. - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractJavaComponentInvoker implements TargetInvoker { - - protected Method operation; - - public AbstractJavaComponentInvoker(Method operation) { - assert (operation != null) : "Operation method cannot be null"; - this.operation = operation; - } - - public Object invokeTarget(Object payload) throws InvocationTargetException { - try { - Object instance = getInstance(); - if (!operation.getDeclaringClass().isInstance(instance)) { - Set<Method> methods = JavaIntrospectionHelper.getAllUniqueMethods(instance.getClass()); - Method newOperation = JavaIntrospectionHelper.findClosestMatchingMethod(operation.getName(), operation - .getParameterTypes(), methods); - if (newOperation != null) - operation = newOperation; - } - if (payload != null && !payload.getClass().isArray()) { - return operation.invoke(instance, payload); - } else { - return operation.invoke(instance, (Object[]) payload); - } - } catch (IllegalAccessException e) { - throw new InvocationRuntimeException(e); - } - } - - 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; - } - - protected abstract Object getInstance() throws TargetException; - - public void setNext(Interceptor next) { - throw new IllegalStateException("This interceptor must be the last interceptor in an interceptor chain"); - } - - @Override - public Object clone() throws CloneNotSupportedException { - try { - AbstractJavaComponentInvoker clone = (AbstractJavaComponentInvoker) super.clone(); - clone.operation = this.operation; - return clone; - } catch (CloneNotSupportedException e) { - return null; // will not happen - } - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/ScopedJavaComponentInvoker.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/ScopedJavaComponentInvoker.java deleted file mode 100644 index 85d72b4b0d..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/ScopedJavaComponentInvoker.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.invocation; - -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.TargetException; - -import java.lang.reflect.Method; - -/** - * Uses a scope container to resolve an implementation instance based on the current thread context - * - * @version $Rev$ $Date$ - */ -public class ScopedJavaComponentInvoker extends AbstractJavaComponentInvoker { - - private ScopeContext container; - - private QualifiedName name; - - private Object target; - - public boolean cacheable; - - - /** - * Creates a new invoker - * - * @param serviceName the name of the component/service pair to invoke - * @param operation the operation the invoker is associated with - * @param scopeContext the scope context the component is resolved in - * @param cacheable Sets whether the target service instance may be cached by the invoker. This is a possible optimization - * when a wire is configured for a "down-scope" reference, i.e. a reference from a source of a shorter - * lifetime to a source of greater lifetime. - */ - public ScopedJavaComponentInvoker(QualifiedName serviceName, Method operation, ScopeContext scopeContext, boolean cacheable) { - super(operation); - assert (serviceName != null) : "No service name specified"; - assert (scopeContext != null) : "No scope scopeContext specified"; - name = serviceName; - this.container = scopeContext; - this.cacheable = cacheable; - } - - /** - * Returns whether the target is cacheable. - */ - public boolean isCacheable() { - return cacheable; - } - - /** - * Resolves the target service instance or returns a cached one - */ - protected Object getInstance() throws TargetException { - if (!cacheable) { - return container.getInstance(name); - } else { - if (target == null) { - target = container.getInstance(name); - } - return target; - } - } - - public Object clone() throws CloneNotSupportedException { - ScopedJavaComponentInvoker invoker = (ScopedJavaComponentInvoker) super.clone(); - invoker.target = null; - invoker.cacheable = this.cacheable; - invoker.container = this.container; - invoker.name = this.name; - return invoker; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/StaticJavaComponentTargetInvoker.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/StaticJavaComponentTargetInvoker.java deleted file mode 100644 index dd757137cf..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/StaticJavaComponentTargetInvoker.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.invocation; - -import java.lang.reflect.Method; - -/** - * Caches component instances that do not need to be resolved for every wire, e.g. an wire originating from - * a lesser scope intended for a target with a wider scope - * - * @version $Rev$ $Date$ - */ -public class StaticJavaComponentTargetInvoker extends AbstractJavaComponentInvoker { - - private Object instance; - - public StaticJavaComponentTargetInvoker(Method operation, Object instance) { - super(operation); - assert (instance != null) : "Instance cannot be null"; - this.instance = instance; - } - - protected Object getInstance() { - return instance; - } - - public boolean isCacheable() { - return true; - } - - public Object clone() throws CloneNotSupportedException { - StaticJavaComponentTargetInvoker invoker = (StaticJavaComponentTargetInvoker) super.clone(); - invoker.instance = null; - return invoker; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/loader/JavaImplementationLoader.java b/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/loader/JavaImplementationLoader.java deleted file mode 100644 index db3dd07c98..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/loader/JavaImplementationLoader.java +++ /dev/null @@ -1,165 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.loader; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; -import org.apache.tuscany.container.java.assembly.JavaImplementation; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.InvalidRootElementException; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.config.SidefileLoadException; -import org.apache.tuscany.core.config.processor.ProcessorUtils; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.loader.StAXElementLoader; -import org.apache.tuscany.core.loader.StAXLoaderRegistry; -import org.apache.tuscany.core.loader.assembly.AssemblyConstants; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.model.assembly.ComponentType; -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class JavaImplementationLoader implements StAXElementLoader<JavaImplementation> { - public static final QName IMPLEMENTATION_JAVA = new QName("http://www.osoa.org/xmlns/sca/0.9", "implementation.java"); - - private StAXLoaderRegistry registry; - private XMLInputFactory xmlFactory; - - private JavaAssemblyFactory factory; - private ComponentTypeIntrospector introspector; - - public JavaImplementationLoader() { - // todo make this a reference to a system service - xmlFactory = XMLInputFactory.newInstance(); - } - - @Autowire - public void setRegistry(StAXLoaderRegistry registry) { - this.registry = registry; - } - - @Autowire - public void setFactory(JavaAssemblyFactory factory) { - this.factory = factory; - //FIXME JFM HACK - introspector = ProcessorUtils.createCoreIntrospector(factory); - } - - @Init(eager = true) - public void start() { - registry.registerLoader(IMPLEMENTATION_JAVA, this); - } - - @Destroy - public void stop() { - registry.unregisterLoader(IMPLEMENTATION_JAVA, this); - } - - public JavaImplementation load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - JavaImplementation javaImpl = factory.createJavaImplementation(); - String typeName = reader.getAttributeValue(null, "class"); - Class<?> implementationClass = getImplementationClass(loaderContext.getResourceLoader(), typeName); - javaImpl.setImplementationClass(implementationClass); - javaImpl.setComponentType(loadComponentType(loaderContext, implementationClass)); - return javaImpl; - } - - protected Class<?> getImplementationClass(ResourceLoader resourceLoader, String typeName) throws ConfigurationLoadException { - ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); - try { - // set TCCL in case the application code needs it - Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader()); - return resourceLoader.loadClass(typeName); - } catch (ClassNotFoundException e) { - throw new ConfigurationLoadException(e.getMessage(), e); - } finally { - Thread.currentThread().setContextClassLoader(oldCL); - } - } - - protected ComponentType loadComponentType(LoaderContext loaderContext, Class<?> implClass) throws ConfigurationLoadException, XMLStreamException { - String baseName = JavaIntrospectionHelper.getBaseName(implClass); - URL sidefile = implClass.getResource(baseName + ".componentType"); - if (sidefile == null) { - return loadComponentTypeByIntrospection(implClass); - } else { - return loadComponentTypeFromSidefile(sidefile, loaderContext); - } - } - - protected ComponentType loadComponentTypeByIntrospection(Class<?> implClass) throws ConfigurationLoadException { - return introspector.introspect(implClass); - } - - protected ComponentType loadComponentTypeFromSidefile(URL sidefile, LoaderContext loaderContext) throws SidefileLoadException { - try { - XMLStreamReader reader; - InputStream is; - is = sidefile.openStream(); - try { - reader = xmlFactory.createXMLStreamReader(is); - try { - reader.nextTag(); - if (!AssemblyConstants.COMPONENT_TYPE.equals(reader.getName())) { - InvalidRootElementException e = new InvalidRootElementException(AssemblyConstants.COMPONENT_TYPE, reader.getName()); - e.setResourceURI(sidefile.toString()); - throw e; - } - return (ComponentType) registry.load(reader, loaderContext); - } finally { - try { - reader.close(); - } catch (XMLStreamException e) { - // ignore - } - } - } finally { - try { - is.close(); - } catch (IOException e) { - // ignore - } - } - } catch (IOException e) { - SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); - sfe.setResourceURI(sidefile.toString()); - throw sfe; - } catch (XMLStreamException e) { - SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); - sfe.setResourceURI(sidefile.toString()); - throw sfe; - } catch (ConfigurationLoadException e) { - SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); - sfe.setResourceURI(sidefile.toString()); - throw sfe; - } - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/containers/container.java/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/containers/container.java/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/containers/container.java/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/resources/org/apache/tuscany/container/java/Messages.properties b/branches/java-M1/java/sca/containers/container.java/src/main/resources/org/apache/tuscany/container/java/Messages.properties deleted file mode 100644 index 4581e44bff..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/resources/org/apache/tuscany/container/java/Messages.properties +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. -# -# Licensed 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. -# ==================================================================== -# To code developer: -# Do NOT change the properties between this line and the -# "%%% END OF TRANSLATED PROPERTIES %%%" line. -# Make a new property name, append to the end of the file and change -# the code to use the new property. -# ==================================================================== - -# ===================================================================== -# %%% END OF TRANSLATED PROPERTIES %%% -# ===================================================================== -# NLS_MESSAGEFORMAT_ALL diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/resources/system.fragment b/branches/java-M1/java/sca/containers/container.java/src/main/resources/system.fragment deleted file mode 100644 index 6aab9b8510..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/resources/system.fragment +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:tuscany="http://org.apache.tuscany/xmlns/system/0.9"
- name="org.apache.tuscany.container.java">
-
- <component name="org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder">
- <tuscany:implementation.system class="org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder"/>
- </component>
- <component name="org.apache.tuscany.core.config.ComponentTypeIntrospector">
- <tuscany:implementation.system class="org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector"/>
- </component>
-
-
- <component name="org.apache.tuscany.container.java.builder.JavaTargetWireBuilder">
- <tuscany:implementation.system class="org.apache.tuscany.container.java.builder.JavaTargetWireBuilder"/>
- </component>
-
- <component name="org.apache.tuscany.container.java.assembly.JavaAssemblyFactory">
- <tuscany:implementation.system class="org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl"/>
- </component>
-
- <component name="org.apache.tuscany.container.java.loader.JavaImplementationLoader">
- <tuscany:implementation.system class="org.apache.tuscany.container.java.loader.JavaImplementationLoader"/>
- </component>
-
-</moduleFragment>
diff --git a/branches/java-M1/java/sca/containers/container.java/src/main/test/sca.module b/branches/java-M1/java/sca/containers/container.java/src/main/test/sca.module deleted file mode 100644 index 1c1ddafb53..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/main/test/sca.module +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
-
- name="sample.myvaluemodule">
- <!--
- <entryPoint name="MyValueService">
- <interface.java interface="services.myvalue.MyValueService"/>
- <binding.ws port="http://webservice.myvalue#wsdl.endpoint(MyValueService/MyValueWebService)"/>
- <reference>MyValueServiceComponent</reference>
- </entryPoint>
-
- <component name="MyValueServiceComponent">
- <implementation.java class="services.myvalue.MyValueServiceImpl"/>
- <properties>
- <v:currency>EURO</v:currency>
- </properties>
- <references>
- <v:customerService>CustomerServiceComponent</v:customerService>
- <v:stockQuoteService>StockQuoteMediatorComponent</v:stockQuoteService>
- </references>
- </component>
-
- <component name="StockQuoteMediatorComponent">
- <implementation.java class="services.mediator.StockQuoteMediatorImpl"/>
- <references>
- <v:stockQuoteService>StockQuoteService</v:stockQuoteService>
- </references>
- </component>
-
- <component name="CustomerServiceComponent">
- <implementation.java class="services.customer.CustomerServiceImpl"/>
- </component>
-
- <component name="StockQuoteService">
- <implementation.java class="services.stockquote.StockQuoteServiceImpl"/>
- </component>
- -->
- <component name="TestService">
- <implementation.java class="test.org.apache.tuscany.container.java.components.ModuleScopeComponentImpl"/>
- <properties>
- <v:foo>MyFoo</v:foo>
- <v:mInt>1</v:mInt>
- </properties>
- <references>
- <v:mGenericComponent>TestService2</v:mGenericComponent>
- </references>
- </component>
- <component name="TestService2">
- <implementation.java class="test.org.apache.tuscany.container.java.components.ModuleScopeComponentImpl"/>
- </component>
-
- <!--
- <externalService name="StockQuoteService">
- <interface.java interface="services.stockquote.StockQuoteService"/>
- <binding.ws port="http://webservice.stockquote#wsdl.endpoint(StockQuoteService/StockQuoteWebService)"/>
- </externalService>
- -->
-
-</module>
-
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.componentType b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.componentType deleted file mode 100644 index 784d8bf728..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.componentType +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" - xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <service name="HelloWorldService">
- <interface.java interface="org.apache.tuscany.container.java.assembly.mock.HelloWorldService" remoteable="true"/>
- </service>
- <property name="text" type="xsd:string"/>
-</componentType>
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.java deleted file mode 100644 index 74f4c658ce..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.mock; - -/** - * @version $Rev$ $Date$ - */ -public class HelloWorldImpl implements HelloWorldService { - - private String text; - - private int count; - - public String hello(String name) { - ++count; - return "Hello " + name; - } - - public int count() { - return count; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldService.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldService.java deleted file mode 100644 index a7d0fe7788..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldService.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.mock; - -/** - * @version $Rev$ $Date$ - */ -public interface HelloWorldService { - String hello(String name); - - public int count(); - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldWithFieldProperties.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldWithFieldProperties.java deleted file mode 100644 index 0801c56f44..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldWithFieldProperties.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.mock; - -import org.osoa.sca.annotations.Property; - -/** - * @version $Rev$ $Date$ - */ -public class HelloWorldWithFieldProperties { - @Property - protected String text; - - @Property(required = true) - public Integer text2; - - @Property(name = "foo") - public int text3; - - @Property(name = "not exposed") - protected int field4; - - public String hello(String name) { - return "Hello " + name; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorld.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorld.java deleted file mode 100644 index 2f1ae5d17b..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorld.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.mock; - -/** - * @version $Rev$ $Date$ - */ -public class NakedHelloWorld { - public String hello(String name) { - return "Hello " + name; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorldWithInterface.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorldWithInterface.java deleted file mode 100644 index 9d5fe5e969..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorldWithInterface.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.mock; - -import java.io.Serializable; - -/** - * @version $Rev$ $Date$ - */ -public class NakedHelloWorldWithInterface implements Serializable { - public String hello(String name) { - return "Hello " + name; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountReport.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountReport.java deleted file mode 100644 index 1770c2b011..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountReport.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.account; - -import java.util.List; - -/** - * @model - */ - -public interface AccountReport { - - /** - * @model type="services.account.AccountSummary" - */ - - List getAccountSummaries(); -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.java deleted file mode 100644 index 1bb938655f..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.account; - -import org.osoa.sca.annotations.Remotable; - -@Remotable -public interface AccountService { - - public AccountReport getAccountReport(String customerID); -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.wsdl b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.wsdl deleted file mode 100644 index 022258f2c5..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.wsdl +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.bigbank.com/AccountService/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.bigbank.com/AccountService/"
-
- name="AccountService">
-
- <wsdl:types>
- <xsd:schema targetNamespace="http://www.bigbank.com/AccountService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <xsd:element name="customerID" type="xsd:string"/>
- <xsd:element name="getAccountReportResponse" type="tns:AccountReport"/>
-
- <xsd:complexType name="AccountReport">
- <xsd:sequence>
- <xsd:element name="accountSummary" type="tns:AccountSummary" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="AccountSummary">
- <xsd:sequence>
- <xsd:element name="accountNumber" type="xsd:string"/>
- <xsd:element name="accountType" type="xsd:string"/>
- <xsd:element name="balance" type="xsd:float"/>
- </xsd:sequence>
- </xsd:complexType>
-
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="getAccountReportRequest">
- <wsdl:part element="tns:customerID" name="getAccountReportRequest"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportResponse">
- <wsdl:part element="tns:getAccountReportResponse" name="getAccountReportResponse"/>
- </wsdl:message>
- <wsdl:portType name="AccountService">
- <wsdl:operation name="getAccountReport">
- <wsdl:input message="tns:getAccountReportRequest"/>
- <wsdl:output message="tns:getAccountReportResponse"/>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="AccountServiceSOAP" type="tns:AccountService">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getAccountReport">
- <soap:operation
- soapAction="http://www.bigbank.com/AccountService/getAccountReport"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="AccountService">
- <wsdl:port binding="tns:AccountServiceSOAP"
- name="AccountServiceSOAP">
- <soap:address location="http://localhost:8080/tuscany-container-java/services/AccountService"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java deleted file mode 100644 index 9a5ddb0005..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.account; - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata.AccountDataService; -import org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.stockquote.StockQuoteService; - -public class AccountServiceImpl implements AccountService { - - @Property - public String currency = "USD"; - - @Reference - public AccountDataService accountDataService; - @Reference - public StockQuoteService stockQuoteService; - - public AccountServiceImpl() { - } - - public AccountReport getAccountReport(String customerID) { - return null; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountSummary.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountSummary.java deleted file mode 100644 index 2b11e23425..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountSummary.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.account; - -/** - * @model - */ - -public interface AccountSummary { - - /** - * @model - */ - String getAccountNumber(); - - void setAccountNumber(String accountNumber); - - /** - * @model - */ - String getAccountType(); - - void setAccountType(String accountType); - - /** - * @model - */ - float getBalance(); - - void setBalance(float balance); -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java deleted file mode 100644 index 56f24ea4ac..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata; - -public interface AccountDataService { - - CheckingAccount getCheckingAccount(String customerID); - - SavingsAccount getSavingsAccount(String customerID); - - StockAccount getStockAccount(String customerID); -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java deleted file mode 100644 index a7a40f954d..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata; - -public class AccountDataServiceImpl implements AccountDataService { - - public CheckingAccount getCheckingAccount(String customerID) { - - CheckingAccount checkingAccount = new CheckingAccount(); - checkingAccount.setAccountNumber(customerID + "_" + "CHA12345"); - checkingAccount.setBalance(1500.0f); - - return checkingAccount; - } - - public SavingsAccount getSavingsAccount(String customerID) { - - SavingsAccount savingsAccount = new SavingsAccount(); - savingsAccount.setAccountNumber(customerID + "_" + "SAA12345"); - savingsAccount.setBalance(1500.0f); - - return savingsAccount; - } - - public StockAccount getStockAccount(String customerID) { - - StockAccount stockAccount = new StockAccount(); - stockAccount.setAccountNumber(customerID + "_" + "STA12345"); - stockAccount.setSymbol("IBM"); - stockAccount.setQuantity(100); - - return stockAccount; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java deleted file mode 100644 index ff84e9968a..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata; - -public class CheckingAccount { - - private String accountNumber; - private float balance; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - public float getBalance() { - return balance; - } - - public void setBalance(float balance) { - this.balance = balance; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java deleted file mode 100644 index b39d9051de..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata; - -public class SavingsAccount { - - private String accountNumber; - private float balance; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - public float getBalance() { - return balance; - } - - public void setBalance(float balance) { - this.balance = balance; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/StockAccount.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/StockAccount.java deleted file mode 100644 index bce0821b25..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/StockAccount.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata; - -public class StockAccount { - - private String accountNumber; - private String symbol; - private int quantity; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - public int getQuantity() { - return quantity; - } - - public void setQuantity(int quantity) { - this.quantity = quantity; - } - - public String getSymbol() { - return symbol; - } - - public void setSymbol(String symbol) { - this.symbol = symbol; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java deleted file mode 100644 index 78ece12b41..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.stockquote; - -public interface StockQuoteService { - - public float getQuote(String symbol); -} - -
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java deleted file mode 100644 index fa180d0ceb..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.stockquote; - -/* Dummy'd up StockQuoteService, override webservice for now */ - -public class StockQuoteServiceImpl implements StockQuoteService { - - public float getQuote(String symbol) { - // Just hardcode for now - return 83.00f; - } - -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl deleted file mode 100644 index 6af61ef80e..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl +++ /dev/null @@ -1,98 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions targetNamespace="http://webservice.stockquote" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice.stockquote" xmlns:intf="http://webservice.stockquote" xmlns:tns1="http://stockquote" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="stockquote">
- <!--WSDL created by Apache Axis version: 1.2.1
-Built on Jun 14, 2005 (09:15:57 EDT)-->
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
- <complexType name="GetQuoteRequest">
- <sequence>
- <element name="symbol" nillable="true" type="xsd:string"/>
- </sequence>
- </complexType>
- <complexType name="GetQuoteResponse">
- <sequence>
- <element name="price" type="xsd:float"/>
- </sequence>
- </complexType>
- </schema>
- <schema elementFormDefault="qualified" targetNamespace="http://webservice.stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
- <import namespace="http://stockquote"/>
- <element name="request" type="tns1:GetQuoteRequest"/>
- <element name="getQuoteReturn" type="tns1:GetQuoteResponse"/>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getQuoteResponse">
-
- <wsdl:part element="impl:getQuoteReturn" name="getQuoteReturn"/>
-
- </wsdl:message>
-
- <wsdl:message name="getQuoteRequest">
-
- <wsdl:part element="impl:request" name="request"/>
-
- </wsdl:message>
-
- <wsdl:portType name="StockQuoteWebService">
-
- <wsdl:operation name="getQuote" parameterOrder="request">
-
- <wsdl:input message="impl:getQuoteRequest" name="getQuoteRequest"/>
-
- <wsdl:output message="impl:getQuoteResponse" name="getQuoteResponse"/>
-
- </wsdl:operation>
-
- </wsdl:portType>
-
- <wsdl:binding name="StockQuoteWebServiceSoapBinding" type="impl:StockQuoteWebService">
-
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <wsdl:operation name="getQuote">
-
- <wsdlsoap:operation soapAction=""/>
-
- <wsdl:input name="getQuoteRequest">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:input>
-
- <wsdl:output name="getQuoteResponse">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:output>
-
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:service name="StockQuoteWebServiceService">
-
- <wsdl:port binding="impl:StockQuoteWebServiceSoapBinding" name="StockQuoteWebService">
-
- <wsdlsoap:address location="http://localhost:8123/StockQuoteWebService/services/StockQuoteWebService"/>
-
- </wsdl:port>
-
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilderTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilderTestCase.java deleted file mode 100644 index fcfd320e0e..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilderTestCase.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.builder; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.GenericComponent; -import org.apache.tuscany.container.java.mock.components.ModuleScopeComponent; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; -import org.apache.tuscany.core.context.scope.ModuleScopeContext; -import org.apache.tuscany.core.context.ScopeStrategy; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.wire.WireConfiguration; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.Module; - -public class JavaContextFactoryBuilderTestCase extends TestCase { - - public JavaContextFactoryBuilderTestCase() { - } - - public void testBuilder() throws Exception { - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, true); - PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); - policyRegistry.registerSourceBuilder(interceptorBuilder); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); - JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); - - JavaTargetWireBuilder javaWireBuilder = new JavaTargetWireBuilder(); - ScopeStrategy strategy = new DefaultScopeStrategy(); - DefaultWireBuilder wireBuilder = new DefaultWireBuilder(); - wireBuilder.addWireBuilder(javaWireBuilder); - Module module = MockFactory.createModule(); - EventContext eCtx = new EventContextImpl(); - ScopeContext scopeContext = new ModuleScopeContext(eCtx); - scopeContext.start(); - scopeContext.onEvent(new ModuleStart(this)); - List<Component> components = module.getComponents(); - Map<String, Component> compMap = new HashMap<String, Component>(components.size()); - - for (Component component : components) { - compMap.put(component.getName(), component); - builder.build(component); - ContextFactory contextFactory = (ContextFactory) component.getContextFactory(); - Assert.assertNotNull(contextFactory); - } - for (Component component : components) { - ContextFactory<Context> source = (ContextFactory<Context>) component.getContextFactory(); - Assert.assertNotNull(source); - for (SourceWireFactory pFactory : source.getSourceWireFactories()) { - WireConfiguration pConfig = pFactory.getConfiguration(); - Component target = compMap.get(pConfig.getTargetName().getPartName()); - - if (target != null) { - ContextFactory targetConfig = (ContextFactory) target.getContextFactory(); - boolean downScope = strategy.downScopeReference(source.getScope(), targetConfig.getScope()); - wireBuilder.connect(pFactory, targetConfig.getTargetWireFactory(pFactory.getConfiguration().getTargetName() - .getPortName()), targetConfig.getClass(), downScope, scopeContext); - } - pFactory.initialize(); - } - scopeContext.registerFactory(source); - } - for (Component component : components) { - ContextFactory config = (ContextFactory) component.getContextFactory(); - Context context = config.createContext(); - if ("source".equals(component.getName())) { - ModuleScopeComponent source = (ModuleScopeComponent) context.getInstance(null); - Assert.assertNotNull(source); - GenericComponent gComp = source.getGenericComponent(); - gComp.getString(); - } - } - } - - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilderTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilderTestCase.java deleted file mode 100644 index 5a0ee8e14c..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilderTestCase.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.builder; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.config.JavaContextFactory; -import org.apache.tuscany.container.java.invocation.mock.MockHandler; -import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; -import org.apache.tuscany.container.java.invocation.mock.SimpleTarget; -import org.apache.tuscany.container.java.invocation.mock.SimpleTargetImpl; -import org.apache.tuscany.container.java.mock.MockScopeContext; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.wire.MethodHashMap; -import org.apache.tuscany.core.wire.impl.InvokerInterceptor; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; - -public class JavaTargetWireBuilderTestCase extends TestCase { - - private Method hello; - - public JavaTargetWireBuilderTestCase() { - } - - public JavaTargetWireBuilderTestCase(String arg0) { - super(arg0); - } - - public void setUp() throws Exception { - hello = SimpleTarget.class.getMethod("hello", String.class); - } - - - /** - * Tests basic wiring of a source to a target, including handlers and interceptors - */ - public void testInvocation() throws Exception { - MessageFactory msgFactory = new MessageFactoryImpl(); - - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockHandler sourceRequestHandler = new MockHandler(); - MockHandler sourceResponseHandler = new MockHandler(); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addRequestHandler(sourceRequestHandler); - source.addResponseHandler(sourceResponseHandler); - source.addInterceptor(sourceInterceptor); - - SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); - Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>(); - sourceInvocationConfigs.put(hello, source); - WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), - sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - sourceFactory.setConfiguration(sourceConfig); - sourceFactory.setBusinessInterface(SimpleTarget.class); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockHandler targetRequestHandler = new MockHandler(); - MockHandler targetResponseHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addResponseHandler(targetResponseHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - TargetWireFactory targetFactory = new JDKWireFactoryFactory().createTargetWireFactory(); - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>(); - targetInvocationConfigs.put(hello, target); - WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), - targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - targetFactory.setConfiguration(targetConfig); - targetFactory.setBusinessInterface(SimpleTarget.class); - - // bootstrap a scope container with the target in it - Map<String,Object> instances = new HashMap<String,Object>(); - SimpleTarget simpleTarget = new SimpleTargetImpl(); - instances.put("target",simpleTarget); - MockScopeContext scopeCtx = new MockScopeContext(instances); - - // connect the source to the target - DefaultWireBuilder builder = new DefaultWireBuilder(); - builder.addWireBuilder(new JavaTargetWireBuilder()); - - builder.connect(sourceFactory, targetFactory, JavaContextFactory.class, true, scopeCtx); - source.build(); - target.build(); - Assert.assertNotNull(source.getTargetInvoker()); - - Message msg = msgFactory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(source.getTargetInvoker()); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - Assert.assertEquals(1, sourceRequestHandler.getCount()); - Assert.assertEquals(1, sourceResponseHandler.getCount()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetRequestHandler.getCount()); - Assert.assertEquals(1, targetResponseHandler.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockHandlerBuilder.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockHandlerBuilder.java deleted file mode 100644 index bd1c13c4ac..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockHandlerBuilder.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.builder; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.SourcePolicyBuilder; -import org.apache.tuscany.core.builder.TargetPolicyBuilder; -import org.apache.tuscany.core.wire.InvocationConfiguration; -import org.apache.tuscany.core.wire.MessageHandler; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; - -import java.util.List; - -/** - * Adds a handler to a source or target proxy configuration - * - * @version $Rev$ $Date$ - */ -public class MockHandlerBuilder implements SourcePolicyBuilder, TargetPolicyBuilder { - - - private MessageHandler handler; - - private boolean source; - - private boolean request; - - /** - * Creates the builder. - * - * @param handler the handler to add to the source or target proxy configuration - * @param source true if the handler should be added on the source side; false if the handler should be added to the target - * side - * @param request true if the handler is a request handler; false if the handler is a response handler - */ - public MockHandlerBuilder(MessageHandler handler, boolean source, boolean request) { - this.handler = handler; - this.source = source; - this.request = request; - } - - public void build(AssemblyObject modelObject) throws BuilderException { - if (source) { - if (!(modelObject instanceof ConfiguredReference)) { - return; - } else { - ConfiguredReference cref = (ConfiguredReference) modelObject; - // /xcv WireFactory pFactory = (WireFactory) cref.getProxyFactory(); - for (ConfiguredService configuredService : cref.getTargetConfiguredServices()) { - SourceWireFactory pFactory = (SourceWireFactory) configuredService.getProxyFactory(); - for (InvocationConfiguration config : pFactory.getConfiguration().getInvocationConfigurations().values()) { - if (request) { - config.addRequestHandler(handler); - } else { - config.addResponseHandler(handler); - } - } - } - } - } else { - if (!(modelObject instanceof ConfiguredService)) { - return; - } else { - ConfiguredService cservice = (ConfiguredService) modelObject; - TargetWireFactory pFactory = (TargetWireFactory) cservice.getProxyFactory(); - for (InvocationConfiguration config : pFactory.getConfiguration().getInvocationConfigurations().values()) { - if (request) { - config.addRequestHandler(handler); - } else { - config.addResponseHandler(handler); - } - } - } - - } - } - - public void build(ConfiguredReference reference, List<WireSourceConfiguration> configurations) throws BuilderException { - for (WireSourceConfiguration wireSourceConfiguration : configurations) { - for (SourceInvocationConfiguration configuration : wireSourceConfiguration.getInvocationConfigurations().values()) { - if (request) { - configuration.addRequestHandler(handler); - } else { - configuration.addResponseHandler(handler); - } - - } - - } - } - - public void build(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException { - for (TargetInvocationConfiguration config : configuration.getInvocationConfigurations().values()) { - if (request) { - config.addRequestHandler(handler); - } else { - config.addResponseHandler(handler); - } - } - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockInterceptorBuilder.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockInterceptorBuilder.java deleted file mode 100644 index d3ad8a53b5..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockInterceptorBuilder.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.builder; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.SourcePolicyBuilder; -import org.apache.tuscany.core.builder.TargetPolicyBuilder; -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.WireFactory; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; - -import java.util.List; - -/** - * Adds an interceptor to a source or target proxy configuration - * - * @version $Rev$ $Date$ - */ -public class MockInterceptorBuilder implements SourcePolicyBuilder, TargetPolicyBuilder { - - private Interceptor interceptor; - - /** - * Creates the builder - * - * @param interceptor the interceptor ot add - * @param source true if the interceptor should be added to the source side; false if the interceptor should be added to - * the target side - */ - public MockInterceptorBuilder(Interceptor interceptor, boolean source) { - this.interceptor = interceptor; - } - - public void build(ConfiguredReference reference, List<WireSourceConfiguration> configurations) throws BuilderException { - for (WireSourceConfiguration wireSourceConfiguration : configurations) { - for (SourceInvocationConfiguration configuration : wireSourceConfiguration.getInvocationConfigurations().values()) { - configuration.addInterceptor(interceptor); - } - } - } - - public void build(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException { - for (TargetInvocationConfiguration config : configuration.getInvocationConfigurations().values()) { - config.addInterceptor(interceptor); - } - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/DifferentInterfaceWireTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/DifferentInterfaceWireTestCase.java deleted file mode 100644 index ed91b9cb9b..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/DifferentInterfaceWireTestCase.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.context; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.builder.JavaTargetWireBuilder; -import org.apache.tuscany.container.java.mock.MockConfigContext; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.OtherTarget; -import org.apache.tuscany.container.java.mock.components.Source; -import org.apache.tuscany.container.java.mock.components.Target; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Tests wires that have different interfaces on the source and target side - * - * @version $Rev$ $Date$ - */ -public class DifferentInterfaceWireTestCase extends TestCase { - - public void testMultiplicity() throws Exception { - - CompositeContext context = createContext(); - context.start(); - context.registerModelObject(MockFactory.createModuleWithWiredComponentsOfDifferentInterface(Scope.MODULE, Scope.MODULE)); - context.publish(new ModuleStart(this)); - Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); - Assert.assertNotNull(source); - OtherTarget target = (OtherTarget) ((AtomicContext)context.getContext("target")).getTargetInstance(); - Assert.assertNotNull(target); - // test setter injection - List<Target> targets = source.getTargets(); - Assert.assertEquals(1, targets.size()); - - // test field injection - targets = source.getTargetsThroughField(); - Assert.assertEquals(1, targets.size()); - targets.get(0).setString("foo"); - Assert.assertEquals("foo",target.getString()); - } - - private CompositeContext createContext() { - CompositeContextImpl context = new CompositeContextImpl(); - context.setName("system.context"); - List<ContextFactoryBuilder>builders = MockFactory.createSystemBuilders(); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); - builders.add(new JavaContextFactoryBuilder(wireService)); - List<WireBuilder> wireBuilders = new ArrayList<WireBuilder>(); - wireBuilders.add(new JavaTargetWireBuilder()); - context.setConfigurationContext(new MockConfigContext(builders,wireBuilders)); - return context; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextLifecycleTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextLifecycleTestCase.java deleted file mode 100644 index c257a1f892..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextLifecycleTestCase.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.context; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.ModuleScopeInitOnlyComponent; -import org.apache.tuscany.container.java.mock.components.ModuleScopeInitDestroyComponent; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Tests init and destroy lifecycle callbacks are handled properly - * - * @version $Rev$ $Date$ - */ -public class JavaAtomicContextLifecycleTestCase extends TestCase { - - public void testComponentNameSet() throws Exception { - CompositeContext mc = new CompositeContextImpl(); - mc.setName("mc"); - JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit", - ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc); - context.start(); - ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null); - Assert.assertNotNull(instance); - Assert.assertEquals("TestServiceInit", instance.getName()); - context.stop(); - } - - public void testModuleContextSet() throws Exception { - CompositeContext mc = new CompositeContextImpl(); - mc.setName("mc"); - JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit", - ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc); - context.start(); - ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null); - Assert.assertNotNull(instance); - Assert.assertEquals(mc, instance.getModuleContext()); - context.stop(); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextMetadataInjectionTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextMetadataInjectionTestCase.java deleted file mode 100644 index a79a04f5ab..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextMetadataInjectionTestCase.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.context; - -import junit.framework.TestCase; -import junit.framework.Assert; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.ModuleScopeInitOnlyComponent; -import org.apache.tuscany.container.java.mock.components.ModuleScopeInitDestroyComponent; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Tests SCA metadata such as <code>@ComponentName</code> and <code>@Context</code> are handled properly - * - * @version $Rev: 394173 $ $Date: 2006-04-14 11:54:59 -0700 (Fri, 14 Apr 2006) $ - */ -public class JavaAtomicContextMetadataInjectionTestCase extends TestCase { - - public void testComponentNameSet() throws Exception { - CompositeContext mc = new CompositeContextImpl(); - mc.setName("mc"); - JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit", - ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc); - context.start(); - ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null); - Assert.assertNotNull(instance); - Assert.assertEquals("TestServiceInit", instance.getName()); - context.stop(); - } - - public void testModuleContextSet() throws Exception { - CompositeContext mc = new CompositeContextImpl(); - mc.setName("mc"); - JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit", - ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc); - context.start(); - ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null); - Assert.assertNotNull(instance); - Assert.assertEquals(mc, instance.getModuleContext()); - context.stop(); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextNegativeMetadataTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextNegativeMetadataTestCase.java deleted file mode 100644 index 0a4527f405..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextNegativeMetadataTestCase.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.context; - -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.BadContextPojo; -import org.apache.tuscany.container.java.mock.components.BadNamePojo; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Performs rudimentary negative testing by using malformed metadata on a POJO - * - * @version $Rev $Date - */ -public class JavaAtomicContextNegativeMetadataTestCase extends TestCase { - - /** - * Tests that a pojo with <code>@ComponentName</code> specified on a non-String type generates an error. - * <p/> - * <strong>NB:</strong> the test assumes an error with a message containing - * "@ComponentName" is generated - */ - public void testBadNameType() throws Exception { - CompositeContext mc = new CompositeContextImpl(); - mc.setName("mc"); - try { - MockFactory.createPojoContext("BadNamePojo", BadNamePojo.class, Scope.MODULE, mc); - } catch (NoSuchMethodException e) { - if (e.getMessage().indexOf("@ComponentName") < 0) { - throw e; - } - } - - } - - /** - * Tests that a pojo with <code>@Context</code> specified on a non-ModuleContext type generates an error. - * <p/> - * <strong>NB:</strong> the test assumes an error with a message containing - * "@Context" is generated - */ - public void testContextType() throws Exception { - CompositeContext mc = new CompositeContextImpl(); - mc.setName("mc"); - try { - MockFactory.createPojoContext("BadContextPojo", BadContextPojo.class, Scope.MODULE, mc); - } catch (NoSuchMethodException e) { - if (e.getMessage().indexOf("@Context") < 0) { - throw e; - } - } - - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextScopeTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextScopeTestCase.java deleted file mode 100644 index 96bff0cf2e..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextScopeTestCase.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.context; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; -import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl; -import org.apache.tuscany.container.java.mock.components.GenericComponent; -import org.apache.tuscany.container.java.mock.components.ModuleScopeComponentImpl; -import org.apache.tuscany.container.java.mock.components.RequestScopeComponentImpl; -import org.apache.tuscany.container.java.mock.components.SessionScopeComponentImpl; -import org.apache.tuscany.container.java.mock.components.StatelessComponentImpl; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.injection.PojoObjectFactory; - -/** - * Tests {@link JavaAtomicContext} to ensure it handles component scopes properly - * - * @version $Rev$ $Date$ - */ -public class JavaAtomicContextScopeTestCase extends TestCase { - - JavaAssemblyFactory factory = new JavaAssemblyFactoryImpl(); - - public void testGetModuleInstance() throws Exception { - CompositeContext mc = new CompositeContextImpl(); - mc.setName("mc"); - JavaAtomicContext c = new JavaAtomicContext("foo", new PojoObjectFactory<ModuleScopeComponentImpl>(JavaIntrospectionHelper - .getDefaultConstructor(ModuleScopeComponentImpl.class), null, null), false, null, null, false); - GenericComponent service = (GenericComponent) c.getInstance(null); - Assert.assertNotNull(service); - service.setString("foo"); - GenericComponent service2 = (GenericComponent) c.getInstance(null); - Assert.assertNotNull(service2); - Assert.assertSame(service, service2); - } - - public void testGetSessionInstance() throws Exception { - CompositeContext mc = new CompositeContextImpl(); - mc.setName("mc"); - JavaAtomicContext c = new JavaAtomicContext("foo", new PojoObjectFactory<SessionScopeComponentImpl>(JavaIntrospectionHelper - .getDefaultConstructor(SessionScopeComponentImpl.class), null, null), false, null, null, false); - GenericComponent service = (GenericComponent) c.getInstance(null); - Assert.assertNotNull(service); - service.setString("foo"); - GenericComponent service2 = (GenericComponent) c.getInstance(null); - Assert.assertNotNull(service2); - Assert.assertSame(service, service2); - } - - public void testGetRequestInstance() throws Exception { - CompositeContext mc = new CompositeContextImpl(); - mc.setName("mc"); - JavaAtomicContext c = new JavaAtomicContext("foo", new PojoObjectFactory<RequestScopeComponentImpl>(JavaIntrospectionHelper - .getDefaultConstructor(RequestScopeComponentImpl.class), null, null), false, null, null, false); - GenericComponent service = (GenericComponent) c.getInstance(null); - Assert.assertNotNull(service); - service.setString("foo"); - GenericComponent service2 = (GenericComponent) c.getInstance(null); - Assert.assertNotNull(service2); - Assert.assertSame(service, service2); - } - - public void testGetStatelessInstance() throws Exception { - CompositeContext mc = new CompositeContextImpl(); - mc.setName("fooContext"); - JavaAtomicContext c = new JavaAtomicContext("foo", new PojoObjectFactory<StatelessComponentImpl>(JavaIntrospectionHelper - .getDefaultConstructor(StatelessComponentImpl.class), null, null), false, null, null, true); - GenericComponent service = (GenericComponent) c.getInstance(null); - Assert.assertNotNull(service); - service.setString("foo"); - GenericComponent service2 = (GenericComponent) c.getInstance(null); - Assert.assertNotNull(service2); - Assert.assertTrue(!"foo".equals(service2.getString())); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/MultiplicityTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/MultiplicityTestCase.java deleted file mode 100644 index a22a8dfce2..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/MultiplicityTestCase.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.context; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.builder.JavaTargetWireBuilder; -import org.apache.tuscany.container.java.mock.MockConfigContext; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.Source; -import org.apache.tuscany.container.java.mock.components.Target; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Tests wires that are configured with a multiplicity - * - * @version $Rev$ $Date$ - */ -public class MultiplicityTestCase extends TestCase { - - public void testMultiplicity() throws Exception { - CompositeContext context = createContext(); - context.start(); - context.registerModelObject(MockFactory.createModuleWithWiredComponents(Scope.MODULE, Scope.MODULE)); - context.publish(new ModuleStart(this)); - Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); - Assert.assertNotNull(source); - Target target = (Target) ((AtomicContext)context.getContext("target")).getTargetInstance(); - Assert.assertNotNull(target); - // test setter injection - List<Target> targets = source.getTargets(); - Assert.assertEquals(1, targets.size()); - - // test field injection - targets = source.getTargetsThroughField(); - Assert.assertEquals(1, targets.size()); - } - - private CompositeContext createContext() { - CompositeContextImpl context = new CompositeContextImpl(); - context.setName("system.context"); - List<ContextFactoryBuilder>builders = MockFactory.createSystemBuilders(); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); - builders.add(new JavaContextFactoryBuilder(wireService)); - List<WireBuilder> wireBuilders = new ArrayList<WireBuilder>(); - wireBuilders.add(new JavaTargetWireBuilder()); - context.setConfigurationContext(new MockConfigContext(builders,wireBuilders)); - return context; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java deleted file mode 100644 index 58180674b3..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.integration; - -/** - * @version $Rev$ $Date$ - */ -public interface GreetingProvider { - String getGreeting(String name, String locale); -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java deleted file mode 100644 index fef068c22e..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.integration; - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Service; - -/** - * @version $Rev$ $Date$ - */ -@Service(GreetingProvider.class) -public class GreetingProviderImpl implements GreetingProvider { - - public String greeting; - - @Property - public void setGreeting(String greeting) { - this.greeting = greeting; - } - - public String getGreeting(String name, String locale) { - if ("fr".equals(locale)) { - return "Bonjour " + name; - } else { - return greeting + name; - } - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldImpl.java deleted file mode 100644 index 9ff58f2d8d..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.integration; - -import org.osoa.sca.annotations.Service; - -/** - * @version $Rev$ $Date$ - */ -@Service(HelloWorldService.class) -public class HelloWorldImpl implements HelloWorldService { - public String getGreetings(String name) { - return "Hello " + name; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java deleted file mode 100644 index aa5069c232..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.integration; - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Service; -import org.apache.tuscany.core.sdo.helper.SDOHelper; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.DataFactory; - -/** - * @version $Rev$ $Date$ - */ -@Service(HelloWorldService.class) -public class HelloWorldMCImpl implements HelloWorldService { - - @Property - public String locale; - - public String getBar() { - return bar; - } - - @Property(name= "bar", required=true) - public void setXBar(String bar) { - this.bar = bar; - } - - public String bar; - - @Reference(name="greetingProvider") - public void setGreetingProvider(GreetingProvider greetingProvider) { - this.greetingProvider2 = greetingProvider; - } - - public GreetingProvider greetingProvider2; - - @Reference(required=false) - public GreetingProvider foo; - - public String getGreetings(String name) { - return greetingProvider2.getGreeting(name, locale); - } - - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java deleted file mode 100644 index 5a73abd45a..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.integration; - -import java.net.URL; -import java.net.URLClassLoader; - -import junit.framework.TestCase; -import org.apache.tuscany.core.client.TuscanyRuntime; -import org.osoa.sca.CurrentModuleContext; -import org.osoa.sca.ModuleContext; - -/** - * @version $Rev$ $Date$ - */ -public class HelloWorldMCTestCase extends TestCase { - private ClassLoader oldCL; - - public void testHelloWorld() throws Exception { - TuscanyRuntime tuscany = new TuscanyRuntime("test", "foo"); - tuscany.start(); - ModuleContext moduleContext = CurrentModuleContext.getContext(); - assertNotNull(moduleContext); - assertEquals("foo", moduleContext.getURI()); - HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld"); - assertNotNull(helloworldService); - - String value = helloworldService .getGreetings("World"); - assertEquals("Hello World", value); - tuscany.stop(); - } - - protected void setUp() throws Exception { - super.setUp(); - URL url = getClass().getResource("/helloworldmc/"); - ClassLoader cl = new URLClassLoader(new URL[]{url}, getClass().getClassLoader()); - oldCL = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(cl); - } - - protected void tearDown() throws Exception { - Thread.currentThread().setContextClassLoader(oldCL); - super.tearDown(); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldService.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldService.java deleted file mode 100644 index 3abb99d7e0..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldService.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.integration; - -/** - * @version $Rev$ $Date$ - */ -public interface HelloWorldService { - public String getGreetings(String name); -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java deleted file mode 100644 index c714b416e4..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.integration; - -import java.net.URL; -import java.net.URLClassLoader; - -import junit.framework.TestCase; -import org.osoa.sca.CurrentModuleContext; -import org.osoa.sca.ModuleContext; - -import org.apache.tuscany.core.client.TuscanyRuntime; - -/** - * @version $Rev$ $Date$ - */ -public class HelloWorldTestCase extends TestCase { - private ClassLoader oldCL; - - public void testHelloWorld() throws Exception { - TuscanyRuntime tuscany = new TuscanyRuntime("test", null); - tuscany.start(); - ModuleContext moduleContext = CurrentModuleContext.getContext(); - assertNotNull(moduleContext); - - HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld"); - assertNotNull(helloworldService); - - String value = helloworldService .getGreetings("World"); - assertEquals("Hello World", value); - - tuscany.stop(); - } - - protected void setUp() throws Exception { - super.setUp(); - URL url = getClass().getResource("/helloworld/"); - ClassLoader cl = new URLClassLoader(new URL[]{url}, getClass().getClassLoader()); - oldCL = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(cl); - } - - protected void tearDown() throws Exception { - Thread.currentThread().setContextClassLoader(oldCL); - super.tearDown(); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaBuilderContextIntegrationTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaBuilderContextIntegrationTestCase.java deleted file mode 100644 index f7cc2ed149..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaBuilderContextIntegrationTestCase.java +++ /dev/null @@ -1,189 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.integration; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.builder.JavaTargetWireBuilder; -import org.apache.tuscany.container.java.builder.MockHandlerBuilder; -import org.apache.tuscany.container.java.builder.MockInterceptorBuilder; -import org.apache.tuscany.container.java.invocation.mock.MockHandler; -import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.GenericComponent; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; -import org.apache.tuscany.core.client.BootstrapHelper; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.runtime.RuntimeContextImpl; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.wire.service.WireFactoryService; - -/** - * Verifies that the composite context implementation and java component builders construct references properly - * - * @version $Rev$ $Date$ - */ -public class JavaBuilderContextIntegrationTestCase extends TestCase { - private ContextFactoryBuilderRegistry builderRegistry; - private DefaultWireBuilder defaultWireBuilder; - private NullMonitorFactory monitorFactory; - - public JavaBuilderContextIntegrationTestCase(String arg0) { - super(arg0); - } - - protected void setUp() throws Exception { - super.setUp(); - monitorFactory = new NullMonitorFactory(); - builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); - defaultWireBuilder = new DefaultWireBuilder(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void testRefWithSourceInterceptor() throws Exception { - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, true); - PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); - policyRegistry.registerSourceBuilder(interceptorBuilder); - WireFactoryService wireFactory = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); - JavaContextFactoryBuilder javaBuilder = new JavaContextFactoryBuilder(wireFactory); - - builderRegistry.register(javaBuilder); - - RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, defaultWireBuilder); - runtime.addBuilder(new JavaTargetWireBuilder()); - runtime.start(); - runtime.getRootContext().registerModelObject( - MockFactory.createCompositeComponent("test.module")); - CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockFactory.createModule()); - child.publish(new ModuleStart(this)); - GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null); - Assert.assertNotNull(source); - source.getGenericComponent().getString(); - Assert.assertEquals(1, mockInterceptor.getCount()); - source.getGenericComponent().getString(); - Assert.assertEquals(2, mockInterceptor.getCount()); - child.publish(new ModuleStop(this)); - runtime.stop(); - } - - public void testRefWithSourceInterceptorHandler() throws Exception { - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, true); - MockHandler mockHandler = new MockHandler(); - MockHandlerBuilder handlerBuilder = new MockHandlerBuilder(mockHandler, true, true); - PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); - policyRegistry.registerSourceBuilder(interceptorBuilder); - policyRegistry.registerSourceBuilder(handlerBuilder); - WireFactoryService wireFactory = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); - JavaContextFactoryBuilder javaBuilder = new JavaContextFactoryBuilder(wireFactory); - - builderRegistry.register(javaBuilder); - RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, defaultWireBuilder); - runtime.addBuilder(new JavaTargetWireBuilder()); - runtime.start(); - runtime.getRootContext().registerModelObject( - MockFactory.createCompositeComponent("test.module")); - CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockFactory.createModule()); - child.publish(new ModuleStart(this)); - GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null); - Assert.assertNotNull(source); - source.getGenericComponent().getString(); - Assert.assertEquals(1, mockInterceptor.getCount()); - Assert.assertEquals(1, mockHandler.getCount()); - source.getGenericComponent().getString(); - Assert.assertEquals(2, mockInterceptor.getCount()); - Assert.assertEquals(2, mockHandler.getCount()); - child.publish(new ModuleStop(this)); - runtime.stop(); - } - - public void testRefWithTargetInterceptorHandler() throws Exception { - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); - MockHandler mockHandler = new MockHandler(); - MockHandlerBuilder handlerBuilder = new MockHandlerBuilder(mockHandler, false, true); - PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); - policyRegistry.registerSourceBuilder(interceptorBuilder); - policyRegistry.registerSourceBuilder(handlerBuilder); - WireFactoryService wireFactory = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); - JavaContextFactoryBuilder javaBuilder = new JavaContextFactoryBuilder(wireFactory); - - builderRegistry.register(javaBuilder); - - RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, defaultWireBuilder); - runtime.addBuilder(new JavaTargetWireBuilder()); - runtime.start(); - runtime.getRootContext().registerModelObject( - MockFactory.createCompositeComponent("test.module")); - CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockFactory.createModule()); - child.publish(new ModuleStart(this)); - GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null); - Assert.assertNotNull(source); - source.getGenericComponent().getString(); - Assert.assertEquals(1, mockInterceptor.getCount()); - Assert.assertEquals(1, mockHandler.getCount()); - source.getGenericComponent().getString(); - Assert.assertEquals(2, mockInterceptor.getCount()); - Assert.assertEquals(2, mockHandler.getCount()); - child.publish(new ModuleStop(this)); - runtime.stop(); - } - - public void testRefWithTargetInterceptor() throws Exception { - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); - PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); - policyRegistry.registerSourceBuilder(interceptorBuilder); - WireFactoryService wireFactory = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); - JavaContextFactoryBuilder javaBuilder = new JavaContextFactoryBuilder(wireFactory); - - builderRegistry.register(javaBuilder); - - RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, defaultWireBuilder); - runtime.addBuilder(new JavaTargetWireBuilder()); - - runtime.start(); - runtime.getRootContext().registerModelObject( - MockFactory.createCompositeComponent("test.module")); - CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockFactory.createModule()); - child.publish(new ModuleStart(this)); - GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null); - Assert.assertNotNull(source); - source.getGenericComponent().getString(); - Assert.assertEquals(1, mockInterceptor.getCount()); - source.getGenericComponent().getString(); - Assert.assertEquals(2, mockInterceptor.getCount()); - child.publish(new ModuleStop(this)); - runtime.stop(); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java deleted file mode 100644 index a5ec39480f..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.integration; - -import junit.framework.TestCase; - -import org.apache.tuscany.common.monitor.MonitorFactory; -import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; -import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; -import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.client.BootstrapHelper; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.runtime.RuntimeContextImpl; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; - -/** - * Integration test that verifies container.java can be used to host components. - * - * @version $Rev$ $Date$ - */ -public class JavaIntegrationTestCase extends TestCase { - private JavaAssemblyFactory factory; - private RuntimeContext runtime; - - public void testModuleWithOneComponent() throws Exception { - Module module = factory.createModule(); - ModuleComponent moduleComponent = factory.createModuleComponent(); - moduleComponent.setImplementation(module); - -// runtime.registerModelObject(moduleComponent); - } - - protected void setUp() throws Exception { - super.setUp(); - - // Create a factory for model objects - factory = new JavaAssemblyFactoryImpl(); - - // Create and bootstrap an empty Tuscany runtime - MonitorFactory monitorFactory = new NullMonitorFactory(); - ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); - DefaultWireBuilder wireBuilder = new DefaultWireBuilder(); - runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder); - runtime.start(); - } - - protected void tearDown() throws Exception { - runtime.stop(); - super.tearDown(); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaRuntimeBootstrapTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaRuntimeBootstrapTestCase.java deleted file mode 100644 index 6a9fca90c9..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaRuntimeBootstrapTestCase.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.integration; - -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.GenericComponent; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.runtime.RuntimeContext; - -import junit.framework.Assert; -import junit.framework.TestCase; - -/** - * Ensures basic runtime with Java support boots properly - * - * @version $Rev$ $Date$ - */ -public class JavaRuntimeBootstrapTestCase extends TestCase { - - /** - * Tests the runtime can be bootstrapped with Java builders and two module-scoped Java-based components can be wired - */ - public void testRuntimeBoot() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule()); - testCtx.publish(new ModuleStart(this)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().getString(); - } - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/StartStopTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/StartStopTestCase.java deleted file mode 100644 index 8b7ed342c4..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/StartStopTestCase.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.integration; - -import java.net.URL; -import java.net.URLClassLoader; - -import junit.framework.TestCase; -import org.apache.tuscany.core.client.TuscanyRuntime; -import org.osoa.sca.ModuleContext; -import org.osoa.sca.CurrentModuleContext; - -/** - * @version $Rev$ $Date$ - */ -public class StartStopTestCase extends TestCase { - private ClassLoader oldCL; - - public void testHelloWorld() throws Exception { - TuscanyRuntime tuscany = new TuscanyRuntime("test", null); - tuscany.start(); - ModuleContext moduleContext = CurrentModuleContext.getContext(); - assertNotNull(moduleContext); - - HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld"); - assertNotNull(helloworldService); - - String value = helloworldService .getGreetings("World"); - assertEquals("Hello World", value); - tuscany.stop(); - tuscany = new TuscanyRuntime("test", null); - tuscany.start(); - moduleContext = CurrentModuleContext.getContext(); - assertNotNull(moduleContext); - helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld"); - assertNotNull(helloworldService); - value = helloworldService .getGreetings("World"); - assertEquals("Hello World", value); - tuscany.stop(); - } - - protected void setUp() throws Exception { - super.setUp(); - URL url = getClass().getResource("/helloworldmc/"); - ClassLoader cl = new URLClassLoader(new URL[]{url}, getClass().getClassLoader()); - oldCL = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(cl); - } - - protected void tearDown() throws Exception { - Thread.currentThread().setContextClassLoader(oldCL); - super.tearDown(); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EPtoExternalServiceTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EPtoExternalServiceTestCase.java deleted file mode 100644 index 17424669bc..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EPtoExternalServiceTestCase.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.integration.binding; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; -import org.apache.tuscany.container.java.builder.MockInterceptorBuilder; -import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.EntryPointContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.context.event.RequestStart; -import org.apache.tuscany.core.runtime.RuntimeContext; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class EPtoExternalServiceTestCase extends TestCase { - private Method hello; - - /** - * Tests wiring of an entry point directly to an external service - */ - public void testEPtoESInvocation() throws Throwable { - RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); - PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) - .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); - registry.registerTargetBuilder(interceptorBuilder); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); - CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockFactory.createModuleWithEntryPointToExternalService()); - child.publish(new ModuleStart(this)); - Object id = new Object(); - child.publish(new RequestStart(this, id)); - EntryPointContext ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - InvocationHandler handler = (InvocationHandler) ctx.getHandler(); - Assert.assertEquals(0, mockInterceptor.getCount()); - Object response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("foo", response); - Assert.assertEquals(1, mockInterceptor.getCount()); - - ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - handler = (InvocationHandler) ctx.getHandler(); - response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("foo", response); - child.publish(new RequestEnd(this, id)); - - // second request - Object id2 = new Object(); - child.publish(new RequestStart(this, id2)); - ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - handler = (InvocationHandler) ctx.getHandler(); - Assert.assertEquals(2, mockInterceptor.getCount()); - response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("foo", response); - Assert.assertEquals(3, mockInterceptor.getCount()); - child.publish(new RequestEnd(this, id2)); - - child.publish(new ModuleStop(this)); - runtime.stop(); - - } - - protected void setUp() throws Exception { - super.setUp(); - hello = HelloWorldService.class.getMethod("hello", String.class); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EntryPointToJavaTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EntryPointToJavaTestCase.java deleted file mode 100644 index f8ba1e2192..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EntryPointToJavaTestCase.java +++ /dev/null @@ -1,261 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.integration.binding; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; -import org.apache.tuscany.container.java.builder.MockInterceptorBuilder; -import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.EntryPointContext; -import org.apache.tuscany.core.context.event.HttpSessionBound; -import org.apache.tuscany.core.context.event.HttpSessionEnd; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.context.event.RequestStart; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.model.assembly.Scope; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; - -/** - * Tests basic entry point functionality with Java components - * - * @version $Rev$ $Date$ - */ -public class EntryPointToJavaTestCase extends TestCase { - - private Method hello; - - public void setUp() throws Exception { - hello = HelloWorldService.class.getMethod("hello", String.class); - } - - /** - * Tests creation and wire of an entry point wired to a module-scoped service offered by a Java component - */ - public void testEPtoJavaModuleScopeInvoke() throws Throwable { - RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); - PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) - .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); - - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); - registry.registerTargetBuilder(interceptorBuilder); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); - CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.MODULE)); - child.publish(new ModuleStart(this)); - Object id = new Object(); - child.publish(new RequestStart(this, id)); - EntryPointContext ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - InvocationHandler handler = (InvocationHandler) ctx.getHandler(); - Assert.assertEquals(0, mockInterceptor.getCount()); - Object response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("Hello foo", response); - Assert.assertEquals(1, mockInterceptor.getCount()); - Object id2 = new Object(); - child.publish(new RequestStart(this, id2)); - - // second request - Object id3 = new Object(); - child.publish(new RequestStart(this, id3)); - ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - handler = (InvocationHandler) ctx.getHandler(); - Assert.assertEquals(1, mockInterceptor.getCount()); - response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("Hello foo", response); - Assert.assertEquals(2, mockInterceptor.getCount()); - HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null); - Assert.assertEquals(2, service1.count()); - child.publish(new RequestEnd(this, id3)); - - child.publish(new ModuleStop(this)); - runtime.stop(); - } - - /** - * Tests creation and wire of an entry point wired to a session-scoped service offered by a Java component - */ - public void testEPtoJavaSessionScopeInvoke() throws Throwable { - RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); - PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) - .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); - registry.registerTargetBuilder(interceptorBuilder); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); - CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.SESSION)); - child.publish(new ModuleStart(this)); - - // first session - Object session = new Object(); - Object id = new Object(); - child.publish(new RequestStart(this, id)); - child.publish(new HttpSessionBound(this, session)); - - EntryPointContext ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - InvocationHandler handler = (InvocationHandler) ctx.getHandler(); - Assert.assertEquals(0, mockInterceptor.getCount()); - Object response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("Hello foo", response); - Assert.assertEquals(1, mockInterceptor.getCount()); - child.publish(new RequestEnd(this, id)); - - Object id2 = new Object(); - child.publish(new RequestStart(this, id2)); - child.publish(new HttpSessionBound(this, session)); - EntryPointContext ctx2 = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx2); - response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("Hello foo", response); - Assert.assertEquals(2, mockInterceptor.getCount()); - HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null); - Assert.assertEquals(2, service1.count()); - child.publish(new RequestEnd(this, id2)); - child.publish(new HttpSessionEnd(this, session)); - - // second session - Object session2 = new Object(); - child.publish(new RequestStart(this, new Object())); - child.publish(new HttpSessionBound(this, session2)); - - ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - Assert.assertEquals(2, mockInterceptor.getCount()); - response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("Hello foo", response); - Assert.assertEquals(3, mockInterceptor.getCount()); - child.publish(new HttpSessionBound(this, session2)); - - Object id3 = new Object(); - child.publish(new RequestStart(this, id3)); - child.publish(new HttpSessionBound(this, session2)); - ctx2 = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx2); - response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("Hello foo", response); - Assert.assertEquals(4, mockInterceptor.getCount()); - HelloWorldService service2 = (HelloWorldService) child.getContext("target").getInstance(null); - Assert.assertEquals(2, service2.count()); - Assert.assertEquals(2, service1.count()); //ensure sessions not crossed - child.publish(new RequestEnd(this, session2)); - child.publish(new HttpSessionBound(this, session2)); - - child.publish(new ModuleStop(this)); - runtime.stop(); - } - - - /** - * Tests creation and wire of an entry point wired to a module-scoped service offered by a Java component - */ - public void testEPtoJavaStatelessInvoke() throws Throwable { - RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); - PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) - .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); - registry.registerTargetBuilder(interceptorBuilder); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); - CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.INSTANCE)); - child.publish(new ModuleStart(this)); - Object id = new Object(); - child.publish(new RequestStart(this, id)); - EntryPointContext ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - InvocationHandler handler = (InvocationHandler) ctx.getHandler(); - Assert.assertEquals(0, mockInterceptor.getCount()); - Object response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("Hello foo", response); - Assert.assertEquals(1, mockInterceptor.getCount()); - child.publish(new RequestEnd(this, id)); - - // second request - Object id2 = new Object(); - child.publish(new RequestStart(this, id2)); - ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - handler = (InvocationHandler) ctx.getHandler(); - Assert.assertEquals(1, mockInterceptor.getCount()); - response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("Hello foo", response); - Assert.assertEquals(2, mockInterceptor.getCount()); - HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null); - Assert.assertEquals(0, service1.count()); - child.publish(new RequestEnd(this, id)); - - child.publish(new ModuleStop(this)); - runtime.stop(); - } - - public void testEPtoJavaRequestInvoke() throws Throwable { - RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); - PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) - .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); - registry.registerTargetBuilder(interceptorBuilder); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); - CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.REQUEST)); - child.publish(new ModuleStart(this)); - Object id = new Object(); - child.publish(new RequestStart(this, id)); - EntryPointContext ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - InvocationHandler handler = (InvocationHandler) ctx.getHandler(); - Assert.assertEquals(0, mockInterceptor.getCount()); - Object response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("Hello foo", response); - Assert.assertEquals(1, mockInterceptor.getCount()); - - ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - handler = (InvocationHandler) ctx.getHandler(); - response = handler.invoke(null, hello, new Object[]{"foo"}); - HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null); - Assert.assertEquals(2, service1.count()); - - child.publish(new RequestEnd(this, id)); - - // second request - Object id2 = new Object(); - child.publish(new RequestStart(this, id2)); - ctx = (EntryPointContext) child.getContext("source"); - Assert.assertNotNull(ctx); - handler = (InvocationHandler) ctx.getHandler(); - Assert.assertEquals(2, mockInterceptor.getCount()); - response = handler.invoke(null, hello, new Object[]{"foo"}); - Assert.assertEquals("Hello foo", response); - Assert.assertEquals(3, mockInterceptor.getCount()); - HelloWorldService service2 = (HelloWorldService) child.getContext("target").getInstance(null); - Assert.assertEquals(1, service2.count()); - child.publish(new RequestEnd(this, id2)); - - child.publish(new ModuleStop(this)); - runtime.stop(); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/ExternalServiceProxyInvokeTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/ExternalServiceProxyInvokeTestCase.java deleted file mode 100644 index 7357f973f7..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/ExternalServiceProxyInvokeTestCase.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.integration.binding; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; -import org.apache.tuscany.container.java.builder.MockInterceptorBuilder; -import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.context.event.RequestStart; -import org.apache.tuscany.core.runtime.RuntimeContext; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class ExternalServiceProxyInvokeTestCase extends TestCase { - - /** - * Tests that an external service can be invoked by locating a proxy to it as opposed to invoking it over a wire from another - * source such as an entry point or external service. - * - * @throws Throwable - */ - public void testProxyInvocation() throws Throwable { - RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); - PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) - .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); - registry.registerTargetBuilder(interceptorBuilder); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); - CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockFactory.createModuleWithEntryPointToExternalService()); - child.publish(new ModuleStart(this)); - Object id = new Object(); - child.publish(new RequestStart(this, id)); - HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null); - Assert.assertEquals("foo", service1.hello("foo")); - - child.publish(new RequestEnd(this, id)); - child.publish(new ModuleStop(this)); - runtime.stop(); - - } - - protected void setUp() throws Exception { - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/JavaToExternalServiceTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/JavaToExternalServiceTestCase.java deleted file mode 100644 index 90acb1c591..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/JavaToExternalServiceTestCase.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.integration.binding; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; -import org.apache.tuscany.container.java.builder.MockInterceptorBuilder; -import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.runtime.RuntimeContext; - -/** - * Tests basic Java to external service interaction - * - * @version $Rev$ $Date$ - */ -public class JavaToExternalServiceTestCase extends TestCase { - - /** - * Tests an wire of an external service configured with the {@link org.apache.tuscany.container.java.mock.binding.foo.FooBinding} - * from a Java component - * - * @throws Exception - */ - public void testJavaToESInvoke() throws Exception { - RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); - PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext( - MockFactory.SYSTEM_CHILD)).getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); - registry.registerTargetBuilder(interceptorBuilder); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); - CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockFactory.createModuleWithExternalService()); - child.publish(new ModuleStart(this)); - HelloWorldService source = (HelloWorldService) child.getContext("source").getInstance(null); - Assert.assertNotNull(source); - Assert.assertEquals(0, mockInterceptor.getCount()); - Assert.assertEquals("foo", source.hello("foo")); - Assert.assertEquals(1, mockInterceptor.getCount()); - child.publish(new ModuleStop(this)); - runtime.stop(); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java deleted file mode 100644 index 89320f60e5..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java +++ /dev/null @@ -1,741 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.integration.context; - -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.GenericComponent; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.RequestStart; -import org.apache.tuscany.core.context.event.HttpSessionBound; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.model.assembly.Scope; - -import junit.framework.Assert; -import junit.framework.TestCase; - -/** - * Tests scoping is properly handled for service references - * - * @version $Rev$ $Date$ - */ -public class ScopeReferenceTestCase extends TestCase { - - /** - * Tests a module-to-module scoped wire is setup properly by the runtime - */ - public void testModuleToModule() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule()); - testCtx.publish(new ModuleStart(this)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().getString(); - } - - /** - * Tests a module-to-session scoped wire is setup properly by the runtime - */ - public void testModuleToSession() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.MODULE,Scope.SESSION)); - testCtx.publish(new ModuleStart(this)); - - // first session - Object session = new Object(); - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - testCtx.publish(new HttpSessionBound(this,session)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,id)); - - //second session - Object session2 = new Object(); - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - testCtx.publish(new HttpSessionBound(this,session2)); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target2); - Assert.assertTrue(!"foo".equals(target2.getString())); - - Assert.assertTrue(!"foo".equals(source.getGenericComponent().getString())); - source.getGenericComponent().setString("bar"); - Assert.assertEquals("bar",target2.getString()); - Assert.assertEquals("bar",source.getGenericComponent().getString()); - //testCtx.fireEvent(EventContext.SESSION_NOTIFY,session); - - } - - /** - * Tests a module-to-request scoped wire is setup properly by the runtime - */ - public void testModuleToRequest() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.MODULE,Scope.REQUEST)); - testCtx.publish(new ModuleStart(this)); - - // first request - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,id)); - - //second request - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target2); - Assert.assertTrue(!"foo".equals(target2.getString())); - - Assert.assertTrue(!"foo".equals(source.getGenericComponent().getString())); - source.getGenericComponent().setString("bar"); - Assert.assertEquals("bar",target2.getString()); - Assert.assertEquals("bar",source.getGenericComponent().getString()); - - } - - /** - * Tests a module-to-stateless scoped wire is setup properly by the runtime - */ - public void testModuleToStateless() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.MODULE,Scope.INSTANCE)); - testCtx.publish(new ModuleStart(this)); - - // first request - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertTrue(!"foo".equals(target.getString())); - testCtx.publish(new RequestEnd(this,id)); - - //second request - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target2); - Assert.assertTrue(!"foo".equals(target2.getString())); - - Assert.assertTrue(!"foo".equals(source.getGenericComponent().getString())); - source.getGenericComponent().setString("bar"); - Assert.assertTrue(!"bar".equals(target2.getString())); - } - - /** - * Tests a session-to-session scoped wire is setup properly by the runtime - */ - public void testSessionToSession() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.SESSION)); - testCtx.publish(new ModuleStart(this)); - - // first session - Object session = new Object(); - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - testCtx.publish(new HttpSessionBound(this,session)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - source.getGenericComponent().setString("foo"); - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,id)); - - //second session - Object session2 = new Object(); - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - testCtx.publish(new HttpSessionBound(this,session2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source2); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals(null,target2.getString()); - Assert.assertEquals(null,source2.getGenericComponent().getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals("baz",source2.getGenericComponent().getString()); - Assert.assertEquals("baz",target2.getString()); - - testCtx.publish(new RequestEnd(this,id2)); - - } - - - /** - * Tests a session-to-module scoped wire is setup properly by the runtime - */ - public void testSessionToModule() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.MODULE)); - testCtx.publish(new ModuleStart(this)); - - // first session - Object session = new Object(); - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - testCtx.publish(new HttpSessionBound(this,session)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - source.getGenericComponent().setString("foo"); - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,id)); - - //second session - Object session2 = new Object(); - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - testCtx.publish(new HttpSessionBound(this,session2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source2); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals("foo",target2.getString()); - Assert.assertEquals("foo",source2.getGenericComponent().getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals("baz",source2.getGenericComponent().getString()); - Assert.assertEquals("baz",target2.getString()); - Assert.assertEquals("baz",target.getString()); - - testCtx.publish(new RequestEnd(this,session2)); - - } - - /** - * Tests a session-to-request scoped wire is setup properly by the runtime - */ - public void testSessionToRequest() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.REQUEST)); - testCtx.publish(new ModuleStart(this)); - - // first session - Object session = new Object(); - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - testCtx.publish(new HttpSessionBound(this,session)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,session)); - - //second session - Object session2 = new Object(); - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - testCtx.publish(new HttpSessionBound(this,session2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals(null,target2.getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals("baz",target2.getString()); - Assert.assertEquals("baz",source2.getGenericComponent().getString()); - - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,session)); - - } - - - /** - * Tests a session-to-stateless scoped wire is setup properly by the runtime - */ - public void testSessionToStateless() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.INSTANCE)); - testCtx.publish(new ModuleStart(this)); - - // first session - Object session = new Object(); - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - testCtx.publish(new HttpSessionBound(this,session)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals(null,target.getString()); - testCtx.publish(new RequestEnd(this,session)); - - //second session - Object session2 = new Object(); - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - testCtx.publish(new HttpSessionBound(this,session2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals(null,target2.getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals(null,target2.getString()); //Note assumes no pooling - Assert.assertEquals(null,source2.getGenericComponent().getString()); - - Assert.assertEquals(null,target.getString()); //Note assumes no pooling - testCtx.publish(new RequestEnd(this,session)); - - } - - /** - * Tests a request-to-request scoped wire is setup properly by the runtime - */ - public void testRequestToRequest() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.REQUEST)); - testCtx.publish(new ModuleStart(this)); - - // first request - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,new Object())); - - //second request - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source2); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals(null,target2.getString()); - Assert.assertEquals(null,source2.getGenericComponent().getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals("baz",source2.getGenericComponent().getString()); - Assert.assertEquals("baz",target2.getString()); - - testCtx.publish(new RequestEnd(this,new Object())); - } - - /** - * Tests a request-to-module scoped wire is setup properly by the runtime - */ - public void testRequestToModule() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.MODULE)); - testCtx.publish(new ModuleStart(this)); - - // first request - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,new Object())); - - //second request - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source2); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals("foo",target2.getString()); - Assert.assertEquals("foo",source2.getGenericComponent().getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals("baz",source2.getGenericComponent().getString()); - Assert.assertEquals("baz",target2.getString()); - Assert.assertEquals("baz",target.getString()); - - testCtx.publish(new RequestEnd(this,new Object())); - } - - /** - * Tests a request-to-session scoped wire is setup properly by the runtime - */ - public void testRequestToSession() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.SESSION)); - testCtx.publish(new ModuleStart(this)); - - // first session - Object session = new Object(); - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - testCtx.publish(new HttpSessionBound(this,session)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,new Object())); - - //second request for session - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - testCtx.publish(new HttpSessionBound(this,session)); - GenericComponent targetR2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertEquals("foo",targetR2.getString()); - GenericComponent sourceR2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(sourceR2); - Assert.assertEquals("foo",sourceR2.getGenericComponent().getString()); - - testCtx.publish(new RequestEnd(this,new Object())); - - //second session - Object session2 = new Object(); - Object id3 = new Object(); - testCtx.publish(new RequestStart(this,id3)); - testCtx.publish(new HttpSessionBound(this,session2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source2); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals(null,target2.getString()); - Assert.assertEquals(null,source2.getGenericComponent().getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals("baz",source2.getGenericComponent().getString()); - Assert.assertEquals("baz",target2.getString()); - - testCtx.publish(new RequestEnd(this,session2)); - Object id4 = new Object(); - testCtx.publish(new RequestStart(this,id4)); - testCtx.publish(new HttpSessionBound(this,session)); - testCtx.publish(new RequestEnd(this,session)); - - } - - - /** - * Tests a request-to-stateless scoped wire is setup properly by the runtime - */ - public void testRequestToStateless() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.INSTANCE)); - testCtx.publish(new ModuleStart(this)); - - // first request - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals(null,target.getString()); - testCtx.publish(new RequestEnd(this,new Object())); - - //second request - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source2); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals(null,target2.getString()); - Assert.assertEquals(null,source2.getGenericComponent().getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals(null,source2.getGenericComponent().getString()); - Assert.assertEquals(null,target2.getString()); - - testCtx.publish(new RequestEnd(this,new Object())); - } - - - /** - * Tests a stateless-to-stateless scoped wire is setup properly by the runtime - */ - public void testStatelessToStateless() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.INSTANCE)); - testCtx.publish(new ModuleStart(this)); - - // first request - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals(null,target.getString()); - testCtx.publish(new RequestEnd(this,new Object())); - - //second request - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source2); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals(null,target2.getString()); - Assert.assertEquals(null,source2.getGenericComponent().getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals(null,source2.getGenericComponent().getString()); - Assert.assertEquals(null,target2.getString()); - - testCtx.publish(new RequestEnd(this,new Object())); - } - - /** - * Tests a stateless-to-request scoped wire is setup properly by the runtime - */ - public void testStatelessToRequest() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.REQUEST)); - testCtx.publish(new ModuleStart(this)); - - // first request - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,new Object())); - - GenericComponent targetR1 = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(targetR1); - Assert.assertEquals("foo",target.getString()); - - //second request - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source2); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals(null,target2.getString()); - Assert.assertEquals(null,source2.getGenericComponent().getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals("baz",source2.getGenericComponent().getString()); - Assert.assertEquals("baz",target2.getString()); - - testCtx.publish(new RequestEnd(this,new Object())); - } - - /** - * Tests a stateless-to-session scoped wire is setup properly by the runtime - */ - public void testStatelessToSession() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.SESSION)); - testCtx.publish(new ModuleStart(this)); - - // first session - Object session = new Object(); - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - testCtx.publish(new HttpSessionBound(this,session)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,new Object())); - - //second request for session - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - testCtx.publish(new HttpSessionBound(this,session)); - GenericComponent targetR2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertEquals("foo",targetR2.getString()); - GenericComponent sourceR2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(sourceR2); - Assert.assertEquals("foo",sourceR2.getGenericComponent().getString()); - - testCtx.publish(new RequestEnd(this,new Object())); - - //second session - Object session2 = new Object(); - Object id3 = new Object(); - testCtx.publish(new RequestStart(this,id3)); - testCtx.publish(new HttpSessionBound(this,session2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source2); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals(null,target2.getString()); - Assert.assertEquals(null,source2.getGenericComponent().getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals("baz",source2.getGenericComponent().getString()); - Assert.assertEquals("baz",target2.getString()); - - testCtx.publish(new RequestEnd(this,session2)); - Object id4 = new Object(); - testCtx.publish(new RequestStart(this,id4)); - testCtx.publish(new HttpSessionBound(this,session)); - testCtx.publish(new RequestEnd(this,session)); - - } - - - /** - * Tests a stateless-to-module scoped wire is setup properly by the runtime - */ - public void testStatelessToModule() throws Exception{ - RuntimeContext runtime = MockFactory.createJavaRuntime(); - Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); - Assert.assertNotNull(ctx); - runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); - CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); - Assert.assertNotNull(testCtx); - testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.MODULE)); - testCtx.publish(new ModuleStart(this)); - - Object id = new Object(); - testCtx.publish(new RequestStart(this,id)); - GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); - Assert.assertNotNull(target); - source.getGenericComponent().setString("foo"); - Assert.assertEquals("foo",target.getString()); - testCtx.publish(new RequestEnd(this,new Object())); - - //second session - Object id2 = new Object(); - testCtx.publish(new RequestStart(this,id2)); - GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); - Assert.assertNotNull(source2); - GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); - - Assert.assertNotNull(target2); - Assert.assertEquals("foo",target2.getString()); - Assert.assertEquals("foo",source2.getGenericComponent().getString()); - source2.getGenericComponent().setString("baz"); - Assert.assertEquals("baz",source2.getGenericComponent().getString()); - Assert.assertEquals("baz",target2.getString()); - - testCtx.publish(new RequestEnd(this,new Object())); - - } - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/MediationTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/MediationTestCase.java deleted file mode 100644 index e560af6fd3..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/MediationTestCase.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.invocation; - -import java.lang.reflect.Method; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.invocation.mock.SimpleTargetImpl; -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; - -/** - * Tests invoking on a different interface from the one actually implemented by the target - * - * @version $Rev$ $Date$ - */ -public class MediationTestCase extends TestCase { - - private Method hello; - - private MessageFactory msgFactory = new MessageFactoryImpl(); - - public void setUp() throws Exception { - hello = Hello.class.getMethod("hello", String.class); - } - - public void testMediation() throws Exception { - StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(hello, new SimpleTargetImpl()); - Message msg = msgFactory.createMessage(); - msg.setBody("foo"); - Assert.assertEquals("foo", invoker.invoke(msg).getBody()); - } - - public interface Hello { - - public String hello(String message) throws Exception; - - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/ScopedPojoInvokerTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/ScopedPojoInvokerTestCase.java deleted file mode 100644 index f4337fe3cb..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/ScopedPojoInvokerTestCase.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.invocation; - -import java.lang.reflect.Method; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.invocation.mock.SimpleTarget; -import org.apache.tuscany.container.java.mock.MockScopeContext; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; - -public class ScopedPojoInvokerTestCase extends TestCase { - - private Method echoMethod; - - public ScopedPojoInvokerTestCase() { - super(); - } - - public ScopedPojoInvokerTestCase(String arg0) { - super(arg0); - } - - public void setUp() throws Exception { - echoMethod = SimpleTarget.class.getDeclaredMethod("echo", String.class); - Assert.assertNotNull(echoMethod); - } - - public void testScopedInvoke() throws Exception { - ScopeContext container = new MockScopeContext(); - ScopedJavaComponentInvoker invoker = new ScopedJavaComponentInvoker(new QualifiedName("foo"), echoMethod, container,false); - Object ret = invoker.invokeTarget("foo"); - Assert.assertEquals("foo", ret); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/StaticPojoInvokerTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/StaticPojoInvokerTestCase.java deleted file mode 100644 index 31e7e3c64e..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/StaticPojoInvokerTestCase.java +++ /dev/null @@ -1,154 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.invocation; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import static java.lang.Integer.*; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class StaticPojoInvokerTestCase extends TestCase { - - private Method echoMethod; - private Method arrayMethod; - private Method nullParamMethod; - private Method primitiveMethod; - private Method checkedMethod; - private Method runtimeMethod; - - public StaticPojoInvokerTestCase() { - - } - - public StaticPojoInvokerTestCase(String arg0) { - super(arg0); - } - - public void setUp() throws Exception { - echoMethod = TestBean.class.getDeclaredMethod("echo", String.class); - arrayMethod = TestBean.class.getDeclaredMethod("arrayEcho", String[].class); - nullParamMethod = TestBean.class.getDeclaredMethod("nullParam", (Class[]) null); - primitiveMethod = TestBean.class.getDeclaredMethod("primitiveEcho", TYPE); - checkedMethod = TestBean.class.getDeclaredMethod("checkedException", (Class[]) null); - runtimeMethod = TestBean.class.getDeclaredMethod("runtimeException", (Class[]) null); - Assert.assertNotNull(echoMethod); - Assert.assertNotNull(checkedMethod); - Assert.assertNotNull(runtimeMethod); - } - - public void testObjectInvoke() throws Throwable { - TestBean bean = new TestBean(); - StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(echoMethod, bean); - Object ret = invoker.invokeTarget("foo"); - Assert.assertEquals("foo", ret); - } - - public void testArrayInvoke() throws Throwable { - TestBean bean = new TestBean(); - StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(arrayMethod, bean); - String[] args = new String[]{"foo", "bar"}; - Object ret = invoker.invokeTarget(new Object[]{args}); - String[] retA = (String[]) ret; - Assert.assertNotNull(retA); - Assert.assertEquals(2, retA.length); - Assert.assertEquals("foo", retA[0]); - Assert.assertEquals("bar", retA[1]); - } - - public void testNullInvoke() throws Throwable { - TestBean bean = new TestBean(); - StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(nullParamMethod, bean); - Object ret = invoker.invokeTarget(null); - String retS = (String) ret; - Assert.assertEquals("foo", retS); - } - - public void testPrimitiveInvoke() throws Throwable { - TestBean bean = new TestBean(); - StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(primitiveMethod, bean); - Object ret = invoker.invokeTarget(new Integer[]{1}); - Integer retI = (Integer) ret; - Assert.assertEquals(1, retI.intValue()); - } - - public void testInvokeCheckedException() throws Throwable { - TestBean bean = new TestBean(); - StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(checkedMethod, bean); - try { - invoker.invokeTarget(null); - } catch (InvocationTargetException e) { - if (e.getCause() != null && TestException.class.equals(e.getCause().getClass())) { - return; - } - } catch (Throwable e) { - } - fail(TestException.class.getName() + " should have been thrown"); - } - - public void testInvokeRuntimeException() throws Throwable { - TestBean bean = new TestBean(); - StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(runtimeMethod, bean); - try { - invoker.invokeTarget(null); - } catch (InvocationTargetException e) { - if (e.getCause() != null && e.getCause() instanceof TestRuntimeException) { - return; - } - } - fail(TestException.class.getName() + " should have been thrown"); - } - - private class TestBean { - - public String echo(String msg) throws Exception { - Assert.assertEquals("foo", msg); - return msg; - } - - public String[] arrayEcho(String[] msg) throws Exception { - Assert.assertNotNull(msg); - Assert.assertEquals(2, msg.length); - Assert.assertEquals("foo", msg[0]); - Assert.assertEquals("bar", msg[1]); - return msg; - } - - public String nullParam() throws Exception { - return "foo"; - } - - public int primitiveEcho(int i) throws Exception { - return i; - } - - public void checkedException() throws TestException { - throw new TestException(); - } - - public void runtimeException() throws TestRuntimeException { - throw new TestRuntimeException(); - } - } - - public class TestException extends Exception { - } - - public class TestRuntimeException extends RuntimeException { - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java deleted file mode 100644 index cda09e8540..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.invocation.mock; - -import org.apache.tuscany.core.wire.MessageHandler; -import org.apache.tuscany.core.message.Message; - -/** - * - */ -public class MockHandler implements MessageHandler { - - private int count =0; - - public boolean processMessage(Message message) { - //System.out.println("Invoking handler"); - count++; - return true; - } - - public int getCount(){ - return count; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockSyncInterceptor.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockSyncInterceptor.java deleted file mode 100644 index 24b22a641a..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockSyncInterceptor.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.invocation.mock; - -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.message.Message; - -public class MockSyncInterceptor implements Interceptor { - - private int count; - - private Interceptor next; - - public MockSyncInterceptor() { - } - - public Message invoke(Message msg) { - ++count; - //System.out.println("Invoking interceptor"); - return next.invoke(msg); - } - - public int getCount() { - return count; - } - - public void setNext(Interceptor next) { - this.next=next; - } -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSource.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSource.java deleted file mode 100644 index 213caab7e9..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSource.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.invocation.mock; - -public interface SimpleSource { - - public void invokeHello() throws Exception; - - public void invokeGoodbye() throws Exception; -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSourceImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSourceImpl.java deleted file mode 100644 index 2e7bd75f11..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSourceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.invocation.mock; - -public class SimpleSourceImpl implements SimpleSource { - - private SimpleTarget proxy; - - public SimpleSourceImpl(SimpleTarget proxy) { - this.proxy = proxy; - } - - public void invokeHello() throws Exception { - proxy.hello("hello"); - } - - public void invokeGoodbye() throws Exception { - proxy.goodbye("hello"); - } - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTarget.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTarget.java deleted file mode 100644 index cbd3037529..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTarget.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.invocation.mock; - -public interface SimpleTarget { - - public String hello(String message) throws Exception; - - public String goodbye(String message) throws Exception; - - public String echo(String message) throws Exception; - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTargetImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTargetImpl.java deleted file mode 100644 index 18abf6108a..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTargetImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.invocation.mock; - -public class SimpleTargetImpl implements SimpleTarget { - - public SimpleTargetImpl() { - super(); - } - - public String hello(String message) throws Exception { - return message; - } - - public String goodbye(String message) throws Exception { - return message; - } - - public String echo(String message) throws Exception { - return message; - } - - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/loader/JavaImplementationLoaderTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/loader/JavaImplementationLoaderTestCase.java deleted file mode 100644 index 85e79d8780..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/loader/JavaImplementationLoaderTestCase.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.loader; - -import java.net.URL; -import java.util.List; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.namespace.QName; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; -import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl; -import org.apache.tuscany.container.java.assembly.mock.HelloWorldImpl; -import org.apache.tuscany.container.java.assembly.mock.HelloWorldWithFieldProperties; -import org.apache.tuscany.container.java.assembly.mock.NakedHelloWorld; -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.loader.LoaderContext; -import org.apache.tuscany.core.loader.assembly.AssemblyConstants; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.Service; - -/** - * @version $Rev$ $Date$ - */ -public class JavaImplementationLoaderTestCase extends TestCase { - private JavaImplementationLoader loader; - private ComponentType mockType; - - public void testNakedHelloWorld() throws ConfigurationLoadException { - ComponentType type = loader.loadComponentTypeByIntrospection(NakedHelloWorld.class); - Assert.assertNotNull(type); - Assert.assertEquals(1,type.getProperties().size()); - Assert.assertTrue(type.getReferences().isEmpty()); - List<Service> services = type.getServices(); - Assert.assertEquals(1, services.size()); - Assert.assertEquals("NakedHelloWorld", services.get(0).getName()); - } - - public void testHelloWorldWithSidefile() throws XMLStreamException, ConfigurationLoadException { - StAXLoaderRegistry mockRegistry = new MockRegistry(mockType); - loader.setRegistry(mockRegistry); - URL sidefile = HelloWorldImpl.class.getResource("HelloWorldImpl.componentType"); - ComponentType type = loader.loadComponentTypeFromSidefile(sidefile, null); - assertSame(mockType, type); - } - - public void testHelloWorldWithFieldProperties() throws ConfigurationLoadException { - ComponentType type = loader.loadComponentTypeByIntrospection(HelloWorldWithFieldProperties.class); - type.initialize(null); - Assert.assertNotNull(type); - List<Property> props = type.getProperties(); - Assert.assertEquals(5, props.size()); - - Property prop = type.getProperty("text"); - Assert.assertNotNull(prop); - Assert.assertEquals("text", prop.getName()); - Assert.assertEquals(false, prop.isRequired()); - Assert.assertEquals(String.class, prop.getType()); - - prop = type.getProperty("text2"); - Assert.assertNotNull(prop); - Assert.assertEquals("text2", prop.getName()); - Assert.assertEquals(true, prop.isRequired()); - Assert.assertEquals(Integer.class, prop.getType()); - - prop = type.getProperty("foo"); - Assert.assertNotNull(prop); - Assert.assertEquals("foo", prop.getName()); - Assert.assertEquals(false, prop.isRequired()); - Assert.assertEquals(Integer.TYPE, prop.getType()); - } - - protected void setUp() throws Exception { - super.setUp(); - JavaAssemblyFactory factory = new JavaAssemblyFactoryImpl(); - mockType = factory.createComponentType(); - - loader = new JavaImplementationLoader(); - loader.setFactory(factory); - } - - private static class MockRegistry implements StAXLoaderRegistry { - private final ComponentType mockType; - - public MockRegistry(ComponentType mockType) { - this.mockType = mockType; - } - - public AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assertEquals(AssemblyConstants.COMPONENT_TYPE, reader.getName()); - return mockType; - } - - public <T extends AssemblyObject> void registerLoader(QName element, StAXElementLoader<T> loader) { - throw new UnsupportedOperationException(); - } - - public <T extends AssemblyObject> void unregisterLoader(QName element, StAXElementLoader<T> loader) { - throw new UnsupportedOperationException(); - } - - @Deprecated - public AssemblyContext getContext() { - throw new UnsupportedOperationException(); - } - - @Deprecated - public void setContext(AssemblyContext context) { - throw new UnsupportedOperationException(); - } - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockConfigContext.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockConfigContext.java deleted file mode 100644 index 9cb1998d68..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockConfigContext.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.builder.impl.AssemblyVisitorImpl; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.context.ConfigurationContext; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.model.assembly.AssemblyObject; - -/** - * A mock configuration context - * - * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ - */ -public class MockConfigContext implements ConfigurationContext { - - private List<ContextFactoryBuilder> builders; - - private DefaultWireBuilder wireBuilder = new DefaultWireBuilder(); - - public MockConfigContext(List<ContextFactoryBuilder> builders, List<WireBuilder> wireBuilders) { - this.builders = (builders == null) ? new ArrayList(1) : builders; - if (wireBuilders != null){ - for (WireBuilder builder : wireBuilders) { - wireBuilder.addWireBuilder(builder); - } - } - } - - public void build(AssemblyObject model) throws BuilderConfigException { - AssemblyVisitorImpl visitor = new AssemblyVisitorImpl(builders); - visitor.start(model); - } - - public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) throws BuilderConfigException { - wireBuilder.connect(sourceFactory, targetFactory, targetType, downScope, targetScopeContext); - } - - public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) throws BuilderConfigException { - wireBuilder.completeTargetChain(targetFactory, targetType, targetScopeContext); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockContextFactory.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockContextFactory.java deleted file mode 100644 index 4e00e4c236..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockContextFactory.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock; - -import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; -import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl; -import org.apache.tuscany.container.java.config.JavaContextFactory; -import org.apache.tuscany.container.java.scopes.OrderedDependentPojo; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.injection.ObjectCreationException; -import org.apache.tuscany.core.injection.EventInvoker; -import org.apache.tuscany.core.injection.MethodEventInvoker; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class MockContextFactory { - - private MockContextFactory(){} - - /** - * Wires together a source and target - * @throws NoSuchMethodException - */ - public static List<ContextFactory<Context>> createWiredContexts(Scope scope, ScopeContext context) throws NoSuchMethodException{ - - Constructor constructor = JavaIntrospectionHelper.getDefaultConstructor(OrderedDependentPojo.class); - Method getPojo = OrderedDependentPojo.class.getMethod("setPojo",OrderedDependentPojo.class); - Method init = OrderedDependentPojo.class.getMethod("init",(Class[])null); - EventInvoker<Object> initInvoker = new MethodEventInvoker<Object>(init); - Method destroy = OrderedDependentPojo.class.getMethod("destroy",(Class[])null); - EventInvoker<Object> destroyInvoker = new MethodEventInvoker<Object>(destroy); - - JavaContextFactory source = new JavaContextFactory("source",constructor,scope); - source.setInitInvoker(initInvoker); - source.setDestroyInvoker(destroyInvoker); - JavaContextFactory target = new JavaContextFactory("target",constructor,scope); - target.setInitInvoker(initInvoker); - target.setDestroyInvoker(destroyInvoker); - List<Injector> injectors = new ArrayList<Injector>(); - injectors.add(new MethodInjector(getPojo, new MockTargetFactory("target",context))); - source.setSetters(injectors); - List<ContextFactory<Context>> list = new ArrayList<ContextFactory<Context>>(); - list.add((ContextFactory)source); - list.add((ContextFactory)target); - return list; - } - - private static class MockTargetFactory implements ObjectFactory{ - - private String name; - private ScopeContext context; - - public MockTargetFactory (String name, ScopeContext context){ - this.name = name; - this.context = context; - } - - public Object getInstance() throws ObjectCreationException { - return context.getContext(name).getInstance(null); - } - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java deleted file mode 100644 index 3b45352865..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java +++ /dev/null @@ -1,819 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import junit.framework.Assert; -import org.apache.tuscany.common.monitor.MonitorFactory; -import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; -import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; -import org.apache.tuscany.container.java.assembly.JavaImplementation; -import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl; -import org.apache.tuscany.container.java.assembly.mock.HelloWorldImpl; -import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.builder.JavaTargetWireBuilder; -import org.apache.tuscany.container.java.context.JavaAtomicContext; -import org.apache.tuscany.container.java.mock.binding.foo.FooBinding; -import org.apache.tuscany.container.java.mock.binding.foo.FooBindingBuilder; -import org.apache.tuscany.container.java.mock.binding.foo.FooBindingWireBuilder; -import org.apache.tuscany.container.java.mock.components.GenericComponent; -import org.apache.tuscany.container.java.mock.components.HelloWorldClient; -import org.apache.tuscany.container.java.mock.components.ModuleScopeComponent; -import org.apache.tuscany.container.java.mock.components.ModuleScopeComponentImpl; -import org.apache.tuscany.container.java.mock.components.OtherTarget; -import org.apache.tuscany.container.java.mock.components.OtherTargetImpl; -import org.apache.tuscany.container.java.mock.components.Source; -import org.apache.tuscany.container.java.mock.components.SourceImpl; -import org.apache.tuscany.container.java.mock.components.Target; -import org.apache.tuscany.container.java.mock.components.TargetImpl; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; -import org.apache.tuscany.core.client.BootstrapHelper; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.config.processor.ProcessorUtils; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.SystemCompositeContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.injection.EventInvoker; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodEventInvoker; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.injection.PojoObjectFactory; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.runtime.RuntimeContextImpl; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.SystemBinding; -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.context.SystemCompositeContextImpl; -import org.apache.tuscany.core.wire.WireFactoryFactory; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AtomicComponent; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; -import org.apache.tuscany.model.types.java.JavaServiceContract; -import org.osoa.sca.annotations.ComponentName; -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; - -/** - * Generates test components, modules, and runtime artifacts - * - * @version $Rev$ $Date$ - */ -public class MockFactory { - - public static final String JAVA_BUILDER = "java.runtime.builder"; - public static final String MESSAGE_FACTORY = "java.runtime.messageFactory"; - public static final String PROXY_FACTORY_FACTORY = "java.runtime.wireFactoryFactory"; - public static final String WIRE_FACTORY_SERVICE = "java.runtime.wireFactoryservice"; - public static final String JAVA_WIRE_BUILDER = "java.wire.builder"; - public static final String FOO_BUILDER = "foo.binding.builder"; - public static final String FOO_WIRE_BUILDER = "foo.binding.wire.builder"; - public static final String POLICY_BUILDER_REGISTRY = "foo.binding.policy.registry"; - public static final String SYSTEM_CHILD = "tuscany.system.child"; - - private static JavaAssemblyFactory factory = new JavaAssemblyFactoryImpl(); - private static SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); - private static AssemblyContext assemblyContext = new AssemblyContextImpl(null, null); - private static ComponentTypeIntrospector introspector; - private static ComponentType systemComponentType; - private static ComponentType compositeComponentType; - - public static ComponentType getComponentType() throws ConfigurationLoadException { - if (systemComponentType == null) { - systemComponentType = getIntrospector().introspect(SystemCompositeContextImpl.class); - } - return systemComponentType; - } - - public static ComponentType getCompositeComponentType() throws ConfigurationLoadException { - if (compositeComponentType == null) { - compositeComponentType = getIntrospector().introspect(CompositeContextImpl.class); - } - return compositeComponentType; - } - - public static ComponentTypeIntrospector getIntrospector() { - if (introspector == null) { - introspector = ProcessorUtils.createCoreIntrospector(systemFactory); - } - return introspector; - } - - /** - * Creates an initialized simple component - * - * @param name the component name - * @param type the implementation type - * @param scope the component scope - */ - public static AtomicComponent createComponent(String name, Class type, Scope scope) throws ConfigurationLoadException { - AtomicComponent sc = factory.createSimpleComponent(); - JavaImplementation impl = factory.createJavaImplementation(); - impl.setComponentType(getIntrospector().introspect(type)); - impl.setImplementationClass(type); - sc.setImplementation(impl); - Service s = factory.createService(); - JavaServiceContract ji = factory.createJavaServiceContract(); - ji.setInterface(type); - s.setServiceContract(ji); - ji.setScope(scope); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setImplementation(impl); - return sc; - } - - public static AtomicComponent createNonIntrospectedComponent(String name, Class service, Class type, Scope scope) throws ConfigurationLoadException { - AtomicComponent sc = factory.createSimpleComponent(); - JavaImplementation impl = factory.createJavaImplementation(); - impl.setComponentType(factory.createComponentType()); - impl.setImplementationClass(type); - sc.setImplementation(impl); - Service s = factory.createService(); - JavaServiceContract ji = factory.createJavaServiceContract(); - ji.setInterface(service); - s.setServiceContract(ji); - ji.setScope(scope); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setImplementation(impl); - return sc; - } - - - /** - * Creates an composite component with the given name - */ - public static Component createCompositeComponent(String name) throws ConfigurationLoadException { - Component sc = systemFactory.createModuleComponent(); - Module impl = systemFactory.createModule(); - impl.setName(name); - //impl.setImplementationClass(CompositeContextImpl.class); - sc.setImplementation(impl); - Service s = systemFactory.createService(); - JavaServiceContract ji = systemFactory.createJavaServiceContract(); - s.setServiceContract(ji); - ji.setScope(Scope.AGGREGATE); - //impl.setComponentType(systemFactory.createComponentType()); - impl.setImplementationClass(CompositeContextImpl.class); - impl.setComponentType(getCompositeComponentType()); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setImplementation(impl); - - return sc; - } - - /** - * Creates a system composite component with the given name - */ - public static Component createSystemCompositeComponent(String name) throws ConfigurationLoadException { - Component sc = systemFactory.createModuleComponent(); - Module impl = systemFactory.createSystemModule(); - impl.setName(name); - //impl.setImplementationClass(SystemCompositeContextImpl.class); - sc.setImplementation(impl); - Service s = systemFactory.createService(); - JavaServiceContract ji = systemFactory.createJavaServiceContract(); - s.setServiceContract(ji); - ji.setScope(Scope.AGGREGATE); - impl.setComponentType(getComponentType()); - //impl.setComponentType(systemFactory.createComponentType()); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setImplementation(impl); - return sc; - } - - /** - * Creates an external service configured with the 'Foo' test binding - */ - public static ExternalService createFooBindingExternalService(String name, Class interfaz) { - ExternalService es = factory.createExternalService(); - es.setName(name); - Service s = factory.createService(); - JavaServiceContract ji = factory.createJavaServiceContract(); - ji.setScope(Scope.MODULE); - ji.setInterface(interfaz); - s.setServiceContract(ji); - ConfiguredService configuredService = factory.createConfiguredService(); - es.setConfiguredService(configuredService); - - FooBinding binding = new FooBinding(); - es.getBindings().add(binding); - return es; - } - - /** - * Creates an entry point with the given name configured with the given interface and the {@link - * FooBinding} - */ - public static EntryPoint createFooBindingEntryPoint(String name, Class interfaz) { - EntryPoint ep = factory.createEntryPoint(); - ep.setName(name); - Service s = factory.createService(); - JavaServiceContract ji = factory.createJavaServiceContract(); - ji.setScope(Scope.MODULE); - ji.setInterface(interfaz); - s.setServiceContract(ji); - ConfiguredService configuredService = factory.createConfiguredService(); - configuredService.setPort(s); - ep.setConfiguredService(configuredService); - FooBinding binding = new FooBinding(); - ep.getBindings().add(binding); - return ep; - } - - /** - * Creates an external service configured with a {@link SystemBinding} - */ - public static ExternalService createESSystemBinding(String name, String refName) { - ExternalService es = systemFactory.createExternalService(); - es.setName(name); - ConfiguredService configuredService = systemFactory.createConfiguredService(); - es.setConfiguredService(configuredService); - SystemBinding binding = systemFactory.createSystemBinding(); - binding.setTargetName(refName); - es.getBindings().add(binding); - es.initialize(null); - return es; - } - - /** - * Creates a module with a Java-based "target" module-scoped component wired to a module-scoped "source" - */ - public static Module createModule() throws ConfigurationLoadException { - return createModule(Scope.MODULE, Scope.MODULE); - } - - /** - * Creates a module with a Java-based "target" component wired to a "source" - */ - public static Module createModule(Scope sourceScope, Scope targetScope) throws ConfigurationLoadException { - Component sourceComponent = createNonIntrospectedComponent("source", ModuleScopeComponent.class, ModuleScopeComponentImpl.class, sourceScope); - Component targetComponent = createNonIntrospectedComponent("target", ModuleScopeComponent.class, ModuleScopeComponentImpl.class, targetScope); - - Service targetService = factory.createService(); - JavaServiceContract targetContract = factory.createJavaServiceContract(); - targetContract.setInterface(GenericComponent.class); - targetService.setServiceContract(targetContract); - targetService.setName("GenericComponent"); - targetContract.setScope(targetScope); - ConfiguredService cTargetService = factory.createConfiguredService(); - cTargetService.setPort(targetService); - cTargetService.initialize(assemblyContext); - targetComponent.getConfiguredServices().add(cTargetService); - targetComponent.initialize(assemblyContext); - - Reference ref = factory.createReference(); - ref.setName("setGenericComponent"); - JavaServiceContract inter = factory.createJavaServiceContract(); - inter.setInterface(GenericComponent.class); - ref.setServiceContract(inter); - sourceComponent.getImplementation().getComponentType().getReferences().add(ref); - - ConfiguredReference cref = factory.createConfiguredReference("setGenericComponent", "target"); - cref.initialize(assemblyContext); - sourceComponent.getConfiguredReferences().add(cref); - sourceComponent.initialize(assemblyContext); - - Module module = factory.createModule(); - module.setName("test.module"); - module.getComponents().add(sourceComponent); - module.getComponents().add(targetComponent); - module.initialize(assemblyContext); - return module; - } - - /** - * Creates a module with a Java-based source component wired to a "target" external service configured - * with the {@link FooBinding} - */ - public static Module createModuleWithExternalService() throws ConfigurationLoadException { - Component sourceComponent = createComponent("source", HelloWorldClient.class, Scope.MODULE); - ExternalService targetES = createFooBindingExternalService("target", HelloWorldService.class); - - Service targetService = factory.createService(); - JavaServiceContract targetContract = factory.createJavaServiceContract(); - targetContract.setInterface(HelloWorldService.class); - targetService.setServiceContract(targetContract); - targetService.setName("HelloWorld"); - ConfiguredService cTargetService = factory.createConfiguredService(); - cTargetService.setPort(targetService); - targetES.setConfiguredService(cTargetService); - targetES.initialize(assemblyContext); - - Reference ref = factory.createReference(); - ref.setName("setHelloWorldService"); - JavaServiceContract inter = factory.createJavaServiceContract(); - inter.setInterface(HelloWorldService.class); - ref.setServiceContract(inter); - sourceComponent.getImplementation().getComponentType().getReferences().add(ref); - - ConfiguredReference cref = factory.createConfiguredReference(ref.getName(), "target"); - cref.initialize(assemblyContext); - sourceComponent.getConfiguredReferences().add(cref); - sourceComponent.initialize(assemblyContext); - - Module module = factory.createModule(); - module.setName("test.module"); - module.getComponents().add(sourceComponent); - module.getExternalServices().add(targetES); - module.initialize(assemblyContext); - return module; - } - - /** - * Creates a module with an entry point named "source" configured with the {@link FooBinding} wired to a - * service offered by a Java-based component named "target" - * - * @param scope the scope of the target service - */ - public static Module createModuleWithEntryPoint(Scope scope) throws ConfigurationLoadException { - Component targetComponent = createComponent("target", HelloWorldImpl.class, scope); - - Service targetService = factory.createService(); - JavaServiceContract targetContract = factory.createJavaServiceContract(); - targetContract.setInterface(HelloWorldService.class); - targetService.setServiceContract(targetContract); - targetService.setName("HelloWorldService"); - ConfiguredService cTargetService = factory.createConfiguredService(); - cTargetService.setPort(targetService); - targetComponent.getConfiguredServices().add(cTargetService); - targetComponent.initialize(assemblyContext); - - Reference ref = factory.createReference(); - ConfiguredReference cref = factory.createConfiguredReference(); - ref.setName("setHelloWorldService"); - JavaServiceContract inter = factory.createJavaServiceContract(); - inter.setInterface(HelloWorldService.class); - ref.setServiceContract(inter); - cref.setPort(ref); - cref.getTargetConfiguredServices().add(cTargetService); - cref.initialize(assemblyContext); - - EntryPoint sourceEP = createFooBindingEntryPoint("source", HelloWorldService.class); - sourceEP.setConfiguredReference(cref); - sourceEP.getConfiguredService().getPort().setName("HelloWorldService"); - sourceEP.initialize(assemblyContext); - - Module module = factory.createModule(); - module.setName("test.module"); - module.getEntryPoints().add(sourceEP); - module.getComponents().add(targetComponent); - module.setImplementationClass(CompositeContextImpl.class); - module.setComponentType(getCompositeComponentType()); - module.initialize(assemblyContext); - return module; - } - - /** - * Creates a module with an entry point wired to a "target" external service configured with the {@link - * FooBinding} - */ - public static Module createModuleWithEntryPointToExternalService() { - //Component sourceComponent = createComponent("source", HelloWorldClient.class, Scope.MODULE); - - EntryPoint sourceEP = createFooBindingEntryPoint("source", HelloWorldService.class); - sourceEP.getConfiguredService().getPort().setName("HelloWorldService"); - sourceEP.initialize(assemblyContext); - - - ExternalService targetES = createFooBindingExternalService("target", HelloWorldService.class); - - Service targetService = factory.createService(); - JavaServiceContract targetContract = factory.createJavaServiceContract(); - targetContract.setInterface(HelloWorldService.class); - targetService.setServiceContract(targetContract); - targetService.setName("HelloWorld"); - ConfiguredService cTargetService = factory.createConfiguredService(); - cTargetService.setPort(targetService); - targetES.setConfiguredService(cTargetService); - targetES.initialize(assemblyContext); - - Reference ref = factory.createReference(); - ref.setName("setHelloWorldService"); - JavaServiceContract inter = factory.createJavaServiceContract(); - inter.setInterface(HelloWorldService.class); - ref.setServiceContract(inter); - - - ConfiguredReference cref = factory.createConfiguredReference(ref.getName(), "target"); - cref.setPort(ref); - cref.initialize(assemblyContext); - sourceEP.setConfiguredReference(cref); - sourceEP.initialize(assemblyContext); - - Module module = factory.createModule(); - module.setName("test.module"); - module.getEntryPoints().add(sourceEP); - module.getExternalServices().add(targetES); - module.initialize(assemblyContext); - return module; - } - - - /** - * Creates a test system module with source and target components wired together. - * - * @see org.apache.tuscany.core.mock.component.Source - * @see org.apache.tuscany.core.mock.component.Target - */ - - public static Module createModuleWithWiredComponents(Scope sourceScope, Scope targetScope) { - - // create the target component - AtomicComponent target = factory.createSimpleComponent(); - target.setName("target"); - JavaImplementation targetImpl = factory.createJavaImplementation(); - targetImpl.setComponentType(factory.createComponentType()); - targetImpl.setImplementationClass(TargetImpl.class); - target.setImplementation(targetImpl); - Service targetService = factory.createService(); - JavaServiceContract targetContract = factory.createJavaServiceContract(); - targetContract.setInterface(Target.class); - targetService.setServiceContract(targetContract); - targetService.setName("Target"); - targetImpl.getComponentType().getServices().add(targetService); - targetContract.setScope(targetScope); - ConfiguredService cTargetService = factory.createConfiguredService(); - cTargetService.setPort(targetService); - cTargetService.initialize(assemblyContext); - target.getConfiguredServices().add(cTargetService); - target.initialize(assemblyContext); - - // create the source component - AtomicComponent source = factory.createSimpleComponent(); - ComponentType componentType = factory.createComponentType(); - source.setName("source"); - JavaImplementation impl = factory.createJavaImplementation(); - impl.setComponentType(componentType); - impl.setImplementationClass(SourceImpl.class); - source.setImplementation(impl); - Service s = systemFactory.createService(); - JavaServiceContract contract = systemFactory.createJavaServiceContract(); - contract.setInterface(Source.class); - s.setServiceContract(contract); - contract.setScope(sourceScope); - impl.getComponentType().getServices().add(s); - source.setImplementation(impl); - - // wire source to target - JavaServiceContract refContract = systemFactory.createJavaServiceContract(); - refContract.setInterface(Target.class); - Reference reference = systemFactory.createReference(); - reference.setName("setTarget"); - reference.setServiceContract(refContract); - componentType.getReferences().add(reference); - ConfiguredReference cReference = systemFactory.createConfiguredReference(reference.getName(), "target"); - cReference.initialize(assemblyContext); - source.getConfiguredReferences().add(cReference); - - // wire multiplicity using a setter - JavaServiceContract refContract2 = systemFactory.createJavaServiceContract(); - refContract2.setInterface(Target.class); - Reference reference2 = systemFactory.createReference(); - reference2.setName("setTargets"); - reference2.setServiceContract(refContract2); - reference2.setMultiplicity(Multiplicity.ONE_N); - componentType.getReferences().add(reference2); - ConfiguredReference cReference2 = systemFactory.createConfiguredReference(reference2.getName(), "target"); - cReference2.initialize(assemblyContext); - source.getConfiguredReferences().add(cReference2); - - // wire multiplicity using a field - JavaServiceContract refContract3 = systemFactory.createJavaServiceContract(); - refContract3.setInterface(Target.class); - Reference reference3 = systemFactory.createReference(); - reference3.setName("targetsThroughField"); - reference3.setServiceContract(refContract3); - reference3.setMultiplicity(Multiplicity.ONE_N); - componentType.getReferences().add(reference3); - ConfiguredReference cReference3 = systemFactory.createConfiguredReference(reference3.getName(), "target"); - cReference3.initialize(assemblyContext); - source.getConfiguredReferences().add(cReference3); - - // wire multiplicity using a array - JavaServiceContract refContract4 = systemFactory.createJavaServiceContract(); - refContract4.setInterface(Target.class); - Reference reference4 = systemFactory.createReference(); - reference4.setName("setArrayOfTargets"); - reference4.setServiceContract(refContract4); - reference4.setMultiplicity(Multiplicity.ONE_N); - componentType.getReferences().add(reference4); - ConfiguredReference cReference4 = systemFactory.createConfiguredReference(reference4.getName(), "target"); - cReference4.initialize(assemblyContext); - source.getConfiguredReferences().add(cReference4); - - source.initialize(assemblyContext); - - Module module = systemFactory.createModule(); - module.setName("system.module"); - - module.getComponents().add(source); - module.getComponents().add(target); - module.initialize(assemblyContext); - return module; - } - - - /** - * Creates a test system module with source and target components wired together. - * - * @see org.apache.tuscany.core.mock.component.Source - * @see org.apache.tuscany.core.mock.component.Target - */ - - public static Module createModuleWithWiredComponentsOfDifferentInterface(Scope sourceScope, Scope targetScope) { - - // create the target component - AtomicComponent target = factory.createSimpleComponent(); - target.setName("target"); - JavaImplementation targetImpl = factory.createJavaImplementation(); - targetImpl.setComponentType(factory.createComponentType()); - targetImpl.setImplementationClass(OtherTargetImpl.class); - target.setImplementation(targetImpl); - Service targetService = factory.createService(); - JavaServiceContract targetContract = factory.createJavaServiceContract(); - targetContract.setInterface(OtherTarget.class); - targetService.setServiceContract(targetContract); - targetService.setName("Target"); - targetImpl.getComponentType().getServices().add(targetService); - targetContract.setScope(targetScope); - ConfiguredService cTargetService = factory.createConfiguredService(); - cTargetService.setPort(targetService); - cTargetService.initialize(assemblyContext); - target.getConfiguredServices().add(cTargetService); - target.initialize(assemblyContext); - - // create the source component - AtomicComponent source = factory.createSimpleComponent(); - ComponentType componentType = factory.createComponentType(); - source.setName("source"); - JavaImplementation impl = factory.createJavaImplementation(); - impl.setComponentType(componentType); - impl.setImplementationClass(SourceImpl.class); - source.setImplementation(impl); - Service s = systemFactory.createService(); - JavaServiceContract contract = systemFactory.createJavaServiceContract(); - contract.setInterface(Source.class); - s.setServiceContract(contract); - contract.setScope(sourceScope); - impl.getComponentType().getServices().add(s); - source.setImplementation(impl); - - // wire source to target - JavaServiceContract refContract = systemFactory.createJavaServiceContract(); - refContract.setInterface(Target.class); - Reference reference = systemFactory.createReference(); - reference.setName("setTarget"); - reference.setServiceContract(refContract); - componentType.getReferences().add(reference); - ConfiguredReference cReference = systemFactory.createConfiguredReference(reference.getName(), "target"); - cReference.initialize(assemblyContext); - source.getConfiguredReferences().add(cReference); - - // wire multiplicity using a setter - JavaServiceContract refContract2 = systemFactory.createJavaServiceContract(); - refContract2.setInterface(Target.class); - Reference reference2 = systemFactory.createReference(); - reference2.setName("setTargets"); - reference2.setServiceContract(refContract2); - reference2.setMultiplicity(Multiplicity.ONE_N); - componentType.getReferences().add(reference2); - ConfiguredReference cReference2 = systemFactory.createConfiguredReference(reference2.getName(), "target"); - cReference2.initialize(assemblyContext); - source.getConfiguredReferences().add(cReference2); - - // wire multiplicity using a field - JavaServiceContract refContract3 = systemFactory.createJavaServiceContract(); - refContract3.setInterface(Target.class); - Reference reference3 = systemFactory.createReference(); - reference3.setName("targetsThroughField"); - reference3.setServiceContract(refContract3); - reference3.setMultiplicity(Multiplicity.ONE_N); - componentType.getReferences().add(reference3); - ConfiguredReference cReference3 = systemFactory.createConfiguredReference(reference3.getName(), "target"); - cReference3.initialize(assemblyContext); - source.getConfiguredReferences().add(cReference3); - - // wire multiplicity using a array - JavaServiceContract refContract4 = systemFactory.createJavaServiceContract(); - refContract4.setInterface(Target.class); - Reference reference4 = systemFactory.createReference(); - reference4.setName("setArrayOfTargets"); - reference4.setServiceContract(refContract4); - reference4.setMultiplicity(Multiplicity.ONE_N); - componentType.getReferences().add(reference4); - ConfiguredReference cReference4 = systemFactory.createConfiguredReference(reference4.getName(), "target"); - cReference4.initialize(assemblyContext); - source.getConfiguredReferences().add(cReference4); - - source.initialize(assemblyContext); - - Module module = systemFactory.createModule(); - module.setName("system.module"); - - module.getComponents().add(source); - module.getComponents().add(target); - module.initialize(assemblyContext); - return module; - } - - - /** - * Returns a collection of bootstrap configuration builders - */ - public static List<ContextFactoryBuilder> createSystemBuilders() { - List<ContextFactoryBuilder> builders = new ArrayList<ContextFactoryBuilder>(); - builders.add((new SystemContextFactoryBuilder(null))); - builders.add(new SystemEntryPointBuilder()); - builders.add(new SystemExternalServiceBuilder()); - return builders; - } - - /** - * Creates an composite context faxtory - * - * @param name the name of the component - * @throws BuilderException - * @see ContextFactory - */ - public static ContextFactory<Context> createCompositeConfiguration(String name - ) throws BuilderException, ConfigurationLoadException { - - Component sc = createCompositeComponent(name); - SystemContextFactoryBuilder builder = new SystemContextFactoryBuilder(null); - builder.build(sc); - return (ContextFactory<Context>) sc.getContextFactory(); - } - - /** - * Creates a Java POJO component context - * - * @param name the name of the context - * @param implType the POJO class - * @param scope the component scope - * @param moduleComponentContext the containing composite context - * @throws NoSuchMethodException if the POJO does not have a default noi-args constructor - */ - public static JavaAtomicContext createPojoContext(String name, Class implType, Scope scope, - CompositeContext moduleComponentContext) throws NoSuchMethodException, ConfigurationLoadException { - AtomicComponent component = createComponent(name, implType, scope); - - Set<Field> fields = JavaIntrospectionHelper.getAllFields(implType); - Set<Method> methods = JavaIntrospectionHelper.getAllUniqueMethods(implType); - List<Injector> injectors = new ArrayList<Injector>(); - - EventInvoker initInvoker = null; - boolean eagerInit = false; - EventInvoker destroyInvoker = null; - for (Field field : fields) { - ComponentName compName = field.getAnnotation(ComponentName.class); - if (compName != null) { - Injector injector = new FieldInjector(field, new SingletonObjectFactory(name)); - injectors.add(injector); - } - org.osoa.sca.annotations.Context context = field.getAnnotation(org.osoa.sca.annotations.Context.class); - if (context != null) { - Injector injector = new FieldInjector(field, new SingletonObjectFactory(moduleComponentContext)); - injectors.add(injector); - } - } - for (Method method : methods) { - // FIXME Java5 - Init init = method.getAnnotation(Init.class); - if (init != null && initInvoker == null) { - initInvoker = new MethodEventInvoker(method); - eagerInit = init.eager(); - continue; - } - Destroy destroy = method.getAnnotation(Destroy.class); - if (destroy != null && destroyInvoker == null) { - destroyInvoker = new MethodEventInvoker(method); - continue; - } - ComponentName compName = method.getAnnotation(ComponentName.class); - if (compName != null) { - Injector injector = new MethodInjector(method, new SingletonObjectFactory(name)); - injectors.add(injector); - } - org.osoa.sca.annotations.Context context = method.getAnnotation(org.osoa.sca.annotations.Context.class); - if (context != null) { - Injector injector = new MethodInjector(method, new SingletonObjectFactory(moduleComponentContext)); - injectors.add(injector); - } - } - boolean stateless = (scope == Scope.INSTANCE); - return new JavaAtomicContext("foo", new PojoObjectFactory(JavaIntrospectionHelper - .getDefaultConstructor(implType), null, injectors), eagerInit, initInvoker, destroyInvoker, stateless); - } - - /** - * Creates a default {@link RuntimeContext} configured with support for Java component implementations - * - * @throws ConfigurationException - */ - public static RuntimeContext createJavaRuntime() throws ConfigurationException { - MonitorFactory monitorFactory = new NullMonitorFactory(); - ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); - DefaultWireBuilder wireBuilder = new DefaultWireBuilder(); - RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder); - runtime.start(); - runtime.getSystemContext().registerModelObject(createSystemCompositeComponent(SYSTEM_CHILD)); - SystemCompositeContext ctx = (SystemCompositeContext) runtime.getSystemContext().getContext(SYSTEM_CHILD); - Component comp = systemFactory.createSystemComponent(POLICY_BUILDER_REGISTRY, PolicyBuilderRegistry.class, DefaultPolicyBuilderRegistry.class, Scope.MODULE); - comp.getImplementation().setComponentType(getIntrospector().introspect(DefaultPolicyBuilderRegistry.class)); - ctx.registerModelObject(comp); - comp = systemFactory.createSystemComponent(MESSAGE_FACTORY, MessageFactory.class, MessageFactoryImpl.class, Scope.MODULE); - comp.getImplementation().setComponentType(getIntrospector().introspect(MessageFactoryImpl.class)); - ctx.registerModelObject(comp); - comp = systemFactory.createSystemComponent(PROXY_FACTORY_FACTORY, WireFactoryFactory.class, JDKWireFactoryFactory.class, Scope.MODULE); - comp.getImplementation().setComponentType(getIntrospector().introspect(JDKWireFactoryFactory.class)); - ctx.registerModelObject(comp); - comp = systemFactory.createSystemComponent(WIRE_FACTORY_SERVICE, org.apache.tuscany.core.wire.service.WireFactoryService.class, DefaultWireFactoryService.class, Scope.MODULE); - comp.getImplementation().setComponentType(getIntrospector().introspect(DefaultWireFactoryService.class)); - ctx.registerModelObject(comp); - comp = systemFactory.createSystemComponent(JAVA_BUILDER, ContextFactoryBuilder.class, JavaContextFactoryBuilder.class, Scope.MODULE); - comp.getImplementation().setComponentType(getIntrospector().introspect(JavaContextFactoryBuilder.class)); - ctx.registerModelObject(comp); - comp = systemFactory.createSystemComponent(JAVA_WIRE_BUILDER, WireBuilder.class, JavaTargetWireBuilder.class, Scope.MODULE); - comp.getImplementation().setComponentType(getIntrospector().introspect(JavaTargetWireBuilder.class)); - ctx.registerModelObject(comp); - ctx.publish(new ModuleStart(new Object())); - return runtime; - } - - /** - * Registers the {@link FooBinding} builders with a given runtime - * - * @throws ConfigurationException - */ - public static RuntimeContext registerFooBinding(RuntimeContext runtime) throws ConfigurationException { - CompositeContext child = (CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD); - child.getContext(MockFactory.JAVA_BUILDER).getInstance(null); - Component comp = systemFactory.createSystemComponent(FOO_BUILDER, ContextFactoryBuilder.class, FooBindingBuilder.class, Scope.MODULE); - comp.getImplementation().setComponentType(getIntrospector().introspect(FooBindingBuilder.class)); - child.registerModelObject(comp); - comp = systemFactory.createSystemComponent(FOO_WIRE_BUILDER, WireBuilder.class, FooBindingWireBuilder.class, Scope.MODULE); - comp.getImplementation().setComponentType(getIntrospector().introspect(FooBindingWireBuilder.class)); - child.registerModelObject(comp); - // since the child context is already started, we need to manually retrieve the components to init them - Assert.assertNotNull(child.getContext(FOO_BUILDER).getInstance(null)); - Assert.assertNotNull(child.getContext(FOO_WIRE_BUILDER).getInstance(null)); - return runtime; - } - - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockScopeContext.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockScopeContext.java deleted file mode 100644 index fe128f19a7..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockScopeContext.java +++ /dev/null @@ -1,131 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.container.java.invocation.mock.SimpleTargetImpl; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.ContextRuntimeException; -import org.apache.tuscany.core.context.EventFilter; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.RuntimeEventListener; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.ScopeRuntimeException; -import org.apache.tuscany.core.context.event.Event; -import org.apache.tuscany.model.assembly.AtomicComponent; - -public class MockScopeContext implements ScopeContext { - - Map<String, Object> components; - - public MockScopeContext() { - components = new HashMap<String, Object>(); - components.put("foo", new SimpleTargetImpl()); - components.put("bar", new SimpleTargetImpl()); - } - - public MockScopeContext(Map<String,Object> instances) { - components = instances; - } - - - public void start() { - } - - public void stop() { - } - - public void publish(Event object) { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void addListener(RuntimeEventListener listener) throws ContextRuntimeException { - } - - public void addListener(EventFilter filter, RuntimeEventListener listener) { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void removeListener(RuntimeEventListener listener) throws ContextRuntimeException { - } - - public String getName() { - return "Mock Scope Container"; - } - - public boolean isCacheable() { - return false; - } - - public int[] getEventTypes() { - return null; - } - - public AtomicContext getContext(String name) { - return null; - } - - public Object getInstance(QualifiedName name) throws ScopeRuntimeException { - return components.get(name.getPartName()); - } - - public AtomicContext getContextByKey(String name, Object key) { - return null; - } - - public void setComponent(AtomicComponent component) throws ScopeRuntimeException { - } - - public void removeContext(String name) throws ScopeRuntimeException { - } - - public void removeContextByKey(String name, Object key) throws ScopeRuntimeException { - } - - public AtomicComponent[] getComponents() { - return null; - } - - public void registerFactories(List<ContextFactory<Context>> configurations) { - } - - public void registerFactory(ContextFactory<Context> configuration) { - } - - public int getLifecycleState(){ - return RUNNING; - } - - - public void setLifecycleState(int state) { - } - - - public void setName(String name) { - } - - - public void onEvent(Event event) { - //To change body of implemented methods use File | Settings | File Templates. - } -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBinding.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBinding.java deleted file mode 100644 index 49c59bc718..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBinding.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.binding.foo; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Binding; - -/** - * Represents a mock binding that echoes back a single parameter - * - * @version $Rev$ $Date$ - */ -public class FooBinding implements Binding { - - public FooBinding() { - } - - public String getURI() { - return null; - } - - public void setURI(String value) { - } - - public void initialize(AssemblyContext modelContext) { - } - - public void freeze() { - } - - public boolean accept(AssemblyVisitor visitor) { - return true; - } - - private Object contextFactory; - - public void setContextFactory(Object factory) { - contextFactory = factory; - } - - public Object getContextFactory() { - System.out.println("retting"); - return contextFactory; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingBuilder.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingBuilder.java deleted file mode 100644 index 558a8ce2cf..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingBuilder.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.binding.foo; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.extension.EntryPointContextFactory; -import org.apache.tuscany.core.injection.ObjectCreationException; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Service; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -/** - * Creates a <code>ContextFactoryBuilder</code> for an entry point or external service configured with the {@link FooBinding} - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class FooBindingBuilder implements ContextFactoryBuilder { - private ContextFactoryBuilderRegistry builderRegistry; - - private MessageFactory messageFactory; - - private WireFactoryService wireFactoryService; - - public FooBindingBuilder(WireFactoryService wireFactoryService) { - this.wireFactoryService = wireFactoryService; - } - - public FooBindingBuilder() { - } - - @Init(eager = true) - public void init() { - builderRegistry.register(this); - } - - @Autowire - public void setBuilderRegistry(ContextFactoryBuilderRegistry builderRegistry) { - this.builderRegistry = builderRegistry; - } - - @Autowire - public void setWireFactoryService(WireFactoryService wireFactoryService) { - this.wireFactoryService = wireFactoryService; - } - - - /** - * Sets the factory used to construct wire messages - * - * @param msgFactory - */ - @Autowire - public void setMessageFactory(MessageFactory msgFactory) { - this.messageFactory = msgFactory; - } - - public void build(AssemblyObject object) throws BuilderException { - if (object instanceof EntryPoint) { - EntryPoint ep = (EntryPoint) object; - if (ep.getBindings().size() < 1 || !(ep.getBindings().get(0) instanceof FooBinding)) { - return; - } - EntryPointContextFactory contextFactory = new FooEntryPointContextFactory(ep.getName(), messageFactory); - ConfiguredService configuredService = ep.getConfiguredService(); - Service service = configuredService.getPort(); - SourceWireFactory wireFactory = wireFactoryService.createSourceFactory(ep.getConfiguredReference()).get(0); - contextFactory.addSourceWireFactory(service.getName(), wireFactory); - ep.setContextFactory(contextFactory); - } else if (object instanceof ExternalService) { - ExternalService es = (ExternalService) object; - if (es.getBindings().size() < 1 || !(es.getBindings().get(0) instanceof FooBinding)) { - return; - } - FooExternalServiceContextFactory contextFactory = new FooExternalServiceContextFactory(es.getName(), - new FooClientFactory()); - ConfiguredService configuredService = es.getConfiguredService(); - Service service = configuredService.getPort(); - TargetWireFactory wireFactory = wireFactoryService.createTargetFactory(configuredService); - contextFactory.addTargetWireFactory(service.getName(), wireFactory); - es.setContextFactory(contextFactory); - } - } - - private static class FooClientFactory implements ObjectFactory { - - public Object getInstance() throws ObjectCreationException { - return new FooClient(); - } - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingWireBuilder.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingWireBuilder.java deleted file mode 100644 index e2592024f8..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingWireBuilder.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.binding.foo; - -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.runtime.RuntimeContext; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.osoa.sca.annotations.Init; - -public class FooBindingWireBuilder implements WireBuilder { - - public FooBindingWireBuilder() { - super(); - } - - private RuntimeContext runtimeContext; - - @Autowire - public void setRuntimeContext(RuntimeContext context) { - runtimeContext = context; - } - - @Init(eager = true) - public void init() { - runtimeContext.addBuilder(this); - } - - - public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) throws BuilderConfigException { - if (!FooExternalServiceContextFactory.class.isAssignableFrom(targetType)) { - return; - } - for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration().getInvocationConfigurations() - .values()) { - FooExternalServiceTargetInvoker invoker = new FooExternalServiceTargetInvoker(sourceFactory.getConfiguration().getTargetName() - .getPartName()); - sourceInvocationConfig.setTargetInvoker(invoker); - } - - } - - public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) - throws BuilderConfigException { - if (FooExternalServiceContextFactory.class.isAssignableFrom(targetType)) { - for (TargetInvocationConfiguration targetInvocationConfig : targetFactory.getConfiguration().getInvocationConfigurations() - .values()) { - TargetInvoker invoker = new FooExternalServiceTargetInvoker(targetFactory.getConfiguration().getTargetName().getQualifiedName()); - targetInvocationConfig.setTargetInvoker(invoker); - } - - } - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooClient.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooClient.java deleted file mode 100644 index 9f67eb7786..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooClient.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.binding.foo; - -import java.lang.reflect.Array; - -import org.apache.tuscany.core.context.TargetException; - -/** - * A mock client for a transport binding - * - * @version $Rev$ $Date$ - */ -public class FooClient { - - public FooClient() { - } - - public Object invoke(Object msg) { - if (msg!=null && msg.getClass().isArray() && Array.getLength(msg) == 1){ - return Array.get(msg,0); - }else{ - throw new TargetException("This binding only understands operations with a single parameter"); - } - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooEntryPointContextFactory.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooEntryPointContextFactory.java deleted file mode 100644 index 69d81f66be..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooEntryPointContextFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.binding.foo; - -import org.apache.tuscany.core.extension.EntryPointContextFactory; -import org.apache.tuscany.core.message.MessageFactory; - -/** - * - * - * @version $Rev$ $Date$ - */ -public class FooEntryPointContextFactory extends EntryPointContextFactory { - - public FooEntryPointContextFactory(String name, MessageFactory msgFactory) { - super(name, msgFactory); - } - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceContextFactory.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceContextFactory.java deleted file mode 100644 index c7f67e2ff2..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceContextFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.binding.foo; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.extension.ExternalServiceContextFactory; - -/** - * Creates instances of {@link org.apache.tuscany.core.context.ExternalServiceContext} configured with the appropriate - * wire chains and bindings. This implementation serves as a marker for - * {@link org.apache.tuscany.container.java.mock.binding.foo.FooBindingWireBuilder} - * - * @version $Rev$ $Date$ - */ -public class FooExternalServiceContextFactory extends ExternalServiceContextFactory { - - public FooExternalServiceContextFactory(String name, ObjectFactory objectFactory) { - super(name, objectFactory); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceTargetInvoker.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceTargetInvoker.java deleted file mode 100644 index ecc9655a10..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceTargetInvoker.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.binding.foo; - -import org.apache.tuscany.core.context.ExternalServiceContext; -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.TargetInvoker; - -import java.lang.reflect.InvocationTargetException; - -/** - * Responsible for invoking a mock transport binding client configured for an external service over a wire - * - * @version $Rev$ $Date$ - */ -public class FooExternalServiceTargetInvoker implements TargetInvoker { - - private String name; - private ExternalServiceContext context; - - public FooExternalServiceTargetInvoker(String esName) { - assert (esName != null) : "No external service name specified"; - name = esName; // name is not used; it is included for illustration - } - - public Object invokeTarget(Object payload) throws InvocationTargetException { - FooClient client = new FooClient(); - if (payload != null) { - return client.invoke(payload); - } else { - return client.invoke(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() throws CloneNotSupportedException { - try { - FooExternalServiceTargetInvoker invoker = (FooExternalServiceTargetInvoker) super.clone(); - invoker.context = this.context; - invoker.name = this.name; - return invoker; - } catch (CloneNotSupportedException e) { - return null; // will not happen - } - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/AbstractGenericComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/AbstractGenericComponent.java deleted file mode 100644 index 0c9d8172f8..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/AbstractGenericComponent.java +++ /dev/null @@ -1,296 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import java.util.List; -import java.util.Map; - -import org.osoa.sca.ModuleContext; -import org.osoa.sca.annotations.ComponentName; -import org.osoa.sca.annotations.Context; -import org.osoa.sca.annotations.Property; - -/** - * Base test component implementation - * - * @version $Rev$ $Date$ - */ -public class AbstractGenericComponent implements GenericComponent { - - @ComponentName - private String name; - - public String getName() { - return name; - } - - @Context - private ModuleContext context; - - public ModuleContext getModuleContext() { - return context; - } - - //---------------------------------- - // Collections - //---------------------------------- - - Map testMap; - - public Map getTestMap() { - return testMap; - } - - public void setTestMap(Map testMap) { - this.testMap = testMap; - } - - List testList; - - public List getTestList() { - return testList; - } - - public void setTestList(List testList) { - this.testList = testList; - } - - //---------------------------------- - // Arrays - //---------------------------------- - - private int[] arrayInt; - - public int[] getArrayInt() { - return arrayInt; - } - - public void setArrayInt(int[] arrayInt) { - this.arrayInt = arrayInt; - } - - private float[] arrayFloat; - - public float[] getArrayFloat() { - return arrayFloat; - } - - public void setArrayFloat(float[] pArrayFloat) { - arrayFloat = pArrayFloat; - } - - private double[] arrayDouble; - - public double[] getArrayDouble() { - return arrayDouble; - } - - public void setArrayDouble(double[] pArrayDouble) { - arrayDouble = pArrayDouble; - } - - private long[] arrayLong; - - public long[] getArrayLong() { - return arrayLong; - } - - public void setArrayLong(long[] arrayLong) { - this.arrayLong = arrayLong; - } - - private short[] arrayShort; - - public short[] getArrayShort() { - return arrayShort; - } - - public void setArrayShort(short[] arrayShort) { - this.arrayShort = arrayShort; - } - - private boolean[] arrayBoolean; - - public boolean[] getArrayBoolean() { - return arrayBoolean; - } - - public void setArrayBoolean(boolean[] arrayBoolean) { - this.arrayBoolean = arrayBoolean; - } - - private String[] arrayString; - - public String[] getArrayString() { - return arrayString; - } - - public void setArrayString(String[] arrayString) { - this.arrayString = arrayString; - } - - //---------------------------------- - // Primitives - //---------------------------------- - - private boolean mBoolean; - - public boolean getBoolean() { - return mBoolean; - } - - public void setBoolean(boolean pBoolean) { - mBoolean = pBoolean; - } - - private short mShort; - - public short getShort() { - return mShort; - } - - public void setShort(short pShort) { - mShort = pShort; - } - - private int mInt; - - public int getInt() { - return mInt; - } - - public void setInt(int pInt) { - mInt = pInt; - } - - private long mLong; - - public long getLong() { - return mLong; - } - - public void setLong(long pLong) { - mLong = pLong; - } - - private double mDouble; - - public double getDouble() { - return mDouble; - } - - public void setDouble(double pDouble) { - mDouble = pDouble; - } - - private float mFloat; - - public float getFloat() { - return mFloat; - } - - public void setFloat(float pFloat) { - mFloat = pFloat; - } - - private char mChar; - - public char getChar() { - return mChar; - } - - public void setChar(char pChar) { - mChar = pChar; - } - - //---------------------------------- - // Object types - //---------------------------------- - - private String mString; - - public String getString() { - return mString; - } - - public void setString(String pString) { - mString = pString; - } - - private Short mOShort; - - public Short getOShort() { - return mOShort; - } - - public void setOShort(Short pOShort) { - mOShort = pOShort; - } - - private Integer mOInteger; - - public Integer getOInteger() { - return mOInteger; - } - - public void setOInteger(Integer pOInteger) { - mOInteger = pOInteger; - } - - private Long mOLong; - - public Long getOLong() { - return mOLong; - } - - public void setOLong(Long pOLong) { - mOLong = pOLong; - } - - private Float mOFloat; - - public Float getOFloat() { - return mOFloat; - } - - public void setOFloat(Float pOFloat) { - mOFloat = pOFloat; - } - - private Double mODouble; - - public Double getODouble() { - return mODouble; - } - - public void setODouble(Double pODouble) { - mODouble = pODouble; - } - - @Property(name = "genericComponent") - private GenericComponent mGenericComponent; - - public GenericComponent getGenericComponent() { - return mGenericComponent; - } - - public void setGenericComponent(GenericComponent pGenericComponent) { - mGenericComponent = pGenericComponent; - } - - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadContextPojo.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadContextPojo.java deleted file mode 100644 index 7840b57dea..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadContextPojo.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Context; - -public class BadContextPojo { - - @Context - String moduleContext; - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadNamePojo.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadNamePojo.java deleted file mode 100644 index d9753fa9f0..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadNamePojo.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.ComponentName; - -public class BadNamePojo { - @ComponentName - private int name; -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/DataObject.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/DataObject.java deleted file mode 100644 index 695cc2a5a1..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/DataObject.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import java.io.Serializable; - -/** - * A complex type for testing - * - * @version $Rev$ $Date$ - */ -public class DataObject implements Serializable { - - private String stringValue; - - public String getStringValue() { - return stringValue; - } - - public void setStringValue(String stringValue) { - this.stringValue = stringValue; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/GenericComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/GenericComponent.java deleted file mode 100644 index 44f1c02bfd..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/GenericComponent.java +++ /dev/null @@ -1,142 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import java.util.List; -import java.util.Map; - -import org.osoa.sca.ModuleContext; - -/** - * Generic test component - * - * @version $Rev$ $Date$ - */ -public interface GenericComponent { - - public String getName(); - - public ModuleContext getModuleContext(); - - // ---------------------------------- - // Collections - // ---------------------------------- - - public Map getTestMap(); - - public void setTestMap(Map pTestMap); - - public List getTestList(); - - public void setTestList(List pTestList); - - // ---------------------------------- - // Arrays - // ---------------------------------- - - public int[] getArrayInt(); - - public void setArrayInt(int[] pArrayInt); - - public float[] getArrayFloat(); - - public void setArrayFloat(float[] pArrayFloat); - - public double[] getArrayDouble(); - - public void setArrayDouble(double[] pArrayDouble); - - public long[] getArrayLong(); - - public void setArrayLong(long[] pArrayLong); - - public short[] getArrayShort(); - - public void setArrayShort(short[] pArrayShort); - - public boolean[] getArrayBoolean(); - - public void setArrayBoolean(boolean[] pArrayBoolean); - - public String[] getArrayString(); - - public void setArrayString(String[] pArrayString); - - // ---------------------------------- - // Primitives - // ---------------------------------- - - public boolean getBoolean(); - - public void setBoolean(boolean pBoolean); - - public short getShort(); - - public void setShort(short pShort); - - public int getInt(); - - public void setInt(int pInt); - - public long getLong(); - - public void setLong(long pLong); - - public double getDouble(); - - public void setDouble(double pDouble); - - public float getFloat(); - - public void setFloat(float pFloat); - - public char getChar(); - - public void setChar(char pChar); - - // ---------------------------------- - // Object types - // ---------------------------------- - - public String getString(); - - public void setString(String pString); - - public Short getOShort(); - - public void setOShort(Short pOShort); - - public Integer getOInteger(); - - public void setOInteger(Integer pOInteger); - - public Long getOLong(); - - public void setOLong(Long pOLong); - - public Float getOFloat(); - - public void setOFloat(Float pOFloat); - - public Double getODouble(); - - public void setODouble(Double pODouble); - - public GenericComponent getGenericComponent(); - - public void setGenericComponent(GenericComponent pGenericComponent); -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/HelloWorldClient.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/HelloWorldClient.java deleted file mode 100644 index 1e7ca9f36b..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/HelloWorldClient.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; - -/** - * - * - * @version $Rev$ $Date$ - */ -public class HelloWorldClient implements HelloWorldService{ - - private int count; - - public HelloWorldClient() { - } - - private HelloWorldService service; - - public void setHelloWorldService(HelloWorldService service){ - this.service = service; - } - - public String hello(String name) { - ++count; - return service.hello(name); - } - - public int count() { - return count; - } - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/LocalComponentImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/LocalComponentImpl.java deleted file mode 100644 index 4b57c7f301..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/LocalComponentImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.ModuleContext; -import org.osoa.sca.annotations.ComponentName; -import org.osoa.sca.annotations.Context; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; - -/** - * A test local service - * - * @version $Rev$ $Date$ - */ - -public class LocalComponentImpl { - - @ComponentName - protected String name; - - public String getName() { - return name; - } - - @Context - protected ModuleContext moduleCtx; - - public ModuleContext getModuleContext() { - return moduleCtx; - } - - @Property(name = "fieldSetter", required = true) - private String mfieldSetter; - - public String getfieldSetter() { - return mfieldSetter; - } - - public void setfieldSetter(String pfieldSetter) throws Exception { - throw new Exception("Set method instead of field"); - } - - private String mMethodSetter; - boolean mSetByMethod; - - public String getMethodSetter() throws Exception { - if (mSetByMethod) { - return mMethodSetter; - } - throw new Exception("Property method setter failed"); - - } - - @Property(required = true) - public void setMethodSetter(String pMethodSetter) { - mSetByMethod = true; - mMethodSetter = pMethodSetter; - } - - @Reference(name = "requiredDataObject", required = true) - private DataObject mRequiredDataObject; - - public DataObject getRequiredDataObject() { - return mRequiredDataObject; - } - - public void setRequiredDataObject(DataObject pRequiredDataObject) { - mRequiredDataObject = pRequiredDataObject; - } - - @Reference(name = "optionalDataObject") - private DataObject mOptionalDataObject; - - public DataObject getOptionalDataObject() { - return mOptionalDataObject; - } - - public void setOptionalDataObject(DataObject pOptionalDataObject) { - mOptionalDataObject = pOptionalDataObject; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java deleted file mode 100644 index 04cbb01de6..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public interface ModuleScopeComponent extends GenericComponent { - public GenericComponent getGenericComponent(); - - public String getString(); - //public boolean isInit(); -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.componentType b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.componentType deleted file mode 100644 index ca4c633e59..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.componentType +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<!-- remove this once ImplementationImpl is fixed not to requrie this -->
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
-
- <service name="ModuleScopeComponent" scope="module">
- <interface.java interface="janus.test.component.ModuleScopeComponent"/>
- </service> - <!-- Not supported, not in the spec
- <property.java name="mInt" class="java.lang.Integer" default="default"/>
- <property.java name="foo" class="java.lang.String" default="default"/> - -->
- <reference name="mGenericComponent" multiplicity="0..1">
- <interface.java interface="test.org.apache.tuscany.container.java.components.AbstractGenericComponent"/>
- </reference>
-
-</componentType>
-
diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.java deleted file mode 100644 index 7981208b9e..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Scope; - - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class ModuleScopeComponentImpl extends AbstractGenericComponent implements - ModuleScopeComponent { - - private String foo; - - public void setFoo(String foo) { - this.foo = foo; - } - - public String getFoo() { - return foo; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeDestroyOnlyComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeDestroyOnlyComponent.java deleted file mode 100644 index 76218c2d6c..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeDestroyOnlyComponent.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; - -public class ModuleScopeDestroyOnlyComponent extends ModuleScopeComponentImpl { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitComponent.java deleted file mode 100644 index 56a0421f24..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitComponent.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Init; - -public class ModuleScopeEagerInitComponent extends ModuleScopeComponentImpl { - - boolean initialized = false; - - public boolean isInitialized() { - return initialized; - } - - // this value tests to ensure introspection can find the init() method even - // if a field is named the same. Ultimately, this should be in the - // introspection tests - private boolean init; - - @Init(eager = true) - public void init() { - initialized = true; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitDestroyComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitDestroyComponent.java deleted file mode 100644 index dae156737a..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitDestroyComponent.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; - -public class ModuleScopeEagerInitDestroyComponent extends ModuleScopeEagerInitComponent { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitDestroyComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitDestroyComponent.java deleted file mode 100644 index 695157612b..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitDestroyComponent.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; - -public class ModuleScopeInitDestroyComponent extends ModuleScopeInitOnlyComponent { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - if (destroyed){ - throw new AssertionError("Destroy called more than once"); - } - destroyed = true; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitOnlyComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitOnlyComponent.java deleted file mode 100644 index 4945309852..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitOnlyComponent.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Init; - -public class ModuleScopeInitOnlyComponent extends ModuleScopeComponentImpl { - - boolean initialized = false; - - public boolean isInitialized() { - return initialized; - } - - // this value tests to ensure introspection can find the init() method even - // if a field is named the same. Ultimately, this should be in the introspection tests - private boolean init; - - @Init - public void init() { - if (initialized){ - throw new AssertionError("Init called more than once"); - } - initialized = true; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTarget.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTarget.java deleted file mode 100644 index 2edc8246db..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTarget.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -/** - * Implementations are used in wiring tests - * - * @version $Rev$ $Date$ - */ -public interface OtherTarget { - - public String getString(); - - public void setString(String val); -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTargetImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTargetImpl.java deleted file mode 100644 index 08d4d9f720..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTargetImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -/** - * A target used for testing wires with a different source and target interface - * - * @version $Rev$ $Date$ - */ -public class OtherTargetImpl implements OtherTarget{ - - private String theString; - - public String getString() { - return theString; - } - - public void setString(String val) { - theString = val; - } - - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableService.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableService.java deleted file mode 100644 index 645fd7f47c..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableService.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Remotable; - -/** - * Used for testing basic remoting operations - * - * @version $Rev$ $Date$ - */ - -@Remotable -public interface RemotableService { - - public void syncOneWay(String msg); - - public String syncTwoWay(String msg); - - public DataObject syncTwoWayCustomType(DataObject val); - - public String getString(); - - public void setString(String string); - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableServiceImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableServiceImpl.java deleted file mode 100644 index 34a4273323..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableServiceImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import junit.framework.Assert; -import org.osoa.sca.annotations.Property; - - -/** - * @version $Rev$ $Date$ - */ -public class RemotableServiceImpl implements RemotableService { - - // ---------------------------------- - // Properties - // ---------------------------------- - - @Property(name = "string", required = true) - private String mString; - - public String getString() { - return mString; - } - - public void setString(String string) { - mString = string; - } - - // ---------------------------------- - // Methods - // ---------------------------------- - - public void syncOneWay(String msg) { - Assert.assertEquals("hello", msg); - } - - public String syncTwoWay(String msg) { - return "response"; - } - - public DataObject syncTwoWayCustomType(DataObject val) { - Assert.assertEquals("hello", val.getStringValue()); - DataObject dto = new DataObject(); - dto.setStringValue("return"); - return dto; - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponent.java deleted file mode 100644 index ac7931bd2c..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("REQUEST") -public interface RequestScopeComponent extends GenericComponent { - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponentImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponentImpl.java deleted file mode 100644 index 5b20519d90..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponentImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -/** - * @version $Rev$ $Date$ - */ -public class RequestScopeComponentImpl extends AbstractGenericComponent implements - RequestScopeComponent { - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeDestroyOnlyComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeDestroyOnlyComponent.java deleted file mode 100644 index ae63f761c3..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeDestroyOnlyComponent.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Scope; - -@Scope("REQUEST") -public class RequestScopeDestroyOnlyComponent extends SessionScopeComponentImpl { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitDestroyComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitDestroyComponent.java deleted file mode 100644 index 67f61df36d..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitDestroyComponent.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Scope; - -@Scope("REQUEST") -public class RequestScopeInitDestroyComponent extends SessionScopeInitOnlyComponent { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitOnlyComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitOnlyComponent.java deleted file mode 100644 index c6c621f518..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitOnlyComponent.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -@Scope("REQUEST") -public class RequestScopeInitOnlyComponent extends SessionScopeComponentImpl { - - boolean initialized = false; - - public boolean isInitialized() { - return initialized; - } - - @Init - public void init() { - initialized = true; - } - - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponent.java deleted file mode 100644 index 236e083a2b..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("SESSION") -public interface SessionScopeComponent extends GenericComponent { - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponentImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponentImpl.java deleted file mode 100644 index 265969a450..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponentImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("SESSION") -public class SessionScopeComponentImpl extends AbstractGenericComponent implements - SessionScopeComponent { - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeDestroyOnlyComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeDestroyOnlyComponent.java deleted file mode 100644 index be20a23d29..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeDestroyOnlyComponent.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; - -public class SessionScopeDestroyOnlyComponent extends SessionScopeComponentImpl { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitDestroyComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitDestroyComponent.java deleted file mode 100644 index 32aa0142a4..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitDestroyComponent.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; - -public class SessionScopeInitDestroyComponent extends SessionScopeInitOnlyComponent { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitOnlyComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitOnlyComponent.java deleted file mode 100644 index a518a9b244..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitOnlyComponent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Init; - -public class SessionScopeInitOnlyComponent extends SessionScopeComponentImpl { - - boolean initialized = false; - - public boolean isInitialized() { - return initialized; - } - - @Init - public void init() { - initialized = true; - } - - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Source.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Source.java deleted file mode 100644 index 1f918590f2..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Source.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import java.util.List; - -/** - * Implementations are used in wiring tests - * - * @version $Rev$ $Date$ - */ -public interface Source { - - public Target getTarget(); - - public List<Target> getTargets(); - - public List<Target> getTargetsThroughField(); - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SourceImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SourceImpl.java deleted file mode 100644 index a2588bae5e..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SourceImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import java.util.List; - -/** - * Mock system component implementation used in wiring tests - * - * @version $Rev$ $Date$ - */ -public class SourceImpl implements Source { - - private Target target; - - private List<Target> targets; - - private List<Target> targetsThroughField; - - public void setTarget(Target target) { - this.target = target; - } - - public Target getTarget() { - return target; - } - - public List<Target> getTargets() { - return targets; - } - - public void setTargets(List<Target> targets) { - this.targets = targets; - } - - public List<Target> getTargetsThroughField() { - return targetsThroughField; - } - - - private Target[] targetsArray; - - public Target[] getArrayOfTargets() { - return targetsArray; - } - - public void setArrayOfTargets(Target[] targets) { - targetsArray = targets; - } - - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponent.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponent.java deleted file mode 100644 index 3fe84dd785..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("STATELESS") -public interface StatelessComponent extends GenericComponent { - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponentImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponentImpl.java deleted file mode 100644 index 8b806d6a2e..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponentImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -/** - * @version $Rev$ $Date$ - */ -public class StatelessComponentImpl extends AbstractGenericComponent implements - StatelessComponent { - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Target.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Target.java deleted file mode 100644 index a56e52c898..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Target.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -/** - * Implementations are used in wiring tests - * - * @version $Rev$ $Date$ - */ -public interface Target { - - public String getString(); - - public void setString(String val); -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/TargetImpl.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/TargetImpl.java deleted file mode 100644 index 5a10bfdbc1..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/TargetImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.mock.components; - -/** - * Mock system component implementation used in wiring tests - * - * @version $Rev$ $Date$ - */ -public class TargetImpl implements Target { - - private String theString; - - public String getString() { - return theString; - } - - public void setString(String val) { - theString = val; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicModuleScopeTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicModuleScopeTestCase.java deleted file mode 100644 index 557f306ad2..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicModuleScopeTestCase.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.ModuleScopeComponentImpl; -import org.apache.tuscany.container.java.mock.components.ModuleScopeInitDestroyComponent; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.ModuleScopeContext; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.AtomicComponent; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Unit tests for the module scope container - * - * @version $Rev$ $Date$ - */ -public class BasicModuleScopeTestCase extends TestCase { - - /** - * Tests instance identity is properly maintained - */ - public void testInstanceManagement() throws Exception { - EventContext ctx = new EventContextImpl(); - ModuleScopeContext scope = new ModuleScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - // first request - scope.onEvent(new ModuleStart(this)); - ModuleScopeComponentImpl comp1 = (ModuleScopeComponentImpl) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp1); - // second request - ModuleScopeComponentImpl comp2 = (ModuleScopeComponentImpl) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp2); - Assert.assertSame(comp1, comp2); - scope.onEvent(new ModuleStop(this)); - scope.stop(); - } - - public void testSetNullComponents() throws Exception { - EventContext ctx = new EventContextImpl(); - ModuleScopeContext scope = new ModuleScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - scope.onEvent(new ModuleStart(this)); - scope.onEvent(new ModuleStop(this)); - scope.stop(); - } - - public void testRegisterContextBeforeStart() throws Exception { - EventContext ctx = new EventContextImpl(); - ModuleScopeContext scope = new ModuleScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - scope.registerFactory(createConfiguration("NewTestService")); - scope.onEvent(new ModuleStart(this)); - ModuleScopeInitDestroyComponent comp2 = (ModuleScopeInitDestroyComponent) scope.getContext("NewTestService").getInstance(null); - Assert.assertNotNull(comp2); - Assert.assertTrue(comp2.isInitialized()); - scope.onEvent(new ModuleStop(this)); - Assert.assertTrue(comp2.isDestroyed()); - scope.stop(); - } - - public void testRegisterContextAfterStart() throws Exception { - EventContext ctx = new EventContextImpl(); - ModuleScopeContext scope = new ModuleScopeContext(ctx); - scope.start(); - scope.registerFactory(createConfiguration("NewTestService")); - scope.onEvent(new ModuleStart(this)); - scope.registerFactories(createConfigurations()); - ModuleScopeInitDestroyComponent comp2 = (ModuleScopeInitDestroyComponent) scope.getContext("NewTestService").getInstance(null); - Assert.assertNotNull(comp2); - Assert.assertTrue(comp2.isInitialized()); - scope.onEvent(new ModuleStop(this)); - Assert.assertTrue(comp2.isDestroyed()); - scope.stop(); - } - - - private List<ContextFactory<Context>> createConfigurations() throws BuilderException, ConfigurationLoadException { - PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); - JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); - AtomicComponent component = MockFactory.createComponent("TestService1", ModuleScopeComponentImpl.class, Scope.MODULE); - builder.build(component); - List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - configs.add((ContextFactory<Context>) component.getContextFactory()); - return configs; - } - - private ContextFactory<Context> createConfiguration(String name) throws BuilderException, ConfigurationLoadException { - PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); - JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); - AtomicComponent component = MockFactory.createComponent(name, ModuleScopeInitDestroyComponent.class, - Scope.MODULE); - ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); - ComponentType type = introspector.introspect(ModuleScopeInitDestroyComponent.class); - component.getImplementation().setComponentType(type); - builder.build(component); - return (ContextFactory<Context>) component.getContextFactory(); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicRequestScopeTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicRequestScopeTestCase.java deleted file mode 100644 index e53b9fc9ac..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicRequestScopeTestCase.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.RequestScopeComponent; -import org.apache.tuscany.container.java.mock.components.RequestScopeComponentImpl; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.RequestScopeContext; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.AtomicComponent; - -/** - * Unit tests for the request scope container - * - * @version $Rev$ $Date$ - */ -public class BasicRequestScopeTestCase extends TestCase { - - /** - * Tests instance identity is properly maintained - */ - public void testInstanceManagement() throws Exception { - EventContext ctx = new EventContextImpl(); - RequestScopeContext scope = new RequestScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - - // first request - RequestScopeComponentImpl comp1 = (RequestScopeComponentImpl) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp1); - Object id = new Object(); - scope.onEvent(new RequestEnd(this,id)); - - // second request - RequestScopeComponentImpl comp2 = (RequestScopeComponentImpl) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp2); - Assert.assertNotSame(comp1, comp2); - Object id2 = new Object(); - scope.onEvent(new RequestEnd(this,id2)); - - scope.stop(); - } - - public void testRegisterContextBeforeRequest() throws Exception { - EventContext ctx = new EventContextImpl(); - RequestScopeContext scope = new RequestScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.registerFactory(createConfiguration("NewTestService")); - scope.start(); - RequestScopeComponent comp1 = (RequestScopeComponent) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp1); - RequestScopeComponent comp2 = (RequestScopeComponent) scope.getContext("NewTestService").getInstance(null); - Assert.assertNotNull(comp2); - Object id = new Object(); - scope.onEvent(new RequestEnd(this,id)); - scope.stop(); - } - - public void testRegisterContextAfterRequest() throws Exception { - EventContext ctx = new EventContextImpl(); - RequestScopeContext scope = new RequestScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - RequestScopeComponent comp1 = (RequestScopeComponent) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp1); - scope.registerFactory(createConfiguration("NewTestService")); - RequestScopeComponent comp2 = (RequestScopeComponent) scope.getContext("NewTestService").getInstance(null); - Assert.assertNotNull(comp2); - Object id = new Object(); - scope.onEvent(new RequestEnd(this,id)); - scope.stop(); - } - - /** - * Tests setting no components in the scope - */ - public void testSetNullComponents() throws Exception { - EventContext ctx = new EventContextImpl(); - RequestScopeContext scope = new RequestScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - scope.stop(); - } - - public void testGetComponentByKey() throws Exception { - EventContext ctx = new EventContextImpl(); - RequestScopeContext scope = new RequestScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - - RequestScopeComponentImpl comp1 = (RequestScopeComponentImpl) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp1); - Object id = new Object(); - scope.onEvent(new RequestEnd(this,id)); - - // second request - // should be null since the other context (thread) expired w/ onEvent(..) - Assert.assertNull(scope.getContextByKey("TestService1", Thread.currentThread())); - // Note should test better using concurrent threads to pull the instance - - scope.stop(); - } - - - private List<ContextFactory<Context>> createConfigurations() throws BuilderException, ConfigurationLoadException { - AtomicComponent component = MockFactory.createComponent("TestService1", RequestScopeComponentImpl.class, - Scope.REQUEST); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); - JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); - builder.build(component); - List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - configs.add((ContextFactory<Context>) component.getContextFactory()); - return configs; - } - - private ContextFactory<Context> createConfiguration(String name) throws BuilderException, ConfigurationLoadException { - AtomicComponent component = MockFactory.createComponent(name, RequestScopeComponentImpl.class, - Scope.REQUEST); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); - JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); - builder.build(component); - return (ContextFactory<Context>) component.getContextFactory(); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicSessionScopeTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicSessionScopeTestCase.java deleted file mode 100644 index 8bee9a9741..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicSessionScopeTestCase.java +++ /dev/null @@ -1,238 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.SessionScopeComponent; -import org.apache.tuscany.container.java.mock.components.SessionScopeComponentImpl; -import org.apache.tuscany.container.java.mock.components.SessionScopeInitDestroyComponent; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.event.HttpSessionEnd; -import org.apache.tuscany.core.context.event.HttpSessionEvent; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.SessionScopeContext; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.AtomicComponent; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Unit tests for the Http session scope container - * - * @version $Rev$ $Date$ - */ -public class BasicSessionScopeTestCase extends TestCase { - - /** - * Tests instance identity is properly maintained - */ - public void testInstanceManagement() throws Exception { - EventContext ctx = new EventContextImpl(); - SessionScopeContext scope = new SessionScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - Object session = new Object(); - Object session2 = new Object(); - // first request - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); - SessionScopeComponent comp1 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp1); - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - - // second request - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); - SessionScopeComponent comp2 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp2); - Assert.assertSame(comp1, comp2); - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - - // third request, different session - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2); - SessionScopeComponent comp3 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp3); - Assert.assertNotSame(comp1, comp3); // should be different instances - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - - scope.onEvent(new HttpSessionEnd(this, session)); - scope.onEvent(new HttpSessionEnd(this, session2)); - scope.stop(); - } - - /** - * Tests setting no components in the scope - */ - public void testSetNullComponents() throws Exception { - EventContext ctx = new EventContextImpl(); - SessionScopeContext scope = new SessionScopeContext(ctx); - scope.registerFactories(new ArrayList<ContextFactory<Context>>()); - scope.start(); - scope.stop(); - } - - public void testGetContextByKey() throws Exception { - EventContext ctx = new EventContextImpl(); - SessionScopeContext scope = new SessionScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - Object session = new Object(); - Object session2 = new Object(); - - // first request - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); - SessionScopeComponent comp1 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp1); - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - - // second request, different session - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2); - SessionScopeComponent comp2 = (SessionScopeComponent) scope.getContextByKey("TestService1", session) - .getInstance(null); - SessionScopeComponent comp3 = (SessionScopeComponent) scope.getContextByKey("TestService1", session) - .getInstance(null); - Assert.assertNotNull(comp2); - Object id = new Object(); - scope.onEvent(new RequestEnd(this, id)); - Assert.assertSame(comp1, comp2); // should be same instances - Assert.assertSame(comp2, comp3); // should not be same instances - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - - // shutdown sessions - scope.onEvent(new HttpSessionEnd(this, session)); - scope.onEvent(new HttpSessionEnd(this, session2)); - - scope.stop(); - } - - public void testRegisterContextBeforeSession() throws Exception { - EventContext ctx = new EventContextImpl(); - SessionScopeContext scope = new SessionScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - Object session = new Object(); - scope.registerFactory(createConfiguration("NewTestService")); - - // first request - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); - - SessionScopeInitDestroyComponent comp2 = (SessionScopeInitDestroyComponent) scope.getContext("NewTestService") - .getInstance(null); - Assert.assertNotNull(comp2); - Assert.assertTrue(comp2.isInitialized()); - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - - // second request different session - Object session2 = new Object(); - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2); - SessionScopeInitDestroyComponent comp3 = (SessionScopeInitDestroyComponent) scope.getContext("NewTestService") - .getInstance(null); - Assert.assertNotNull(comp3); - Assert.assertNotSame(comp2, comp3); - Assert.assertTrue(comp3.isInitialized()); - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - - scope.onEvent(new HttpSessionEnd(this, session)); - Assert.assertTrue(comp2.isDestroyed()); - - scope.onEvent(new HttpSessionEnd(this, session2)); - Assert.assertTrue(comp3.isDestroyed()); - scope.stop(); - } - - /** - * Tests runtime context registration - */ - public void testRegisterContextAfterSession() throws Exception { - EventContext ctx = new EventContextImpl(); - SessionScopeContext scope = new SessionScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - Object session = new Object(); - - // first request - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); - SessionScopeComponent comp1 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp1); - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - - scope.registerFactory(createConfiguration("NewTestService")); - - // second request - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); - SessionScopeInitDestroyComponent comp2 = (SessionScopeInitDestroyComponent) scope.getContext("NewTestService") - .getInstance(null); - Assert.assertNotNull(comp2); - Assert.assertTrue(comp2.isInitialized()); - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - - // third request different session - Object session2 = new Object(); - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2); - SessionScopeInitDestroyComponent comp3 = (SessionScopeInitDestroyComponent) scope.getContext("NewTestService") - .getInstance(null); - Assert.assertNotNull(comp3); - Assert.assertNotSame(comp2, comp3); - Assert.assertTrue(comp3.isInitialized()); - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - - scope.onEvent(new HttpSessionEnd(this, session)); - Assert.assertTrue(comp2.isDestroyed()); - - scope.onEvent(new HttpSessionEnd(this, session2)); - Assert.assertTrue(comp3.isDestroyed()); - scope.stop(); - } - - private List<ContextFactory<Context>> createConfigurations() throws BuilderException, ConfigurationLoadException { - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); - JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); - AtomicComponent component = MockFactory.createComponent("TestService1", SessionScopeComponentImpl.class, Scope.SESSION); - ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); - ComponentType type = introspector.introspect(SessionScopeComponentImpl.class); - component.getImplementation().setComponentType(type); - builder.build(component); - List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - configs.add((ContextFactory<Context>) component.getContextFactory()); - return configs; - } - - private ContextFactory<Context> createConfiguration(String name) throws BuilderException, ConfigurationLoadException { - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); - JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); - AtomicComponent component = MockFactory.createComponent(name, SessionScopeInitDestroyComponent.class, Scope.SESSION); - ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); - ComponentType type = introspector.introspect(SessionScopeInitDestroyComponent.class); - component.getImplementation().setComponentType(type); - builder.build(component); - return (ContextFactory<Context>) component.getContextFactory(); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicStatelessScopeTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicStatelessScopeTestCase.java deleted file mode 100644 index 3765c8bf27..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicStatelessScopeTestCase.java +++ /dev/null @@ -1,129 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.StatelessComponent; -import org.apache.tuscany.container.java.mock.components.StatelessComponentImpl; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.StatelessScopeContext; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.AtomicComponent; - -/** - * Unit tests for the module scope container - * - * @version $Rev$ $Date$ - */ -public class BasicStatelessScopeTestCase extends TestCase { - - /** - * Tests instance identity is properly maintained - */ - public void testInstanceManagement() throws Exception { - EventContext ctx = new EventContextImpl(); - StatelessScopeContext scope = new StatelessScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - // first request - StatelessComponentImpl comp1 = (StatelessComponentImpl) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp1); - // second request - StatelessComponentImpl comp2 = (StatelessComponentImpl) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp2); - Assert.assertNotSame(comp1, comp2); - scope.stop(); - } - - public void testRegisterContextBeforeRequest() throws Exception { - EventContext ctx = new EventContextImpl(); - StatelessScopeContext scope = new StatelessScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.registerFactory(createConfiguration("NewTestService")); - scope.start(); - StatelessComponent comp1 = (StatelessComponent) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp1); - StatelessComponent comp2 = (StatelessComponent) scope.getContext("NewTestService").getInstance(null); - Assert.assertNotNull(comp2); - scope.stop(); - } - - public void testRegisterContextAfterRequest() throws Exception { - EventContext ctx = new EventContextImpl(); - StatelessScopeContext scope = new StatelessScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - StatelessComponent comp1 = (StatelessComponent) scope.getContext("TestService1").getInstance(null); - Assert.assertNotNull(comp1); - scope.registerFactory(createConfiguration("NewTestService")); - StatelessComponent comp2 = (StatelessComponent) scope.getContext("NewTestService").getInstance(null); - Assert.assertNotNull(comp2); - scope.stop(); - } - - - /** - * Tests setting no components in the scope - */ - public void testSetNullComponents() throws Exception { - EventContext ctx = new EventContextImpl(); - StatelessScopeContext scope = new StatelessScopeContext(ctx); - scope.registerFactories(createConfigurations()); - scope.start(); - scope.stop(); - } - - private List<ContextFactory<Context>> createConfigurations() - throws NoSuchMethodException, BuilderException, ConfigurationLoadException { - AtomicComponent component = MockFactory.createComponent("TestService1", StatelessComponentImpl.class, - Scope.INSTANCE); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); - JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); - builder.build(component); - List<ContextFactory<Context>> configs = new ArrayList(); - configs.add((ContextFactory<Context>) component.getContextFactory()); - return configs; - } - - private ContextFactory<Context> createConfiguration(String name) - throws NoSuchMethodException, BuilderException, ConfigurationLoadException { - AtomicComponent component = MockFactory.createComponent(name, StatelessComponentImpl.class, - Scope.INSTANCE); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(),new DefaultPolicyBuilderRegistry()); - JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); - builder.build(component); - return (ContextFactory<Context>) component.getContextFactory(); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java deleted file mode 100644 index d5b5a29e9c..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java +++ /dev/null @@ -1,188 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.GenericComponent; -import org.apache.tuscany.container.java.mock.components.ModuleScopeComponentImpl; -import org.apache.tuscany.container.java.mock.components.SessionScopeComponentImpl; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.RequestStart; -import org.apache.tuscany.core.context.event.HttpSessionBound; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.context.event.HttpSessionEnd; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.CompositeScopeContext; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.Extensible; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.AtomicComponent; - -/** - * Tests component nesting. This test needs to be in the container.java progject since it relies on Java POJOs for scope - * testing. - * - * @version $Rev$ $Date$ - */ -public class CompositeScopeTestCase extends TestCase { - - /** - * Ensures scope events are propagated in an composite scope - */ - public void testCompositeScopePropagation() throws Exception { - EventContext ctx = new EventContextImpl(); - CompositeContext moduleComponentCtx = new CompositeContextImpl(); - moduleComponentCtx.setName("testMC"); - moduleComponentCtx.start(); - CompositeScopeContext scopeContainer = new CompositeScopeContext(ctx); - scopeContainer.registerFactory(MockFactory.createCompositeConfiguration("CompositeComponent")); - scopeContainer.start(); - CompositeContext child = (CompositeContext) scopeContainer.getContext("CompositeComponent"); - List<Extensible> models = createAssembly(); - for (Extensible model : models) { - child.registerModelObject(model); - } - - scopeContainer.onEvent(new ModuleStart(this)); - Object session = new Object(); - Object id = new Object(); - //ctx.setIdentifier(EventContext.SESSION,session); - scopeContainer.onEvent(new RequestStart(this,id)); - scopeContainer.onEvent(new HttpSessionBound(this,session)); - CompositeContext componentCtx = (CompositeContext) scopeContainer.getContext("CompositeComponent"); - GenericComponent testService1 = (GenericComponent) componentCtx.getContext("TestService1").getInstance(null); - GenericComponent testService2 = (GenericComponent) componentCtx.getContext("TestService2").getInstance(null); - GenericComponent testService3 = (GenericComponent) componentCtx.getContext("TestService3").getInstance(null); - Assert.assertNotNull(testService1); - Assert.assertNotNull(testService2); - Assert.assertNotNull(testService3); - scopeContainer.onEvent(new RequestEnd(this,id)); - scopeContainer.onEvent(new RequestStart(this,id)); - scopeContainer.onEvent(new HttpSessionBound(this,session)); - - GenericComponent testService2a = (GenericComponent) componentCtx.getContext("TestService2").getInstance(null); - Assert.assertNotNull(testService2a); - GenericComponent testService3a = (GenericComponent) componentCtx.getContext("TestService3").getInstance(null); - Assert.assertNotNull(testService3a); - Assert.assertEquals(testService2, testService2a); - Assert.assertNotSame(testService3, testService3a); - scopeContainer.onEvent(new RequestEnd(this,id)); - scopeContainer.onEvent(new HttpSessionEnd(this,session)); - - Object session2 = new Object(); - Object id2 = new Object(); - scopeContainer.onEvent(new RequestStart(this,id2)); - scopeContainer.onEvent(new HttpSessionBound(this,session2)); - GenericComponent testService2b = (GenericComponent) componentCtx.getContext("TestService2").getInstance(null); - Assert.assertNotNull(testService2b); - Assert.assertNotSame(testService2, testService2b); - - scopeContainer.onEvent(new RequestEnd(this,id2)); - scopeContainer.onEvent(new HttpSessionEnd(this,session2)); - - } - - /** - * Ensures only child entry points (and not components) are accessible from parents - */ - public void testCompositeNoEntryPoint() throws Exception { - EventContext ctx = new EventContextImpl(); - CompositeContext moduleComponentCtx = new CompositeContextImpl(); - moduleComponentCtx.setName("testMC"); - CompositeScopeContext scopeContainer = new CompositeScopeContext(ctx); - scopeContainer.registerFactory(MockFactory.createCompositeConfiguration("CompositeComponent")); - scopeContainer.start(); - CompositeContext child = (CompositeContext) scopeContainer.getContext("CompositeComponent"); - List<Extensible> parts = createAssembly(); - for (Extensible part : parts) { - child.registerModelObject(part); - } - scopeContainer.onEvent(new ModuleStart(this)); - scopeContainer.getContext("CompositeComponent"); - } - - /** - * Tests adding a context before its parent has been started - */ - public void testRegisterContextBeforeStart() throws Exception { - EventContext ctx = new EventContextImpl(); - CompositeContext moduleComponentCtx = new CompositeContextImpl(); - moduleComponentCtx.setName("testMC"); - CompositeScopeContext scopeContainer = new CompositeScopeContext(ctx); - scopeContainer.registerFactory(MockFactory.createCompositeConfiguration("CompositeComponent")); - scopeContainer.start(); - scopeContainer.onEvent(new ModuleStart(this)); - scopeContainer.getContext("CompositeComponent"); - scopeContainer.onEvent(new ModuleStop(this)); - scopeContainer.stop(); - } - - /** - * Tests adding a context after its parent has been started - */ - public void testRegisterContextAfterStart() throws Exception { - EventContext ctx = new EventContextImpl(); - CompositeContext moduleComponentCtx = new CompositeContextImpl(); - moduleComponentCtx.setName("testMC"); - CompositeScopeContext scopeContainer = new CompositeScopeContext(ctx); - scopeContainer.start(); - - scopeContainer.onEvent(new ModuleStart(this)); - scopeContainer.registerFactory(MockFactory.createCompositeConfiguration("CompositeComponent")); - scopeContainer.getContext("CompositeComponent"); - scopeContainer.onEvent(new ModuleStop(this)); - scopeContainer.stop(); - } - - /** - * Creats an assembly containing a module-scoped component definition, a session-scoped component definition, and a - * request-scoped component definition - * - */ - private List<Extensible> createAssembly() throws BuilderException, ConfigurationLoadException { - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); - JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); - AtomicComponent component = MockFactory.createComponent("TestService1", ModuleScopeComponentImpl.class, Scope.MODULE); - AtomicComponent sessionComponent = MockFactory.createComponent("TestService2", SessionScopeComponentImpl.class, - Scope.SESSION); - AtomicComponent requestComponent = MockFactory.createComponent("TestService3", SessionScopeComponentImpl.class, - Scope.REQUEST); - builder.build(component); - builder.build(sessionComponent); - builder.build(requestComponent); - List<Extensible> configs = new ArrayList<Extensible>(); - configs.add(component); - configs.add(sessionComponent); - configs.add(requestComponent); - return configs; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/DependencyLifecycleTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/DependencyLifecycleTestCase.java deleted file mode 100644 index dc3fe3efcb..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/DependencyLifecycleTestCase.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import junit.framework.TestCase; -import org.apache.tuscany.container.java.mock.MockContextFactory; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.event.HttpSessionBound; -import org.apache.tuscany.core.context.event.HttpSessionEvent; -import org.apache.tuscany.core.context.event.HttpSessionEnd; -import org.apache.tuscany.core.context.event.RequestStart; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.ModuleScopeContext; -import org.apache.tuscany.core.context.scope.SessionScopeContext; -import org.apache.tuscany.core.context.scope.RequestScopeContext; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Tests that dependencies are initalized and destroyed in the proper order (i.e. LIFO) - * - * @version $Rev: 393992 $ $Date: 2006-04-13 18:01:05 -0700 (Thu, 13 Apr 2006) $ - */ -public class DependencyLifecycleTestCase extends TestCase { - - - - public void testInitDestroyOrderModuleScope() throws Exception { - EventContext ctx = new EventContextImpl(); - ModuleScopeContext scope = new ModuleScopeContext(ctx); - scope.registerFactories(MockContextFactory.createWiredContexts(Scope.MODULE,scope)); - scope.start(); - scope.onEvent(new ModuleStart(this)); - OrderedDependentPojo source = (OrderedDependentPojo) scope.getContext("source").getInstance(null); - assertNotNull(source.getPojo()); - // expire module - assertEquals(2,source.getNumberInstantiated()); - scope.onEvent(new ModuleStop(this)); - assertEquals(0,source.getNumberInstantiated()); - scope.stop(); - } - - public void testInitDestroyOrderSessionScope() throws Exception { - EventContext ctx = new EventContextImpl(); - SessionScopeContext scope = new SessionScopeContext(ctx); - scope.registerFactories(MockContextFactory.createWiredContexts(Scope.SESSION,scope)); - scope.start(); - Object session = new Object(); - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER,session); - scope.onEvent(new HttpSessionBound(this,session)); - OrderedDependentPojo source = (OrderedDependentPojo) scope.getContext("source").getInstance(null); - assertNotNull(source.getPojo()); - // expire module - assertEquals(2,source.getNumberInstantiated()); - scope.onEvent(new HttpSessionEnd(this,session)); - assertEquals(0,source.getNumberInstantiated()); - scope.stop(); - } - - - public void testInitDestroyOrderRequestScope() throws Exception { - EventContext ctx = new EventContextImpl(); - RequestScopeContext scope = new RequestScopeContext(ctx); - scope.registerFactories(MockContextFactory.createWiredContexts(Scope.REQUEST,scope)); - scope.start(); - Object request = new Object(); - scope.onEvent(new RequestStart(this,request)); - OrderedDependentPojo source = (OrderedDependentPojo) scope.getContext("source").getInstance(null); - assertNotNull(source.getPojo()); - // expire module - assertEquals(2,source.getNumberInstantiated()); - scope.onEvent(new RequestEnd(this,request)); - assertEquals(0,source.getNumberInstantiated()); - scope.stop(); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/ModuleScopeLifecycleTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/ModuleScopeLifecycleTestCase.java deleted file mode 100644 index 904e218c08..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/ModuleScopeLifecycleTestCase.java +++ /dev/null @@ -1,248 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.ModuleScopeDestroyOnlyComponent; -import org.apache.tuscany.container.java.mock.components.ModuleScopeEagerInitComponent; -import org.apache.tuscany.container.java.mock.components.ModuleScopeEagerInitDestroyComponent; -import org.apache.tuscany.container.java.mock.components.ModuleScopeInitDestroyComponent; -import org.apache.tuscany.container.java.mock.components.ModuleScopeInitOnlyComponent; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.ModuleScopeContext; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.AtomicComponent; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Lifecycle unit tests for the module scope container - * - * @version $Rev$ $Date$ - */ -public class ModuleScopeLifecycleTestCase extends TestCase { - - JavaContextFactoryBuilder builder; - - public void testInitDestroy() throws Exception { - EventContext ctx = new EventContextImpl(); - ModuleScopeContext scope = new ModuleScopeContext(ctx); - scope.registerFactories(createComponents()); - scope.start(); - scope.onEvent(new ModuleStart(this)); - ModuleScopeInitDestroyComponent initDestroy = (ModuleScopeInitDestroyComponent) scope.getContext( - "TestServiceInitDestroy").getInstance(null); - Assert.assertNotNull(initDestroy); - ModuleScopeInitOnlyComponent initOnly = (ModuleScopeInitOnlyComponent) scope.getContext("TestServiceInitOnly") - .getInstance(null); - Assert.assertNotNull(initOnly); - ModuleScopeDestroyOnlyComponent destroyOnly = (ModuleScopeDestroyOnlyComponent) scope.getContext( - "TestServiceDestroyOnly").getInstance(null); - Assert.assertNotNull(destroyOnly); - - Assert.assertTrue(initDestroy.isInitialized()); - Assert.assertTrue(initOnly.isInitialized()); - Assert.assertFalse(initDestroy.isDestroyed()); - Assert.assertFalse(destroyOnly.isDestroyed()); - - // expire module - scope.onEvent(new ModuleStop(this)); - - Assert.assertTrue(initDestroy.isDestroyed()); - Assert.assertTrue(destroyOnly.isDestroyed()); - - scope.stop(); - } - - public void testEagerInit() throws Exception { - EventContext ctx = new EventContextImpl(); - ModuleScopeContext scope = new ModuleScopeContext(ctx); - scope.registerFactories(createEagerInitComponents()); - scope.start(); - scope.onEvent(new ModuleStart(this)); - ModuleScopeEagerInitDestroyComponent initDestroy = (ModuleScopeEagerInitDestroyComponent) scope.getContext( - "TestServiceEagerInitDestroy").getInstance(null); - Assert.assertNotNull(initDestroy); - ModuleScopeEagerInitComponent initOnly = (ModuleScopeEagerInitComponent) scope - .getContext("TestServiceEagerInit").getInstance(null); - Assert.assertNotNull(initOnly); - - Assert.assertTrue(initDestroy.isInitialized()); - Assert.assertTrue(initOnly.isInitialized()); - Assert.assertFalse(initDestroy.isDestroyed()); - - // expire module - scope.onEvent(new ModuleStop(this)); - - Assert.assertTrue(initDestroy.isDestroyed()); - - scope.stop(); - - } - - public void testDestroyOrder() throws Exception { - EventContext ctx = new EventContextImpl(); - ModuleScopeContext scope = new ModuleScopeContext(ctx); - scope.registerFactories(createOrderedInitComponents()); - scope.start(); - scope.onEvent(new ModuleStart(this)); - OrderedInitPojo one = (OrderedInitPojo) scope.getContext("one").getInstance(null); - Assert.assertNotNull(one); - Assert.assertEquals(1, one.getNumberInstantiated()); - Assert.assertEquals(1, one.getInitOrder()); - - OrderedInitPojo two = (OrderedInitPojo) scope.getContext("two").getInstance(null); - Assert.assertNotNull(two); - Assert.assertEquals(2, two.getNumberInstantiated()); - Assert.assertEquals(2, two.getInitOrder()); - - OrderedInitPojo three = (OrderedInitPojo) scope.getContext("three").getInstance(null); - Assert.assertNotNull(three); - Assert.assertEquals(3, three.getNumberInstantiated()); - Assert.assertEquals(3, three.getInitOrder()); - - // expire module - scope.onEvent(new ModuleStop(this)); - Assert.assertEquals(0, one.getNumberInstantiated()); - scope.stop(); - } - - public void testEagerInitDestroyOrder() throws Exception { - EventContext ctx = new EventContextImpl(); - ModuleScopeContext scope = new ModuleScopeContext(ctx); - scope.registerFactories(createOrderedEagerInitComponents()); - scope.start(); - scope.onEvent(new ModuleStart(this)); - OrderedEagerInitPojo one = (OrderedEagerInitPojo) scope.getContext("one").getInstance(null); - Assert.assertNotNull(one); - - OrderedEagerInitPojo two = (OrderedEagerInitPojo) scope.getContext("two").getInstance(null); - Assert.assertNotNull(two); - - OrderedEagerInitPojo three = (OrderedEagerInitPojo) scope.getContext("three").getInstance(null); - Assert.assertNotNull(three); - - // expire module - scope.onEvent(new ModuleStop(this)); - Assert.assertEquals(0, one.getNumberInstantiated()); - scope.stop(); - } - - - private List<ContextFactory<Context>> createComponents() throws BuilderException, ConfigurationLoadException { - AtomicComponent[] ca = new AtomicComponent[3]; - ca[0] = MockFactory.createComponent("TestServiceInitDestroy", ModuleScopeInitDestroyComponent.class, - Scope.MODULE); - ca[1] = MockFactory.createComponent("TestServiceInitOnly", ModuleScopeInitOnlyComponent.class, - Scope.MODULE); - ca[2] = MockFactory.createComponent("TestServiceDestroyOnly", ModuleScopeDestroyOnlyComponent.class, - Scope.MODULE); - List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); - ca[0].getImplementation().setComponentType(introspector.introspect(ModuleScopeInitDestroyComponent.class)); - ca[1].getImplementation().setComponentType(introspector.introspect(ModuleScopeInitOnlyComponent.class)); - ca[2].getImplementation().setComponentType(introspector.introspect(ModuleScopeDestroyOnlyComponent.class)); - for (AtomicComponent aCa : ca) { - builder.build(aCa); - configs.add((ContextFactory<Context>) aCa.getContextFactory()); - - } - return configs; - } - - private List<ContextFactory<Context>> createEagerInitComponents() throws - BuilderException, ConfigurationLoadException { - AtomicComponent[] ca = new AtomicComponent[2]; - ca[0] = MockFactory.createComponent("TestServiceEagerInitDestroy", ModuleScopeEagerInitDestroyComponent.class, - Scope.MODULE); - ca[1] = MockFactory.createComponent("TestServiceEagerInit", ModuleScopeEagerInitComponent.class, - Scope.MODULE); - List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); - ComponentType type = introspector.introspect(OrderedInitPojo.class); - ca[0].getImplementation().setComponentType(introspector.introspect(ModuleScopeEagerInitDestroyComponent.class)); - ca[1].getImplementation().setComponentType(introspector.introspect(ModuleScopeEagerInitComponent.class)); - for (AtomicComponent aCa : ca) { - builder.build(aCa); - configs.add((ContextFactory<Context>) aCa.getContextFactory()); - } - return configs; - } - - private List<ContextFactory<Context>> createOrderedInitComponents() throws - BuilderException, ConfigurationLoadException { - AtomicComponent[] ca = new AtomicComponent[3]; - ca[0] = MockFactory.createComponent("one", OrderedInitPojo.class, Scope.MODULE); - ca[1] = MockFactory.createComponent("two", OrderedInitPojo.class, Scope.MODULE); - ca[2] = MockFactory.createComponent("three", OrderedInitPojo.class, Scope.MODULE); - List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); - ComponentType type = introspector.introspect(OrderedInitPojo.class); - ca[0].getImplementation().setComponentType(type); - ca[1].getImplementation().setComponentType(type); - ca[2].getImplementation().setComponentType(type); - for (AtomicComponent aCa : ca) { - builder.build(aCa); - configs.add((ContextFactory<Context>) aCa.getContextFactory()); - } - return configs; - } - - private List<ContextFactory<Context>> createOrderedEagerInitComponents() throws - BuilderException, ConfigurationLoadException { - AtomicComponent[] ca = new AtomicComponent[3]; - ca[0] = MockFactory.createComponent("one", OrderedEagerInitPojo.class, Scope.MODULE); - ca[1] = MockFactory.createComponent("two", OrderedEagerInitPojo.class, Scope.MODULE); - ca[2] = MockFactory.createComponent("three", OrderedEagerInitPojo.class, Scope.MODULE); - ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); - ComponentType type = introspector.introspect(OrderedEagerInitPojo.class); - ca[0].getImplementation().setComponentType(type); - ca[1].getImplementation().setComponentType(type); - ca[2].getImplementation().setComponentType(type); - List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - for (AtomicComponent aCa : ca) { - builder.build(aCa); - configs.add((ContextFactory<Context>) aCa.getContextFactory()); - - } - return configs; - } - - protected void setUp() throws Exception { - super.setUp(); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); - builder = new JavaContextFactoryBuilder(wireService); - } -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderException.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderException.java deleted file mode 100644 index fc5f7c8c58..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderException.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -public class OrderException extends Exception { - - public OrderException() { - super(); - } - - public OrderException(String message) { - super(message); - } - - public OrderException(String message, Throwable cause) { - super(message, cause); - } - - public OrderException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedDependentPojo.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedDependentPojo.java deleted file mode 100644 index f8fe2af7be..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedDependentPojo.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class OrderedDependentPojo extends OrderedInitPojo { - - private OrderedDependentPojo pojo; - - public OrderedDependentPojo getPojo() { - return pojo; - } - - public void setPojo(OrderedDependentPojo pojo) { - this.pojo = pojo; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedEagerInitPojo.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedEagerInitPojo.java deleted file mode 100644 index f9aeefccbe..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedEagerInitPojo.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -@Scope("MODULE") -public class OrderedEagerInitPojo { - - private static Object lock = new Object(); - private static int numberInstantied; - private int initOrder; - - @Init(eager = true) - public void init() { - synchronized (lock) { - ++numberInstantied; - initOrder = numberInstantied; - } - } - - @Destroy - public void destroy() throws OrderException { - synchronized (lock) { - if (initOrder != numberInstantied) { - throw new OrderException("Instance shutdown done out of order"); - } - --numberInstantied; - } - } - - public int getNumberInstantiated() { - return numberInstantied; - } - - public int getInitOrder() { - return initOrder; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedInitPojo.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedInitPojo.java deleted file mode 100644 index b4d4eb03ba..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedInitPojo.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -@Scope("MODULE") -public class OrderedInitPojo { - - private static Object lock = new Object(); - private static int numberInstantied; - private int initOrder; - - @Init - public void init() { - synchronized (lock) { - ++numberInstantied; - initOrder = numberInstantied; - } - } - - @Destroy - public void destroy() throws OrderException { - synchronized (lock) { - if (initOrder != numberInstantied) { - throw new OrderException("Instance shutdown done out of order"); - } - --numberInstantied; - } - } - - public int getNumberInstantiated() { - return numberInstantied; - } - - public int getInitOrder() { - return initOrder; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopeLifecycleTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopeLifecycleTestCase.java deleted file mode 100644 index bca1e57cbc..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopeLifecycleTestCase.java +++ /dev/null @@ -1,166 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.RequestScopeDestroyOnlyComponent; -import org.apache.tuscany.container.java.mock.components.RequestScopeInitDestroyComponent; -import org.apache.tuscany.container.java.mock.components.RequestScopeInitOnlyComponent; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.RequestScopeContext; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.AtomicComponent; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Lifecycle unit tests for the Http session scope container - * - * @version $Rev$ $Date$ - */ -public class RequestScopeLifecycleTestCase extends TestCase { - - /** - * Tests instance identity is properly maintained - */ - public void testInitDestroy() throws Exception { - EventContext ctx = new EventContextImpl(); - RequestScopeContext scope = new RequestScopeContext(ctx); - scope.registerFactories(createComponents()); - scope.start(); - RequestScopeInitDestroyComponent initDestroy = (RequestScopeInitDestroyComponent) scope.getContext( - "TestServiceInitDestroy").getInstance(null); - Assert.assertNotNull(initDestroy); - RequestScopeInitOnlyComponent initOnly = (RequestScopeInitOnlyComponent) scope.getContext("TestServiceInitOnly") - .getInstance(null); - Assert.assertNotNull(initOnly); - RequestScopeDestroyOnlyComponent destroyOnly = (RequestScopeDestroyOnlyComponent) scope.getContext( - "TestServiceDestroyOnly").getInstance(null); - Assert.assertNotNull(destroyOnly); - - Assert.assertTrue(initDestroy.isInitialized()); - Assert.assertTrue(initOnly.isInitialized()); - Assert.assertFalse(initDestroy.isDestroyed()); - Assert.assertFalse(destroyOnly.isDestroyed()); - - // end request - scope.onEvent(new RequestEnd(this, new Object())); - Assert.assertTrue(initDestroy.isDestroyed()); - Assert.assertTrue(destroyOnly.isDestroyed()); - - scope.stop(); - } - - /** - * Test instances destroyed in proper (i.e. reverse) order - */ - public void testDestroyOrder() throws Exception { - EventContext ctx = new EventContextImpl(); - RequestScopeContext scope = new RequestScopeContext(ctx); - scope.registerFactories(createOrderedInitComponents()); - scope.start(); - // request start - RequestScopedOrderedInitPojo one = (RequestScopedOrderedInitPojo) scope.getContext("one").getInstance(null); - Assert.assertNotNull(one); - Assert.assertEquals(1, one.getNumberInstantiated()); - Assert.assertEquals(1, one.getInitOrder()); - - RequestScopedOrderedInitPojo two = (RequestScopedOrderedInitPojo) scope.getContext("two").getInstance(null); - Assert.assertNotNull(two); - Assert.assertEquals(2, two.getNumberInstantiated()); - Assert.assertEquals(2, two.getInitOrder()); - - RequestScopedOrderedInitPojo three = (RequestScopedOrderedInitPojo) scope.getContext("three").getInstance(null); - Assert.assertNotNull(three); - Assert.assertEquals(3, three.getNumberInstantiated()); - Assert.assertEquals(3, three.getInitOrder()); - - // end request - scope.onEvent(new RequestEnd(this, new Object())); - - Assert.assertEquals(0, one.getNumberInstantiated()); - scope.stop(); - } - - - JavaContextFactoryBuilder builder; - - private List<ContextFactory<Context>> createComponents() throws BuilderException, ConfigurationLoadException { - AtomicComponent[] ca = new AtomicComponent[3]; - ca[0] = MockFactory.createComponent("TestServiceInitDestroy", RequestScopeInitDestroyComponent.class, - Scope.REQUEST); - ca[1] = MockFactory.createComponent("TestServiceInitOnly", RequestScopeInitOnlyComponent.class, - Scope.REQUEST); - ca[2] = MockFactory.createComponent("TestServiceDestroyOnly", RequestScopeDestroyOnlyComponent.class, - Scope.REQUEST); - ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); - ca[0].getImplementation().setComponentType(introspector.introspect(RequestScopeInitDestroyComponent.class)); - ca[1].getImplementation().setComponentType(introspector.introspect(RequestScopeInitOnlyComponent.class)); - ca[2].getImplementation().setComponentType(introspector.introspect(RequestScopeDestroyOnlyComponent.class)); - List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - for (AtomicComponent aCa : ca) { - builder.build(aCa); - configs.add((ContextFactory<Context>) aCa.getContextFactory()); - - } - return configs; - } - - private List<ContextFactory<Context>> createOrderedInitComponents() throws - BuilderException, ConfigurationLoadException { - AtomicComponent[] ca = new AtomicComponent[3]; - ca[0] = MockFactory.createComponent("one", RequestScopedOrderedInitPojo.class, Scope.REQUEST); - ca[1] = MockFactory.createComponent("two", RequestScopedOrderedInitPojo.class, Scope.REQUEST); - ca[2] = MockFactory.createComponent("three", RequestScopedOrderedInitPojo.class, Scope.REQUEST); - ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); - ComponentType type = introspector.introspect(RequestScopedOrderedInitPojo.class); - ca[0].getImplementation().setComponentType(type); - ca[1].getImplementation().setComponentType(type); - ca[2].getImplementation().setComponentType(type); - List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - for (AtomicComponent aCa : ca) { - builder.build(aCa); - configs.add((ContextFactory<Context>) aCa.getContextFactory()); - - } - return configs; - } - - protected void setUp() throws Exception { - super.setUp(); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); - builder = new JavaContextFactoryBuilder(wireService); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopedOrderedInitPojo.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopedOrderedInitPojo.java deleted file mode 100644 index 717c7008c9..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopedOrderedInitPojo.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Destroy; - -@Scope("REQUEST") -public class RequestScopedOrderedInitPojo { - - private static Object lock = new Object(); - private static int numberInstantied; - private int initOrder; - - @Init - public void init() { - synchronized (RequestScopedOrderedInitPojo.lock) { - ++RequestScopedOrderedInitPojo.numberInstantied; - initOrder = RequestScopedOrderedInitPojo.numberInstantied; - } - } - - @Destroy - public void destroy() throws OrderException { - synchronized (RequestScopedOrderedInitPojo.lock) { - if (initOrder != RequestScopedOrderedInitPojo.numberInstantied) { - throw new OrderException("Instance shutdown done out of order"); - } - --RequestScopedOrderedInitPojo.numberInstantied; - } - } - - public int getNumberInstantiated() { - return RequestScopedOrderedInitPojo.numberInstantied; - } - - public int getInitOrder() { - return initOrder; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopeLifecycleTestCase.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopeLifecycleTestCase.java deleted file mode 100644 index 80d8cb71cb..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopeLifecycleTestCase.java +++ /dev/null @@ -1,176 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; -import org.apache.tuscany.container.java.mock.MockFactory; -import org.apache.tuscany.container.java.mock.components.SessionScopeDestroyOnlyComponent; -import org.apache.tuscany.container.java.mock.components.SessionScopeInitDestroyComponent; -import org.apache.tuscany.container.java.mock.components.SessionScopeInitOnlyComponent; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.event.HttpSessionEnd; -import org.apache.tuscany.core.context.event.HttpSessionEvent; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.SessionScopeContext; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.AtomicComponent; -import org.apache.tuscany.model.assembly.ComponentType; - -/** - * Lifecycle unit tests for the Http session scope container - * - * @version $Rev$ $Date$ - */ -public class SessionScopeLifecycleTestCase extends TestCase { - - /** - * Tests instance identity is properly maintained - */ - public void testInitDestroy() throws Exception { - EventContext ctx = new EventContextImpl(); - SessionScopeContext scope = new SessionScopeContext(ctx); - scope.registerFactories(createComponents()); - scope.start(); - Object session = new Object(); - // first request, no need to notify scope container since sessions are - // evaluated lazily - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER,session); - SessionScopeInitDestroyComponent initDestroy = (SessionScopeInitDestroyComponent) scope.getContext( - "TestServiceInitDestroy").getInstance(null); - Assert.assertNotNull(initDestroy); - SessionScopeInitOnlyComponent initOnly = (SessionScopeInitOnlyComponent) scope.getContext("TestServiceInitOnly") - .getInstance(null); - Assert.assertNotNull(initOnly); - SessionScopeDestroyOnlyComponent destroyOnly = (SessionScopeDestroyOnlyComponent) scope.getContext( - "TestServiceDestroyOnly").getInstance(null); - Assert.assertNotNull(destroyOnly); - - Assert.assertTrue(initDestroy.isInitialized()); - Assert.assertTrue(initOnly.isInitialized()); - Assert.assertFalse(initDestroy.isDestroyed()); - Assert.assertFalse(destroyOnly.isDestroyed()); - // end request - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - // expire session - scope.onEvent(new HttpSessionEnd(this,session)); - Assert.assertTrue(initDestroy.isDestroyed()); - Assert.assertTrue(destroyOnly.isDestroyed()); - - scope.stop(); - } - - /** - * Test instances destroyed in proper (i.e. reverse) order - */ - public void testDestroyOrder() throws Exception { - EventContext ctx = new EventContextImpl(); - SessionScopeContext scope = new SessionScopeContext(ctx); - scope.registerFactories(createOrderedInitComponents()); - scope.start(); - Object session = new Object(); - // request start - ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER,session); - - SessionScopedOrderedInitPojo one = (SessionScopedOrderedInitPojo) scope.getContext("one").getInstance(null); - Assert.assertNotNull(one); - Assert.assertEquals(1, one.getNumberInstantiated()); - Assert.assertEquals(1, one.getInitOrder()); - - SessionScopedOrderedInitPojo two = (SessionScopedOrderedInitPojo) scope.getContext("two").getInstance(null); - Assert.assertNotNull(two); - Assert.assertEquals(2, two.getNumberInstantiated()); - Assert.assertEquals(2, two.getInitOrder()); - - SessionScopedOrderedInitPojo three = (SessionScopedOrderedInitPojo) scope.getContext("three").getInstance(null); - Assert.assertNotNull(three); - Assert.assertEquals(3, three.getNumberInstantiated()); - Assert.assertEquals(3, three.getInitOrder()); - - // end request - ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - - // expire session - scope.onEvent(new HttpSessionEnd(this, session)); - Assert.assertEquals(0, one.getNumberInstantiated()); - scope.stop(); - } - - JavaContextFactoryBuilder builder; - - private List<ContextFactory<Context>> createComponents() throws BuilderException, ConfigurationLoadException { - AtomicComponent[] ca = new AtomicComponent[3]; - ca[0] = MockFactory.createComponent("TestServiceInitDestroy", SessionScopeInitDestroyComponent.class, - Scope.SESSION); - ca[1] = MockFactory.createComponent("TestServiceInitOnly", SessionScopeInitOnlyComponent.class, Scope.SESSION); - ca[2] = MockFactory.createComponent("TestServiceDestroyOnly", SessionScopeDestroyOnlyComponent.class, - Scope.SESSION); - ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); - ca[0].getImplementation().setComponentType(introspector.introspect(SessionScopeInitDestroyComponent.class)); - ca[1].getImplementation().setComponentType(introspector.introspect(SessionScopeInitOnlyComponent.class)); - ca[2].getImplementation().setComponentType(introspector.introspect(SessionScopeDestroyOnlyComponent.class)); - List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - for (AtomicComponent aCa : ca) { - builder.build(aCa); - configs.add((ContextFactory<Context>) aCa.getContextFactory()); - - } - return configs; - } - - private List<ContextFactory<Context>> createOrderedInitComponents() throws - BuilderException, ConfigurationLoadException { - AtomicComponent[] ca = new AtomicComponent[3]; - ca[0] = MockFactory.createComponent("one", SessionScopedOrderedInitPojo.class, Scope.SESSION); - ca[1] = MockFactory.createComponent("two", SessionScopedOrderedInitPojo.class, Scope.SESSION); - ca[2] = MockFactory.createComponent("three", SessionScopedOrderedInitPojo.class, Scope.SESSION); - ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); - ComponentType type = introspector.introspect(SessionScopedOrderedInitPojo.class); - ca[0].getImplementation().setComponentType(type); - ca[1].getImplementation().setComponentType(type); - ca[2].getImplementation().setComponentType(type); - List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - for (AtomicComponent aCa : ca) { - builder.build(aCa); - configs.add((ContextFactory<Context>) aCa.getContextFactory()); - - } - return configs; - } - - protected void setUp() throws Exception { - super.setUp(); - WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(),new DefaultPolicyBuilderRegistry()); - builder = new JavaContextFactoryBuilder(wireService); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopedOrderedInitPojo.java b/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopedOrderedInitPojo.java deleted file mode 100644 index 683247a5c8..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopedOrderedInitPojo.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.java.scopes; - -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Destroy; - -@Scope("SESSION") -public class SessionScopedOrderedInitPojo { - - private static Object lock = new Object(); - private static int numberInstantied; - private int initOrder; - - @Init - public void init() { - synchronized (SessionScopedOrderedInitPojo.lock) { - ++SessionScopedOrderedInitPojo.numberInstantied; - initOrder = SessionScopedOrderedInitPojo.numberInstantied; - } - } - - @Destroy - public void destroy() throws OrderException { - synchronized (SessionScopedOrderedInitPojo.lock) { - if (initOrder != SessionScopedOrderedInitPojo.numberInstantied) { - throw new OrderException("Instance shutdown done out of order"); - } - --SessionScopedOrderedInitPojo.numberInstantied; - } - } - - public int getNumberInstantiated() { - return SessionScopedOrderedInitPojo.numberInstantied; - } - - public int getInitOrder() { - return initOrder; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/resources/helloworld/example.wsdl b/branches/java-M1/java/sca/containers/container.java/src/test/resources/helloworld/example.wsdl deleted file mode 100644 index 3a23e7b717..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/resources/helloworld/example.wsdl +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<wsdl:definitions targetNamespace="http://www.example.org" - xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - name="example"> - - <wsdl:portType name="HelloWorld"> - </wsdl:portType> -</wsdl:definitions> diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/resources/helloworld/sca.module b/branches/java-M1/java/sca/containers/container.java/src/test/resources/helloworld/sca.module deleted file mode 100644 index d5bc2cd5f9..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/resources/helloworld/sca.module +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" - name="Helloworld"> - - <component name="HelloWorld"> - <implementation.java class="org.apache.tuscany.container.java.integration.HelloWorldImpl"/> - </component> - -<!-- - <import.wsdl wsdlLocation="example.wsdl"/> - - <externalService name="external"> - <interface.wsdl interface="http://www.example.org#wsdl.interface(HelloWorld)"/> - </externalService> ---> - -</module> diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/resources/helloworldmc/sca.module b/branches/java-M1/java/sca/containers/container.java/src/test/resources/helloworldmc/sca.module deleted file mode 100644 index 8c590976de..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/resources/helloworldmc/sca.module +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" - name="HelloworldMC"> - - <component name="HelloWorld"> - <implementation.java class="org.apache.tuscany.container.java.integration.HelloWorldMCImpl"/> - <references> - <!-- <v:greetingProvider>GreetingProvider</v:greetingProvider>--> - </references> - <properties> - <v:bar>bar</v:bar> - <v:locale>en</v:locale> - </properties> - </component> - <wire> - <source.uri>HelloWorld/greetingProvider</source.uri> - <target.uri>GreetingProvider</target.uri> - </wire> - <component name="GreetingProvider"> - <implementation.java class="org.apache.tuscany.container.java.integration.GreetingProviderImpl"/> - <properties> - <v:greeting>Hello </v:greeting> - </properties> - </component> -</module> diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/assembly/tests/sca.module b/branches/java-M1/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/assembly/tests/sca.module deleted file mode 100644 index d0f0856225..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/assembly/tests/sca.module +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
-
- name="tuscany.container.java.assembly.tests.bigbank.account">
-
- <entryPoint name="AccountService">
- <interface.java interface="org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.account.AccountService"/>
- <binding.ws port="http://www.bigbank.com/AccountService#wsdl.endpoint(AccountService/AccountServiceSOAP)"/>
- <reference>AccountServiceComponent</reference>
- </entryPoint>
-
- <component name="AccountServiceComponent">
- <implementation.java class="org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.account.AccountServiceImpl"/>
- <properties>
- <v:currency overridable="may">EURO</v:currency>
- </properties>
- <references>
- <v:accountDataService>AccountDataServiceComponent</v:accountDataService>
- <v:stockQuoteService>StockQuoteService</v:stockQuoteService>
- </references>
- </component>
-
- <component name="AccountDataServiceComponent">
- <implementation.java class="org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata.AccountDataServiceImpl"/>
- </component>
-
- <component name="StockQuoteService">
- <implementation.java class="org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.stockquote.StockQuoteServiceImpl"/>
- </component>
-
- <!--
- <externalService name="StockQuoteService">
- <interface.java interface="org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.stockquote"/>
- <binding.ws port="http://www.quickstockquote.com/StockQuoteService#wsdl.endpoint(StockQuote/StockQuoteServiceSOAP)"/>
- </externalService>
- -->
-
-</module>
-
diff --git a/branches/java-M1/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/config/ModuleComponentLoaderTest1.module b/branches/java-M1/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/config/ModuleComponentLoaderTest1.module deleted file mode 100644 index 46169aa304..0000000000 --- a/branches/java-M1/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/config/ModuleComponentLoaderTest1.module +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<module xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- name="ModuleComponentLoaderTest1">
-
- <component name="HelloWorldServiceComponent">
- <implementation.java class="org.apache.tuscany.container.java.assembly.mock.HelloWorldImpl"/>
- </component>
-</module>
diff --git a/branches/java-M1/java/sca/containers/container.rhino/pom.xml b/branches/java-M1/java/sca/containers/container.rhino/pom.xml deleted file mode 100644 index 3f8d8fe9cd..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project> - - <parent> - <groupId>org.apache.tuscany.sca.containers</groupId> - <artifactId>tuscany-sca-containers</artifactId> - <version>incubating-M1</version> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>tuscany-container-rhino</artifactId> - <name>Tuscany Rhino JavaScript Container</name> - <description>Tuscany Rhino JavaScript Container</description> - <version>incubating-M1</version> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-core</artifactId> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>rhino</groupId> - <artifactId>js</artifactId> - <version>1.6R2</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.databinding</groupId> - <artifactId>tuscany-databinding-sdo</artifactId> <!-- Reqd for E4X --> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>xmlbeans</groupId> - <artifactId>xbean</artifactId> <!-- Reqd for E4X --> - <version>2.1.0</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - -</project> diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java b/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java deleted file mode 100644 index c68bf239a3..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.rhino.assembly; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.impl.AtomicImplementationImpl; - -import commonj.sdo.helper.TypeHelper; - -/** - * Default implementation of a JavScript component implementation type - * - * @version $Rev$ $Date$ - */ -public class JavaScriptImplementation extends AtomicImplementationImpl { - - private String scriptFile; - - private String script; - - private ResourceLoader resourceLoader; - - private TypeHelper typeHelper; - - public JavaScriptImplementation() { - super(); - } - - public void setResourceLoader(ResourceLoader resourceLoader) { - this.resourceLoader = resourceLoader; - } - - public ResourceLoader getResourceLoader() { - return resourceLoader; - } - - public TypeHelper getTypeHelper() { - return typeHelper; - } - - public void setTypeHelper(TypeHelper typeHelper) { - this.typeHelper = typeHelper; - } - - public String getScriptFile() { - return scriptFile; - } - - public void setScriptFile(String fn) { - scriptFile = fn; - } - - public String getScript() { - return script; - } - - public void setScript(String script) { - this.script = script; - } -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java b/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java deleted file mode 100644 index 2012971014..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.rhino.builder; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.wsdl.Input; -import javax.wsdl.Message; -import javax.wsdl.Operation; -import javax.wsdl.Part; -import javax.wsdl.PortType; - -import org.apache.tuscany.container.rhino.assembly.JavaScriptImplementation; -import org.apache.tuscany.container.rhino.config.JavaScriptContextFactory; -import org.apache.tuscany.container.rhino.rhino.E4XDataBinding; -import org.apache.tuscany.container.rhino.rhino.RhinoE4XScript; -import org.apache.tuscany.container.rhino.rhino.RhinoScript; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.extension.ContextFactoryBuilderSupport; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; - -import commonj.sdo.helper.TypeHelper; - -/** - * Builds {@link org.apache.tuscany.container.rhino.config.JavaScriptContextFactory}s from a JavaScript component type - * - * @version $Rev$ $Date$ - */ -@org.osoa.sca.annotations.Scope("MODULE") -public class JavaScriptContextFactoryBuilder extends ContextFactoryBuilderSupport<JavaScriptImplementation> { - - @Override - protected ContextFactory createContextFactory(String componentName, JavaScriptImplementation jsImplementation, Scope scope) { - - Map<String, Class> services = new HashMap<String, Class>(); - for (Service service : jsImplementation.getComponentType().getServices()) { - services.put(service.getName(), service.getServiceContract().getInterface()); - } - - Map<String, Object> defaultProperties = new HashMap<String, Object>(); - for (org.apache.tuscany.model.assembly.Property property : jsImplementation.getComponentType().getProperties()) { - defaultProperties.put(property.getName(), property.getDefaultValue()); - } - - String script = jsImplementation.getScript(); - ClassLoader cl = jsImplementation.getResourceLoader().getClassLoader(); - - RhinoScript invoker; - if (isE4XStyle(componentName, jsImplementation.getComponentType().getServices())) { - E4XDataBinding dataBinding = createDataBinding(jsImplementation); - invoker = new RhinoE4XScript(componentName, script, defaultProperties, cl, dataBinding); - } else { - invoker = new RhinoScript(componentName, script, defaultProperties, cl); - } - - Map<String, Object> properties = new HashMap<String, Object>(); - JavaScriptContextFactory contextFactory = new JavaScriptContextFactory(componentName, scope, services, properties, invoker); - - return contextFactory; - } - - /** - * Tests if this should be an E4X style service - * Its E4X if the JavaScript component uses WSDL to define its interface - */ - protected boolean isE4XStyle(String componentName, List<Service> services) { - Boolean isE4XStyle = null; - for (Service service : services) { - ServiceContract sc = service.getServiceContract(); - if (sc instanceof WSDLServiceContract) { - if (isE4XStyle != null && !isE4XStyle.booleanValue()) { - throw new BuilderConfigException("mixed service interface types not supportted"); - } - isE4XStyle = Boolean.TRUE; - } else { - isE4XStyle = Boolean.FALSE; - } - } - return isE4XStyle.booleanValue(); - } - - /** - * Create the data binding for the component initialized for each operation in the service - */ - protected E4XDataBinding createDataBinding(JavaScriptImplementation jsImplementation) { - ClassLoader classLoader = jsImplementation.getResourceLoader().getClassLoader(); - TypeHelper typeHelper = jsImplementation.getTypeHelper(); - E4XDataBinding dataBinding = new E4XDataBinding(classLoader, typeHelper); - for (Service service : jsImplementation.getComponentType().getServices()) { - ServiceContract sc = service.getServiceContract(); - if (sc instanceof WSDLServiceContract) { - PortType pt = ((WSDLServiceContract) sc).getPortType(); - for (Object o : pt.getOperations()) { - Operation operation = (Operation) o; - Input input = operation.getInput(); - if (input != null) { - Message message = input.getMessage(); - if (message != null) { - List parts = message.getOrderedParts(null); - if (parts != null && parts.size() > 0) { - Part part = (Part) parts.get(0); - dataBinding.addElementQName(operation.getName(), part.getElementName()); - } - } - } - } - } - } - return dataBinding; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptTargetWireBuilder.java b/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptTargetWireBuilder.java deleted file mode 100644 index 0c45aee35e..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptTargetWireBuilder.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.rhino.builder; - -import java.lang.reflect.Method; - -import org.apache.tuscany.container.rhino.config.JavaScriptContextFactory; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.extension.ComponentTargetInvoker; -import org.apache.tuscany.core.extension.WireBuilderSupport; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.osoa.sca.annotations.Scope; - -/** - * Responsible for bridging source- and target-side invocations chains when the target type is a JavaScript implementation - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class JavaScriptTargetWireBuilder extends WireBuilderSupport<JavaScriptContextFactory> { - - protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) { - return new ComponentTargetInvoker(targetName, operation, context); - } -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/config/JavaScriptContextFactory.java b/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/config/JavaScriptContextFactory.java deleted file mode 100644 index 28a0302a4f..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/config/JavaScriptContextFactory.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.rhino.config; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.container.rhino.context.JavaScriptComponentContext; -import org.apache.tuscany.container.rhino.rhino.RhinoScript; -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Creates instance contexts for JavaScript component types - * - * @version $Rev$ $Date$ - */ -public class JavaScriptContextFactory implements ContextFactory<AtomicContext>, ContextResolver { - - private Scope scope; - - private String name; - - private Map<String, TargetWireFactory> targetProxyFactories = new HashMap<String, TargetWireFactory>(); - - private List<SourceWireFactory> sourceProxyFactories = new ArrayList<SourceWireFactory>(); - - private Map<String, Class> services; - - private Map<String, Object> properties; - - private RhinoScript invoker; - - private CompositeContext parentContext; - - public JavaScriptContextFactory(String name, Scope scope, Map<String, Class> services, Map<String, Object> properties, RhinoScript invoker) { - this.name = name; - this.scope = scope; - this.services = services; - this.properties = properties; - this.invoker = invoker; - } - - public AtomicContext createContext() throws ContextCreationException { - return new JavaScriptComponentContext(name, services, properties, sourceProxyFactories, targetProxyFactories, invoker.copy()); - } - - public Scope getScope() { - return scope; - } - - public String getName() { - return name; - } - - public void addProperty(String propertyName, Object value) { - properties.put(propertyName, value); - } - - public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { - targetProxyFactories.put(serviceName, factory); - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - return targetProxyFactories.get(serviceName); - } - - public Map<String, TargetWireFactory> getTargetWireFactories() { - return targetProxyFactories; - } - - public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { - sourceProxyFactories.add(factory); - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factories, boolean multiplicity) { - sourceProxyFactories.addAll(factories); - } - - public List<SourceWireFactory> getSourceWireFactories() { - return sourceProxyFactories; - } - - public void prepare(CompositeContext parent) { - parentContext = parent; - } - - public CompositeContext getCurrentContext() { - return parentContext; - } - -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/context/JavaScriptComponentContext.java b/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/context/JavaScriptComponentContext.java deleted file mode 100644 index bfa4eeaffb..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/context/JavaScriptComponentContext.java +++ /dev/null @@ -1,140 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.rhino.context; - -import org.apache.tuscany.container.rhino.rhino.RhinoScript; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.context.event.InstanceCreated; -import org.apache.tuscany.core.context.impl.AbstractContext; -import org.apache.tuscany.core.wire.ProxyCreationException; -import org.apache.tuscany.core.wire.WireFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.osoa.sca.ServiceRuntimeException; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class JavaScriptComponentContext extends AbstractContext implements AtomicContext { - - private Map<String, Class> services; - - private RhinoScript rhinoInvoker; - - private Map<String, Object> properties; - - private List<SourceWireFactory> sourceProxyFactories; - - private Map<String, TargetWireFactory> targetProxyFactories; - - private Object instance; - - public JavaScriptComponentContext(String name, Map<String, Class> services, Map<String, Object> properties, - List<SourceWireFactory> sourceProxyFactories, Map<String, TargetWireFactory> targetProxyFactories, RhinoScript invoker) { - super(name); - assert (services != null) : "No service interface mapping specified"; - assert (properties != null) : "No properties specified"; - this.services = services; - this.properties = properties; - this.rhinoInvoker = invoker; - this.sourceProxyFactories = sourceProxyFactories; - this.targetProxyFactories = targetProxyFactories; - } - - public Object getInstance(QualifiedName qName) throws TargetException { - return getInstance(qName, true); - } - - public void init() throws TargetException { - getInstance(null, false); - } - - public void destroy() throws TargetException { - - } - - private synchronized Object getInstance(QualifiedName qName, boolean notify) throws TargetException { - String portName = qName.getPortName(); - WireFactory targetFactory; - if (portName != null) { - targetFactory = targetProxyFactories.get(portName); - } else { - //FIXME The port name is null here, either locateService needs more information (the expected interface) to - // select the correct port, or we need to return a factory that matches the whole set of services exposed by - // the component. - targetFactory = targetProxyFactories.values().iterator().next(); - } - if (targetFactory == null) { - TargetException e = new TargetException("Target service not found"); - e.setIdentifier(qName.getPortName()); - e.addContextName(getName()); - throw e; - } - try { - Object proxy = targetFactory.createProxy(); //createProxy(new Class[] { iface }); - if (notify) { - publish(new InstanceCreated(this)); - } - return proxy; - } catch (ProxyCreationException e) { - TargetException te = new TargetException("Error returning target", e); - e.setIdentifier(qName.getPortName()); - e.addContextName(getName()); - throw te; - } - } - - public Object getTargetInstance() throws TargetException { - rhinoInvoker.updateScriptScope(createServiceReferences()); // create references - rhinoInvoker.updateScriptScope(properties); // create prop values - return rhinoInvoker; - } - - /** - * Creates a map containing any ServiceReferences - */ - private Map createServiceReferences() { - try { - Map<String, Object> context = new HashMap<String, Object>(); - for (SourceWireFactory proxyFactory : sourceProxyFactories) { - context.put(proxyFactory.getConfiguration().getReferenceName(), proxyFactory.createProxy()); - } - return context; - } catch (ProxyCreationException e) { - throw new ServiceRuntimeException(e); - } - } - - public boolean isEagerInit() { - return false; - } - - public boolean isDestroyable() { - return false; - } - - public void start() throws CoreRuntimeException { - } - - public void stop() throws CoreRuntimeException { - } - -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java b/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java deleted file mode 100644 index e28776049c..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java +++ /dev/null @@ -1,168 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.rhino.loader; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.container.rhino.assembly.JavaScriptImplementation; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.InvalidRootElementException; -import org.apache.tuscany.core.config.MissingResourceException; -import org.apache.tuscany.core.config.SidefileLoadException; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.loader.StAXElementLoader; -import org.apache.tuscany.core.loader.StAXLoaderRegistry; -import org.apache.tuscany.core.loader.assembly.AssemblyConstants; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.model.assembly.ComponentType; -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class JavaScriptImplementationLoader implements StAXElementLoader<JavaScriptImplementation> { - - public static final QName IMPLEMENTATION_JS = new QName("http://org.apache.tuscany/xmlns/js/0.9", "implementation.js"); - - protected StAXLoaderRegistry registry; - - private XMLInputFactory xmlFactory; - - public JavaScriptImplementationLoader() { - // todo make this a reference to a system service - xmlFactory = XMLInputFactory.newInstance(); - } - - @Autowire - public void setRegistry(StAXLoaderRegistry registry) { - this.registry = registry; - } - - @Init(eager = true) - public void start() { - registry.registerLoader(IMPLEMENTATION_JS, this); - } - - @Destroy - public void stop() { - registry.unregisterLoader(IMPLEMENTATION_JS, this); - } - - public JavaScriptImplementation load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - String scriptFile = reader.getAttributeValue(null, "scriptFile"); - String script = loadScript(scriptFile, loaderContext.getResourceLoader()); - ComponentType componentType = loadComponentType(scriptFile, loaderContext); - - JavaScriptImplementation jsImpl = new JavaScriptImplementation(); - jsImpl.setComponentType(componentType); - jsImpl.setScriptFile(scriptFile); - jsImpl.setScript(script); - jsImpl.setResourceLoader(loaderContext.getResourceLoader()); - jsImpl.setTypeHelper(registry.getContext().getTypeHelper()); - return jsImpl; - } - - protected String loadScript(String scriptFile, ResourceLoader resourceLoader) throws ConfigurationLoadException { - URL url = resourceLoader.getResource(scriptFile); - if (url == null) { - throw new ConfigurationLoadException(scriptFile); - } - InputStream inputStream; - try { - inputStream = url.openStream(); - } catch (IOException e) { - throw new ConfigurationLoadException(scriptFile, e); - } - try { - StringBuilder sb = new StringBuilder(1024); - int n; - while ((n = inputStream.read()) != -1) { - sb.append((char) n); - } - return sb.toString(); - } catch (IOException e) { - throw new ConfigurationLoadException(scriptFile, e); - } finally { - try { - inputStream.close(); - } catch (IOException e) { - // ignore - } - } - } - - protected ComponentType loadComponentType(String scriptFile, LoaderContext loaderContext) throws SidefileLoadException, MissingResourceException{ - String sidefile = scriptFile.substring(0, scriptFile.lastIndexOf('.')) + ".componentType"; - URL componentTypeFile = loaderContext.getResourceLoader().getResource(sidefile); - if (componentTypeFile == null) { - throw new MissingResourceException(sidefile); - } - - try { - XMLStreamReader reader; - InputStream is; - is = componentTypeFile.openStream(); - try { - reader = xmlFactory.createXMLStreamReader(is); - try { - reader.nextTag(); - if (!AssemblyConstants.COMPONENT_TYPE.equals(reader.getName())) { - InvalidRootElementException e = new InvalidRootElementException(AssemblyConstants.COMPONENT_TYPE, reader.getName()); - e.setResourceURI(componentTypeFile.toString()); - throw e; - } - return (ComponentType) registry.load(reader, loaderContext); - } finally { - try { - reader.close(); - } catch (XMLStreamException e) { - // ignore - } - } - } finally { - try { - is.close(); - } catch (IOException e) { - // ignore - } - } - } catch (IOException e) { - SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); - sfe.setResourceURI(componentTypeFile.toString()); - throw sfe; - } catch (XMLStreamException e) { - SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); - sfe.setResourceURI(componentTypeFile.toString()); - throw sfe; - } catch (ConfigurationLoadException e) { - SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); - sfe.setResourceURI(componentTypeFile.toString()); - throw sfe; - } - } -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/E4XDataBinding.java b/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/E4XDataBinding.java deleted file mode 100644 index 3969735b23..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/E4XDataBinding.java +++ /dev/null @@ -1,108 +0,0 @@ -/**
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.container.rhino.rhino;
-
-import java.io.ByteArrayInputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.core.wire.InvocationRuntimeException;
-import org.apache.tuscany.databinding.sdo.SDOXMLHelper;
-import org.apache.xmlbeans.XmlObject;
-import org.mozilla.javascript.Context;
-import org.mozilla.javascript.Scriptable;
-
-import commonj.sdo.helper.TypeHelper;
-
-/**
- * DataBinding to convert between Java objects and JavaScript E4X XML objects. This uses SDO to do the conversion between XML and Java so WSDL/XSDs
- * need to have be registered with the SDO runtime.
- *
- * TODO: suport non-wrapped WSDL
- */
-public class E4XDataBinding {
-
- private ClassLoader classLoader;
-
- private TypeHelper typeHelper;
-
- private Map<String, QName> function2ElementMap;
-
- private static final boolean IS_WRAPPED = true;
-
- public E4XDataBinding(ClassLoader classLoader, TypeHelper typeHelper) {
- this.classLoader = classLoader;
- this.typeHelper = typeHelper;
- this.function2ElementMap = new HashMap<String, QName>();
- }
-
- /**
- * Convert E4X XML to Java objects
- *
- * @param e4xXML
- * @return the array of Objects
- */
- public Object[] toObjects(Scriptable e4xXML) {
- byte[] xmlBytes = e4xXML.toString().getBytes();
- Object[] os = SDOXMLHelper.toObjects(classLoader, typeHelper, xmlBytes, IS_WRAPPED);
- return os;
- }
-
- /**
- * Convert request Java objects to XML
- *
- * @param functionName
- * @param os
- * @param scope
- * @return a JavaScript E4X XML object
- */
- public Scriptable toE4X(String functionName, Object[] os, Scriptable scope) {
- QName elementQN = function2ElementMap.get(functionName);
- byte[] xmlBytes = SDOXMLHelper.toXMLBytes(classLoader, typeHelper, os, elementQN, IS_WRAPPED);
-
- XmlObject xmlObject;
- try {
- xmlObject = XmlObject.Factory.parse(new ByteArrayInputStream(xmlBytes));
- } catch (Exception e) {
- throw new InvocationRuntimeException(e);
- }
-
- Context cx = Context.enter();
- try {
-
- Object xml = cx.getWrapFactory().wrap(cx, scope, xmlObject, XmlObject.class);
- Scriptable jsXML = cx.newObject(scope, "XML", new Object[] { xml });
-
- return jsXML;
-
- } finally {
- Context.exit();
- }
- }
-
- /**
- * Add the XML element name to use for an operation when converting from
- * Java objects to XML.
- *
- * @param functionName
- * @param elementQN
- */
- public void addElementQName(String functionName, QName elementQN) {
- function2ElementMap.put(functionName, elementQN);
- }
-}
diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScript.java b/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScript.java deleted file mode 100644 index 5f42f6d164..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScript.java +++ /dev/null @@ -1,76 +0,0 @@ -/**
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.container.rhino.rhino;
-
-import java.util.Map;
-
-import org.mozilla.javascript.Function;
-import org.mozilla.javascript.Scriptable;
-import org.mozilla.javascript.xml.XMLObject;
-
-/**
- * Invokes a JavaScript/E4X function with argument and return values that may be E4X XML objects.
- */
-public class RhinoE4XScript extends RhinoScript {
-
- private E4XDataBinding dataBinding;
-
- public RhinoE4XScript(String scriptName, String script, Map context, ClassLoader cl, E4XDataBinding dataBinding) {
- super(scriptName, script, context, cl);
- this.dataBinding = dataBinding;
- }
-
- protected RhinoE4XScript(String scriptName, String script, Scriptable scriptScope, E4XDataBinding dataBinding) {
- super(scriptName, script, scriptScope);
- this.dataBinding = dataBinding;
- }
-
- /**
- * Turn args to JS objects and convert any OMElement to E4X XML
- */
- @Override
- protected Object[] processArgs(String functionName, Object[] args, Scriptable scope) {
- return new Object[] { dataBinding.toE4X(functionName, args, scope) };
- }
-
- /**
- * Unwrap and convert response converting any E4X XML into Java objects
- */
- @Override
- protected Object processResponse(String functionName, Object response, Class responseClass) {
- if (response instanceof XMLObject) {
- Object[] os = dataBinding.toObjects((XMLObject) response);
- if (os == null || os.length < 1) {
- return null;
- } else {
- return os[0];
- }
- } else {
- return super.processResponse(functionName, response, responseClass);
- }
- }
-
- @Override
- protected Function getFunction(Scriptable scope, String functionName) {
- return super.getFunction(scope, "process");
- }
-
- @Override
- public RhinoE4XScript copy() {
- return new RhinoE4XScript(scriptName, script, scriptScope, dataBinding);
- }
-
-}
diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoScript.java b/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoScript.java deleted file mode 100644 index 5518159f69..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoScript.java +++ /dev/null @@ -1,290 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.rhino.rhino; - -import java.util.Iterator; -import java.util.Map; - -import org.apache.tuscany.core.extension.ExternalServiceInvoker; -import org.mozilla.javascript.Context; -import org.mozilla.javascript.ContextFactory; -import org.mozilla.javascript.Function; -import org.mozilla.javascript.ImporterTopLevel; -import org.mozilla.javascript.Script; -import org.mozilla.javascript.Scriptable; -import org.mozilla.javascript.Wrapper; - -/** - * Represents, and is responsible for dispatching to, a JavaScript artifact in Rhino - */ -public class RhinoScript implements ExternalServiceInvoker { - - protected String scriptName; - - protected String script; - - protected Scriptable scriptScope; - - private Scriptable sharedScope; - - /* - * Enable dynamic scopes so a script can be used concurrently with a global shared scope and individual execution - * scopes. See http://www.mozilla.org/rhino/scopes.html TODO: need to review how ths fits in with Tuscany scopes - */ - private static class MyFactory extends ContextFactory { - protected boolean hasFeature(Context cx, int featureIndex) { - if (featureIndex == Context.FEATURE_DYNAMIC_SCOPE) { - return true; - } - return super.hasFeature(cx, featureIndex); - } - } - - static { - ContextFactory.initGlobal(new MyFactory()); - } - - /** - * Create a new RhinoInvoker. - * - * @param scriptName the name of the script. Can be anything, only used in messages to identify the script - * @param script the complete script - */ - public RhinoScript(String scriptName, String script) { - this(scriptName, script, (Map) null, null); - } - - /** - * Create a new RhinoInvoker. - * - * @param scriptName the name of the script. Can be anything, only used in messages to identify the script - * @param script the complete script - * @param context name-value pairs that are added in to the scope where the script is compiled. May be null. The - * value objects are made available to the script by using a variable with the name. - */ - public RhinoScript(String scriptName, String script, Map context, ClassLoader cl) { - this.scriptName = scriptName; - this.script = script; - initScriptScope(scriptName, script, context, cl); - initSharedScope(); - } - - /** - * Construct a RhinoInvoker from another RhinoInvoker object. This uses the original script scope so the script - * doesn't need to be recompiled. - */ - protected RhinoScript(String scriptName, String script, Scriptable scriptScope) { - this.scriptName = scriptName; - this.script = script; - this.scriptScope = scriptScope; - initSharedScope(); - } - - /** - * Invoke a script function - * - * @param functionName the name of the function to invoke. - * @param arg arguments to the function, may be a single object or an array of objects. - * @return the function return value. - */ - public Object invoke(String functionName, Object[] args) { - return invoke(functionName, args, null, null); - } - - /** - * Invoke a script function - * - * @param functionName the name of the function to invoke. - * @param arg arguments to the function, may be a single object or an array of objects. - * @param contexts a Map of name-value pairs which are added to the wire Scope to enable the script to access - * the values by using the variable in name. - * @return the function return value. - */ - public Object invoke(String functionName, Object[] args, Map contexts) { - return invoke(functionName, args, null, contexts); - } - - /** - * Invoke a script function - * - * @param functionName the name of the function to invoke. - * @param arg arguments to the function, may be a single object or an array of objects. - * @param responseClass the desired class of the response object. - * @param contexts a Map of name-value pairs which are added to the wire Scope to enable the script to access - * the values by using the variable in name. - * @return the function return value. - */ - public Object invoke(String functionName, Object[] args, Class responseClass, Map contexts) { - Context cx = Context.enter(); - try { - Function function = getFunction(scriptScope, functionName); - Scriptable invocationScope = getInvocationScope(cx, contexts); - Object[] jsArgs = processArgs(functionName, args, invocationScope); - Object jsResponse = function.call(cx, invocationScope, invocationScope, jsArgs); - Object response = processResponse(functionName, jsResponse, responseClass); - return response; - } finally { - Context.exit(); - } - } - - /** - * Turn args to JS objects and convert any OMElement to E4X XML - */ - protected Object[] processArgs(String functionName, Object[] arg, Scriptable scope) { - Object[] args; - if (arg == null) { - args = new Object[] { null }; - } else if (arg.getClass().isArray()) { - args = (Object[]) arg; - for (int i = 0; i < args.length; i++) { - args[i] = Context.toObject(args[i], scope); - } - } else { - args = new Object[] { Context.toObject(arg, scope) }; - } - return args; - } - - /** - * Unwrap and convert response - */ - protected Object processResponse(String functionName, Object response, Class responseClass) { - if (Context.getUndefinedValue().equals(response)) { - response = null; - } else if (response instanceof Wrapper) { - response = ((Wrapper) response).unwrap(); - } else { - if (responseClass != null) { - response = Context.jsToJava(response, responseClass); - } else { - response = Context.jsToJava(response, String.class); - } - } - return response; - } - - /** - * Create a Rhino scope and compile the script into it - */ - protected void initScriptScope(String fileName, String scriptCode, Map context, ClassLoader cl) { - Context cx = Context.enter(); - try { - - if (cl != null) { - cx.setApplicationClassLoader(cl); - } - this.scriptScope = new ImporterTopLevel( cx, true ); - Script compiledScript = cx.compileString(scriptCode, fileName, 1, null); - compiledScript.exec(cx, scriptScope); - addContexts(scriptScope, context); - - } finally { - Context.exit(); - } - } - - /** - * Initializes the shared scope - */ - protected void initSharedScope() { - Context cx = Context.enter(); - try { - - this.sharedScope = cx.newObject(scriptScope); - sharedScope.setPrototype(scriptScope); - sharedScope.setParentScope(null); - - } finally { - Context.exit(); - } - } - - /** - * Get a Rhino scope for the function wire. If the wire has no context objects then this will use the - * shared scope otherwise a new scope is created to hold the context objects. Any new variables the executing script - * might define will go in the sharedScope. This new scope is just to hold the wire specific context objects. - */ - protected Scriptable getInvocationScope(Context cx, Map contexts) { - - Scriptable scope; - if (contexts == null || contexts.size() == 0) { - scope = sharedScope; - } else { - scope = cx.newObject(sharedScope); - scope.setPrototype(sharedScope); - scope.setParentScope(null); - addContexts(scope, contexts); - } - - return scope; - } - - /** - * Add the context to the scope. This will make the objects available to a script by using the name it was added - * with. - */ - protected void addContexts(Scriptable scope, Map contexts) { - if (contexts != null) { - for (Iterator i = contexts.keySet().iterator(); i.hasNext();) { - String name = (String) i.next(); - Object value = contexts.get(name); - if (value != null) { - scope.put(name, scope, Context.toObject(value, scope)); - } - } - } - } - - /** - * Get the Rhino Function object for the named script function - */ - protected Function getFunction(Scriptable scope, String functionName) { - - Object handleObj = scope.get(functionName, scope); - - if (!(handleObj instanceof Function)) { - throw new RuntimeException("script function '" + functionName + "' is undefined or not a function in script " - + scriptName); - } - - return (Function) handleObj; - } - - /** - * Make a copy of this RhinoScript object. This shares the script scope to avoid the overhead of recompiling the - * script, and to allow any initialization done by the script to be shared. - */ - public RhinoScript copy() { - return new RhinoScript(scriptName, script, scriptScope); - } - - /** - * Update the scope where the script is complied with new context values - * - * @param properties - */ - public void updateScriptScope(Map context) { - Context.enter(); - try { - addContexts(scriptScope, context); - } finally { - Context.exit(); - } - } - -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 4095b1af76..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,777 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - -=============================================================================== - -For the Rhino JavaScript project: - -Netscape Public License V1.1 - - AMENDMENTS - - The Netscape Public License Version 1.1 ("NPL") consists of the - Mozilla Public License Version 1.1 with the following Amendments, - including Exhibit A-Netscape Public License. Files identified with - "Exhibit A-Netscape Public License" are governed by the Netscape - Public License Version 1.1. - - Additional Terms applicable to the Netscape Public License. - I. Effect. - These additional terms described in this Netscape Public - License -- Amendments shall apply to the Mozilla Communicator - client code and to all Covered Code under this License. - - II. "Netscape's Branded Code" means Covered Code that Netscape - distributes and/or permits others to distribute under one or more - trademark(s) which are controlled by Netscape but which are not - licensed for use under this License. - - III. Netscape and logo. - This License does not grant any rights to use the trademarks - "Netscape", the "Netscape N and horizon" logo or the "Netscape - lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript", - "Smart Browsing" even if such marks are included in the Original - Code or Modifications. - - IV. Inability to Comply Due to Contractual Obligation. - Prior to licensing the Original Code under this License, Netscape - has licensed third party code for use in Netscape's Branded Code. - To the extent that Netscape is limited contractually from making - such third party code available under this License, Netscape may - choose to reintegrate such code into Covered Code without being - required to distribute such code in Source Code form, even if - such code would otherwise be considered "Modifications" under - this License. - - V. Use of Modifications and Covered Code by Initial Developer. - V.1. In General. - The obligations of Section 3 apply to Netscape, except to - the extent specified in this Amendment, Section V.2 and V.3. - - V.2. Other Products. - Netscape may include Covered Code in products other than the - Netscape's Branded Code which are released by Netscape - during the two (2) years following the release date of the - Original Code, without such additional products becoming - subject to the terms of this License, and may license such - additional products on different terms from those contained - in this License. - - V.3. Alternative Licensing. - Netscape may license the Source Code of Netscape's Branded - Code, including Modifications incorporated therein, without - such Netscape Branded Code becoming subject to the terms of - this License, and may license such Netscape Branded Code on - different terms from those contained in this License. - - VI. Litigation. - Notwithstanding the limitations of Section 11 above, the - provisions regarding litigation in Section 11(a), (b) and (c) of - the License shall apply to all disputes relating to this License. - - EXHIBIT A-Netscape Public License. - - "The contents of this file are subject to the Netscape Public - License Version 1.1 (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.mozilla.org/NPL/ - - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. - - The Original Code is Mozilla Communicator client code, released - March 31, 1998. - - The Initial Developer of the Original Code is Netscape - Communications Corporation. Portions created by Netscape are - Copyright (C) 1998-1999 Netscape Communications Corporation. All - Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the - terms of the _____ license (the "[___] License"), in which case - the provisions of [______] License are applicable instead of - those above. If you wish to allow use of your version of this - file only under the terms of the [____] License and not to allow - others to use your version of this file under the NPL, indicate - your decision by deleting the provisions above and replace them - with the notice and other provisions required by the [___] - License. If you do not delete the provisions above, a recipient - may use your version of this file under either the NPL or the - [___] License." - - ---------------------------------------------------------------------- - - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the NPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License - Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. - Portions created by ______________________ are Copyright (C) ______ - _______________________. All Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms - of the _____ license (the "[___] License"), in which case the - provisions of [______] License are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the [____] License and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the [___] License. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] - diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/system.fragment b/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/system.fragment deleted file mode 100644 index 840efd10bc..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/main/resources/system.fragment +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:tuscany="http://org.apache.tuscany/xmlns/system/0.9"
- name="org.apache.tuscany.container.rhino">
-
- <component name="org.apache.tuscany.container.rhino.builder.JavaScriptContextFactoryBuilder">
- <tuscany:implementation.system class="org.apache.tuscany.container.rhino.builder.JavaScriptContextFactoryBuilder"/>
- </component>
-
- <component name="org.apache.tuscany.container.rhino.builder.JavaScriptTargetWireBuilder">
- <tuscany:implementation.system class="org.apache.tuscany.container.rhino.builder.JavaScriptTargetWireBuilder"/>
- </component>
-
- <component name="org.apache.tuscany.container.rhino.loader.JavaScriptImplementationLoader">
- <tuscany:implementation.system class="org.apache.tuscany.container.rhino.loader.JavaScriptImplementationLoader"/>
- </component>
-</moduleFragment>
diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/AbstractJavaScriptTestCase.java b/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/AbstractJavaScriptTestCase.java deleted file mode 100644 index ee6b533ddf..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/AbstractJavaScriptTestCase.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.rhino.integration; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.client.TuscanyRuntime; -import org.osoa.sca.CurrentModuleContext; -import org.osoa.sca.ModuleContext; - -/** - * Integration tests for JavaScript components - */ -public abstract class AbstractJavaScriptTestCase extends TestCase { - - protected TuscanyRuntime tuscany; - - protected ModuleContext moduleContext; - - @Override - protected void setUp() throws Exception { - super.setUp(); - - tuscany = new TuscanyRuntime("tests", null); - tuscany.start(); - moduleContext = CurrentModuleContext.getContext(); - - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - tuscany.stop(); - } -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/BasicTestCase.java b/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/BasicTestCase.java deleted file mode 100644 index f66f2e1079..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/BasicTestCase.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.rhino.integration; - -/** - * Integration tests for JavaScript components - */ -public class BasicTestCase extends AbstractJavaScriptTestCase { - - public void testBasicInvocation() throws Exception { - HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent1"); - String response = helloworldService.getGreetings("petra"); - assertEquals("jsHello petra", response); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/E4XTestCase.java b/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/E4XTestCase.java deleted file mode 100644 index d6060aea90..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/E4XTestCase.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.rhino.integration; - -/** - * Integration tests for JavaScript components and composite contexts - * - * @version $Rev$ $Date$ - */ -public class E4XTestCase extends AbstractJavaScriptTestCase { - - public void testE4X() throws Exception { - HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponentE4X"); - String response = helloworldService.getGreetings("petra"); - assertEquals("e4xHello petra", response); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/HelloWorld.java b/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/HelloWorld.java deleted file mode 100644 index 3a90be0102..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/HelloWorld.java +++ /dev/null @@ -1,26 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.container.rhino.integration;
-
-/**
- * This is the business interface of the HelloWorld service component.
- */
-public interface HelloWorld {
-
- public String getGreetings(String name);
-
-}
diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/InitializationTestCase.java b/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/InitializationTestCase.java deleted file mode 100644 index 138d9a8452..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/InitializationTestCase.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.rhino.integration; - -/** - * Integration tests for JavaScript components - */ -public class InitializationTestCase extends AbstractJavaScriptTestCase { - - public void testInitialization() throws Exception { - HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent4"); - String response = helloworldService.getGreetings("petra"); - assertEquals("Bonjour petra", response); - } - - public void testImports1() throws Exception { - HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent5"); - String response = helloworldService.getGreetings("petra"); - assertEquals("Kia ora petra", response); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/PropertiesTestCase.java b/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/PropertiesTestCase.java deleted file mode 100644 index 7b14376dbe..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/PropertiesTestCase.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.rhino.integration; - -/** - * Integration tests for JavaScript components - */ -public class PropertiesTestCase extends AbstractJavaScriptTestCase { - - public void testDefaultProperty() throws Exception { - HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent2a"); - String response = helloworldService.getGreetings("petra"); - assertEquals("Hi petra", response); - } - - public void testOverrideProperty() throws Exception { - HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent2b"); - String response = helloworldService.getGreetings("petra"); - assertEquals("Guten Tag petra", response); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/Salutation.java b/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/Salutation.java deleted file mode 100644 index 42d46c16d1..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/Salutation.java +++ /dev/null @@ -1,25 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.container.rhino.integration;
-
-/**
- */
-public interface Salutation {
-
- public String getSalutation();
-
-}
diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/ServiceRefsTestCase.java b/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/ServiceRefsTestCase.java deleted file mode 100644 index 27993c2b99..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/ServiceRefsTestCase.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.container.rhino.integration; - -/** - * Integration tests for JavaScript components - */ -public class ServiceRefsTestCase extends AbstractJavaScriptTestCase { - - public void testServiceReference() throws Exception { - HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent3a"); - String response = helloworldService.getGreetings("petra"); - assertEquals("Guten Tag petra", response); - } - -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/TestMethods.java b/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/TestMethods.java deleted file mode 100644 index 327edd1cbb..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/TestMethods.java +++ /dev/null @@ -1,30 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.container.rhino.integration;
-
-public class TestMethods {
-
- private String salutation = "Kia ora";
-
- public String getSalutation() {
- return salutation;
- }
-
- public void getSalutation(String s) {
- salutation = s;
- }
-}
diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.java b/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.java deleted file mode 100644 index 714814f2cf..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.java +++ /dev/null @@ -1,89 +0,0 @@ -/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.container.rhino.rhino;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sdo.helper.XSDHelperImpl;
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.helper.XSDHelper;
-
-/**
- * Tests for the RhinoE4XScript
- */
-public class RhinoE4XScriptTestCase extends TestCase {
-
- private static final String scriptName = "RhinoE4XScriptTestCase.js";
-
- private String script;
-
- private E4XDataBinding dataBinding;
-
- protected void setUp() throws Exception {
- super.setUp();
- this.script = readResource(scriptName);
- TypeHelper th = SDOUtil.createTypeHelper();
- XSDHelper xsdHelper = new XSDHelperImpl(th);
- URL url = getClass().getResource("helloworld.wsdl");
- xsdHelper.define(url.openStream(), null);
-
- dataBinding = new E4XDataBinding(getClass().getClassLoader(),th);
- dataBinding.addElementQName("getGreetings", new QName("http://helloworld.samples.tuscany.apache.org", "getGreetings"));
- }
-
- public void testSimpleInvocation() throws IOException {
- RhinoE4XScript ri = new RhinoE4XScript(scriptName, script, null, null, dataBinding);
- Object x = ri.invoke("getGreetings", new Object[] { "petra" }, null);
- assertEquals(x, "hello petra");
- }
-
- /**
- * Read a resource into a String
- */
- private String readResource(String name) {
- try {
- URL url = getClass().getResource(name);
- if (url == null) {
- throw new RuntimeException("resource not found: " + name);
- }
- InputStream inputStream = url.openStream();
-
- StringBuffer resource = new StringBuffer();
- int n = 0;
-
- while ((n = inputStream.read()) != -1) {
- resource.append((char) n);
- }
-
- inputStream.close();
-
- String s = resource.toString();
- return s;
-
- } catch (IOException e) {
- throw new RuntimeException("IOException reading resource " + name, e);
- }
- }
-
-}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.java b/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.java deleted file mode 100644 index 19c0d9bcf6..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 2004,2005 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.container.rhino.rhino; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import junit.framework.TestCase; - -import org.apache.tuscany.container.rhino.rhino.RhinoScript; -import org.mozilla.javascript.EcmaError; - -/** - * Tests for the RhinoScript - */ -public class RhinoScriptTestCase extends TestCase { - - private static final String scriptName = "RhinoScriptTestCase.js"; - - private String script; - - protected void setUp() throws Exception { - super.setUp(); - this.script = readResource(scriptName); - } - - public void testSimpleInvocation() { - RhinoScript ri = new RhinoScript(scriptName, script); - Object x = ri.invoke("echo", new Object[] { "petra" }, null); - assertEquals("petra", x); - } - - public void testCopy() { - RhinoScript ri = new RhinoScript(scriptName, script); - Object x = ri.invoke("echo", new Object[] { "petra" }, null); - assertEquals("petra", x); - - ri = ri.copy(); - x = ri.invoke("echo", new Object[] { "sue" }, null); - assertEquals("sue", x); - - } - - public void testContexts1() { - RhinoScript ri = new RhinoScript(scriptName, script); - Map<String, Object> contexts = new HashMap<String, Object>(); - contexts.put("a", "petra"); - Object x = ri.invoke("getA", null, contexts); - assertEquals("petra", x); - } - - /** - * Tests context not accessable across invocations - */ - public void testContexts2() { - RhinoScript ri = new RhinoScript(scriptName, script); - Map<String, Object> contexts = new HashMap<String, Object>(); - contexts.put("a", "petra"); - Object x = ri.invoke("getA", null, contexts); - assertEquals("petra", x); - - try { - x = ri.invoke("getA", null, null); - assertTrue("expected ReferenceError", false); - } catch (EcmaError e) { - assertEquals("ReferenceError", e.getName()); - } - } - - /** - * Tests shared scope is accessable across invocations - */ - public void testScopes1() { - RhinoScript ri = new RhinoScript(scriptName, script); - ri.invoke("setGlobalVarY", new Object[] { "petra" }, null); - - Object x = ri.invoke("getGlobalVarY", null, null); - assertEquals("petra", x); - } - - /** - * Tests local vars are NOT accessable across invocations - */ - public void testScopes2() { - RhinoScript ri = new RhinoScript(scriptName, script); - ri.invoke("setLocalVarY", new Object[] { "petra" }, null); - - try { - ri.invoke("getGlobalVarY", null, null); - assertTrue("expected ReferenceError", false); - } catch (EcmaError e) { - assertEquals("ReferenceError", e.getName()); - } - } - - /** - * Tests shared scope is accessable when using contexts (ie an wire scope) - */ - public void testScopes3() { - RhinoScript ri = new RhinoScript(scriptName, script); - ri.invoke("setGlobalVarY", new Object[] { "petra" }, null); - - Map<String, Object> contexts = new HashMap<String, Object>(); - contexts.put("a", "sue"); - Object x = ri.invoke("getGlobalVarY", null, contexts); - assertEquals("petra", x); - - x = ri.invoke("getA", null, contexts); - assertEquals("sue", x); - - } - - /** - * Tests a copy only retains the script scope not the shared scope - */ - public void testScopes4() { - RhinoScript ri = new RhinoScript(scriptName, script); - ri.invoke("setGlobalVarY", new Object[] { "petra" }, null); - - ri = ri.copy(); - try { - ri.invoke("getGlobalVarY", null, null); - assertTrue("expected ReferenceError", false); - } catch (EcmaError e) { - assertEquals("ReferenceError", e.getName()); - } - try { - ri.invoke("getA", null, null); - assertTrue("expected ReferenceError", false); - } catch (EcmaError e) { - assertEquals("ReferenceError", e.getName()); - } - - } - - public void testGetInt() { - RhinoScript ri = new RhinoScript(scriptName, script); - Object x = ri.invoke("getInt", null, Integer.TYPE, null); - assertEquals(Integer.class, x.getClass()); - } - - /** - * Read a resource into a String - */ - private String readResource(String name) { - try { - URL url = getClass().getResource(name); - if (url == null) { - throw new RuntimeException("resource not found: " + name); - } - InputStream inputStream = url.openStream(); - - StringBuffer resource = new StringBuffer(); - int n = 0; - - while ((n = inputStream.read()) != -1) { - resource.append((char) n); - } - - inputStream.close(); - - String s = resource.toString(); - return s; - - } catch (IOException e) { - throw new RuntimeException("IOException reading resource " + name, e); - } - } - -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.js b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.js deleted file mode 100644 index 20dc2245f9..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.js +++ /dev/null @@ -1,11 +0,0 @@ - -function process(inXML) { - - var greeting = "hello " + inXML..*::in0; - var outXML = - <helloworldaxis:getGreetingsResponse xmlns:helloworldaxis="http://helloworld.samples.tuscany.apache.org"> - <helloworldaxis:getGreetingsReturn>{ greeting }</helloworldaxis:getGreetingsReturn> - </helloworldaxis:getGreetingsResponse>; - - return outXML; -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.js b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.js deleted file mode 100644 index 2de740d5f8..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.js +++ /dev/null @@ -1,22 +0,0 @@ - -function echo(x) { - return x; -} - -function getA(x) { - return a; -} - -function setGlobalVarY(x) { - y = x; -} -function setLocalVarY(x) { - var y = x; -} -function getGlobalVarY(x) { - return y; -} - -function getInt(x) { - return 42; -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/helloworld.wsdl b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/helloworld.wsdl deleted file mode 100644 index a402cc4d7c..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/helloworld.wsdl +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<wsdl:definitions targetNamespace="http://helloworld.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworld.samples.tuscany.apache.org" xmlns:intf="http://helloworld.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
- <!--WSDL created by Apache Axis version: 1.2.1
-Built on Jun 14, 2005 (09:15:57 EDT)-->
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworld.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="in0" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
-
- <wsdl:part element="impl:getGreetings" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
-
- <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:portType name="HelloWorldServiceImpl">
-
- <wsdl:operation name="getGreetings">
-
- <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
-
- <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
-
- </wsdl:operation>
-
- </wsdl:portType>
-
- <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
-
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <wsdl:operation name="getGreetings">
-
- <wsdlsoap:operation soapAction=""/>
-
- <wsdl:input name="getGreetingsRequest">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:input>
-
- <wsdl:output name="getGreetingsResponse">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:output>
-
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldServiceImplService">
-
- <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
-
- <wsdlsoap:address location="http://localhost:8080/sample-helloworldws/services/HelloWorldService"/>
-
- </wsdl:port>
-
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/sca.module b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/sca.module deleted file mode 100644 index f78a41381a..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/sca.module +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" - xmlns:js="http://org.apache.tuscany/xmlns/js/0.9" - - name="JavaScriptTests"> - - <component name="HelloWorldComponent1"> - <js:implementation.js scriptFile="tests/HelloWorldImpl1.js"/> - </component> - - <component name="HelloWorldComponent2a"> - <js:implementation.js scriptFile="tests/HelloWorldImpl2.js"/> - </component> - - <component name="HelloWorldComponent2b"> - <js:implementation.js scriptFile="tests/HelloWorldImpl2.js"/> - <properties> - <v:salutation>Guten Tag</v:salutation> - </properties> - </component> - - <component name="HelloWorldComponent3a"> - <js:implementation.js scriptFile="tests/HelloWorldImpl3a.js"/> - <references> - <v:SalutationService>SalutationComponent3b</v:SalutationService> - </references> - </component> - - <component name="SalutationComponent3b"> - <js:implementation.js scriptFile="tests/SalutationImpl.js"/> - <properties> - <v:GREETING>Guten Tag</v:GREETING> - </properties> - </component> - - <component name="HelloWorldComponent4"> - <js:implementation.js scriptFile="tests/HelloWorldImpl4.js"/> - </component> - - <component name="HelloWorldComponent5"> - <js:implementation.js scriptFile="tests/HelloWorldImpl5.js"/> - </component> - - <import.sdo wsdlLocation="wsdl/helloworld.wsdl"/> - <import.wsdl wsdlLocation="wsdl/helloworld.wsdl"/> - - <component name="HelloWorldComponentE4X"> - <js:implementation.js scriptFile="tests/e4x.js"/> - </component> - -</module> diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.componentType b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.componentType deleted file mode 100644 index 90b6c09015..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.componentType +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> - -<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - - <service name="HelloWorldService"> - <interface.java interface="org.apache.tuscany.container.rhino.integration.HelloWorld"/> - </service> - -</componentType>
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.js b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.js deleted file mode 100644 index b3104f78a5..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -function getGreetings(name) { - return "jsHello " + name; -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.componentType b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.componentType deleted file mode 100644 index 33208811bf..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.componentType +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> - -<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - - <service name="HelloWorldService"> - <interface.java interface="org.apache.tuscany.container.rhino.integration.HelloWorld"/> - </service> - - <property name="salutation" type="xsd:string" default="Hi"/> - -</componentType>
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.js b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.js deleted file mode 100644 index 4f91dba40e..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -function getGreetings(name) { - return salutation + " " + name; -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.componentType b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.componentType deleted file mode 100644 index 1bc6922e6d..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.componentType +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> - -<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - - <service name="HelloWorldService"> - <interface.java interface="org.apache.tuscany.container.rhino.integration.HelloWorld"/> - </service> - - <reference name="SalutationService"> - <interface.java interface="org.apache.tuscany.container.rhino.integration.Salutation"/> - </reference> - -</componentType>
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.js b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.js deleted file mode 100644 index f3160f6f65..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -function getGreetings(name) { - return SalutationService.getSalutation() + " " + name; -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.componentType b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.componentType deleted file mode 100644 index 90b6c09015..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.componentType +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> - -<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - - <service name="HelloWorldService"> - <interface.java interface="org.apache.tuscany.container.rhino.integration.HelloWorld"/> - </service> - -</componentType>
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.js b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.js deleted file mode 100644 index 338c3ac3cd..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -initSalutation(); - -function getGreetings(name) { - return SALUTATION + name; -} - -function initSalutation() { - SALUTATION = "Bonjour "; -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.componentType b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.componentType deleted file mode 100644 index 90b6c09015..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.componentType +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> - -<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - - <service name="HelloWorldService"> - <interface.java interface="org.apache.tuscany.container.rhino.integration.HelloWorld"/> - </service> - -</componentType>
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.js b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.js deleted file mode 100644 index f01cd1727f..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -//importPackage(Packages.sample.utils); -importClass(Packages.org.apache.tuscany.container.rhino.integration.TestMethods); - -initSalutation(); - -function getGreetings(name) { - return SALUTATION.getSalutation() + " " + name; -} - -function initSalutation() { - SALUTATION = new TestMethods(); -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.componentType b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.componentType deleted file mode 100644 index 1c819bff32..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.componentType +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> - -<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - - <service name="SalutationService"> - <interface.java interface="org.apache.tuscany.container.rhino.integration.Salutation"/> - </service> - - <property name="GREETING" type="xsd:string" default="Hi"/> - -</componentType>
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.js b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.js deleted file mode 100644 index 2116e40ae3..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -function getSalutation() { - return GREETING; -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/e4x.componentType b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/e4x.componentType deleted file mode 100644 index 6bf89d2ef8..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/e4x.componentType +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> - -<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - - <service name="HelloWorldService"> - <interface.wsdl interface="http://integration.rhino.container.tuscany.apache.org#HelloWorld"/> - </service> - -</componentType>
\ No newline at end of file diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/e4x.js b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/e4x.js deleted file mode 100644 index 7fe882df55..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/tests/e4x.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -function process(xmlIn) { - - var greeting = "e4xHello " + xmlIn..*::in0; - - var xmlOut = - <helloworld:getGreetingsResponse xmlns:helloworld="http://integration.rhino.container.tuscany.apache.org"> - <helloworld:getGreetingsReturn> { greeting } </helloworld:getGreetingsReturn> - </helloworld:getGreetingsResponse>; - - return xmlOut; -} diff --git a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/wsdl/helloworld.wsdl b/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 7bcb48dcf2..0000000000 --- a/branches/java-M1/java/sca/containers/container.rhino/src/test/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<wsdl:definitions targetNamespace="http://integration.rhino.container.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://integration.rhino.container.tuscany.apache.org" xmlns:intf="http://helloworld.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
- <!--WSDL created by Apache Axis version: 1.2.1
-Built on Jun 14, 2005 (09:15:57 EDT)-->
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://integration.rhino.container.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="in0" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
-
- <wsdl:part element="impl:getGreetings" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
-
- <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:portType name="HelloWorld">
-
- <wsdl:operation name="getGreetings">
-
- <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
-
- <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
-
- </wsdl:operation>
-
- </wsdl:portType>
-
- <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorld">
-
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <wsdl:operation name="getGreetings">
-
- <wsdlsoap:operation soapAction=""/>
-
- <wsdl:input name="getGreetingsRequest">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:input>
-
- <wsdl:output name="getGreetingsResponse">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:output>
-
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldServiceImplService">
-
- <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
-
- <wsdlsoap:address location="http://localhost:8080/helloworldws/services/HelloWorldService"/>
-
- </wsdl:port>
-
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/containers/pom.xml b/branches/java-M1/java/sca/containers/pom.xml deleted file mode 100644 index e3a992c3a3..0000000000 --- a/branches/java-M1/java/sca/containers/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<project>
-
- <parent>
- <groupId>org.apache.tuscany</groupId>
- <artifactId>tuscany-sca</artifactId>
- <version>incubating-M1</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.tuscany.sca.containers</groupId>
- <artifactId>tuscany-sca-containers</artifactId>
- <packaging>pom</packaging>
- <name>Tuscany SCA Containers</name>
- <version>incubating-M1</version>
-
- <modules>
- <module>container.java</module>
- <module>container.rhino</module>
- </modules>
-
-</project>
diff --git a/branches/java-M1/java/sca/core/pom.xml b/branches/java-M1/java/sca/core/pom.xml deleted file mode 100644 index b5e934d45e..0000000000 --- a/branches/java-M1/java/sca/core/pom.xml +++ /dev/null @@ -1,107 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project> - <parent> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-sca</artifactId> - <version>incubating-M1</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>tuscany-core</artifactId> - <name>Tuscany Core</name> - <description>Core Tuscany runtime.</description> - <version>incubating-M1</version> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-model</artifactId> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>stax</groupId> - <artifactId>stax-api</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>woodstox</groupId> - <artifactId>wstx-asl</artifactId> - <version>2.9.3</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>tomcat</groupId> - <artifactId>servlet-api</artifactId> - <version>5.0.18</version> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.geronimo</groupId> - <artifactId>geronimo-connector</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.geronimo</groupId> - <artifactId>geronimo-transaction</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jta_1.0.1B_spec</artifactId> - <version>1.0</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>concurrent</groupId> - <artifactId>concurrent</artifactId> - <version>1.3.4</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.0.4</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - -</project> diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/async/builder/AsyncPolicyBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/async/builder/AsyncPolicyBuilder.java deleted file mode 100644 index 6acebdaa8e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/async/builder/AsyncPolicyBuilder.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.async.builder; - -import java.util.List; - -import javax.resource.spi.work.WorkManager; - -import org.apache.tuscany.core.async.invocation.AsyncInterceptor; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.SourcePolicyBuilder; -import org.apache.tuscany.core.builder.TargetPolicyBuilder; -import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.OneWay; - -/** - * Builds context factories for component implementations that map to {@link org.apache.tuscany.container.java.assembly.JavaImplementation}. - * The logical model is then decorated with the runtime configuration. - * - * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ - * @see org.apache.tuscany.core.builder.ContextFactory - */ -@org.osoa.sca.annotations.Scope("MODULE") -public class AsyncPolicyBuilder implements SourcePolicyBuilder, TargetPolicyBuilder { - - private PolicyBuilderRegistry builderRegistry; - private WorkManager workManager; - private MessageFactory messageFactory; - - public AsyncPolicyBuilder() { - } - - @Init(eager = true) - public void init() { - builderRegistry.registerSourceBuilder(this); - builderRegistry.registerTargetBuilder(this); - } - - @Autowire - public void setBuilderRegistry(PolicyBuilderRegistry builderRegistry) { - this.builderRegistry = builderRegistry; - } - - @Autowire - public void setWorkManager(WorkManager workManager) { - this.workManager = workManager; - } - - @Autowire - public void setMessageFactory(MessageFactory messageFactory) { - this.messageFactory = messageFactory; - } - - public void build(ConfiguredReference arg0, List<WireSourceConfiguration> arg1) throws BuilderException { - } - - public void build(ConfiguredService service, WireTargetConfiguration wireTargetConfiguration) throws BuilderException { - for (TargetInvocationConfiguration configuration : wireTargetConfiguration.getInvocationConfigurations().values()) { - if (configuration.getMethod().getAnnotation(OneWay.class)!=null) { - configuration.addInterceptor(new AsyncInterceptor(workManager, messageFactory)); - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/async/invocation/AsyncInterceptor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/async/invocation/AsyncInterceptor.java deleted file mode 100644 index 08a718bd73..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/async/invocation/AsyncInterceptor.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.async.invocation; - -import javax.resource.spi.work.Work; -import javax.resource.spi.work.WorkException; -import javax.resource.spi.work.WorkManager; - -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.wire.Interceptor; -import org.osoa.sca.CurrentModuleContext; -import org.osoa.sca.ModuleContext; -import org.osoa.sca.SCA; -import org.osoa.sca.ServiceRuntimeException; - -/** - * A wire interceptor that uses a WorkManager to schedule asynchronous execution of invocations in Work instances. - */ -public class AsyncInterceptor implements Interceptor { - - private static final ContextBinder BINDER = new ContextBinder(); - - private WorkManager workManager; - private MessageFactory messageFactory; - private Interceptor next; - - /** - * Constructs a new instance - * @param workManager - */ - public AsyncInterceptor(WorkManager workManager, MessageFactory messageFactory) { - this.workManager=workManager; - this.messageFactory=messageFactory; - } - - public Message invoke(final Message message) { - - final ModuleContext currentModuleContext=CurrentModuleContext.getContext(); - - // Schedule the invocation of the next interceptor in a new Work instance - try { - workManager.scheduleWork(new Work() { - - public void run() { - ModuleContext oldModuleContext=CurrentModuleContext.getContext(); - try { - BINDER.setContext(currentModuleContext); - - // Invoke the next interceptor - next.invoke(message); - - } catch (Exception e) { - //FIXME How do we report exceptions? - e.printStackTrace(); - - } finally { - - BINDER.setContext(oldModuleContext); - } - } - - public void release() { - } - - }); - } catch (WorkException e) { - //FIXME Which exception should we throw here? - throw new ServiceRuntimeException(e); - } - - // No return on a OneWay invocation. - return messageFactory.createMessage(); - } - - public void setNext(Interceptor next) { - this.next=next; - } - - private static class ContextBinder extends SCA { - public void setContext(ModuleContext context) { - setModuleContext(context); - } - - public void start() { - throw new AssertionError(); - } - - public void stop() { - throw new AssertionError(); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/async/work/DefaultWorkManager.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/async/work/DefaultWorkManager.java deleted file mode 100644 index 866e101b0e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/async/work/DefaultWorkManager.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.async.work; - -import javax.resource.spi.work.WorkManager; - -import org.apache.geronimo.connector.work.GeronimoWorkManager; -import org.apache.geronimo.transaction.context.TransactionContextManager; -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -/** - * A Work Manager service component implementation which just reuses the Geronimo WorkManager. - * - * @version $Rev$ $Date$ - */ -@Service(WorkManager.class) -@Scope("MODULE") -public class DefaultWorkManager extends GeronimoWorkManager implements WorkManager { - - private final static int DEFAULT_POOL_SIZE = 10; - - @Property - public int scheduledMaximumPoolSize; - - /** - * Constructs a new instance. - */ - public DefaultWorkManager() { - super(DEFAULT_POOL_SIZE, new TransactionContextManager()); - } - - @Init(eager=true) - public void init() throws Exception { - doStart(); - } - - @Destroy - public void destroy() throws Exception { - doStop(); - } - - public void setScheduledMaximumPoolSize(int maxSize) { - super.setScheduledMaximumPoolSize(maxSize); - } - - public int getScheduledMaximumPoolSize() { - return super.getScheduledMaximumPoolSize(); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderConfigException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderConfigException.java deleted file mode 100644 index c2402d9141..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderConfigException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.builder; - -/** - * Represents an error processing an assembly model - * - * @version $Rev$ $Date$ - */ -public class BuilderConfigException extends BuilderException { - - public BuilderConfigException() { - super(); - } - - public BuilderConfigException(String message) { - super(message); - } - - public BuilderConfigException(String message, Throwable cause) { - super(message, cause); - } - - public BuilderConfigException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderException.java deleted file mode 100644 index 246f188988..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderException.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.core.context.CoreRuntimeException; - -/** - * The root exception for the builder package. Builder exceptions denote a non-recoverable failure. - * - * @version $Rev$ $Date$ - */ -public abstract class BuilderException extends CoreRuntimeException { - - public BuilderException() { - super(); - } - - public BuilderException(String message) { - super(message); - } - - public BuilderException(String message, Throwable cause) { - super(message, cause); - } - - public BuilderException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderInitException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderInitException.java deleted file mode 100644 index cd57eaf7ab..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderInitException.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - -/** - * Denotes an exception initializing a builder - * - * @version $Rev$ $Date$ - */ -public class BuilderInitException extends BuilderException { - - public BuilderInitException() { - super(); - } - - public BuilderInitException(String message, Throwable cause) { - super(message, cause); - } - - public BuilderInitException(String message) { - super(message); - } - - public BuilderInitException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextCreationException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextCreationException.java deleted file mode 100644 index 24b526371d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextCreationException.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - - -/** - * Denotes an exception creating an instance context - * - * @version $Rev$ $Date$ - */ -public class ContextCreationException extends BuilderException { - - public ContextCreationException() { - super(); - } - - public ContextCreationException(String message) { - super(message); - } - - public ContextCreationException(String message, Throwable cause) { - super(message, cause); - } - - public ContextCreationException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactory.java deleted file mode 100644 index ccef8024e8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactory.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.List; -import java.util.Map; - -/** - * Implementations create {@link org.apache.tuscany.core.context.Context}s based on an assembly configuration. - * <p/> - * Context factories are "built" in two phases. {@link ContextFactoryBuilder}s analyze an assembly, producing - * <code>ContextFactory</code>s for {@link org.apache.tuscany.model.assembly.Component}s, {@link - * org.apache.tuscany.model.assembly.EntryPoint}s, and {@link org.apache.tuscany.model.assembly.ExternalService}s. During this - * phase, {@link org.apache.tuscany.core.wire.WireFactory}s for source- and target-side wires are produced for the - * <code>ContextFactory</code>s. Ê - * <p/> - * The second build phase connects the source- and target-side <code>WireFactories</code>, thereby completing wire configuration. - * <p/> - * At runtime, <code>ContextFactory</code>s are called to create new <code>Context</code>s when a new implementation instance is - * required for a component, entry point, or external service. The <code>Context</code> is then responsible for instantiating and - * managing the actual implementation instance. When a <code>Context</code> creates a new instance, the previously configured - * <code>WireFactory</code>s are used to create wires to and from the instance. A wire is a collection of stateless invocation - * chains that are managed by the <code>Context</code>'s <code>ContextFactory</code>. - * - * @version $Rev: 385747 $ $Date: 2006-03-13 22:12:53 -0800 (Mon, 13 Mar 2006) $ - */ -public interface ContextFactory<T extends Context> { - - /** - * Creates a <code>Context</code> based on configuration supplied by a logical model assembly - * - * @return a new instance context - * @throws ContextCreationException if an error occurs creating the context - */ - public T createContext() throws ContextCreationException; - - /** - * Returns the scope identifier associated with the type of contexts produced by the current factory - */ - public Scope getScope(); - - /** - * Returns the name of the <code>Context</code> produced by the current factory - */ - public String getName(); - - /** - * Adds a property to the context - */ - public void addProperty(String propertyName, Object value); - - /** - * Adds a target-side wire factory for the given service name. Target-side wire factories contain the invocation chains - * associated with the destination service of a wire and are responsible for generating proxies - */ - public void addTargetWireFactory(String serviceName, TargetWireFactory factory); - - /** - * Returns the target-side wire factory associated with the given service name - */ - public TargetWireFactory getTargetWireFactory(String serviceName); - - /** - * Returns a collection of target-side wire factories keyed by service name - */ - public Map<String, TargetWireFactory> getTargetWireFactories(); - - /** - * Adds a source-side wire factory for the given reference. Source-side wire factories contain the invocation chains for a - * reference in the implementation associated with the instance context created by this configuration. Source-side wire - * factories also produce proxies that are injected on a reference in a component implementation. - * - * @param referenceName - * @param factory - */ - public void addSourceWireFactory(String referenceName, SourceWireFactory factory); - - /** - * Adds a set of source-side wire factories for the given reference. Source-side wire factories contain the invocation chains - * for a reference in the implementation associated with the instance context created by this configuration. Source-side wire - * factories also produce proxies that are injected on a reference in a component implementation. - * - * @param referenceName - * @param referenceInterface - * @param factory - * @param multiplicity - */ - public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity); - - /** - * Returns a collection of source-side wire factories for references. There may 1..n wire factories per reference. - */ - public List<SourceWireFactory> getSourceWireFactories(); - - /** - * Called to signal to the configuration that its parent context has been activated and that it shoud perform any required - * initialization steps - * - * @param parent the parent context - */ - public void prepare(CompositeContext parent); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilder.java deleted file mode 100644 index 786298809e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilder.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.model.assembly.AssemblyObject; - -/** - * The extension point for component types in the runtime. Implementations perform the first phase of converting an assembly model - * into a series of runtime artifacts. Specifically, <code>ContextFactoryBuilder</code>s are responsible for analyzing the - * assembly model and producing {@link ContextFactory}s that are used to generate executable artifacts such as an {@link - * org.apache.tuscany.core.context.Context}. In the case of components, the <code>ContextFactory</code> will typically contain - * configuration for instantiating implementation instances with injected properties and references. - * <p/> - * As the assembly model is analyzed, <code>ContextFactoryBuilder</code>s are guaranteed to be called first and are expected to - * decorate the assembly model with <code>ContextFactory</code>s. - * <p/> - * The second phase uses {@link WireBuilder}s to connect the source and target wire chains held in these - * <code>ContextFactory</code>s to form a completed wire. <code>WireBuilder<code>s may use a similar delegation strategy and - * perform various optimizations. - * - * @version $Rev$ $Date$ - * @see ContextFactory - * @see WireBuilder - */ -public interface ContextFactoryBuilder { - - /** - * Creates or updates a context factory based on configuration contained in the given model object. The model object is - * decorated with the factory. - * - * @param object the logical configuration model node - * @throws BuilderException - */ - public void build(AssemblyObject object) throws BuilderException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilderRegistry.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilderRegistry.java deleted file mode 100644 index a002627c2e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilderRegistry.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.builder; - -/** - * System wide registry for ContextFactoryBuilder implementations. - * - * @version $Rev$ $Date$ - */ -public interface ContextFactoryBuilderRegistry { - /** - * Register a builder. Called by extensions to register their builders. - * - * @param builder the builder to register - */ - void register(ContextFactoryBuilder builder); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextResolver.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextResolver.java deleted file mode 100644 index 5c99d6dd43..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextResolver.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.core.context.CompositeContext; - -/** - * Implementations are responsible for resolving the current composite context - * - * @version $Rev$ $Date$ - */ -public interface ContextResolver { - - /** - * Returns the current composite context - */ - CompositeContext getCurrentContext(); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/HierarchicalWireBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/HierarchicalWireBuilder.java deleted file mode 100644 index ace34a1ad5..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/HierarchicalWireBuilder.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - -/** - * A wire builder that delegates to child wire builders - * - * @version $Rev$ $Date$ - */ -public interface HierarchicalWireBuilder extends WireBuilder{ - - /** - * Registers a child wire builder - */ - public void addWireBuilder(WireBuilder builder); - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/NoAccessorException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/NoAccessorException.java deleted file mode 100644 index 34b6294638..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/NoAccessorException.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - -/** - * Denotes an attempt to access a non-existent field or method - * - * @version $Rev$ $Date$ - */ -public class NoAccessorException extends BuilderException { - - public NoAccessorException() { - super(); - } - - public NoAccessorException(String message) { - super(message); - } - - public NoAccessorException(String message, Throwable cause) { - super(message, cause); - } - - public NoAccessorException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ObjectFactory.java deleted file mode 100644 index ab2cfd9bac..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ObjectFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.core.injection.ObjectCreationException; - -/** - * Implementations create new instances of a particular type - * - * @version $Rev$ $Date$ - */ -public interface ObjectFactory<T> { - - /** - * Return a instance of the type that this factory creates. - * - * @return a instance from this factory - */ - T getInstance() throws ObjectCreationException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyBuilder.java deleted file mode 100644 index 489541a213..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyBuilder.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - -/** - * A marker for policy extensions in the runtime. Implementations evaluate wire-related policy metadata on a {@link - * org.apache.tuscany.model.assembly.ConfiguredReference} or {@link org.apache.tuscany.model.assembly.ConfiguredService} and - * contribute {@link org.apache.tuscany.core.wire.Interceptor}s or {@link org.apache.tuscany.core.wire.MessageHandler}s - * implementing a policy to {@link org.apache.tuscany.core.wire.InvocationConfiguration}s that are part of a {@link - * org.apache.tuscany.core.wire.WireConfiguration}. The contributed <code>Interceptor</code>s or <code>Handler</code>s will be - * called as part of an invocation over a wire. - * - * @version $$Rev$$ $$Date$$ - */ -public interface PolicyBuilder { - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyOrderer.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyOrderer.java deleted file mode 100644 index 1038b6e878..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyOrderer.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - -/** - * A marker for implementations that order source- or target-side policy {@link org.apache.tuscany.core.wire.Interceptor}s or - * {@link org.apache.tuscany.core.wire.MessageHandler}s in a {@link org.apache.tuscany.core.wire.WireConfiguration}. - * - * @see SourcePolicyOrderer - * @see TargetPolicyOrderer - * @version $$Rev$$ $$Date$$ - */ -public interface PolicyOrderer { - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyBuilder.java deleted file mode 100644 index 76a376e3d5..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyBuilder.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.model.assembly.ConfiguredReference; - -import java.util.List; - -/** - * Implementations contribute {@link org.apache.tuscany.core.wire.Interceptor}s or {@link - * org.apache.tuscany.core.wire.MessageHandler}s that handle source-side policy on a wire. - * - * @version $$Rev$$ $$Date$$ - */ -public interface SourcePolicyBuilder extends PolicyBuilder { - - public void build(ConfiguredReference reference, List<WireSourceConfiguration> configurations) throws BuilderException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyOrderer.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyOrderer.java deleted file mode 100644 index 6bc3bcda6e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyOrderer.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.core.wire.WireSourceConfiguration; - -/** - * Implementations order source-side policy {@link org.apache.tuscany.core.wire.Interceptor}s or - * {@link org.apache.tuscany.core.wire.MessageHandler}s in a {@link org.apache.tuscany.core.wire.WireConfiguration}. - * - * @version $$Rev$$ $$Date$$ - */ -public interface SourcePolicyOrderer extends PolicyOrderer{ - - public void order(WireSourceConfiguration configuration); - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyBuilder.java deleted file mode 100644 index 10c34751e2..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyBuilder.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.core.wire.WireTargetConfiguration; - -/** - * Implementations contribute {@link org.apache.tuscany.core.wire.Interceptor}s or {@link - * org.apache.tuscany.core.wire.MessageHandler}s that handle target-side policy on a wire. - * - * @version $$Rev$$ $$Date$$ - */ -public interface TargetPolicyBuilder extends PolicyBuilder{ - - public void build(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyOrderer.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyOrderer.java deleted file mode 100644 index 4b596bfdc1..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyOrderer.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.core.wire.WireTargetConfiguration; - -/** - * Implementation order target-side policy {@link org.apache.tuscany.core.wire.Interceptor}s or - * {@link org.apache.tuscany.core.wire.MessageHandler}s in a {@link org.apache.tuscany.core.wire.WireConfiguration}. - - * @version $$Rev$$ $$Date$$ - */ -public interface TargetPolicyOrderer { - - public void order(WireTargetConfiguration configuration); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/UnknownTypeException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/UnknownTypeException.java deleted file mode 100644 index 24c1fa24ff..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/UnknownTypeException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.builder; - -/** - * Denotes an unknown configuration parameter type - * - * @version $Rev$ $Date$ - */ -public class UnknownTypeException extends BuilderException { - - public UnknownTypeException() { - super(); - } - - public UnknownTypeException(String message) { - super(message); - } - - public UnknownTypeException(String message, Throwable cause) { - super(message, cause); - } - - public UnknownTypeException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java deleted file mode 100644 index 54f2ff4b4e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder; - -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; - -/** - * Implementations perform the second phase of converting a logical model representing an assembly into a series of - * runtime or executable artifacts. Specifically, they are responsible for finalizing target-side proxy factories and - * bridging {@link org.apache.tuscany.core.wire.InvocationConfiguration}s held by source- and target-side proxy - * factories. <code>WireBuilder</code>s generally operate by target implementation type. In other words, for a wire - * from a Java source to a JavaScript target, the Javascript <code>WireBuilder</code> will complete the wire. This is - * necessary as a <code>WireBuilder</code> must set a {@link org.apache.tuscany.core.wire.TargetInvoker} that is - * responsible for dispatching to an implementation on the source side of the wire. - * <p> - * Runtimes are generally configured with a {@link org.apache.tuscany.core.builder.impl.DefaultWireBuilder} as a - * top-most wire builder, which delegates to other builders wired to it as part of a system configuration. - * <p> - * Wire builders may optimize the wire chains based on certain characteristics of th wire, such as source and - * target scopes. - * - * @see org.apache.tuscany.core.builder.ContextFactoryBuilder - * @see org.apache.tuscany.core.builder.impl.DefaultWireBuilder - * @version $Rev$ $Date$ - */ -public interface WireBuilder { - - /** - * Connects wire configurations of the source proxy factory to corresponding ones in the target proxy to - * factory - * - * @param sourceFactory the proxy factory used in constructing the source side of the wire chain - * @param targetFactory the proxy factory used in constructing the target side of the wire chain - * @param targetType the context type of the target. Used to determine if a paricular wire builder should construct - * the wire - * @param downScope true if the component containing the reference (source side) is of a lesser scope than the - * target service - * @param targetScopeContext the scope context responsible for managing intance contexts of the target component - * type - * @throws BuilderConfigException if an error occurs during the wire buildSource process - */ - public void connect(SourceWireFactory<?> sourceFactory, TargetWireFactory<?> targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) throws BuilderConfigException; - - /** - * Finishes processing the target side wire chain. For example, a - * {@link org.apache.tuscany.core.wire.TargetInvoker} used by target-side proxies is usually set during this - * phase. - * - * @param targetFactory the target-side proxy factory - * @param targetType the target context type - * @param targetScopeContext the target scope - * @throws BuilderConfigException if an error occurs during the wire buildSource process - */ - public void completeTargetChain(TargetWireFactory<?> targetFactory, Class targetType, ScopeContext targetScopeContext) - throws BuilderConfigException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ArrayMultiplicityObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ArrayMultiplicityObjectFactory.java deleted file mode 100644 index 8f0cbbf91b..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ArrayMultiplicityObjectFactory.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder.impl; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.injection.ObjectCreationException; - -import java.lang.reflect.Array; -import java.util.List; - -/** - * Resolves targets configured in a multiplicity by delegating to object factories and returning an - * <code>Array</code> containing object instances - * - * @version $Rev$ $Date$ - */ -public class ArrayMultiplicityObjectFactory implements ObjectFactory<Object> { - - private ObjectFactory[] factories; - - private Class interfaceType; - - public ArrayMultiplicityObjectFactory(Class interfaceType, List<ObjectFactory> factories) { - assert (interfaceType != null) : "Interface type was null"; - assert (factories != null) : "Object factories were null"; - this.interfaceType = interfaceType; - this.factories = factories.toArray(new ObjectFactory[factories.size()]); - } - - public Object getInstance() throws ObjectCreationException { - Object array = Array.newInstance(interfaceType, factories.length); - for (int i = 0; i < factories.length; i++) { - Array.set(array, i, factories[i].getInstance()); - } - return array; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/AssemblyVisitorImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/AssemblyVisitorImpl.java deleted file mode 100644 index 178d3d4de6..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/AssemblyVisitorImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder.impl; - -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.ContextFactoryHolder; - -import java.util.List; - -/** - * Decorates an assembly object graph with runtime configurations using a set of builders - * - * @version $Rev: 392146 $ $Date: 2006-04-06 18:11:28 -0700 (Thu, 06 Apr 2006) $ - */ -public class AssemblyVisitorImpl implements AssemblyVisitor { - - private List<ContextFactoryBuilder> builders; - - /** - * Constructs a visitor - * - * @param builders the collection of builders for creating context factories - */ - public AssemblyVisitorImpl(List<ContextFactoryBuilder> builders) { - this.builders = builders; - } - - /** - * Initiate walking the object graph - */ - public boolean start(AssemblyObject modelObject) { - return modelObject.accept(this); - } - - /** - * Callback when walking the graph - */ - public boolean visit(AssemblyObject modelObject) { - if (modelObject instanceof ContextFactoryHolder){ - if (((ContextFactoryHolder)modelObject).getContextFactory() != null){ - return true; // HACK FIX for TUSCANY 249 - } - } - for (ContextFactoryBuilder builder : builders) { - builder.build(modelObject); - } - return true; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ContextFactoryBuilderRegistryImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ContextFactoryBuilderRegistryImpl.java deleted file mode 100644 index d500b2e503..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ContextFactoryBuilderRegistryImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.builder.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; - -/** - * @version $Rev$ $Date$ - */ -public class ContextFactoryBuilderRegistryImpl implements ContextFactoryBuilderRegistry { - - private final List<ContextFactoryBuilder> builders = new ArrayList<ContextFactoryBuilder>(); - - public void register(ContextFactoryBuilder builder) { - builders.add(builder); - } - - public List<ContextFactoryBuilder> getBuilders() { - return builders; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilder.java deleted file mode 100644 index 5243c2a8cd..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilder.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder.impl; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.HierarchicalWireBuilder; -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.impl.InvokerInterceptor; -import org.apache.tuscany.core.wire.impl.MessageChannelImpl; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * The top-most <code>WireBuilder</code> configured in a runtime. Responsible for constructing wires from source and target chains, - * this implementation first bridges the chains and then delegates to any other wire builders. - * - * @version $Rev$ $Date$ - */ -public class DefaultWireBuilder implements HierarchicalWireBuilder { - - // collection configured wire builders - private List<WireBuilder> builders = new ArrayList<WireBuilder>(); - - public DefaultWireBuilder() { - } - - /** - * Adds a wire builder to delegate to - */ - public void addWireBuilder(WireBuilder builder) { - builders.add(builder); - } - - public void connect(SourceWireFactory<?> sourceFactory, TargetWireFactory<?> targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) { - // get the proxy chain for the target - if (targetFactory != null) { - // if null, the target side has no interceptors or handlers - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = targetFactory.getConfiguration().getInvocationConfigurations(); - for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration() - .getInvocationConfigurations().values()) { - // match wire chains - TargetInvocationConfiguration targetInvocationConfig = targetInvocationConfigs.get(sourceInvocationConfig.getMethod()); - if (targetInvocationConfig == null){ - BuilderConfigException e= new BuilderConfigException("Incompatible source and target interface types for reference"); - //FIXME xcv - e.setIdentifier(sourceFactory.getConfiguration().getReferenceName()); - throw e; - } - // if handler is configured, add that - if (targetInvocationConfig.getRequestHandlers() != null) { - sourceInvocationConfig.setTargetRequestChannel(new MessageChannelImpl(targetInvocationConfig - .getRequestHandlers())); - sourceInvocationConfig.setTargetResponseChannel(new MessageChannelImpl(targetInvocationConfig - .getResponseHandlers())); - } else { - // no handlers, just connect interceptors - if (targetInvocationConfig.getHeadInterceptor() == null) { - BuilderConfigException e = new BuilderConfigException("No target handler or interceptor for operation"); - e.setIdentifier(targetInvocationConfig.getMethod().getName()); - throw e; - } - //xcv if (!(sourceInvocationConfig.getLastTargetInterceptor() instanceof InvokerInterceptor && targetInvocationConfig - if (!(sourceInvocationConfig.getTailInterceptor() instanceof InvokerInterceptor && targetInvocationConfig - .getHeadInterceptor() instanceof InvokerInterceptor)) { - // check that we do not have the case where the only interceptors are invokers since we just need one - sourceInvocationConfig.setTargetInterceptor(targetInvocationConfig.getHeadInterceptor()); - } - } - } - } - // delegate to other wire builders - for (WireBuilder builder : builders) { - builder.connect(sourceFactory, targetFactory, targetType, downScope, targetScopeContext); - } - // signal that wire buildSource process is complete - for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration().getInvocationConfigurations() - .values()) { - sourceInvocationConfig.build(); - // TODO optimize if no proxy needed using NullWireFactory - } - } - - public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) - throws BuilderConfigException { - // delegate to other wire builders - for (WireBuilder builder : builders) { - builder.completeTargetChain(targetFactory, targetType, targetScopeContext); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/HierarchicalBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/HierarchicalBuilder.java deleted file mode 100644 index ffab32bd37..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/HierarchicalBuilder.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder.impl; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.model.assembly.AssemblyObject; - -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * A builder that contains nested builders. Used for synchronizing parts of the buildSource process, such as references. - * - * @version $Rev$ $Date$ - */ -public class HierarchicalBuilder implements ContextFactoryBuilder { - private List<ContextFactoryBuilder> builders = new CopyOnWriteArrayList<ContextFactoryBuilder>(); - - private List<ContextFactoryBuilder> readOnlyBuilders = Collections.unmodifiableList(builders); - - public HierarchicalBuilder() { - } - - public void addBuilder(ContextFactoryBuilder builder) { - builders.add(builder); - } - - public void removeBuilder(ContextFactoryBuilder builder){ - builders.remove(builder); - } - - public List getBuilders(){ - return readOnlyBuilders; - } - - public void build(AssemblyObject object) throws BuilderException { - for (ContextFactoryBuilder builder : builders) { - builder.build(object); - } - - } - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ListMultiplicityObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ListMultiplicityObjectFactory.java deleted file mode 100644 index 5d37eb8e89..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ListMultiplicityObjectFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder.impl; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.injection.ObjectCreationException; - -import java.util.ArrayList; -import java.util.List; - -/** - * Resolves targets configured in a multiplicity by delegating to object factories and returning an - * <code>List</code> containing object instances - * - * @version $Rev$ $Date$ - */ -public class ListMultiplicityObjectFactory implements ObjectFactory<List> { - - private ObjectFactory[] factories; - - public ListMultiplicityObjectFactory(List<ObjectFactory> factories) { - assert (factories != null) : "Object factories were null"; - this.factories = factories.toArray(new ObjectFactory[factories.size()]); - } - - public List getInstance() throws ObjectCreationException { - List<Object> list = new ArrayList<Object>(); - for (ObjectFactory factory : factories) { - list.add(factory.getInstance()); - } - return list; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ProxyObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ProxyObjectFactory.java deleted file mode 100644 index 1dc6627306..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ProxyObjectFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder.impl; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.injection.ObjectCreationException; -import org.apache.tuscany.core.wire.ProxyCreationException; -import org.apache.tuscany.core.wire.WireFactory; - -/** - * Uses a proxy factory to return an object instance - * - * @version $Rev$ $Date$ - */ -public class ProxyObjectFactory implements ObjectFactory { - - private WireFactory factory; - - public ProxyObjectFactory(WireFactory factory) { - this.factory = factory; - } - - public Object getInstance() throws ObjectCreationException { - try { - return factory.createProxy(); - } catch (ProxyCreationException e) { - throw new ObjectCreationException(e); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/DefaultPolicyBuilderRegistry.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/DefaultPolicyBuilderRegistry.java deleted file mode 100644 index 4c53a2c830..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/DefaultPolicyBuilderRegistry.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.builder.system; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.SourcePolicyBuilder; -import org.apache.tuscany.core.builder.SourcePolicyOrderer; -import org.apache.tuscany.core.builder.TargetPolicyBuilder; -import org.apache.tuscany.core.builder.TargetPolicyOrderer; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -import java.util.ArrayList; -import java.util.List; - -/** - * A system service that serves as the default implementation of a policy builder registry - * - * @version $$Rev$$ $$Date$$ - */ - -@Scope("MODULE") -@Service(interfaces = {PolicyBuilderRegistry.class}) -public class DefaultPolicyBuilderRegistry implements PolicyBuilderRegistry { - - private final List<SourcePolicyBuilder> sourceBuilders = new ArrayList<SourcePolicyBuilder>(); - private final List<TargetPolicyBuilder> targetBuilders = new ArrayList<TargetPolicyBuilder>(); - - private TargetPolicyOrderer targetOrderer; - - private SourcePolicyOrderer sourceOrderer; - - @Autowire - public void setTargetOrderer(TargetPolicyOrderer orderer) { - this.targetOrderer = orderer; - } - - @Autowire - public void setSourceOrderer(SourcePolicyOrderer orderer) { - this.sourceOrderer = orderer; - } - - public void registerTargetBuilder(TargetPolicyBuilder builder) { - targetBuilders.add(builder); - } - - public void unregisterTargetBuilder(TargetPolicyBuilder builder) { - targetBuilders.remove(builder); - } - - public void registerSourceBuilder(SourcePolicyBuilder builder) { - sourceBuilders.add(builder); - } - - public void unregisterSourceBuilder(SourcePolicyBuilder builder) { - sourceBuilders.remove(builder); - } - - public List<TargetPolicyBuilder> getTargetBuilders() { - return targetBuilders; - } - - public List<SourcePolicyBuilder> getSourceBuilders() { - return sourceBuilders; - } - - public void buildSource(ConfiguredReference reference, List<WireSourceConfiguration> configurations) throws BuilderException { - for (SourcePolicyBuilder builder : sourceBuilders) { - builder.build(reference, configurations); - } - if (sourceOrderer != null) { - for (WireSourceConfiguration configuration : configurations) { - sourceOrderer.order(configuration); - } - } - } - - public void buildTarget(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException { - for (TargetPolicyBuilder builder : targetBuilders) { - builder.build(service, configuration); - } - if (targetOrderer != null) { - targetOrderer.order(configuration); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/PolicyBuilderRegistry.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/PolicyBuilderRegistry.java deleted file mode 100644 index fb9b0b25db..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/PolicyBuilderRegistry.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.builder.system; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.SourcePolicyBuilder; -import org.apache.tuscany.core.builder.TargetPolicyBuilder; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; - -import java.util.List; - -/** - * A System registry for {@link org.apache.tuscany.core.builder.PolicyBuilder}s. <code>PolicyBuilder</code>s will be invoked when - * a {@link org.apache.tuscany.core.wire.WireFactory} is constructed by the {@link org.apache.tuscany.core.wire.WireFactory} - * service. - * <p/> - * <code>PolicyBuilder</code>s operate on either a source- or target-side wire and typically are registered by runtime extensions - * through {@link #registerTargetBuilder} or {@link #registerSourceBuilder} - * - * @version $Rev$ $Date$ - */ -public interface PolicyBuilderRegistry { - - /** - * Registers a target-side policy builder. Called by extensions to register their builders. - * - * @param builder the builder to register - */ - public void registerTargetBuilder(TargetPolicyBuilder builder); - - /** - * De-registers a target-side builder. Called by extensions to register their builders. - * - * @param builder the builder to register - */ - public void unregisterTargetBuilder(TargetPolicyBuilder builder); - - /** - * Registers a source-side policy builder. Called by extensions to register their builders. - * - * @param builder the builder to register - */ - public void registerSourceBuilder(SourcePolicyBuilder builder); - - /** - * De-registers a source-side builder. Called by extensions to register their builders. - * - * @param builder the builder to register - */ - public void unregisterSourceBuilder(SourcePolicyBuilder builder); - - /** - * Returns the list of registered target-side builders - */ - public List<TargetPolicyBuilder> getTargetBuilders(); - - /** - * Returns the list of registered source-side builders - */ - public List<SourcePolicyBuilder> getSourceBuilders(); - - /** - * Evaluates source-side policy metadata for configured reference and updates the curresponding collection of wire configurations - * - * @throws BuilderException - */ - public void buildSource(ConfiguredReference reference, List<WireSourceConfiguration> configurations) throws BuilderException; - - /** - * Evaluates target-side policy metadata for configured reference and updates the curresponding collection of wire configurations - * - * @throws BuilderException - */ - public void buildTarget(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException; -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/client/BootstrapHelper.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/client/BootstrapHelper.java deleted file mode 100644 index 556b0991f7..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/client/BootstrapHelper.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.client; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.stream.XMLInputFactory; - -import org.apache.tuscany.common.monitor.MonitorFactory; -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.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.impl.ContextFactoryBuilderRegistryImpl; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; -import org.apache.tuscany.core.config.impl.StAXModuleComponentConfigurationLoaderImpl; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.SystemCompositeContext; -import org.apache.tuscany.core.context.event.ModuleStart; -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.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; -import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; -import org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl; - -/** - * @version $Rev$ $Date$ - */ -public final class BootstrapHelper { - private BootstrapHelper() { - } - - /** - * Returns a default AssemblyModelContext. - * - * @param classLoader the classloader to use for application artifacts - * @return a default AssemblyModelContext - */ - public static AssemblyContext getModelContext(ClassLoader classLoader) { - // Create an assembly model factory - AssemblyFactory modelFactory = new SystemAssemblyFactoryImpl(); - - // Create a default assembly model loader - AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl(); - - // Create a resource loader from the supplied classloader - ResourceLoader resourceLoader = new ResourceLoaderImpl(classLoader); - - // Create an assembly model context - return new AssemblyContextImpl(modelFactory, modelLoader, resourceLoader); - } - - /** - * Returns a default list of configuration builders. - * - * @param monitorFactory - * @return a default list of configuration builders - */ - public static List<ContextFactoryBuilder> getBuilders(MonitorFactory monitorFactory) { - List<ContextFactoryBuilder> configBuilders = new ArrayList<ContextFactoryBuilder>(); - configBuilders.add((new SystemContextFactoryBuilder(monitorFactory))); - configBuilders.add(new SystemEntryPointBuilder()); - configBuilders.add(new SystemExternalServiceBuilder()); - return configBuilders; - } - - /** - * Returns a ContextFactoryBuilderRegistry with default builders registered for system contexts. - * - * @param monitorFactory a monitorFactory that will be used to obtain monitors for system components - * @return a default ContextFactoryBuilderRegistry - */ - public static ContextFactoryBuilderRegistry bootstrapContextFactoryBuilders(MonitorFactory monitorFactory) { - ContextFactoryBuilderRegistryImpl registry = new ContextFactoryBuilderRegistryImpl(); - registry.register(new SystemContextFactoryBuilder(monitorFactory)); - registry.register(new SystemEntryPointBuilder()); - registry.register(new SystemExternalServiceBuilder()); - return registry; - } - - public 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(SystemCompositeContext systemContext, AssemblyContext modelContext) { - return new StAXModuleComponentConfigurationLoaderImpl(modelContext, XMLInputFactory.newInstance(), systemContext.resolveInstance(StAXLoaderRegistry.class)); - } - - /** - * Bootstrap the StAX-based loader. - * - * @param parentContext the parent system context - * @param modelContext - * @return the system context for the loader - * @throws ConfigurationException - */ - public static CompositeContext bootstrapStaxLoader(SystemCompositeContext parentContext, AssemblyContext modelContext) throws ConfigurationException { - ModuleComponent loaderComponent = StAXUtil.bootstrapLoader(SYSTEM_LOADER_COMPONENT, modelContext); - CompositeContext loaderContext = registerModule(parentContext, loaderComponent); - loaderContext.publish(new ModuleStart(loaderComponent)); - return loaderContext; - } - - public static CompositeContext registerModule(CompositeContext parent, ModuleComponent component) throws ConfigurationException { - // register the component - parent.registerModelObject(component); - - // Get the composite context representing the component - return (CompositeContext) parent.getContext(component.getName()); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java deleted file mode 100644 index fe78cd712a..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java +++ /dev/null @@ -1,182 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.client; - -import org.osoa.sca.ModuleContext; -import org.osoa.sca.SCA; -import org.osoa.sca.ServiceRuntimeException; - -import org.apache.tuscany.common.monitor.LogLevel; -import org.apache.tuscany.common.monitor.MonitorFactory; -import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -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.CompositeContext; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.SystemCompositeContext; -import org.apache.tuscany.core.context.event.HttpSessionBound; -import org.apache.tuscany.core.context.event.HttpSessionEnd; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.context.event.RequestStart; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.runtime.RuntimeContextImpl; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.ModuleComponent; - -/** - * Create and initialize a Tuscany SCA runtime environment. - * - * @version $Rev$ $Date$ - */ -public class TuscanyRuntime extends SCA { - private final Monitor monitor; - private final Object sessionKey = new Object(); - - private final RuntimeContext runtime; - private final CompositeContext moduleContext; - - 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, 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 monitorFactory the MonitorFactory for this runtime - * @throws ConfigurationException if there was a problem loading the SCA configuration - */ - public TuscanyRuntime(String name, String uri, MonitorFactory monitorFactory) throws ConfigurationException { - assert(monitorFactory != null): "monitor factory was null"; - this.monitor = monitorFactory.getMonitor(Monitor.class); - - // Create an assembly model context - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - AssemblyContext modelContext = BootstrapHelper.getModelContext(classLoader); - - // Create a runtime context and start it - ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); - runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, new DefaultWireBuilder()); - runtime.start(); - - // Load and start the system configuration - SystemCompositeContext systemContext = runtime.getSystemContext(); - BootstrapHelper.bootstrapStaxLoader(systemContext, modelContext); - ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext); - ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT); - CompositeContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent); - context.publish(new ModuleStart(this)); - - // Load the SCDL configuration of the application module - CompositeContext rootContext = runtime.getRootContext(); - ModuleComponent moduleComponent = loader.loadModuleComponent(name, uri); - moduleContext = BootstrapHelper.registerModule(rootContext, moduleComponent); - if (moduleContext.getURI() == null){ - moduleContext.setURI(uri); - } - //TODO remove hack - moduleContext.setAssemblyContext(modelContext); - } - - /** - * Start the runtime and associate the module context with the calling thread. - */ - @Override - public void start() { - setModuleContext((ModuleContext) moduleContext); - try { - //moduleContext.start(); - moduleContext.publish(new ModuleStart(this)); - moduleContext.publish(new RequestStart(this, new Object())); - moduleContext.publish(new HttpSessionBound(this, sessionKey)); - monitor.moduleStarted(moduleContext.getName()); - } catch (CoreRuntimeException e) { - setModuleContext(null); - monitor.moduleStartFailed(moduleContext.getName(), 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.publish(new RequestEnd(this, new Object())); - moduleContext.publish(new HttpSessionEnd(this, sessionKey)); - moduleContext.publish(new ModuleStop(this)); - moduleContext.stop(); - monitor.moduleStopped(moduleContext.getName()); - } - - /** - * Shut down the Tuscany runtime. - */ - public void shutdown() { - runtime.getSystemContext().publish(new ModuleStop(this)); - runtime.stop(); - } - - /** - * Monitor interface for a TuscanyRuntime. - */ - public static interface Monitor { - /** - * Event emitted after an application module has been started. - * - * @param name the name of the application module - */ - @LogLevel("INFO") - void moduleStarted(String name); - - /** - * Event emitted when an attempt to start an application module failed. - * - * @param name the name of the application module - * @param e the exception that caused the failure - */ - @LogLevel("SEVERE") - void moduleStartFailed(String name, CoreRuntimeException e); - - /** - * Event emitted after an application module has been stopped. - * - * @param name the name of the application module - */ - @LogLevel("INFO") - void moduleStopped(String name); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ComponentTypeIntrospector.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ComponentTypeIntrospector.java deleted file mode 100644 index 9f9c125a5e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ComponentTypeIntrospector.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.core.extension.config.ImplementationProcessor; - -/** - * Interface for implementations that are able create SCA definitions by inspecting Java classes. - * - * @version $Rev$ $Date$ - */ -public interface ComponentTypeIntrospector { - - /** - * Create a componentType definition by introspecting a Java Class. - * - * @param implClass the class to inspect - * @return a componentType definition - * @throws ConfigurationLoadException if the Class does not define a valid component type - */ - ComponentType introspect(Class<?> implClass) throws ConfigurationLoadException; - - /** - * Completes the given componentType definition by introspecting a Java Class. - * - * @param implClass the class to inspect - * @return a componentType definition - * @throws ConfigurationLoadException if the Class does not define a valid component type - */ - ComponentType introspect(Class<?> implClass, ComponentType compType) throws ConfigurationLoadException; - - /** - * Registers an annotation processor - */ - void registerProcessor(ImplementationProcessor processor); - - /** - * De-registers an annotation processor - */ - void unregisterProcessor(ImplementationProcessor processor); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationException.java deleted file mode 100644 index de0e4a3733..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationException.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -import org.apache.tuscany.common.TuscanyException; - - -/** - * Base class for exceptions that pertain to configuration. - * - * @version $Rev$ $Date$ - */ -public abstract class ConfigurationException extends TuscanyException { - private static final long serialVersionUID = 7441469809266868036L; - - public ConfigurationException() { - } - - public ConfigurationException(String message) { - super(message); - } - - public ConfigurationException(String message, Throwable cause) { - super(message, cause); - } - - public ConfigurationException(Throwable cause) { - super(cause); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationLoadException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationLoadException.java deleted file mode 100644 index 2a9e325b0b..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationLoadException.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -/** - * Exception indicating that there was a problem loading a configuration resource. - * - * @version $Rev$ $Date$ - */ -public class ConfigurationLoadException extends ConfigurationException { - private static final long serialVersionUID = -2310798146091959144L; - - private String resourceURI; - - public ConfigurationLoadException() { - } - - public ConfigurationLoadException(String message) { - super(message); - } - - public ConfigurationLoadException(String message, Throwable cause) { - super(message, cause); - } - - public ConfigurationLoadException(Throwable cause) { - super(cause); - } - - /** - * Returns the location of the resource that was being loaded. - * @return the location of the resource that was being loaded - */ - public String getResourceURI() { - return resourceURI; - } - - /** - * Sets the location of the resource that was being loaded. - * @param resourceURI the location of the resource that was being loaded - */ - public void setResourceURI(String resourceURI) { - this.resourceURI = resourceURI; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ImplementationCache.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ImplementationCache.java deleted file mode 100644 index cc5f2999fe..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ImplementationCache.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -import org.apache.tuscany.model.assembly.Implementation; - -import javax.xml.namespace.QName; - -/** - * Cache of introspected implementations. - * - * @version $Rev$ $Date$ - */ -public interface ImplementationCache { - /** - * Return an implementation from a given namespace. - * - * @param type the namespace that defines the type of implementation - * @param name the name of an implementation in that namespace - * @return the implementation or null if it is not present in the cache - */ - Implementation get(QName type, String name); - - /** - * Add an implementation to the cache - * - * @param type the namespace that defines the type of implementation - * @param name the name of an implementation in that namespace - * @param implementation the introspected implementation - */ - void put(QName type, String name, Implementation implementation); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidMetaDataException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidMetaDataException.java deleted file mode 100644 index 71b2329044..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidMetaDataException.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config; - -/** - * Denotes an validation error processing component metadata - * @version $$Rev$$ $$Date$$ - */ -public class InvalidMetaDataException extends MetaDataException { - public InvalidMetaDataException() { - } - - public InvalidMetaDataException(String message) { - super(message); - } - - public InvalidMetaDataException(String message, Throwable cause) { - super(message, cause); - } - - public InvalidMetaDataException(Throwable cause) { - super(cause); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidRootElementException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidRootElementException.java deleted file mode 100644 index a355d884a5..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidRootElementException.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -import javax.xml.namespace.QName; - -/** - * Configuration exception that indicates the actual root element in an XML file was not the one expected. - * - * @version $Rev$ $Date$ - */ -public class InvalidRootElementException extends ConfigurationLoadException { - private static final long serialVersionUID = 2376629433948140418L; - - private final QName expected; - private final QName actual; - - public InvalidRootElementException(QName expected, QName actual) { - super("Invalid root element, expected [" + expected + "], was [" + actual + ']'); - this.expected = expected; - this.actual = actual; - } - - public QName getExpected() { - return expected; - } - - public QName getActual() { - return actual; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidSetterException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidSetterException.java deleted file mode 100644 index ed4e53645f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidSetterException.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -/** - * @version $Rev$ $Date$ - */ -public class InvalidSetterException extends ConfigurationLoadException { - private static final long serialVersionUID = -3298236203808038211L; - - public InvalidSetterException() { - } - - public InvalidSetterException(String message) { - super(message); - } - - public InvalidSetterException(String message, Throwable cause) { - super(message, cause); - } - - public InvalidSetterException(Throwable cause) { - super(cause); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/JavaIntrospectionHelper.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/JavaIntrospectionHelper.java deleted file mode 100644 index 9d74633519..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/JavaIntrospectionHelper.java +++ /dev/null @@ -1,446 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -import java.lang.reflect.AccessibleObject; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * Implements various reflection-related operations - * - * @version $Rev$ $Date$ - */ -public class JavaIntrospectionHelper { - - private static final Class[] EMPTY_CLASS_ARRY = new Class[0]; - - /** - * Hide the constructor - */ - private JavaIntrospectionHelper() { - } - - /** - * Returns a collection of public, private, protected, or default fields declared by a class or one of its - * supertypes - */ - public static Set<Field> getAllFields(Class pClass) { - return getAllFields(pClass, new HashSet<Field>()); - } - - /** - * Recursively evaluates the type hierachy to return all fields on a given type - */ - private static Set<Field> getAllFields(Class pClass, Set<Field> fields) { - if (pClass == null || pClass.isArray() || Object.class.equals(pClass)) { - return fields; - } - fields = getAllFields(pClass.getSuperclass(), fields); - Field[] declaredFields = pClass.getDeclaredFields(); - for (Field field : declaredFields) { - field.setAccessible(true); // ignore Java accessibility - fields.add(field); - } - return fields; - } - - /** - * Returns a collection of public, and protected fields declared by a class or one of its - * supertypes - */ - public static Set<Field> getAllPublicAndProtectedFields(Class clazz) { - return getAllPublicAndProtectedFields(clazz, new HashSet<Field>()); - } - - /** - * Recursively evaluates the type hierachy to return all fields that are public or protected - */ - private static Set<Field> getAllPublicAndProtectedFields(Class clazz, Set<Field> fields) { - if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) { - return fields; - } - fields = getAllPublicAndProtectedFields(clazz.getSuperclass(), fields); - Field[] declaredFields = clazz.getDeclaredFields(); -// fields = new HashSet<Field>(); -// Field[] declaredFields = clazz.getFields(); - for (Field field : declaredFields) { - int modifiers = field.getModifiers(); - if ((Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)) && !Modifier.isStatic(modifiers)){ - field.setAccessible(true); // ignore Java accessibility - fields.add(field); - } - } - return fields; - } - - /** - * Returns a collection of public, private, protected, or default methods declared by a class or one of - * its supertypes. Note that overriden methods will not be returned in the collection (i.e. only the - * method override will be). <p/> This method can potentially be expensive as reflection information is - * not cached. It is assumed that this method will be used during a configuration phase. - */ - public static Set<Method> getAllUniqueMethods(Class clazz) { - return getAllUniqueMethods(clazz, new HashSet<Method>()); - } - - /** - * Recursively evaluates the type hierarchy to return all unique methods - */ - private static Set<Method> getAllUniqueMethods(Class pClass, Set<Method> methods) { - if (pClass == null || pClass.isArray() || Object.class.equals(pClass)) { - return methods; - } - // we first evaluate methods of the subclass and then move to the parent - Method[] declaredMethods = pClass.getDeclaredMethods(); - for (Method declaredMethod : declaredMethods) { - if (methods.size() == 0) { - methods.add(declaredMethod); - } else { - List<Method> temp = new ArrayList<Method>(); - boolean matched = false; - for (Method method : methods) { - // only add if not already in the set from a supclass (i.e. the - // method is not overrided) - if (exactMethodMatch(declaredMethod, method)) { - matched = true; - break; - } - } - if (!matched) { - // TODO ignore Java accessibility - declaredMethod.setAccessible(true); - temp.add(declaredMethod); - - } - methods.addAll(temp); - temp.clear(); - } - } - // evaluate class hierarchy - this is done last to track inherited methods - methods = getAllUniqueMethods(pClass.getSuperclass(), methods); - return methods; - } - - /** - * Finds the closest matching field with the given name, that is, a field of the exact specified type or, - * alternately, of a supertype. - * - * @param name the name of the field - * @param type the field type - * @param fields the collection of fields to search - * @return the matching field or null if not found - */ - public static Field findClosestMatchingField(String name, Class type, Set<Field> fields) { - Field candidate = null; - for (Field field : fields) { - if (field.getName().equals(name)) { - if (field.getType().equals(type)) { - return field; // exact match - } else if (field.getType().isAssignableFrom(type) - || (field.getType().isPrimitive() && primitiveAssignable(field.getType(), type))) { - // We could have the situation where a field parameter is a primitive and the demarshalled value is - // an object counterpart (e.g. Integer and int) - // @spec issue - // either an interface or super class, so keep a reference until - // we know there are no closer types - candidate = field; - } - } - } - if (candidate != null) { - return candidate; - } else { - return null; - } - } - - /** - * Finds the closest matching method with the given name, that is, a method taking the exact parameter - * types or, alternately, parameter supertypes. - * - * @param name the name of the method - * @param types the method parameter types - * @param methods the collection of methods to search - * @return the matching method or null if not found - */ - public static Method findClosestMatchingMethod(String name, Class[] types, Set<Method> methods) { - if (types == null) { - types = EMPTY_CLASS_ARRY; - } - Method candidate = null; - for (Method method : methods) { - if (method.getName().equals(name) && method.getParameterTypes().length == types.length) { - Class[] params = method.getParameterTypes(); - boolean disqualify = false; - boolean exactMatch = true; - for (int i = 0; i < params.length; i++) { - if (!params[i].equals(types[i]) && !params[i].isAssignableFrom(types[i])) { - // no match - disqualify = true; - exactMatch = false; - break; - } else if (!params[i].equals(types[i]) && params[i].isAssignableFrom(types[i])) { - // not exact match - exactMatch = false; - } - } - if (disqualify) { - continue; - } else if (exactMatch) { - return method; - } else { - candidate = method; - } - } - } - if (candidate != null) { - return candidate; - } else { - return null; - } - } - - /** - * Searches a collection of fields for one that matches by name and has a multiplicity type. i.e. a List - * or Array of interfaces - * - * @return a matching field or null - */ - public static Field findMultiplicityFieldByName(String name, Set<Field> fields) { - for (Field candidate : fields) { - if (candidate.getName().equals(name) - && (List.class.isAssignableFrom(candidate.getType()) || (candidate.getType().isArray() - && candidate.getType().getComponentType() != null && candidate.getType().getComponentType() - .isInterface()))) { - return candidate; - } - } - return null; - } - - /** - * Searches a collection of method for one that matches by name and has single parameter of a multiplicity - * type. i.e. a List or Array of interfaces - * - * @return a matching method or null - */ - public static Method findMultiplicityMethodByName(String name, Set<Method> methods) { - for (Method candidate : methods) { - if (candidate.getName().equals(name) - && candidate.getParameterTypes().length == 1 - && (List.class.isAssignableFrom(candidate.getParameterTypes()[0]) || (candidate.getParameterTypes()[0] - .isArray() - && candidate.getParameterTypes()[0].getComponentType() != null && candidate.getParameterTypes()[0] - .getComponentType().isInterface()))) { - return candidate; - } - } - return null; - } - - /** - * Returns a field or method defined in the given class or its superclasses matching a literal name and - * parameter types <p/> This method can potentially be expensive as reflection information is not cached. - * It is assumed that this method will be used during a configuration phase. - * - * @param clazz the class to introspect - * @param propertName the literal name of the property (i.e. JavaBean conventions are not applied) - * @param paramTypes the parameter types for a method or null for fields or methods with no parameters - * @return the field, method or null - */ - public static AccessibleObject getBeanProperty(Class clazz, String propertName, Class[] paramTypes) { - - Set<Method> methods = getAllUniqueMethods(clazz); - for (Method method : methods) { - if (method.getName().equals(propertName)) { - Class[] types = method.getParameterTypes(); - if (types.length == 0 && paramTypes == null) { - return method; - } else if (types.length != 0 && paramTypes == null) { - break; - } else if (types.length == paramTypes.length) { - for (int n = 0; n < types.length - 1; n++) { - if (!types[n].equals(paramTypes[n]) || !types[n].isAssignableFrom(paramTypes[n])) { - break; - } - } - return method; - } - } - } - - Set<Field> fields = getAllFields(clazz); - for (Field field : fields) { - if (field.getName().equals(propertName)) { - return field; - } - } - return null; - } - - /** - * Determines if two methods "match" - that is, they have the same method names and exact parameter types - * (one is not a supertype of the other) - */ - public static boolean exactMethodMatch(Method method1, Method method2) { - if (!method1.getName().equals(method2.getName())) { - return false; - } - Class[] types1 = method1.getParameterTypes(); - Class[] types2 = method2.getParameterTypes(); - if (types1.length == 0 && types2.length == 0) { - return true; - } else if (types1.length == types2.length) { - for (int n = 0; n < types1.length; n++) { - if (!types1[n].equals(types2[n])) { - return false; - } - } - return true; - } - return false; - } - - public static <T> Constructor<T> getDefaultConstructor(Class<T> clazz) throws NoSuchMethodException { - return clazz.getConstructor((Class[]) null); - } - - /** - * Loads a class corresponding to the class name using the current context class loader. - * - * @throws ClassNotFoundException if the class was not found on the classpath - */ - public static Class loadClass(String pName) throws ClassNotFoundException { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - return Class.forName(pName, true, loader); - } - - /** - * Returns the simple name of a class - i.e. the class name devoid of its package qualifier - * - * @param implClass - */ - public static String getBaseName(Class<?> implClass) { - String baseName = implClass.getName(); - int lastDot = baseName.lastIndexOf('.'); - if (lastDot != -1) { - baseName = baseName.substring(lastDot + 1); - } - return baseName; - } - - public static boolean isImmutable(Class clazz) { - return (String.class == clazz || clazz.isPrimitive() || Number.class.isAssignableFrom(clazz) - || Boolean.class.isAssignableFrom(clazz) || Character.class.isAssignableFrom(clazz) || Byte.class - .isAssignableFrom(clazz)); - } - - /** - * Takes a property name and converts it to a getter method name according to JavaBean conventions. For - * example, property <code>foo<code> is returned as <code>getFoo</code> - */ - public static String toGetter(String name) { - return "get" + name.toUpperCase().substring(0, 1) + name.substring(1); - } - - /** - * Takes a setter or getter method name and converts it to a property name according to JavaBean - * conventions. For example, <code>setFoo(var)</code> is returned as property <code>foo<code> - */ - public static String toPropertyName(String name) { - return Character.toLowerCase(name.charAt(3)) + name.substring(4); - } - - /** - * Takes a property name and converts it to a setter method name according to JavaBean conventions. For - * example, the property <code>foo<code> is returned as <code>setFoo(var)</code> - */ - public static String toSetter(String name) { - return "set" + name.toUpperCase().substring(0, 1) + name.substring(1); - } - - /** - * Compares a two types, assuming one is a primitive, to determine if the other is its object counterpart - */ - private static boolean primitiveAssignable(Class memberType, Class param) { - if (memberType == Integer.class) { - return (param == Integer.TYPE); - } else if (memberType == Double.class) { - return (param == Double.TYPE); - } else if (memberType == Float.class) { - return (param == Float.TYPE); - } else if (memberType == Short.class) { - return (param == Short.TYPE); - } else if (memberType == Character.class) { - return (param == Character.TYPE); - } else if (memberType == Boolean.class) { - return (param == Boolean.TYPE); - } else if (memberType == Byte.class) { - return (param == Byte.TYPE); - } else if (param == Integer.class) { - return (memberType == Integer.TYPE); - } else if (param == Double.class) { - return (memberType == Double.TYPE); - } else if (param == Float.class) { - return (memberType == Float.TYPE); - } else if (param == Short.class) { - return (memberType == Short.TYPE); - } else if (param == Character.class) { - return (memberType == Character.TYPE); - } else if (param == Boolean.class) { - return (memberType == Boolean.TYPE); - } else if (param == Byte.class) { - return (memberType == Byte.TYPE); - } else { - return false; - } - } - - /** - * Returns the generic types represented in the given type. Usage as follows: - * <p/> - * <code> // to return the generic type of a field: JavaIntrospectionHelper.getGenerics(field.getGenericType()); - * <p/> - * // to return the generic types for the first parameter of a method: JavaIntrospectionHelper.getGenerics(m.getGenericParameterTypes()[0];); - * <p/> - * </code> - * - * @return the generic types in order of declaration or an empty array if the type is not genericized - */ - public static List<? extends Type> getGenerics(Type genericType) { - List<Type> classes = new ArrayList<Type>(); - if (genericType instanceof ParameterizedType) { - ParameterizedType ptype = (ParameterizedType) genericType; - // get the type arguments - Type[] targs = ptype.getActualTypeArguments(); - for (Type targ : targs) { - classes.add(targ); - } - } - return classes; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/MetaDataException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/MetaDataException.java deleted file mode 100644 index 30840a6e15..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/MetaDataException.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config; - -/** - * Denotes an error processing component metadata - * - * @version $$Rev$$ $$Date$$ - */ -public class MetaDataException extends ConfigurationLoadException{ - - public MetaDataException() { - } - - public MetaDataException(String message) { - super(message); - } - - public MetaDataException(String message, Throwable cause) { - super(message, cause); - } - - public MetaDataException(Throwable cause) { - super(cause); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingInterfaceException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingInterfaceException.java deleted file mode 100644 index 6164b6a011..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingInterfaceException.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -/** - * Exception indicating that the interface referenced in an assembly file could not be found. - * - * @version $Rev$ $Date$ - */ -public class MissingInterfaceException extends ConfigurationLoadException { - public MissingInterfaceException() { - } - - public MissingInterfaceException(String message) { - super(message); - } - - public MissingInterfaceException(String message, Throwable cause) { - super(message, cause); - } - - public MissingInterfaceException(Throwable cause) { - super(cause); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingResourceException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingResourceException.java deleted file mode 100644 index 8260dbc8ae..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingResourceException.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -/** - * Exception that indicates an expected resource could not be found. - * - * @version $Rev$ $Date$ - */ -public class MissingResourceException extends ConfigurationLoadException { - /** - * Constructor that indicates which resource could not be found. - * The supplied parameter is also returned as the message. - * - * @param resource the resource that could not be found - */ - public MissingResourceException(String resource) { - super(resource); - setResourceURI(resource); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ModuleComponentConfigurationLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ModuleComponentConfigurationLoader.java deleted file mode 100644 index 15857441b1..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/ModuleComponentConfigurationLoader.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -import org.apache.tuscany.model.assembly.ModuleComponent; - -import java.net.URL; -import java.util.Collection; - -/** - * Interface for loading configuration information from some external - * form into a Tuscany logical model. - * - * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ - */ -public interface ModuleComponentConfigurationLoader { - - /** - * Load a SCDL module component. - * - * @param name the name of the module component - * @param uri - * @return a new module component definition - * @throws ConfigurationLoadException if there was a problem loading the module component. - */ - ModuleComponent loadModuleComponent(String name, String uri) throws ConfigurationLoadException; - - /** - * Load a System SCDL module component. - * - * @param name the name of the module component - * @param uri - * @return a new module component definition - * @throws ConfigurationLoadException if there was a problem loading the module component. - */ - ModuleComponent loadSystemModuleComponent(String name, String uri) throws ConfigurationLoadException; - - /** - * Load a SCDL module component. - * - * @param name the name of the module component - * @param uri - * @param url - * @return a new module component definition - * @throws ConfigurationLoadException if there was a problem loading the module component. - */ - ModuleComponent loadModuleComponent(String name, String uri, URL url) throws ConfigurationLoadException; - - /** - * Load a SCDL module component. - * - * @param name the name of the module component - * @param uri - * @param url - * @param urls - * @return a new module component definition - * @throws ConfigurationLoadException if there was a problem loading the module component. - */ - ModuleComponent loadModuleComponent(String name, String uri, URL url, Collection<URL> urls) throws ConfigurationLoadException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/SidefileLoadException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/SidefileLoadException.java deleted file mode 100644 index b432d4ea68..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/SidefileLoadException.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -/** - * Exception indicating that there was a problem loading a sidefile. - * - * @version $Rev$ $Date$ - */ -public class SidefileLoadException extends ConfigurationLoadException { - private static final long serialVersionUID = -3530306758412789392L; - private String sidefileURI; - - public SidefileLoadException() { - } - - public SidefileLoadException(String message) { - super(message); - } - - public SidefileLoadException(String message, Throwable cause) { - super(message, cause); - } - - public SidefileLoadException(Throwable cause) { - super(cause); - } - - public String getSidefileURI() { - return sidefileURI; - } - - public void setSidefileURI(String sidefileURI) { - this.sidefileURI = sidefileURI; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java deleted file mode 100644 index a77031b8c5..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java +++ /dev/null @@ -1,164 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.processor.ProcessorUtils; -import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.ModuleFragment; -import org.apache.tuscany.model.assembly.ComponentType; - -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -/** - * @version $Rev$ $Date$ - */ -public abstract class AbstractModuleComponentConfigurationLoader implements ModuleComponentConfigurationLoader { - private static final String SCA_MODULE_FILE_NAME = "sca.module"; - //FIXME can fragments have a variable prefix name? - private static final String SCA_FRAGMENT_FILE_NAME = "sca.fragment"; - private static final String SYSTEM_MODULE_FILE_NAME = "system.module"; - //FIXME can fragments have a variable prefix name? - private static final String SYSTEM_FRAGMENT_FILE_NAME = "system.fragment"; - - protected final AssemblyContext modelContext; - protected final ResourceLoader resourceLoader; - protected final AssemblyFactory assemblyFactory; - - // JFM HACK - private ComponentTypeIntrospector introspector; - - private ComponentType systemType; - - private ComponentType compositeType; - - protected ComponentTypeIntrospector getIntrospector(){ - if (introspector == null){ - introspector = ProcessorUtils.createCoreIntrospector(assemblyFactory); - } - return introspector; - } - - protected ComponentType getSystemCompositeComponentType() throws ConfigurationLoadException { - if (systemType == null){ - systemType = getIntrospector().introspect(SystemCompositeContextImpl.class); - } - return systemType; - } - - protected ComponentType getCompositeComponentType() throws ConfigurationLoadException { - if (compositeType == null){ - compositeType = getIntrospector().introspect(CompositeContextImpl.class); - } - return compositeType; - } - /// JFM HACK - - protected AbstractModuleComponentConfigurationLoader(AssemblyContext modelContext) { - this.modelContext = modelContext; - resourceLoader = modelContext.getApplicationResourceLoader(); - assemblyFactory = modelContext.getAssemblyFactory(); - } - - public ModuleComponent loadSystemModuleComponent(String name, String uri) throws ConfigurationLoadException { - ModuleComponent mc = loadModuleComponent(SYSTEM_MODULE_FILE_NAME, SYSTEM_FRAGMENT_FILE_NAME, name, uri); - //JFM HACK - this is completely gross since it overwrites existing component type - mc.getImplementation().setImplementationClass(SystemCompositeContextImpl.class); - mc.getImplementation().setComponentType(getSystemCompositeComponentType()); - //END HACK - return mc; - } - - public ModuleComponent loadModuleComponent(String name, String uri) throws ConfigurationLoadException { - ModuleComponent mc = loadModuleComponent(SCA_MODULE_FILE_NAME, SCA_FRAGMENT_FILE_NAME, name, uri); - //JFM HACK - mc.getImplementation().setImplementationClass(CompositeContextImpl.class); - mc.getImplementation().setComponentType(getCompositeComponentType()); - //END HACK - return mc; - } - - protected ModuleComponent loadModuleComponent(String moduleFileName, String fragmentFileName, String name, String uri) throws ConfigurationLoadException { - - // Load the sca.module file - URL moduleUrl; - moduleUrl = resourceLoader.getResource(moduleFileName); - - - if (moduleUrl == null) { - throw new ConfigurationLoadException(moduleFileName); - } - - // Load the sca.fragment files - Iterator<URL> i; - try { - i = resourceLoader.getResources(fragmentFileName); - } catch (IOException e) { - throw new ConfigurationLoadException(fragmentFileName, e); - } - List<URL> moduleFragmentUris=new ArrayList<URL>(); - while (i.hasNext()) { - URL url=i.next(); - moduleFragmentUris.add(url); - } - - return loadModuleComponent(name, uri, moduleUrl, moduleFragmentUris); - } - - public ModuleComponent loadModuleComponent(String name, String uri, URL url) throws ConfigurationLoadException { - return loadModuleComponent( name, uri, url, null); - } - - public ModuleComponent loadModuleComponent(String name, String uri, URL moduleUri, Collection<URL> moduleFragmentUris) throws ConfigurationLoadException { - - // Load the module file - Module module=loadModule(moduleUri); - // Load the sca.fragment files - if (moduleFragmentUris!=null) { - for (URL moduleFragmentUri : moduleFragmentUris) { - ModuleFragment moduleFragment=loadModuleFragment(moduleFragmentUri); - module.getModuleFragments().add(moduleFragment); - } - } - - // Create the module component - ModuleComponent moduleComponent=assemblyFactory.createModuleComponent(); - moduleComponent.setName(name); - moduleComponent.setURI(uri); - moduleComponent.setImplementation(module); - moduleComponent.initialize(modelContext); - - return moduleComponent; - } - - public abstract Module loadModule(URL url) throws ConfigurationLoadException; - - public abstract ModuleFragment loadModuleFragment(URL url) throws ConfigurationLoadException; -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java deleted file mode 100644 index fdbb6e0942..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.config.processor.ProcessorUtils; -import org.apache.tuscany.core.extension.config.ImplementationProcessor; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.ComponentName; - -/** - * Introspects Java annotation-based metata data - * - * @version $Rev$ $Date$ - */ -@org.osoa.sca.annotations.Service(ComponentTypeIntrospector.class) -public class Java5ComponentTypeIntrospector implements ComponentTypeIntrospector { - - private AssemblyFactory factory; - - private List<ImplementationProcessor> processors = new ArrayList<ImplementationProcessor>(); - - public Java5ComponentTypeIntrospector() { - } - - public Java5ComponentTypeIntrospector(AssemblyFactory factory) { - this.factory = factory; - } - - @Autowire - public void setFactory(SystemAssemblyFactory factory) { - this.factory = factory; - //FIXME JFM HACK - List<ImplementationProcessor> processors = ProcessorUtils.createCoreProcessors(factory); - for (ImplementationProcessor processor : processors) { - this.registerProcessor(processor); - } - // END hack - } - - @ComponentName - protected String name; - - @Init(eager = true) - public void init(){ - } - - public void registerProcessor(ImplementationProcessor processor) { - processors.add(processor); - } - - public void unregisterProcessor(ImplementationProcessor processor) { - processors.remove(processor); - } - - /** - * Visits the given implementation type and calls back to {@link org.apache.tuscany.core.extension.config.ImplementationProcessor}s - * registered with this introspector to build up a {@link ComponentType} - * - * @return ComponentType representing the implementation type metadata - * @throws ConfigurationLoadException if there is an error introspecting the implementation type - */ - public ComponentType introspect(Class<?> implClass) throws ConfigurationLoadException { - ComponentType compType = factory.createComponentType(); - return introspect(implClass, compType); - } - - public ComponentType introspect(Class<?> implClass, ComponentType compType) throws ConfigurationLoadException { - for (ImplementationProcessor processor : processors) { - processor.visitClass(implClass, compType); - } - Constructor[] constructors = implClass.getConstructors(); - for (Constructor constructor : constructors) { - for (ImplementationProcessor processor : processors) { - processor.visitConstructor(constructor, compType); - } - } - Method[] methods = implClass.getMethods(); - for (Method method : methods) { - for (ImplementationProcessor processor : processors) { - processor.visitMethod(method, compType); - } - } - Set<Field> fields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(implClass); - for (Field field : fields) { - for (ImplementationProcessor processor : processors) { - processor.visitField(field, compType); - } - } - Class superClass = implClass.getSuperclass(); - if (superClass != null) { - visitSuperClass(superClass, compType); - } - for (ImplementationProcessor processor : processors) { - processor.visitEnd(implClass, compType); - } - return compType; - } - - private void visitSuperClass(Class<?> superClass, ComponentType compType) throws ConfigurationLoadException { - if (!Object.class.equals(superClass)) { - for (ImplementationProcessor processor : processors) { - processor.visitSuperClass(superClass, compType); - } - superClass = superClass.getSuperclass(); - if (superClass != null) { - visitSuperClass(superClass, compType); - } - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/StAXModuleComponentConfigurationLoaderImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/StAXModuleComponentConfigurationLoaderImpl.java deleted file mode 100644 index 3bd6e6361d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/StAXModuleComponentConfigurationLoaderImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.StAXLoaderRegistry; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleFragment; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import java.io.IOException; -import java.net.URL; - -/** - * @version $Rev$ $Date$ - */ -public class StAXModuleComponentConfigurationLoaderImpl extends AbstractModuleComponentConfigurationLoader { - private final XMLInputFactory xmlFactory; - private final StAXLoaderRegistry registry; - - public StAXModuleComponentConfigurationLoaderImpl(AssemblyContext modelContext, XMLInputFactory xmlFactory, StAXLoaderRegistry registry) { - super(modelContext); - this.xmlFactory = xmlFactory; - this.registry = registry; - } - - public Module loadModule(URL url) throws ConfigurationLoadException { - registry.setContext(modelContext); - try { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(url.openStream()); - getDocumentRoot(reader); - return (Module) registry.load(reader, new LoaderContext(resourceLoader)); - } catch (XMLStreamException e) { - ConfigurationLoadException ce = new ConfigurationLoadException(e); - ce.setResourceURI(url.toString()); - throw ce; - } catch (IOException e) { - ConfigurationLoadException ce = new ConfigurationLoadException(e); - ce.setResourceURI(url.toString()); - throw ce; - } finally { - registry.setContext(null); - } - } - - public ModuleFragment loadModuleFragment(URL url) throws ConfigurationLoadException { - registry.setContext(modelContext); - try { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(url.openStream()); - getDocumentRoot(reader); - return (ModuleFragment) registry.load(reader, new LoaderContext(resourceLoader)); - } catch (XMLStreamException e) { - ConfigurationLoadException ce = new ConfigurationLoadException(e); - ce.setResourceURI(url.toString()); - throw ce; - } catch (IOException e) { - ConfigurationLoadException ce = new ConfigurationLoadException(e); - ce.setResourceURI(url.toString()); - throw ce; - } finally { - registry.setContext(null); - } - } - - private static void getDocumentRoot(XMLStreamReader reader) throws XMLStreamException { - while (true) { - if (reader.next() == XMLStreamConstants.START_ELEMENT) { - return; - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ComponentNameProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ComponentNameProcessor.java deleted file mode 100644 index 0314bcc9bf..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ComponentNameProcessor.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.extension.config.extensibility.ComponentNameExtensibilityElement; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.osoa.sca.annotations.ComponentName; - -/** - * Processes the {@link ComponentName} annotation - * - * @version $$Rev$$ $$Date$$ - */ -public class ComponentNameProcessor extends ImplementationProcessorSupport { - - public ComponentNameProcessor(AssemblyFactory factory) { - super(factory); - } - - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { - ComponentName name = method.getAnnotation(ComponentName.class); - if (name == null) { - return; - } - type.getExtensibilityElements().add(new ComponentNameExtensibilityElement(method)); - } - - public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { - ComponentName name = field.getAnnotation(ComponentName.class); - if (name == null) { - return; - } - type.getExtensibilityElements().add(new ComponentNameExtensibilityElement(field)); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ContextProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ContextProcessor.java deleted file mode 100644 index ff5c3736b7..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ContextProcessor.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.extension.config.extensibility.ContextExtensibilityElement; -import org.apache.tuscany.model.assembly.ComponentType; -import org.osoa.sca.annotations.Context; - -/** - * Processes the {@link org.osoa.sca.annotations.Context} annotation - * - * @version $$Rev$$ $$Date$$ - */ -public class ContextProcessor extends ImplementationProcessorSupport { - - public ContextProcessor() { - } - - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { - Context context = method.getAnnotation(Context.class); - if (context == null) { - return; - } - type.getExtensibilityElements().add(new ContextExtensibilityElement(method)); - } - - public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { - Context context = field.getAnnotation(Context.class); - if (context == null) { - return; - } - type.getExtensibilityElements().add(new ContextExtensibilityElement(field)); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DefaultProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DefaultProcessor.java deleted file mode 100644 index 8445526dc8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DefaultProcessor.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.List; -import java.util.Set; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.Reference; - -/** - * Adds public methods and public/protected fields as properties that are not declared explicitly with an - * {@link org.osoa.sca.annotations.Property} or {@link org.osoa.sca.annotations.Reference} annotation - * - * @version $$Rev$$ $$Date$$ - */ -public class DefaultProcessor extends ImplementationProcessorSupport { - - public DefaultProcessor(AssemblyFactory factory) { - super(factory); - } - - public DefaultProcessor() { - } - - public void visitEnd(Class<?> clazz, ComponentType type) throws ConfigurationLoadException { - // add any public/protected fields and public setter methods as properties - Set<Field> fields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(clazz); - List<Property> properties = type.getProperties(); - List<Reference> references = type.getReferences(); - boolean contains; - Method[] methods = clazz.getMethods(); - String name; - for (Method method : methods) { - if (Object.class.equals(method.getDeclaringClass()) || method.getParameterTypes().length != 1 - || method.isAnnotationPresent(org.osoa.sca.annotations.Property.class) - || method.isAnnotationPresent(org.osoa.sca.annotations.Reference.class)) { - continue; - } - contains = containsProperty(properties, method.getName()); - if (contains) { - continue; - } - name = method.getName(); - if (name.length() > 3 && name.startsWith("set")) { - // follow JavaBeans conventions - name = JavaIntrospectionHelper.toPropertyName(name); - } - contains = containsReference(references, name); - if (!contains) { - addProperty(name, method.getParameterTypes()[0], type); - } - } - for (Field field : fields) { - if (field.isAnnotationPresent(org.osoa.sca.annotations.Property.class) - || field.isAnnotationPresent(org.osoa.sca.annotations.Reference.class)) { - continue; - } - contains = containsProperty(properties, field.getName()); - if (contains) { - continue; - } - contains = containsReference(references, field.getName()); - if (!contains) { - addProperty(field.getName(), field.getType(), type); - } - } - } - - private boolean containsProperty(List<Property> properties, String name) { - for (Property prop : properties) { - if (prop.getName().equals(name)) { - return true; - } - } - return false; - } - - private boolean containsReference(List<Reference> references, String name) { - for (Reference ref : references) { - if (ref.getName().equals(name)) { - return true; - } - } - return false; - } - - private void addProperty(String name, Class<?> propType, ComponentType type) { - Property property = factory.createProperty(); - property.setName(name); - property.setRequired(false); - property.setType(propType); - type.getProperties().add(property); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DestroyProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DestroyProcessor.java deleted file mode 100644 index a16845bbf8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DestroyProcessor.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.lang.reflect.Method; - -import org.apache.tuscany.core.extension.config.extensibility.DestroyInvokerExtensibilityElement; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.osoa.sca.annotations.Destroy; - -/** - * Processes a {@link Destroy} - * - * @version $$Rev$$ $$Date$$ - */ -public class DestroyProcessor extends ImplementationProcessorSupport { - - public DestroyProcessor() { - } - - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { - Destroy destroy = method.getAnnotation(Destroy.class); - if (destroy == null) { - return; - } - if (method.getParameterTypes().length != 0) { - throw new ConfigurationLoadException("Destroy methods cannot take parameters"); - } - type.getExtensibilityElements().add(new DestroyInvokerExtensibilityElement(method)); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ImplementationProcessorSupport.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ImplementationProcessorSupport.java deleted file mode 100644 index 175de28a92..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ImplementationProcessorSupport.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.extension.config.ImplementationProcessor; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -/** - * A base implementation of an <code>ImplementationProcessor</code> - * - * @version $$Rev$$ $$Date$$ - */ -@Scope("MODULE") -public abstract class ImplementationProcessorSupport implements ImplementationProcessor { - - protected ComponentTypeIntrospector introspector; - protected AssemblyFactory factory; - - protected ImplementationProcessorSupport(AssemblyFactory factory) { - this.factory = factory; - } - - protected ImplementationProcessorSupport() { - } - - @Init(eager = true) - public void init() throws Exception { - introspector.registerProcessor(this); - } - - @Autowire - public void setIntrospector(ComponentTypeIntrospector introspector) { - this.introspector = introspector; - } - - @Autowire - public void setFactory(AssemblyFactory factory) { - this.factory = factory; - - } - - public void visitClass(Class<?> clazz, ComponentType type) throws ConfigurationLoadException { - - } - - public void visitSuperClass(Class<?> clazz, ComponentType type) throws ConfigurationLoadException { - - } - - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { - - } - - public void visitConstructor(Constructor<?> constructor, ComponentType type) throws ConfigurationLoadException { - - } - - public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { - - } - - public void visitInterface(Class clazz, Annotation[] annotations, ComponentType type) throws ConfigurationLoadException { - - } - - public void visitInterfaceMethod(Method method, Annotation[] annotations, ComponentType type) throws ConfigurationLoadException { - - } - - public void visitEnd(Class<?> clazz, ComponentType type) throws ConfigurationLoadException { - - } - -// /** -// * Creates a {@link JavaExtensibilityElement} subclasses may update while processing annotations -// */ -// protected JavaExtensibilityElement getExtensibilityElement(ComponentType type) { -// JavaExtensibilityElement element = (JavaExtensibilityElement) type.getExtensibilityElements().get(JAVA_ELEMENT); -// if (element == null) { -// element = new JavaExtensibilityElementImpl(); -// type.getExtensibilityElements().put(JAVA_ELEMENT, element); -// } -// return element; -// } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/InitProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/InitProcessor.java deleted file mode 100644 index 9f4a53a651..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/InitProcessor.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.lang.reflect.Method; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.extension.config.extensibility.InitInvokerExtensibilityElement; -import org.apache.tuscany.model.assembly.ComponentType; -import org.osoa.sca.annotations.Init; - -/** - * Processes the {@link org.osoa.sca.annotations.Init} annotation - * - * @version $$Rev$$ $$Date$$ - */ -public class InitProcessor extends ImplementationProcessorSupport { - - public InitProcessor() { - } - - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { - Init init = method.getAnnotation(Init.class); - if (init == null) { - return; - } - if (method.getParameterTypes().length != 0) { - throw new ConfigurationLoadException("Initialize methods cannot take parameters"); - } - type.getExtensibilityElements().add(new InitInvokerExtensibilityElement(method, init.eager())); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorHelper.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorHelper.java deleted file mode 100644 index d4c6c4a40e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorHelper.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.util.List; - -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; - -/** - * Provides utility functions for {@link org.apache.tuscany.core.extension.config.ImplementationProcessor}s - * - * @version $$Rev$$ $$Date$$ - */ -public class ProcessorHelper { - - private ProcessorHelper() { - } - - /** - * Returns the first <code>Service</code> from a collection matching the interface type - */ - public static Service getService(Class<?> interfaceType, List<Service> services) { - for (Service service : services) { - Class serviceInterface = service.getServiceContract().getInterface(); - if (serviceInterface.equals(interfaceType)) { - return service; - } - } - return null; - } - - /** - * Returns the scope enum specified by the annotation - */ - public static Scope getScope(org.osoa.sca.annotations.Scope annotation) { - if ("MODULE".equalsIgnoreCase(annotation.value())) { - return Scope.MODULE; - } else if ("SESSION".equalsIgnoreCase(annotation.value())) { - return Scope.SESSION; - } else if ("REQUEST".equalsIgnoreCase(annotation.value())) { - return Scope.REQUEST; - } else { - return Scope.INSTANCE; - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorUtils.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorUtils.java deleted file mode 100644 index b0400c183f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorUtils.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.core.extension.config.ImplementationProcessor; -import org.apache.tuscany.core.system.config.processor.AutowireProcessor; -import org.apache.tuscany.core.system.config.processor.MonitorProcessor; -import org.apache.tuscany.core.system.config.processor.ParentContextProcessor; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector; -import org.apache.tuscany.core.sdo.helper.SDOHelperProcessor; -import org.apache.tuscany.model.assembly.AssemblyFactory; - -/** - * Temporary class to create bootstrap {@link ImplementationProcessor}s - * - * @version $$Rev$$ $$Date$$ - */ -public class ProcessorUtils { - - private ProcessorUtils() { - } - - public static List<ImplementationProcessor> createCoreProcessors(AssemblyFactory factory) { - List<ImplementationProcessor> processors = new ArrayList<ImplementationProcessor>(); - processors.add(new PropertyProcessor(factory)); - processors.add(new ReferenceProcessor(factory)); - processors.add(new ScopeProcessor()); - processors.add(new ServiceProcessor(factory)); - processors.add(new InitProcessor()); - processors.add(new DestroyProcessor()); - processors.add(new ContextProcessor()); - processors.add(new ComponentNameProcessor(factory)); - processors.add(new DefaultProcessor(factory)); - processors.add(new AutowireProcessor()); - processors.add(new MonitorProcessor()); - processors.add(new ParentContextProcessor()); - processors.add(new SDOHelperProcessor()); - return processors; - } - - public static ComponentTypeIntrospector createCoreIntrospector(AssemblyFactory factory){ - ComponentTypeIntrospector introspector = new Java5ComponentTypeIntrospector(factory); - List<ImplementationProcessor> processors = createCoreProcessors(factory); - for (ImplementationProcessor processor : processors) { - introspector.registerProcessor(processor); - } - return introspector; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyProcessor.java deleted file mode 100644 index 9191b75793..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyProcessor.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.InvalidSetterException; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Property; -import org.osoa.sca.annotations.Scope; - -/** - * Processes the {@link org.osoa.sca.annotations.Property} annotation - * - * @version $$Rev$$ $$Date$$ - */ -@Scope("MODULE") -public class PropertyProcessor extends ImplementationProcessorSupport { - - public PropertyProcessor(AssemblyFactory factory) { - super(factory); - } - - public PropertyProcessor() { - } - - @Override - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { - if (method.getDeclaringClass().equals(Object.class)) { - return; - } - org.osoa.sca.annotations.Property annotation = method.getAnnotation(org.osoa.sca.annotations.Property.class); - if (annotation != null) { - if (!Modifier.isPublic(method.getModifiers())) { - InvalidSetterException e = new InvalidSetterException("Property setter method is not public"); - e.setIdentifier(method.toString()); - throw e; - } - Class<?>[] params = method.getParameterTypes(); - if (params.length != 1) { - InvalidSetterException e = new InvalidSetterException("Property setter method must have one parameter"); - e.setIdentifier(method.toString()); - throw e; - } - String name = annotation.name(); - if (name.length() == 0) { - name = method.getName(); - if (name.length() > 3 && name.startsWith("set")) { - // follow JavaBeans conventions - name = JavaIntrospectionHelper.toPropertyName(name); - } - } - addProperty(name, method.getParameterTypes()[0], annotation.required(), type); - } - - - } - - @Override - public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { - if (field.getDeclaringClass().equals(Object.class)) { - return; - } - int modifiers = field.getModifiers(); - org.osoa.sca.annotations.Property annotation = field.getAnnotation(org.osoa.sca.annotations.Property.class); - if (annotation != null) { - if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { - InvalidSetterException e = new InvalidSetterException("Property field is not public or protected"); - e.setIdentifier(field.getName()); - throw e; - } - String name = annotation.name(); - if (name.length() == 0) { - name = field.getName(); - } - addProperty(name, field.getType(), annotation.required(), type); - } - } - - private void addProperty(String name, Class<?> propType, boolean required, ComponentType type) { - Property property = factory.createProperty(); - property.setName(name); - property.setRequired(required); - property.setType(propType); - type.getProperties().add(property); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyReferenceValidator.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyReferenceValidator.java deleted file mode 100644 index bc8ef02777..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyReferenceValidator.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.lang.reflect.Field; -import java.util.Set; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.MetaDataException; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; - -/** - * Validates the use of {@link org.osoa.sca.annotations.Property} and {@link - * org.osoa.sca.annotations.Reference} annotations beyond native Java syntactic capabilities - * - * @version $$Rev$$ $$Date$$ - */ -public class PropertyReferenceValidator extends ImplementationProcessorSupport { - - public PropertyReferenceValidator(AssemblyFactory factory) { - super(factory); - } - - public void visitEnd(Class<?> clazz, ComponentType type) throws ConfigurationLoadException { - // validate methods do not contain both @Reference and @Property annotations - Method[] methods = clazz.getMethods(); - boolean found; - for (Method method : methods) { - found = false; - Annotation[] anotations = method.getAnnotations(); - for (Annotation annotation : anotations) { - if (Property.class.equals(annotation.annotationType()) - || Reference.class.equals(annotation.annotationType())) { - if (found) { - MetaDataException e = new MetaDataException("Method cannot specify both property and reference"); - e.setIdentifier(method.getName()); - throw e; - } - found = true; - } - } - } - // validate fields do not contain both @Reference and @Property annotations - Set<Field> fields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(clazz); - for (Field field : fields) { - found = false; - Annotation[] anotations = field.getAnnotations(); - for (Annotation annotation : anotations) { - if (Property.class.equals(annotation.annotationType()) - || Reference.class.equals(annotation.annotationType())) { - if (found) { - MetaDataException e = new MetaDataException("Field cannot specify both property and reference"); - e.setIdentifier(field.getName()); - throw e; - } - found = true; - } - } - } - - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ReferenceProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ReferenceProcessor.java deleted file mode 100644 index 007410b500..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ReferenceProcessor.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.Collection; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.InvalidSetterException; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.osoa.sca.annotations.Scope; - -/** - * Processes the {@link org.osoa.sca.annotations.Reference} annotation - * - * @version $$Rev$$ $$Date$$ - */ -@Scope("MODULE") -public class ReferenceProcessor extends ImplementationProcessorSupport { - - public ReferenceProcessor() { - } - - public ReferenceProcessor(AssemblyFactory factory) { - super(factory); - } - - @Override - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { - if(method.getDeclaringClass().equals(Object.class)){ - return; - } - int modifiers = method.getModifiers(); - org.osoa.sca.annotations.Reference annotation = method.getAnnotation(org.osoa.sca.annotations.Reference.class); - if (annotation != null) { - if (!Modifier.isPublic(modifiers)) { - InvalidSetterException e = new InvalidSetterException("Reference setter method is not public"); - e.setIdentifier(method.getName()); - throw e; - } - if (!Void.TYPE.equals(method.getReturnType())) { - InvalidSetterException e = new InvalidSetterException("Refence setter method must return void"); - e.setIdentifier(method.toString()); - throw e; - } - Class<?>[] params = method.getParameterTypes(); - if (params.length != 1) { - InvalidSetterException e = new InvalidSetterException("Reference setter method must have one parameter"); - e.setIdentifier(method.toString()); - throw e; - } - String name = annotation.name(); - if (name.length() == 0) { - name = method.getName(); - if (name.length() > 3 && name.startsWith("set")) { - // follow JavaBeans conventions - name = JavaIntrospectionHelper.toPropertyName(name); - } - } - addReference(name, params[0], annotation.required(), type); - } - } - - @Override - public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { - if(field.getDeclaringClass().equals(Object.class)){ - return; - } - int modifiers = field.getModifiers(); - org.osoa.sca.annotations.Reference annotation = field.getAnnotation(org.osoa.sca.annotations.Reference.class); - if (annotation != null) { - if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { - InvalidSetterException e = new InvalidSetterException("Reference field is not public or protected"); - e.setIdentifier(field.getName()); - throw e; - } - String name = annotation.name(); - if (name.length() == 0) { - name = field.getName(); - } - addReference(name, field.getType(), annotation.required(), type); - } - } - - private void addReference(String name, Class<?> paramType, boolean required, ComponentType type) { - Reference reference = factory.createReference(); - reference.setName(name); - ServiceContract contract = factory.createJavaServiceContract(); - contract.setInterface(paramType); - reference.setServiceContract(contract); - boolean many = paramType.isArray() || Collection.class.isAssignableFrom(paramType); - Multiplicity multiplicity; - if (required) - multiplicity = many ? Multiplicity.ONE_N : Multiplicity.ONE_ONE; - else - multiplicity = many ? Multiplicity.ZERO_N : Multiplicity.ZERO_ONE; - reference.setMultiplicity(multiplicity); - type.getReferences().add(reference); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ScopeProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ScopeProcessor.java deleted file mode 100644 index e81430115a..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ScopeProcessor.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; - -/** - * Processes the {@link org.osoa.sca.annotations.Scope} annotation - * - * @version $$Rev$$ $$Date$$ - */ -public class ScopeProcessor extends ImplementationProcessorSupport { - - public ScopeProcessor() { - } - - @Override - public void visitEnd(Class<?> clazz, ComponentType type) throws ConfigurationLoadException { - Scope scope = null; - org.osoa.sca.annotations.Scope annotation = clazz.getAnnotation(org.osoa.sca.annotations.Scope.class); - if (annotation != null) { - scope = ProcessorHelper.getScope(annotation); - } else { - Class<?> superClass = clazz.getSuperclass(); - if (superClass != null) { - scope = recurseScope(superClass); - } - } - if (scope == null) { - scope = Scope.INSTANCE; - } - //FIXME hack for now - set scope to implementation scope - //This will be clean up with spec change - for (Service service : type.getServices()) { - Scope serviceScope = service.getServiceContract().getScope(); - if (serviceScope == Scope.INSTANCE || serviceScope == null) { - service.getServiceContract().setScope(scope); - } - } - - } - - /** - * Walks the class hierarchy until a scope annotation is found - */ - private Scope recurseScope(Class<?> superClass) { - if (Object.class.equals(superClass)) { - return null; - } - org.osoa.sca.annotations.Scope scope = superClass.getAnnotation(org.osoa.sca.annotations.Scope.class); - if (scope == null) { - superClass = superClass.getSuperclass(); - if (superClass != null) { - return recurseScope(superClass); - } - } - return ProcessorHelper.getScope(scope); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java deleted file mode 100644 index 2c7ba823f2..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java +++ /dev/null @@ -1,129 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.processor; - -import java.util.List; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.InvalidMetaDataException; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.types.java.JavaServiceContract; -import org.osoa.sca.annotations.Callback; - -/** - * Processes the {@link org.osoa.sca.annotations.Service} annotation - * - * @version $$Rev$$ $$Date$$ - */ -public class ServiceProcessor extends ImplementationProcessorSupport { - - public ServiceProcessor() { - } - - public ServiceProcessor(AssemblyFactory factory) { - super(factory); - } - - @Override - public void visitClass(Class<?> clazz, ComponentType type) throws ConfigurationLoadException { - if (!clazz.isInterface()) { - processImplementation(clazz,type); - } else { - processInterface(clazz, type); - } - } - - private void processImplementation(Class<?> clazz, ComponentType type) throws ConfigurationLoadException { - // visiting the base implementation class - List<org.apache.tuscany.model.assembly.Service> services = type.getServices(); - Class[] interfaces = clazz.getInterfaces(); - org.osoa.sca.annotations.Service serviceAnnotation = clazz.getAnnotation(org.osoa.sca.annotations.Service.class); - if (interfaces.length == 0) { - // no interfaces so the class is the service - addService(services, clazz); - } else if (serviceAnnotation == null && interfaces.length == 1) { - // the impl has one interface, assign it to be the service - addService(services, interfaces[0]); - } else { - // visiting the implementation class - if (serviceAnnotation == null) { - return; - } - Class<?>[] serviceInterfaces = serviceAnnotation.interfaces(); - Class<?> value = serviceAnnotation.value(); - if (serviceInterfaces.length > 0) { - if (!Void.class.equals(value)) { - InvalidMetaDataException e = new InvalidMetaDataException("Both interfaces and value specified in @Service on "); - e.setIdentifier(clazz.getName()); - throw e; - } - for (Class<?> intf : interfaces) { - addService(services, intf); - } - } else if (!Void.class.equals(value)) { - addService(services, value); - } - } - } - - - @Override - public void visitEnd(Class<?> clazz, ComponentType type) throws ConfigurationLoadException { - List<Service> services = type.getServices(); - if (services.size() == 0) { - // no services processed so the class is the service - addService(services, clazz); - } - } - - private void processInterface(Class<?> clazz, ComponentType type) { - List<org.apache.tuscany.model.assembly.Service> services = type.getServices(); - // the interface is a remotable service, add it - org.osoa.sca.annotations.Remotable remotableAnnotation = clazz.getAnnotation(org.osoa.sca.annotations.Remotable.class); - if (remotableAnnotation != null) { - // check to see if service added previously b/c it was specified on @Service - if (ProcessorHelper.getService(clazz, services) == null) { - addService(services, clazz); - } - } - } - - - private void addService(List<Service> services, Class<?> serviceClass) { - //FIXME how do we support specifying remotable? - JavaServiceContract javaInterface = factory.createJavaServiceContract(); - javaInterface.setInterface(serviceClass); - org.osoa.sca.annotations.Scope scopeAnnotation = serviceClass.getAnnotation(org.osoa.sca.annotations.Scope.class); - Scope scope; - if (scopeAnnotation == null) { - scope = Scope.INSTANCE; - } else { - scope = ProcessorHelper.getScope(scopeAnnotation); - } - javaInterface.setScope(scope); - Callback callback = serviceClass.getAnnotation(Callback.class); - if (callback != null && !Void.class.equals(callback.value())) { - javaInterface.setCallbackInterface(callback.value()); - } - String name = JavaIntrospectionHelper.getBaseName(serviceClass); - Service service = factory.createService(); - service.setName(name); - service.setServiceContract(javaInterface); - services.add(service); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/AtomicContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/AtomicContext.java deleted file mode 100644 index 7d4b990ab5..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/AtomicContext.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * A runtime entity that manages an atomic (i.e. leaf-type) artifact. - * - * @version $Rev$ $Date$ - */ -public interface AtomicContext extends Context { - - /** - * Returns whether the context should be eagerly initialized - */ - public boolean isEagerInit(); - - /** - * Notifies the context of an initialization event - * @throws TargetException - */ - public void init() throws TargetException; - - /** - * Notifies the context of a destroy event - * @throws TargetException - */ - public void destroy() throws TargetException; - - /** - * Returns whether the context should be called back when its scope ends - */ - public boolean isDestroyable(); - - /** - * Returns the target instance associated with the context. A target instance is the actual - * object a request is dispatched to sans proxy wire chain. - * @throws TargetException - */ - public Object getTargetInstance() throws TargetException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireContext.java deleted file mode 100644 index 7fa459e76d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireContext.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * A specialization of a CompositeContext that is able to automatically resolve references - * for its children using EntryPoint or Service interfaces exposed by it or, recursively, any - * of it parents. - * - * @version $Rev$ $Date$ - */ -public interface AutowireContext extends CompositeContext { - - /** - * Invoked by child contexts to return an an autowire target. Resolved targets may be entry points or - * components in the parent or its ancestors, or entry points in a sibling context - * - * @param instanceInterface the type of service being requested - * @return a reference to the requested service or null if none can be found - * @throws AutowireResolutionException if an error occurs attempting to resolve an autowire - */ - <T> T resolveInstance(Class<T> instanceInterface) throws AutowireResolutionException; - - /** - * Invoked by a parent context to return an autowire target in a child. Resolved targets must be entry points. - * For example, given a parent P and two siblings, A and B, A would request an autowire by invoking - * {@link #resolveInstance(Class<T>)} on P, which in turn could invoke the present method on B in order to resolve - * a target. - * - * @param instanceInterface the type of service being requested - * @return a reference to the requested service or null if none can be found - * @throws AutowireResolutionException if an error occurs attempting to resolve an autowire - */ - <T> T resolveExternalInstance(Class<T> instanceInterface) throws AutowireResolutionException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireResolutionException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireResolutionException.java deleted file mode 100644 index 4da4206a94..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireResolutionException.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * Denotes an exception while resolving an automatic wire - * - * @version $Rev$ $Date$ - */ -public class AutowireResolutionException extends TargetException { - - public AutowireResolutionException() { - super(); - } - - public AutowireResolutionException(String message) { - super(message); - } - - public AutowireResolutionException(String message, Throwable cause) { - super(message, cause); - } - - public AutowireResolutionException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/CompositeContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/CompositeContext.java deleted file mode 100644 index abd23feb38..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/CompositeContext.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.model.assembly.Composite; -import org.apache.tuscany.model.assembly.Part; -import org.apache.tuscany.model.assembly.Extensible; -import org.apache.tuscany.model.assembly.AssemblyContext; - -import java.util.List; - -/** - * A context which contains child component contexts. - * - * @version $Rev$ $Date$ - */ -public interface CompositeContext extends Context { - - public String getURI(); - - public void setURI(String uri); - - /** - * TODO remove this method - * @deprecated - */ - public void setAssemblyContext(AssemblyContext context); - - /** - * Returns the parent context, or null if the context does not have one - */ - public CompositeContext getParent(); - - /** - * Sets the parent context - */ - public void setParent(CompositeContext parent); - - /** - * Adds runtime artifacts represented by the set of model objects to the composite context by merging them with - * existing artifacts. Implementing classes may support only a subset of {@link Part} types. - * - * @see org.apache.tuscany.model.assembly.Component - * @see org.apache.tuscany.model.assembly.ModuleComponent - * @see org.apache.tuscany.model.assembly.AtomicComponent - * @see org.apache.tuscany.model.assembly.EntryPoint - * @see org.apache.tuscany.model.assembly.ExternalService - */ - public void registerModelObjects(List<? extends Extensible> models) throws ConfigurationException; - - /** - * Adds a runtime artifact represented by the model object to the composite context by merging it with existing - * artifacts. Implementing classes may support only a subset of {@link Part} types. - * - * @see org.apache.tuscany.model.assembly.Component - * @see org.apache.tuscany.model.assembly.ModuleComponent - * @see org.apache.tuscany.model.assembly.AtomicComponent - * @see org.apache.tuscany.model.assembly.EntryPoint - * @see org.apache.tuscany.model.assembly.ExternalService - */ - public void registerModelObject(Extensible model) throws ConfigurationException; - - /** - * Returns the child context associated with a given name - */ - public Context getContext(String name); - - /** - * Returns the composite managed by this composite context - */ - @Deprecated - public Composite getComposite(); - - public void removeContext(String name); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ConfigurationContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ConfigurationContext.java deleted file mode 100644 index 558de7609f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ConfigurationContext.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.WireBuilder; - -/** - * Offers configuration services in the runtime. A ConfigurationContext is able to configure a model and then buildSource the - * runtime representation corresponding to that model in the live system. - * <p> - * Configuration contexts will typically be hierarchical, delegating to their parent <b>after</b> performing an - * operation. The parent ConfigurationContext will typically be injected into an implementation of this interface during - * registration. - * - * @version $Rev$ $Date$ - */ -public interface ConfigurationContext extends ContextFactoryBuilder, WireBuilder { -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/Context.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/Context.java deleted file mode 100644 index df313d8000..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/Context.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * An entity that provides an execution context for a runtime artifact or artifacts. A <code>Context</code> may - * be a composite, managing child contexts or it may be an atomic, i.e. leaf, context. - * - * @version $Rev$ $Date$ - */ -public interface Context extends EventPublisher, Lifecycle { - /** - * Returns the instance associated with the requested name, which may be in a atomic or composite form. Atomic (i.e. - * leaf) contexts will return an instance associated with the service name part of the compound name, which may be - * null. - * <p/> - * Composite contexts will return an instance (likely a proxy) of a contained entry point context. In this case, the - * port name on the qualified name will correspond to the composite context name and the part name will be used to - * retrieve the contained entry point context. The latter may be null. If the contained context is not an entry - * point context, an exception will be thrown. - * - * @param qName a qualified name of the requested instance - * @return the implementation instance or a proxy to it - * @throws TargetException - * if an error occurs retrieving the instance or the requested component is not an entry - * point. - * @see CompositeContext - * @see org.apache.tuscany.model.assembly.EntryPoint - */ - public Object getInstance(QualifiedName qName) throws TargetException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextInitException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextInitException.java deleted file mode 100644 index e024a98b0e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextInitException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * Denotes an error encountered while initializing an instance context - * - * @version $Rev$ $Date$ - */ -public class ContextInitException extends ContextRuntimeException { - - public ContextInitException() { - super(); - } - - public ContextInitException(String message) { - super(message); - } - - public ContextInitException(String message, Throwable cause) { - super(message, cause); - } - - public ContextInitException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextRuntimeException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextRuntimeException.java deleted file mode 100644 index 0d35f145dc..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextRuntimeException.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * An unchecked exception encountered by an {@link org.apache.tuscany.core.context.Context} - * - * @version $Rev$ $Date$ - */ -public class ContextRuntimeException extends CoreRuntimeException { - - public ContextRuntimeException() { - super(); - } - - public ContextRuntimeException(String message) { - super(message); - } - - public ContextRuntimeException(String message, Throwable cause) { - super(message, cause); - } - - public ContextRuntimeException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/CoreRuntimeException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/CoreRuntimeException.java deleted file mode 100644 index 63e6f18e99..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/CoreRuntimeException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.common.TuscanyRuntimeException; - -/** - * The root exception for the runtime package. Exceptions occurring in the runtime are generally non-recoverable - * - * @version $Rev$ $Date$ - */ -public abstract class CoreRuntimeException extends TuscanyRuntimeException { - - public CoreRuntimeException() { - super(); - } - - public CoreRuntimeException(String message) { - super(message); - } - - public CoreRuntimeException(String message, Throwable cause) { - super(message, cause); - } - - public CoreRuntimeException(Throwable cause) { - super(cause); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/DuplicateNameException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/DuplicateNameException.java deleted file mode 100644 index 81a334d3c8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/DuplicateNameException.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * Denotes an attempt to add a context with a name equal to an existing context - * - * @version $Rev$ $Date$ - */ -public class DuplicateNameException extends ContextRuntimeException { - - public DuplicateNameException() { - super(); - } - - public DuplicateNameException(String message) { - super(message); - } - - public DuplicateNameException(String message, Throwable cause) { - super(message, cause); - } - - public DuplicateNameException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EntryPointContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EntryPointContext.java deleted file mode 100644 index 63feabc43c..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EntryPointContext.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.wire.SourceWireFactory; - -/** - * The runtime artifact representing an entry point, <code>EntryPointContext</code> manages wire handler - * instances that expose service operations offered by a component in the parent composite. The wire handler - * instance is responsible for dispatching the request down an wire chain to the target instance. The wire - * chain may contain {@link org.apache.tuscany.core.wire.Interceptor}s and - * {@link org.apache.tuscany.core.wire.MessageHandler}s that implement policies or perform mediations on the - * wire. - * <p> - * Entry point contexts are used by transport binding artifacts to invoke an operation on a service. The transport - * binding uses an {@link java.lang.reflect.InvocationHandler} instance obtained from the <code>EntryPointContext</code> - * to perform the wire as in: - * - * <pre> - * CompositeContext compositeContext = ... - * EntryPointContext ctx = (EntryPointContext) compositeContext.getContext("source"); - * Assert.assertNotNull(ctx); - * InvocationHandler handler = (InvocationHandler) ctx.getHandler(); - * Object response = handler.invoke(null, operation, new Object[] { param }); - * </pre> - * - * The <code>Proxy</code> instance passed to <code>InvocationHandler</code> may be null as the client is invoking - * directly on the handler. - * <p> - * Alternatively, the following will return a proxy implementing the service interface exposed by the entry point: - * - * <pre> - * CompositeContext compositeContext = ... - * EntryPointContext ctx = (EntryPointContext) compositeContext.getContext("source"); - * Assert.assertNotNull(ctx); - * HelloWorld proxy = (Helloworld) ctx.getInstance(null); // service name not necessary - * </pre> - * - * The proxy returned will be backed by the entry point wire chain. - * - * @version $Rev$ $Date$ - */ -public interface EntryPointContext extends Context { - - /** - * Returns the handler responsible for flowing a request through the entry point - * @throws TargetException - */ - public Object getHandler() throws TargetException; - - /** - * Returns the service interface configured for the entry poitn - */ - public Class getServiceInterface(); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java deleted file mode 100644 index 36b0f98928..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * Implementations are responsible for tracking scope keys associated with the current request. - * - * @version $Rev$ $Date$ - */ -public interface EventContext { - - /** - * Returns the unique key for the given identifier associated with the current request - */ - public Object getIdentifier(Object type); - - /** - * Sets the unique key for the given identifier associated with the current request - */ - public void setIdentifier(Object type, Object identifier); - - /** - * Clears the unique key for the given identifier associated with the current request - */ - public void clearIdentifier(Object type); - - /** - * Clears all identifiers associated with the current request - */ - public void clearIdentifiers(); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventException.java deleted file mode 100644 index aaf26aee69..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * Denotes an error encountered while firing a module event - * - * @version $Rev$ $Date$ - */ -public class EventException extends CoreRuntimeException { - - public EventException(String message, Throwable cause) { - super(message, cause); - } - - public EventException(String message) { - super(message); - } - - public EventException(Throwable cause) { - super(cause); - } - - public EventException() { - super(); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventFilter.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventFilter.java deleted file mode 100644 index ee1334bef2..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventFilter.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.context.event.Event; - -import java.util.EventObject; - -/** - * Evaluates whether a {@link RuntimeEventListener} is applicable to a given runtime event - * - * @version $$Rev$$ $$Date$$ - */ -public interface EventFilter { - - /** - * Performs the actual evaluation on an event - */ - public boolean match(Event event); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventPublisher.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventPublisher.java deleted file mode 100644 index c7ccf88e25..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventPublisher.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.context.event.Event; - -/** - * Publishes events in the runtime - * - * @version $$Rev$$ $$Date$$ - */ -public interface EventPublisher { - - public void publish(Event object); - - /** - * Registers a listener to receive notifications for the context - */ - public void addListener(RuntimeEventListener listener); - - /** - * Registers a listener to receive notifications for the context - */ - public void addListener(EventFilter filter, RuntimeEventListener listener); - - - /** - * Removes a previously registered listener - */ - public void removeListener(RuntimeEventListener listener); - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java deleted file mode 100644 index f7b4a6c572..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * Manages an external service - * - * @version $Rev$ $Date$ - */ -public interface ExternalServiceContext extends Context { - - /** - * Returns the handler responsible for flowing a request through the external service - * @throws TargetException - */ - public Object getHandler() throws TargetException; - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/InvalidNameException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/InvalidNameException.java deleted file mode 100644 index 65c709e569..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/InvalidNameException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * Denotes an invalid name - * - * @version $Rev$ $Date$ - */ -public class InvalidNameException extends ContextRuntimeException { - - public InvalidNameException() { - super(); - } - - public InvalidNameException(String message) { - super(message); - } - - public InvalidNameException(String message, Throwable cause) { - super(message, cause); - } - - public InvalidNameException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/Lifecycle.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/Lifecycle.java deleted file mode 100644 index 6572841cf0..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/Lifecycle.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation or its licensors as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * @version $Rev$ $Date$ - */ -public interface Lifecycle { - /* A configuration error state */ - int CONFIG_ERROR = -1; - /* Has not been initialized */ - int UNINITIALIZED = 0; - /* In the process of being configured and initialized */ - int INITIALIZING = 1; - /* Instantiated and configured */ - int INITIALIZED = 2; - /* Started */ - int STARTED = 4; - /* Configured and initialized */ - int RUNNING = 4; - /* In the process of being shutdown */ - int STOPPING = 5; - /* Has been shutdown and removed from the module */ - int STOPPED = 6; - /* In an error state */ - int ERROR = 7; - - /** - * Returns the lifecycle state - * - * @see #UNINITIALIZED - * @see #INITIALIZING - * @see #INITIALIZED - * @see #RUNNING - * @see #STOPPING - * @see #STOPPED - */ - int getLifecycleState(); - - /** - * Starts the Lifecycle. - * - * @throws CoreRuntimeException - */ - void start() throws CoreRuntimeException; - - /** - * Stops the Lifecycle. - * - * @throws CoreRuntimeException - */ - void stop() throws CoreRuntimeException; - - /** - * Returns the name of the Lifecycle. - * @return the name of the Lifecycle - */ - String getName(); - - /** - * Sets the name of the Lifecycle. - * @param name the name of the Lifecycle - */ - void setName(String name); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingContextFactoryException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingContextFactoryException.java deleted file mode 100644 index fd4d613e34..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingContextFactoryException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.config.ConfigurationException; - -/** - * - * @version $Rev$ $Date$ - */ -public class MissingContextFactoryException extends ConfigurationException { - private static final long serialVersionUID = 5140433835245354247L; - - public MissingContextFactoryException() { - } - - public MissingContextFactoryException(String message) { - super(message); - } - - public MissingContextFactoryException(String message, Throwable cause) { - super(message, cause); - } - - public MissingContextFactoryException(Throwable cause) { - super(cause); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingImplementationException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingImplementationException.java deleted file mode 100644 index 787e9cae20..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingImplementationException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.config.ConfigurationException; - -/** - * - * @version $Rev$ $Date$ - */ -public class MissingImplementationException extends ConfigurationException { - private static final long serialVersionUID = 7274481740916067128L; - - public MissingImplementationException() { - } - - public MissingImplementationException(String message) { - super(message); - } - - public MissingImplementationException(String message, Throwable cause) { - super(message, cause); - } - - public MissingImplementationException(Throwable cause) { - super(cause); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingScopeException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingScopeException.java deleted file mode 100644 index 53108e6e6b..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingScopeException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.config.ConfigurationException; - -/** - * - * @version $Rev$ $Date$ - */ -public class MissingScopeException extends ConfigurationException { - private static final long serialVersionUID = -6999184494724096056L; - - public MissingScopeException() { - } - - public MissingScopeException(String message) { - super(message); - } - - public MissingScopeException(String message, Throwable cause) { - super(message, cause); - } - - public MissingScopeException(Throwable cause) { - super(cause); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ProxyConfigurationException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ProxyConfigurationException.java deleted file mode 100644 index 2d15118c1c..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ProxyConfigurationException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.config.ConfigurationException; - -/** - * - * @version $Rev$ $Date$ - */ -public class ProxyConfigurationException extends ConfigurationException { - private static final long serialVersionUID = -5860342620108741058L; - - public ProxyConfigurationException() { - } - - public ProxyConfigurationException(String message) { - super(message); - } - - public ProxyConfigurationException(String message, Throwable cause) { - super(message, cause); - } - - public ProxyConfigurationException(Throwable cause) { - super(cause); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/QualifiedName.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/QualifiedName.java deleted file mode 100644 index a9a0baeff9..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/QualifiedName.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * An evaluated name consisting of a part/port pair. In the runtime, a part generally 'contains' or 'provides' ports - * such as a module component/entry point or a component/service pair. - * - * @version $Rev$ $Date$ - */ -public class QualifiedName { - - private String qName; - - private String partName; - - private String portName; - - public static final String NAME_SEPARATOR = "/"; - - /** - * Constructs a new qualified name in the form of part/port where part is the parent context and port represents a - * child, which is either a service in the case of an atomic context or a contained context in the case of a composite. - * - * @throws InvalidNameException if the name is in an invalid format - */ - public QualifiedName(String qualifiedName) throws InvalidNameException { - if (qualifiedName == null){ - return; - } - int pos = qualifiedName.indexOf(QualifiedName.NAME_SEPARATOR); - switch (pos) { - case -1: - partName = qualifiedName; - break; - case 0: - throw new InvalidNameException(qualifiedName); - default: - partName = qualifiedName.substring(0, pos); - portName = qualifiedName.substring(pos + 1); - break; - } - qName = qualifiedName; - } - - /** - * Returns the parsed part name - */ - public String getPartName() { - return partName; - } - - /** - * Returns the parsed port name if the original is of the compound for part/port - */ - public String getPortName() { - return portName; - } - - /** - * Returns the full part/port name pair - */ - public String getQualifiedName() { - return qName; - } - - public String toString() { - return qName; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/RuntimeEventListener.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/RuntimeEventListener.java deleted file mode 100644 index 89cc51f3fc..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/RuntimeEventListener.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.context.event.Event; - -import java.util.EventListener; -import java.util.EventObject; - -/** - * Listeners observe events fired in the SCA runtime. - * - * @version $Rev$ $Date$ - */ -public interface RuntimeEventListener extends EventListener { - - public void onEvent(Event event); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeAwareContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeAwareContext.java deleted file mode 100644 index d57d59cb58..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeAwareContext.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.model.assembly.Scope; - -import java.util.Map; - -/** - * Denotes a composite context that supports scopes - * - * @version $Rev$ $Date$ - */ -public interface ScopeAwareContext extends CompositeContext { - - /** - * Returns an immutable collection of scopes keyed by type for the composite context - */ - public Map<Scope, ScopeContext> getScopeContexts(); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeContext.java deleted file mode 100644 index c582bde2b4..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeContext.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.builder.ContextFactory; - -import java.util.List; - -/** - * Manages the lifecycle and visibility of <code>Context</code>s. - * - * @see org.apache.tuscany.core.context.Context - * - * @version $Rev$ $Date$ - */ -public interface ScopeContext extends Lifecycle, RuntimeEventListener { - - public Object getInstance(QualifiedName qName) throws TargetException; - - /** - * Returns whether implementation instances may be held for the duration of an wire - */ - public boolean isCacheable(); - - /** - * Registers the context factory used to construct instance contexts for the scope - */ - public void registerFactories(List<ContextFactory<Context>> configurations); - - /** - * Adds a context factory to the scope - */ - public void registerFactory(ContextFactory<Context> configuration); - - /** - * Returns a context bound to the given name or null if the component does not exist. The returned context is bound - * to a key determined from the thread context. - */ - public Context getContext(String name); - - /** - * Returns a context bound to the given name and scoped to the given key or null if the context does not exist - */ - public Context getContextByKey(String name, Object key); - - /** - * Removes a context with the given name, determining the scope key from the thread context - * - * @throws ScopeRuntimeException - */ - public void removeContext(String name) throws ScopeRuntimeException; - - /** - * Removes a context bound to the given name and scope key - * - * @throws ScopeRuntimeException - */ - public void removeContextByKey(String name, Object key) throws ScopeRuntimeException; - -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeIdentifier.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeIdentifier.java deleted file mode 100644 index d25477f71c..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeIdentifier.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * Implementations enable lazy retrieval of a scope id associated with a request, i.e. an id (and presumably a context) do not - * have to be generated if the scope is never accessed. Identifiers are associated with the current request thread and keyed on - * scope type. - * - * @version $Rev$ $Date$ - * @see org.apache.tuscany.core.context.EventContext - */ -public interface ScopeIdentifier { - - /** - * Returns the scope id for the request. - */ - public Object getIdentifier(); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeInitializationException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeInitializationException.java deleted file mode 100644 index 6ef5bfe9dd..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeInitializationException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * Denotes an initialization exception thrown by a scope container - * - * @version $Rev$ $Date$ - */ -public class ScopeInitializationException extends ScopeRuntimeException { - - public ScopeInitializationException() { - super(); - } - - public ScopeInitializationException(String message) { - super(message); - } - - public ScopeInitializationException(String message, Throwable cause) { - super(message, cause); - } - - public ScopeInitializationException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeRuntimeException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeRuntimeException.java deleted file mode 100644 index 5022f7589d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeRuntimeException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * Denotes a general runtime exception encountered by a scope container - * - * @version $Rev$ $Date$ - */ -public class ScopeRuntimeException extends CoreRuntimeException { - - public ScopeRuntimeException() { - super(); - } - - public ScopeRuntimeException(String message) { - super(message); - } - - public ScopeRuntimeException(String message, Throwable cause) { - super(message, cause); - } - - public ScopeRuntimeException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeStrategy.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeStrategy.java deleted file mode 100644 index c01df8ff9e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.model.assembly.Scope; - -import java.util.Map; - -/** - * Implementations provide scope container creation facilities and scope semantics to the runtime - * - * @version $Rev$ $Date$ - */ -public interface ScopeStrategy { - - /* Denotes an undefined scope */ - public static final int SCOPE_NOT_FOUND = -3; - - /** - * Creates and returns new instances of configured scope containers - */ - public Map<Scope, ScopeContext> getScopeContexts(EventContext eventContext); - - /** - * Determines whether a wire proceeds from a source of higher scope to a target of lesser scope - */ - public boolean downScopeReference(Scope sourceScope, Scope targetScope); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ServiceNotFoundException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ServiceNotFoundException.java deleted file mode 100644 index ee8c9f91b8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/ServiceNotFoundException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.osoa.sca.ServiceRuntimeException; - -/** - * Denotes the specific case where a service was not found at runtime - * - * @version $Rev$ $Date$ - */ -public class ServiceNotFoundException extends ServiceRuntimeException { - - public ServiceNotFoundException() { - super(); - } - - public ServiceNotFoundException(String message) { - super(message); - } - - public ServiceNotFoundException(Throwable cause) { - super(cause); - } - - public ServiceNotFoundException(String message, Throwable cause) { - super(message, cause); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/SystemCompositeContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/SystemCompositeContext.java deleted file mode 100644 index 7e3b4b8045..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/SystemCompositeContext.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -import org.apache.tuscany.core.config.ConfigurationException; - -/** - * Marker type for system composite contexts - * - * @version $Rev$ $Date$ - */ -public interface SystemCompositeContext extends AutowireContext, ScopeAwareContext, ConfigurationContext { - - /** - * Register a simple Java Object as a system component. - * This is primarily intended for use by bootstrap code to create the initial - * configuration components. - * - * @param name the name of the resulting component - * @param service - * @param instance the Object that will become the component's implementation - * @throws ConfigurationException - */ - void registerJavaObject(String name, Class<?> service, Object instance) throws ConfigurationException; -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/TargetException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/TargetException.java deleted file mode 100644 index dd39d06aa1..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/TargetException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context; - -/** - * Denotes an error while performing an operation on a target component implementation instance or proxy - * - * @version $Rev$ $Date$ - */ -public class TargetException extends CoreRuntimeException { - - public TargetException() { - super(); - } - - public TargetException(String message) { - super(message); - } - - public TargetException(String message, Throwable cause) { - super(message, cause); - } - - public TargetException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java deleted file mode 100644 index cef0c25a63..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * A basic implementation of a runtime event - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class AbstractEvent implements Event{ - - protected transient Object source; - - public AbstractEvent(Object source) { - assert (source !=null): "Source id was null"; - this.source = source; - } - - public Object getSource() { - return source; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java deleted file mode 100644 index c038f141b5..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Base implementation of a request event - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class AbstractRequestEvent extends AbstractEvent implements RequestEvent { - - private Object id; - - /** - * Creates a new event - * @param source the source of the event - * @param id the id of the request associated with the event - */ - public AbstractRequestEvent(Object source, Object id) { - super(source); - assert (id !=null): "Request id was null"; - this.id = id; - } - - public Object getId(){ - return id; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java deleted file mode 100644 index 5b370b8c73..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Represents an event that is propagated in the runtime - * - * @version $$Rev$$ $$Date$$ - */ -public interface Event { - - /** - * Returns the source of the event - */ - public Object getSource(); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBound.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBound.java deleted file mode 100644 index 8af7042ad3..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBound.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - - -/** - * An event propagated when an HTTP session is bound to the current request - * - * @version $$Rev$$ $$Date$$ - */ -public class HttpSessionBound extends HttpSessionEvent implements SessionBound { - - /** - * Creates a new event - * @param source the source of the event - * @param id the id of the HTTP session associated with the event or possibly a lazy wrapper - */ - public HttpSessionBound(Object source, Object id) { - super(source,id); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEnd.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEnd.java deleted file mode 100644 index 3b2aff1353..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEnd.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Propagated when an HTTP-based session is expired - * - * @version $$Rev$$ $$Date$$ - */ -public class HttpSessionEnd extends HttpSessionEvent implements SessionEnd { - - /** - * Creates a new event - * @param source the source of the event - * @param id the id of the HTTP session being ended - */ - public HttpSessionEnd(Object source, Object id) { - super(source,id); - } - - } diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java deleted file mode 100644 index ecfbefa808..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * A base implementation of HTTP-based session events in the runtime - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class HttpSessionEvent implements SessionEvent { - - // FIXME this needs to be made private and not directly referenced in the runtime - public static final Object HTTP_IDENTIFIER = new Object(); - - private Object id; - protected transient Object source; - - public HttpSessionEvent(Object source, Object id) { - assert (source !=null): "Source id was null"; - assert (id !=null): "Session id was null"; - this.source = source; - this.id = id; - } - - public Object getSource() { - return source; - } - - public Object getId(){ - return id; - } - - public Object getSessionTypeIdentifier(){ - return HTTP_IDENTIFIER; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreated.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreated.java deleted file mode 100644 index d157b4b1e1..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreated.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * An event propagated upon the creation of an instance belonging to a {@link org.apache.tuscany.core.context.Context} - * - * @version $$Rev$$ $$Date$$ - */ -public class InstanceCreated extends AbstractEvent { - - public InstanceCreated(Object source) { - super(source); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java deleted file mode 100644 index 48de538048..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Implemented by runtime events associated with a module, e.g. lifecycle events - * - * @version $$Rev$$ $$Date$$ - */ -public interface ModuleEvent extends Event{ - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStart.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStart.java deleted file mode 100644 index d953ddd65f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStart.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Propagated when a module starts - * - * @version $$Rev$$ $$Date$$ - */ -public class ModuleStart extends AbstractEvent implements ModuleEvent { - - public ModuleStart(Object source) { - super(source); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStop.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStop.java deleted file mode 100644 index fb3c31bdff..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStop.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Propagated when a module stops - * - * @version $$Rev$$ $$Date$$ - */ -public class ModuleStop extends AbstractEvent implements ModuleEvent{ - - public ModuleStop(Object source) { - super(source); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEnd.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEnd.java deleted file mode 100644 index 1cbe024be3..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEnd.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Propagated when a request completes or is ended - * - * @version $$Rev$$ $$Date$$ - */ -public class RequestEnd extends AbstractRequestEvent{ - - /** - * Creates a new event - * @param source the source of the event - * @param id the id of the completed/ended request - */ - public RequestEnd(Object source, Object id) { - super(source,id); - } - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java deleted file mode 100644 index 0b7e1b8005..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */package org.apache.tuscany.core.context.event; - -/** - * Implemented by runtime events associated request - * @version $$Rev$$ $$Date$$ - */ -public interface RequestEvent { - - /** - * Returns the id of the request the event is associated with - */ - public Object getId(); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStart.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStart.java deleted file mode 100644 index 8c07a3d607..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStart.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Propagated when a request is started in the runtime - * - * @version $$Rev$$ $$Date$$ - */ -public class RequestStart extends AbstractRequestEvent { - - /** - * Creates a new event - * @param source the source of the event - * @param id the id of the request being started - */ - public RequestStart(Object source, Object id) { - super(source,id); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBound.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBound.java deleted file mode 100644 index 5d977911be..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBound.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Propagated when a generic session is associated with the current request. - * - * @version $$Rev$$ $$Date$$ - */ -public interface SessionBound extends SessionEvent { - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEnd.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEnd.java deleted file mode 100644 index 809d63bd0f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEnd.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Propagated when a session ended or expired - * - * @version $$Rev$$ $$Date$$ - */ -public interface SessionEnd extends SessionEvent{ - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java deleted file mode 100644 index 7eaff1de24..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Implemented by runtime events associated with a session. There may be multiple session types in the runtime such as - * HTTP-based or conversational. - * - * @version $$Rev$$ $$Date$$ - */ -public interface SessionEvent extends Event { - - /** - * Returns the unique key identifying the session type the event is associated with, e.g. an HTTP-based or conversational - * session - */ - public Object getSessionTypeIdentifier(); - - /** - * Returns the session id associated with the event - */ - public Object getId(); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionStart.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionStart.java deleted file mode 100644 index cfe490e2ff..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionStart.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.event; - -/** - * Propagated when a session starts - * - * @version $$Rev$$ $$Date$$ - */ -public interface SessionStart extends SessionEvent{ - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/filter/TrueFilter.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/filter/TrueFilter.java deleted file mode 100644 index 35601646f2..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/filter/TrueFilter.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.filter; - -import org.apache.tuscany.core.context.EventFilter; -import org.apache.tuscany.core.context.event.Event; - -/** - * An event filter that always returns a true condition - * - * @version $$Rev$$ $$Date$$ - */ -public class TrueFilter implements EventFilter { - - public boolean match(Event event) { - return true; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java deleted file mode 100644 index c9e563302c..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java +++ /dev/null @@ -1,852 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import org.apache.tuscany.common.TuscanyRuntimeException; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.context.AutowireResolutionException; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.ConfigurationContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.ContextInitException; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.DuplicateNameException; -import org.apache.tuscany.core.context.EntryPointContext; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.EventException; -import org.apache.tuscany.core.context.Lifecycle; -import org.apache.tuscany.core.context.MissingContextFactoryException; -import org.apache.tuscany.core.context.MissingImplementationException; -import org.apache.tuscany.core.context.MissingScopeException; -import org.apache.tuscany.core.context.ProxyConfigurationException; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeAwareContext; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.ScopeStrategy; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.context.event.Event; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.context.event.SessionBound; -import org.apache.tuscany.core.context.event.SessionEvent; -import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.system.annotation.ParentContext; -import org.apache.tuscany.core.system.assembly.SystemBinding; -import org.apache.tuscany.core.wire.InvocationConfiguration; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.WireConfiguration; -import org.apache.tuscany.core.wire.WireFactory; -import org.apache.tuscany.core.wire.WireFactoryInitException; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.Composite; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Extensible; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; - -/** - * The base implementation of a composite context - * - * @version $Rev$ $Date$ - */ -@SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized", "RawUseOfParameterizedType", "NonPrivateFieldAccessedInSynchronizedContext"}) -public abstract class AbstractCompositeContext extends AbstractContext implements AutowireContext, ScopeAwareContext, ConfigurationContext { - - public static final int DEFAULT_WAIT = 1000 * 60; - - protected AssemblyContext assemblyContext; - - protected CompositeContext parentContext; - - // The parent configuration context, if one exists - @Autowire - protected ConfigurationContext configurationContext; - - // The logical model representing the module assembly - // protected ModuleComponent moduleComponent; - protected Module module; - - protected Map<String, ContextFactory<Context>> configurations = new HashMap<String, ContextFactory<Context>>(); - - // Factory for scope contexts - protected ScopeStrategy scopeStrategy; - - // The event context for associating context events to threads - protected EventContext eventContext; - - // The scopes for this context - protected Map<Scope, ScopeContext> scopeContexts; - - protected Map<Scope, ScopeContext> immutableScopeContexts; - - // A component context name to scope context index - protected Map<String, ScopeContext> scopeIndex; - - // Blocking latch to ensure the module is initialized exactly once prior to servicing requests - protected CountDownLatch initializeLatch = new CountDownLatch(1); - - protected final Object lock = new Object(); - - // Indicates whether the module context has been initialized - protected boolean initialized; - - // a mapping of service type to component name - private final Map<Class, NameToScope> autowireInternal = new ConcurrentHashMap<Class, NameToScope>(); - private final Map<Class, NameToScope> autowireExternal = new ConcurrentHashMap<Class, NameToScope>(); - - private AutowireContext autowireContext; - - public AbstractCompositeContext() { - scopeIndex = new ConcurrentHashMap<String, ScopeContext>(); - // FIXME the factory should be injected - module = new AssemblyFactoryImpl().createModule(); - scopeStrategy = new DefaultScopeStrategy(); - } - - public AbstractCompositeContext(String name, CompositeContext parent, ScopeStrategy strategy, EventContext ctx, ConfigurationContext configCtx) { - super(name); - if (strategy == null) { - strategy = new DefaultScopeStrategy(); - } - this.scopeStrategy = strategy; - this.eventContext = ctx; - this.configurationContext = configCtx; - scopeIndex = new ConcurrentHashMap<String, ScopeContext>(); - parentContext = parent; - // FIXME the factory should be injected - module = new AssemblyFactoryImpl().createModule(); - } - - public void setAssemblyContext(AssemblyContext assemblyContext) { - this.assemblyContext = assemblyContext; - } - - private String uri; - - public String getURI() { - return uri; - } - - public void setURI(String uri) { - this.uri = uri; - } - - - public void start() { - synchronized (lock) { - try { - if (lifecycleState == STOPPED) { - throw new IllegalStateException("Context cannot be restarted - create a new one"); - } else if (lifecycleState != UNINITIALIZED) { - throw new IllegalStateException("Context not in UNINITIALIZED state"); - } - - lifecycleState = INITIALIZING; - initializeScopes(); - - Map<Scope, List<ContextFactory<Context>>> configurationsByScope = new EnumMap<Scope, List<ContextFactory<Context>>>(Scope.class); - if (configurations != null) { - for (ContextFactory<Context> contextFactory : configurations.values()) { - // FIXME scopes are defined at the interface level - Scope sourceScope = contextFactory.getScope(); - wireSource(contextFactory); - buildTarget(contextFactory); - scopeIndex.put(contextFactory.getName(), scopeContexts.get(sourceScope)); - List<ContextFactory<Context>> list = configurationsByScope.get(sourceScope); - if (list == null) { - list = new ArrayList<ContextFactory<Context>>(); - configurationsByScope.put(sourceScope, list); - } - list.add(contextFactory); - } - } - for (EntryPoint ep : module.getEntryPoints()) { - registerAutowire(ep); - } - for (Component component : module.getComponents()) { - if (component instanceof ModuleComponent) { - registerAutowire((ModuleComponent) component); - } else { - registerAutowire(component); - } - } - for (ExternalService es : module.getExternalServices()) { - registerAutowire(es); - } - for (Map.Entry<Scope, List<ContextFactory<Context>>> entries : configurationsByScope.entrySet()) - { - // register configurations with scope contexts - ScopeContext scope = scopeContexts.get(entries.getKey()); - scope.registerFactories(entries.getValue()); - } - initializeWireFactories(); - for (ScopeContext scope : scopeContexts.values()) { - // register scope contexts as a listeners for events in the composite context - addListener(scope); - scope.start(); - } - lifecycleState = RUNNING; - } catch (WireFactoryInitException e) { - lifecycleState = ERROR; - ContextInitException cie = new ContextInitException(e); - cie.addContextName(getName()); - throw cie; - } catch (CoreRuntimeException e) { - lifecycleState = ERROR; - e.addContextName(getName()); - throw e; - } finally { - initialized = true; - // release the latch and allow requests to be processed - initializeLatch.countDown(); - } - } - } - - public void stop() { - if (lifecycleState == STOPPED) { - return; - } - // need to block a start until reset is complete - initializeLatch = new CountDownLatch(1); //xcv - lifecycleState = STOPPING; - initialized = false; - if (scopeContexts != null) { - for (ScopeContext scopeContext : scopeContexts.values()) { - if (scopeContext.getLifecycleState() == Lifecycle.RUNNING) { - scopeContext.stop(); - } - } - } - scopeContexts = null; - scopeIndex.clear(); - // allow initialized to be called - initializeLatch.countDown(); - lifecycleState = STOPPED; - - } - - public void setModule(Module module) { - assert (module != null) : "Module cannot be null"; - name = module.getName(); - this.module = module; - } - - public void setEventContext(EventContext eventContext) { - this.eventContext = eventContext; - } - - public void setConfigurationContext(ConfigurationContext context) { - this.configurationContext = context; - } - - public CompositeContext getParent() { - return parentContext; - } - - @ParentContext - public void setParent(CompositeContext parent) { - parentContext = parent; - } - - public void registerModelObjects(List<? extends Extensible> models) throws ConfigurationException { - assert (models != null) : "Model object collection was null"; - for (Extensible model : models) { - registerModelObject(model); - } - } - - public void registerModelObject(Extensible model) throws ConfigurationException { - assert (model != null) : "Model object was null"; - initializeScopes(); - if (configurationContext != null) { - try { - configurationContext.build(model); - } catch (BuilderConfigException e) { - e.addContextName(getName()); - throw e; - } - } - ContextFactory<Context> configuration; - if (model instanceof Module) { - // merge new module definition with the existing one - Module oldModule = module; - Module newModule = (Module) model; - module = newModule; - for (Component component : newModule.getComponents()) { - Implementation componentImplementation = component.getImplementation(); - if (componentImplementation == null) { - ConfigurationException e = new MissingImplementationException("Component implementation not set"); - e.addContextName(component.getName()); - e.addContextName(getName()); - throw e; - } - configuration = (ContextFactory<Context>) component.getContextFactory(); - if (configuration == null) { - ConfigurationException e = new MissingContextFactoryException("Context factory not set"); - e.addContextName(component.getName()); - e.addContextName(getName()); - throw e; - } - registerConfiguration(configuration); - if (component instanceof ModuleComponent) { - registerAutowire((ModuleComponent) component); - } else { - registerAutowire(component); - } - } - for (EntryPoint ep : newModule.getEntryPoints()) { - configuration = (ContextFactory<Context>) ep.getContextFactory(); - if (configuration == null) { - ConfigurationException e = new MissingContextFactoryException("Context factory not set"); - e.setIdentifier(ep.getName()); - e.addContextName(getName()); - throw e; - } - registerConfiguration(configuration); - registerAutowire(ep); - } - for (ExternalService service : newModule.getExternalServices()) { - configuration = (ContextFactory<Context>) service.getContextFactory(); - if (configuration == null) { - ConfigurationException e = new MissingContextFactoryException("Context factory not set"); - e.setIdentifier(service.getName()); - e.addContextName(getName()); - throw e; - } - registerConfiguration(configuration); - registerAutowire(service); - } - if (lifecycleState == RUNNING) { - for (Component component : newModule.getComponents()) { - ContextFactory<Context> contextFactory = (ContextFactory<Context>) component.getContextFactory(); - wireSource(contextFactory); - buildTarget(contextFactory); - contextFactory.prepare(this); - try { - if (contextFactory.getSourceWireFactories() != null) { - for (SourceWireFactory sourceWireFactory : contextFactory.getSourceWireFactories()) - { - sourceWireFactory.initialize(); - } - } - if (contextFactory.getTargetWireFactories() != null) { - for (TargetWireFactory targetWireFactory : contextFactory.getTargetWireFactories() - .values()) { - targetWireFactory.initialize(); - } - } - } catch (WireFactoryInitException e) { - ProxyConfigurationException ce = new ProxyConfigurationException(e); - ce.addContextName(getName()); - throw ce; - } - - } - for (EntryPoint ep : newModule.getEntryPoints()) { - ContextFactory<Context> contextFactory = (ContextFactory<Context>) ep.getContextFactory(); - wireSource(contextFactory); - buildTarget(contextFactory); - contextFactory.prepare(this); - try { - if (contextFactory.getSourceWireFactories() != null) { - for (SourceWireFactory sourceWireFactory : contextFactory.getSourceWireFactories()) - { - sourceWireFactory.initialize(); - } - } - if (contextFactory.getTargetWireFactories() != null) { - for (TargetWireFactory targetWireFactory : contextFactory.getTargetWireFactories() - .values()) { - targetWireFactory.initialize(); - } - } - } catch (WireFactoryInitException e) { - ProxyConfigurationException ce = new ProxyConfigurationException(e); - ce.addContextName(getName()); - throw ce; - } - - } - for (ExternalService es : newModule.getExternalServices()) { - ContextFactory<Context> contextFactory = (ContextFactory<Context>) es.getContextFactory(); - wireSource(contextFactory); - buildTarget(contextFactory); - contextFactory.prepare(this); - try { - if (contextFactory.getSourceWireFactories() != null) { - for (SourceWireFactory sourceWireFactory : contextFactory.getSourceWireFactories()) - { - sourceWireFactory.initialize(); - } - } - if (contextFactory.getTargetWireFactories() != null) { - for (WireFactory targetWireFactory : contextFactory.getTargetWireFactories() - .values()) { - targetWireFactory.initialize(); - } - } - } catch (WireFactoryInitException e) { - ProxyConfigurationException ce = new ProxyConfigurationException(e); - ce.addContextName(getName()); - throw ce; - } - - } - - } - // merge existing module component assets - module.getComponents().addAll(oldModule.getComponents()); - module.getEntryPoints().addAll(oldModule.getEntryPoints()); - module.getExternalServices().addAll(oldModule.getExternalServices()); - } else { - if (model instanceof Component) { - Component component = (Component) model; - module.getComponents().add(component); - configuration = (ContextFactory<Context>) component.getContextFactory(); - if (configuration == null) { - ConfigurationException e = new MissingContextFactoryException("Context factory not set"); - e.setIdentifier(component.getName()); - e.addContextName(getName()); - throw e; - } - registerConfiguration(configuration); - if (component instanceof ModuleComponent) { - registerAutowire((ModuleComponent) component); - } else { - registerAutowire(component); - } - } else if (model instanceof EntryPoint) { - EntryPoint ep = (EntryPoint) model; - module.getEntryPoints().add(ep); - configuration = (ContextFactory<Context>) ep.getContextFactory(); - if (configuration == null) { - ConfigurationException e = new MissingContextFactoryException("Context factory not set"); - e.setIdentifier(ep.getName()); - e.addContextName(getName()); - throw e; - } - registerConfiguration(configuration); - registerAutowire(ep); - } else if (model instanceof ExternalService) { - ExternalService service = (ExternalService) model; - module.getExternalServices().add(service); - configuration = (ContextFactory<Context>) service.getContextFactory(); - if (configuration == null) { - ConfigurationException e = new MissingContextFactoryException("Context factory not set"); - e.setIdentifier(service.getName()); - e.addContextName(getName()); - throw e; - } - registerConfiguration(configuration); - registerAutowire(service); - } else { - BuilderConfigException e = new BuilderConfigException("Unknown model type"); - e.setIdentifier(model.getClass().getName()); - e.addContextName(getName()); - throw e; - } - } - } - - protected void registerConfiguration(ContextFactory<Context> factory) throws ConfigurationException { - factory.prepare(this); - if (lifecycleState == RUNNING) { - if (scopeIndex.get(factory.getName()) != null) { - throw new DuplicateNameException(factory.getName()); - } - try { - ScopeContext scope = scopeContexts.get(factory.getScope()); - if (scope == null) { - ConfigurationException e = new MissingScopeException("Component has an unknown scope"); - e.addContextName(factory.getName()); - e.addContextName(getName()); - throw e; - } - scope.registerFactory(factory); - scopeIndex.put(factory.getName(), scope); - } catch (TuscanyRuntimeException e) { - e.addContextName(getName()); - throw e; - } - configurations.put(factory.getName(), factory); // xcv - } else { - if (configurations.get(factory.getName()) != null) { - throw new DuplicateNameException(factory.getName()); - } - configurations.put(factory.getName(), factory); - } - - } - - public void fireEvent(int eventType, Object message) throws EventException { - throw new UnsupportedOperationException(); - } - - public void publish(Event event) { - checkInit(); - if (event instanceof SessionBound) { - SessionEvent sessionEvent = ((SessionBound) event); - // update context - eventContext.setIdentifier(sessionEvent.getSessionTypeIdentifier(), sessionEvent.getId()); - } else if (event instanceof RequestEnd) { - // be very careful with pooled threads, ensuring threadlocals are cleaned up - eventContext.clearIdentifiers(); - } - super.publish(event); - } - - public Context getContext(String componentName) { - checkInit(); - assert (componentName != null) : "Name was null"; - ScopeContext scope = scopeIndex.get(componentName); - if (scope == null) { - return null; - } - return scope.getContext(componentName); - - } - - public Object getInstance(QualifiedName qName) throws TargetException { - assert (qName != null) : "Name was null "; - // use the port name to get the context since entry points ports - ScopeContext scope = scopeIndex.get(qName.getPortName()); - if (scope == null) { - return null; - } - Context ctx = scope.getContext(qName.getPortName()); - if (!(ctx instanceof EntryPointContext)) { - TargetException e = new TargetException("Target not an entry point"); - e.setIdentifier(qName.getQualifiedName()); - e.addContextName(name); - throw e; - } - return ctx.getInstance(null); - } - - public Map<Scope, ScopeContext> getScopeContexts() { - initializeScopes(); - return immutableScopeContexts; - } - - /** - * Blocks until the module context has been initialized - */ - protected void checkInit() { - if (lifecycleState == STOPPED) { - throw new IllegalStateException("Context cannot be restarted - create a new one"); - } - if (!initialized) { - try { - /* block until the module has initialized */ - boolean success = initializeLatch.await(DEFAULT_WAIT, TimeUnit.MILLISECONDS); - if (!success) { - throw new ContextInitException("Timeout waiting for module context to initialize"); - } - } catch (InterruptedException e) { // should not happen - } - } - - } - - protected void initializeScopes() { - if (scopeContexts == null) { - scopeContexts = scopeStrategy.getScopeContexts(eventContext); - immutableScopeContexts = Collections.unmodifiableMap(scopeContexts); - } - } - - /** - * Iterates through references and delegates to the configuration context to wire them to their targets - */ - protected void wireSource(ContextFactory<Context> source) { - Scope sourceScope = source.getScope(); - if (source.getSourceWireFactories() != null) { - for (SourceWireFactory<?> sourceFactory : source.getSourceWireFactories()) { - WireConfiguration wireConfiguration = sourceFactory.getConfiguration(); - QualifiedName targetName = wireConfiguration.getTargetName(); - ContextFactory<?> target = configurations.get(targetName.getPartName()); - if (target == null) { - ContextInitException e = new ContextInitException("Target not found"); - e.setIdentifier(targetName.getPartName()); - e.addContextName(source.getName()); - e.addContextName(name); - throw e; - } - // get the proxy chain for the target - TargetWireFactory targetFactory = target.getTargetWireFactory(targetName.getPortName()); - if (targetFactory == null) { - ContextInitException e = new ContextInitException("No proxy factory found for service"); - e.setIdentifier(wireConfiguration.getTargetName().getPortName()); - e.addContextName(target.getName()); - e.addContextName(source.getName()); - e.addContextName(name); - throw e; - } - try { - boolean downScope = scopeStrategy.downScopeReference(sourceScope, target.getScope()); - configurationContext.connect(sourceFactory, targetFactory, target.getClass(), downScope, scopeContexts - .get(target.getScope())); - } catch (BuilderConfigException e) { - e.addContextName(target.getName()); - e.addContextName(source.getName()); - e.addContextName(name); - throw e; - } - - } - } - // wire invokers when the proxy only contains the target chain - if (source.getTargetWireFactories() != null) { - for (TargetWireFactory targetFactory : source.getTargetWireFactories().values()) { - try { - configurationContext.completeTargetChain(targetFactory, source.getClass(), scopeContexts.get(sourceScope)); - } catch (BuilderConfigException e) { - e.addContextName(source.getName()); - e.addContextName(name); - throw e; - } - } - } - } - - /** - * Signals to target side of reference configurations to initialize - */ - protected void buildTarget(ContextFactory<?> target) { - Map<String, TargetWireFactory> targetProxyFactories = target.getTargetWireFactories(); - if (targetProxyFactories != null) { - for (TargetWireFactory<?> targetFactory : targetProxyFactories.values()) { - for (InvocationConfiguration iConfig : targetFactory - .getConfiguration().getInvocationConfigurations().values()) { - iConfig.build(); - } - } - } - } - - protected void initializeWireFactories() throws WireFactoryInitException { - for (ContextFactory<?> config : configurations.values()) { - List<SourceWireFactory> sourceProxyFactories = config.getSourceWireFactories(); - if (sourceProxyFactories != null) { - for (WireFactory<?> sourceWireFactory : sourceProxyFactories) { - sourceWireFactory.initialize(); - } - } - if (sourceProxyFactories != null) { - Map<String, TargetWireFactory> targetWireFactories = config.getTargetWireFactories(); - for (TargetWireFactory<?> targetWireFactory : targetWireFactories.values()) { - targetWireFactory.initialize(); - } - } - } - } - - public Composite getComposite() { - return module; - } - - @Autowire - public void setAutowireContext(AutowireContext context) { - autowireContext = context; - } - - public <T> T resolveInstance(Class<T> instanceInterface) throws AutowireResolutionException { - if (ConfigurationContext.class.equals(instanceInterface)) { - return instanceInterface.cast(this); - } else if (AutowireContext.class.equals(instanceInterface)) { - return instanceInterface.cast(this); - } else if (AssemblyContext.class.equals(instanceInterface)) { - return instanceInterface.cast(assemblyContext); - } - - NameToScope nts = autowireInternal.get(instanceInterface); - if (nts != null) { - try { - return instanceInterface.cast(nts.getScopeContext().getInstance(nts.getName())); - } catch (TargetException e) { - AutowireResolutionException ae = new AutowireResolutionException("Autowire instance not found", e); - ae.addContextName(getName()); - throw ae; - } - } else if (autowireContext != null) { - try { - // resolve to parent - return autowireContext.resolveInstance(instanceInterface); - } catch (AutowireResolutionException e) { - e.addContextName(getName()); - throw e; - } - } else { - return null; - } - } - - public <T> T resolveExternalInstance(Class<T> instanceInterface) throws AutowireResolutionException { - NameToScope nts = autowireExternal.get(instanceInterface); - if (nts != null) { - try { - return instanceInterface.cast(nts.getScopeContext().getInstance(nts.getName())); - } catch (TargetException e) { - AutowireResolutionException ae = new AutowireResolutionException("Autowire instance not found", e); - ae.addContextName(getName()); - throw ae; - } - } else { - return null; - } - } - - private void registerAutowire(ExternalService service) { - } - - private void registerAutowire(ModuleComponent component) { - for (EntryPoint ep : component.getImplementation().getEntryPoints()) { - for (Binding binding : ep.getBindings()) { - if (binding instanceof SystemBinding) { - Class interfaze = ep.getConfiguredService().getPort().getServiceContract().getInterface(); - ScopeContext scope = scopeContexts.get(Scope.AGGREGATE); - String qname = component.getName() + QualifiedName.NAME_SEPARATOR + ep.getName(); - registerAutowireInternal(interfaze, qname, scope); - } - } - } - } - - private void registerAutowire(Component component) { - for (Service service : component.getImplementation().getComponentType().getServices()) { - Class interfaze = service.getServiceContract().getInterface(); - ScopeContext scopeCtx = scopeContexts.get(service.getServiceContract().getScope()); - registerAutowireInternal(interfaze, component.getName(), scopeCtx); - } - } - - protected void registerAutowireInternal(Class<?> interfaze, String name, ScopeContext scopeContext) { - assert interfaze != null; - if (autowireInternal.containsKey(interfaze)) { - return; - } - QualifiedName qname = new QualifiedName(name); - NameToScope nts = new NameToScope(qname, scopeContext); - autowireInternal.put(interfaze, nts); - } - - private void registerAutowire(EntryPoint ep) { - for (Binding binding : ep.getBindings()) { - if (binding instanceof SystemBinding) { - Class interfaze = ep.getConfiguredService().getPort().getServiceContract().getInterface(); - ScopeContext scope = scopeContexts.get(((ContextFactory) ep.getContextFactory()).getScope()); - registerAutowireExternal(interfaze, ep.getName(), scope); - } - } - } - - protected void registerAutowireExternal(Class<?> interfaze, String name, ScopeContext scopeContext) { - assert interfaze != null; - if (autowireExternal.containsKey(interfaze)) { - return; - } - QualifiedName qname = new QualifiedName(name); - NameToScope nts = new NameToScope(qname, scopeContext); - autowireExternal.put(interfaze, nts); - } - - protected static class NameToScope { - - private final QualifiedName qName; - - private final ScopeContext scope; - - public NameToScope(QualifiedName name, ScopeContext scope) { - this.qName = name; - this.scope = scope; - } - - public QualifiedName getName() { - return qName; - } - - public ScopeContext getScopeContext() { - return scope; - } - } - - - public void build(AssemblyObject model) throws BuilderConfigException { - if (configurationContext != null) { - try { - configurationContext.build(model); - } catch (BuilderConfigException e) { - e.addContextName(getName()); - throw e; - } - } - } - - public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) throws BuilderConfigException { - if (configurationContext != null) { - try { - configurationContext.connect(sourceFactory, targetFactory, targetType, downScope, targetScopeContext); - } catch (BuilderConfigException e) { - e.addContextName(getName()); - throw e; - } - } - } - - public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) - throws BuilderConfigException { - if (configurationContext != null) { - try { - configurationContext.completeTargetChain(targetFactory, targetType, targetScopeContext); - } catch (BuilderConfigException e) { - e.addContextName(getName()); - throw e; - } - } - } - - - public void removeContext(String name){ - configurations.remove(name); - ScopeContext ctx = scopeIndex.remove(name); - if (ctx != null){ - ctx.removeContext(name); - } - - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractContext.java deleted file mode 100644 index 680267d53e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractContext.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.impl; - -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.RuntimeEventListener; -import org.apache.tuscany.core.context.EventFilter; -import org.apache.tuscany.core.context.event.Event; -import org.apache.tuscany.core.context.filter.TrueFilter; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Functionality common to all <code>Context<code> implementations - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractContext extends AbstractLifecycle implements Context { - - public AbstractContext() { - } - - public AbstractContext(String name) { - super(name); - } - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractLifecycle.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractLifecycle.java deleted file mode 100644 index ddeebe361f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractLifecycle.java +++ /dev/null @@ -1,129 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation or its licensors as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.impl; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.tuscany.core.context.RuntimeEventListener; -import org.apache.tuscany.core.context.EventFilter; -import org.apache.tuscany.core.context.Lifecycle; -import org.apache.tuscany.core.context.filter.TrueFilter; -import org.apache.tuscany.core.context.event.Event; - -/** - * @version $Rev$ $Date$ - */ -public class AbstractLifecycle { - private static final EventFilter TRUE_FILTER = new TrueFilter(); - protected String name; - protected int lifecycleState = Lifecycle.UNINITIALIZED; - // Listeners for context events - private Map<EventFilter, List<RuntimeEventListener>> listeners; - - public AbstractLifecycle(String name) { - this.name = name; - } - - public AbstractLifecycle() { - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getLifecycleState() { - return lifecycleState; - } - - public void addListener(RuntimeEventListener listener) { - addListener(TRUE_FILTER, listener); - } - - public void removeListener(RuntimeEventListener listener) { - assert (listener != null) : "Listener cannot be null"; - synchronized(getListeners()){ - for (List<RuntimeEventListener> currentList :getListeners().values() ) { - for(RuntimeEventListener current : currentList){ - if (current == listener){ - currentList.remove(current); - return; - } - } - } - } - } - - public void addListener(EventFilter filter, RuntimeEventListener listener){ - assert (listener != null) : "Listener cannot be null"; - synchronized (getListeners()){ - List<RuntimeEventListener> list = getListeners().get(filter); - if (list == null){ - list = new CopyOnWriteArrayList<RuntimeEventListener>(); - listeners.put(filter,list); - } - list.add(listener); - } - } - - public void publish(Event event){ - assert(event != null): "Event object was null"; - for(Map.Entry<EventFilter,List<RuntimeEventListener>> entry :getListeners().entrySet()){ - if(entry.getKey().match(event)){ - for(RuntimeEventListener listener : entry.getValue()){ - listener.onEvent(event); - } - } - } - } - - protected Map<EventFilter, List<RuntimeEventListener>> getListeners(){ - if (listeners == null) { - listeners = new ConcurrentHashMap<EventFilter, List<RuntimeEventListener>>(); - } - return listeners; - } - - public String toString() { - switch (lifecycleState) { - case (Lifecycle.CONFIG_ERROR): - return "Context [" + name + "] in state [CONFIG_ERROR]"; - case (Lifecycle.ERROR): - return "Context [" + name + "] in state [ERROR]"; - case (Lifecycle.INITIALIZING): - return "Context [" + name + "] in state [INITIALIZING]"; - case (Lifecycle.INITIALIZED): - return "Context [" + name + "] in state [INITIALIZED]"; - case (Lifecycle.RUNNING): - return "Context [" + name + "] in state [RUNNING]"; - case (Lifecycle.STOPPING): - return "Context [" + name + "] in state [STOPPING]"; - case (Lifecycle.STOPPED): - return "Context [" + name + "] in state [STOPPED]"; - case (Lifecycle.UNINITIALIZED): - return "Context [" + name + "] in state [UNINITIALIZED]"; - default: - return "Context [" + name + "] in state [UNKNOWN]"; - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java deleted file mode 100644 index ec3d1bc9c0..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.impl; - -import org.osoa.sca.ModuleContext; -import org.osoa.sca.RequestContext; -import org.osoa.sca.ServiceReference; -import org.osoa.sca.ServiceUnavailableException; - -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.ConfigurationContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.ScopeStrategy; -import org.apache.tuscany.core.context.ServiceNotFoundException; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.system.annotation.Autowire; - -/** - * The standard implementation of an composite context. Autowiring is performed by delegating to the parent context. - * - * @version $Rev$ $Date$ - */ -public class CompositeContextImpl extends AbstractCompositeContext implements ModuleContext { - - @Autowire - public void setScopeStrategy(ScopeStrategy scopeStrategy) { - if (scopeStrategy != null) { - this.scopeStrategy = scopeStrategy; - } - } - - public CompositeContextImpl() { - super(); - eventContext = new EventContextImpl(); - } - - public CompositeContextImpl(String name, CompositeContext parent, ScopeStrategy strategy, EventContext ctx, - ConfigurationContext configCtx) { - super(name, parent, strategy, ctx, configCtx); - } - - public CompositeContextImpl(String name, CompositeContext parent, AutowireContext autowireContext, ScopeStrategy strategy, - EventContext ctx, ConfigurationContext configCtx) { - super(name, parent, strategy, ctx, configCtx); - setAutowireContext(autowireContext); - } - - // ---------------------------------- - // ModuleContext methods - // ---------------------------------- - - public Object locateService(String qualifiedName) throws ServiceUnavailableException { - checkInit(); - QualifiedName qName = new QualifiedName(qualifiedName); - ScopeContext scope = scopeIndex.get(qName.getPartName()); - if (scope == null) { - throw new ServiceNotFoundException(qualifiedName); - } - Context ctx = scope.getContext(qName.getPartName()); - try { - Object o = ctx.getInstance(qName); - if (o == null) { - throw new ServiceNotFoundException(qualifiedName); - } - return o; - } catch (TargetException e) { - e.addContextName(getName()); - throw new ServiceNotFoundException(e); - } - } - - public ServiceReference createServiceReference(String serviceName) { - throw new UnsupportedOperationException(); - } - - public RequestContext getRequestContext() { - throw new UnsupportedOperationException(); - } - - public ServiceReference createServiceReferenceForSession(Object self) { - throw new UnsupportedOperationException(); - } - - public ServiceReference createServiceReferenceForSession(Object self, String serviceName) { - throw new UnsupportedOperationException(); - } - - public ServiceReference newSession(String serviceName) { - throw new UnsupportedOperationException(); - } - - public ServiceReference newSession(String serviceName, Object sessionId) { - throw new UnsupportedOperationException(); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EntryPointContextImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EntryPointContextImpl.java deleted file mode 100644 index d1ad7a5548..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EntryPointContextImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.impl; - -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.context.EntryPointContext; -import org.apache.tuscany.core.context.ContextInitException; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.wire.jdk.JDKInvocationHandler; -import org.apache.tuscany.core.wire.ProxyCreationException; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.message.MessageFactory; - -import java.lang.reflect.InvocationHandler; - -/** - * The default implementation of an entry point context - * - * @version $Rev$ $Date$ - */ -public class EntryPointContextImpl extends AbstractContext implements EntryPointContext { - - private SourceWireFactory<?> sourceWireFactory; - - - private InvocationHandler invocationHandler; - - // a proxy implementing the service exposed by the entry point backed by the invocation handler - private Object proxy; - - /** - * Creates a new entry point - * - * @param name the entry point name - * @param sourceWireFactory the proxy factory containing the invocation chains for the entry point - * @param messageFactory a factory for generating invocation messages - * @throws ContextInitException if an error occurs creating the entry point - */ - public EntryPointContextImpl(String name, SourceWireFactory sourceWireFactory, MessageFactory messageFactory) - throws ContextInitException { - super(name); - assert (sourceWireFactory != null) : "Proxy factory was null"; - assert (messageFactory != null) : "Message factory was null"; - this.sourceWireFactory = sourceWireFactory; - invocationHandler = new JDKInvocationHandler(messageFactory, sourceWireFactory.getConfiguration() - .getInvocationConfigurations()); - } - - public Object getInstance(QualifiedName qName) throws TargetException { - if (proxy == null) { - try { - proxy = sourceWireFactory.createProxy(); - } catch (ProxyCreationException e) { - TargetException te = new TargetException(e); - te.addContextName(getName()); - throw te; - } - } - return proxy; - } - - public void start() throws ContextInitException { - lifecycleState = RUNNING; - } - - public void stop() throws CoreRuntimeException { - lifecycleState = STOPPED; - } - - public Object getHandler() throws TargetException { - return invocationHandler; - } - - public Class getServiceInterface() { - return sourceWireFactory.getBusinessInterface(); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java deleted file mode 100644 index 6888e66f20..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.impl; - -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.ScopeIdentifier; - -import java.util.HashMap; -import java.util.Map; - -/** - * An implementation of an {@link org.apache.tuscany.core.context.EventContext} that handles event-to-thread associations using an - * <code>InheritableThreadLocal</code> - * - * @version $Rev$ $Date$ - */ -public class EventContextImpl implements EventContext { - - // @TODO design a proper propagation strategy for creating new threads - /* - * a map ( associated with the current thread) of scope identifiers keyed on the event context id type. the scope identifier - * may be a {@link ScopeIdentifier} or an opaque id - */ - private ThreadLocal<Map> eventContext = new InheritableThreadLocal<Map>(); - - public Object getIdentifier(Object type) { - Map map = eventContext.get(); - if (map == null) { - return null; - } - Object currentId = map.get(type); - if (currentId instanceof ScopeIdentifier) { - currentId = ((ScopeIdentifier) currentId).getIdentifier(); - // once we have accessed the id, replace the lazy wrapper - map.put(type, currentId); - } - return currentId; - } - - public void setIdentifier(Object type, Object identifier) { - Map map = eventContext.get(); - if (map == null) { - map = new HashMap(); - eventContext.set(map); - } - map.put(type, identifier); - } - - public void clearIdentifier(Object type) { - if (type == null) { - return; - } - Map map = eventContext.get(); - if (map != null) { - map.remove(type); - } - } - - public void clearIdentifiers() { - eventContext.remove(); - } - - public EventContextImpl() { - super(); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/ExternalServiceContextImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/ExternalServiceContextImpl.java deleted file mode 100644 index 0ab44fa8fc..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/ExternalServiceContextImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.impl; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.ExternalServiceContext; -import org.apache.tuscany.core.wire.ProxyCreationException; -import org.apache.tuscany.core.wire.TargetWireFactory; - -/** - * The default implementation of an external service context - * - * @version $Rev$ $Date$ - */ -public class ExternalServiceContextImpl extends AbstractContext implements ExternalServiceContext { - - private TargetWireFactory<?> targetWireFactory; - - private ObjectFactory targetInstanceFactory; - - /** - * Creates an external service context - * - * @param name the name of the external service - * @param targetWireFactory the factory which creates proxies implementing the configured service interface for the - * external service. There is always only one proxy factory as an external service is configured with one - * service - * @param targetInstanceFactory the object factory that creates an artifact capabile of communicating over the - * binding transport configured on the external service. The object factory may implement a caching strategy. - */ - public ExternalServiceContextImpl(String name, TargetWireFactory targetWireFactory, ObjectFactory targetInstanceFactory) { - super(name); - assert (targetInstanceFactory != null) : "Target instance factory was null"; - this.targetWireFactory = targetWireFactory; - this.targetInstanceFactory = targetInstanceFactory; - } - - public void start() throws CoreRuntimeException { - lifecycleState = RUNNING; - } - - public void stop() throws CoreRuntimeException { - lifecycleState = STOPPED; - } - - - public Object getInstance(QualifiedName qName) throws TargetException { - try { - return targetWireFactory.createProxy(); - // TODO do we cache the proxy, (assumes stateful capabilities will be provided in an interceptor) - } catch (ProxyCreationException e) { - TargetException te = new TargetException(e); - te.addContextName(getName()); - throw te; - } - } - - public Object getHandler() throws TargetException { - return targetInstanceFactory.getInstance(); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeContext.java deleted file mode 100644 index 7eed472101..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeContext.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.scope; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.EventContext; -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.context.impl.AbstractLifecycle; - -/** - * Implements functionality common to scope contexts. - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractScopeContext extends AbstractLifecycle implements ScopeContext { - - // The collection of runtime configurations for the scope - protected Map<String, ContextFactory<Context>> contextFactories = new ConcurrentHashMap<String, ContextFactory<Context>>(); - - // The event context the scope container is associated with - protected EventContext eventContext; - - public AbstractScopeContext(EventContext eventContext) { - assert (eventContext != null) : "Event context was null"; - this.eventContext = eventContext; - } - - public void registerFactories(List<ContextFactory<Context>> configurations) { - for (ContextFactory<Context> configuration : configurations) { - contextFactories.put(configuration.getName(), configuration); - } - } - - public Object getInstance(QualifiedName qName) throws TargetException { - Context context = getContext(qName.getPartName()); - if (context == null) { - TargetException e = new TargetException("Target not found"); - e.setIdentifier(qName.getQualifiedName()); - throw e; - } - return context.getInstance(qName); - } - - protected void checkInit() { - if (getLifecycleState() != RUNNING) { - throw new IllegalStateException("Scope not running [" + getLifecycleState() + "]"); - } - } - - protected EventContext getEventContext() { - return eventContext; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeStrategy.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeStrategy.java deleted file mode 100644 index f89d09196d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeStrategy.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.scope; - -import org.apache.tuscany.core.context.ScopeStrategy; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Implements basic scope strategy functionality - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractScopeStrategy implements ScopeStrategy { - - public AbstractScopeStrategy() { - } - - /** - * Determines legal scope references according to standard SCA scope rules - * - * @param pReferrer the scope of the component making the reference - * @param pReferee the scope of the component being referred to - */ - public boolean downScopeReference(Scope pReferrer, Scope pReferee) { - if (pReferrer == Scope.UNDEFINED || pReferee == Scope.UNDEFINED) { - return false; - } - if (pReferee == pReferrer){ - return false; - }else if(pReferrer == Scope.INSTANCE){ - return false; - }else if(pReferee == Scope.INSTANCE){ - return true; - }else if (pReferrer == Scope.REQUEST && pReferee == Scope.SESSION){ - return false; - }else if (pReferrer == Scope.REQUEST && pReferee == Scope.MODULE){ - return false; -// }else if (pReferrer == Scope.SESSION && pReferee == Scope.REQUEST){ -// return true; - }else if (pReferrer == Scope.SESSION && pReferee == Scope.MODULE){ - return false; -// }else if (pReferrer == Scope.MODULE){ -// return true; - }else{ - return true; - } - //FIXME Jim this does not work with enumerations, what does it mean to have a scope <0? -// } else if ((pReferrer < 0) || (pReferee < 0)) { -// return false; -// } -// -// return (pReferrer > pReferee); -// return pReferrer != pReferee; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java deleted file mode 100644 index 7468ff9dd6..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java +++ /dev/null @@ -1,156 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.scope; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.ScopeInitializationException; -import org.apache.tuscany.core.context.ScopeRuntimeException; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.context.event.Event; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.impl.AbstractLifecycle; - -/** - * Manages the lifecycle of composite component contexts, i.e. contexts which contain child contexts - * - * @see org.apache.tuscany.core.context.CompositeContext - * @version $Rev$ $Date$ - */ -public class CompositeScopeContext extends AbstractLifecycle implements ScopeContext { - - private List<ContextFactory<Context>> configs = new ArrayList<ContextFactory<Context>>(); - - // Composite component contexts in this scope keyed by name - private Map<String, CompositeContext> contexts = new ConcurrentHashMap<String, CompositeContext>(); - - // indicates if a module start event has been previously propagated so child contexts added after can be notified - private boolean moduleScopeStarted; - - public CompositeScopeContext(EventContext eventContext) { - assert (eventContext != null) : "Event context was null"; - setName("Composite Scope"); - } - - public void start() throws ScopeInitializationException { - for (ContextFactory<Context> configuration : configs) { - Context context = configuration.createContext(); - if (!(context instanceof CompositeContext)) { - ScopeInitializationException e = new ScopeInitializationException("Context not an composite type"); - e.addContextName(context.getName()); - throw e; - } - CompositeContext compositeCtx = (CompositeContext) context; - compositeCtx.start(); - contexts.put(compositeCtx.getName(), compositeCtx); - } - lifecycleState = RUNNING; - } - - public void stop() throws ScopeRuntimeException { - for (CompositeContext context : contexts.values()) { - context.stop(); - } - } - - public void registerFactories(List<ContextFactory<Context>> configurations) { - this.configs = configurations; - } - - public void registerFactory(ContextFactory<Context> configuration) { - assert (configuration != null) : "Configuration was null"; - configs.add(configuration); - if (getLifecycleState() == RUNNING) { - Context context = configuration.createContext(); - if (!(context instanceof CompositeContext)) { - ScopeInitializationException e = new ScopeInitializationException("Context not an composite type"); - e.setIdentifier(context.getName()); - throw e; - } - CompositeContext compositeCtx = (CompositeContext) context; - compositeCtx.start(); - if (moduleScopeStarted) { - compositeCtx.publish(new ModuleStart(this)); - } - contexts.put(compositeCtx.getName(), compositeCtx); - } - } - - public boolean isCacheable() { - return false; - } - - public Object getInstance(QualifiedName qName) throws TargetException { - Context context = getContext(qName.getPartName()); - if (context == null) { - TargetException e = new TargetException("Component not found"); - e.setIdentifier(qName.getQualifiedName()); - throw e; - } - return context.getInstance(qName); - } - - public Context getContext(String ctxName) { - checkInit(); - return contexts.get(ctxName); - } - - public Context getContextByKey(String ctxName, Object key) { - return getContext(ctxName); - } - - public void removeContext(String ctxName) throws ScopeRuntimeException { - Context context = contexts.remove(ctxName); - if (context != null) { - context.stop(); - } - } - - public void removeContextByKey(String ctxName, Object key) throws ScopeRuntimeException { - throw new UnsupportedOperationException(); - } - - public void onEvent(Event event){ - if (event instanceof ModuleStart) { - // track module starting so that composite contexts registered after the event are notified properly - moduleScopeStarted = true; - } else if (event instanceof ModuleStop) { - moduleScopeStarted = false; - publish(event); - } - // propagate events to child contexts - for (CompositeContext context : contexts.values()) { - context.publish(event); - } - } - - private void checkInit() { - if (getLifecycleState()!= RUNNING) { - throw new IllegalStateException("Scope not running [" + getLifecycleState() + "]"); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategy.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategy.java deleted file mode 100644 index 1f386fd35f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategy.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.scope; - -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.HashMap; -import java.util.Map; - -/** - * Implements a {@link org.apache.tuscany.core.context.ScopeStrategy} for the default module scopes: stateless, request, session, - * and module. - * - * @version $Rev$ $Date$ - */ -public class DefaultScopeStrategy extends AbstractScopeStrategy { - - public DefaultScopeStrategy() { - } - - public Map<Scope,ScopeContext> getScopeContexts(EventContext eventContext) { - ScopeContext moduleScope = new ModuleScopeContext(eventContext); - ScopeContext sessionScope = new SessionScopeContext(eventContext); - ScopeContext requestScope = new RequestScopeContext(eventContext); - ScopeContext statelessScope = new StatelessScopeContext(eventContext); - ScopeContext aggregrateScope = new CompositeScopeContext(eventContext); - Map<Scope,ScopeContext> scopes = new HashMap<Scope,ScopeContext>(); - scopes.put(Scope.MODULE,moduleScope); - scopes.put(Scope.SESSION,sessionScope); - scopes.put(Scope.REQUEST,requestScope); - scopes.put(Scope.INSTANCE,statelessScope); - scopes.put(Scope.AGGREGATE,aggregrateScope); - return scopes; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/ModuleScopeContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/ModuleScopeContext.java deleted file mode 100644 index dbb342bb5a..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/ModuleScopeContext.java +++ /dev/null @@ -1,194 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.scope; - -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.context.Lifecycle; -import org.apache.tuscany.core.context.event.InstanceCreated; -import org.apache.tuscany.core.context.event.Event; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; - -import java.util.Map; -import java.util.List; -import java.util.ArrayList; -import java.util.ListIterator; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Manages contexts whose implementations are module scoped. This scope contexts eagerly starts contexts when - * a {@link ModuleStart} event is received. If a contained context has an implementation marked to eagerly initialized, - * the an instance will be created at that time as well. Contained contexts are shutdown when a {@link ModuleStop} - * event is received in reverse order to which their implementation instances were created. - * - * @version $Rev$ $Date$ - */ -public class ModuleScopeContext extends AbstractScopeContext { - - // Component contexts in this scope keyed by name - private Map<String, Context> contexts; - - // the queue of contexts to destroy, in the order that their instances were created - private List<Context> destroyQueue; - - public ModuleScopeContext(EventContext eventContext) { - super(eventContext); - setName("Module Scope"); - } - - public void onEvent(Event event) { - if (event instanceof ModuleStart) { - lifecycleState = RUNNING; - initComponentContexts(); - } else if (event instanceof ModuleStop) { - shutdownContexts(); - } else if (event instanceof InstanceCreated) { - checkInit(); - if (event.getSource() instanceof Context) { - Context context = (Context) event.getSource(); - // Queue the context to have its implementation instance released if destroyable - destroyQueue.add(context); - } - } - } - - public synchronized void start() { - if (lifecycleState != UNINITIALIZED) { - throw new IllegalStateException("Scope must be in UNINITIALIZED state [" + lifecycleState + "]"); - } - } - - public synchronized void stop() { - if (lifecycleState != RUNNING) { - throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]"); - } - contexts = null; - destroyQueue = null; - lifecycleState = STOPPED; - } - - public boolean isCacheable() { - return true; - } - - public void registerFactory(ContextFactory<Context> configuration) { - contextFactories.put(configuration.getName(), configuration); - if (lifecycleState == RUNNING) { - contexts.put(configuration.getName(), configuration.createContext()); - } - } - - public Context getContext(String ctxName) { - checkInit(); - initComponentContexts(); - return contexts.get(ctxName); - } - - public Context getContextByKey(String ctxName, Object key) { - checkInit(); - initComponentContexts(); - return contexts.get(ctxName); - } - - public void removeContext(String ctxName) { - checkInit(); - if (contexts == null){ - return; - } - Context context = contexts.remove(ctxName); - if (context != null) { - destroyQueue.remove(context); - } - } - - public void removeContextByKey(String ctxName, Object key){ - removeContext(ctxName); - } - - /** - * Notifies contexts of a shutdown in reverse order to which they were started - */ - private synchronized void shutdownContexts() { - if (destroyQueue == null || destroyQueue.size() == 0) { - return; - } - // shutdown destroyable instances in reverse instantiation order - ListIterator<Context> iter = destroyQueue.listIterator(destroyQueue.size()); - while(iter.hasPrevious()){ - Lifecycle context = iter.previous(); - if (context.getLifecycleState() == RUNNING) { - try { - if (context instanceof AtomicContext){ - ((AtomicContext)context).destroy(); - } - } catch (TargetException e) { - // TODO send a monitoring event - } - } - } - if (contexts == null){ - return; - } - for(Lifecycle context: contexts.values()) { - try { - if (context.getLifecycleState() == RUNNING) { - context.stop(); - } - } catch (CoreRuntimeException e){ - // TODO send monitoring event - } - } - contexts = null; - destroyQueue = null; - } - - /** - * Creates and starts components contexts in the module scope. Implementations marked to eagerly initialize will - * also be notified to do so. - * - * @throws CoreRuntimeException - */ - private synchronized void initComponentContexts() throws CoreRuntimeException { - if (contexts == null) { - contexts = new ConcurrentHashMap<String, Context>(); - destroyQueue = new ArrayList<Context>(); - for (ContextFactory<Context> config : contextFactories.values()) { - Context context = config.createContext(); - context.start(); - contexts.put(context.getName(), context); - } - // Initialize eager contexts. Note this cannot be done when we initially create each context since a component may - // contain a forward reference to a component which has not been instantiated - for (Context context : contexts.values()) { - if (context instanceof AtomicContext) { - AtomicContext atomic = (AtomicContext) context; - if (atomic.isEagerInit()) { - // perform silent creation and manual shutdown registration - atomic.init(); - destroyQueue.add(context); - } - } - context.addListener(this); - } - } - } -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java deleted file mode 100644 index 67ce176af5..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java +++ /dev/null @@ -1,228 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.scope; - -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.context.Lifecycle; -import org.apache.tuscany.core.context.event.InstanceCreated; -import org.apache.tuscany.core.context.event.Event; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.context.event.RequestStart; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.ListIterator; -import java.util.concurrent.ConcurrentHashMap; - -/** - * An implementation of a request-scoped component container. This scope contexts eagerly starts contexts when - * a {@link org.apache.tuscany.core.context.event.RequestStart} event is received. If a contained context has an implementation marked to eagerly initialized, - * the an instance will be created at that time as well. Contained contexts are shutdown when a {@link org.apache.tuscany.core.context.event.RequestEnd} - * event is received in reverse order to which their implementation instances were created. - * - * @version $Rev$ $Date$ - */ -public class RequestScopeContext extends AbstractScopeContext { - - // A collection of service component contexts keyed by thread. Note this could have been implemented with a ThreadLocal but - // using a Map allows finer-grained concurrency. - private Map<Object, Map<String, Context>> contexts; - - // stores ordered lists of contexts to shutdown for each thread. - private Map<Object, List<Context>> destroyQueues; - - public RequestScopeContext(EventContext eventContext) { - super(eventContext); - setName("Request Scope"); - } - - public void onEvent(Event event){ - if (event instanceof RequestStart){ - getContexts(); // eager load - }else if (event instanceof RequestEnd){ - checkInit(); - getEventContext().clearIdentifiers(); // clean up current context for pooled threads - shutdownContexts(); - cleanupRequestContexts(); - }else if (event instanceof InstanceCreated){ - checkInit(); - assert(event.getSource() instanceof Context): "Context must be passed on created event"; - Context context = (Context)event.getSource(); - List<Context> collection = destroyQueues.get(Thread.currentThread()); - collection.add(context); - } - } - - public synchronized void start() { - if (lifecycleState != UNINITIALIZED) { - throw new IllegalStateException("Scope must be in UNINITIALIZED state [" + lifecycleState + "]"); - } - contexts = new ConcurrentHashMap<Object, Map<String, Context>>(); - destroyQueues = new ConcurrentHashMap<Object, List<Context>>(); - lifecycleState = RUNNING; - } - - public synchronized void stop() { - if (lifecycleState != RUNNING) { - throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]"); - } - contexts = null; - destroyQueues = null; - lifecycleState = STOPPED; - } - - public boolean isCacheable() { - return true; - } - - public void registerFactory(ContextFactory<Context> configuration) { - contextFactories.put(configuration.getName(), configuration); - } - - public Context getContext(String ctxName) { - checkInit(); - Map<String, Context> contexts = getContexts(); - Context ctx = contexts.get(ctxName); - if (ctx == null){ - // check to see if the configuration was added after the request was started - ContextFactory<Context> configuration = contextFactories.get(ctxName); - if (configuration != null) { - ctx = configuration.createContext(); - //ctx.addListener(this); - ctx.start(); - contexts.put(ctx.getName(), ctx); - } - } - return ctx; - } - - public Context getContextByKey(String ctxName, Object key) { - checkInit(); - if (key == null) { - return null; - } - Map<String, Context> components = contexts.get(key); - if (components == null) { - return null; - } - return components.get(ctxName); - } - - public void removeContext(String ctxName) { - removeContextByKey(ctxName, Thread.currentThread()); - } - - public void removeContextByKey(String ctxName, Object key) { - checkInit(); - if (key == null || ctxName == null) { - return; - } - Map components = contexts.get(key); - if (components == null) { - return; - } - components.remove(ctxName); - } - - - - private void cleanupRequestContexts() { - // TODO uninitialize all request-scoped components - contexts.remove(Thread.currentThread()); - destroyQueues.remove(Thread.currentThread()); - } - - /** - * Initializes ServiceComponentContexts for the current request. - * <p> - * TODO This eagerly creates all component contexts, even if the component is never accessed during the request. This method - * should be profiled to determine if lazy initialization is more performant - * <p> - * TODO Eager initialization is not performed for request-scoped components - */ - - private Map<String, Context> getContexts() throws CoreRuntimeException { - Map<String, Context> requestContexts = this.contexts.get(Thread.currentThread()); - if (requestContexts == null) { - requestContexts = new ConcurrentHashMap<String, Context>(); - List<Context> shutdownQueue = new ArrayList<Context>(); - for (ContextFactory<Context> config : contextFactories.values()) { - Context context = config.createContext(); - context.start(); - requestContexts.put(context.getName(), context); - } - // initialize eager components. Note this cannot be done when we initially create each context since a component may - // contain a forward reference to a component which has not been instantiated - for (Context context : requestContexts.values()) { - if (context instanceof AtomicContext) { - AtomicContext atomic = (AtomicContext) context; - if (atomic.isEagerInit()) { - atomic.init(); // Notify the instance - synchronized(shutdownQueue){ - shutdownQueue.add(context); - } - } - } - context.addListener(this); - } - contexts.put(Thread.currentThread(), requestContexts); - destroyQueues.put(Thread.currentThread(), shutdownQueue); - } - return requestContexts; - } - - private void shutdownContexts() { - List<Context> destroyQueue = destroyQueues.remove(Thread.currentThread()); - if (destroyQueue == null || destroyQueue.size() == 0) { - return; - } - synchronized(destroyQueue){ - // shutdown destroyable instances in reverse instantiation order - ListIterator<Context> iter = destroyQueue.listIterator(destroyQueue.size()); - while(iter.hasPrevious()){ - Lifecycle context = iter.previous(); - if (context.getLifecycleState() == RUNNING) { - try { - if (context instanceof AtomicContext){ - ((AtomicContext)context).destroy(); - } - } catch (TargetException e) { - // TODO send a monitoring event - } - } - } - } - // shutdown contexts - Map<String,Context> currentContexts = contexts.remove(Thread.currentThread()); - if (currentContexts == null){ - return; - } - for (Lifecycle context: currentContexts.values()){ - if (context.getLifecycleState() == RUNNING) { - context.stop(); - } - } - - } - -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java deleted file mode 100644 index c5785d25f7..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java +++ /dev/null @@ -1,258 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.scope; - -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.ScopeRuntimeException; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.context.Lifecycle; -import org.apache.tuscany.core.context.event.Event; -import org.apache.tuscany.core.context.event.HttpSessionEvent; -import org.apache.tuscany.core.context.event.InstanceCreated; -import org.apache.tuscany.core.context.event.SessionEnd; -import org.apache.tuscany.core.context.event.SessionStart; - -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * An implementation of an session-scoped component container. This scope contexts eagerly starts contexts when a - * {@link org.apache.tuscany.core.context.event.SessionStart} event is received. If a contained context has an implementation - * marked to eagerly initialized, the an instance will be created at that time as well. Contained contexts are shutdown when a - * {@link org.apache.tuscany.core.context.event.SessionEnd} event is received in reverse order to which their implementation - * instances were created. - * TODO this implementation needs to be made generic so that it supports a range of session types, i.e. not tied to HTTP - * session scope - * - * @version $Rev$ $Date$ - */ -public class SessionScopeContext extends AbstractScopeContext { - - // The collection of service component contexts keyed by session - private Map<Object, Map<String, Context>> contexts; - - // Stores ordered lists of contexts to shutdown keyed by session - private Map<Object, List<Context>> destroyQueues; - - public SessionScopeContext(EventContext eventContext) { - super(eventContext); - setName("Session Scope"); - } - - public synchronized void start() { - if (lifecycleState != UNINITIALIZED) { - throw new IllegalStateException("Scope container must be in UNINITIALIZED state"); - } - contexts = new ConcurrentHashMap<Object, Map<String, Context>>(); - destroyQueues = new ConcurrentHashMap<Object, List<Context>>(); - lifecycleState = RUNNING; - } - - public synchronized void stop() { - if (lifecycleState != RUNNING) { - throw new IllegalStateException("Scope container in wrong state"); - } - contexts = null; - contexts = null; - destroyQueues = null; - lifecycleState = STOPPED; - } - - public void onEvent(Event event) { - if (event instanceof SessionStart) { - checkInit(); - Object key = ((SessionEnd) event).getId(); - getSessionContexts(key); - }else if (event instanceof SessionEnd) { - checkInit(); - Object key = ((SessionEnd) event).getId(); - shutdownContexts(key); - destroyComponentContext(key); - } else if (event instanceof InstanceCreated) { - checkInit(); - Object sessionKey = getEventContext().getIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - List<Context> shutdownQueue = destroyQueues.get(sessionKey); - Context context = (Context) event.getSource(); - assert(shutdownQueue != null): "Shutdown queue not found for key"; - shutdownQueue.add(context); - } - } - - public boolean isCacheable() { - return true; - } - - public void registerFactory(ContextFactory<Context> configuration) { - contextFactories.put(configuration.getName(), configuration); - } - - public Context getContext(String ctxName) { - assert(ctxName != null): "No context name specified"; - checkInit(); - Map<String, Context> ctxs = getSessionContexts(); - Context context = ctxs.get(ctxName); - if (context == null) { - // the configuration was added after the session had started, so create a context now and start it - ContextFactory<Context> configuration = contextFactories.get(ctxName); - if (configuration != null) { - context = configuration.createContext(); - context.start(); - if (context instanceof AtomicContext) { - ((AtomicContext) context).init(); - } - - ctxs.put(context.getName(), context); - List<Context> shutdownQueue = destroyQueues.get(getEventContext().getIdentifier(HttpSessionEvent.HTTP_IDENTIFIER)); - synchronized (shutdownQueue) { - shutdownQueue.add(context); - } - context.addListener(this); - } - } - return context; - } - - public Context getContextByKey(String ctxName, Object key) { - checkInit(); - assert(ctxName != null): "No context name specified"; - assert(key != null): "No key specified"; - Map ctxs = contexts.get(key); - if (ctxs == null) { - return null; - } - return (Context) ctxs.get(ctxName); - } - - public void removeContext(String ctxName) { - checkInit(); - Object key = getEventContext().getIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - removeContextByKey(ctxName, key); - } - - public void removeContextByKey(String ctxName, Object key) { - checkInit(); - assert(ctxName != null): "No context name specified"; - assert(key != null): "No key specified"; - Map components = contexts.get(key); - if (components == null) { - return; - } - components.remove(ctxName); - Map<String, Context> definitions = contexts.get(key); - Context ctx = definitions.get(ctxName); - if (ctx != null) { - destroyQueues.get(key).remove(ctx); - } - definitions.remove(ctxName); - } - - /** - * Returns and, if necessary, creates a context for the current sesion - */ - private Map<String, Context> getSessionContexts() throws CoreRuntimeException { - Object key = getEventContext().getIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); - return getSessionContexts(key); - } - - /** - * Returns and, if necessary, creates a context for the given session key - */ - private Map<String, Context> getSessionContexts(Object key) throws CoreRuntimeException { - if (key == null) { - throw new ScopeRuntimeException("Session key not set in request context"); - } - Map<String, Context> m = contexts.get(key); - if (m != null) { - return m; // already created, return - } - Map<String, Context> sessionContext = new ConcurrentHashMap<String, Context>(contextFactories.size()); - for (ContextFactory<Context> config : contextFactories.values()) { - Context context = config.createContext(); - context.start(); - sessionContext.put(context.getName(), context); - } - - List<Context> shutdownQueue = new ArrayList<Context>(); - contexts.put(key, sessionContext); - destroyQueues.put(key, shutdownQueue); - // initialize eager components. Note this cannot be done when we initially create each context since a component may - // contain a forward reference to a component which has not been instantiated - for (Context context : sessionContext.values()) { - if (context instanceof AtomicContext) { - AtomicContext atomic = (AtomicContext) context; - if (atomic.isEagerInit()) { - atomic.init(); // Notify the instance - synchronized (shutdownQueue) { - shutdownQueue.add(context); - } - } - } - context.addListener(this); - } - return sessionContext; - } - - /** - * Removes the components associated with an expiring context - */ - private void destroyComponentContext(Object key) { - contexts.remove(key); - destroyQueues.remove(key); - } - - - private synchronized void shutdownContexts(Object key) { - List<Context> destroyQueue = destroyQueues.remove(key); - if (destroyQueue == null || destroyQueue.size() == 0) { - return; - } - // shutdown destroyable instances in reverse instantiation order - ListIterator<Context> iter = destroyQueue.listIterator(destroyQueue.size()); - synchronized (destroyQueue) { - while (iter.hasPrevious()) { - Lifecycle context = iter.previous(); - if (context.getLifecycleState() == RUNNING) { - try { - if (context instanceof AtomicContext) { - ((AtomicContext) context).destroy(); - } - } catch (TargetException e) { - // TODO send a monitoring event - } - } - } - } - // shutdown contexts - Map<String, Context> currentContexts = contexts.remove(Thread.currentThread()); - if (currentContexts == null) { - return; - } - for (Lifecycle context : currentContexts.values()) { - if (context.getLifecycleState() == RUNNING) { - context.stop(); - } - } - } - -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/StatelessScopeContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/StatelessScopeContext.java deleted file mode 100644 index 46bf58b548..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/StatelessScopeContext.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.context.scope; - -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.Lifecycle; -import org.apache.tuscany.core.context.event.Event; -import org.apache.tuscany.core.context.event.ModuleStop; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * A container that manages stateless components. - * - * @version $Rev$ $Date$ - */ -public class StatelessScopeContext extends AbstractScopeContext { - - // Component contexts keyed by name - private Map<String, Context> contexts; - - public StatelessScopeContext(EventContext eventContext) { - super(eventContext); - setName("Stateless Scope"); - } - - public synchronized void start() { - if (lifecycleState != UNINITIALIZED) { - throw new IllegalStateException("Scope must be in UNINITIALIZED state [" + lifecycleState + "]"); - } - lifecycleState = RUNNING; - } - - public synchronized void stop() { - if (lifecycleState != RUNNING) { - throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]"); - } - contexts = null; - lifecycleState = STOPPED; - } - - public void registerFactory(ContextFactory<Context> configuration) { - contextFactories.put(configuration.getName(), configuration); - if (contexts != null) { - contexts.put(configuration.getName(), configuration.createContext()); - } - } - - public void onEvent(Event event){ - if (event instanceof ModuleStop) { - shutdownContexts(); - } - } - - public boolean isCacheable() { - return true; - } - - public Context getContext(String ctxName) { - prepare(); - return contexts.get(ctxName); - } - - public Context getContextByKey(String ctxName, Object key) { - return getContext(ctxName); - } - - public void removeContext(String ctxName) { - if (contexts == null){ - return; - } - contexts.remove(ctxName); - } - - public void removeContextByKey(String ctxName, Object key) { - removeContext(ctxName); - } - - private void prepare() throws CoreRuntimeException { - if (lifecycleState != RUNNING) { - throw new IllegalStateException("Scope not in INITIALIZED state [" + lifecycleState + "]"); - } - if (contexts == null) { - contexts = new ConcurrentHashMap<String, Context> (); - for (ContextFactory<Context> config : contextFactories.values()) { - for (int i = 0; i < contextFactories.size(); i++) { - Context context = config.createContext(); - context.start(); - contexts.put(context.getName(), context); - } - - } - } - } - - private void shutdownContexts(){ - if (contexts == null){ - return; - } - for(Lifecycle context: contexts.values()) { - try { - if (context.getLifecycleState() == RUNNING) { - context.stop(); - } - } catch (CoreRuntimeException e){ - // TODO send monitoring event - } - - } - contexts = null; - } - - -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ComponentTargetInvoker.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ComponentTargetInvoker.java deleted file mode 100644 index 57fcffc2b2..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ComponentTargetInvoker.java +++ /dev/null @@ -1,122 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.core.extension;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.core.context.AtomicContext;
-import org.apache.tuscany.core.context.Context;
-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.message.Message;
-import org.apache.tuscany.core.wire.Interceptor;
-import org.apache.tuscany.core.wire.TargetInvoker;
-
-/**
- * Responsible for invoking an external service
- * TODO: virtualy identical to ExternalServiceTargetInvoker
- * @version $Rev$ $Date$
- */
-public class ComponentTargetInvoker implements TargetInvoker {
-
- private QualifiedName serviceName;
-
- private String esName;
-
- private Method method;
-
- private ScopeContext container;
-
- private AtomicContext context;
-
- /**
- * Constructs a new ExternalWebServiceTargetInvoker.
- *
- * @param container
- */
- public ComponentTargetInvoker(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) {
- Context iContext = container.getContext(esName);
- if (!(iContext instanceof AtomicContext)) {
- TargetException te = new TargetException("Unexpected target context type");
- te.setIdentifier(iContext.getClass().getName());
- te.addContextName(iContext.getName());
- throw te;
- }
- context = (AtomicContext) iContext;
- }
-
- ExternalServiceInvoker invoker = (ExternalServiceInvoker) context.getTargetInstance();
- if (payload != null) {
- return doInvoke(invoker, (Object[]) payload);
- } else {
- return doInvoke(invoker, null);
- }
- }
-
- protected Object doInvoke(ExternalServiceInvoker invoker, Object[] args) {
- return invoker.invoke(method.getName(), args);
- }
-
- 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() throws CloneNotSupportedException {
- try {
- ComponentTargetInvoker invoker = (ComponentTargetInvoker) 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) {
- // will not happen
- return null;
- }
- }
-
-}
diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java deleted file mode 100644 index 81770d49b8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.osoa.sca.annotations.Init; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.List; - -/** - * A runtime extension point for component types. Subclasses must be genericized according to the model implementation type they - * handle, i.e. a subclass of {@link Implementation}, and implement {@link #createContextFactory}. - * - * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ - * @see org.apache.tuscany.core.builder.ContextFactory - */ -@org.osoa.sca.annotations.Scope("MODULE") -public abstract class ContextFactoryBuilderSupport<T extends Implementation> implements ContextFactoryBuilder { - - protected ContextFactoryBuilderRegistry builderRegistry; - - protected WireFactoryService wireFactoryService; - - protected Class implementationClass; - - /** - * Default constructor - */ - public ContextFactoryBuilderSupport() { - // reflect the generic type of the subclass - Type type = this.getClass().getGenericSuperclass(); - if (type instanceof ParameterizedType) { - implementationClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; - } else { - throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); - } - } - - /** - * Constructs a new instance - * - * @param wireFactoryService the system service responsible for creating wire factories - */ - public ContextFactoryBuilderSupport(WireFactoryService wireFactoryService) { - this(); - this.wireFactoryService = wireFactoryService; - } - - @Init(eager = true) - public void init() { - builderRegistry.register(this); - } - - @Autowire - public void setBuilderRegistry(ContextFactoryBuilderRegistry builderRegistry) { - this.builderRegistry = builderRegistry; - } - - /** - * Sets the system service used to construct wire factories - */ - @Autowire - public void setWireFactoryService(WireFactoryService wireFactoryService) { - this.wireFactoryService = wireFactoryService; - } - - public void build(AssemblyObject modelObject) throws BuilderException { - if (!(modelObject instanceof Component)) { - return; - } - Component nonGenricComponent = (Component) modelObject; - if (!implementationClass.isAssignableFrom(nonGenricComponent.getImplementation().getClass())) { - return; - } - Component<T> component = (Component<T>) modelObject; - List<Service> services = component.getImplementation().getComponentType().getServices(); - Scope previous = null; - Scope scope = Scope.INSTANCE; - for (Service service : services) { - // calculate and validate the scope of the component; ensure that all service scopes are the same unless stateless - Scope current = service.getServiceContract().getScope(); - if (previous != null && current != null && current != previous - && (current != Scope.INSTANCE && previous != Scope.INSTANCE)) { - BuilderException e = new BuilderConfigException("Incompatible scopes specified for services on component"); - e.setIdentifier(component.getName()); - throw e; - } - if (scope != null && current != Scope.INSTANCE) { - scope = current; - } - } - ContextFactory contextFactory; - try { - contextFactory = createContextFactory(component.getName(), component.getImplementation(), scope); - // create target-side wire invocation chains for each service offered by the implementation - for (ConfiguredService configuredService : component.getConfiguredServices()) { - Service service = configuredService.getPort(); - TargetWireFactory wireFactory = wireFactoryService.createTargetFactory(configuredService); - contextFactory.addTargetWireFactory(service.getName(), wireFactory); - } - // handle properties - List<ConfiguredProperty> configuredProperties = component.getConfiguredProperties(); - if (configuredProperties != null) { - for (ConfiguredProperty property : configuredProperties) { - contextFactory.addProperty(property.getName(), property.getValue()); - } - } - // handle references and source side reference chains - List<ConfiguredReference> configuredReferences = component.getConfiguredReferences(); - if (configuredReferences != null) { - for (ConfiguredReference reference : configuredReferences) { - if (reference.getPort().getMultiplicity() == Multiplicity.ZERO_N || reference.getPort().getMultiplicity() == Multiplicity.ZERO_ONE){ - if (reference.getTargetConfiguredServices().size() < 1 && reference.getTargets().size() <1 ){ - continue; // not required, not configured fix TUSCANY-299 - } - } - List<SourceWireFactory> wireFactories = wireFactoryService.createSourceFactory(reference); - String refName = reference.getPort().getName(); - Class refClass = reference.getPort().getServiceContract().getInterface(); - boolean multiplicity = reference.getPort().getMultiplicity() == Multiplicity.ONE_N - || reference.getPort().getMultiplicity() == Multiplicity.ZERO_N; - contextFactory.addSourceWireFactories(refName, refClass, wireFactories, multiplicity); - } - } - component.setContextFactory(contextFactory); - } catch (BuilderException e) { - e.addContextName(component.getName()); - throw e; - } - } - - /** - * Subclasses must implement, returning a context factory appropriate to the component implementation - * - * @param componentName the name of the component - * @param implementation the component implementation - * @param scope the component implementation scope - */ - protected abstract ContextFactory createContextFactory(String componentName, T implementation, Scope scope); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java deleted file mode 100644 index 58d7a626a6..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Service; -import org.osoa.sca.annotations.Init; - -/** - * A base class for a {@link ContextFactoryBuilder} that creates {@link org.apache.tuscany.core.context.EntryPointContext}s - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class EntryPointBuilderSupport<T extends Binding> implements ContextFactoryBuilder { - - protected ContextFactoryBuilderRegistry builderRegistry; - protected WireFactoryService wireService; - protected MessageFactory messageFactory; - protected Class bindingClass; - - public EntryPointBuilderSupport() { - // reflect the generic type of the subclass - Type type = this.getClass().getGenericSuperclass(); - if (type instanceof ParameterizedType) { - bindingClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; - } else { - throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); - } - } - - @Init(eager = true) - public void init() throws Exception { - builderRegistry.register(this); - } - - @Autowire - public void setBuilderRegistry(ContextFactoryBuilderRegistry registry) { - builderRegistry = registry; - } - - @Autowire - public void setWireService(WireFactoryService wireService) { - this.wireService = wireService; - } - - /** - * Sets the factory used to construct wire messages - * - * @param msgFactory - */ - @Autowire - public void setMessageFactory(MessageFactory msgFactory) { - this.messageFactory = msgFactory; - } - - public void build(AssemblyObject object) throws BuilderException { - if (!(object instanceof EntryPoint)) { - return; - } - EntryPoint entryPoint = (EntryPoint) object; - if (entryPoint.getBindings().size() < 1) { - return; - } - if (!bindingClass.isAssignableFrom(entryPoint.getBindings().get(0).getClass())) { - return; - } - - EntryPointContextFactory contextFactory = createEntryPointContextFactory(entryPoint, messageFactory); - ConfiguredService configuredService = entryPoint.getConfiguredService(); - Service service = configuredService.getPort(); - SourceWireFactory wireFactory = wireService.createSourceFactory(entryPoint.getConfiguredReference()).get(0); - contextFactory.addSourceWireFactory(service.getName(), wireFactory); - entryPoint.setContextFactory(contextFactory); - } - - /** - * Callback to create the specific <code>ContextFactory</code> type associated with the extending - * implementation - * - * @param entryPoint the entry point being processed - * @param msgFactory the message factory to be used by <code>EntryPointContext</code> when flowing - * invocations - */ - protected abstract EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory); - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointContextFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointContextFactory.java deleted file mode 100644 index bb4d1207d4..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointContextFactory.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.EntryPointContext; -import org.apache.tuscany.core.context.impl.EntryPointContextImpl; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - * Default factory for contexts that represent entry points. - * - * @version $Rev$ $Date$ - */ -public abstract class EntryPointContextFactory implements ContextFactory<EntryPointContext> { - - private String name; - - private SourceWireFactory sourceWireFactory; - - private MessageFactory msgFactory; - - private List<SourceWireFactory> sourceProxyFactories; - - public EntryPointContextFactory(String name, MessageFactory msgFactory) { - assert (name != null) : "Entry point name was null"; - assert (msgFactory != null) : "Message factory was null"; - this.name = name; - this.msgFactory = msgFactory; - } - - public EntryPointContext createContext() throws ContextCreationException { - return new EntryPointContextImpl(name, sourceWireFactory, msgFactory); - } - - public Scope getScope() { - return Scope.MODULE; - } - - public String getName() { - return name; - } - - public void prepare() { - } - - public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { - // no wires to an entry point from within a composite - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - // no wires to an entry point from within a composite - return null; - } - - public Map<String, TargetWireFactory> getTargetWireFactories() { - // no wires to an entry point from within a composite - return Collections.emptyMap(); - } - - public void addSourceWireFactory(String refName, SourceWireFactory factory) { - assert (refName != null) : "No reference name specified"; - assert (factory != null) : "Proxy factory was null"; - this.sourceWireFactory = factory; - } - - public List<SourceWireFactory> getSourceWireFactories() { - if (sourceProxyFactories == null) { - sourceProxyFactories = new ArrayList<SourceWireFactory>(1); - sourceProxyFactories.add(sourceWireFactory); - } - return sourceProxyFactories; - } - - public void addProperty(String propertyName, Object value) { - throw new UnsupportedOperationException(); - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factories, boolean multiplicity) { - if (factories.size() >1){ - throw new UnsupportedOperationException("Multiple wires for an entry point not allowed"); - }else if(factories.size() <1){ - throw new AssertionError("Empty wire factory list"); - } - this.sourceWireFactory = factories.get(0); - } - - public void prepare(CompositeContext parent) { - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java deleted file mode 100644 index 7c030324f1..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Service; -import org.osoa.sca.annotations.Init; - -/** - * A base class for a {@link ContextFactoryBuilder} that creates {@link org.apache.tuscany.core.context.ExternalServiceContext}s - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class ExternalServiceBuilderSupport<T extends Binding> implements ContextFactoryBuilder { - - private ContextFactoryBuilderRegistry builderRegistry; - private WireFactoryService wireService; - protected Class bindingClass; - - public ExternalServiceBuilderSupport() { - // reflect the generic type of the subclass - Type type = this.getClass().getGenericSuperclass(); - if (type instanceof ParameterizedType) { - bindingClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; - } else { - throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); - } - } - - public ExternalServiceBuilderSupport(WireFactoryService wireService) { - this(); - this.wireService = wireService; - } - - @Init(eager = true) - public void init() throws Exception { - builderRegistry.register(this); - } - - @Autowire - public void setBuilderRegistry(ContextFactoryBuilderRegistry registry) { - builderRegistry = registry; - } - - @Autowire - public void setWireService(WireFactoryService wireService) { - this.wireService = wireService; - } - - public void build(AssemblyObject object) throws BuilderException { - if (!(object instanceof ExternalService)) { - return; - } - ExternalService externalService = (ExternalService) object; - if (externalService.getBindings().size() < 1) { - // || !(handlesBindingType(externalService.getBindings().get(0)))) { - return; - } - if (!bindingClass.isAssignableFrom(externalService.getBindings().get(0).getClass())) { - return; - } - - ExternalServiceContextFactory contextFactory - = createExternalServiceContextFactory(externalService); - - ConfiguredService configuredService = externalService.getConfiguredService(); - Service service = configuredService.getPort(); - TargetWireFactory wireFactory = wireService.createTargetFactory(configuredService); - contextFactory.addTargetWireFactory(service.getName(), wireFactory); - externalService.setContextFactory(contextFactory); - } - - /** - * Returns true if an extending implementation can process the given binding element - */ - //protected abstract boolean handlesBindingType(Binding binding); - - /** - * Callback to create the specific <code>ContextFactory</code> type associated with the extending - * implementation - * - * @param externalService the external service being processed - */ - protected abstract ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceContextFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceContextFactory.java deleted file mode 100644 index 396da3d39e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceContextFactory.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.ExternalServiceContext; -import org.apache.tuscany.core.context.impl.ExternalServiceContextImpl; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * A template implementation that creates instances of {@link org.apache.tuscany.core.context.ExternalServiceContext} - * configured with the appropriate wire chains and bindings. This class is intended to be subclassed when - * contributing new bindings to the runtime. The subclass serves as a marker so the binding {@link org.apache.tuscany.core.builder.WireBuilder - * - * - * - * } - * responsible for setting the proper {@link org.apache.tuscany.core.wire.TargetInvoker} on the wire chains - * can be notified. - * - * @version $Rev$ $Date$ - */ -public abstract class ExternalServiceContextFactory implements ContextFactory<ExternalServiceContext> { - - private String name; - - private TargetWireFactory targetWireFactory; - - private ObjectFactory objectFactory; - - private String targetServiceName; - - private Map<String, TargetWireFactory> targetProxyFactories; - - public ExternalServiceContextFactory(String name, ObjectFactory objectFactory) { - assert (name != null) : "Name was null"; - assert (objectFactory != null) : "Object factory was null"; - this.name = name; - this.objectFactory = objectFactory; - } - - public ExternalServiceContext createContext() throws ContextCreationException { - return new ExternalServiceContextImpl(name, targetWireFactory, objectFactory); - } - - public Scope getScope() { - return Scope.MODULE; - } - - public String getName() { - return name; - } - - public void prepare() { - } - - public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { - assert (serviceName != null) : "No service name specified"; - assert (factory != null) : "Proxy factory was null"; - this.targetServiceName = serviceName; // external services are configured with only one service - this.targetWireFactory = factory; - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - if (this.targetServiceName.equals(serviceName)) { - return targetWireFactory; - } else { - return null; - } - } - - public Map<String,TargetWireFactory> getTargetWireFactories() { - if (targetProxyFactories == null) { - targetProxyFactories = new HashMap<String, TargetWireFactory> (1); - targetProxyFactories.put(targetServiceName, targetWireFactory); - } - return targetProxyFactories; - } - - public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { - throw new UnsupportedOperationException(); - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity) { - - } - - public List<SourceWireFactory> getSourceWireFactories() { - return Collections.emptyList(); - } - - public void addProperty(String propertyName, Object value) { - throw new UnsupportedOperationException(); - } - - public void prepare(CompositeContext parent) { - //parentContext = parent; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceInvoker.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceInvoker.java deleted file mode 100644 index 0424bf5de6..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceInvoker.java +++ /dev/null @@ -1,23 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.core.extension;
-
-public interface ExternalServiceInvoker {
-
- public Object invoke(String methodName, Object[] args);
-
-}
diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceTargetInvoker.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceTargetInvoker.java deleted file mode 100644 index 0d664e0207..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceTargetInvoker.java +++ /dev/null @@ -1,122 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.core.extension;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.core.context.Context;
-import org.apache.tuscany.core.context.ExternalServiceContext;
-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.message.Message;
-import org.apache.tuscany.core.wire.Interceptor;
-import org.apache.tuscany.core.wire.TargetInvoker;
-
-/**
- * Responsible for invoking an external service
- *
- * @version $Rev$ $Date$
- */
-public class ExternalServiceTargetInvoker implements TargetInvoker {
-
- private QualifiedName serviceName;
-
- private String esName;
-
- private Method method;
-
- private ScopeContext container;
-
- private ExternalServiceContext context;
-
- /**
- * Constructs a new ExternalWebServiceTargetInvoker.
- *
- * @param container
- */
- public ExternalServiceTargetInvoker(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) {
- Context 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;
- }
-
- ExternalServiceInvoker invoker = (ExternalServiceInvoker) context.getHandler();
- if (payload != null) {
- return doInvoke(invoker, (Object[]) payload);
- } else {
- return doInvoke(invoker, null);
- }
- }
-
- protected Object doInvoke(ExternalServiceInvoker invoker, Object[] args) {
- return invoker.invoke(method.getName(), args);
- }
-
- 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() throws CloneNotSupportedException {
- try {
- ExternalServiceTargetInvoker invoker = (ExternalServiceTargetInvoker) 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) {
- // will not happen
- return null;
- }
- }
-
-}
diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java deleted file mode 100644 index 5b2d9de0e3..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.osoa.sca.annotations.Init; - -/** - * A base class for {@link WireBuilder} implementations - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class WireBuilderSupport<T extends ContextFactory<?>> implements WireBuilder { - - protected RuntimeContext runtimeContext; - protected Class targetClass; - - @Autowire - public void setRuntimeContext(RuntimeContext context) { - runtimeContext = context; - } - - public WireBuilderSupport() { - // reflect the generic type of the subclass - Type type = this.getClass().getGenericSuperclass(); - if (type instanceof ParameterizedType) { - targetClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; - } else { - throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); - } - } - - @Init(eager = true) - public void init() throws Exception { - runtimeContext.addBuilder(this); - } - - public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) throws BuilderConfigException { - if (!targetClass.isAssignableFrom(targetType)) { - return; - } - - for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration().getInvocationConfigurations() - .values()) { - TargetInvoker invoker = createInvoker(sourceFactory.getConfiguration() - .getTargetName(), sourceInvocationConfig.getMethod(), targetScopeContext, downScope); - sourceInvocationConfig.setTargetInvoker(invoker); - } - } - - public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) - throws BuilderConfigException { - - if (!targetClass.isAssignableFrom(targetType)) { - return; - } - for (TargetInvocationConfiguration targetInvocationConfig : targetFactory.getConfiguration().getInvocationConfigurations() - .values()) { - Method method = targetInvocationConfig.getMethod(); - TargetInvoker invoker = createInvoker(targetFactory.getConfiguration().getTargetName(), method, targetScopeContext, false); - targetInvocationConfig.setTargetInvoker(invoker); - } - } - - /** - * Callback to create the specific <code>TargetInvoker</code> type for dispatching to the target type - * - * @param targetName the fully qualified name of the wire target - * @param operation the operation the invoker will be associated with - * @param context the scope context that manages the target context - * @param downScope whether the wire source scope is "longer" than the target - */ - protected abstract TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/ImplementationProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/ImplementationProcessor.java deleted file mode 100644 index b464a7f00f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/ImplementationProcessor.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension.config; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.core.config.ConfigurationLoadException; - -/** - * Implementations process a Java class and contribute to a {@link org.apache.tuscany.model.assembly.ComponentType} - * or provide some validation function. Implementations may contribute to defined <code>ComponentType</code> - * metadata, a general <code>ComponentType</code> extensibility element, or a more specific Java extensibility - * element, which is associated with {@link org.apache.tuscany.core.extension.config.JavaExtensibilityElement} and - * stored in the <code>ComponentType</code>'s extensibility collection. Processors will typically use {@link - * JavaExtensibilityHelper#getExtensibilityElement(org.apache.tuscany.model.assembly.Extensible)}, which - * provides methods for retrieving the Java extensibility element. - * <p/> - * In the runtime, a {@link org.apache.tuscany.core.config.ComponentTypeIntrospector} system service introspects component implementation - * types when an assembly is loaded, calling out to registered processors in the order defined by {@link - * ComponentTypeIntrospector#introspect(Class<?>)}. Generally, processors are also system services which - * register themeselves with a <code>ComponentTypeIntrospector</code>. For convenience, a processor - * implementation can extend <@link org.apache.tuscany.core.config.processor.ImplementationProcessorSupport}, - * which provides mechanisms for doing this. - * <p/> - * There are a series of bootsrap, or primordial, processors configured in the runtime, and they serve as - * examples of how an <code>ImplementationProcessor</code> can be implemented. - * - * @see org.apache.tuscany.core.config.processor.PropertyProcessor - * @see org.apache.tuscany.core.config.processor.ReferenceProcessor - * @see org.apache.tuscany.core.config.processor.InitProcessor - * @see org.apache.tuscany.core.config.processor.DestroyProcessor - * @see org.apache.tuscany.core.config.processor.ComponentNameProcessor - * - * @version $$Rev$$ $$Date$$ - * @see org.apache.tuscany.core.config.processor.ImplementationProcessorSupport - */ -public interface ImplementationProcessor { - - public void visitClass(Class<?> clazz, ComponentType type) throws ConfigurationLoadException; - - public void visitSuperClass(Class<?> clazz, ComponentType type) throws ConfigurationLoadException; - - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException; - - public void visitConstructor(Constructor<?> constructor, ComponentType type) throws ConfigurationLoadException; - - public void visitField(Field field, ComponentType type) throws ConfigurationLoadException; - - public void visitEnd(Class<?> clazz, ComponentType type) throws ConfigurationLoadException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/InjectorExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/InjectorExtensibilityElement.java deleted file mode 100644 index 50818d1ac0..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/InjectorExtensibilityElement.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension.config; - -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.injection.Injector; - -/** - * An extensiblity element which provides {@link Injector}s based on component type metadata - * - * @version $$Rev$$ $$Date$$ - */ -public interface InjectorExtensibilityElement extends JavaExtensibilityElement { - - /** - * Creates an injector - * @param resolver that returns the current composite context - */ - public Injector<?> getInjector(ContextResolver resolver); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/JavaExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/JavaExtensibilityElement.java deleted file mode 100644 index fba57d8254..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/JavaExtensibilityElement.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension.config; - -/** - * Serves as a marker for a metadata extensibility point. For example, {@link ImplementationProcessor}s may - * create extensibility elements which are responsible for implementing injection functionality prescribed by - * a Java source annotation. - * - * @version $$Rev$$ $$Date$$ - */ -public interface JavaExtensibilityElement { - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ComponentNameExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ComponentNameExtensibilityElement.java deleted file mode 100644 index e04ca34da6..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ComponentNameExtensibilityElement.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension.config.extensibility; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.extension.config.JavaExtensibilityElement; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class ComponentNameExtensibilityElement implements JavaExtensibilityElement { - - private Method method; - private Field field; - - public ComponentNameExtensibilityElement(Method m) { - method = m; - } - - public ComponentNameExtensibilityElement(Field f) { - field = f; - } - - public Injector<?> getEventInvoker(String name) { - if (method != null) { - return new MethodInjector(method, new SingletonObjectFactory<Object>(name)); - }else{ - return new FieldInjector(field, new SingletonObjectFactory<Object>(name)); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ContextExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ContextExtensibilityElement.java deleted file mode 100644 index 9099132e36..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ContextExtensibilityElement.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension.config.extensibility; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.extension.config.JavaExtensibilityElement; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.injection.ContextObjectFactory; -import org.apache.tuscany.core.builder.ContextResolver; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class ContextExtensibilityElement implements JavaExtensibilityElement { - - private Method method; - private Field field; - - public ContextExtensibilityElement(Method m) { - method = m; - } - - public ContextExtensibilityElement(Field f) { - field = f; - } - - public Injector<?> getInjector(ContextResolver resolver) { - if (method != null) { - return new MethodInjector(method, new ContextObjectFactory(resolver)); - } else { - return new FieldInjector(field, new ContextObjectFactory(resolver)); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/DestroyInvokerExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/DestroyInvokerExtensibilityElement.java deleted file mode 100644 index 9952f507b2..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/DestroyInvokerExtensibilityElement.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension.config.extensibility; - -import java.lang.reflect.Method; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class DestroyInvokerExtensibilityElement extends InvokerExtensibilityElement{ - - public DestroyInvokerExtensibilityElement(Method m) { - super(m); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InitInvokerExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InitInvokerExtensibilityElement.java deleted file mode 100644 index 4c542b4b5d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InitInvokerExtensibilityElement.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension.config.extensibility; - -import java.lang.reflect.Method; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class InitInvokerExtensibilityElement extends InvokerExtensibilityElement{ - - private boolean eager; - - public InitInvokerExtensibilityElement(Method m, boolean eager) { - super(m); - this.eager = eager; - } - - public boolean isEager() { - return eager; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InvokerExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InvokerExtensibilityElement.java deleted file mode 100644 index a87acd16cc..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InvokerExtensibilityElement.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension.config.extensibility; - -import java.lang.reflect.Method; - -import org.apache.tuscany.core.extension.config.JavaExtensibilityElement; -import org.apache.tuscany.core.injection.MethodEventInvoker; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class InvokerExtensibilityElement implements JavaExtensibilityElement { - - private Method method; - private MethodEventInvoker invoker; - - public InvokerExtensibilityElement(Method m) { - method = m; - } - - public MethodEventInvoker getEventInvoker() { - if (invoker == null) { - invoker = new MethodEventInvoker(method); - } - return invoker; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ContextObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ContextObjectFactory.java deleted file mode 100644 index 6facd25e59..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ContextObjectFactory.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.CompositeContext; - -/** - * An implementation of <code>ObjectFactory</code> that resolves the current parent context - * - * @version $Rev: 380903 $ $Date: 2006-02-25 00:53:26 -0800 (Sat, 25 Feb 2006) $ - */ -public class ContextObjectFactory implements ObjectFactory<CompositeContext> { - - private final ContextResolver resolver; - - public ContextObjectFactory(ContextResolver resolver) { - assert (resolver != null) : "Resolver cannot be null"; - this.resolver = resolver; - } - - public CompositeContext getInstance() { - return resolver.getCurrentContext(); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java deleted file mode 100644 index 6f5de43b96..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -/** - * Performs an wire on an instance - * - * @version $Rev$ $Date$ - * @see MethodEventInvoker - */ -public interface EventInvoker<T> { - - /** - * Performs the wire on a given instance - * - * @throws ObjectCallbackException - */ - void invokeEvent(T instance) throws ObjectCallbackException; -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FactoryInitException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FactoryInitException.java deleted file mode 100644 index 589ae796ac..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FactoryInitException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -/** - * Denotes an exception initializing an object factory - * - * @version $Rev$ $Date$ - */ -public class FactoryInitException extends InjectionRuntimeException { - - public FactoryInitException(String message, Throwable cause) { - super(message, cause); - } - - public FactoryInitException(String message) { - super(message); - } - - public FactoryInitException(Throwable cause) { - super(cause); - } - - public FactoryInitException() { - super(); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java deleted file mode 100644 index 7be73462d3..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -import org.apache.tuscany.core.builder.ObjectFactory; - -import java.lang.reflect.Field; - -/** - * Injects a value created by an {@link ObjectFactory} on a given field - * - * @version $Rev$ $Date$ - */ -public class FieldInjector<T> implements Injector<T> { - - private final Field field; - - private final ObjectFactory<?> objectFactory; - - /** - * Create an injector and have it use the given <code>ObjectFactory</code> - * to inject a value on the instance using the reflected <code>Field</code> - */ - public FieldInjector(Field field, ObjectFactory<?> objectFactory) { - this.field = field; - this.objectFactory = objectFactory; - } - - /** - * Inject a new value on the given isntance - */ - public void inject(T instance) throws ObjectCreationException { - try { - field.set(instance, objectFactory.getInstance()); - } catch (IllegalAccessException e) { - throw new AssertionError("Field is not accessible [" + field + "]"); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java deleted file mode 100644 index 2c26f3c4b1..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -import org.apache.tuscany.common.TuscanyRuntimeException; - -/** - * Root unchecked exception for the injection package - * - * @version $Rev$ $Date$ - */ -public abstract class InjectionRuntimeException extends TuscanyRuntimeException { - - public InjectionRuntimeException() { - super(); - } - - public InjectionRuntimeException(String message) { - super(message); - } - - public InjectionRuntimeException(String message, Throwable cause) { - super(message, cause); - } - - public InjectionRuntimeException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/Injector.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/Injector.java deleted file mode 100644 index 306dab3e98..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/Injector.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -/** - * Implementations inject a pre-configured value on an instance - * - * @version $Rev$ $Date$ - * @see MethodInjector - * @see FieldInjector - */ -public interface Injector<T> { - - /** - * Inject a value on the given instance - */ - void inject(T instance) throws ObjectCreationException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InterCompositeReferenceFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InterCompositeReferenceFactory.java deleted file mode 100644 index 55d8a88790..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InterCompositeReferenceFactory.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.injection; - -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.TargetException; - -/** - * Returns a direct reference to a target service exposed in another composite, i.e. the factory avoids creating proxies - * and returns the actual target instance - * - * @version $Rev: 384135 $ $Date: 2006-03-07 22:53:58 -0800 (Tue, 07 Mar 2006) $ - */ -public class InterCompositeReferenceFactory<T> implements ObjectFactory<T> { - - private ContextResolver resolver; - - private QualifiedName targetQualifiedName; - - /** - * Reference source is an external service, target is in another module - * - * @param targetName the name of the target service - */ - public InterCompositeReferenceFactory(String targetName) { - targetQualifiedName = new QualifiedName(targetName); - } - - public void setContextResolver(ContextResolver resolver){ - this.resolver = resolver; - } - - public T getInstance() throws ObjectCreationException { - // only return entry points since this is an inter-module wire - Object o = resolver.getCurrentContext().getInstance(targetQualifiedName); - if (o != null) { - return (T) o; - } else { - // walk up the hierarchy of composite contexts - CompositeContext ctx = resolver.getCurrentContext(); - do { - if (ctx == null) { - break; // reached top of context hierarchy - } - Context compContext = ctx.getContext(targetQualifiedName.getPartName()); - if (compContext != null) { - o = compContext.getInstance(targetQualifiedName); - if (o != null) { - return (T) o; - } - } - ctx = ctx.getParent(); - } while (ctx != null); - TargetException e = new TargetException("Target reference not found"); - e.setIdentifier(targetQualifiedName.getQualifiedName()); - throw e; - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.java deleted file mode 100644 index bed7db887a..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -import javax.naming.Context; -import javax.naming.NamingException; - -import org.apache.tuscany.core.builder.ObjectFactory; - -/** - * An implementation of ObjectFactory that creates instances - * by looking them up in a JNDI context. - * - * @version $Rev$ $Date$ - */ -public class JNDIObjectFactory<T> implements ObjectFactory<T> { - private final Context context; - private final String name; - - public JNDIObjectFactory(Context context, String name) { - this.context = context; - this.name = name; - } - - public T getInstance() throws ObjectCreationException { - try { - return (T) context.lookup(name); - } catch (NamingException e) { - throw new ObjectCreationException(e); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java deleted file mode 100644 index 69c7670c03..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * Performs an wire on a method of a given instance - * - * @version $Rev$ $Date$ - */ -public class MethodEventInvoker<T> implements EventInvoker<T> { - private final Method method; - - /** - * Intantiates an invoker for the given method - */ - public MethodEventInvoker(Method method) { - this.method = method; - } - - public void invokeEvent(T instance) throws ObjectCallbackException { - try { - method.invoke(instance, (Object[]) null); - } catch (IllegalAccessException e) { - throw new AssertionError("Method is not accessible [" + method + "]"); - } catch (InvocationTargetException e) { - throw new ObjectCallbackException("Exception thrown by callback method [" + method + "]", e); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java deleted file mode 100644 index 6095061872..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -import org.apache.tuscany.core.builder.ObjectFactory; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * Injects a value created by an {@link ObjectFactory} using a given method - * @version $Rev$ $Date$ - */ -public class MethodInjector<T> implements Injector<T> { - private final Method method; - private final ObjectFactory<?> objectFactory; - - public MethodInjector(Method method, ObjectFactory<?> objectFactory) { - this.method = method; - this.objectFactory = objectFactory; - } - - public void inject(T instance) throws ObjectCreationException { - try { - method.invoke(instance, objectFactory.getInstance()); - } catch (IllegalAccessException e) { - throw new AssertionError("Method is not accessible [" + method + "]"); - } catch (InvocationTargetException e) { - ObjectCreationException oce= new ObjectCreationException("Exception thrown by setter", e); - oce.setIdentifier(method.getName()); - throw oce; - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NonProxiedTargetFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NonProxiedTargetFactory.java deleted file mode 100644 index 7f7a307433..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NonProxiedTargetFactory.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.injection; - -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.model.assembly.ConfiguredService; - -/** - * Returns a direct reference to a target within the same composite, i.e. the factory avoids creating proxies and - * returns the actual target instance - * - * @version $Rev$ $Date$ - */ -public class NonProxiedTargetFactory<T> implements ObjectFactory<T> { - - private ContextResolver resolver; - - // the name of the target component/service for this reference - private QualifiedName targetName; - private QualifiedName qualifiedServiceName; - - /** - * Constructs a reference object factory from a configured reference on a type - * - * @throws FactoryInitException - */ - public NonProxiedTargetFactory(ConfiguredService targetService, ContextResolver resolver) throws FactoryInitException { - assert (targetService != null) : "Target service was null"; - assert (resolver != null) : "Context resolver was null"; - - this.resolver = resolver; - targetName = new QualifiedName(targetService.getPart().getName()); - qualifiedServiceName = new QualifiedName("./"+targetName.getPortName()); - } - - public T getInstance() throws ObjectCreationException { - return (T) resolver.getCurrentContext().getContext(targetName.getPartName()).getInstance(qualifiedServiceName); //locateInstance(targetName); //locateInstance(targetName); - } - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NullEventInvoker.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NullEventInvoker.java deleted file mode 100644 index e8f109f2d8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NullEventInvoker.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -/** - * A no-op invoker - * - * @version $Rev$ $Date$ - */ -public final class NullEventInvoker<T> implements EventInvoker<T> { - public static final EventInvoker<?> NULL_INVOKER = new NullEventInvoker(); - - public void invokeEvent(T instance) { - // does nothing - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java deleted file mode 100644 index 44edee43eb..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -/** - * Denotes an error when invoking on an object - * - * @version $Rev$ $Date$ - */ -public class ObjectCallbackException extends InjectionRuntimeException { - - public ObjectCallbackException() { - super(); - } - - public ObjectCallbackException(String message) { - super(message); - } - - public ObjectCallbackException(String message, Throwable cause) { - super(message, cause); - } - - public ObjectCallbackException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCreationException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCreationException.java deleted file mode 100644 index 875eda3680..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCreationException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -/** - * Denotes an error creating a new object instance - * - * @version $Rev$ $Date$ - */ -public class ObjectCreationException extends InjectionRuntimeException { - - public ObjectCreationException() { - super(); - } - - public ObjectCreationException(String message) { - super(message); - } - - public ObjectCreationException(String message, Throwable cause) { - super(message, cause); - } - - public ObjectCreationException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java deleted file mode 100644 index fac8248b0c..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -import org.apache.tuscany.core.builder.ObjectFactory; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.Collections; -import java.util.List; - -/** - * Creates new instances of a Java class, calling a given set of injectors to configure the instance - * - * @version $Rev$ $Date$ - * @see Injector - */ -public class PojoObjectFactory<T> implements ObjectFactory<T> { - - private static final ObjectFactory[] NO_INIT_PARAM = {}; - - private static final List<Injector> NO_SETTER_PARAM = Collections.emptyList(); - - private final Constructor<T> ctr; - - private final ObjectFactory<?>[] initParamsArray; - - private final List<Injector> setters; - - public PojoObjectFactory(Constructor<T> ctr, List<ObjectFactory> initParams, List<Injector> setters) { - this.ctr = ctr; - if (initParams != null && initParams.size() > 0) { - initParamsArray = initParams.toArray(new ObjectFactory[initParams.size()]); - } else { - initParamsArray = NO_INIT_PARAM; - } - this.setters = setters != null ? setters : NO_SETTER_PARAM; - } - - public T getInstance() throws ObjectCreationException { - Object[] initargs = new Object[initParamsArray.length]; - // create the constructor arg array - for (int i = 0; i < initParamsArray.length; i++) { - ObjectFactory<?> objectFactory = initParamsArray[i]; - initargs[i] = objectFactory.getInstance(); - } - try { - T instance = ctr.newInstance(initargs); - // interate through the injectors and inject the instance - for (Injector<T> setter : setters) { - setter.inject(instance); - } - return instance; - } catch (InstantiationException e) { - throw new AssertionError("Class is not instantiable [" + ctr.getDeclaringClass().getName() + "]"); - } catch (IllegalAccessException e) { - throw new AssertionError("Constructor is not accessible [" + ctr + "]"); - } catch (InvocationTargetException e) { - throw new ObjectCreationException("Exception thrown by constructor [" + ctr + "]", e); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java deleted file mode 100644 index 8a7e0bf782..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.injection; - -import org.apache.tuscany.core.builder.ObjectFactory; - -/** - * Implementation of ObjectFactory that returns a single instance, typically an immutable type. - * - * @version $Rev$ $Date$ - */ -public class SingletonObjectFactory<T> implements ObjectFactory<T> { - private final T instance; - - public SingletonObjectFactory(T instance) { - this.instance = instance; - } - - public T getInstance() { - return instance; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/InvalidPropertyFactoryException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/InvalidPropertyFactoryException.java deleted file mode 100644 index 9ccbbb3a7a..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/InvalidPropertyFactoryException.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader; - -import org.apache.tuscany.core.config.ConfigurationLoadException; - -/** - * Exception raised if there is a problem configuring a PropertyFactory. - * - * @version $Rev$ $Date$ - */ -public class InvalidPropertyFactoryException extends ConfigurationLoadException { - private static final long serialVersionUID = 5017976138519117474L; - - /** - * Constructor indicating the cause why the property factory could not be created. - * - * @param className the name of the class that is intended to be the PropertyFactory - * @param cause the Throwable that prevented the PropertyFactory from being created - */ - public InvalidPropertyFactoryException(String className, Throwable cause) { - super(className, cause); - } - - /** - * Returns the name of the property factory implementation class. - * @return the name of the property factory implementation class - */ - public String getClassName() { - return getMessage(); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/LoaderContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/LoaderContext.java deleted file mode 100644 index cef7353bbf..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/LoaderContext.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation or its licensors as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader; - -import org.apache.tuscany.common.resource.ResourceLoader; - -/** - * Context holder that can be used during the load process to store information - * that is not part of the logical model. This should be regarded as transient - * and references to this context should not be stored inside the model. - * - * @version $Rev$ $Date$ - */ -public class LoaderContext { - private final ResourceLoader resourceLoader; - - /** - * Constructor specifying the loader for application resources. - * - * @param resourceLoader the loader for application resources - */ - public LoaderContext(ResourceLoader resourceLoader) { - this.resourceLoader = resourceLoader; - } - - /** - * Returns a resource loader that can be used to load application resources. - * @return a resource loader that can be used to load application resources - */ - public ResourceLoader getResourceLoader() { - return resourceLoader; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXElementLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXElementLoader.java deleted file mode 100644 index e1a9f55ca4..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXElementLoader.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.AssemblyObject; - -/** - * A loader that creates a model object from a StAX input stream. - * - * @version $Rev$ $Date$ - */ -public interface StAXElementLoader<T extends AssemblyObject> { - /** - * Build the model object for an element in an XML stream. - * When this method returns the stream will be positioned on the corresponding END_ELEMENT. - * - * @param reader the XML stream reader positioned on the applicable START_ELEMENT - * @param loaderContext the context for the load operation - * @return the model object for that element - */ - T load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException; -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXLoaderRegistry.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXLoaderRegistry.java deleted file mode 100644 index a38d388815..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXLoaderRegistry.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyObject; - -/** - * Registry for XML loaders that can parse a StAX input stream and return model objects. - * <p/> - * Loaders will typically be contributed to the system by any extension that needs to - * handle extension specific information contained in some XML configuration file. - * The loader can be contributed as a system component with an autowire reference - * to this registry which is used during initialization to actually register. - * </p> - * This registry can also be used to parse an input stream, dispatching to the - * appropriate loader for each element accepted. Loaders can call back to the - * registry to load sub-elements that they are not able to handle directly. - * - * @version $Rev$ $Date$ - */ -public interface StAXLoaderRegistry { - /** - * Register a loader. This operation will typically be called by a loader - * during its initialization. - * - * @param element the element that should be delegated to the contibuted loader - * @param loader a loader that is being contributed to the system - */ - <T extends AssemblyObject> void registerLoader(QName element, StAXElementLoader<T> loader); - - /** - * Unregister a loader. This will typically be called by a loader as it is being destroyed. - * - * @param element the element that was being delegated to the contibuted loader - * @param loader a loader that should no longer be used - */ - <T extends AssemblyObject> void unregisterLoader(QName element, StAXElementLoader<T> loader); - - /** - * Parse the supplied XML stream dispatching to the appropriate registered loader - * for each element encountered in the stream. - * <p/> - * This method must be called with the XML cursor positioned on a START_ELEMENT event. - * When this method returns, the stream will be positioned on the corresponding - * END_ELEMENT event. - * - * @param reader the XML stream to parse - * @param loaderContext - * @return the model object obtained by parsing the current element on the stream - * @throws XMLStreamException if there was a problem reading the stream - */ - AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException; - - /** - * Hack to allow loaders to initialize model objects on the fly. - * Remove when initialization has been moved from the model implementation to the loader. - * - * @return the model context for this load operation - */ - @Deprecated - AssemblyContext getContext(); - - /** - * Hack to allow loaders to initialize model objects on the fly. - * Remove when initialization has been moved from the model implementation to the loader. - * - * @param context the model context for this load operation - */ - @Deprecated - void setContext(AssemblyContext context); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXPropertyFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXPropertyFactory.java deleted file mode 100644 index a05597b51b..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXPropertyFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.Property; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -/** - * A factory that will create an ObjectFactory for a property by parsing a StAX XMLStreamReader. - * - * @version $Rev$ $Date$ - */ -public interface StAXPropertyFactory<T> { - /** - * Return an ObjectFactory for instances of a property defined in an XML stream. - * - * @param reader the reader to use to access the XML stream - * @param property the Property definition that the resulting ObjectFactory must be able to assign to - * @return an ObjectFactory that can produce instances that can be assigned to the supplied Property - * @throws XMLStreamException if there is a problem reading the stream - * @throws ConfigurationLoadException if there is a problem creating the ObjectFactory - */ - ObjectFactory<T> createObjectFactory(XMLStreamReader reader, Property property) throws XMLStreamException, ConfigurationLoadException; -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java deleted file mode 100644 index f9ac2b0559..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java +++ /dev/null @@ -1,160 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector; -import org.apache.tuscany.core.config.processor.ProcessorUtils; -import org.apache.tuscany.core.loader.assembly.ComponentLoader; -import org.apache.tuscany.core.loader.assembly.EntryPointLoader; -import org.apache.tuscany.core.loader.assembly.InterfaceJavaLoader; -import org.apache.tuscany.core.loader.assembly.ModuleFragmentLoader; -import org.apache.tuscany.core.loader.assembly.ModuleLoader; -import org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl; -import org.apache.tuscany.core.loader.impl.StringParserPropertyFactory; -import org.apache.tuscany.core.loader.system.SystemBindingLoader; -import org.apache.tuscany.core.loader.system.SystemImplementationLoader; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.SystemImplementation; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.OverrideOption; -import org.apache.tuscany.model.assembly.Scope; - -/** - * @version $Rev$ $Date$ - */ -public final class StAXUtil { - private static final Map<String, Multiplicity> MULTIPLICITY = new HashMap<String, Multiplicity>(4); - private static final Map<String, OverrideOption> OVERRIDE_OPTIONS = new HashMap<String, OverrideOption>(3); - - static { - MULTIPLICITY.put("0..1", Multiplicity.ZERO_ONE); - MULTIPLICITY.put("1..1", Multiplicity.ONE_ONE); - MULTIPLICITY.put("0..n", Multiplicity.ZERO_N); - MULTIPLICITY.put("1..n", Multiplicity.ONE_N); - - OVERRIDE_OPTIONS.put("no", OverrideOption.NO); - OVERRIDE_OPTIONS.put("may", OverrideOption.MAY); - OVERRIDE_OPTIONS.put("must", OverrideOption.MUST); - } - - private StAXUtil() { - } - - public static void skipToEndElement(XMLStreamReader reader) throws XMLStreamException { - int depth = 0; - while (true) { - int event = reader.next(); - if (event == XMLStreamConstants.START_ELEMENT) { - depth++; - } else if (event == XMLStreamConstants.END_ELEMENT) { - if (depth == 0) { - return; - } - depth--; - } - } - } - - public static Multiplicity multiplicity(String multiplicity, Multiplicity def) { - return multiplicity == null ? def : MULTIPLICITY.get(multiplicity); - } - - public static OverrideOption overrideOption(String overrideOption, OverrideOption def) { - return overrideOption == null ? def : OVERRIDE_OPTIONS.get(overrideOption); - } - - public static ModuleComponent bootstrapLoader(String name, AssemblyContext context) throws ConfigurationLoadException { - SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl(); - ComponentTypeIntrospector introspector = ProcessorUtils.createCoreIntrospector(factory); - Module module = factory.createModule(); - module.setName("org.apache.tuscany.core.system.loader"); - - List<Component> components = module.getComponents(); - - // bootstrap the minimal set of loaders needed to read the system module files - // all others should be defined in the system.module file - components.add(bootstrapLoader(factory, introspector, ModuleLoader.class)); - components.add(bootstrapLoader(factory, introspector, ModuleFragmentLoader.class)); - Component propFactory = factory.createSystemComponent("org.apache.tuscany.core.system.loader.DefaultPropertyFactory", StAXPropertyFactory.class, StringParserPropertyFactory.class, Scope.MODULE); - introspector.introspect(StAXPropertyFactory.class); - components.add(propFactory); - components.add(bootstrapLoader(factory, introspector, ComponentLoader.class)); - components.add(bootstrapLoader(factory, introspector, EntryPointLoader.class)); - components.add(bootstrapLoader(factory, introspector, InterfaceJavaLoader.class)); - components.add(bootstrapLoader(factory, introspector, SystemImplementationLoader.class)); - components.add(bootstrapLoader(factory, introspector, SystemBindingLoader.class)); - // do not add additional loaders above - they should be in the system.module file - - // bootstrap the registries needed by the bootstrap loaders above - bootstrapService(factory, introspector, module, StAXLoaderRegistry.class, StAXLoaderRegistryImpl.class); - bootstrapService(factory, introspector, module, SystemAssemblyFactory.class, SystemAssemblyFactoryImpl.class); - bootstrapService(factory, introspector, module, ComponentTypeIntrospector.class, Java5ComponentTypeIntrospector.class); - - ModuleComponent mc = factory.createModuleComponent(); - mc.setName(name); - mc.setImplementation(module); - mc.initialize(context); - return mc; - } - - private static Component bootstrapLoader(SystemAssemblyFactory factory, ComponentTypeIntrospector introspector, Class<?> loaderClass) { - SystemImplementation implementation = factory.createSystemImplementation(); - implementation.setImplementationClass(loaderClass); - try { - implementation.setComponentType(introspector.introspect(loaderClass)); - } catch (ConfigurationException e) { - throw (AssertionError) new AssertionError("Invalid bootstrap loader").initCause(e); - } - Component component = factory.createSimpleComponent(); - component.setName(loaderClass.getName()); - component.setImplementation(implementation); - return component; - } - - private static <T> void bootstrapService(SystemAssemblyFactory factory, ComponentTypeIntrospector introspector, Module module, Class<T> service, Class<? extends T> impl) { - String epName = service.getName(); - String compName = impl.getName(); - - Component component = factory.createSystemComponent(compName, service, impl, Scope.MODULE); - try { - component.getImplementation().setComponentType(introspector.introspect(impl)); - } catch (ConfigurationException e) { - throw (AssertionError) new AssertionError("Invalid bootstrap loader").initCause(e); - } - - EntryPoint entryPoint = factory.createSystemEntryPoint(epName, service, compName); - - module.getComponents().add(component); - module.getEntryPoints().add(entryPoint); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java deleted file mode 100644 index f88e0f0b35..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader; - -import java.net.URL; -import java.util.List; -import java.io.IOException; -import javax.wsdl.Definition; -import javax.wsdl.PortType; -import javax.wsdl.Service; -import javax.wsdl.WSDLException; -import javax.wsdl.extensions.ExtensionRegistry; -import javax.xml.namespace.QName; - -import org.apache.tuscany.common.resource.ResourceLoader; - -/** - * @version $Rev$ $Date$ - */ -public interface WSDLDefinitionRegistry { - /** - * Loads and registers a WSDL Definition. - * - * @param namespace the expected namespace, or null if any namespace should be allowed - * @param location the location to load the definition from - * @param resourceLoader the application resource loader - * @return the loaded Definition - * @throws IOException if there was a problem reading the document - * @throws WSDLException if there was a problem parsing the definition - */ - Definition loadDefinition(String namespace, URL location, ResourceLoader resourceLoader) throws IOException, WSDLException; - - /** - * Load and register a WSDL definition as specified in a WSDL2.0 wsdlLocation attribute. - * - * @param wsdlLocation the value of the wsdlLocation attribute - * @param resourceLoader application resource loader used to support relative locations - * @return the loaded Definition - * @throws IOException if there was a problem reading the document - * @throws WSDLException if there was a problem parsing the definition - */ - Definition loadDefinition(String wsdlLocation, ResourceLoader resourceLoader) throws IOException, WSDLException; - - /** - * Returns the PortType with the supplied qualified name, or null if no such port has been defined. - * - * @param name the qualified name of the WSDL portType - * @param resourceLoader the application resource loader - * @return the PortType for the supplied name, or null if none has been defined - */ - PortType getPortType(QName name, ResourceLoader resourceLoader); - - /** - * Returns the Service with the supplied qualified name, or null if no such service has been defined. - * - * @param name the qualified name of the WSDL service - * @param resourceLoader the application resource loader - * @return the Service for the supplied name, or null if none has been defined - */ - Service getService(QName name, ResourceLoader resourceLoader); - - - /** - * Returns a list of definitions that have been loaded for the given namespace, or null if - * no WSDL documents have been loaded for the given namespace - * - * @param namespace the namespace to lookup - * @param resourceLoader the application resource loader - * @return The list of definitions that have been loaded for the given namespace, or null - */ - List<Definition> getDefinitionsForNamespace(String namespace, ResourceLoader resourceLoader); - - - /** - * Returns the ExtensionRegistry that is used when parsing WSDL documents during the - * loadDefinition call. - * - * @return the ExtensionRegistry that is used when parsing WSDL documents. - */ - ExtensionRegistry getExtensionRegistry(); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AbstractLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AbstractLoader.java deleted file mode 100644 index fce343df4b..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AbstractLoader.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.core.loader.StAXElementLoader; -import org.apache.tuscany.core.loader.StAXLoaderRegistry; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; - -/** - * @version $Rev$ $Date$ - */ -public abstract class AbstractLoader<T extends AssemblyObject> implements StAXElementLoader<T> { - protected SystemAssemblyFactory factory; - protected StAXLoaderRegistry registry; - - @Autowire - public void setFactory(SystemAssemblyFactory factory) { - this.factory = factory; - } - - @Autowire - public void setRegistry(StAXLoaderRegistry registry) { - this.registry = registry; - } - - @Init(eager = true) - public void start() { - registry.registerLoader(getXMLType(), this); - } - - @Destroy - public void stop() { - registry.unregisterLoader(getXMLType(), this); - } - - /** - * Returns the QName of the element that this implementation handles. - * @return the QName of the element that this implementation handles - */ - protected abstract QName getXMLType(); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AssemblyConstants.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AssemblyConstants.java deleted file mode 100644 index 73ef4119f8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AssemblyConstants.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import javax.xml.namespace.QName; - -/** - * @version $Rev$ $Date$ - */ -public final class AssemblyConstants { - public static final String SCA_NAMESPACE = "http://www.osoa.org/xmlns/sca/0.9"; - - public static final QName COMPONENT = new QName(SCA_NAMESPACE, "component"); - public static final QName COMPONENT_TYPE = new QName(SCA_NAMESPACE, "componentType"); - public static final QName ENTRY_POINT = new QName(SCA_NAMESPACE, "entryPoint"); - public static final QName EXTERNAL_SERVICE = new QName(SCA_NAMESPACE, "externalService"); - public static final QName IMPORT_WSDL = new QName(SCA_NAMESPACE, "import.wsdl"); - public static final QName INTERFACE_JAVA = new QName(SCA_NAMESPACE, "interface.java"); - public static final QName INTERFACE_WSDL = new QName(SCA_NAMESPACE, "interface.wsdl"); - public static final QName MODULE = new QName(SCA_NAMESPACE, "module"); - public static final QName MODULE_FRAGMENT = new QName(SCA_NAMESPACE, "moduleFragment"); - public static final QName PROPERTY = new QName(SCA_NAMESPACE, "property"); - public static final QName PROPERTIES = new QName(SCA_NAMESPACE, "properties"); - public static final QName REFERENCE = new QName(SCA_NAMESPACE, "reference"); - public static final QName REFERENCES = new QName(SCA_NAMESPACE, "references"); - public static final QName SERVICE = new QName(SCA_NAMESPACE, "service"); - public static final QName WIRE = new QName(SCA_NAMESPACE, "wire"); - public static final QName WIRE_SOURCE = new QName(SCA_NAMESPACE, "source.uri"); - public static final QName WIRE_TARGET = new QName(SCA_NAMESPACE, "target.uri"); - - private AssemblyConstants() { - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentLoader.java deleted file mode 100644 index 0fa3e7ddeb..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentLoader.java +++ /dev/null @@ -1,189 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import java.util.List; -import javax.xml.namespace.QName; -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.InvalidPropertyFactoryException; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.loader.StAXPropertyFactory; -import org.apache.tuscany.core.loader.StAXUtil; -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.*; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.OverrideOption; -import org.apache.tuscany.model.assembly.Property; -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class ComponentLoader extends AbstractLoader { - private StAXPropertyFactory<?> defaultPropertyFactory; - - @Autowire - public void setDefaultPropertyFactory(StAXPropertyFactory<?> defaultPropertyFactory) { - this.defaultPropertyFactory = defaultPropertyFactory; - } - - public QName getXMLType() { - return COMPONENT; - } - - public Component load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert COMPONENT.equals(reader.getName()); - - Component component = factory.createSimpleComponent(); - component.setName(reader.getAttributeValue(null, "name")); - - while (true) { - switch (reader.next()) { - case START_ELEMENT: - QName name = reader.getName(); - if (PROPERTIES.equals(name)) { - loadProperties(reader, loaderContext.getResourceLoader(), component); - } else if (REFERENCES.equals(name)) { - loadReferences(reader, component); - } else { - AssemblyObject o = registry.load(reader, loaderContext); - if (o instanceof Implementation) { - Implementation impl = (Implementation) o; - impl.initialize(registry.getContext()); - component.setImplementation(impl); - } - } - reader.next(); - break; - case END_ELEMENT: - List<Property> props = component.getImplementation().getComponentType().getProperties(); - for (Property property : props) { - if (property.isRequired()) { - if (component.getConfiguredProperty(property.getName()) == null) { - ConfigurationLoadException e = new ConfigurationLoadException("Required property not configured"); - e.setIdentifier(property.getName()); - throw e; - } - } - } - return component; - } - } - } - - protected void loadProperties(XMLStreamReader reader, ResourceLoader resourceLoader, Component<?> component) throws XMLStreamException, ConfigurationLoadException { - ComponentType componentType = component.getImplementation().getComponentType(); - List<ConfiguredProperty> configuredProperties = component.getConfiguredProperties(); - - while (true) { - switch (reader.next()) { - case START_ELEMENT: - String name = reader.getLocalName(); - Property property = componentType.getProperty(name); - if (property == null) { - throw new ConfigurationLoadException(name); - } - OverrideOption override = StAXUtil.overrideOption(reader.getAttributeValue(null, "override"), OverrideOption.NO); - -// get a factory for the property - StAXPropertyFactory<?> propertyFactory; - String factoryName = reader.getAttributeValue(null, "factory"); - if (factoryName == null) { - propertyFactory = defaultPropertyFactory; - } else { - propertyFactory = getPropertyFactory(factoryName, resourceLoader); - } - - // create the property value - // FIXME to support complex types we probably should store the factory in the ConfiguredProperty - // FIXME instead of the value as the value may be mutable and should not be shared between instances - ObjectFactory<?> objectFactory = propertyFactory.createObjectFactory(reader, property); - Object value = objectFactory.getInstance(); - - // create the configured property definition - ConfiguredProperty configuredProperty = factory.createConfiguredProperty(); - configuredProperty.setName(name); - configuredProperty.setValue(value); - configuredProperty.setOverrideOption(override); - configuredProperties.add(configuredProperty); - break; - case END_ELEMENT: - return; - } - } - } - - protected StAXPropertyFactory<?> getPropertyFactory(String factoryName, ResourceLoader resourceLoader) throws InvalidPropertyFactoryException { - Class<?> impl; - try { - // try to load factory from application classloader - impl = resourceLoader.loadClass(factoryName); - } catch (ClassNotFoundException e) { - try { - // try to load factory from container classloader - impl = Class.forName(factoryName); - } catch (ClassNotFoundException e1) { - throw new InvalidPropertyFactoryException(factoryName, e); - } - } - try { - return (StAXPropertyFactory<?>) impl.newInstance(); - } catch (InstantiationException e) { - throw new InvalidPropertyFactoryException(factoryName, e); - } catch (IllegalAccessException e) { - throw new InvalidPropertyFactoryException(factoryName, e); - } catch (ClassCastException e) { - throw new InvalidPropertyFactoryException(factoryName, e); - } - } - - protected void loadReferences(XMLStreamReader reader, Component<?> component) throws XMLStreamException { - List<ConfiguredReference> configuredReferences = component.getConfiguredReferences(); - while (true) { - switch (reader.next()) { - case START_ELEMENT: - String name = reader.getLocalName(); - String uri = reader.getElementText(); - - ConfiguredReference configuredReference = component.getConfiguredReference(name); - if (configuredReference == null) { - configuredReference = factory.createConfiguredReference(); - configuredReference.setName(name); - configuredReferences.add(configuredReference); - } - - configuredReference.getTargets().add(uri); - break; - case END_ELEMENT: - return; - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoader.java deleted file mode 100644 index fdb8893830..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoader.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.COMPONENT_TYPE; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.osoa.sca.annotations.Scope; - -import javax.xml.namespace.QName; -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class ComponentTypeLoader extends AbstractLoader { - public QName getXMLType() { - return COMPONENT_TYPE; - } - - public ComponentType load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert COMPONENT_TYPE.equals(reader.getName()); - ComponentType componentType = factory.createComponentType(); - - while (true) { - switch (reader.next()) { - case START_ELEMENT: - AssemblyObject o = registry.load(reader, loaderContext); - if (o instanceof Service) { - componentType.getServices().add((Service) o); - } else if (o instanceof Reference) { - componentType.getReferences().add((Reference) o); - } else if (o instanceof Property) { - componentType.getProperties().add((Property) o); - } - break; - case END_ELEMENT: - return componentType; - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/CompositeLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/CompositeLoader.java deleted file mode 100644 index 9b22a24784..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/CompositeLoader.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.Composite; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.ImportWSDL; -import org.apache.tuscany.model.assembly.Wire; - -/** - * @version $Rev$ $Date$ - */ -public abstract class CompositeLoader extends AbstractLoader { - public void loadComposite(XMLStreamReader reader, Composite composite, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - composite.setName(reader.getAttributeValue(null, "name")); - while (true) { - switch (reader.next()) { - case START_ELEMENT: - AssemblyObject o = registry.load(reader, loaderContext); - if (o instanceof EntryPoint) { - composite.getEntryPoints().add((EntryPoint) o); - } else if (o instanceof ExternalService) { - composite.getExternalServices().add((ExternalService) o); - } else if (o instanceof Component) { - composite.getComponents().add((Component) o); - } else if (o instanceof Wire) { - composite.getWires().add((Wire) o); - } else if (o instanceof ImportWSDL) { - composite.getWSDLImports().add((ImportWSDL) o); - } - reader.next(); - break; - case END_ELEMENT: - return; - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/EntryPointLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/EntryPointLoader.java deleted file mode 100644 index 14b60964d5..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/EntryPointLoader.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.StAXUtil; -import org.apache.tuscany.core.loader.LoaderContext; -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.ENTRY_POINT; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.osoa.sca.annotations.Scope; - -import javax.xml.namespace.QName; -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class EntryPointLoader extends AbstractLoader { - public QName getXMLType() { - return ENTRY_POINT; - } - - public EntryPoint load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert ENTRY_POINT.equals(reader.getName()); - EntryPoint entryPoint = factory.createEntryPoint(); - String name = reader.getAttributeValue(null, "name"); - entryPoint.setName(name); - - Service service = factory.createService(); - service.setName(name); - ConfiguredService configuredService = factory.createConfiguredService(); - configuredService.setPort(service); - entryPoint.setConfiguredService(configuredService); - - Reference reference = factory.createReference(); - reference.setMultiplicity(StAXUtil.multiplicity(reader.getAttributeValue(null, "multiplicity"), Multiplicity.ONE_ONE)); - ConfiguredReference configuredReference = factory.createConfiguredReference(); - configuredReference.setPort(reference); - entryPoint.setConfiguredReference(configuredReference); - - while (true) { - switch (reader.next()) { - case START_ELEMENT: - QName qname = reader.getName(); - if (AssemblyConstants.REFERENCE.equals(qname)) { - String uri = reader.getElementText(); - configuredReference.getTargets().add(uri); - } else { - AssemblyObject o = registry.load(reader, loaderContext); - if (o instanceof Binding) { - entryPoint.getBindings().add((Binding) o); - } else if (o instanceof ServiceContract) { - service.setServiceContract((ServiceContract) o); - reference.setServiceContract((ServiceContract) o); - } - } - reader.next(); - break; - case END_ELEMENT: - return entryPoint; - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoader.java deleted file mode 100644 index 4910c016d8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoader.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.StAXUtil; -import org.apache.tuscany.core.loader.LoaderContext; -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.EXTERNAL_SERVICE; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.OverrideOption; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.osoa.sca.annotations.Scope; - -import javax.xml.namespace.QName; -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class ExternalServiceLoader extends AbstractLoader { - public QName getXMLType() { - return EXTERNAL_SERVICE; - } - - public ExternalService load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert EXTERNAL_SERVICE.equals(reader.getName()); - String name = reader.getAttributeValue(null, "name"); - ExternalService externalService = factory.createExternalService(); - externalService.setName(name); - externalService.setOverrideOption(StAXUtil.overrideOption(reader.getAttributeValue(null, "overridable"), OverrideOption.NO)); - - while (true) { - switch (reader.next()) { - case START_ELEMENT: - AssemblyObject o = registry.load(reader, loaderContext); - if (o instanceof ServiceContract) { - Service service = factory.createService(); - service.setName(name); - service.setServiceContract((ServiceContract) o); - ConfiguredService configuredService = factory.createConfiguredService(); - configuredService.setPort(service); - externalService.setConfiguredService(configuredService); - } else if (o instanceof Binding) { - externalService.getBindings().add((Binding) o); - } - reader.next(); - break; - case END_ELEMENT: - return externalService; - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java deleted file mode 100644 index 6981f05372..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.IMPORT_WSDL; - -import java.io.IOException; -import java.net.URL; - -import javax.wsdl.Definition; -import javax.wsdl.WSDLException; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.MissingResourceException; -import org.apache.tuscany.core.config.SidefileLoadException; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.loader.StAXUtil; -import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.model.assembly.ImportWSDL; -import org.osoa.sca.annotations.Scope; - -/** - * Loader that handles <import.wsdl> elements. - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class ImportWSDLLoader extends AbstractLoader { - private WSDLDefinitionRegistry wsdlRegistry; - - @Autowire - public void setWsdlRegistry(WSDLDefinitionRegistry wsdlRegistry) { - this.wsdlRegistry = wsdlRegistry; - } - - public QName getXMLType() { - return IMPORT_WSDL; - } - - public ImportWSDL load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert AssemblyConstants.IMPORT_WSDL.equals(reader.getName()); - String namespace = reader.getAttributeValue(null, "namespace"); - String location = reader.getAttributeValue(null, "location"); - if (location == null) - location = reader.getAttributeValue(null, "wsdlLocation"); - ImportWSDL importWSDL = factory.createImportWSDL(location, namespace); - - Definition definition = loadDefinition(namespace, location, loaderContext.getResourceLoader()); -// importWSDL.setDefinition(definition); - - StAXUtil.skipToEndElement(reader); - return importWSDL; - } - - protected Definition loadDefinition(String namespace, String location, ResourceLoader resourceLoader) throws MissingResourceException, SidefileLoadException { - Definition definition; - URL wsdlURL = resourceLoader.getResource(location); - if (wsdlURL == null) { - throw new MissingResourceException(location); - } - - try { - definition = wsdlRegistry.loadDefinition(namespace, wsdlURL, resourceLoader); - } catch (IOException e) { - SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); - sfe.setResourceURI(location); - throw sfe; - } catch (WSDLException e) { - SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); - sfe.setResourceURI(location); - throw sfe; - } - - return definition; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceJavaLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceJavaLoader.java deleted file mode 100644 index 602cf2cc0a..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceJavaLoader.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -/** - * @version $Rev$ $Date$ - */ -@org.osoa.sca.annotations.Scope("MODULE") -public class InterfaceJavaLoader extends AbstractLoader { - public QName getXMLType() { - return AssemblyConstants.INTERFACE_JAVA; - } - - public JavaServiceContract load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert AssemblyConstants.INTERFACE_JAVA.equals(reader.getName()); - JavaServiceContract serviceContract = factory.createJavaServiceContract(); - serviceContract.setScope(Scope.INSTANCE); - serviceContract.setInterfaceName(reader.getAttributeValue(null, "interface")); - serviceContract.setCallbackInterfaceName(reader.getAttributeValue(null, "callbackInterface")); - return serviceContract; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoader.java deleted file mode 100644 index 9617cf805f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoader.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import java.io.IOException; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.MissingInterfaceException; -import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; -import org.apache.tuscany.core.loader.StAXUtil; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.wsdl.PortType; -import javax.wsdl.WSDLException; - -/** - * @version $Rev$ $Date$ - */ -@org.osoa.sca.annotations.Scope("MODULE") -public class InterfaceWSDLLoader extends AbstractLoader { - private static final String WSDLI = "http://www.w3.org/2006/01/wsdl-instance"; - private static final String WSDLI_LOCATION = "wsdlLocation"; - - private WSDLDefinitionRegistry wsdlRegistry; - - @Autowire - public void setWsdlRegistry(WSDLDefinitionRegistry wsdlRegistry) { - this.wsdlRegistry = wsdlRegistry; - } - - public QName getXMLType() { - return AssemblyConstants.INTERFACE_WSDL; - } - - public WSDLServiceContract load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert AssemblyConstants.INTERFACE_WSDL.equals(reader.getName()); - WSDLServiceContract serviceContract = factory.createWSDLServiceContract(); - serviceContract.setScope(Scope.INSTANCE); - - ResourceLoader resourceLoader = loaderContext.getResourceLoader(); - - String location = reader.getAttributeValue(WSDLI, WSDLI_LOCATION); - if (location != null) { - try { - wsdlRegistry.loadDefinition(location, resourceLoader); - } catch (IOException e) { - throw new MissingInterfaceException(e); - } catch (WSDLException e) { - throw new MissingInterfaceException(e); - } - } - - String portTypeURI = reader.getAttributeValue(null, "interface"); - if (portTypeURI != null) { - serviceContract.setPortType(getPortType(portTypeURI, resourceLoader)); - } - - portTypeURI = reader.getAttributeValue(null, "callbackInterface"); - if (portTypeURI != null) { - serviceContract.setCallbackPortType(getPortType(portTypeURI, resourceLoader)); - } - StAXUtil.skipToEndElement(reader); - return serviceContract; - } - - protected PortType getPortType(String uri, ResourceLoader resourceLoader) throws MissingInterfaceException { - - // We currently support two syntaxes for specifying a WSDL portType: - // namespace#portTypeName, this is what we supported in the initial contribution, we will - // deprecate this after M1 - // namespace#wsdl.interface(portTypeName), this is the WSDL 2.0 syntax - - int index = uri.indexOf('#'); - String namespace = uri.substring(0, index); - String fragment = uri.substring(index + 1); - String localName; - if (fragment.startsWith("wsdl.interface(") && fragment.endsWith(")")) { - localName = fragment.substring(15, fragment.length()-1); - } else { - localName = fragment; - } - QName qname = new QName(namespace, localName); - PortType portType = wsdlRegistry.getPortType(qname, resourceLoader); - if (portType == null) { - throw new MissingInterfaceException(uri); - } - return portType; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleFragmentLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleFragmentLoader.java deleted file mode 100644 index 4b3e96cfab..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleFragmentLoader.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.model.assembly.ModuleFragment; -import org.osoa.sca.annotations.Scope; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class ModuleFragmentLoader extends CompositeLoader { - public QName getXMLType() { - return AssemblyConstants.MODULE_FRAGMENT; - } - - public ModuleFragment load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - ModuleFragment fragment = factory.createModuleFragment(); - loadComposite(reader, fragment, loaderContext); - return fragment; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleLoader.java deleted file mode 100644 index 08ab23b3a6..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleLoader.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; -import org.apache.tuscany.model.assembly.Module; -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class ModuleLoader extends CompositeLoader { - public QName getXMLType() { - return AssemblyConstants.MODULE; - } - - public Module load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - Module module = factory.createModule(); - loadComposite(reader, module, loaderContext); - // JFM Hack until recursive model in place - if (module.getName().startsWith("org.apache.tuscany.core.system")) { - module.setImplementationClass(SystemCompositeContextImpl.class); - } else { - module.setImplementationClass(CompositeContextImpl.class); - } - return module; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/PropertyLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/PropertyLoader.java deleted file mode 100644 index cbf1ca00df..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/PropertyLoader.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.StAXUtil; -import org.apache.tuscany.core.loader.LoaderContext; -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.PROPERTY; -import org.apache.tuscany.model.assembly.Property; -import org.osoa.sca.annotations.Scope; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import java.util.HashMap; -import java.util.Map; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class PropertyLoader extends AbstractLoader { - private static final String XSD = "http://www.w3.org/2001/XMLSchema"; - - private static final Map<QName, Class<?>> TYPE_MAP; - static { - // todo support more XSD types, or remove if we store the QName - TYPE_MAP = new HashMap<QName, Class<?>>(17); - TYPE_MAP.put(new QName(XSD, "string"), String.class); - } - - public QName getXMLType() { - return PROPERTY; - } - - public Property load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert PROPERTY.equals(reader.getName()); - Property property = factory.createProperty(); - property.setName(reader.getAttributeValue(null, "name")); - String typeName = reader.getAttributeValue(null, "type"); - // support XSD type or Java class name - // todo perhaps we should just store the QName for the PropertyFactory to use - int index = typeName.indexOf(':'); - if (index != -1) { - String prefix = typeName.substring(0, index); - String namespaceURI = reader.getNamespaceURI(prefix); - QName qname = new QName(namespaceURI, typeName.substring(index+1)); - property.setType(TYPE_MAP.get(qname)); - } else { - try { - Class<?> type = loaderContext.getResourceLoader().loadClass(typeName); - property.setType(type); - } catch (ClassNotFoundException e) { - throw new ConfigurationLoadException(e); - } - } - property.setMany(Boolean.parseBoolean(reader.getAttributeValue(null, "many"))); - property.setDefaultValue(reader.getAttributeValue(null, "default")); - String required = reader.getAttributeValue(null, "required"); - property.setRequired(required != null && Boolean.valueOf(required)); - - StAXUtil.skipToEndElement(reader); - return property; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ReferenceLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ReferenceLoader.java deleted file mode 100644 index aa95210757..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ReferenceLoader.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.StAXUtil; -import org.apache.tuscany.core.loader.LoaderContext; -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.REFERENCE; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.osoa.sca.annotations.Scope; - -import javax.xml.namespace.QName; -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class ReferenceLoader extends AbstractLoader { - public QName getXMLType() { - return REFERENCE; - } - - public Reference load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert REFERENCE.equals(reader.getName()); - Reference reference = factory.createReference(); - reference.setName(reader.getAttributeValue(null, "name")); - reference.setMultiplicity(StAXUtil.multiplicity(reader.getAttributeValue(null, "multiplicity"), Multiplicity.ONE_ONE)); - - while (true) { - switch (reader.next()) { - case START_ELEMENT: - AssemblyObject o = registry.load(reader, loaderContext); - if (o instanceof ServiceContract) { - reference.setServiceContract((ServiceContract) o); - } - reader.next(); - break; - case END_ELEMENT: - return reference; - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ServiceLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ServiceLoader.java deleted file mode 100644 index 9cb31b55ff..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ServiceLoader.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.SERVICE; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.osoa.sca.annotations.Scope; - -import javax.xml.namespace.QName; -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class ServiceLoader extends AbstractLoader { - public QName getXMLType() { - return SERVICE; - } - - public Service load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert SERVICE.equals(reader.getName()); - Service service = factory.createService(); - service.setName(reader.getAttributeValue(null, "name")); - - while (true) { - switch (reader.next()) { - case START_ELEMENT: - AssemblyObject o = registry.load(reader, loaderContext); - if (o instanceof ServiceContract) { - service.setServiceContract((ServiceContract) o); - } - reader.next(); - break; - case END_ELEMENT: - return service; - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/WireLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/WireLoader.java deleted file mode 100644 index 0ae3c4405d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/WireLoader.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import java.util.HashMap; -import java.util.Map; -import javax.xml.namespace.QName; -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.model.assembly.Wire; -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class WireLoader extends AbstractLoader { - private static final String XSD = "http://www.w3.org/2001/XMLSchema"; - - private static final Map<QName, Class<?>> TYPE_MAP; - - static { - // todo support more XSD types, or remove if we store the QName - TYPE_MAP = new HashMap<QName, Class<?>>(17); - TYPE_MAP.put(new QName(XSD, "string"), String.class); - } - - public QName getXMLType() { - return AssemblyConstants.WIRE; - } - - public Wire load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert AssemblyConstants.WIRE.equals(reader.getName()); - Wire wire = factory.createWire(); - while (true) { - switch (reader.next()) { - case START_ELEMENT: - QName qname = reader.getName(); - if (AssemblyConstants.WIRE_SOURCE.equals(qname)) { - String uri = reader.getElementText(); - int pos = uri.indexOf('/'); - if (pos < 1) { - throw new ConfigurationLoadException("Invalid source wire"); - } - String partName = uri.substring(0, pos); - String portName = uri.substring(pos + 1); - wire.setSource(factory.createServiceURI(null, partName, portName)); - } else if (AssemblyConstants.WIRE_TARGET.equals(qname)) { - String uri = reader.getElementText(); - int pos = uri.indexOf('/'); - if (pos < 1) { - wire.setTarget(factory.createServiceURI(null, uri)); - }else{ - String partName = uri.substring(0, pos); - String portName = uri.substring(pos + 1); - wire.setTarget(factory.createServiceURI(null, partName, portName)); - } - } - break; - case END_ELEMENT: - return wire; - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/JNDIPropertyFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/JNDIPropertyFactory.java deleted file mode 100644 index 763c88295c..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/JNDIPropertyFactory.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.impl; - -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamException; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; - -import org.apache.tuscany.core.loader.StAXPropertyFactory; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.injection.JNDIObjectFactory; -import org.apache.tuscany.model.assembly.Property; - -/** - * A StAXPropertyFactory that creates property values by looking them - * up in the default JNDI InitialContext. - * - * This can be used to locate resources in a J2EE environment and inject - * them as configuration properties. For example, to access a database - * a component could write: - * <code> - * &at;Property DataSource myDB; - * </code> - * and configure with - * <code> - * <properties> - * <v:myDb>java:comp/env/jdbc/MyDatabase</v:myDB> - * </properties> - * </code> - * - * @version $Rev$ $Date$ - */ -public class JNDIPropertyFactory implements StAXPropertyFactory { - public ObjectFactory<?> createObjectFactory(XMLStreamReader reader, Property property) throws XMLStreamException, ConfigurationLoadException { - Class<?> type = property.getType(); - assert type != null : "property type is null"; - String text = reader.getElementText(); - try { - Context context = new InitialContext(); - return new JNDIObjectFactory(context, text); - } catch (NamingException e) { - throw new ConfigurationLoadException(e); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StAXLoaderRegistryImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StAXLoaderRegistryImpl.java deleted file mode 100644 index 1e9e8ec8fb..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StAXLoaderRegistryImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.impl; - -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.loader.LoaderContext; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.osoa.sca.annotations.Scope; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import java.util.HashMap; -import java.util.Map; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class StAXLoaderRegistryImpl implements StAXLoaderRegistry { - private final Map<QName, StAXElementLoader<? extends AssemblyObject>> loaders = new HashMap<QName, StAXElementLoader<? extends AssemblyObject>>(); - - private Monitor monitor; - - @org.apache.tuscany.core.system.annotation.Monitor - public void setMonitor(Monitor monitor) { - this.monitor = monitor; - } - - public <T extends AssemblyObject> void registerLoader(QName element, StAXElementLoader<T> loader) { - monitor.registeringLoader(element); - loaders.put(element, loader); - } - - public <T extends AssemblyObject> void unregisterLoader(QName element, StAXElementLoader<T> loader) { - monitor.unregisteringLoader(element); - loaders.remove(element); - } - - public AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - QName name = reader.getName(); - monitor.elementLoad(name); - StAXElementLoader<? extends AssemblyObject> loader = loaders.get(name); - if (loader == null) { - ConfigurationLoadException e = new ConfigurationLoadException("Unrecognized element"); - e.setIdentifier(name.toString()); - throw e; - } else { - return loader.load(reader, loaderContext); - } - } - - - private final ThreadLocal<AssemblyContext> modelContext = new ThreadLocal<AssemblyContext>(); - - @Deprecated - public AssemblyContext getContext() { - return modelContext.get(); - } - - @Deprecated - public void setContext(AssemblyContext context) { - modelContext.set(context); - } - - public static interface Monitor { - /** - * Event emitted when a StAX element loader is registered. - * - * @param xmlType the QName of the element the loader will handle - */ - void registeringLoader(QName xmlType); - - /** - * Event emitted when a StAX element loader is unregistered. - * - * @param xmlType the QName of the element the loader will handle - */ - void unregisteringLoader(QName xmlType); - - /** - * Event emitted when a request is made to load an element. - * - * @param xmlType the QName of the element that should be loaded - */ - void elementLoad(QName xmlType); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StringParserPropertyFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StringParserPropertyFactory.java deleted file mode 100644 index 2ed33f895c..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StringParserPropertyFactory.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.impl; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.core.loader.StAXPropertyFactory; -import org.apache.tuscany.model.assembly.Property; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import java.beans.PropertyEditor; -import java.beans.PropertyEditorManager; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -@Service(interfaces = {StAXPropertyFactory.class}) -public class StringParserPropertyFactory implements StAXPropertyFactory { - public ObjectFactory<?> createObjectFactory(XMLStreamReader reader, Property property) throws XMLStreamException, ConfigurationLoadException { - Class<?> type = property.getType(); - assert type != null : "property type is null"; - String text = reader.getElementText(); - - // degenerate case where we are returning a String - if (String.class.equals(type)) { - return new SingletonObjectFactory(text); - } - - // special handler to convert hexBinary to a byte[] - if (byte[].class.equals(type)) { - byte[] instance = new byte[text.length() >> 1]; - for (int i = 0; i < instance.length; i++) { - instance[i] = (byte) (Character.digit(text.charAt(i << 1), 16) << 4 | Character.digit(text.charAt((i << 1) + 1), 16)); - } - return new SingletonObjectFactory(instance); - } - - // does this type have a static valueOf(String) method? - try { - Method valueOf = type.getMethod("valueOf", String.class); - if (Modifier.isStatic(valueOf.getModifiers())) { - try { - return new SingletonObjectFactory(valueOf.invoke(null, text)); - } catch (IllegalAccessException e) { - throw new AssertionError("getMethod returned an inaccessible method"); - } catch (InvocationTargetException e) { - // FIXME we should throw something better - throw new ConfigurationLoadException(e.getCause()); - } - } - } catch (NoSuchMethodException e) { - // try something else - } - - // does this type have a constructor that takes a String? - try { - Constructor<?> ctr = type.getConstructor(String.class); - return new SingletonObjectFactory(ctr.newInstance(text)); - } catch (NoSuchMethodException e) { - // try something else - } catch (IllegalAccessException e) { - throw new AssertionError("getConstructor returned an inaccessible method"); - } catch (InstantiationException e) { - throw new ConfigurationLoadException("Property type cannot be instantiated: " + type.getName()); - } catch (InvocationTargetException e) { - // FIXME we should throw something better - throw new ConfigurationLoadException(e.getCause()); - } - - // do we have a property editor for it? - PropertyEditor editor = PropertyEditorManager.findEditor(type); - if (editor != null) { - try { - editor.setAsText(text); - return new SingletonObjectFactory(editor.getValue()); - } catch (IllegalArgumentException e) { - // FIXME we should throw something better - throw new ConfigurationLoadException(e); - - } - } - - // FIXME we should throw something better - throw new ConfigurationLoadException("Do not have a way to parse a String into a " + type.getName()); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java deleted file mode 100644 index 1063dec3fc..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.impl; - -import java.io.IOException; -import java.net.URL; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.WeakHashMap; - -import javax.wsdl.Definition; -import javax.wsdl.PortType; -import javax.wsdl.Service; -import javax.wsdl.WSDLException; -import javax.wsdl.extensions.ExtensionRegistry; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; -import javax.xml.namespace.QName; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@org.osoa.sca.annotations.Service(interfaces = {WSDLDefinitionRegistry.class}) -@Scope("MODULE") -public class WSDLDefinitionRegistryImpl implements WSDLDefinitionRegistry { - private final WSDLFactory wsdlFactory; - private final ExtensionRegistry registry; - - private final Map<ResourceLoader,Map<URL, Definition>> definitionsByLocationByLoader = new WeakHashMap<ResourceLoader,Map<URL, Definition>>(); - private final Map<ResourceLoader,Map<String, List<Definition>>> definitionsByNamespaceByLoader = new WeakHashMap<ResourceLoader,Map<String, List<Definition>>>(); - - private Monitor monitor; - - public WSDLDefinitionRegistryImpl() throws WSDLException { - wsdlFactory = WSDLFactory.newInstance(); - registry = wsdlFactory.newPopulatedExtensionRegistry(); - } - - @org.apache.tuscany.core.system.annotation.Monitor - public void setMonitor(Monitor monitor) { - this.monitor = monitor; - } - - public ExtensionRegistry getExtensionRegistry() { - return registry; - } - - public Definition loadDefinition(String wsdlLocation, ResourceLoader resourceLoader) throws IOException, WSDLException { - int index = wsdlLocation.indexOf(' '); - if (index == -1) { - throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Invalid wsdlLocation: " + wsdlLocation); - } - String namespace = wsdlLocation.substring(0, index).trim(); - URL url; - URI uri; - try { - uri = new URI(wsdlLocation.substring(index + 1).trim()); - } catch (URISyntaxException e) { - throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Invalid wsdlLocation: " + wsdlLocation); - } - if (uri.isAbsolute()) { - url = uri.toURL(); - } else { - url = resourceLoader.getResource(uri.toString()); - if (url == null) { - throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Resource not found: " + uri); - } - } - return loadDefinition(namespace, url, resourceLoader); - } - - public Definition loadDefinition(String namespace, URL location, ResourceLoader resourceLoader) throws IOException, WSDLException { - Map<URL, Definition> definitionsByLocation = getDefinitionsByLocation(resourceLoader); - Map<String, List<Definition>> definitionsByNamespace = getDefinitionsByNamespace(resourceLoader); - - Definition definition = definitionsByLocation.get(location); - if (definition != null) { - // return cached copy - return definition; - } - - monitor.readingWSDL(namespace, location); - WSDLReader reader = wsdlFactory.newWSDLReader(); - reader.setFeature("javax.wsdl.verbose", false); - reader.setExtensionRegistry(registry); - - definition = reader.readWSDL(location.toString()); - String definitionNamespace = definition.getTargetNamespace(); - if (namespace != null && !namespace.equals(definitionNamespace)) { - throw new WSDLException(WSDLException.CONFIGURATION_ERROR, namespace + " != " + definition.getTargetNamespace()); - } - - monitor.cachingDefinition(definitionNamespace, location); - definitionsByLocation.put(location, definition); - List<Definition> definitions = definitionsByNamespace.get(definitionNamespace); - if (definitions == null) { - definitions = new ArrayList<Definition>(); - definitionsByNamespace.put(definitionNamespace, definitions); - } - definitions.add(definition); - - return definition; - } - - public List<Definition> getDefinitionsForNamespace(String namespace, ResourceLoader resourceLoader) { - Map<String, List<Definition>> definitionsByNamespace = getDefinitionsByNamespace(resourceLoader); - return definitionsByNamespace.get(namespace); - } - - public PortType getPortType(QName name, ResourceLoader resourceLoader) { - Map<String, List<Definition>> definitionsByNamespace = getDefinitionsByNamespace(resourceLoader); - String namespace = name.getNamespaceURI(); - List<Definition> definitions = definitionsByNamespace.get(namespace); - if (definitions == null) { - return null; - } - for (Definition definition : definitions) { - PortType portType = definition.getPortType(name); - if (portType != null) { - return portType; - } - } - return null; - } - - public Service getService(QName name, ResourceLoader resourceLoader) { - Map<String, List<Definition>> definitionsByNamespace = getDefinitionsByNamespace(resourceLoader); - String namespace = name.getNamespaceURI(); - List<Definition> definitions = definitionsByNamespace.get(namespace); - if (definitions == null) { - return null; - } - for (Definition definition : definitions) { - Service service = definition.getService(name); - if (service != null) { - return service; - } - } - return null; - } - - private Map<String, List<Definition>> getDefinitionsByNamespace(ResourceLoader resourceLoader) { - Map<String, List<Definition>> map = definitionsByNamespaceByLoader.get(resourceLoader); - if (map == null) { - map = new HashMap<String, List<Definition>>(); - definitionsByNamespaceByLoader.put(resourceLoader, map); - } - return map; - } - - private Map<URL, Definition> getDefinitionsByLocation(ResourceLoader resourceLoader) { - Map<URL, Definition> map = definitionsByLocationByLoader.get(resourceLoader); - if (map == null) { - map = new HashMap<URL, Definition>(); - definitionsByLocationByLoader.put(resourceLoader, map); - } - return map; - } - - public static interface Monitor { - /** - * Monitor event emitted immediately before an attempt is made to - * read WSDL for the supplied namespace from the supplied location. - * - * @param namespace the target namespace expected in the WSDL; may be null - * @param location the location where we will attempt to read the WSDL definition from - */ - void readingWSDL(String namespace, URL location); - - /** - * Monitor event emitted immediately before registering a WSDL definition - * in the cache. - * - * @param namespace the target namespace for the WSDL - * @param location the location where the WSDL definition was read from - */ - void cachingDefinition(String namespace, URL location); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemBindingLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemBindingLoader.java deleted file mode 100644 index d75f25a232..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemBindingLoader.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.system; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.StAXUtil; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.loader.assembly.AbstractLoader; -import org.apache.tuscany.core.system.assembly.SystemBinding; -import org.osoa.sca.annotations.Scope; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class SystemBindingLoader extends AbstractLoader { - public static final QName SYSTEM_BINDING = new QName("http://org.apache.tuscany/xmlns/system/0.9", "binding.system"); - - protected QName getXMLType() { - return SYSTEM_BINDING; - } - - public SystemBinding load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert SystemBindingLoader.SYSTEM_BINDING.equals(reader.getName()); - SystemBinding binding = factory.createSystemBinding(); - StAXUtil.skipToEndElement(reader); - return binding; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemImplementationLoader.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemImplementationLoader.java deleted file mode 100644 index b9f35d8656..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemImplementationLoader.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.system; - -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.StAXUtil; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.loader.assembly.AbstractLoader; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.system.assembly.SystemImplementation; -import org.osoa.sca.annotations.Scope; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class SystemImplementationLoader extends AbstractLoader { - public static final QName SYSTEM_IMPLEMENTATION = new QName("http://org.apache.tuscany/xmlns/system/0.9", "implementation.system"); - - private ComponentTypeIntrospector introspector; - - @Autowire - public void setIntrospector(ComponentTypeIntrospector introspector) { - this.introspector = introspector; - } - - protected QName getXMLType() { - return SYSTEM_IMPLEMENTATION; - } - - public SystemImplementation load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert SYSTEM_IMPLEMENTATION.equals(reader.getName()); - SystemImplementation implementation = factory.createSystemImplementation(); - String implClass = reader.getAttributeValue(null, "class"); - Class<?> implementationClass; - try { - implementationClass = loaderContext.getResourceLoader().loadClass(implClass); - implementation.setImplementationClass(implementationClass); - } catch (ClassNotFoundException e) { - throw new ConfigurationLoadException(e); - } - - // todo we should allow componentType sidefiles for system implementations - implementation.setComponentType(introspector.introspect(implementationClass)); - - StAXUtil.skipToEndElement(reader); - return implementation; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/Message.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/Message.java deleted file mode 100644 index dc623af1fc..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/Message.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.message; - -import org.apache.tuscany.core.wire.MessageChannel; -import org.apache.tuscany.core.wire.TargetInvoker; - -/** - * Represents a request, response, or exception flowing through a wire - * - * @version $Rev $Date - */ -public interface Message { - - /** - * Returns the body of the message, which will be the payload or parameters associated with the wire - */ - Object getBody(); - - /** - * Sets the body of the message. - */ - void setBody(Object body); - - /** - * Sets the target invoker to dispatch to when the message passes through the request side of the invocation chain - */ - public void setTargetInvoker(TargetInvoker invoker); - - /** - * Sets the target invoker to dispatch to when the message passes through the request side of the invocation chain - */ - public TargetInvoker getTargetInvoker(); - - /** - * Returns the callback channel - */ - public MessageChannel getCallbackChannel(); - - /** - * - */ - public Message getRelatedCallbackMessage(); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/MessageFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/MessageFactory.java deleted file mode 100644 index 265e4ba601..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/MessageFactory.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.message; - -/** - * A factory for creating messages flowed through a wire during an invocation - */ -public interface MessageFactory { - - /** - * Returns a new message. - */ - Message createMessage(); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageFactoryImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageFactoryImpl.java deleted file mode 100644 index a30f17a938..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageFactoryImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.message.impl; - -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.message.MessageFactory; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Init; - -/** - * The default message factory - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class MessageFactoryImpl implements MessageFactory { - - public MessageFactoryImpl() { - super(); - } - - @Init(eager = true) - public void init(){ - } - - public Message createMessage() { - return new MessageImpl(); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageImpl.java deleted file mode 100644 index f7f365952c..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.message.impl; - -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.wire.MessageChannel; -import org.apache.tuscany.core.wire.TargetInvoker; - -/** - * The default implementation of a message flowed through a wire during an invocation - * - * @version $Rev $Date - */ -public class MessageImpl implements Message, MessageChannel { - - private Object body; - private Message relatedCallbackMessage; - private TargetInvoker invoker; - - protected MessageImpl() { - super(); - } - - /** - * @see org.apache.tuscany.core.message.Message#getBody() - */ - public Object getBody() { - return body; - } - - /** - * @see org.apache.tuscany.core.message.Message#setBody(java.lang.Object) - */ - public void setBody(Object body) { - this.body = body; - } - - /** - * @see org.apache.tuscany.core.message.Message#getCallbackChannel() - */ - public MessageChannel getCallbackChannel() { - return this; - } - - /** - * @see org.apache.tuscany.core.wire.MessageChannel#send(org.apache.tuscany.core.message.Message) - */ - public void send(Message message) { - relatedCallbackMessage = message; - } - - /** - * @see org.apache.tuscany.core.message.Message#getRelatedCallbackMessage() - */ - public Message getRelatedCallbackMessage() { - return relatedCallbackMessage; - } - - /** - * @see org.apache.tuscany.core.message.Message#setTargetInvoker(org.apache.tuscany.core.wire.TargetInvoker) - */ - public void setTargetInvoker(TargetInvoker invoker) { - this.invoker = invoker; - } - - /** - * @see org.apache.tuscany.core.message.Message#getTargetInvoker() - */ - public TargetInvoker getTargetInvoker() { - return invoker; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContext.java deleted file mode 100644 index 16e1fc6483..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContext.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.runtime; - -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.ConfigurationContext; -import org.apache.tuscany.core.context.SystemCompositeContext; - -/** - * Represents a top-level component context in the runtime, that is the bootstrap context. - * This context serves as the ultimate root of the context hierarchy. Under it are two - * separate trees: the rootContext for user components and the systemContext for - * system components (those that comprise the runtime itself). - * - * @version $Rev$ $Date$ - */ -public interface RuntimeContext extends AutowireContext, ConfigurationContext { - - /* the symbolic name of the runtime bootstrap context */ - public static final String RUNTIME = "tuscany.runtime"; - - /* the symbolic name of the composite context containing all system components in the runtime */ - public static final String SYSTEM = "tuscany.system"; - - /* the symbolic name of the composite context containing all user components in the runtime */ - public static final String ROOT = "tuscany.root"; - - /** - * Returns the context that forms the root of the user component tree. - * All user components will managed by contexts that are children of this root. - * @return the root of the user component tree - */ - public CompositeContext getRootContext(); - - /** - * Returns the context that forms the root of the system component tree. - * All system components, components that provide system services needed by the - * Tuscany runtime itself, will be managed by contexts that are children of this root. - * @return the root of the system component tree - */ - public SystemCompositeContext getSystemContext(); - - /** - * Adds a wire builder to the runtime - */ - @Deprecated - public void addBuilder(WireBuilder builder); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContextImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContextImpl.java deleted file mode 100644 index 0ebc063b90..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContextImpl.java +++ /dev/null @@ -1,221 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.runtime; - -import java.util.List; - -import org.apache.tuscany.common.monitor.MonitorFactory; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.HierarchicalWireBuilder; -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.builder.impl.AssemblyVisitorImpl; -import org.apache.tuscany.core.builder.impl.ContextFactoryBuilderRegistryImpl; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.context.AutowireResolutionException; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.ConfigurationContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.EventException; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.SystemCompositeContext; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.context.impl.AbstractContext; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; -import org.apache.tuscany.core.system.context.SystemScopeStrategy; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Composite; -import org.apache.tuscany.model.assembly.Extensible; - -/** - * Implementation of a <code>RuntimeContext</code> that forms the foundation for a Tuscany environment. - * - * @version $Rev$ $Date$ - */ -public class RuntimeContextImpl extends AbstractContext implements RuntimeContext { - - // the top-level wire builder in the runtime - private final HierarchicalWireBuilder wireBuilder; - - //private final List<RuntimeEventListener> listeners = new ArrayList<RuntimeEventListener>(1); - - private final CompositeContext rootContext; - - private final SystemCompositeContext systemContext; - - private final MonitorFactory monitorFactory; - - private final ContextFactoryBuilderRegistryImpl builderRegistry; - - public RuntimeContextImpl(MonitorFactory monitorFactory, ContextFactoryBuilderRegistry builderRegistry, HierarchicalWireBuilder wireBuilder) { - super(RUNTIME); - this.monitorFactory = monitorFactory; - this.builderRegistry = (ContextFactoryBuilderRegistryImpl) builderRegistry; - this.wireBuilder = wireBuilder; - - rootContext = new CompositeContextImpl(ROOT, this, this, new RuntimeScopeStrategy(), new EventContextImpl(), this); - systemContext = new SystemCompositeContextImpl(SYSTEM, this, this, new SystemScopeStrategy(), new EventContextImpl(), this); - } - - public void start() throws CoreRuntimeException { - if (lifecycleState == RUNNING) { - return; - } - systemContext.start(); - - rootContext.start(); - lifecycleState = RUNNING; - } - - public void stop() throws CoreRuntimeException { - if (lifecycleState == STOPPED) { - return; - } - rootContext.stop(); - systemContext.stop(); - lifecycleState = STOPPED; - } - - public void addBuilder(WireBuilder builder) { - assert (builder != null) : "Builder was null"; - wireBuilder.addWireBuilder(builder); - } - - public Context getContext(String ctxName) { - checkRunning(); - if (ROOT.equals(ctxName)) { - return rootContext; - } else if (SYSTEM.equals(ctxName)) { - return systemContext; - } - return rootContext.getContext(ctxName); - } - - public CompositeContext getRootContext() { - checkRunning(); - return rootContext; - } - - public SystemCompositeContext getSystemContext() { - checkRunning(); - return systemContext; - } - - public void registerModelObject(Extensible model) throws ConfigurationException { - assert (model != null) : "Model was null"; - // note do not configure or buildSource model object since the root context will perform a call back - rootContext.registerModelObject(model); - } - - public void registerModelObjects(List<? extends Extensible> models) throws ConfigurationException { - for (Extensible model : models) { - registerModelObject(model); - } - } - - public CompositeContext getParent() { - return null; // there is no parent - } - - public void setParent(CompositeContext parent) { - throw new UnsupportedOperationException(); - } - - public String getURI() { - return null; - } - - public void setURI(String uri) { - } - - public void setAssemblyContext(AssemblyContext context) { - - } - - //TODO remove - public void fireEvent(int pEventType, Object pMessage) throws EventException { - throw new UnsupportedOperationException(); - } - - public Object locateService(QualifiedName serviceName) { - return null; - } - - public Object locateInstance(QualifiedName serviceName) { - return null; - } - - public Object getInstance(QualifiedName qName) throws TargetException { - return getSystemContext().getInstance(qName); - } - - public synchronized void build(AssemblyObject model) throws BuilderConfigException { - AssemblyVisitorImpl visitor = new AssemblyVisitorImpl(builderRegistry.getBuilders()); - visitor.start(model); - } - - public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) throws BuilderConfigException { - wireBuilder.connect(sourceFactory, targetFactory, targetType, downScope, targetScopeContext); - } - - public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) - throws BuilderConfigException { - wireBuilder.completeTargetChain(targetFactory, targetType, targetScopeContext); - } - - public <T> T resolveInstance(Class<T> instanceInterface) throws AutowireResolutionException { - if (MonitorFactory.class.equals(instanceInterface)) { - return instanceInterface.cast(monitorFactory); - } else if (ConfigurationContext.class.equals(instanceInterface)) { - return instanceInterface.cast(this); - } else if (AutowireContext.class.equals(instanceInterface)) { - return instanceInterface.cast(this); - } else if (RuntimeContext.class.equals(instanceInterface)) { - return instanceInterface.cast(this); - } else if (ContextFactoryBuilderRegistry.class.equals(instanceInterface)) { - return instanceInterface.cast(builderRegistry); - } else { - // autowire to system components - return instanceInterface.cast(getSystemContext().resolveExternalInstance(instanceInterface)); - } - } - - public <T> T resolveExternalInstance(Class<T> instanceInterface) throws AutowireResolutionException { - return systemContext.resolveExternalInstance(instanceInterface); - } - - public Composite getComposite() { - return systemContext.getComposite(); - } - - public void removeContext(String name) { - - } - - private void checkRunning() { - if (lifecycleState != RUNNING) { - throw new IllegalStateException("Context must be in RUNNING state"); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeMonitor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeMonitor.java deleted file mode 100644 index c1b87d6a13..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeMonitor.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.runtime; - -import org.apache.tuscany.common.TuscanyException; -import org.apache.tuscany.common.TuscanyRuntimeException; - - -/** - * Serves as a top-level error logging monitor - * - * @version $Rev$ $Date$ - */ -public interface RuntimeMonitor { - - public void log(TuscanyRuntimeException e); - - public void log(TuscanyException e); - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeScopeStrategy.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeScopeStrategy.java deleted file mode 100644 index 5051c2674d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeScopeStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.runtime; - -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.scope.AbstractScopeStrategy; -import org.apache.tuscany.core.context.scope.CompositeScopeContext; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.HashMap; -import java.util.Map; - -/** - * Implements a {@link org.apache.tuscany.core.context.ScopeStrategy} for a runtime context. Specifically, a runtime - * context has only one scope, {@link org.apache.tuscany.model.assembly.Scope#AGGREGATE} - * - * @version $Rev$ $Date$ - */ -public class RuntimeScopeStrategy extends AbstractScopeStrategy { - - public RuntimeScopeStrategy() { - } - - public Map<Scope, ScopeContext> getScopeContexts(EventContext eventContext) { - ScopeContext aggregrateScope = new CompositeScopeContext(eventContext); - Map<Scope, ScopeContext> scopes = new HashMap<Scope, ScopeContext>(); - scopes.put(Scope.AGGREGATE, aggregrateScope); - return scopes; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/DataFactoryObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/DataFactoryObjectFactory.java deleted file mode 100644 index 6b35115e1f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/DataFactoryObjectFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.sdo; - -import commonj.sdo.helper.DataFactory; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.injection.ObjectCreationException; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.sdo.util.SDOUtil; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class DataFactoryObjectFactory implements ObjectFactory<DataFactory> { - - private ContextResolver resolver; - - /** - * @throws org.apache.tuscany.core.injection.FactoryInitException - * - */ - public DataFactoryObjectFactory(ContextResolver resolver) { - this.resolver = resolver; - } - - - public DataFactory getInstance() throws ObjectCreationException { - CompositeContext parent = resolver.getCurrentContext(); - if (parent == null) { - return null;// FIXME semantic here means required is not followed - } - if (!(parent instanceof AutowireContext)) { - ObjectCreationException e = new ObjectCreationException("Parent does not implement " - + AutowireContext.class.getName()); - e.setIdentifier(parent.getName()); - throw e; - } - AutowireContext ctx = (AutowireContext) parent; - AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class); - return SDOUtil.createDataFactory(assemblyContext.getTypeHelper()); - } - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/TypeHelperObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/TypeHelperObjectFactory.java deleted file mode 100644 index d345e7be95..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/TypeHelperObjectFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.sdo; - -import commonj.sdo.helper.TypeHelper; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.injection.ObjectCreationException; -import org.apache.tuscany.model.assembly.AssemblyContext; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class TypeHelperObjectFactory implements ObjectFactory<TypeHelper> { - - - private ContextResolver resolver; - - /** - * @throws org.apache.tuscany.core.injection.FactoryInitException - * - */ - public TypeHelperObjectFactory(ContextResolver resolver) { - this.resolver = resolver; - } - - - public TypeHelper getInstance() throws ObjectCreationException { - CompositeContext parent = resolver.getCurrentContext(); - if (parent == null) { - return null;// FIXME semantic here means required is not followed - } - if (!(parent instanceof AutowireContext)) { - ObjectCreationException e = new ObjectCreationException("Parent does not implement " - + AutowireContext.class.getName()); - e.setIdentifier(parent.getName()); - throw e; - } - AutowireContext ctx = (AutowireContext) parent; - AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class); - return assemblyContext.getTypeHelper(); - } - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XMLHelperObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XMLHelperObjectFactory.java deleted file mode 100644 index 04773f9770..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XMLHelperObjectFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.sdo; - -import commonj.sdo.helper.XMLHelper; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.injection.ObjectCreationException; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.sdo.util.SDOUtil; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class XMLHelperObjectFactory implements ObjectFactory<XMLHelper> { - - - private ContextResolver resolver; - - /** - * @throws org.apache.tuscany.core.injection.FactoryInitException - * - */ - public XMLHelperObjectFactory(ContextResolver resolver) { - this.resolver = resolver; - } - - - public XMLHelper getInstance() throws ObjectCreationException { - CompositeContext parent = resolver.getCurrentContext(); - if (parent == null) { - return null;// FIXME semantic here means required is not followed - } - if (!(parent instanceof AutowireContext)) { - ObjectCreationException e = new ObjectCreationException("Parent does not implement " - + AutowireContext.class.getName()); - e.setIdentifier(parent.getName()); - throw e; - } - AutowireContext ctx = (AutowireContext) parent; - AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class); - return SDOUtil.createXMLHelper(assemblyContext.getTypeHelper()); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XSDHelperObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XSDHelperObjectFactory.java deleted file mode 100644 index eaddf15cb2..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XSDHelperObjectFactory.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.sdo; - -import commonj.sdo.helper.XSDHelper; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.injection.ObjectCreationException; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.sdo.util.SDOUtil; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class XSDHelperObjectFactory implements ObjectFactory<XSDHelper> { - - - private ContextResolver resolver; - - /** - * @throws org.apache.tuscany.core.injection.FactoryInitException - * - */ - public XSDHelperObjectFactory(ContextResolver resolver) { - this.resolver = resolver; - } - - - public XSDHelper getInstance() throws ObjectCreationException { - CompositeContext parent = resolver.getCurrentContext(); - if (parent == null) { - return null;// FIXME semantic here means required is not followed - } - if (!(parent instanceof AutowireContext)) { - ObjectCreationException e = new ObjectCreationException("Parent does not implement " - + AutowireContext.class.getName()); - e.setIdentifier(parent.getName()); - throw e; - } - AutowireContext ctx = (AutowireContext) parent; - AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class); - return SDOUtil.createXSDHelper(assemblyContext.getTypeHelper()); - } - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java deleted file mode 100644 index a804fc51b4..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.sdo.helper; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Annotation used to indicate a field or method that is used to inject an SDO helper. - * - * The following helpers are supported: - * commonj.sdo.helper.TypeHelper - * commonj.sdo.helper.DataFactory - * commonj.sdo.helper.XSDHelper - * commonj.sdo.helper.XMLHelper - * - */ -@Target({METHOD, FIELD}) -@Retention(RUNTIME) -public @interface SDOHelper { - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java deleted file mode 100644 index c6f84fa485..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.sdo.helper; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import commonj.sdo.helper.DataFactory; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.helper.XSDHelper; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.extension.config.InjectorExtensibilityElement; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.injection.ObjectCreationException; -import org.apache.tuscany.core.sdo.DataFactoryObjectFactory; -import org.apache.tuscany.core.sdo.TypeHelperObjectFactory; -import org.apache.tuscany.core.sdo.XMLHelperObjectFactory; -import org.apache.tuscany.core.sdo.XSDHelperObjectFactory; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class SDOHelperExtensibilityElement implements InjectorExtensibilityElement { - - private Method method; - private Field field; - private Class<?> type; - - public SDOHelperExtensibilityElement(Method m) { - method = m; - assert(method != null); - assert(method.getParameterTypes().length == 1); - type = method.getParameterTypes()[0]; - } - - public SDOHelperExtensibilityElement(Field field) { - assert (field != null); - this.field = field; - this.type = field.getType(); - } - - public Injector<?> getInjector(ContextResolver resolver) { - ObjectFactory<?> factory; - if (TypeHelper.class.equals(type)) { - factory = new TypeHelperObjectFactory(resolver); - } else if (DataFactory.class.equals(type)) { - factory = new DataFactoryObjectFactory(resolver); - } else if (XSDHelper.class.equals(type)) { - factory = new XSDHelperObjectFactory(resolver); - } else if (XMLHelper.class.equals(type)) { - factory = new XMLHelperObjectFactory(resolver); - } else { - ObjectCreationException e = new ObjectCreationException("Unknown type"); - e.setIdentifier(type.getName()); - throw e; - } - if (method != null) { - return new MethodInjector(method, factory); - } - return new FieldInjector(field, factory); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java deleted file mode 100644 index dc8d97779f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.sdo.helper; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.InvalidSetterException; -import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport; -import org.apache.tuscany.model.assembly.ComponentType; -import org.osoa.sca.annotations.Scope; - -/** - * @version $$Rev$$ $$Date$$ - */ -@Scope("Module") -public class SDOHelperProcessor extends ImplementationProcessorSupport { - - @Override - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { - if (method.getDeclaringClass().equals(Object.class)) { - return; - } - SDOHelper annotation = method.getAnnotation(SDOHelper.class); - if (annotation != null) { - if (!Modifier.isPublic(method.getModifiers())) { - InvalidSetterException e = new InvalidSetterException("SDO setter method is not public"); - e.setIdentifier(method.toString()); - throw e; - } - Class<?>[] params = method.getParameterTypes(); - if (params.length != 1) { - InvalidSetterException e = new InvalidSetterException("SDO setter method must have one parameter"); - e.setIdentifier(method.toString()); - throw e; - } - type.getExtensibilityElements().add(new SDOHelperExtensibilityElement(method)); - - } - - - } - - @Override - public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { - if (field.getDeclaringClass().equals(Object.class)) { - return; - } - int modifiers = field.getModifiers(); - SDOHelper annotation = field.getAnnotation(SDOHelper.class); - if (annotation != null) { - if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { - InvalidSetterException e = new InvalidSetterException("Property field is not public or protected"); - e.setIdentifier(field.getName()); - throw e; - } - type.getExtensibilityElements().add(new SDOHelperExtensibilityElement(field)); - } - } - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Autowire.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Autowire.java deleted file mode 100644 index 5eb1f6b926..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Autowire.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.annotation; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import java.lang.annotation.Target; - -/** - * A system annotation to inject an autowired instance - * - * @version $Rev$ $Date$ - */ -@Target( { METHOD, FIELD }) -@Retention(RUNTIME) -public @interface Autowire { - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Monitor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Monitor.java deleted file mode 100644 index aa552b8e0d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Monitor.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.annotation; - -import java.lang.annotation.Target; -import java.lang.annotation.Retention; -import java.lang.annotation.ElementType; -import java.lang.annotation.RetentionPolicy; - -/** - * A system annotation to inject a monitor - * - * @version $Rev: 392146 $ $Date: 2006-04-06 18:11:28 -0700 (Thu, 06 Apr 2006) $ - */ -@Target( { ElementType.METHOD, ElementType.FIELD }) -@Retention(RetentionPolicy.RUNTIME) -public @interface Monitor { -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/ParentContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/ParentContext.java deleted file mode 100644 index a9d07dbb5f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/ParentContext.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.annotation; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import java.lang.annotation.Target; - -/** - * A system annotation to inject the parent context - * - * @version $Rev$ $Date$ - */ - -@Target( { METHOD, FIELD }) -@Retention(RUNTIME) -public @interface ParentContext { - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemAssemblyFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemAssemblyFactory.java deleted file mode 100644 index fea8d24ba6..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemAssemblyFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.assembly; - -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Scope; - -/** - * A factory for building system assembly model artifacts - * - * @version $Rev$ $Date$ - */ -public interface SystemAssemblyFactory extends AssemblyFactory { - - /** - * Returns an assembly model artifact representing a system component implementation - */ - SystemImplementation createSystemImplementation(); - - /** - * Returns an assembly model artifact representing a system module - */ - SystemModule createSystemModule(); - - /** - * Returns an assembly model artifact representing a system binding - */ - SystemBinding createSystemBinding(); - - /** - * Helper method for creating a typical system component. - * - * @param name the name of the component - * @param service the service that the component provides - * @param impl the component implementation - * @param scope the component's scope - * @return a Component model object with the appropriate system implementation - */ - <T> Component createSystemComponent(String name, Class<T> service, Class<? extends T> impl, Scope scope); - - /** - * Helper method for creating a system entry point wired to a component. - * - * @param entryPointName the name of the entry point - * @param serviceContract the service contract exposed - * @param targetName the component to wire the entry point to - * @return a EntryPoint model object that exposes the service contract and is wired to the named component - */ - EntryPoint createSystemEntryPoint(String entryPointName, Class<?> serviceContract, String targetName); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemBinding.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemBinding.java deleted file mode 100644 index edc7c87c85..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemBinding.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.assembly; - -import org.apache.tuscany.model.assembly.Binding; - -/** - * Represents a system binding - * - * @version $Rev$ $Date$ - */ -public interface SystemBinding extends Binding { - - /** - * Returns the qualified name of the wire target the binding is associated with in component/service form - */ - public String getTargetName(); - - /** - * Sets the qualified name of the wire target the binding is associated with in component/service form - */ - public void setTargetName(String name); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemImplementation.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemImplementation.java deleted file mode 100644 index a6a024ceca..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemImplementation.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.assembly; - -import org.apache.tuscany.model.assembly.AtomicImplementation; - -/** - * Represents a system component implementation - * - * @version $Rev$ $Date$ - */ -public interface SystemImplementation extends AtomicImplementation { - - /** - * Returns the implementation class of the system component - */ - Class<?> getImplementationClass(); - - /** - * Sets the implementation class of the system component - */ - void setImplementationClass(Class<?> value); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemModule.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemModule.java deleted file mode 100644 index a43aca67a2..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemModule.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.assembly; - -/** - * - */ -import org.apache.tuscany.model.assembly.Module; - -public interface SystemModule extends Module { - - /** - * Returns the implementation class of the system component - */ - Class<?> getImplementationClass(); - - /** - * Sets the implementation class of the system component - */ - void setImplementationClass(Class<?> value); - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java deleted file mode 100644 index c0d97c9a35..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.assembly.impl; - -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.SystemBinding; -import org.apache.tuscany.core.system.assembly.SystemImplementation; -import org.apache.tuscany.core.system.assembly.SystemModule; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * The default implementation of the system assembly factory - * - * @version $Rev$ $Date$ - */ -public class SystemAssemblyFactoryImpl extends AssemblyFactoryImpl implements SystemAssemblyFactory { - - public SystemAssemblyFactoryImpl() { - } - - public SystemImplementation createSystemImplementation() { - return new SystemImplementationImpl(); - } - - public SystemBinding createSystemBinding() { - return new SystemBindingImpl(); - } - - public <T> Component createSystemComponent(String name, Class<T> service, Class<? extends T> impl, Scope scope) { - JavaServiceContract jsc = createJavaServiceContract(); - jsc.setInterface(service); - jsc.setScope(scope); - Service s = createService(); - s.setServiceContract(jsc); - - ComponentType componentType = createComponentType(); - componentType.getServices().add(s); - - SystemImplementation sysImpl = createSystemImplementation(); - sysImpl.setImplementationClass(impl); - sysImpl.setComponentType(componentType); - - Component sc = createSimpleComponent(); - sc.setName(name); - sc.setImplementation(sysImpl); - return sc; - } - - public EntryPoint createSystemEntryPoint(String entryPointName, Class<?> serviceContract, String targetName) { - // create the system binding - SystemBinding systemBinding = createSystemBinding(); - - // define the EP's service contract - JavaServiceContract javaServiceContract = createJavaServiceContract(); - javaServiceContract.setInterface(serviceContract); - - return createEntryPoint(entryPointName, javaServiceContract, systemBinding, targetName); - } - - public SystemModule createSystemModule() { - return new SystemModuleImpl(); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemBindingImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemBindingImpl.java deleted file mode 100644 index a9996065e2..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemBindingImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.assembly.impl; - -import org.apache.tuscany.core.system.assembly.SystemBinding; -import org.apache.tuscany.model.assembly.impl.BindingImpl; - -/** - * The default implementation of the system binding assembly artifact - * - * @version $Rev$ $Date$ - */ -public class SystemBindingImpl extends BindingImpl implements SystemBinding { - - protected SystemBindingImpl() { - } - - private String name; - - public String getTargetName() { - return name; - } - - public void setTargetName(String name) { - this.name = name; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemImplementationImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemImplementationImpl.java deleted file mode 100644 index cca3aef1bb..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemImplementationImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.assembly.impl; - -import org.apache.tuscany.core.system.assembly.SystemImplementation; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.impl.AtomicImplementationImpl; - -/** - * The default implementation of the system implementation assembly artifact - * - * @version $Rev$ $Date$ - */ -public class SystemImplementationImpl extends AtomicImplementationImpl implements SystemImplementation { - - private Class<?> implementationClass; - - private AssemblyContext modelContext; - - protected SystemImplementationImpl() { - } - - public Class<?> getImplementationClass() { - return implementationClass; - } - - public void setImplementationClass(Class<?> value) { - checkNotFrozen(); - implementationClass = value; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemModuleImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemModuleImpl.java deleted file mode 100644 index 98198cba85..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemModuleImpl.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.assembly.impl; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.core.system.assembly.SystemModule; -import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.ModuleFragment; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.OverrideOption; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.apache.tuscany.model.assembly.ServiceURI; -import org.apache.tuscany.model.assembly.Wire; -import org.apache.tuscany.model.assembly.impl.CompositeImpl; - -/** - * An implementation of Module. - */ -public class SystemModuleImpl extends CompositeImpl implements SystemModule { - - private List<ModuleFragment> moduleFragments = new ArrayList<ModuleFragment>(); - private Map<String, ModuleFragment> moduleFragmentsMap; - private ComponentType componentType; - private Object contextFactory; - - /** - * Constructor - */ - protected SystemModuleImpl() { - } - - /** - * @see org.apache.tuscany.model.assembly.Implementation#getComponentType() - */ - public ComponentType getComponentType() { - return componentType; - } - - /** - * @see org.apache.tuscany.model.assembly.Implementation#setComponentType(org.apache.tuscany.model.assembly.ComponentType) - */ - public void setComponentType(ComponentType componentType) { - checkNotFrozen(); - this.componentType = componentType; - } - - /** - * @see org.apache.tuscany.model.assembly.Module#getModuleFragments() - */ - public List<ModuleFragment> getModuleFragments() { - return moduleFragments; - } - - /** - * @see org.apache.tuscany.model.assembly.Module#getModuleFragment(java.lang.String) - */ - public ModuleFragment getModuleFragment(String name) { - checkInitialized(); - return moduleFragmentsMap.get(name); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyObject#initialize(org.apache.tuscany.model.assembly.AssemblyContext) - */ - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - - // Initialize module fragments - for (ModuleFragment moduleFragment : moduleFragments) { - - // Add all WSDL imports, components, entry points and external services from the module fragments - getWSDLImports().addAll(moduleFragment.getWSDLImports()); - getComponents().addAll(moduleFragment.getComponents()); - getEntryPoints().addAll(moduleFragment.getEntryPoints()); - getExternalServices().addAll(moduleFragment.getExternalServices()); - - // Add all the wires from the module fragments - getWires().addAll(moduleFragment.getWires()); - - moduleFragment.initialize(modelContext); - } - - // Initialize the composite - super.initialize(modelContext); - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyObject#freeze() - */ - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze component type and module fragments - if (componentType != null) - componentType.freeze(); - moduleFragments = Collections.unmodifiableList(moduleFragments); - freeze(moduleFragments); - } - - /** - * @see org.apache.tuscany.model.assembly.ContextFactoryHolder#getContextFactory() - */ - public Object getContextFactory() { - return contextFactory; - } - - /** - * @see org.apache.tuscany.model.assembly.ContextFactoryHolder#setContextFactory(java.lang.Object) - */ - public void setContextFactory(Object configuration) { - checkNotFrozen(); - this.contextFactory = configuration; - } - - /** - * @see org.apache.tuscany.model.assembly.impl.CompositeImpl#accept(org.apache.tuscany.model.assembly.AssemblyVisitor) - */ - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (componentType != null) { - if (!componentType.accept(visitor)) - return false; - } - - return accept(moduleFragments, visitor); - - } - - public Class<?> getImplementationClass() { - return SystemCompositeContextImpl.class; // FIXME hack - } - - public void setImplementationClass(Class<?> clazz) { - // do nothing - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilder.java deleted file mode 100644 index 835324c392..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilder.java +++ /dev/null @@ -1,343 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.builder; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.apache.tuscany.common.monitor.MonitorFactory; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.NoAccessorException; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.builder.UnknownTypeException; -import org.apache.tuscany.core.builder.impl.ArrayMultiplicityObjectFactory; -import org.apache.tuscany.core.builder.impl.ListMultiplicityObjectFactory; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.extension.config.InjectorExtensibilityElement; -import org.apache.tuscany.core.extension.config.extensibility.ComponentNameExtensibilityElement; -import org.apache.tuscany.core.extension.config.extensibility.ContextExtensibilityElement; -import org.apache.tuscany.core.extension.config.extensibility.DestroyInvokerExtensibilityElement; -import org.apache.tuscany.core.extension.config.extensibility.InitInvokerExtensibilityElement; -import org.apache.tuscany.core.injection.EventInvoker; -import org.apache.tuscany.core.injection.FactoryInitException; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.injection.NonProxiedTargetFactory; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.core.system.assembly.SystemImplementation; -import org.apache.tuscany.core.system.assembly.SystemModule; -import org.apache.tuscany.core.system.config.SystemContextFactory; -import org.apache.tuscany.core.system.config.SystemInjectorExtensibilityElement; -import org.apache.tuscany.core.system.config.extensibility.MonitorExtensibilityElement; -import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.Composite; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; - -/** - * Decorates components whose implementation type is a {@link org.apache.tuscany.core.system.assembly.SystemImplementation} - * with the appropriate runtime configuration. This builder handles both system composite components as well - * as system leaf or "simple" components. Consequently, both simple and composite component types may be - * injected and autowired. - * <p/> - * Note that system component references are not proxied. - * - * @version $Rev$ $Date$ - */ -public class SystemContextFactoryBuilder implements ContextFactoryBuilder { - - private final MonitorFactory monitorFactory; - - public SystemContextFactoryBuilder(MonitorFactory monitorFactory) { - this.monitorFactory = monitorFactory; - } - - @SuppressWarnings("unchecked") - public void build(AssemblyObject modelObject) throws BuilderException { - if (!(modelObject instanceof Component)) { - return; - } - Component component = (Component) modelObject; - - Class implClass; - Scope scope; - // Get the component implementation - Implementation componentImplementation = component.getImplementation(); - if (componentImplementation instanceof SystemImplementation - && component.getContextFactory() == null) { - - // The component is a system component, implemented by a Java class - SystemImplementation implementation = (SystemImplementation) componentImplementation; - if (componentImplementation.getComponentType().getServices() == null - || componentImplementation.getComponentType().getServices().size() < 1) { - BuilderConfigException e = new BuilderConfigException("No service configured on component type"); - e.setIdentifier(component.getName()); - throw e; - } - implClass = implementation.getImplementationClass(); - Scope previous = null; - scope = Scope.MODULE; - List<Service> services = component.getImplementation().getComponentType().getServices(); - for (Service service : services) { - // calculate and validate the scope of the component; ensure that all service scopes are the same unless - // a scope is stateless - Scope current = service.getServiceContract().getScope(); - if (previous != null && current != null && current != previous - && (current != Scope.INSTANCE && previous != Scope.INSTANCE)) { - BuilderException e = new BuilderConfigException("Incompatible scopes specified for services on component"); - e.setIdentifier(component.getName()); - throw e; - } - if (current != null && current != Scope.MODULE) { - scope = current; - } - } - - } else if (componentImplementation instanceof Composite) { - implClass = ((Composite) componentImplementation).getImplementationClass(); - if (implClass == null) { - // FIXME this is a hack - if (((Module) componentImplementation).getName().startsWith("org.apache.tuscany.core.system")) - { - // The component is a system module component, fix the implementation class to our implementation - // of system module component context - implClass = SystemCompositeContextImpl.class; - } else if (componentImplementation instanceof SystemModule) { - implClass = SystemCompositeContextImpl.class; - } else { - // The component is an app module component, fix the implementation class to our implementation - // of app module component context - //FIXME this should be extensible, i.e. the model should specify the impl class of the module - implClass = CompositeContextImpl.class; - } - //END hack - } - scope = Scope.AGGREGATE; - } else { - return; - } - Set<Field> fields; - Set<Method> methods; - SystemContextFactory contextFactory; - try { - fields = JavaIntrospectionHelper.getAllFields(implClass); - methods = JavaIntrospectionHelper.getAllUniqueMethods(implClass); - String name = component.getName(); - if (componentImplementation instanceof Module) { - Module module = (Module) componentImplementation; - contextFactory = new SystemContextFactory(name, module, JavaIntrospectionHelper.getDefaultConstructor(implClass), scope); - - } else { - contextFactory = new SystemContextFactory(name, JavaIntrospectionHelper.getDefaultConstructor(implClass), scope); - } - - //ContextObjectFactory contextObjectFactory = new ContextObjectFactory(contextFactory); - - List<Injector> injectors = new ArrayList<Injector>(); - - // handle properties - List<ConfiguredProperty> configuredProperties = component.getConfiguredProperties(); - if (configuredProperties != null) { - for (ConfiguredProperty property : configuredProperties) { - Injector injector = createPropertyInjector(property, fields, methods); - injectors.add(injector); - } - } - - // FIXME do not inject references on an application module yet - if (implClass != CompositeContextImpl.class) { - // handle references - List<ConfiguredReference> configuredReferences = component.getConfiguredReferences(); - if (configuredReferences != null) { - for (ConfiguredReference reference : configuredReferences) { - Injector injector = createReferenceInjector(reference, fields, methods, contextFactory); - injectors.add(injector); - } - } - } - List<Object> elements = componentImplementation.getComponentType().getExtensibilityElements(); - for (Object element : elements) { - if (element instanceof InitInvokerExtensibilityElement) { - InitInvokerExtensibilityElement invokerElement = (InitInvokerExtensibilityElement) element; - EventInvoker<Object> initInvoker = invokerElement.getEventInvoker(); - boolean eagerInit = invokerElement.isEager(); - contextFactory.setEagerInit(eagerInit); - contextFactory.setInitInvoker(initInvoker); - } else if (element instanceof DestroyInvokerExtensibilityElement) { - DestroyInvokerExtensibilityElement invokerElement = (DestroyInvokerExtensibilityElement) element; - EventInvoker<Object> destroyInvoker = invokerElement.getEventInvoker(); - contextFactory.setDestroyInvoker(destroyInvoker); - } else if (element instanceof ComponentNameExtensibilityElement) { - ComponentNameExtensibilityElement nameElement = (ComponentNameExtensibilityElement) element; - injectors.add(nameElement.getEventInvoker(name)); - } else if (element instanceof ContextExtensibilityElement) { - ContextExtensibilityElement contextElement = (ContextExtensibilityElement) element; - injectors.add(contextElement.getInjector(contextFactory)); - } else if (element instanceof InjectorExtensibilityElement) { - InjectorExtensibilityElement injectorElement = (InjectorExtensibilityElement) element; - injectors.add(injectorElement.getInjector(contextFactory)); - } else if (element instanceof SystemInjectorExtensibilityElement) { - SystemInjectorExtensibilityElement injectorElement = (SystemInjectorExtensibilityElement) element; - injectors.add(injectorElement.getInjector(contextFactory)); - } else if (element instanceof MonitorExtensibilityElement) { - MonitorExtensibilityElement monitorElement = (MonitorExtensibilityElement) element; - injectors.add(monitorElement.getInjector(monitorFactory)); - } - } - contextFactory.setSetters(injectors); - // decorate the logical model - component.setContextFactory(contextFactory); - } catch (BuilderConfigException e) { - e.addContextName(component.getName()); - throw e; - } catch (NoSuchMethodException e) { - BuilderConfigException ce = new BuilderConfigException("Class does not have a no-arg constructor", e); - ce.setIdentifier(implClass.getName()); - throw ce; - } catch (FactoryInitException e) { - BuilderConfigException ce = new BuilderConfigException("Error building component", e); - ce.addContextName(component.getName()); - throw ce; - } - } - - /** - * Creates an <code>Injector</code> for component properties - */ - private Injector createPropertyInjector(ConfiguredProperty property, Set<Field> fields, Set<Method> methods) - throws NoAccessorException { - Object value = property.getValue(); - String propName = property.getProperty().getName(); - // @FIXME is this how to get property type of object - Class type = value.getClass(); - - // There is no efficient way to do this - Method method = null; - Field field = JavaIntrospectionHelper.findClosestMatchingField(propName, type, fields); - if (field == null) { - method = JavaIntrospectionHelper.findClosestMatchingMethod(propName, new Class[]{type}, methods); - if (method == null) { - throw new NoAccessorException(propName); - } - } - Injector injector; - // FIXME support types other than String - if (JavaIntrospectionHelper.isImmutable(type)) { - if (field != null) { - injector = new FieldInjector(field, new SingletonObjectFactory<Object>(value)); - } else { - injector = new MethodInjector(method, new SingletonObjectFactory<Object>(value)); - } - } else { - if (field != null) { - throw new UnknownTypeException(field.getName()); - } else { - throw new UnknownTypeException(method.getName()); - } - } - return injector; - - } - - /** - * Creates object factories that resolve target(s) of a reference and an <code>Injector</code> responsible - * for injecting them into the reference - */ - private Injector createReferenceInjector(ConfiguredReference reference, Set<Field> fields, Set<Method> methods, - ContextResolver resolver) { - - List<ObjectFactory> objectFactories = new ArrayList<ObjectFactory>(); - String refName = reference.getPort().getName(); - Class refClass = reference.getPort().getServiceContract().getInterface(); - for (ConfiguredService configuredService : reference.getTargetConfiguredServices()) { - objectFactories.add(new NonProxiedTargetFactory(configuredService, resolver)); - } - boolean multiplicity = reference.getPort().getMultiplicity() == Multiplicity.ONE_N - || reference.getPort().getMultiplicity() == Multiplicity.ZERO_N; - return createInjector(refName, refClass, multiplicity, objectFactories, fields, methods); - - } - - /** - * Creates an <code>Injector</code> for an object factories associated with a reference. - */ - private Injector createInjector(String refName, Class refClass, boolean multiplicity, List<ObjectFactory> objectFactories, - Set<Field> fields, Set<Method> methods) throws NoAccessorException, BuilderConfigException { - Field field; - Method method = null; - if (multiplicity) { - // since this is a multiplicity, we cannot match on business interface type, so scan through the fields, - // matching on name and List or Array - field = JavaIntrospectionHelper.findMultiplicityFieldByName(refName, fields); - if (field == null) { - // No fields found. Again, since this is a multiplicity, we cannot match on interface type, so - // scan through the fields, matching on name and List or Array - method = JavaIntrospectionHelper.findMultiplicityMethodByName(refName, methods); - if (method == null) { - throw new NoAccessorException(refName); - } - } - Injector injector; - if (field != null) { - // for multiplicities, we need to inject the target or targets using an object factory - // which first delegates to create the proxies and then returns them in the appropriate List or array - // type - if (field.getType().isArray()) { - injector = new FieldInjector(field, new ArrayMultiplicityObjectFactory(refClass, objectFactories)); - } else { - injector = new FieldInjector(field, new ListMultiplicityObjectFactory(objectFactories)); - } - } else { - if (method.getParameterTypes()[0].isArray()) { - injector = new MethodInjector(method, new ArrayMultiplicityObjectFactory(refClass, objectFactories)); - } else { - injector = new MethodInjector(method, new ListMultiplicityObjectFactory(objectFactories)); - } - } - return injector; - } else { - field = JavaIntrospectionHelper.findClosestMatchingField(refName, refClass, fields); - if (field == null) { - method = JavaIntrospectionHelper.findClosestMatchingMethod(refName, new Class[]{refClass}, methods); - if (method == null) { - throw new NoAccessorException(refName); - } - } - Injector injector; - if (field != null) { - injector = new FieldInjector(field, objectFactories.get(0)); - } else { - injector = new MethodInjector(method, objectFactories.get(0)); - } - return injector; - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemEntryPointBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemEntryPointBuilder.java deleted file mode 100644 index c366da53d6..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemEntryPointBuilder.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.builder; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.BuilderInitException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.injection.FactoryInitException; -import org.apache.tuscany.core.system.assembly.SystemBinding; -import org.apache.tuscany.core.system.config.SystemEntryPointContextFactory; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; - -/** - * Decorates the logical model with entry point context configuration builders - * - * @version $Rev: 385747 $ $Date: 2006-03-13 22:12:53 -0800 (Mon, 13 Mar 2006) $ - */ -public class SystemEntryPointBuilder implements ContextFactoryBuilder { - - public SystemEntryPointBuilder() { - } - - public void build(AssemblyObject modelObject) throws BuilderException { - if (!(modelObject instanceof EntryPoint)) { - return; - } - EntryPoint entryPoint = (EntryPoint) modelObject; - if (!(entryPoint.getBindings().get(0) instanceof SystemBinding) - || entryPoint.getContextFactory() != null) { - return; - } - try { - String targetName; - ConfiguredService targetService = entryPoint.getConfiguredReference().getTargetConfiguredServices().get(0); - Class serviceInterface = entryPoint.getConfiguredReference().getPort().getServiceContract().getInterface(); - if (targetService.getPart() == null) { - // FIXME not correct - if (targetService.getPort() == null) { - BuilderInitException e = new BuilderInitException("No target service specified on "); - e.setIdentifier(entryPoint.getName()); - } - targetName = targetService.getPort().getName(); - } else { - targetName = targetService.getPart().getName(); - } - SystemEntryPointContextFactory contextFactory = new SystemEntryPointContextFactory(entryPoint.getName(), - targetName, serviceInterface); - entryPoint.setContextFactory(contextFactory); - } catch (FactoryInitException e) { - e.addContextName(entryPoint.getName()); - throw e; - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemExternalServiceBuilder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemExternalServiceBuilder.java deleted file mode 100644 index a568e9aa2f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemExternalServiceBuilder.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.builder; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.injection.InterCompositeReferenceFactory; -import org.apache.tuscany.core.system.assembly.SystemBinding; -import org.apache.tuscany.core.system.config.SystemExternalServiceContextFactory; -import org.apache.tuscany.core.system.injection.AutowireObjectFactory; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.ExternalService; - -/** - * Creates runtime configurations for system type external services - * - * @version $Rev$ $Date$ - */ -public class SystemExternalServiceBuilder implements ContextFactoryBuilder { - - public SystemExternalServiceBuilder() { - } - - public void build(AssemblyObject modelObject) throws BuilderException { - if (!(modelObject instanceof ExternalService)) { - return; - } - ExternalService externalService = (ExternalService) modelObject; - if (externalService.getConfiguredService() != null - && externalService.getContextFactory() != null) { - return; - } else if (externalService.getBindings() == null || externalService.getBindings().size() < 1 - || !(externalService.getBindings().get(0) instanceof SystemBinding)) { - return; - } - SystemBinding binding = (SystemBinding)externalService.getBindings().get(0); - if (binding.getTargetName() != null) { - SystemExternalServiceContextFactory contextFactory = new SystemExternalServiceContextFactory(externalService - .getName(), new InterCompositeReferenceFactory(binding.getTargetName())); - externalService.setContextFactory(contextFactory); - } else if (externalService.getConfiguredService().getPort().getServiceContract().getInterface() != null) { - // autowire - Class<Object> claz = externalService.getConfiguredService().getPort().getServiceContract().getInterface(); - if (claz == null) { - BuilderException e = new BuilderConfigException("Interface type not specified"); - e.setIdentifier(externalService.getName()); - e.addContextName(externalService.getName()); - throw e; - } - SystemExternalServiceContextFactory config = new SystemExternalServiceContextFactory(externalService - .getName(), new AutowireObjectFactory<Object>(claz)); - externalService.setContextFactory(config); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemContextFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemContextFactory.java deleted file mode 100644 index 2e4a2916ce..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemContextFactory.java +++ /dev/null @@ -1,208 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.config; - -import org.apache.tuscany.common.TuscanyRuntimeException; -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.injection.EventInvoker; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.PojoObjectFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.system.context.SystemAtomicContext; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.Scope; - -import java.lang.reflect.Constructor; -import java.util.List; -import java.util.Map; - -/** - * A <code>ContextFactory</code> that handles system component implementation types, which may be either simple, leaf - * types or an composites. - * <p> - * For composite types, this factory delegates to an {@link org.apache.tuscany.core.builder.ObjectFactory} to create an - * instance of the composite implementation and perform injection of configuration and references. Once an composite - * instance is created, the factory will register the composite's children. This process may be done recursively in a - * lazy fashion, descending down an composite hierarchy as a child composite is instantiated. - * - * @version $Rev$ $Date$ - */ -public class SystemContextFactory implements ContextFactory<Context>, ContextResolver { - - // the component name as configured in the hosting module - private String name; - - // if this factory produces composites, the module will be the logical model associated with its children - private Module module; - - private CompositeContext parentContext; - - // the implementation type constructor - private Constructor ctr; - - // injectors for properties, references and other metadata values such as @Context - private List<Injector> setters; - - // an invoker for a method decorated with @Init - private EventInvoker init; - - // whether the component should be eagerly initialized when its scope starts - private boolean eagerInit; - - // an invoker for a method decorated with @Destroy - private EventInvoker destroy; - - // the scope of the implementation instance - private Scope scope; - - // if the component implementation scope is stateless - private boolean stateless; - - // if the component implementation is an composite context - private boolean isComposite; - - /** - * Creates the runtime configuration - * - * @param name the SCDL name of the component the context refers to - * @param ctr the implementation type constructor - * @param scope the scope of the component implementation type - */ - public SystemContextFactory(String name, Constructor ctr, Scope scope) { - this(name, null, ctr, scope); - } - - /** - * Creates the runtime configuration - * - * @param name the SCDL name of the component the context refers to - * @param module if this factory produces aggregagtes, the logical model associated with its children; otherwise - * null - * @param ctr the implementation type constructor - * @param scope the scope of the component implementation type - */ - public SystemContextFactory(String name, Module module, Constructor ctr, Scope scope) { - assert (name != null) : "Name was null"; - assert (ctr != null) : "Constructor was null"; - this.name = name; - this.module = module; - this.ctr = ctr; - this.isComposite = CompositeContext.class.isAssignableFrom(ctr.getDeclaringClass()); - this.scope = scope; - if (isComposite) { - scope = Scope.AGGREGATE; - } else { - stateless = (scope == Scope.INSTANCE); - } - } - - public String getName() { - return name; - } - - public void addProperty(String propertyName, Object value) { - - } - - public Scope getScope() { - return scope; - } - - public Context createContext() throws ContextCreationException { - if (isComposite) { - try { - // composite context types are themselves an instance context - PojoObjectFactory<CompositeContext> objectFactory = new PojoObjectFactory<CompositeContext>(ctr, null, setters); - CompositeContext ctx = objectFactory.getInstance(); - ctx.setName(name); - // the composite has been created, now register its children - if (module != null) { - try { - ctx.registerModelObject(module); - } catch (ConfigurationException e) { - ContextCreationException cce = new ContextCreationException("Error creating context", e); - cce.setIdentifier(getName()); - throw cce; - } - - } - return ctx; - } catch (TuscanyRuntimeException e) { - e.addContextName(name); - throw e; - } - } else { - PojoObjectFactory objectFactory = new PojoObjectFactory(ctr, null, setters); - return new SystemAtomicContext(name, objectFactory, eagerInit, init, destroy, stateless); - } - } - - public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { - throw new UnsupportedOperationException(); - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - return null; - } - - public Map<String, TargetWireFactory> getTargetWireFactories() { - return null; - } - - public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { - throw new UnsupportedOperationException(); - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity) { - - } - - public List<SourceWireFactory> getSourceWireFactories() { - return null; - } - - public void setSetters(List<Injector> setters) { - this.setters = setters; - } - - public void setEagerInit(boolean val) { - eagerInit = val; - } - - public void setInitInvoker(EventInvoker invoker) { - init = invoker; - } - - public void setDestroyInvoker(EventInvoker invoker) { - destroy = invoker; - } - - public void prepare(CompositeContext parent) { - parentContext = parent; - } - - public CompositeContext getCurrentContext() { - return parentContext; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemEntryPointContextFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemEntryPointContextFactory.java deleted file mode 100644 index c9cfeccd6b..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemEntryPointContextFactory.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.config; - -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.EntryPointContext; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.system.context.SystemEntryPointContext; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.List; -import java.util.Map; - -/** - * Creates {@link SystemEntryPointContext} instances based on an entry point configuration in an assembly model - * - * @version $Rev$ $Date$ - */ -public class SystemEntryPointContextFactory implements ContextFactory<EntryPointContext>, ContextResolver { - - // the name of the entry point - private String name; - - private CompositeContext parentContext; - - private String targetName; - - private Class serviceInterface; - - public SystemEntryPointContextFactory(String name, String targetName, Class serviceInterface) { - this.name = name; - this.targetName = targetName; - this.serviceInterface = serviceInterface; - } - - public EntryPointContext createContext() throws ContextCreationException { - return new SystemEntryPointContext(name, targetName, serviceInterface, this); - } - - public Scope getScope() { - return Scope.MODULE; - } - - public String getName() { - return name; - } - - - public void addTargetWireFactory(String serviceName, TargetWireFactory pFactory) { - throw new UnsupportedOperationException(); - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - return null; - } - - public Map<String, TargetWireFactory> getTargetWireFactories() { - return null; - } - - public void addSourceWireFactory(String referenceName, SourceWireFactory pFactory) { - throw new UnsupportedOperationException(); - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity) { - throw new UnsupportedOperationException(); - } - public void addProperty(String propertyName, Object value) { - - } - - public List<SourceWireFactory> getSourceWireFactories() { - return null; - } - - public void prepare(CompositeContext parent) { - this.parentContext = parent; - } - - public CompositeContext getCurrentContext() { - return parentContext; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExtensibilityElement.java deleted file mode 100644 index 14655c2393..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExtensibilityElement.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.config; - -/** - * Base marker for system metadata extensions - * - * @version $$Rev$$ $$Date$$ - */ -public interface SystemExtensibilityElement { - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExternalServiceContextFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExternalServiceContextFactory.java deleted file mode 100644 index d62afa4425..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExternalServiceContextFactory.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.config; - -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.ExternalServiceContext; -import org.apache.tuscany.core.injection.InterCompositeReferenceFactory; -import org.apache.tuscany.core.system.context.SystemExternalServiceContext; -import org.apache.tuscany.core.system.injection.AutowireObjectFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.List; -import java.util.Map; - -/** - * Creates system type external service contexts - * - * @version $Rev$ $Date$ - * @see org.apache.tuscany.core.context.ExternalServiceContext - * @see org.apache.tuscany.core.system.context.SystemExternalServiceContext - */ -public class SystemExternalServiceContextFactory implements ContextFactory<ExternalServiceContext>, ContextResolver { - - // the name of the external service - private String name; - - // the factory for returning a reference to the implementation instance of the component represented by the external - // service - private ObjectFactory factory; - - private CompositeContext parentContext; - - public SystemExternalServiceContextFactory(String name, ObjectFactory factory) { - assert (name != null) : "Name was null"; - assert (factory != null) : "Object factory was null"; - this.name = name; - this.factory = factory; - } - - public Scope getScope() { - return Scope.MODULE; - } - - public String getName() { - return name; - } - - public void addProperty(String propertyName, Object value) { - throw new UnsupportedOperationException(); - } - - public ExternalServiceContext createContext() throws ContextCreationException { - return new SystemExternalServiceContext(name, factory); - } - - public void addTargetWireFactory(String serviceName, TargetWireFactory pFactory) { - throw new UnsupportedOperationException(); - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - return null; - } - - public Map<String, TargetWireFactory> getTargetWireFactories() { - return null; - } - - public void addSourceWireFactory(String referenceName, SourceWireFactory pFactory) { - throw new UnsupportedOperationException(); - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity) { - - } - - public List<SourceWireFactory> getSourceWireFactories() { - return null; - } - - public void prepare(CompositeContext parent) { - parentContext = parent; - if (factory instanceof InterCompositeReferenceFactory) { - ((InterCompositeReferenceFactory) factory).setContextResolver(this); - } else if (factory instanceof AutowireObjectFactory) { - ((AutowireObjectFactory) factory).setContextResolver(this); - } - } - - public CompositeContext getCurrentContext() { - return parentContext; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java deleted file mode 100644 index 7fca219399..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.config; - -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.injection.Injector; - -/** - * An extensiblity element which provides {@link org.apache.tuscany.core.injection.Injector}s based on - * component type metadata specific to system services - * - * @version $$Rev$$ $$Date$$ - */ -public interface SystemInjectorExtensibilityElement { - /** - * Creates an injector - * - * @param resolver that returns the current composite context - */ - public Injector<?> getInjector(ContextResolver resolver); - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemObjectContextFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemObjectContextFactory.java deleted file mode 100644 index d4a21dd427..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemObjectContextFactory.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.config; - -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.core.wire.WireFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.system.context.SystemAtomicContext; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.List; -import java.util.Map; - -/** - * A ContextFactory that contains the configuration needed to convert a simple - * Java Object into a component. The object is assumed to be fully initialized and - * will always be added with MODULE scope. - * - * @version $Rev$ $Date$ - */ -public class SystemObjectContextFactory implements ContextFactory { - private final String name; - private final ObjectFactory<?> objectFactory; - - /** - * Construct a ContextFactory for the supplied Java Object. - * - * @param name the name to be assigned to the resulting component - * @param instance the Java Object that provides the implementation - */ - public SystemObjectContextFactory(String name, Object instance) { - this.name = name; - objectFactory = new SingletonObjectFactory<Object>(instance); - } - - public Context createContext() throws ContextCreationException { - return new SystemAtomicContext(name, objectFactory, false, null, null, false); - } - - public Scope getScope() { - return Scope.MODULE; - } - - public String getName() { - return name; - } - - public void addProperty(String propertyName, Object value) { - - } - - public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { - throw new UnsupportedOperationException(); - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - throw new UnsupportedOperationException(); - } - - public Map getTargetWireFactories() { - throw new UnsupportedOperationException(); - } - - public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { - throw new UnsupportedOperationException(); - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity) { - - } - - public List<WireFactory> getSourceWireFactories() { - throw new UnsupportedOperationException(); - } - - public void prepare(CompositeContext parent) { - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java deleted file mode 100644 index 42d3151c78..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.config.extensibility; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.system.config.SystemInjectorExtensibilityElement; -import org.apache.tuscany.core.system.injection.AutowireObjectFactory; - -/** - * A metadata extensbility element for autowires; creates injectors which return the target of an autowire - * - * @version $$Rev$$ $$Date$$ - */ -public class AutowireExtensibilityElement implements SystemInjectorExtensibilityElement { - - private Method method; - private Field field; - - public AutowireExtensibilityElement(Method m) { - assert(m == null || m.getParameterTypes().length == 1): "Illegal number of parameters"; - method = m; - } - - public AutowireExtensibilityElement(Field f) { - field = f; - } - - @SuppressWarnings("unchecked") - public Injector<?> getInjector(ContextResolver resolver) { - if (method != null) { - return new MethodInjector(method, new AutowireObjectFactory(method.getParameterTypes()[0], resolver)); - } else { - return new FieldInjector(field, new AutowireObjectFactory(field.getType(), resolver)); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java deleted file mode 100644 index 61c89d991b..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.config.extensibility; - -import java.lang.reflect.Method; -import java.lang.reflect.Field; - -import org.apache.tuscany.core.system.config.SystemExtensibilityElement; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.injection.ContextObjectFactory; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.common.monitor.MonitorFactory; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class MonitorExtensibilityElement implements SystemExtensibilityElement { - - private Method method; - private Field field; - - public MonitorExtensibilityElement(Method m) { - assert(m.getParameterTypes().length == 1): "Illegal number of parameters"; - method = m; - } - - public MonitorExtensibilityElement(Field f) { - field = f; - } - - public Injector<?> getInjector(MonitorFactory factory) { - if (method != null) { - Object monitor = factory.getMonitor(method.getParameterTypes()[0]); - return new MethodInjector(method, new SingletonObjectFactory<Object>(monitor)); - } else { - Object monitor = factory.getMonitor(field.getType()); - return new FieldInjector(field, new SingletonObjectFactory<Object>(monitor)); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java deleted file mode 100644 index b95b87c8de..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.config.extensibility; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.injection.ContextObjectFactory; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.system.config.SystemInjectorExtensibilityElement; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class ParentContextExtensibilityElement implements SystemInjectorExtensibilityElement { - - private Method method; - private Field field; - - public ParentContextExtensibilityElement(Method m) { - assert(m.getParameterTypes().length == 1): "Illegal number of parameters"; - method = m; - } - - public ParentContextExtensibilityElement(Field f) { - field = f; - } - - public Injector<?> getInjector(ContextResolver resolver) { - if (method != null) { - return new MethodInjector(method, new ContextObjectFactory(resolver)); - } else { - return new FieldInjector(field, new ContextObjectFactory(resolver)); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java deleted file mode 100644 index 1885a5eaaa..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.config.processor; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.InvalidSetterException; -import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.system.config.extensibility.AutowireExtensibilityElement; -import org.apache.tuscany.core.context.SystemCompositeContext; -import org.apache.tuscany.core.context.ConfigurationContext; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.common.monitor.MonitorFactory; - -/** - * Processes {@link Autowire} annotations - * - * @version $$Rev$$ $$Date$$ - */ -public class AutowireProcessor extends ImplementationProcessorSupport { - - @Override - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { - Autowire annotation = method.getAnnotation(Autowire.class); - if (annotation != null) { - if (!Modifier.isPublic(method.getModifiers())) { - InvalidSetterException e = new InvalidSetterException("Autowire setter method is not public"); - e.setIdentifier(method.toString()); - throw e; - } - if (method.getParameterTypes().length != 1){ - InvalidSetterException e = new InvalidSetterException("Autowire setter method must have one parameter"); - e.setIdentifier(method.toString()); - throw e; - } - checkAutowireType(method.getParameterTypes()[0],method.getDeclaringClass()); - type.getExtensibilityElements().add(new AutowireExtensibilityElement(method)); - } - } - - @Override - public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { - checkAutowireType(field.getType(),field.getDeclaringClass()); - int modifiers = field.getModifiers(); - Autowire annotation = field.getAnnotation(Autowire.class); - if (annotation != null) { - if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { - InvalidSetterException e = new InvalidSetterException("Autowire field is not public or protected"); - e.setIdentifier(field.getName()); - throw e; - } - type.getExtensibilityElements().add(new AutowireExtensibilityElement(field)); - } - } - - - - private void checkAutowireType(Class paramClass, Class declaringClass) throws BuilderConfigException{ - if (SystemCompositeContext.class.isAssignableFrom(declaringClass) - && !(paramClass.equals(ConfigurationContext.class) - || paramClass.equals(MonitorFactory.class) - || paramClass.equals(RuntimeContext.class) || paramClass.equals( - AutowireContext.class))) { - BuilderConfigException e = new BuilderConfigException("Illegal autowire type for system context"); - e.setIdentifier(paramClass.getName()); - throw e; - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java deleted file mode 100644 index 9d7f535cc8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.config.processor; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.InvalidSetterException; -import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport; -import org.apache.tuscany.core.system.annotation.Monitor; -import org.apache.tuscany.core.system.config.extensibility.MonitorExtensibilityElement; -import org.apache.tuscany.model.assembly.ComponentType; - -/** - * Processes {@link org.apache.tuscany.core.system.annotation.Autowire} annotations - * - * @version $$Rev$$ $$Date$$ - */ -public class MonitorProcessor extends ImplementationProcessorSupport { - - @Override - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { - Monitor annotation = method.getAnnotation(Monitor.class); - if (annotation != null) { - if (!Modifier.isPublic(method.getModifiers())) { - InvalidSetterException e = new InvalidSetterException("Monitor setter method is not public"); - e.setIdentifier(method.toString()); - throw e; - } - if (method.getParameterTypes().length != 1) { - InvalidSetterException e = new InvalidSetterException("Monitor setter method must have one parameter"); - e.setIdentifier(method.toString()); - throw e; - } - type.getExtensibilityElements().add(new MonitorExtensibilityElement(method)); - } - } - - @Override - public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { - int modifiers = field.getModifiers(); - Monitor annotation = field.getAnnotation(Monitor.class); - if (annotation != null) { - if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { - InvalidSetterException e = new InvalidSetterException("Monitor field is not public or protected"); - e.setIdentifier(field.getName()); - throw e; - } - type.getExtensibilityElements().add(new MonitorExtensibilityElement(field)); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java deleted file mode 100644 index 1ddc68e3e8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.config.processor; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.InvalidSetterException; -import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.system.annotation.ParentContext; -import org.apache.tuscany.core.system.config.extensibility.ParentContextExtensibilityElement; -import org.apache.tuscany.model.assembly.ComponentType; - -/** - * Processes {@link org.apache.tuscany.core.system.annotation.Autowire} annotations - * - * @version $$Rev$$ $$Date$$ - */ -public class ParentContextProcessor extends ImplementationProcessorSupport { - - @Override - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { - ParentContext annotation = method.getAnnotation(ParentContext.class); - if (annotation != null) { - if (!Modifier.isPublic(method.getModifiers())) { - InvalidSetterException e = new InvalidSetterException("ParentContext setter method is not public"); - e.setIdentifier(method.toString()); - throw e; - } - if (method.getParameterTypes().length != 1 - && !CompositeContext.class.isAssignableFrom(method.getParameterTypes()[0])) { - InvalidSetterException e = new InvalidSetterException("ParentContext setter method must have one parameter of type " + CompositeContext.class.getName()); - e.setIdentifier(method.toString()); - throw e; - } - type.getExtensibilityElements().add(new ParentContextExtensibilityElement(method)); - } - } - - @Override - public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { - int modifiers = field.getModifiers(); - ParentContext annotation = field.getAnnotation(ParentContext.class); - if (annotation != null) { - if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { - InvalidSetterException e = new InvalidSetterException("ParentContext field is not public or protected"); - e.setIdentifier(field.getName()); - throw e; - } - type.getExtensibilityElements().add(new ParentContextExtensibilityElement(field)); - } - } - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAtomicContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAtomicContext.java deleted file mode 100644 index 374555bfb6..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAtomicContext.java +++ /dev/null @@ -1,159 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.injection.EventInvoker; -import org.apache.tuscany.core.injection.ObjectCallbackException; -import org.apache.tuscany.core.injection.ObjectCreationException; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.impl.AbstractContext; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ContextInitException; -import org.apache.tuscany.core.context.event.InstanceCreated; - -/** - * Manages system component implementation instances - * - * @version $Rev$ $Date$ - */ -public class SystemAtomicContext extends AbstractContext implements AtomicContext { - - private boolean eagerInit; - - private EventInvoker<Object> initInvoker; - - private EventInvoker<Object> destroyInvoker; - - private boolean stateless; - - // the cached target instance - private Object cachedTargetInstance; - - // responsible for creating a new implementation instance with injected references and properties - private ObjectFactory objectFactory; - - public SystemAtomicContext(String name, ObjectFactory objectFactory, boolean eagerInit, EventInvoker<Object> initInvoker, - EventInvoker<Object> destroyInvoker, boolean stateless) { - super(name); - assert (objectFactory != null) : "Object factory was null"; - if (eagerInit && initInvoker == null) { - throw new AssertionError("No intialization method found for eager init implementation"); - } - this.objectFactory = objectFactory; - this.eagerInit = eagerInit; - this.initInvoker = initInvoker; - this.destroyInvoker = destroyInvoker; - this.stateless = stateless; - } - - public void setName(String name) { - super.setName(name); - } - - protected int type; - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public void init() throws TargetException{ - getInstance(null); - } - - public void destroy() throws TargetException { - if (cachedTargetInstance != null) { - if (destroyInvoker != null) { - try { - destroyInvoker.invokeEvent(cachedTargetInstance); - } catch (ObjectCallbackException e) { - throw new TargetException(e.getCause()); - } - } - } - lifecycleState = STARTED; - } - - public synchronized Object getInstance(QualifiedName qName) throws TargetException { - if (cachedTargetInstance != null) { - return cachedTargetInstance; // already cached, just return - } - - if (getLifecycleState() == ERROR || getLifecycleState() == CONFIG_ERROR) { - return null; - } - synchronized (this) { - try { - Object instance = objectFactory.getInstance(); - // handle @Init - if (initInvoker != null) { - initInvoker.invokeEvent(instance); - } - publish(new InstanceCreated(this)); - lifecycleState = RUNNING; - if (stateless) { - return instance; - } else { - // cache the actual instance - cachedTargetInstance = instance; - return cachedTargetInstance; - } - } catch (ObjectCreationException e) { - lifecycleState = ERROR; - TargetException te = new TargetException("Error creating component instance", e); - te.setIdentifier(getName()); - throw te; - } - } - - } - - public Object getTargetInstance() throws TargetException { - return getInstance(null); - } - - public boolean isEagerInit() { - return eagerInit; - } - - public boolean isDestroyable() { - return (destroyInvoker != null); - } - - public void start() throws ContextInitException { - if (getLifecycleState() != UNINITIALIZED && getLifecycleState() != STOPPED) { - throw new IllegalStateException("Component must be in UNINITIALIZED state [" + getLifecycleState() + "]"); - } - if (objectFactory == null) { - lifecycleState = ERROR; - ContextInitException e = new ContextInitException("Object factory not found "); - e.setIdentifier(getName()); - throw e; - } - lifecycleState = INITIALIZED; - } - - public void stop() { - lifecycleState = STOPPED; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java deleted file mode 100644 index 9ac0abe38a..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.context.AutowireResolutionException; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.ConfigurationContext; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.ScopeStrategy; -import org.apache.tuscany.core.context.SystemCompositeContext; -import org.apache.tuscany.core.context.impl.AbstractCompositeContext; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.system.config.SystemObjectContextFactory; -import org.apache.tuscany.core.wire.WireFactoryFactory; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; - - -/** - * Implements an composite context for system components. By default a system context uses the scopes specified by - * {@link org.apache.tuscany.core.system.context.SystemScopeStrategy}. In addition, it implements an autowire policy - * where entry points configured with a {@link org.apache.tuscany.core.system.assembly.SystemBinding} are matched - * according to their exposed interface. A system context may contain child composite contexts but an entry point in a - * child context will only be outwardly accessible if there is an entry point that exposes it configured in the - * top-level system context. - * - * @version $Rev$ $Date$ - */ -public class SystemCompositeContextImpl extends AbstractCompositeContext implements SystemCompositeContext { - public SystemCompositeContextImpl() { - super(); - eventContext = new EventContextImpl(); - scopeStrategy = new SystemScopeStrategy(); - } - - public SystemCompositeContextImpl(String name, - CompositeContext parent, - AutowireContext autowire, - ScopeStrategy strategy, - EventContext ctx, - ConfigurationContext configCtx - ) { - super(name, parent, strategy, ctx, configCtx); - setAutowireContext(autowire); - scopeIndex = new ConcurrentHashMap<String, ScopeContext>(); - } - - public void registerJavaObject(String componentName, Class<?> service, Object instance) throws ConfigurationException { - SystemObjectContextFactory configuration = new SystemObjectContextFactory(componentName, instance); - registerConfiguration(configuration); - ScopeContext scope = scopeContexts.get(configuration.getScope()); - registerAutowireInternal(service, componentName, scope); - } - - // FIXME These should be removed and configured - private static final MessageFactory messageFactory = new MessageFactoryImpl(); - - private static final WireFactoryFactory WIRE_FACTORY_FACTORY = new JDKWireFactoryFactory(); - - public <T> T resolveInstance(Class<T> instanceInterface) throws AutowireResolutionException { - if (CompositeContext.class.equals(instanceInterface)) { - return instanceInterface.cast(this); - } else if (MessageFactory.class.equals(instanceInterface)) { - return instanceInterface.cast(messageFactory); - } else if (WireFactoryFactory.class.equals(instanceInterface)) { - return instanceInterface.cast(WIRE_FACTORY_FACTORY); - } else { - return super.resolveInstance(instanceInterface); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemEntryPointContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemEntryPointContext.java deleted file mode 100644 index 107e676c47..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemEntryPointContext.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.context.impl.AbstractContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.EntryPointContext; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.TargetException; - -/** - * Manages an entry point into a system module. System entry points cache a direct (i.e. non-proxied) reference to a - * component instance. - * - * @version $Rev$ $Date$ - */ -public class SystemEntryPointContext extends AbstractContext implements EntryPointContext { - - // a reference to the component's implementation instance exposed by the entry point - private Object cachedInstance; - - private ContextResolver resolver; - - private QualifiedName targetName; - - private Class serviceInterface; - - public SystemEntryPointContext(String name, String targetName, Class serviceInterface, ContextResolver resolver) { - super(name); - assert (resolver != null) : "Context resolver was null"; - assert (targetName != null) : "Target name was null"; - assert (serviceInterface != null) : "Service interface is null"; - this.serviceInterface = serviceInterface; - this.resolver = resolver; - this.targetName = new QualifiedName(targetName); - } - - public Object getInstance(QualifiedName qName) throws TargetException { - try { - if (cachedInstance == null) { - Context ctx = resolver.getCurrentContext().getContext(targetName.getPartName()); - if (ctx == null){ - return null; - } - cachedInstance = ctx.getInstance(targetName); - } - return cachedInstance; - } catch (TargetException e) { - e.addContextName(getName()); - throw e; - } - } - - public void start() throws CoreRuntimeException { - lifecycleState = RUNNING; - } - - public void stop() throws CoreRuntimeException { - lifecycleState = STOPPED; - } - - public Object getHandler() throws TargetException { - return getInstance(null); - } - - public Class getServiceInterface() { - return serviceInterface; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemExternalServiceContext.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemExternalServiceContext.java deleted file mode 100644 index b85bd2722b..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemExternalServiceContext.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.impl.AbstractContext; -import org.apache.tuscany.core.context.ExternalServiceContext; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.TargetException; - -/** - * An implementation of an external service for system wiring. As system components are not proxied and the system - * binding is by-reference, the implementation caches a reference to its configured target. - * - * @version $Rev$ $Date$ - */ -public class SystemExternalServiceContext extends AbstractContext implements ExternalServiceContext { - - // a factory for retrieving the target of the external service wire - private ObjectFactory factory; - - // the cached target - private Object cachedInstance; - - public SystemExternalServiceContext(String name, ObjectFactory factory) { - super(name); - assert (factory != null) : "Object factory was null"; - this.factory = factory; - } - - public Object getInstance(QualifiedName qName) throws TargetException { - try { - if (cachedInstance == null) { - cachedInstance = factory.getInstance(); - } - return cachedInstance; - } catch (TargetException e) { - e.addContextName(getName()); - throw e; - } - - } - - public void start() { - lifecycleState = RUNNING; - } - - public void stop() { - lifecycleState = STOPPED; - } - - public Object getHandler() throws TargetException { - return this; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemScopeStrategy.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemScopeStrategy.java deleted file mode 100644 index 76b9f2856d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemScopeStrategy.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.scope.AbstractScopeStrategy; -import org.apache.tuscany.core.context.scope.CompositeScopeContext; -import org.apache.tuscany.core.context.scope.ModuleScopeContext; -import org.apache.tuscany.core.context.scope.StatelessScopeContext; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.HashMap; -import java.util.Map; - -/** - * Implements a {@link org.apache.tuscany.core.context.ScopeStrategy} for a system composite context with the following scopes: - * <ul> - * <li>{@link org.apache.tuscany.model.assembly.Scope#AGGREGATE}</li> - * <li>{@link org.apache.tuscany.model.assembly.Scope#MODULE}</li> - * <li>{@link org.apache.tuscany.model.assembly.Scope#INSTANCE}</li> - * </ul> - * - * @version $Rev$ $Date$ - */ -public class SystemScopeStrategy extends AbstractScopeStrategy { - - public SystemScopeStrategy() { - } - - public Map<Scope, ScopeContext> getScopeContexts(EventContext eventContext) { - ScopeContext aggregrateScope = new CompositeScopeContext(eventContext); - ScopeContext moduleScoper = new ModuleScopeContext(eventContext); - ScopeContext statelessScope = new StatelessScopeContext(eventContext); - Map<Scope, ScopeContext> scopes = new HashMap<Scope, ScopeContext>(); - scopes.put(Scope.AGGREGATE, aggregrateScope); - scopes.put(Scope.MODULE, moduleScoper); - scopes.put(Scope.INSTANCE, statelessScope); - return scopes; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java deleted file mode 100644 index 6c1d291673..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.injection; - -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.injection.FactoryInitException; -import org.apache.tuscany.core.injection.ObjectCreationException; - -/** - * Returns an instance by resolving against an AutowireContext. - * - * @version $Rev: 385139 $ $Date: 2006-03-11 11:03:11 -0800 (Sat, 11 Mar 2006) $ - */ -public class AutowireObjectFactory<T> implements ObjectFactory<T> { - - private ContextResolver resolver; - - private Class<T> autowireType; - - /** - * - * @throws FactoryInitException - */ - public AutowireObjectFactory(Class<T> autowireType,ContextResolver resolver) { - assert (autowireType != null) : "Target interface was null"; - this.resolver = resolver; - this.autowireType = autowireType; - } - - /** - * Creates a new factory that resolves against the cuurent context using the given implementation type - * - * @throws FactoryInitException - */ - public AutowireObjectFactory(Class<T> implementationType) { - this(implementationType, null); - } - - public T getInstance() throws ObjectCreationException { - CompositeContext parent = resolver.getCurrentContext(); - if (parent == null) { - return null;// FIXME semantic here means required is not followed - } - if (!(parent instanceof AutowireContext)) { - ObjectCreationException e = new ObjectCreationException("Parent does not implement " - + AutowireContext.class.getName()); - e.setIdentifier(parent.getName()); - throw e; - } - AutowireContext ctx = (AutowireContext) parent; - return ctx.resolveInstance(autowireType); - } - - public void setContextResolver(ContextResolver resolver) { - this.resolver = resolver; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ContextBinder.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ContextBinder.java deleted file mode 100644 index 70b40e7269..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ContextBinder.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.webapp; - -import org.osoa.sca.ModuleContext; -import org.osoa.sca.SCA; - -/** - * @version $Rev$ $Date$ - */ -class ContextBinder extends SCA { - static final ContextBinder BINDER = new ContextBinder(); - - public void setContext(ModuleContext context) { - setModuleContext(context); - } - - public void start() { - throw new AssertionError(); - } - - public void stop() { - throw new AssertionError(); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/LazyHTTPSessionId.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/LazyHTTPSessionId.java deleted file mode 100644 index c9e69eaa82..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/LazyHTTPSessionId.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.webapp; - -import org.apache.tuscany.core.context.ScopeIdentifier; - -import javax.servlet.http.HttpServletRequest; - -/** - * Implements a <code>ScopeIdentifier</code> for a Servlet-based transport. - * Wraps an <code>HttpServletRequest</code> so that the session id associated - * with the current request may be lazily retrieved by the module context - i.e. - * if a session context or session-scoped component is not accessed, no session - * is created. - * - * @version $Rev$ $Date$ - */ -public class LazyHTTPSessionId implements ScopeIdentifier { - - private HttpServletRequest request; - - //---------------------------------- - // Constructors - //---------------------------------- - - public LazyHTTPSessionId(HttpServletRequest request) { - this.request = request; - } - - //---------------------------------- - // Methods - //---------------------------------- - - /** - * Returns the session identifier - * - * @see org.apache.tuscany.core.context.ScopeIdentifier#getIdentifier() - */ - public Object getIdentifier() { - return request.getSession(true); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ServletHost.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ServletHost.java deleted file mode 100644 index 85a4a180c5..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ServletHost.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.webapp; - -import javax.servlet.Servlet; - -/** - * Service interface implemented by host environments that allow Servlets - * to be registered. - * <p/> - * This interface allows an SCA system component to register a servlet to handle - * inbound requests. - * - * @version $Rev$ $Date$ - */ -public interface ServletHost { - /** - * Register a mapping for an instance of a Servlet. - * This requests that the servlet container direct all requests to the - * designated mapping to the supplied Servlet instance. - * - * @param mapping the uri-mapping for the Servlet - * @param servlet the Servlet that should be invoked - */ - void registerMapping(String mapping, Servlet servlet); - - /** - * Unregister a servlet mapping. - * This directs the servlet contain not to direct any more requests to - * a previously registered Servlet. - * - * @param mapping the uri-mapping for the Servlet - */ - void unregisterMapping(String mapping); - - /** - * Get the servlet instance registered for the mapping. - * - * @param mapping the uri-mapping for the Servlet - * @return the Servelt for the mapping or null if there is no Servlet registered for the mapping - */ - @Deprecated - Servlet getMapping(String mapping); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyRequestFilter.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyRequestFilter.java deleted file mode 100644 index 6637448204..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyRequestFilter.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.webapp; - -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.event.HttpSessionBound; -import org.apache.tuscany.core.context.event.RequestStart; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.osoa.sca.CurrentModuleContext; -import org.osoa.sca.ModuleContext; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.Filter; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.FilterConfig; -import javax.servlet.ServletResponse; -import javax.servlet.FilterChain; -import javax.servlet.ServletRequest; -import java.io.IOException; - -/** - * Notifies the {@link org.apache.tuscany.core.context.CompositeContext} of web request start and end events as well as setting up the - * current session context. The latter is done using lazy Servlet-based session retrieval. The filter fires a session - * start event, passing a <tt>LazyServletSessionId</tt> as the session id. The <tt>LazyServletSessionId</tt> is a - * wrapper for the servlet request which may be called by the <tt>ModuleContext</tt> to retrieve the session id - * lazily. - * - * @version $Rev: 379957 $ $Date: 2006-02-22 14:58:24 -0800 (Wed, 22 Feb 2006) $ - */ -public class TuscanyRequestFilter implements Filter { - private CompositeContext moduleContext; - - public TuscanyRequestFilter() { - } - - public void init(FilterConfig filterConfig) throws ServletException { - ServletContext servletContext = filterConfig.getServletContext(); - moduleContext = (CompositeContext) servletContext.getAttribute(TuscanyServletListener.MODULE_COMPONENT_NAME); - } - - public void destroy() { - } - - public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws ServletException, IOException { - ModuleContext oldContext = CurrentModuleContext.getContext(); - try { - // Set the current module context - ContextBinder.BINDER.setContext((ModuleContext) moduleContext); - - // Handle a request - if (request instanceof HttpServletRequest) { - if (((HttpServletRequest) request).getSession(false) != null) { - - // A session is already active - moduleContext.publish(new HttpSessionBound(this, ((HttpServletRequest) request).getSession(true))); - } else { - // Create a lazy wrapper since a session is not yet active - moduleContext.publish(new HttpSessionBound(this, new LazyHTTPSessionId((HttpServletRequest) request))); - } - } else { - moduleContext.publish(new HttpSessionBound(this, request)); - } - // Start processing the request - moduleContext.publish(new RequestStart(this, request)); - // Dispatch to the next filter - filterChain.doFilter(request, response); - } catch (Exception e) { - throw new ServletException(e); - - } finally { - try { - // End processing the request - moduleContext.publish(new RequestEnd(this, request)); - } catch (Exception e) { - throw new ServletException(e); - } - ContextBinder.BINDER.setContext(oldContext); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyServletListener.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyServletListener.java deleted file mode 100644 index 8c9c215d64..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyServletListener.java +++ /dev/null @@ -1,129 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.webapp; - -import org.apache.tuscany.common.monitor.MonitorFactory; -import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.client.BootstrapHelper; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.SystemCompositeContext; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.HttpSessionEnd; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.runtime.RuntimeContextImpl; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.osoa.sca.CurrentModuleContext; -import org.osoa.sca.ModuleContext; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.http.HttpSessionEvent; -import javax.servlet.http.HttpSessionListener; - -/** - * ServletContextListener that can be added to a standard web application to boot - * a Tuscany runtime inside that application. All implementation classes should - * be located in the web application itself. - * - * @version $Rev: 380792 $ $Date: 2006-02-24 11:25:11 -0800 (Fri, 24 Feb 2006) $ - */ -public class TuscanyServletListener implements ServletContextListener, HttpSessionListener { - public static final String SCA_COMPONENT_NAME = "org.apache.tuscany.core.webapp.ModuleComponentName"; - public static final String MODULE_COMPONENT_NAME = "org.apache.tuscany.core.webapp.ModuleComponentContext"; - public static final String TUSCANY_RUNTIME_NAME = RuntimeContext.class.getName(); - - private RuntimeContext runtime; - private CompositeContext moduleContext; - - private static final String SYSTEM_MODULE_COMPONENT = "org.apache.tuscany.core.system"; - - public void contextInitialized(ServletContextEvent servletContextEvent) { - ServletContext servletContext = servletContextEvent.getServletContext(); - String name = servletContext.getInitParameter(SCA_COMPONENT_NAME); - String uri = name; // todo get from context path - MonitorFactory monitorFactory = new NullMonitorFactory(); // todo have one that writes to the servlet log - - try { - bootRuntime(name, uri, monitorFactory); - } catch (ConfigurationException e) { - throw new RuntimeException(e.getMessage(), e); - } - - servletContext.setAttribute(TUSCANY_RUNTIME_NAME, runtime); - servletContext.setAttribute(MODULE_COMPONENT_NAME, moduleContext); - } - - public void contextDestroyed(ServletContextEvent servletContextEvent) { - moduleContext.publish(new ModuleStop(this)); - moduleContext.stop(); - SystemCompositeContext systemContext = runtime.getSystemContext(); - systemContext.publish(new ModuleStop(this)); - systemContext.stop(); - runtime.stop(); - servletContextEvent.getServletContext().removeAttribute(MODULE_COMPONENT_NAME); - servletContextEvent.getServletContext().removeAttribute(TUSCANY_RUNTIME_NAME); - } - - public void sessionCreated(HttpSessionEvent event) { - // do nothing since sessions are lazily created in {@link TuscanyRequestFilter} - } - - public void sessionDestroyed(HttpSessionEvent event) { - // todo do we actually need to bind the module context to the thread to fire this event? - ModuleContext oldContext = CurrentModuleContext.getContext(); - try { - ContextBinder.BINDER.setContext((ModuleContext) moduleContext); - moduleContext.publish(new HttpSessionEnd(this, event.getSession())); - } finally{ - ContextBinder.BINDER.setContext(oldContext); - } - } - - private void bootRuntime(String name, String uri, MonitorFactory monitorFactory) throws ConfigurationException { - - // Create an assembly model context - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - AssemblyContext modelContext = BootstrapHelper.getModelContext(classLoader); - - // Create a runtime context and start it - ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); - runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, new DefaultWireBuilder()); - runtime.start(); - - // Load and start the system configuration - SystemCompositeContext systemContext = runtime.getSystemContext(); - BootstrapHelper.bootstrapStaxLoader(systemContext, modelContext); - ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext); - ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT); - CompositeContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent); - context.publish(new ModuleStart(this)); - - // Load the SCDL configuration of the application module - CompositeContext rootContext = runtime.getRootContext(); - ModuleComponent moduleComponent = loader.loadModuleComponent(name, uri); - moduleContext = BootstrapHelper.registerModule(rootContext, moduleComponent); - - moduleContext.publish(new ModuleStart(this)); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/Interceptor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/Interceptor.java deleted file mode 100644 index 1e87e45616..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/Interceptor.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.core.message.Message; - -/** - * Synchronous, around-style mediation associated with a client- or target- side wire. - * - * @version $Rev$ $Date$ - */ -public interface Interceptor { - - /** - * Process a synchronous wire. - * - * @param msg the request Message for the wire - * @return the response Message from the wire - */ - Message invoke(Message msg); - - /** - * Sets the next interceptor. - * - * @param next - */ - void setNext(Interceptor next); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationConfiguration.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationConfiguration.java deleted file mode 100644 index 94e8d91ba5..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationConfiguration.java +++ /dev/null @@ -1,181 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; - -/** - * Contains a source- or target-side invocation pipeline for a service operation. The runtime framework creates invocation chains - * on a per-operation, per-service basis. Further, invocation chains are further distinguished by being part of the source or - * target sides of a wire. Chains are "bridged" together by the runtime by a set of {@link - * org.apache.tuscany.core.builder.WireBuilder}s with the source-side holding references to the target. - * <p/> - * <code>InvocationChain</code>s are managed by {@link WireConfiguration}s, which are used by {@link - * org.apache.tuscany.core.wire.WireFactory}s to buildSource wires and proxies. - * <p/> - * Invocation configurations must contain at least one interceptor and may have 0 to N handlers. Handlers process a wire request - * or response in a one-way fashion. A typical wire sequence where interceptors and handlers are configured for both the source - * and target-side will proceed as follows: - * <pre> - * <ol> - * <li>The first source interceptor will be called with a message, which will in - * turn invoke the next interceptor in the chain <li>The last source interceptor, which must be of type {@link - * org.apache.tuscany.core.wire.impl.RequestResponseInterceptor} if there are handlers present, will be invoked. The RR - * interceptor will in turn pass the message to a {@link MessageChannel} which will invoke all source-side request handlers. - * <li>The RR interceptor will then invoke the target-side request <code>MessageChannel</code>. - * <li>The last source-side handler, an instance of {@link org.apache.tuscany.core.wire.impl.MessageDispatcher}, will invoke the - * first source-side interceptor, which in turn will pass the message down the target-side interceptor chain. - * <li>If the target is a component instance the last target-side interceptor, an instance of - * {@link org.apache.tuscany.core.wire.impl.InvokerInterceptor} will retrieve the {@link TargetInvoker} from the message and - * call it to invoke the operation on a target instance. <tt>TargetInvoker</tt>s are help by - * the source proxy to enable optimizations such as caching of target instances. <li> The response is returned up the wire - * stack - * until it reaches the source-side <tt>RequestResponseInterceptor</tt>, which invokes the target and source-side response - * channels respectively. - * <li>The response is then passed back up the rest of the wire stack. </ol> - * </pre> - * <p/> - * The source-to-target bridge may be constructed in any of the following ways: - * <pre> - * <ul> - * <li>Source handler-to-target handler - * <li>Source handler-to-target interceptor - * <li>Source interceptor-to-target handler - * <li>Source interceptor-to-target interceptor - * </ul> - * </pre> - * <p/> - * In some scenarios, a service proxy may only contain target-side invocaton chains, for example, when a service is resolved - * through a locate operation by a non-component client. In this case, there will be no source-side wire chains and the target - * invoker will be held by the target-side and passed down the pipeline. - * - * @version $Rev$ $Date$ - * @see org.apache.tuscany.core.builder.WireBuilder - * @see WireFactory - * @see TargetInvoker - * @see org.apache.tuscany.core.wire.impl.MessageDispatcher - */ -public abstract class InvocationConfiguration { - - // the operation on the target that will utlimately be invoked - protected Method operation; - - // responsible for invoking a target instance - protected TargetInvoker targetInvoker; - - protected Interceptor interceptorChainHead; - - protected Interceptor interceptorChainTail; - - protected List<MessageHandler> requestHandlers; - - protected List<MessageHandler> responseHandlers; - - public InvocationConfiguration(Method operation) { - assert (operation != null) : "No operation type specified"; - this.operation = operation; - } - - /** - * Returns the target operation for this invocation chain - */ - public Method getMethod() { - return operation; - } - - /** - * Adds an request handler to the invocation chain - */ - public void addRequestHandler(MessageHandler handler) { - if (requestHandlers == null) { - requestHandlers = new ArrayList<MessageHandler>(); - } - requestHandlers.add(handler); - } - - /** - * Adds an response handler to the invocation chain - */ - public void addResponseHandler(MessageHandler handler) { - if (responseHandlers == null) { - responseHandlers = new ArrayList<MessageHandler>(); - } - responseHandlers.add(handler); - } - - /** - * Returns the request handler chain - */ - public List<MessageHandler> getRequestHandlers() { - return requestHandlers; - } - - /** - * Returns the response handler chain - */ - public List<MessageHandler> getResponseHandlers() { - return responseHandlers; - } - - /** - * Sets the target invoker to pass down the chain - */ - public void setTargetInvoker(TargetInvoker invoker) { - this.targetInvoker = invoker; - } - - /** - * Returns the target invoker that is passed down the chain - */ - public TargetInvoker getTargetInvoker() { - return targetInvoker; - } - - /** - * Adds an interceptor to the chain - */ - public void addInterceptor(Interceptor interceptor) { - if (interceptorChainHead == null) { - interceptorChainHead = interceptor; - } else { - interceptorChainTail.setNext(interceptor); - } - interceptorChainTail = interceptor; - } - - /** - * Returns the last interceptor in the chain - */ - public Interceptor getTailInterceptor() { - return interceptorChainTail; - } - - /** - * Returns the first interceptor in the chain - */ - public Interceptor getHeadInterceptor() { - return interceptorChainHead; - } - - /** - * Signals to the chain that its configuration is complete. Implementations may use this callback to prepare there invocation - * chains. - */ - public abstract void build(); -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationRuntimeException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationRuntimeException.java deleted file mode 100644 index 5e3dbaa204..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationRuntimeException.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import org.osoa.sca.ServiceRuntimeException; - -/** - * Denotes a runtime exception thrown during an invocation over a wire - * - * @version $Rev$ $Date$ - */ -public class InvocationRuntimeException extends ServiceRuntimeException { - - public InvocationRuntimeException() { - super(); - } - - public InvocationRuntimeException(String message) { - super(message); - } - - public InvocationRuntimeException(String message, Throwable cause) { - super(message, cause); - } - - public InvocationRuntimeException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageChannel.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageChannel.java deleted file mode 100644 index 07a7594849..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageChannel.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.core.message.Message; - -/** - * Represents a one-way pipeline through which messages are sent during an invocation over a wire - * - * @see org.apache.tuscany.core.message.Message - */ -public interface MessageChannel { - - /** - * Sends a message - */ - void send(Message message); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageHandler.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageHandler.java deleted file mode 100644 index 19442f3663..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.core.message.Message; - - -/** - * Performs a uni-directional mediation on a message - * - * @see org.apache.tuscany.core.message.Message - */ -public interface MessageHandler { - - /** - * Process a message. - */ - boolean processMessage(Message message); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MethodHashMap.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MethodHashMap.java deleted file mode 100644 index c0e40e0644..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MethodHashMap.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.core.config.JavaIntrospectionHelper; - -import java.lang.reflect.Method; -import java.util.HashMap; - -/** - * A <code>Map</code> implementation that performs a lookup on a collection of methods by method name. This implementation is used - * to map methods on one interface to compatible methods on another interface, for example, when flowing an invocation from a - * proxy injected on a source reference to a target service instance. - * - * @version $Rev$ $Date$ - */ -public class MethodHashMap<T extends InvocationConfiguration> extends HashMap<Method, T> { - - public MethodHashMap() { - super(); - } - - public MethodHashMap(int size) { - super(size); - } - - /** - * @see java.util.HashMap#get(java.lang.Object) - */ - public T get(Object key) { - if (key instanceof Method) { - Method m = (Method) key; - //FIXME find a more efficient way to find a matching method - Method closestMethod = JavaIntrospectionHelper.findClosestMatchingMethod(m.getName(), m.getParameterTypes(), super.keySet()); - return super.get(closestMethod); - } else { - throw new IllegalArgumentException("Key must be a method"); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/ProxyCreationException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/ProxyCreationException.java deleted file mode 100644 index 2caa613b8f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/ProxyCreationException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -/** - * Denotes an error creating a proxy representing for a wire - * - * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $ - */ -public class ProxyCreationException extends WireException { - - public ProxyCreationException() { - super(); - } - - public ProxyCreationException(String message, Throwable cause) { - super(message, cause); - } - - public ProxyCreationException(String message) { - super(message); - } - - public ProxyCreationException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceInvocationConfiguration.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceInvocationConfiguration.java deleted file mode 100644 index 80e1450a0d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceInvocationConfiguration.java +++ /dev/null @@ -1,131 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.core.wire.impl.MessageChannelImpl; -import org.apache.tuscany.core.wire.impl.MessageDispatcher; -import org.apache.tuscany.core.wire.impl.RequestResponseInterceptor; - -import java.lang.reflect.Method; - -/** - * Contains a source-side invocation pipeline for a service operation. - * - * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $ - */ -public class SourceInvocationConfiguration extends InvocationConfiguration { - - // the pointer to the bridged target head interceptor or null if the target has no interceptors - private Interceptor targetInterceptorChainHead; - - // the pointer to bridged target request channel, or null if the target has an interceptor - private MessageChannel targetRequestChannel; - - // the pointer to bridged target response channel, or null if the target has an interceptor - private MessageChannel targetResponseChannel; - - /** - * Creates an new wire configuration for the given service reference operation - * - * @param operation the method on the interface representing specified by the reference, where the method corresponds to the - * service operation - */ - public SourceInvocationConfiguration(Method operation) { - super(operation); - } - - /** - * Sets the head interceptor of the target-side configuration for the wire. Used when the runtime bridges source and target - * chains. - * - * @param interceptor - */ - public void setTargetInterceptor(Interceptor interceptor) { - targetInterceptorChainHead = interceptor; - } - - /** - * Returns the head target-side interceptor. This will be the head interceptor of the "bridged" target configuration. - */ - public Interceptor getTargetInterceptor() { - return targetInterceptorChainHead; - } - - /** - * Sets the target-side request channel. Used when the runtime bridges source and target chains. - */ - public void setTargetRequestChannel(MessageChannel channel) { - targetRequestChannel = channel; - } - - /** - * Sets the target-side response channel. Used when the runtime bridges source and target chains. - */ - public void setTargetResponseChannel(MessageChannel channel) { - targetResponseChannel = channel; - } - - /** - * Prepares the configuration by linking interceptors and handlers - */ - @Override - public void build() { - - if (requestHandlers != null && targetInterceptorChainHead != null) { - // on target-side, connect existing handlers and interceptors - MessageHandler messageDispatcher = new MessageDispatcher(targetInterceptorChainHead); - requestHandlers.add(messageDispatcher); - } - - if (requestHandlers != null) { - MessageChannel requestChannel = new MessageChannelImpl(requestHandlers); - MessageChannel responseChannel = new MessageChannelImpl(responseHandlers); - Interceptor channelInterceptor = new RequestResponseInterceptor(requestChannel, targetRequestChannel, - responseChannel, targetResponseChannel); - - if (interceptorChainHead != null) { - interceptorChainTail.setNext(channelInterceptor); - } else { - interceptorChainHead = channelInterceptor; - } - - } else { - // no request handlers - if (interceptorChainHead != null) { - if (targetInterceptorChainHead != null) { - // Connect source interceptor chain directly to target interceptor chain - interceptorChainTail.setNext(targetInterceptorChainHead); - // interceptorChainTail = targetInterceptorChainHead; - } else { - // Connect source interceptor chain to the target request channel - Interceptor channelInterceptor = new RequestResponseInterceptor(null, targetRequestChannel, null, - targetResponseChannel); - interceptorChainTail.setNext(channelInterceptor); - } - } else { - // no source interceptor chain or source handlers, conntect to target interceptor chain or channel - if (targetInterceptorChainHead != null) { - interceptorChainHead = targetInterceptorChainHead; - interceptorChainTail = targetInterceptorChainHead; - } else { - Interceptor channelInterceptor = new RequestResponseInterceptor(null, targetRequestChannel, null, - targetResponseChannel); - interceptorChainHead = channelInterceptor; - interceptorChainTail = channelInterceptor; - } - } - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceWireFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceWireFactory.java deleted file mode 100644 index c460c71bd5..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceWireFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire; - -/** - * Implementations are responsible for managing the source side of a wire. - * - * @version $$Rev$$ $$Date$$ - */ -public interface SourceWireFactory<T> extends WireFactory<T>{ - - /** - * Returns the configuration information used to create the source-side of a wire, including invocation chains - */ - public WireSourceConfiguration getConfiguration(); - - /** - * Sets the configuration information used to create the source-side of a wire, including invocation chains - */ - public void setConfiguration(WireSourceConfiguration config); - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvocationConfiguration.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvocationConfiguration.java deleted file mode 100644 index fc7810763d..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvocationConfiguration.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.core.wire.impl.MessageDispatcher; - -import java.lang.reflect.Method; - -/** - * Contains a target-side invocation pipeline for a service operation. - * - * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $ - */ -public class TargetInvocationConfiguration extends InvocationConfiguration { - - /** - * Creates an new target-side pipeline for the given operation - * - * @param operation the method on the interface representing target service, where the method corresponds to the service - * operation - */ - public TargetInvocationConfiguration(Method operation) { - super(operation); - } - - /** - * Prepares the configuration by linking interceptors and handlers - */ - @Override - public void build() { - if (requestHandlers != null && interceptorChainHead != null) { - // on target-side, connect existing handlers and interceptors - MessageHandler messageDispatcher = new MessageDispatcher(interceptorChainHead); - requestHandlers.add(messageDispatcher); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvoker.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvoker.java deleted file mode 100644 index 387da1bca3..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvoker.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.InvocationTargetException; - -/** - * Implementations are responsible for resolving a target and performing the actual invocation on it, for example, a - * service component implementation instance or an external service client. - * - * @version $Rev$ $Date$ - */ -public interface TargetInvoker extends Interceptor, Cloneable{ - - /** - * Responsible for invoking an operation on a target with the given payload - * - * @param payload the parameters of the target operation or null - * @throws InvocationTargetException if the target operation itself throws an exception. The root cause will be set - * to that exception - */ - public Object invokeTarget(Object payload) throws InvocationTargetException; - - /** - * Determines whether the proxy can be cached on the client/source side - */ - public boolean isCacheable(); - - /** - * Implementations must support deep cloning - */ - public Object clone() throws CloneNotSupportedException; -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetWireFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetWireFactory.java deleted file mode 100644 index f46754b975..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetWireFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire; - -/** - * Implementations are responsible for managing the target side of a wire - * - * @version $$Rev$$ $$Date$$ - */ -public interface TargetWireFactory<T> extends WireFactory<T> { - - /** - * Returns the configuration information used to create the target-side of a wire, including invocation chains - */ - public WireTargetConfiguration getConfiguration(); - - /** - * Sets the configuration information used to create the target-side of a wire, including invocation chains - */ - public void setConfiguration(WireTargetConfiguration config); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireConfiguration.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireConfiguration.java deleted file mode 100644 index 78ab6ee3c7..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireConfiguration.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.message.MessageFactory; - -import java.lang.reflect.Method; -import java.util.Map; - -/** - * Contains configuration for a wire, including its invocation chains. Invocation chains are accessed from the collection of - * {@link InvocationConfiguration}s keyed by operation on the service specified by the source reference or target service. - * <code>WireConfiguration</code> subtypes distinguish between source and target sides of a wire and hence return corresponding - * <code>InvocationChain</code> subtypes. Operations are represented using JDK reflection, i.e. as a <code>Method</code> - * corresponding to the Java interface representing the service. - * <p/> - * Wire configurations are created from an assembly model by the runtime during the buildSource phase. - * - * @version $Rev$ $Date$ - */ -public abstract class WireConfiguration<T extends InvocationConfiguration> { - - protected Map<Method, T> configurations; - - protected ClassLoader proxyClassLoader; - - protected MessageFactory messageFactory; - - protected QualifiedName targetName; - - /** - * Creates the configuration - * - * @param targetName the qualified name of the target service specified by the wire - * @param proxyClassLoader the classloader to use when creating a proxy - * @param messageFactory the factory used to create wire messages - */ - public WireConfiguration(QualifiedName targetName, ClassLoader proxyClassLoader, MessageFactory messageFactory) { - this.targetName = targetName; - this.messageFactory = messageFactory; - if (proxyClassLoader == null) { - this.proxyClassLoader = Thread.currentThread().getContextClassLoader(); - } else { - this.proxyClassLoader = proxyClassLoader; - } - } - - /** - * Returns the qualified name of the target service specified by the wire - */ - public QualifiedName getTargetName() { - return targetName; - } - - /** - * Returns the classloader used for creating proxies - */ - public ClassLoader getProxyClassLoader() { - return proxyClassLoader; - } - - /** - * Returns the factory used to create invocation messages - */ - public MessageFactory getMessageFactory() { - return messageFactory; - } - - /** - * Returns the invocation configuration for each operation on a service specified by a reference or a target service. - */ - public Map<Method, T> getInvocationConfigurations() { - return configurations; - } - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireException.java deleted file mode 100644 index 0bada0bbfc..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.common.TuscanyException; - -/** - * Denotes a top-level exception dealing with a wire - */ -public abstract class WireException extends TuscanyException { - - public WireException() { - super(); - } - - public WireException(String message) { - super(message); - } - - public WireException(String message, Throwable cause) { - super(message, cause); - } - - public WireException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactory.java deleted file mode 100644 index 55cab31adf..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactory.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -/** - * Implementations are responsible for managing source or target sides of a wire, including creation of service proxies. - * Source-side wires are injected on references and may contain policy interceptors and/or handlers specified by them. Target-side - * wires may contain policy interceptors and/or handlers specified by the service the wire is targeted to or one of its - * operations. Source- and target-side <code>WireFactory</code>s are held in the {@link org.apache.tuscany.core.builder.ContextFactory} - * associated with the source reference or target service. - * <p/> - * When an assembly is built by the runtime, source-side and target-side wires are "bridged" on the source side (i.e. a reference - * to the target-side is stored in the source-side). This bridging process is done by a series of {@link - * org.apache.tuscany.core.builder.WireBuilder}s configured in the runtime. When a new component implementation instance is - * created, it will be injected with a proxy for each reference containing the bridged source- and target-side wires. - * <p/> - * Unmanaged code, i.e. clients that are not components, that perform a locate operation are handled differently. In this case, a - * target-side proxy will be returned by the locate operation created by the <code>WireFactory</code> associated with the target - * service. This target-side proxy will only contain the target-side wire and its handlers/interceptors.Ê - * <p/> - * Wires are structured by operation; that is, they contain an invocation chain per operation on a service. Note that the service - * specified by a reference may differ in type from the target service specified by the wire. In this case, a mediation may be - * performed by the runtime. Hence, source-to-target bridging is done on a per operation basis. Source- and target-side Invocation - * chains are accessible through the subtypes of <code>WireFactory</code>. - * - * @version $Rev$ $Date$ - */ -public interface WireFactory<T> { - - /** - * Prepares the factory. This will typically be called at buildSource time, after bridging source- and target-side invocation chains. - * - * @throws WireFactoryInitException if an error is encountered during initialization - */ - public void initialize() throws WireFactoryInitException; - - /** - * Returns a proxy for a service specified by a reference or target - */ - public T createProxy() throws ProxyCreationException; - - /** - * Sets the primary interface type generated proxies implement - */ - public void setBusinessInterface(Class interfaze); - - /** - * Returns the primary interface type implemented by generated proxies - */ - public Class getBusinessInterface(); - - /** - * Adds an interface type generated proxies implement - */ - public void addInterface(Class claz); - - /** - * Returns an array of all interfaces implemented by generated proxies - */ - public Class[] getImplementatedInterfaces(); - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryFactory.java deleted file mode 100644 index f055ecd427..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import java.lang.reflect.InvocationHandler; - -/** - * Implementations provide a runtime system service that creates {@link WireFactory}s - * - * @version $Rev$ $Date$ - */ -public interface WireFactoryFactory { - - /** - * Creates a target-side wire factory - */ - public TargetWireFactory createTargetWireFactory(); - - /** - * Creates a source-side wire factory - */ - public SourceWireFactory createSourceWireFactory(); - - /** - * Determines whether the given object is a proxy - */ - public boolean isProxy(Object object); - - /** - * Returns an wire handler fronting the wire chains used by the proxy. Note that should SCA define a - * DII, this could return such an interface. - * - * @throws IllegalArgumentException if the class is not a proxy - */ - public InvocationHandler getHandler(Object proxy) throws IllegalArgumentException; -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryInitException.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryInitException.java deleted file mode 100644 index caf535ee00..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryInitException.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -/** - * Denotes an error initializing a wire factory - * - * @version $Rev$ $Date$ - */ -public class WireFactoryInitException extends WireException { - - public WireFactoryInitException() { - super(); - } - - public WireFactoryInitException(String message) { - super(message); - } - - public WireFactoryInitException(String message, Throwable cause) { - super(message, cause); - } - - public WireFactoryInitException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireSourceConfiguration.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireSourceConfiguration.java deleted file mode 100644 index d9408b2fb0..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireSourceConfiguration.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.message.MessageFactory; - -import java.lang.reflect.Method; -import java.util.Map; - -/** - * Contains configuration for the source side of a wire - * - * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $ - */ -public class WireSourceConfiguration extends WireConfiguration<SourceInvocationConfiguration> { - - private String referenceName; - - /** - * Creates the source side of a wire - * - * @param referenceName the name of the reference the wire is associated with - * @param targetName the qualified name of the target service specified by the wire - * @param invocationConfigs a collection of service operation-to-invocation chain mappings - * @param proxyClassLoader the classloader to use when creating a proxy - * @param messageFactory the factory used to create wire messages - */ - public WireSourceConfiguration(String referenceName, QualifiedName targetName, - Map<Method, SourceInvocationConfiguration> invocationConfigs, ClassLoader proxyClassLoader, MessageFactory messageFactory) { - super(targetName, proxyClassLoader, messageFactory); - this.referenceName = referenceName; - this.configurations = invocationConfigs; - } - - /** - * Creates the source side of a wire where the reference is "anonymous", i.e. on an entry point - * - * @param targetName the qualified name of the target service specified by the wire - * @param invocationConfigs a collection of service operation-to-invocation chain mappings - * @param proxyClassLoader the classloader to use when creating a proxy - * @param messageFactory the factory used to create wire messages - */ - public WireSourceConfiguration(QualifiedName targetName, - Map<Method, SourceInvocationConfiguration> invocationConfigs, ClassLoader proxyClassLoader, MessageFactory messageFactory) { - this(null, targetName, invocationConfigs, proxyClassLoader, messageFactory); - } - - - /** - * Returns the name of the source reference - */ - public String getReferenceName() { - return referenceName; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireTargetConfiguration.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireTargetConfiguration.java deleted file mode 100644 index ce6ebade0c..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireTargetConfiguration.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.context.QualifiedName; - -import java.lang.reflect.Method; -import java.util.Map; - -/** - * Contains configuration for the target side of a wire - * - * @version $$Rev$$ $$Date$$ - */ -public class WireTargetConfiguration extends WireConfiguration<TargetInvocationConfiguration> { - - /** - * Creates the source side of a wire - * - * @param targetName the qualified name of the target service specified by the wire - * @param invocationConfigs a collection of target service operation-to-invocation chain mappings - * @param proxyClassLoader the classloader to use when creating a proxy - * @param messageFactory the factory used to create wire messages - */ - public WireTargetConfiguration(QualifiedName targetName, Map<Method, TargetInvocationConfiguration> invocationConfigs, - ClassLoader proxyClassLoader, MessageFactory messageFactory) { - super(targetName, proxyClassLoader, messageFactory); - assert (invocationConfigs != null) : "No wire configuration map specified"; - configurations = invocationConfigs; - - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/InvokerInterceptor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/InvokerInterceptor.java deleted file mode 100644 index 9c114c013e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/InvokerInterceptor.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire.impl; - -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.InvocationRuntimeException; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.apache.tuscany.core.message.Message; - -/** - * Serves as a tail interceptor on a target wire chain. This implementation dispatches to the target invoker - * passed inside the wire message. Target invokers are passed from the source in order to allow for caching of - * target instances. - * - * @see org.apache.tuscany.core.wire.TargetInvoker - * @version $Rev$ $Date$ - */ -public class InvokerInterceptor implements Interceptor { - - public InvokerInterceptor() { - } - - 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) { - throw new IllegalStateException("This interceptor must be the last one in an target interceptor chain"); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageChannelImpl.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageChannelImpl.java deleted file mode 100644 index 8b9d484313..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageChannelImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.impl; - -import org.apache.tuscany.core.wire.MessageChannel; -import org.apache.tuscany.core.wire.MessageHandler; -import org.apache.tuscany.core.message.Message; - -import java.util.List; - -/** - * A channel comprising an ordered collection of message handlers. - * - *@see org.apache.tuscany.core.message.Message - * @version $Rev$ $Date$ - */ -public class MessageChannelImpl implements MessageChannel { - - private final List<MessageHandler> pipeline; - - //---------------------------------- - // Constructors - //---------------------------------- - - /** - * Construct a new channel comprising the supplied list of handlers. - * - * @param pipeline the Handlers in the channel - */ - public MessageChannelImpl(List<MessageHandler> pipeline) { - this.pipeline = pipeline; - } - - //---------------------------------- - // Methods - //---------------------------------- - - /** - * Send a message down the channel. The message will be processed by all handlers - * in order until one returns false to indicate processing is complete or all - * handlers have been called. - * - * @param msg a Message to send down the channel - */ - public void send(Message msg) { - if (pipeline!=null) { - for (MessageHandler handler : pipeline) { - if (!handler.processMessage(msg)) { - break; - } - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageDispatcher.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageDispatcher.java deleted file mode 100644 index ada01b7f91..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageDispatcher.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.impl; - -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.MessageHandler; -import org.apache.tuscany.core.message.Message; - -/** - * A message handler that dispatches the message through an interceptor stack and the uses the response channel to - * return the wire result. - * - * @version $Rev$ $Date$ - */ -public class MessageDispatcher implements MessageHandler { - private final Interceptor head; - - /** - * Construct a handler that dispatches messages to an Interceptor stack. - * - * @param head the interceptor at the head of the stack - */ - public MessageDispatcher(Interceptor head) { - this.head = head; - } - - public boolean processMessage(Message msg) { - Message resp = head.invoke(msg); - msg.getCallbackChannel().send(resp); - return false; - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/NullWireFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/NullWireFactory.java deleted file mode 100644 index e46ed26184..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/NullWireFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.impl; - -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.wire.WireConfiguration; -import org.apache.tuscany.core.wire.ProxyCreationException; -import org.apache.tuscany.core.wire.WireFactory; -import org.apache.tuscany.core.wire.WireFactoryInitException; - -/** - * Returns an actual implementation instance as opposed to a proxy. Used in cases where proxying may be optimized away. - * - * @version $Rev: 379957 $ $Date: 2006-02-22 14:58:24 -0800 (Wed, 22 Feb 2006) $ - */ -public class NullWireFactory implements WireFactory { - - private CompositeContext parentContext; - - private String targetName; - - private Class businessInterface; - - public NullWireFactory(String componentName, CompositeContext parentContext) { - assert (parentContext != null) : "Parent context was null"; - this.targetName = componentName; - this.parentContext = parentContext; - } - - public void initialize(Class businessInterface, WireConfiguration config) throws WireFactoryInitException { - this.businessInterface = businessInterface; - } - - public Object createProxy() throws ProxyCreationException { - return parentContext.getContext(targetName); - } - - public void initialize() throws WireFactoryInitException { - } - - public void setBusinessInterface(Class interfaze) { - businessInterface = interfaze; - } - - public Class getBusinessInterface() { - return businessInterface; - } - - public void addInterface(Class claz) { - throw new UnsupportedOperationException(); - } - - public Class[] getImplementatedInterfaces() { - throw new UnsupportedOperationException(); - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/OneWayInterceptor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/OneWayInterceptor.java deleted file mode 100644 index 4e3bb460aa..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/OneWayInterceptor.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.impl; - -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.MessageChannel; -import org.apache.tuscany.core.message.Message; - -/** - * An interceptor that sends the wire Message down its request channel and does not expect a response. - * - * @version $Rev$ $Date$ - */ -public class OneWayInterceptor implements Interceptor { - private MessageChannel requestChannel; - - /** - * Construct an interceptor that sends messages down the supplied channel. - * - * @param requestChannel the channel to send messages down - */ - public OneWayInterceptor(MessageChannel requestChannel) { - this.requestChannel = requestChannel; - } - - public Message invoke(Message message) { - requestChannel.send(message); - return null; - } - - public void setNext(Interceptor next) { - throw new IllegalStateException("This interceptor must be the last one in an interceptor chain"); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/RequestResponseInterceptor.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/RequestResponseInterceptor.java deleted file mode 100644 index ae1c69fc12..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/RequestResponseInterceptor.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.impl; - -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.MessageChannel; -import org.apache.tuscany.core.message.Message; - -/** - * An interceptor that first sends a message down its request channel then extracts the response from the - * message and sends it down the response channel before returning it up the interceptor stack. - * - * @version $Rev$ $Date$ - */ -public class RequestResponseInterceptor implements Interceptor { - - private MessageChannel sourceRequestChannel; - - private MessageChannel sourceResponseChannel; - - private MessageChannel targetRequestChannel; - - private MessageChannel targetResponseChannel; - - /** - * Construct an interceptor that sends messages down the supplied channels. - * - * @param targetRequestChannel the channel to send request messages down - * @param targetResponseChannel the channel to sent response messages down - */ - public RequestResponseInterceptor(MessageChannel sourceRequestChannel, MessageChannel targetRequestChannel, - MessageChannel sourceResponseChannel, MessageChannel targetResponseChannel) { - this.sourceRequestChannel = sourceRequestChannel; - this.sourceResponseChannel = sourceResponseChannel; - this.targetRequestChannel = targetRequestChannel; - this.targetResponseChannel = targetResponseChannel; - } - - public Message invoke(Message requestMessage) { - if (sourceRequestChannel != null) { - sourceRequestChannel.send(requestMessage); - } - if (targetRequestChannel != null) { - targetRequestChannel.send(requestMessage); - } - Message responseMessage = requestMessage.getRelatedCallbackMessage(); - if (targetResponseChannel != null) { - targetResponseChannel.send(responseMessage); - } - if (sourceResponseChannel != null) { - sourceResponseChannel.send(responseMessage); - } - return responseMessage; - } - - public void setNext(Interceptor next) { - throw new IllegalStateException("This interceptor must be the last one in an interceptor chain"); - } -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java deleted file mode 100644 index 2cef096a5e..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java +++ /dev/null @@ -1,137 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.jdk; - -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.InvocationConfiguration; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.message.MessageFactory; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -/** - * Receives a request from a JDK proxy and dispatches it to a target invoker or source interceptor stack - * - * @version $Rev$ $Date$ - */ -public class JDKInvocationHandler implements InvocationHandler { - - private MessageFactory messageFactory; - - /* - * an association of an operation to configuration holder. The holder contains the master wire configuration - * and a locale clone of the master TargetInvoker. TargetInvokers will be cloned by the handler and placed in the - * holder if they are cacheable. This allows optimizations such as avoiding target resolution when a source refers - * to a target of greater scope since the target reference can be maintained by the invoker. When a target invoker - * is not cacheable, the master associated with the wire configuration will be used. - */ - private Map<Method, ConfigHolder> configuration; - - public JDKInvocationHandler(MessageFactory messageFactory, Map<Method, ? extends InvocationConfiguration> configuration) { - assert (messageFactory != null) : "Message factory was null"; - assert (configuration != null) : "Configuration not specified"; - this.configuration = new HashMap<Method, ConfigHolder>(configuration.size()); - for (Map.Entry<Method, ? extends InvocationConfiguration> entry : configuration.entrySet()) { - this.configuration.put(entry.getKey(), new ConfigHolder(entry.getValue())); - } - this.messageFactory = messageFactory; - } - - /** - * Dispatches a client request made on a proxy - */ - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - Interceptor headInterceptor = null; - ConfigHolder holder = configuration.get(method); - if (holder == null) { - TargetException e = new TargetException("Operation not configured"); - e.setIdentifier(method.getName()); - throw e; - } - InvocationConfiguration config = holder.config; - if (config != null) { - headInterceptor = config.getHeadInterceptor(); - } - - TargetInvoker invoker; - - if (holder.cachedInvoker == null) { - assert config != null; - if(config.getTargetInvoker() == null){ - TargetException e= new TargetException("No target invoker configured for operation"); - e.setIdentifier(config.getMethod().getName()); - throw e; - } - if (config.getTargetInvoker().isCacheable()) { - // clone and store the invoker locally - holder.cachedInvoker = (TargetInvoker) config.getTargetInvoker().clone(); - invoker = holder.cachedInvoker; - } else { - invoker = config.getTargetInvoker(); - } - } else { - assert config != null; - invoker = config.getTargetInvoker(); - } - if (headInterceptor == null) { - try { - // short-circuit the dispatch and invoke the target directly - if (config.getTargetInvoker() == null) { - throw new AssertionError("No target invoker [" + method.getName() + "]"); - } - return config.getTargetInvoker().invokeTarget(args); - } catch (InvocationTargetException e) { - // the cause was thrown by the target so throw it - throw e.getCause(); - } - } else { - Message msg = messageFactory.createMessage(); - msg.setTargetInvoker(invoker); - msg.setBody(args); - // dispatch the wire down the chain and get the response - Message resp = headInterceptor.invoke(msg); - - Object body = resp.getBody(); - if (body instanceof Throwable) { - throw (Throwable) body; - } - return body; - } - } - - /** - * A holder used to associate an wire configuration with a local copy of a target invoker that was previously - * cloned from the configuration master - */ - private class ConfigHolder { - - public ConfigHolder(InvocationConfiguration config) { - this.config = config; - } - - InvocationConfiguration config; - - TargetInvoker cachedInvoker; - } - -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKSourceWireFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKSourceWireFactory.java deleted file mode 100644 index dbaab87fce..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKSourceWireFactory.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire.jdk; - -import org.apache.tuscany.core.wire.MethodHashMap; -import org.apache.tuscany.core.wire.WireFactoryInitException; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.WireSourceConfiguration; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Map; - -/** - * Creates proxies that are injected on references using JDK dynamic proxy facilities and front a wire. The proxies implement the - * business interface associated with the service required by reference. - * - * @version $Rev: 394431 $ $Date: 2006-04-15 21:27:44 -0700 (Sat, 15 Apr 2006) $ - */ -public class JDKSourceWireFactory implements SourceWireFactory { - - private static final int UNINITIALIZED = 0; - - private static final int INITIALIZED = 1; - - private int state = UNINITIALIZED; - - private Class[] businessInterfaceArray; - - private Map<Method, SourceInvocationConfiguration> methodToInvocationConfig; - - private WireSourceConfiguration configuration; - - public void initialize() throws WireFactoryInitException { - if (state != UNINITIALIZED) { - throw new IllegalStateException("Proxy factory in wrong state [" + state + "]"); - } - Map<Method, SourceInvocationConfiguration> invocationConfigs = configuration.getInvocationConfigurations(); - methodToInvocationConfig = new MethodHashMap<SourceInvocationConfiguration>(invocationConfigs.size()); - for (Map.Entry<Method, SourceInvocationConfiguration> entry : invocationConfigs.entrySet()) { - Method method = entry.getKey(); - methodToInvocationConfig.put(method, entry.getValue()); - } - state = INITIALIZED; - } - - public Object createProxy() { - if (state != INITIALIZED) { - throw new IllegalStateException("Proxy factory not INITIALIZED [" + state + "]"); - } - InvocationHandler handler = new JDKInvocationHandler(configuration.getMessageFactory(), methodToInvocationConfig); - return Proxy.newProxyInstance(configuration.getProxyClassLoader(), businessInterfaceArray, handler); - } - - public WireSourceConfiguration getConfiguration() { - return configuration; - } - - public void setConfiguration(WireSourceConfiguration config) { - configuration = config; - } - - public void setBusinessInterface(Class interfaze) { - businessInterfaceArray = new Class[]{interfaze}; - } - - public Class getBusinessInterface() { - return businessInterfaceArray[0]; - } - - public void addInterface(Class claz) { - throw new UnsupportedOperationException("Additional proxy interfaces not yet supported"); - } - - public Class[] getImplementatedInterfaces() { - return businessInterfaceArray; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKTargetWireFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKTargetWireFactory.java deleted file mode 100644 index 76f3b0389c..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKTargetWireFactory.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.jdk; - -import org.apache.tuscany.core.wire.MethodHashMap; -import org.apache.tuscany.core.wire.WireFactoryInitException; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.WireTargetConfiguration; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Map; - -/** - * Creates proxies that are returned to non-SCA clients using JDK dynamic proxy facilities and front a wire. The proxies implement - * the business interface associated with the target service of the wire and are typically returned by a locate operation. - * - * @version $Rev: 394431 $ $Date: 2006-04-15 21:27:44 -0700 (Sat, 15 Apr 2006) $ - */ -public class JDKTargetWireFactory implements TargetWireFactory { - - private static final int UNINITIALIZED = 0; - - private static final int INITIALIZED = 1; - - private int state = UNINITIALIZED; - - private Class[] businessInterfaceArray; - - private Map<Method, TargetInvocationConfiguration> methodToInvocationConfig; - - private WireTargetConfiguration configuration; - - public void initialize() throws WireFactoryInitException { - if (state != UNINITIALIZED) { - throw new IllegalStateException("Proxy factory in wrong state [" + state + "]"); - } - Map<Method, TargetInvocationConfiguration> invocationConfigs = configuration.getInvocationConfigurations(); - methodToInvocationConfig = new MethodHashMap<TargetInvocationConfiguration>(invocationConfigs.size()); - for (Map.Entry<Method, TargetInvocationConfiguration> entry : invocationConfigs.entrySet()) { - Method method = entry.getKey(); - methodToInvocationConfig.put(method, entry.getValue()); - } - state = INITIALIZED; - } - - public Object createProxy() { - if (state != INITIALIZED) { - throw new IllegalStateException("Proxy factory not INITIALIZED [" + state + "]"); - } - InvocationHandler handler = new JDKInvocationHandler(configuration.getMessageFactory(), methodToInvocationConfig); - return Proxy.newProxyInstance(configuration.getProxyClassLoader(), businessInterfaceArray, handler); - } - - public WireTargetConfiguration getConfiguration() { - return configuration; - } - - public void setConfiguration(WireTargetConfiguration config) { - configuration = config; - } - - public void setBusinessInterface(Class interfaze) { - businessInterfaceArray = new Class[]{interfaze}; - } - - public Class getBusinessInterface() { - return businessInterfaceArray[0]; - } - - public void addInterface(Class claz) { - throw new UnsupportedOperationException("Additional proxy interfaces not yet supported"); - } - - public Class[] getImplementatedInterfaces() { - return businessInterfaceArray; - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactory.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactory.java deleted file mode 100644 index 3eaffb9ba8..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire.jdk; - -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.WireFactoryFactory; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Proxy; - -/** - * A system service that creates JDK dynamic proxy-based {@link org.apache.tuscany.core.wire.WireFactory}s - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -@Service(interfaces = {WireFactoryFactory.class}) -public class JDKWireFactoryFactory implements WireFactoryFactory { - - public JDKWireFactoryFactory() { - } - - @Init(eager = true) - public void init() { - } - - public TargetWireFactory createTargetWireFactory() { - return new JDKTargetWireFactory(); - } - - public SourceWireFactory createSourceWireFactory() { - return new JDKSourceWireFactory(); - } - - public boolean isProxy(Object object) { - if (object == null) { - return false; - } else { - return Proxy.isProxyClass(object.getClass()); - } - } - - public InvocationHandler getHandler(Object proxy) { - if (proxy == null) { - return null; - } else { - return Proxy.getInvocationHandler(proxy); - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/DefaultWireFactoryService.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/DefaultWireFactoryService.java deleted file mode 100644 index 3c61081caf..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/DefaultWireFactoryService.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire.service; - -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.MethodHashMap; -import org.apache.tuscany.core.wire.WireFactoryFactory; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.core.wire.impl.InvokerInterceptor; -import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.List; -import java.util.ArrayList; - -/** - * The default implementation of a <code>WireFactoryFactory</code> - * - * @version $$Rev$$ $$Date$$ - */ -@Scope("MODULE") -@Service(interfaces = {org.apache.tuscany.core.wire.service.WireFactoryService.class}) -public class DefaultWireFactoryService implements org.apache.tuscany.core.wire.service.WireFactoryService { - - private MessageFactory messageFactory; - private WireFactoryFactory wireFactoryFactory; - private PolicyBuilderRegistry policyRegistry; - - - public DefaultWireFactoryService() { - - } - - public DefaultWireFactoryService(MessageFactory messageFactory, WireFactoryFactory wireFactoryFactory, PolicyBuilderRegistry registry) { - this.messageFactory = messageFactory; - this.wireFactoryFactory = wireFactoryFactory; - this.policyRegistry = registry; - } - - @Autowire - public void setMessageFactory(MessageFactory messageFactory) { - this.messageFactory = messageFactory; - } - - @Autowire - public void setWireFactoryService(WireFactoryFactory wireFactoryFactory) { - this.wireFactoryFactory = wireFactoryFactory; - } - - @Autowire - public void setPolicyRegistry(PolicyBuilderRegistry policyRegistry) { - this.policyRegistry = policyRegistry; - } - - @Init(eager = true) - public void init() { - } - - public List<SourceWireFactory> createSourceFactory(ConfiguredReference configuredReference) throws BuilderConfigException{ - String referenceName = configuredReference.getPort().getName(); - Class interfaze; - // FIXME hack for NPE when entry points with no set service contract on their configuredReference - if (configuredReference.getPort().getServiceContract() != null){ - interfaze = configuredReference.getPort().getServiceContract().getInterface(); - }else if(configuredReference.getPart() instanceof EntryPoint){ - interfaze = ((EntryPoint)configuredReference.getPart()).getConfiguredService().getPort().getServiceContract().getInterface(); - }else{ - BuilderConfigException bce = new BuilderConfigException("No interface found on configured reference"); - bce.setIdentifier(configuredReference.getName()); - throw bce; - } - List<SourceWireFactory> wireFactories = new ArrayList<SourceWireFactory>(); - List<WireSourceConfiguration> wireConfigurations = new ArrayList<WireSourceConfiguration>(); - for (ConfiguredService configuredService : configuredReference.getTargetConfiguredServices()) { - String targetCompName = configuredService.getPart().getName(); - String targetSerivceName = configuredService.getPort().getName(); - QualifiedName targetName = new QualifiedName(targetCompName + QualifiedName.NAME_SEPARATOR + targetSerivceName); - SourceWireFactory wireFactory = wireFactoryFactory.createSourceWireFactory(); - Map<Method, SourceInvocationConfiguration> iConfigMap = new HashMap<Method, SourceInvocationConfiguration>(); - Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(interfaze); - for (Method method : javaMethods) { - SourceInvocationConfiguration iConfig = new SourceInvocationConfiguration(method); - iConfigMap.put(method, iConfig); - } - WireSourceConfiguration wireConfiguration = new WireSourceConfiguration(referenceName, targetName, iConfigMap, interfaze.getClassLoader(), - messageFactory); - wireConfigurations.add(wireConfiguration); - wireFactory.setBusinessInterface(interfaze); - wireFactory.setConfiguration(wireConfiguration); - wireFactories.add(wireFactory); - } - if (policyRegistry != null) { - // invoke policy builders - policyRegistry.buildSource(configuredReference, wireConfigurations); - } - return wireFactories; - - } - - public TargetWireFactory createTargetFactory(ConfiguredService configuredService) { - org.apache.tuscany.model.assembly.Service service = configuredService.getPort(); - Class interfaze = service.getServiceContract().getInterface(); - QualifiedName targetName = new QualifiedName(configuredService.getPart().getName() + QualifiedName.NAME_SEPARATOR - + service.getName()); - - Map<Method, TargetInvocationConfiguration> iConfigMap = new MethodHashMap<TargetInvocationConfiguration>(); - TargetWireFactory wireFactory = wireFactoryFactory.createTargetWireFactory(); - Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(interfaze); - for (Method method : javaMethods) { - TargetInvocationConfiguration iConfig = new TargetInvocationConfiguration(method); - iConfigMap.put(method, iConfig); - } - WireTargetConfiguration wireConfiguration = new WireTargetConfiguration(targetName, iConfigMap, interfaze.getClassLoader(), messageFactory); - wireFactory.setBusinessInterface(interfaze); - wireFactory.setConfiguration(wireConfiguration); - if (policyRegistry != null) { - // invoke policy builders - policyRegistry.buildTarget(configuredService, wireConfiguration); - } - // add tail interceptor - for (TargetInvocationConfiguration iConfig : wireFactory.getConfiguration().getInvocationConfigurations().values()) { - iConfig.addInterceptor(new InvokerInterceptor()); - } - return wireFactory; - } - - -} diff --git a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/WireFactoryService.java b/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/WireFactoryService.java deleted file mode 100644 index eb41baf69a..0000000000 --- a/branches/java-M1/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/WireFactoryService.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire.service; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; - -import java.util.List; - -/** - * Implementations provide a system service that creates {@link org.apache.tuscany.core.wire.SourceWireFactory}s - * and {@link org.apache.tuscany.core.wire.TargetWireFactory}s. This service is used by {@link - * org.apache.tuscany.core.builder.ContextFactoryBuilder}s to provide {@link org.apache.tuscany.core.builder.ContextFactory}s with - * {@link org.apache.tuscany.core.wire.WireFactory}s for their references and target services. This service is typically autowired - * to. - * - * @version $$Rev$$ $$Date$$ - */ -public interface WireFactoryService { - - /** - * Creates the source-side wire factory for a reference - * - * @param configuredReference the configured reference to create the wire factory for - * @throws BuilderConfigException - */ - public List<SourceWireFactory> createSourceFactory(ConfiguredReference configuredReference) throws BuilderConfigException; - - /** - * Creates a target-side wire factory for a service implementing a given interface - * - * @param configuredService the configured service to create the wire factory for - * @throws BuilderConfigException - */ - public TargetWireFactory createTargetFactory(ConfiguredService configuredService) throws BuilderConfigException; - -} diff --git a/branches/java-M1/java/sca/core/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/core/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/core/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/core/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/core/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/core/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/core/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/core/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/core/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/core/src/main/resources/META-INF/services/org.apache.tuscany.core.runtime.proxy.ServiceProxyFactory b/branches/java-M1/java/sca/core/src/main/resources/META-INF/services/org.apache.tuscany.core.runtime.proxy.ServiceProxyFactory deleted file mode 100644 index 9b2d05d734..0000000000 --- a/branches/java-M1/java/sca/core/src/main/resources/META-INF/services/org.apache.tuscany.core.runtime.proxy.ServiceProxyFactory +++ /dev/null @@ -1 +0,0 @@ -org.apache.tuscany.core.runtime.proxy.impl.ServiceProxyFactoryImpl
\ No newline at end of file diff --git a/branches/java-M1/java/sca/core/src/main/resources/model/anyobject.xsd b/branches/java-M1/java/sca/core/src/main/resources/model/anyobject.xsd deleted file mode 100644 index 47f45d61d7..0000000000 --- a/branches/java-M1/java/sca/core/src/main/resources/model/anyobject.xsd +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - xmlns:obj="http://org.apache.tuscany/xmlns/anyobject/v0.0.1/" - targetNamespace="http://org.apache.tuscany/xmlns/anyobject/v0.0.1/" - xmlns:codegen="http://www.eclipse.org/emf/2002/Ecore" - codegen:nsPrefix="obj" - codegen:package="org.apache.tuscany.message.object"> - - <element name="anyObject" type="obj:AnyObject"/> - <complexType name="AnyObject"> - <sequence> - <element name="object" type="obj:Object"/> - </sequence> - </complexType> - - <simpleType name="Object" codegen:instanceClass="java.lang.Object"> - <restriction base="base64Binary"/> - </simpleType> - -</schema> diff --git a/branches/java-M1/java/sca/core/src/main/resources/model/tuscany-system.xsd b/branches/java-M1/java/sca/core/src/main/resources/model/tuscany-system.xsd deleted file mode 100644 index 9c85db8c37..0000000000 --- a/branches/java-M1/java/sca/core/src/main/resources/model/tuscany-system.xsd +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://org.apache.tuscany/xmlns/system/0.9" - xmlns:sca="http://www.osoa.org/xmlns/sca/0.9" - xmlns:system="http://org.apache.tuscany/xmlns/system/0.9" - xmlns:sdo="commonj.sdo/xml" - xmlns:sdojava="commonj.sdo/java" - elementFormDefault="qualified" - sdojava:package="org.apache.tuscany.core.system.scdl"> - - <import namespace="http://www.osoa.org/xmlns/sca/0.9" schemaLocation="../../../../../model/src/main/resources/model/sca-core.xsd"/> - - <element name="implementation.system" type="system:SystemImplementation" substitutionGroup="sca:implementation" sdo:name="implementationSystem"/> - <complexType name="SystemImplementation"> - <complexContent> - <extension base="sca:Implementation"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="class" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> - - <element name="binding.system" type="system:SystemBinding" substitutionGroup="sca:binding" sdo:name="bindingSystem"/> - <complexType name="SystemBinding"> - <complexContent> - <extension base="sca:Binding"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> - -</schema>
\ No newline at end of file diff --git a/branches/java-M1/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties b/branches/java-M1/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties deleted file mode 100644 index e3b2ff9a4f..0000000000 --- a/branches/java-M1/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. -# -# Licensed 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. -# -# $Rev$ $Date$ -# - -org.apache.tuscany.core.client.TuscanyRuntime$Monitor#moduleStarted = Started application module [{0}] -org.apache.tuscany.core.client.TuscanyRuntime$Monitor#moduleStartFailed = Fatal exception starting application module [{0}] -org.apache.tuscany.core.client.TuscanyRuntime$Monitor#moduleStopped = Stopped application module [{0}] - -org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl$Monitor#registeringLoader = Registering StAXElementLoader for {0} -org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl$Monitor#elementLoad = Processing element {0}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/core/src/main/resources/system.module b/branches/java-M1/java/sca/core/src/main/resources/system.module deleted file mode 100644 index 8d76e19283..0000000000 --- a/branches/java-M1/java/sca/core/src/main/resources/system.module +++ /dev/null @@ -1,93 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<module xmlns="http://www.osoa.org/xmlns/sca/0.9"
- xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:tuscany="http://org.apache.tuscany/xmlns/system/0.9"
- name="org.apache.tuscany.core.system">
-
- <component name="org.apache.tuscany.core.loader.WSDLDefinitionRegistry">
- <tuscany:implementation.system class="org.apache.tuscany.core.loader.impl.WSDLDefinitionRegistryImpl"/>
- </component>
-
- <component name="org.apache.tuscany.core.loader.assembly.ComponentTypeLoader">
- <tuscany:implementation.system class="org.apache.tuscany.core.loader.assembly.ComponentTypeLoader"/>
- </component>
-
- <!--
- <component name="org.apache.tuscany.core.config.processor.ServiceProcessor">
- <tuscany:implementation.system class="org.apache.tuscany.core.config.processor.ServiceProcessor"/>
- </component>
- <component name="org.apache.tuscany.core.config.processor.PropertyProcessor">
- <tuscany:implementation.system class="org.apache.tuscany.core.config.processor.PropertyProcessor"/>
- </component>
- -->
- <component name="org.apache.tuscany.core.loader.assembly.ExternalServiceLoader">
- <tuscany:implementation.system class="org.apache.tuscany.core.loader.assembly.ExternalServiceLoader"/>
- </component>
-
- <component name="org.apache.tuscany.core.loader.assembly.ImportWSDLLoader">
- <tuscany:implementation.system class="org.apache.tuscany.core.loader.assembly.ImportWSDLLoader"/>
- </component>
-
- <component name="org.apache.tuscany.core.loader.assembly.InterfaceWSDLLoader">
- <tuscany:implementation.system class="org.apache.tuscany.core.loader.assembly.InterfaceWSDLLoader"/>
- </component>
-
- <component name="org.apache.tuscany.core.loader.assembly.PropertyLoader">
- <tuscany:implementation.system class="org.apache.tuscany.core.loader.assembly.PropertyLoader"/>
- </component>
-
- <component name="org.apache.tuscany.core.loader.assembly.ReferenceLoader">
- <tuscany:implementation.system class="org.apache.tuscany.core.loader.assembly.ReferenceLoader"/>
- </component>
-
- <component name="org.apache.tuscany.core.loader.assembly.WireLoader">
- <tuscany:implementation.system class="org.apache.tuscany.core.loader.assembly.WireLoader"/>
- </component>
-
- <component name="org.apache.tuscany.core.loader.assembly.ServiceLoader">
- <tuscany:implementation.system class="org.apache.tuscany.core.loader.assembly.ServiceLoader"/>
- </component>
-
- <component name="org.apache.tuscany.core.builder.system.PolicyBuilderRegistry">
- <tuscany:implementation.system class="org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry"/>
- </component>
-
- <component name="org.apache.tuscany.core.wire.service.internal.WireFactoryService">
- <tuscany:implementation.system class="org.apache.tuscany.core.wire.service.DefaultWireFactoryService"/>
- </component>
-
- <component name="org.apache.tuscany.core.message.MessageFactory">
- <tuscany:implementation.system class="org.apache.tuscany.core.message.impl.MessageFactoryImpl"/>
- </component>
-
- <component name="org.apache.tuscany.core.wire.WireFactoryFactory">
- <tuscany:implementation.system class="org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory"/>
- </component>
-
- <component name="org.apache.tuscany.core.async.work.DefaultWorkManager">
- <tuscany:implementation.system class="org.apache.tuscany.core.async.work.DefaultWorkManager"/>
- <properties>
- <v:scheduledMaximumPoolSize>10</v:scheduledMaximumPoolSize>
- </properties>
- </component>
-
- <component name="org.apache.tuscany.core.async.builder.AsyncPolicyBuilder">
- <tuscany:implementation.system class="org.apache.tuscany.core.async.builder.AsyncPolicyBuilder"/>
- </component>
-
-</module>
diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/invocation/AsyncInvocationConfigurationTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/invocation/AsyncInvocationConfigurationTestCase.java deleted file mode 100644 index 6f55182c2b..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/invocation/AsyncInvocationConfigurationTestCase.java +++ /dev/null @@ -1,197 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.async.invocation; - -import java.lang.reflect.Method; -import java.util.concurrent.CountDownLatch; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.core.async.wire.mock.MockHandler; -import org.apache.tuscany.core.async.wire.mock.MockStaticInvoker; -import org.apache.tuscany.core.async.wire.mock.MockSyncInterceptor; -import org.apache.tuscany.core.async.wire.mock.SimpleTarget; -import org.apache.tuscany.core.async.wire.mock.SimpleTargetImpl; -import org.apache.tuscany.core.async.work.DefaultWorkManager; -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.impl.InvokerInterceptor; -import org.apache.tuscany.core.wire.impl.MessageChannelImpl; - -public class AsyncInvocationConfigurationTestCase extends TestCase { - - private DefaultWorkManager workManager; - private Method hello; - - private MessageFactory factory = new MessageFactoryImpl(); - - public AsyncInvocationConfigurationTestCase() { - super(); - } - - public AsyncInvocationConfigurationTestCase(String arg0) { - super(arg0); - } - - protected void setUp() throws Exception { - hello = SimpleTarget.class.getMethod("hello", String.class); - - workManager=new DefaultWorkManager(); - workManager.setScheduledMaximumPoolSize(5); - workManager.init(); - } - - protected void tearDown() throws Exception { - workManager.destroy(); - - super.tearDown(); - } - - /** - * Tests basic wiring of a source to a target, including handlers and interceptors - */ - public void testInvokeWithHandlers() throws Exception { - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - - source.addInterceptor(new AsyncInterceptor(workManager, factory)); - - MockHandler sourceRequestHandler = new MockHandler(); - MockHandler sourceResponseHandler = new MockHandler(); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addRequestHandler(sourceRequestHandler); - source.addResponseHandler(sourceResponseHandler); - source.addInterceptor(sourceInterceptor); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockHandler targetRequestHandler = new MockHandler(); - MockHandler targetResponseHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addResponseHandler(targetResponseHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - // connect the source to the target - source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); - source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); - source.build(); - target.build(); - - CountDownLatch startSignal = new CountDownLatch(1); - CountDownLatch doneSignal = new CountDownLatch(1); - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl(startSignal, doneSignal)); - source.setTargetInvoker(invoker); - - Message msg = factory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - startSignal.countDown(); - doneSignal.await(); - - Assert.assertEquals(null, response.getBody()); - Assert.assertEquals(1, sourceRequestHandler.getCount()); - //FIXME why isn't the responseHandler invoked? - //Assert.assertEquals(1, sourceResponseHandler.getCount()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetRequestHandler.getCount()); - //FIXME - //Assert.assertEquals(1, targetResponseHandler.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - public void testInvokeWithRequestHandlers() throws Exception { - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - - source.addInterceptor(new AsyncInterceptor(workManager, factory)); - - MockHandler sourceRequestHandler = new MockHandler(); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addRequestHandler(sourceRequestHandler); - source.addInterceptor(sourceInterceptor); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockHandler targetRequestHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - // connect the source to the target - source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); - source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); - source.build(); - target.build(); - - CountDownLatch startSignal = new CountDownLatch(1); - CountDownLatch doneSignal = new CountDownLatch(1); - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl(startSignal, doneSignal)); - source.setTargetInvoker(invoker); - - Message msg = factory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - startSignal.countDown(); - doneSignal.await(); - - Assert.assertEquals(null, response.getBody()); - Assert.assertEquals(1, sourceRequestHandler.getCount()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetRequestHandler.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - /** - * Tests basic wiring of a source to a target, including handlers and interceptors - */ - public void testInvokeWithInterceptorsOnly() throws Exception { - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - - source.addInterceptor(new AsyncInterceptor(workManager, factory)); - - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addInterceptor(sourceInterceptor); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - // connect the source to the target - source.setTargetInterceptor(target.getHeadInterceptor()); - source.build(); - target.build(); - - CountDownLatch startSignal = new CountDownLatch(1); - CountDownLatch doneSignal = new CountDownLatch(1); - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl(startSignal, doneSignal)); - source.setTargetInvoker(invoker); - - Message msg = factory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - startSignal.countDown(); - doneSignal.await(); - - Assert.assertEquals(null, response.getBody()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockHandler.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockHandler.java deleted file mode 100644 index 4f17dc2a76..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.async.wire.mock; - -import org.apache.tuscany.core.wire.MessageHandler; -import org.apache.tuscany.core.message.Message; - -/** - * - */ -public class MockHandler implements MessageHandler { - - private int count =0; - - public boolean processMessage(Message message) { - //System.out.println("Invoking handler"); - count++; - return true; - } - - public int getCount(){ - return count; - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockStaticInvoker.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockStaticInvoker.java deleted file mode 100644 index e32de0eec1..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockStaticInvoker.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.async.wire.mock; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.InvocationRuntimeException; -import org.apache.tuscany.core.wire.TargetInvoker; - -/** - * Caches component instances that do not need to be resolved for every wire, e.g. an wire originating from - * a lesser scope intended for a target with a wider scope - * - * @version $Rev: 377006 $ $Date: 2006-02-11 09:41:59 -0800 (Sat, 11 Feb 2006) $ - */ -public class MockStaticInvoker implements TargetInvoker { - - private Object instance; - - private Method operation; - - public MockStaticInvoker(Method operation, Object instance) { - this.operation = operation; - this.instance = instance; - } - - public boolean isCacheable() { - return true; - } - - public Object invokeTarget(Object payload) throws InvocationTargetException { - try { - if (payload != null && !payload.getClass().isArray()) { - return operation.invoke(instance, payload); - } else { - return operation.invoke(instance, (Object[]) payload); - } - } catch (IllegalAccessException e) { - throw new InvocationRuntimeException(e); - } - } - - 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 IllegalStateException("This interceptor must be the last interceptor in an interceptor chain"); - } - - public Object clone() throws CloneNotSupportedException { - try { - MockStaticInvoker invoker = (MockStaticInvoker) super.clone(); - invoker.instance = this.instance; - invoker.operation = this.operation; - return invoker; - } catch (CloneNotSupportedException e) { - return null; // will not happen - } - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockSyncInterceptor.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockSyncInterceptor.java deleted file mode 100644 index 5b70848d06..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockSyncInterceptor.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.async.wire.mock; - -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.message.Message; - -public class MockSyncInterceptor implements Interceptor { - - private int count; - - private Interceptor next; - - public MockSyncInterceptor() { - } - - public Message invoke(Message msg) { - ++count; - //System.out.println("Invoking interceptor"); - return next.invoke(msg); - } - - public int getCount() { - return count; - } - - public void setNext(Interceptor next) { - this.next=next; - } -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTarget.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTarget.java deleted file mode 100644 index 2147a3a4db..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTarget.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.async.wire.mock; - -public interface SimpleTarget { - - public void hello(String message) throws Exception; - - public void goodbye(String message) throws Exception; - - public void echo(String message) throws Exception; - -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTargetImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTargetImpl.java deleted file mode 100644 index e6f76494f6..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTargetImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.async.wire.mock; - -import java.util.concurrent.CountDownLatch; - -public class SimpleTargetImpl implements SimpleTarget { - - private final CountDownLatch startSignal; - private final CountDownLatch doneSignal; - - public SimpleTargetImpl(CountDownLatch startSignal, CountDownLatch doneSignal) { - this.startSignal = startSignal; - this.doneSignal = doneSignal; - } - - public void hello(String message) throws Exception { - try { - startSignal.await(); - doneSignal.countDown(); - } catch (InterruptedException ex) {} - } - - public void goodbye(String message) throws Exception { - try { - startSignal.await(); - doneSignal.countDown(); - } catch (InterruptedException ex) {} - } - - public void echo(String message) throws Exception { - try { - startSignal.await(); - doneSignal.countDown(); - } catch (InterruptedException ex) {} - } - - -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/DefaultWorkManagerTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/DefaultWorkManagerTestCase.java deleted file mode 100644 index 964564f3ee..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/DefaultWorkManagerTestCase.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.async.work; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; -import java.util.concurrent.CountDownLatch; - -import javax.resource.spi.work.Work; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.async.work.DefaultWorkManager; - -/** - * Test the PooledWorkManager. - */ -public class DefaultWorkManagerTestCase extends TestCase { - - private Set<Thread> done; - private int count; - - public void testScheduleWork() throws Exception { - - DefaultWorkManager workManager = new DefaultWorkManager(); - workManager.setScheduledMaximumPoolSize(3); - workManager.init(); - - int max=workManager.getScheduledMaximumPoolSize()*5; - done=Collections.synchronizedSet(new HashSet<Thread>()); - count=0; - - CountDownLatch startSignal = new CountDownLatch(1); - CountDownLatch doneSignal = new CountDownLatch(max); - for (int i = 0; i < max; ++i) { - workManager.scheduleWork(new Worker(startSignal, doneSignal)); - } - startSignal.countDown(); - doneSignal.await(); - - assertFalse(done.contains(Thread.currentThread())); - assert(done.size()==workManager.getScheduledMaximumPoolSize()); - assert(count==max); - - done=null; - count=0; - - workManager.destroy(); - - } - - private synchronized void done(Thread thread) { - done.add(thread); - count++; - } - - private class Worker implements Work { - private final CountDownLatch startSignal; - private final CountDownLatch doneSignal; - - Worker(CountDownLatch startSignal, CountDownLatch doneSignal) { - this.startSignal = startSignal; - this.doneSignal = doneSignal; - } - - public void run() { - try { - startSignal.await(); - - DefaultWorkManagerTestCase.this.done(Thread.currentThread()); - //System.out.println(Thread.currentThread()); - - doneSignal.countDown(); - } catch (InterruptedException ex) { - } - } - - public void release() { - } - - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/GeronimoWorkManagerTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/GeronimoWorkManagerTestCase.java deleted file mode 100644 index 18570d54c3..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/GeronimoWorkManagerTestCase.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.async.work; - -import javax.resource.spi.work.Work; -import javax.resource.spi.work.WorkEvent; -import javax.resource.spi.work.WorkListener; - -import junit.framework.TestCase; - -import org.apache.geronimo.connector.work.GeronimoWorkManager; -import org.apache.geronimo.transaction.context.TransactionContextManager; - -/** - * Tests the Geronimo work manager - * - * @version $Rev$ $Date$ - */ -public class GeronimoWorkManagerTestCase extends TestCase { - - private GeronimoWorkManager workManager; - - protected void setUp() throws Exception { - TransactionContextManager transactionContextManager = new TransactionContextManager(); - - workManager = new GeronimoWorkManager(2, transactionContextManager); - workManager.doStart(); - } - - public void testScheduleWork() throws Exception { - TestThread threads[] = startTestThreads(5, 10000, 100); - int accepted = 0; - int started = 0; - for (int i = 0; i < threads.length; i++) { - if (null != threads[i].listener.acceptedEvent) { - accepted++; - } else if (null != threads[i].listener.startedEvent) { - started++; - } else { - fail("incorrect state, expecting accepted or started"); - } - } - assertTrue(accepted > 0); - } - - private TestThread[] startTestThreads(int count, int timeout, int delay) throws Exception { - TestThread threads[] = new TestThread[count]; - for (int i = 0; i < count; i++) { - TestWorkListener listener=new TestWorkListener(); - threads[i] = new TestThread(listener, timeout, delay); - } - for (int i = 0; i < count; i++) { - threads[i].start(); - } - for (int i = 0; i < count; i++) { - threads[i].join(); - } - return threads; - } - - private class TestThread extends Thread { - public final TestWorkListener listener; - private final int timeout; - private final int delay; - - public TestThread(TestWorkListener listener, int timeout, int delay) { - this.listener = listener; - this.timeout = timeout; - this.delay = delay; - } - - public void run() { - try { - workManager.scheduleWork(new TestWorker(delay), timeout, null, listener); - } catch (Exception e) { - e.printStackTrace(); - } - } - - } - - public class TestWorker implements Work { - private final int delay; - - public TestWorker(int delay) { - this.delay = delay; - } - - public void release() { - } - - public void run() { - try { - Thread.sleep(delay); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - } - - public class TestWorkListener implements WorkListener { - public WorkEvent acceptedEvent; - public WorkEvent rejectedEvent; - public WorkEvent startedEvent; - public WorkEvent completedEvent; - - public void workAccepted(WorkEvent e) { - acceptedEvent = e; - } - - public void workRejected(WorkEvent e) { - rejectedEvent = e; - } - - public void workStarted(WorkEvent e) { - startedEvent = e; - } - - public void workCompleted(WorkEvent e) { - completedEvent = e; - } - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilderTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilderTestCase.java deleted file mode 100644 index e4aaad62d1..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilderTestCase.java +++ /dev/null @@ -1,465 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.builder.impl; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.wire.MethodHashMap; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.WireFactoryFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.mock.SimpleTarget; -import org.apache.tuscany.core.wire.mock.MockHandler; -import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; -import org.apache.tuscany.core.wire.mock.MockStaticInvoker; -import org.apache.tuscany.core.wire.mock.SimpleTargetImpl; -import org.apache.tuscany.core.wire.impl.InvokerInterceptor; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; - -import java.lang.reflect.Method; -import java.util.Map; - -public class DefaultWireBuilderTestCase extends TestCase { - - private Method hello; - - private WireFactoryFactory wireFactoryFactory = new JDKWireFactoryFactory(); - - public DefaultWireBuilderTestCase() { - super(); - } - - public DefaultWireBuilderTestCase(String arg0) { - super(arg0); - } - - public void setUp() throws Exception { - hello = SimpleTarget.class.getMethod("hello", String.class); - } - - public void testWireWithInterceptorsAndHandlers() throws Exception { - MessageFactory msgFactory = new MessageFactoryImpl(); - - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockHandler sourceRequestHandler = new MockHandler(); - MockHandler sourceResponseHandler = new MockHandler(); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addRequestHandler(sourceRequestHandler); - source.addResponseHandler(sourceResponseHandler); - source.addInterceptor(sourceInterceptor); - - SourceWireFactory sourceFactory = wireFactoryFactory.createSourceWireFactory(); - Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>(); - sourceInvocationConfigs.put(hello, source); - WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), - sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - sourceFactory.setConfiguration(sourceConfig); - sourceFactory.setBusinessInterface(SimpleTarget.class); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockHandler targetRequestHandler = new MockHandler(); - MockHandler targetResponseHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addResponseHandler(targetResponseHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>(); - targetInvocationConfigs.put(hello, target); - WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), - targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - targetFactory.setConfiguration(targetConfig); - targetFactory.setBusinessInterface(SimpleTarget.class); - - // connect the source to the target - DefaultWireBuilder builder = new DefaultWireBuilder(); - // no need for scopes since we use a static invoker - builder.connect(sourceFactory, targetFactory, null, true, null); - // source.buildSource(); - target.build(); - // set a static invoker - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = msgFactory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - Assert.assertEquals(1, sourceRequestHandler.getCount()); - Assert.assertEquals(1, sourceResponseHandler.getCount()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetRequestHandler.getCount()); - Assert.assertEquals(1, targetResponseHandler.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - public void testWireWithSourceInterceptorTargetHandlersAndTargetInterceptor() throws Exception { - MessageFactory msgFactory = new MessageFactoryImpl(); - - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addInterceptor(sourceInterceptor); - - SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); - Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>(); - sourceInvocationConfigs.put(hello, source); - WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), - sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - sourceFactory.setConfiguration(sourceConfig); - sourceFactory.setBusinessInterface(SimpleTarget.class); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockHandler targetRequestHandler = new MockHandler(); - MockHandler targetResponseHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addResponseHandler(targetResponseHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>(); - targetInvocationConfigs.put(hello, target); - WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), - targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - targetFactory.setConfiguration(targetConfig); - targetFactory.setBusinessInterface(SimpleTarget.class); - - // connect the source to the target - DefaultWireBuilder builder = new DefaultWireBuilder(); - // no need for scopes since we use a static invoker - builder.connect(sourceFactory, targetFactory, null, true, null); - // source.buildSource(); - target.build(); - // set a static invoker - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = msgFactory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetRequestHandler.getCount()); - Assert.assertEquals(1, targetResponseHandler.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - public void testWireWithInterceptorsAndRequestHandlers() throws Exception { - MessageFactory msgFactory = new MessageFactoryImpl(); - - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockHandler sourceRequestHandler = new MockHandler(); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addRequestHandler(sourceRequestHandler); - source.addInterceptor(sourceInterceptor); - - SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); - Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>(); - sourceInvocationConfigs.put(hello, source); - WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), - sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - sourceFactory.setConfiguration(sourceConfig); - sourceFactory.setBusinessInterface(SimpleTarget.class); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockHandler targetRequestHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>(); - targetInvocationConfigs.put(hello, target); - WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), - targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - targetFactory.setConfiguration(targetConfig); - targetFactory.setBusinessInterface(SimpleTarget.class); - - // connect the source to the target - DefaultWireBuilder builder = new DefaultWireBuilder(); - // no need for scopes since we use a static invoker - builder.connect(sourceFactory, targetFactory, null, true, null); - // source.buildSource(); - target.build(); - // set a static invoker - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = msgFactory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - Assert.assertEquals(1, sourceRequestHandler.getCount()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetRequestHandler.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - public void testWireWithSourceAndTargetInterceptors() throws Exception { - MessageFactory msgFactory = new MessageFactoryImpl(); - - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addInterceptor(sourceInterceptor); - - SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); - Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>(); - sourceInvocationConfigs.put(hello, source); - WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), - sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - sourceFactory.setConfiguration(sourceConfig); - sourceFactory.setBusinessInterface(SimpleTarget.class); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>(); - targetInvocationConfigs.put(hello, target); - WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), - targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - targetFactory.setConfiguration(targetConfig); - targetFactory.setBusinessInterface(SimpleTarget.class); - - // connect the source to the target - DefaultWireBuilder builder = new DefaultWireBuilder(); - // no need for scopes since we use a static invoker - builder.connect(sourceFactory, targetFactory, null, true, null); - // source.buildSource(); - target.build(); - // set a static invoker - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = msgFactory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - public void testWireWithSourceInterceptorSourceHandlersAndTargetInterceptor() throws Exception { - MessageFactory msgFactory = new MessageFactoryImpl(); - - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockHandler sourceRequestHandler = new MockHandler(); - MockHandler sourceResponseHandler = new MockHandler(); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addRequestHandler(sourceRequestHandler); - source.addResponseHandler(sourceResponseHandler); - source.addInterceptor(sourceInterceptor); - - SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); - Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>(); - sourceInvocationConfigs.put(hello, source); - WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), - sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - sourceFactory.setConfiguration(sourceConfig); - sourceFactory.setBusinessInterface(SimpleTarget.class); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>(); - targetInvocationConfigs.put(hello, target); - WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), - targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - targetFactory.setConfiguration(targetConfig); - targetFactory.setBusinessInterface(SimpleTarget.class); - - // connect the source to the target - DefaultWireBuilder builder = new DefaultWireBuilder(); - // no need for scopes since we use a static invoker - builder.connect(sourceFactory, targetFactory, null, true, null); - // source.buildSource(); - target.build(); - // set a static invoker - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = msgFactory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - Assert.assertEquals(1, sourceRequestHandler.getCount()); - Assert.assertEquals(1, sourceResponseHandler.getCount()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - public void testWireWithTargetInterceptorAndTargetHandlers() throws Exception { - MessageFactory msgFactory = new MessageFactoryImpl(); - - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - - SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); - Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>(); - sourceInvocationConfigs.put(hello, source); - WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), - sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - sourceFactory.setConfiguration(sourceConfig); - sourceFactory.setBusinessInterface(SimpleTarget.class); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockHandler targetRequestHandler = new MockHandler(); - MockHandler targetResponseHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addResponseHandler(targetResponseHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>(); - targetInvocationConfigs.put(hello, target); - WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), - targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - targetFactory.setConfiguration(targetConfig); - targetFactory.setBusinessInterface(SimpleTarget.class); - - // connect the source to the target - DefaultWireBuilder builder = new DefaultWireBuilder(); - // no need for scopes since we use a static invoker - builder.connect(sourceFactory, targetFactory, null, true, null); - // source.buildSource(); - target.build(); - // set a static invoker - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = msgFactory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - Assert.assertEquals(1, targetRequestHandler.getCount()); - Assert.assertEquals(1, targetResponseHandler.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - public void testWireWithTargetInterceptor() throws Exception { - MessageFactory msgFactory = new MessageFactoryImpl(); - - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - - SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); - Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>(); - sourceInvocationConfigs.put(hello, source); - WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), - sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - sourceFactory.setConfiguration(sourceConfig); - sourceFactory.setBusinessInterface(SimpleTarget.class); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>(); - targetInvocationConfigs.put(hello, target); - WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), - targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - targetFactory.setConfiguration(targetConfig); - targetFactory.setBusinessInterface(SimpleTarget.class); - - // connect the source to the target - DefaultWireBuilder builder = new DefaultWireBuilder(); - // no need for scopes since we use a static invoker - builder.connect(sourceFactory, targetFactory, null, true, null); - target.build(); - // set a static invoker - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = msgFactory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - /** - * When there are only {@link InvokerInterceptor}s in the source and target chain, we need to bypass one during - * wire up so they are not chained together - */ - public void testWireWithOnlyInvokerInterceptors() throws Exception { - MessageFactory msgFactory = new MessageFactoryImpl(); - - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - source.setTargetInterceptor(new InvokerInterceptor()); - - SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); - Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>(); - sourceInvocationConfigs.put(hello, source); - WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), - sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - sourceFactory.setConfiguration(sourceConfig); - sourceFactory.setBusinessInterface(SimpleTarget.class); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - target.addInterceptor(new InvokerInterceptor()); - - TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>(); - targetInvocationConfigs.put(hello, target); - WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), - targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - targetFactory.setConfiguration(targetConfig); - targetFactory.setBusinessInterface(SimpleTarget.class); - - // connect the source to the target - DefaultWireBuilder builder = new DefaultWireBuilder(); - // no need for scopes since we use a static invoker - builder.connect(sourceFactory, targetFactory, null, true, null); - target.build(); - // set a static invoker - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = msgFactory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/NegativeDefaultWireBuilderTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/NegativeDefaultWireBuilderTestCase.java deleted file mode 100644 index 983dc577c4..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/NegativeDefaultWireBuilderTestCase.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.builder.impl; - -import junit.framework.TestCase; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.wire.MethodHashMap; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.WireFactoryFactory; -import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; -import org.apache.tuscany.core.wire.mock.SimpleTarget; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; - -import java.lang.reflect.Method; -import java.util.Map; - -public class NegativeDefaultWireBuilderTestCase extends TestCase { - - private Method hello; - - private WireFactoryFactory wireFactoryFactory = new JDKWireFactoryFactory(); - - public NegativeDefaultWireBuilderTestCase() { - super(); - } - - public NegativeDefaultWireBuilderTestCase(String arg0) { - super(arg0); - } - - public void setUp() throws Exception { - hello = SimpleTarget.class.getMethod("hello", String.class); - } - - public void testNoTargetInterceptorOrHandler() throws Exception { - MessageFactory msgFactory = new MessageFactoryImpl(); - - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - - SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); - Map<Method, SourceInvocationConfiguration> sourceInvocationConfigs = new MethodHashMap<SourceInvocationConfiguration>(); - sourceInvocationConfigs.put(hello, source); - WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), - sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - sourceFactory.setConfiguration(sourceConfig); - sourceFactory.setBusinessInterface(SimpleTarget.class); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - - TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = new MethodHashMap<TargetInvocationConfiguration>(); - targetInvocationConfigs.put(hello, target); - WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), - targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); - targetFactory.setConfiguration(targetConfig); - targetFactory.setBusinessInterface(SimpleTarget.class); - - // connect the source to the target - DefaultWireBuilder builder = new DefaultWireBuilder(); - try { - builder.connect(sourceFactory, targetFactory, null, true, null); - fail("Expected " + BuilderConfigException.class.getName()); - } catch (BuilderConfigException e) { - // success - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean1.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean1.java deleted file mode 100644 index c02961e5f4..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean1.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - - -public class Bean1 extends SuperBean { - - public static final int ALL_BEAN1_FIELDS = 6 + ALL_SUPER_FIELDS; - public static final int ALL_BEAN1_PUBLIC_PROTECTED_FIELDS = 5 + ALL_SUPER_PUBLIC_PROTECTED_FIELDS; - - public static final int ALL__BEAN1_METHODS = 4 + ALL_SUPER_METHODS - 1; - - private String field1; - protected String field2; - public String field3; - - public void setMethod1(String param) { - } - - public void setMethod1(int param) { - } - - public void override(String param) throws Exception { - } - - - public void noOverride(String param) throws Exception { - } - - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean2.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean2.java deleted file mode 100644 index eaba545d8e..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean2.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -import junit.framework.AssertionFailedError; - -import java.util.List; - -public class Bean2 { - - private List methodList; - - public List getMethodList() { - return methodList; - } - - public void setMethodList(List list) { - methodList = list; - } - - private List fieldList; - - public List getfieldList() { - return fieldList; - } - - public void setfieldList(List list) { - throw new AssertionFailedError("setter inadvertantly called"); - } - - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/JavaIntrospectionHelperTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/JavaIntrospectionHelperTestCase.java deleted file mode 100644 index 8a95a6c7b0..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/JavaIntrospectionHelperTestCase.java +++ /dev/null @@ -1,163 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.mock.component.Target; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class JavaIntrospectionHelperTestCase extends TestCase { - - public JavaIntrospectionHelperTestCase() { - super(); - } - - public JavaIntrospectionHelperTestCase(String arg0) { - super(arg0); - } - - public void testGetSuperAllFields() throws Exception { - Set<Field> superBeanFields = JavaIntrospectionHelper.getAllFields(SuperBean.class); - Assert.assertEquals(SuperBean.ALL_SUPER_FIELDS, superBeanFields.size()); - } - - public void testBean1AllPublicProtectedFields() throws Exception { - Set<Field> beanFields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(Bean1.class); - Assert.assertEquals(4, beanFields.size()); //Bean1.ALL_BEAN1_PUBLIC_PROTECTED_FIELDS - } - - public void testBean1AllFields() throws Exception { - Set<Field> beanFields = JavaIntrospectionHelper.getAllFields(Bean1.class); - Assert.assertEquals(Bean1.ALL_BEAN1_FIELDS, beanFields.size()); - } - - public void testGetSuperAllMethods() throws Exception { - Set<Method> superBeanMethods = JavaIntrospectionHelper.getAllUniqueMethods(SuperBean.class); - Assert.assertEquals(SuperBean.ALL_SUPER_METHODS, superBeanMethods.size()); - } - - public void testGetBean1AllMethods() throws Exception { - Set<Method> beanMethods = JavaIntrospectionHelper.getAllUniqueMethods(Bean1.class); - Assert.assertEquals(Bean1.ALL__BEAN1_METHODS, beanMethods.size()); - } - - public void testOverrideMethod() throws Exception { - Set<Method> beanFields = JavaIntrospectionHelper.getAllUniqueMethods(Bean1.class); - boolean invoked = false; - for (Method method : beanFields) { - if (method.getName().equals("override")) { - method.invoke(new Bean1(), "foo"); - invoked = true; - } - } - if (!invoked) { - throw new Exception("Override never invoked"); - } - } - - public void testNoOverrideMethod() throws Exception { - Set<Method> beanFields = JavaIntrospectionHelper.getAllUniqueMethods(Bean1.class); - boolean found = false; - for (Method method : beanFields) { - if (method.getName().equals("noOverride") && method.getParameterTypes().length == 0) { - found = true; - } - } - if (!found) { - throw new Exception("No override not found"); - } - } - - public void testGetBean1AllFields() throws Exception { - Set<Field> bean1 = JavaIntrospectionHelper.getAllFields(Bean1.class); - Assert.assertEquals(Bean1.ALL_BEAN1_FIELDS, bean1.size()); - } - - public void testDefaultConstructor() throws Exception { - Constructor ctr = JavaIntrospectionHelper.getDefaultConstructor(Bean2.class); - Assert.assertEquals(ctr, Bean2.class.getConstructor()); - Assert.assertTrue(Bean2.class == ctr.newInstance((Object[]) null).getClass()); - } - - - public void testFindMultiplicityByFieldName() throws Exception{ - Set<Field> fields = JavaIntrospectionHelper.getAllFields(getClass()); - Set<Method> methods = JavaIntrospectionHelper.getAllUniqueMethods(getClass()); - - Assert.assertNotNull(JavaIntrospectionHelper.findMultiplicityFieldByName("testList",fields)); - Assert.assertNotNull(JavaIntrospectionHelper.findMultiplicityMethodByName("fooMethod",methods)); - - // this array is not an interface - Assert.assertNull(JavaIntrospectionHelper.findMultiplicityFieldByName("testStringArray",fields)); - Assert.assertNotNull(JavaIntrospectionHelper.findMultiplicityFieldByName("testArray",fields)); - Assert.assertNotNull(JavaIntrospectionHelper.findMultiplicityMethodByName("setTestArray",methods)); - } - - /** - * Tests generics introspection capabilities - */ - public void testGenerics() throws Exception{ - - List classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testList").getGenericType()); - Assert.assertEquals(1,classes.size()); - Assert.assertEquals(String.class,classes.get(0)); - - classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testNoGenericsList").getGenericType()); - Assert.assertEquals(0,classes.size()); - - classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testMap").getGenericType()); - Assert.assertEquals(2,classes.size()); - Assert.assertEquals(String.class,classes.get(0)); - Assert.assertEquals(Bean1.class,classes.get(1)); - - classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredMethod("fooMethod", Map.class).getGenericParameterTypes()[0]); - Assert.assertEquals(2,classes.size()); - Assert.assertEquals(String.class,classes.get(0)); - Assert.assertEquals(Bean1.class,classes.get(1)); - - classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredMethod("fooMethod", List.class).getGenericParameterTypes()[0]); - Assert.assertEquals(1,classes.size()); - Assert.assertEquals(String.class,classes.get(0)); - - } - - private List testNoGenericsList; - - private List<String> testList; - - private Map<String,Bean1> testMap; - - private void fooMethod(List<String> foo){ - - } - - private void fooMethod(Map<String, Bean1> foo){ - - } - - private Target[] testArray; - private String[] testStringArray; - - public void setTestArray(Target[] array){} -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/SuperBean.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/SuperBean.java deleted file mode 100644 index 0a4e0cca0c..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/SuperBean.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config; - -/** - * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ - */ -public class SuperBean { - - public static final int ALL_SUPER_FIELDS = 6; - public static final int ALL_SUPER_PUBLIC_PROTECTED_FIELDS = 5; - - public static final int ALL_SUPER_METHODS = 4; - - private String superField1; - - public String superField2; - - protected String superField3; - - public void setSuperMethod1(String param) { - } - - public void setSuperMethod1(int param) { - } - - public void override(String param) throws Exception { - throw new Exception("Override not handled"); - } - - public void noOverride() throws Exception { - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java deleted file mode 100644 index aeb614e9c6..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java +++ /dev/null @@ -1,173 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import java.util.List; - -import junit.framework.TestCase; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.config.processor.ProcessorUtils; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceContract; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class CoreAnnotationsProcessingTestCase extends TestCase { - - private ComponentTypeIntrospector introspector; - private AssemblyFactory factory; - - public void testServiceBasicProcessing() throws Exception { - ComponentType type = factory.createComponentType(); - introspector.introspect(TestComponentImpl.class, type); - assertEquals(1, type.getServices().size()); - ServiceContract contract = type.getServices().get(0).getServiceContract(); - assertEquals(TestComponent.class, contract.getInterface()); - assertEquals(Scope.MODULE, contract.getScope()); - } - - public void testServiceNameSet() throws Exception { - ComponentType type = factory.createComponentType(); - introspector.introspect(TestComponentImpl.class, type); - assertEquals(1, type.getServices().size()); - Service service = type.getServices().get(0); - assertEquals(JavaIntrospectionHelper.getBaseName(TestComponent.class), service.getName()); - } - - /** - * Tests the case where a class implements one interface not marked as with <code>Remotable</code> - */ - public void testSingleServiceProcessing() throws Exception { - ComponentType type = factory.createComponentType(); - introspector.introspect(TestLocalComponentImpl.class, type); - assertEquals(1, type.getServices().size()); - ServiceContract contract = type.getServices().get(0).getServiceContract(); - assertEquals(TestLocalComponent.class, contract.getInterface()); - assertEquals(Scope.MODULE, contract.getScope()); - } - - /** - * Tests the case where an implementation specifies a service interface of its parent as opposed to the - * single interface it directly implements - */ - public void testInteraceHierarchyServiceProcessing() throws Exception { - ComponentType type = factory.createComponentType(); - introspector.introspect(SuperFooImpl.class, type); - assertEquals(1, type.getServices().size()); - ServiceContract contract = type.getServices().get(0).getServiceContract(); - assertEquals(SuperSuperFoo.class, contract.getInterface()); - } - - /** - * Tests the case where a class implements two interfaces, with one specified using <code>@Service</code> - * and one marked with <code>@Remotable</code> - */ - public void testMutlipleServiceProcessing() throws Exception { - ComponentType type = factory.createComponentType(); - introspector.introspect(TestMultipleInterfacesComponentImpl.class, type); - assertEquals(2, type.getServices().size()); - for (Service service : type.getServices()) { - if (!service.getServiceContract().equals(TestComponent.class) && - service.getServiceContract().equals(TestLocalComponent.class)) { - fail("Expected multiple interfaces not found"); - } - } - } - - /** - * Test case when an class implements two non-Remotable interfaces and does not specify one with - * <code>@Service</code> - */ - public void testNonServiceProcessing() throws Exception { - ComponentType type = factory.createComponentType(); - introspector.introspect(TestNonServiceInterfacesImpl.class, type); - assertEquals(1, type.getServices().size()); - ServiceContract contract = type.getServices().get(0).getServiceContract(); - assertEquals(TestNonServiceInterfacesImpl.class, contract.getInterface()); - assertEquals(Scope.MODULE, contract.getScope()); - } - - /** - * Tests the case where a class implements two non-Remotable interfaces, with one specified using - * <code>@Service</code> - */ - public void testNonServiceSpecifiedProcessing() throws Exception { - ComponentType type = factory.createComponentType(); - introspector.introspect(TestNonServiceSpecifiedImpl.class, type); - assertEquals(1, type.getServices().size()); - ServiceContract contract = type.getServices().get(0).getServiceContract(); - assertEquals(TestNonServiceInterface.class, contract.getInterface()); - assertEquals(Scope.MODULE, contract.getScope()); - } - - /** - * Tests the case where a component's scope is specified by its superclass - */ - public void testParentScopeEvaluation() throws Exception { - ComponentType type = factory.createComponentType(); - introspector.introspect(ScopeTestComponent.class, type); - assertEquals(1, type.getServices().size()); - ServiceContract contract = type.getServices().get(0).getServiceContract(); - assertEquals(Scope.MODULE, contract.getScope()); - } - - /** - * FIXME JFM - temporarily disabled until non-annotated properties are fixed public void - * testPropertyProcessing() throws Exception { ComponentType type = factory.createComponentType(); - * introspector.introspect(TestComponentImpl.class, type); List<Property>properties = - * type.getProperties(); assertEquals(3, properties.size()); for (Property property : properties) { if - * (!property.getName().equals("foo") && !property.getName().equals("fooRequired") && - * !property.getName().equals("baz")) { fail("Property names not handled properly"); } if - * (property.getName().equals("fooRequired")) { assertTrue(property.isRequired()); } else { - * assertFalse(property.isRequired()); } } } * - */ - - public void testReferenceProcessing() throws Exception { - ComponentType type = factory.createComponentType(); - introspector.introspect(TestComponentImpl.class, type); - List<Reference>references = type.getReferences(); - assertEquals(5, references.size()); - for (Reference reference : references) { - if (reference.getName().equals("setBarRequired")) { - assertTrue(reference.getMultiplicity() == Multiplicity.ONE_N); - } else if (reference.getName().equals("setBar")) { - assertTrue(reference.getMultiplicity() == Multiplicity.ZERO_N); - } else if (reference.getName().equals("bazRefeference")) { - assertTrue(reference.getMultiplicity() == Multiplicity.ZERO_ONE); - } else if (reference.getName().equals("wombat")) { - assertTrue(reference.getMultiplicity() == Multiplicity.ONE_ONE); - } else if (reference.getName().equals("bar")) { - assertTrue(reference.getMultiplicity() == Multiplicity.ZERO_ONE); - } else { - fail("Reference names not handled properly"); - } - } - } - - - protected void setUp() throws Exception { - super.setUp(); - factory = new SystemAssemblyFactoryImpl(); - introspector = ProcessorUtils.createCoreIntrospector(factory); - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopeTestComponent.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopeTestComponent.java deleted file mode 100644 index 1ae24b6b74..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopeTestComponent.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class ScopeTestComponent extends ScopedParent { - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopedParent.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopedParent.java deleted file mode 100644 index 0507af1a8a..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopedParent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $$Rev$$ $$Date$$ - */ -@Scope("MODULE") -public class ScopedParent { -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java deleted file mode 100644 index e8a5079184..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -/** - * @version $$Rev$$ $$Date$$ - */ -public interface SuperFoo { -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java deleted file mode 100644 index 1d964cca8d..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import org.osoa.sca.annotations.Service; - -/** - * @version $$Rev$$ $$Date$$ - */ -@Service(SuperSuperFoo.class) -public class SuperFooImpl extends SuperSuperFooImpl implements SuperFoo{ -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java deleted file mode 100644 index 893c2c5607..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -/** - * @version $$Rev$$ $$Date$$ - */ -public interface SuperSuperFoo { -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java deleted file mode 100644 index 2025dd1cdd..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class SuperSuperFooImpl implements SuperSuperFoo { -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponent.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponent.java deleted file mode 100644 index 8a462ff405..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponent.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import org.osoa.sca.annotations.Remotable; -import org.osoa.sca.annotations.Scope; - -/** - * @version $$Rev$$ $$Date$$ - */ -@Remotable -@Scope("MODULE") -public interface TestComponent { - - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponentImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponentImpl.java deleted file mode 100644 index 691bf18b3f..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponentImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import java.util.List; - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Service; - -/** - * @version $$Rev$$ $$Date$$ - */ -@Service(interfaces = {TestComponent.class}) -public class TestComponentImpl implements TestComponent { - - @Property - protected String baz; - - @Reference (name="bazRefeference") - protected TestComponent bazRef; - - @Reference (required = true) - protected TestComponent wombat; - - @Property - public void setFoo(String foo){ - - } - - @Property(name = "fooRequired",required = true) - public void setFooRequiredRename(String foo){ - - } - - @Reference - public void bar(String bar){ - - } - - @Reference(name ="setBarRequired", required = true) - public void setBar(List bar){ - - } - - @Reference(name ="setBar", required = false) - public void setBarNonRequired(List bar){ - - } - - public void someSetter(String val){ - - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponent.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponent.java deleted file mode 100644 index 15b88547f7..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponent.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import org.osoa.sca.annotations.Remotable; -import org.osoa.sca.annotations.Scope; - -/** - * @version $$Rev$$ $$Date$$ - */ -@Scope("MODULE") -public interface TestLocalComponent { - - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponentImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponentImpl.java deleted file mode 100644 index 86aca3b1bf..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponentImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import java.util.List; - -import org.osoa.sca.annotations.Service; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; - -/** - * @version $$Rev$$ $$Date$$ - */ - -public class TestLocalComponentImpl implements TestLocalComponent { - - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestMultipleInterfacesComponentImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestMultipleInterfacesComponentImpl.java deleted file mode 100644 index b395fd5442..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestMultipleInterfacesComponentImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import org.osoa.sca.annotations.Service; - -/** - * @version $$Rev$$ $$Date$$ - */ - -@Service(interfaces = {TestLocalComponent.class}) -public class TestMultipleInterfacesComponentImpl implements TestComponent, TestLocalComponent { - - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface.java deleted file mode 100644 index 1a595573ae..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -/** - * @version $$Rev$$ $$Date$$ - */ -public interface TestNonServiceInterface { -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface2.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface2.java deleted file mode 100644 index 8aa6e6cb19..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface2.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -/** - * @version $$Rev$$ $$Date$$ - */ -public interface TestNonServiceInterface2 { -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterfacesImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterfacesImpl.java deleted file mode 100644 index 4f6f07b239..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterfacesImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $$Rev$$ $$Date$$ - */ -@Scope("MODULE") -public class TestNonServiceInterfacesImpl implements TestNonServiceInterface, TestNonServiceInterface2{ -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceSpecifiedImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceSpecifiedImpl.java deleted file mode 100644 index b8c0d6a7e8..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceSpecifiedImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.config.impl; - -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -/** - * @version $$Rev$$ $$Date$$ - */ -@Scope("MODULE") -@Service(TestNonServiceInterface.class) -public class TestNonServiceSpecifiedImpl implements TestNonServiceInterface, TestNonServiceInterface2{ -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractCompositeHierarchyTests.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractCompositeHierarchyTests.java deleted file mode 100644 index f529595dae..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractCompositeHierarchyTests.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.mock.MockConfigContext; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Scope; -import org.osoa.sca.ModuleContext; - -import java.util.List; - -/** - * Performs testing of various hierarchical scenarios - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractCompositeHierarchyTests extends TestCase { - protected List<ContextFactoryBuilder> builders; - protected SystemAssemblyFactory factory; - - public void testParentContextIsolation() throws Exception { - CompositeContext parent = createContextHierachy(); - CompositeContext child = (CompositeContext) parent.getContext("test.child"); - Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - parent.registerModelObject(component); - EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); - parent.registerModelObject(ep); - parent.publish(new ModuleStart(this)); - child.publish(new ModuleStart(this)); - Assert.assertNotNull(parent.getContext("TestService1EP").getInstance(null)); - try { - ((ModuleContext) child).locateService("TestService1EP"); - fail("Expexcted " + ServiceNotFoundException.class.getName()); - } catch (ServiceNotFoundException e) { - // expect exception to be thrown - } - parent.publish(new ModuleStop(this)); - child.publish(new ModuleStop(this)); - parent.stop(); - - } - - /** - * Checks that registration of duplicate named model objects before context start throws an exception - */ - public void testRegisterSameName() throws Exception { - CompositeContext parent = new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), - new EventContextImpl(), new MockConfigContext(builders)); - parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child")); - try { - parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child")); - parent.start(); - fail("Expected " + DuplicateNameException.class.getName()); - } catch (DuplicateNameException e) { - // expected - } - } - - /** - * Checks that registration of duplicate named model objects after context start throws an exception - */ - public void testRegisterSameNameAfterStart() throws Exception { - CompositeContext parent = new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), - new EventContextImpl(), new MockConfigContext(builders)); - parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child")); - parent.start(); - CompositeContext child = (CompositeContext) parent.getContext("test.child"); - Assert.assertNotNull(child); - try { - parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child")); - fail("Expected " + DuplicateNameException.class.getName()); - } catch (DuplicateNameException e) { - // expected - } - } - - protected abstract CompositeContext createContextHierachy() throws Exception; - - protected void setUp() throws Exception { - super.setUp(); - factory = new SystemAssemblyFactoryImpl(); - builders = MockFactory.createSystemBuilders(); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeContextRegisterTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeContextRegisterTestCase.java deleted file mode 100644 index b6e7f69daf..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeContextRegisterTestCase.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.mock.MockConfigContext; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.mock.component.GenericSystemComponent; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.List; - -/** - * Tests registration of model objects for an composite context - * - * @version $Rev$ $Date$ - */ -public class CompositeContextRegisterTestCase extends TestCase { - private SystemAssemblyFactory factory; - - public void testModuleRegistration() throws Exception { - CompositeContext moduleContext = createContext(); - Module module = MockFactory.createSystemModule(); - moduleContext.registerModelObject(module); - moduleContext.start(); - moduleContext.publish(new ModuleStart(this)); - GenericSystemComponent component = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null); - Assert.assertNotNull(component); - GenericSystemComponent ep = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null); - Assert.assertNotNull(ep); - moduleContext.publish(new ModuleStop(this)); - moduleContext.stop(); - } - - public void testModuleRegistrationAfterStart() throws Exception { - CompositeContext moduleContext = createContext(); - moduleContext.start(); - Module module = MockFactory.createSystemModule(); - moduleContext.registerModelObject(module); - moduleContext.publish(new ModuleStart(this)); - GenericSystemComponent component = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null); - Assert.assertNotNull(component); - GenericSystemComponent ep = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null); - Assert.assertNotNull(ep); - moduleContext.publish(new ModuleStop(this)); - moduleContext.stop(); - } - - public void testRegistration() throws Exception { - CompositeContext moduleContext = createContext(); - Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - moduleContext.registerModelObject(component); - EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); - moduleContext.registerModelObject(ep); - moduleContext.start(); - moduleContext.publish(new ModuleStart(this)); - GenericSystemComponent test = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null); - Assert.assertNotNull(test); - GenericSystemComponent testEP = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null); - Assert.assertNotNull(testEP); - moduleContext.publish(new ModuleStop(this)); - moduleContext.stop(); - } - - public void testRegistrationAfterStart() throws Exception { - CompositeContext moduleContext = createContext(); - Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - moduleContext.start(); - moduleContext.registerModelObject(component); - EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); - moduleContext.registerModelObject(ep); - moduleContext.publish(new ModuleStart(this)); - GenericSystemComponent test = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null); - Assert.assertNotNull(test); - GenericSystemComponent testEP = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null); - Assert.assertNotNull(testEP); - moduleContext.publish(new ModuleStop(this)); - moduleContext.stop(); - } - - public void testEPRegistrationAfterModuleStart() throws Exception { - CompositeContext moduleContext = createContext(); - Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - moduleContext.start(); - moduleContext.registerModelObject(component); - moduleContext.publish(new ModuleStart(this)); - GenericSystemComponent test = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null); - Assert.assertNotNull(test); - EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); - moduleContext.registerModelObject(ep); - GenericSystemComponent testEP = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null); - Assert.assertNotNull(testEP); - moduleContext.publish(new ModuleStop(this)); - moduleContext.stop(); - } - - protected CompositeContext createContext() { - List<ContextFactoryBuilder> builders = MockFactory.createSystemBuilders(); - return new CompositeContextImpl("test.context", null, new DefaultScopeStrategy(), new EventContextImpl(), - new MockConfigContext(builders)); - } - - protected void setUp() throws Exception { - factory = new SystemAssemblyFactoryImpl(); - super.setUp(); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeHierarchyTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeHierarchyTestCase.java deleted file mode 100644 index bd56a88658..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeHierarchyTestCase.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -import junit.framework.Assert; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.mock.MockConfigContext; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; -import org.osoa.sca.ModuleContext; -import org.osoa.sca.ServiceUnavailableException; -import org.osoa.sca.ServiceRuntimeException; - -import java.util.List; - -/** - * Performs testing of various hierarchical scenarios - * - * @version $Rev$ $Date$ - */ -public class CompositeHierarchyTestCase extends AbstractCompositeHierarchyTests { - - /** - * FIXME model Tests adding a component, accessing it and then exposing it as an entry point after the first access - * - * @throws Exception - */ - public void testChildContextIsolation() throws Exception { - CompositeContext parent = createContextHierachy(); - CompositeContext child = (CompositeContext) parent.getContext("test.child"); - Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - - component.initialize(new AssemblyContextImpl(factory, null, null)); - child.registerModelObject(component); - parent.publish(new ModuleStart(this)); - child.publish(new ModuleStart(this)); - Assert.assertNotNull(child.getContext("TestService1").getInstance(null)); - try { - ((ModuleContext) parent).locateService("test.child/TestService1"); - fail("Expected " + ServiceUnavailableException.class.getName() - + " since [test.child/TestService1] is not an entry point"); - } catch (ServiceRuntimeException e) { - // should throw an exception since it is not an entry point - } - - // now expose the service as an entry point - // FIXME hack to get around initialization of component - just create another one ;-) - component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", - component); - child.registerModelObject(ep); - Assert.assertNotNull(child.getContext("TestService1EP").getInstance(null)); - Assert.assertNotNull(parent.getContext("test.child").getInstance(new QualifiedName("./TestService1EP"))); - - // now expose the child entry point from the parent context - EntryPoint parentEp = MockFactory.createEntryPointWithStringRef("TestService1EP", ModuleScopeSystemComponent.class, - "TestService1", "test.child/TestService1EP"); - parent.registerModelObject(parentEp); - Assert.assertNotNull(parent.getContext("TestService1EP").getInstance(null)); - - parent.publish(new ModuleStop(this)); - child.publish(new ModuleStop(this)); - parent.stop(); - } - - protected CompositeContext createContextHierachy() throws Exception { - List<ContextFactoryBuilder> systemBuilders = MockFactory.createSystemBuilders(); - CompositeContext parent = new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), - new EventContextImpl(), new MockConfigContext(systemBuilders)); - Component component = MockFactory.createCompositeComponent("test.child"); - parent.registerModelObject(component); - parent.start(); - CompositeContext child = (CompositeContext) parent.getContext("test.child"); - Assert.assertNotNull(child); - return parent; - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/QualifiedNameTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/QualifiedNameTestCase.java deleted file mode 100644 index 4f86d1aed5..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/QualifiedNameTestCase.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context; - -import junit.framework.TestCase; - -/** - * Tests parsing of naming patters - * - * @version $Rev$ $Date$ - */ -public class QualifiedNameTestCase extends TestCase { - - public void testSimpleName() throws Exception { - QualifiedName name = new QualifiedName("Foo"); - assertEquals("Foo", name.getPartName()); - assertEquals(null, name.getPortName()); - } - - public void testCompoundName() throws Exception { - QualifiedName name = new QualifiedName("Foo/Bar"); - assertEquals("Foo", name.getPartName()); - assertEquals("Bar", name.getPortName()); - } - - public void testCompoundMultiName() throws Exception { - QualifiedName name = new QualifiedName("Foo/Bar/Baz"); - assertEquals("Foo", name.getPartName()); - assertEquals("Bar/Baz", name.getPortName()); - } - - public void testInvalidName() throws Exception { - try { - QualifiedName name = new QualifiedName("/Foo/Bar"); - fail("Invalid name exception not thrown"); - } catch (InvalidNameException e) { - - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategyTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategyTestCase.java deleted file mode 100644 index c9e6736833..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategyTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.context.scope; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Basic scope strategy tests, including downscope referencing - * - * @version $Rev$ $Date$ - */ -public class DefaultScopeStrategyTestCase extends TestCase { - - public void testDownScopeReferences() throws Exception{ - DefaultScopeStrategy strategy = new DefaultScopeStrategy(); - - Assert.assertTrue(!strategy.downScopeReference(Scope.MODULE,Scope.MODULE)); - Assert.assertTrue(strategy.downScopeReference(Scope.MODULE,Scope.SESSION)); - Assert.assertTrue(strategy.downScopeReference(Scope.MODULE,Scope.REQUEST)); - Assert.assertTrue(strategy.downScopeReference(Scope.MODULE,Scope.INSTANCE)); - - Assert.assertTrue(!strategy.downScopeReference(Scope.SESSION,Scope.MODULE)); - Assert.assertTrue(!strategy.downScopeReference(Scope.SESSION,Scope.SESSION)); - Assert.assertTrue(strategy.downScopeReference(Scope.SESSION,Scope.REQUEST)); - Assert.assertTrue(strategy.downScopeReference(Scope.SESSION,Scope.INSTANCE)); - - Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.MODULE)); - Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.SESSION)); - Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.REQUEST)); - Assert.assertTrue(strategy.downScopeReference(Scope.REQUEST,Scope.INSTANCE)); - - Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.MODULE)); - Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.SESSION)); - Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.REQUEST)); - Assert.assertTrue(!strategy.downScopeReference(Scope.INSTANCE,Scope.INSTANCE)); - } -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java deleted file mode 100644 index 765d6efee4..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import junit.framework.TestCase; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.impl.AtomicImplementationImpl; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class ContextFactorySupportTestCase extends TestCase { - - public void testGenericReflection() throws Exception { - TestFactoryBuilder b = new TestFactoryBuilder(); - assertEquals(TestImplementation.class, b.getImplementationClass()); - } - - public void testNegativeGenericReflection() throws Exception { - try { - new NonGenericFactoryBuilder(); - fail("AssertionError expected on non-genericized subclass of " + ContextFactoryBuilderSupport.class.getName()); - } catch (AssertionError e) { - // indicates success - } - } - - protected void setUp() throws Exception { - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - - private class TestFactoryBuilder extends ContextFactoryBuilderSupport<TestImplementation> { - - - public Class getImplementationClass() { - return implementationClass; - } - - protected ContextFactory createContextFactory(String componentName, TestImplementation implementation, Scope scope) { - return null; - } - } - - private class NonGenericFactoryBuilder extends ContextFactoryBuilderSupport { - - - public Class getImplementationClass() { - return implementationClass; - } - - protected ContextFactory createContextFactory(String componentName, Implementation implementation, Scope scope) { - return null; - } - } - - private class TestImplementation extends AtomicImplementationImpl { - - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java deleted file mode 100644 index 2f911fefa5..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import junit.framework.TestCase; -import org.apache.tuscany.core.extension.EntryPointContextFactory; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.EntryPoint; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class EntryPointBuilderSupportTestCase extends TestCase { - - public void testGenericReflection() throws Exception { - EntryPointBuilderSupportTestCase.TestEntryPointBuilder b = new EntryPointBuilderSupportTestCase.TestEntryPointBuilder(); - assertEquals(EntryPointBuilderSupportTestCase.TestBinding.class, b.getImplementationClass()); - } - - public void testNegativeGenericReflection() throws Exception { - try { - new EntryPointBuilderSupportTestCase.NonGenericFactoryBuilder(); - fail("AssertionError expected on non-genericized subclass of " + ContextFactoryBuilderSupport.class.getName()); - } catch (AssertionError e) { - // indicates success - } - } - - protected void setUp() throws Exception { - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - - private class TestEntryPointBuilder extends EntryPointBuilderSupport<EntryPointBuilderSupportTestCase.TestBinding> { - - public Class getImplementationClass() { - return bindingClass; - } - - protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) { - return null; - } - } - - private class NonGenericFactoryBuilder extends EntryPointBuilderSupport { - - public Class getImplementationClass() { - return bindingClass; - } - - protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) { - return null; - } - } - - private interface TestBinding extends Binding { - - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java deleted file mode 100644 index a1c758c526..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import junit.framework.TestCase; -import org.apache.tuscany.core.extension.ExternalServiceContextFactory; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ExternalService; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class ExternalServiceBuilderSupportTestCase extends TestCase { - - public void testGenericReflection() throws Exception { - ExternalServiceBuilderSupportTestCase.TestExternalServiceBuilder b = new ExternalServiceBuilderSupportTestCase.TestExternalServiceBuilder(); - assertEquals(ExternalServiceBuilderSupportTestCase.TestBinding.class, b.getImplementationClass()); - } - - public void testNegativeGenericReflection() throws Exception { - try { - new ExternalServiceBuilderSupportTestCase.NonGenericFactoryBuilder(); - fail("AssertionError expected on non-genericized subclass of " + ContextFactoryBuilderSupport.class.getName()); - } catch (AssertionError e) { - // indicates success - } - } - - protected void setUp() throws Exception { - super.setUp(); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - - private class TestExternalServiceBuilder extends ExternalServiceBuilderSupport<ExternalServiceBuilderSupportTestCase.TestBinding> { - - - public Class getImplementationClass() { - return bindingClass; - } - - protected ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService) { - return null; - } - } - - private class NonGenericFactoryBuilder extends ExternalServiceBuilderSupport { - - - public Class getImplementationClass() { - return bindingClass; - } - - - protected ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService) { - return null; - } - } - - private interface TestBinding extends Binding { - - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java deleted file mode 100644 index 0fd80c51af..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java +++ /dev/null @@ -1,261 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import junit.framework.TestCase; -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.core.wire.jdk.JDKTargetWireFactory; -import org.apache.tuscany.core.wire.mock.MockScopeContext; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.Scope; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class WireBuilderSupportTestCase extends TestCase { - private Method m; - - /** - * Tests that {@link WireBuilderSupport} only processes connect operations and sets target invokers for - * the correct target type. - * <p/> - * Verifies TUSCANY-218 - * - * @throws Exception - */ - public void testTargetInvokerSet() throws Exception { - FooWireBuilder fooBuilder = new FooWireBuilder(); - BarWireBuilder barBuilder = new BarWireBuilder(); - DefaultWireBuilder defaultBuilder = new DefaultWireBuilder(); - defaultBuilder.addWireBuilder(fooBuilder); - defaultBuilder.addWireBuilder(barBuilder); - TargetWireFactory targetFooFactory = new JDKTargetWireFactory(); - Map<Method, TargetInvocationConfiguration> fooConfigs = new HashMap<Method, TargetInvocationConfiguration>(); - TargetInvocationConfiguration fooInvocation = new TargetInvocationConfiguration(m); - fooConfigs.put(m, fooInvocation); - Map<Method, TargetInvocationConfiguration> barConfigs = new HashMap<Method, TargetInvocationConfiguration>(); - TargetInvocationConfiguration barInvocation = new TargetInvocationConfiguration(m); - barConfigs.put(m, barInvocation); - targetFooFactory.setConfiguration(new WireTargetConfiguration(null, fooConfigs, null, null)); - TargetWireFactory targetBarFactory = new JDKTargetWireFactory(); - targetBarFactory.setConfiguration(new WireTargetConfiguration(null, barConfigs, null, null)); - ScopeContext ctx = new MockScopeContext(); - defaultBuilder.completeTargetChain(targetFooFactory, FooContextFactory.class, ctx); - defaultBuilder.completeTargetChain(targetBarFactory, BarContextFactory.class, ctx); - assertEquals(FooInvoker.class, targetFooFactory.getConfiguration().getInvocationConfigurations().get(m).getTargetInvoker().getClass()); - assertEquals(BarInvoker.class, targetBarFactory.getConfiguration().getInvocationConfigurations().get(m).getTargetInvoker().getClass()); - - } - - - protected void setUp() throws Exception { - super.setUp(); - m = SomeInterface.class.getMethod("test", (Class[]) null); - } - - protected void tearDown() throws Exception { - super.tearDown(); - } - - private interface SomeInterface { - void test(); - } - - private interface Foo extends Implementation { - - } - - private interface Bar extends Implementation { - - } - - private class FooWireBuilder extends WireBuilderSupport<FooContextFactory> { - - protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) { - return new FooInvoker(); - } - } - - private class BarWireBuilder extends WireBuilderSupport<BarContextFactory> { - - protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) { - return new BarInvoker(); - } - } - - private class FooInvoker implements TargetInvoker { - - public Object invokeTarget(Object payload) throws InvocationTargetException { - return null; - } - - public boolean isCacheable() { - return false; - } - - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public Message invoke(Message msg) { - return null; - } - - public void setNext(Interceptor next) { - - } - } - - - private class BarInvoker implements TargetInvoker { - - public Object invokeTarget(Object payload) throws InvocationTargetException { - return null; - } - - public boolean isCacheable() { - return false; - } - - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public Message invoke(Message msg) { - return null; - } - - public void setNext(Interceptor next) { - - } - } - - private class FooContextFactory implements ContextFactory<AtomicContext> { - - public AtomicContext createContext() throws ContextCreationException { - return null; - } - - public Scope getScope() { - return null; - } - - public String getName() { - return null; - } - - public void addProperty(String propertyName, Object value) { - - } - - public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { - - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - return null; - } - - public Map getTargetWireFactories() { - return null; - } - - public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { - - } - - public List getSourceWireFactories() { - return null; - } - - public void prepare(CompositeContext parent) { - - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity) { - - } - } - - - private class BarContextFactory implements ContextFactory<Context> { - public Context createContext() throws ContextCreationException { - return null; - } - - public Scope getScope() { - return null; - } - - public String getName() { - return null; - } - - public void addProperty(String propertyName, Object value) { - - } - - public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { - - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - return null; - } - - public Map getTargetWireFactories() { - return null; - } - - public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { - - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity) { - - } - - public List getSourceWireFactories() { - return null; - } - - public void prepare(CompositeContext parent) { - - } - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/integration/IntraCompositeWireIntegrationTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/integration/IntraCompositeWireIntegrationTestCase.java deleted file mode 100644 index 44be759b69..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/integration/IntraCompositeWireIntegrationTestCase.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.integration; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.mock.component.Source; -import org.apache.tuscany.core.mock.component.Target; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.SystemModule; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * Tests intra-composite system wires are properly constructed in the runtime - * - * @version $Rev$ $Date$ - */ -public class IntraCompositeWireIntegrationTestCase extends TestCase { - - - public void testWireConstruction2() throws Exception { - RuntimeContext runtime = MockFactory.createCoreRuntime(); - ModuleComponent moduleComponent = createSystemCompositeComponent("test.system"); - Module module = MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE, Scope.MODULE); - moduleComponent.setImplementation(module); - runtime.getSystemContext().registerModelObject(moduleComponent); - CompositeContext context = (CompositeContext) runtime.getSystemContext().getContext("test.system"); - context.publish(new ModuleStart(this)); - //context.registerModelObject(module); - Source source = (Source) ((AtomicContext)context.getContext("source")).getTargetInstance(); - Assert.assertNotNull(source); - Target targetRef = source.getTarget(); - Assert.assertNotNull(targetRef); - Target target = (Target) ((AtomicContext)context.getContext("target")).getTargetInstance(); - Assert.assertSame(target, targetRef); - Source source2 = (Source) ((AtomicContext)context.getContext("source")).getTargetInstance(); - Assert.assertSame(target, source2.getTarget()); - context.publish(new ModuleStop(this)); - context.stop(); - } - - private static SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); - - /** - * Creates an composite component with the given name - */ - public static ModuleComponent createSystemCompositeComponent(String name) { - ModuleComponent sc = systemFactory.createModuleComponent(); - SystemModule impl = systemFactory.createSystemModule(); - impl.setImplementationClass(SystemCompositeContextImpl.class); - sc.setImplementation(impl); - Service s = systemFactory.createService(); - JavaServiceContract ji = systemFactory.createJavaServiceContract(); - s.setServiceContract(ji); - ji.setScope(Scope.AGGREGATE); - impl.setComponentType(systemFactory.createComponentType()); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setImplementation(impl); - return sc; - } - - - public void testWireConstruction() throws ConfigurationException { - RuntimeContext runtime = MockFactory.createCoreRuntime(); - runtime.getSystemContext().registerModelObject(MockFactory.createSystemCompositeComponent("test.system")); - CompositeContext context = (CompositeContext) runtime.getSystemContext().getContext("test.system"); - - context.publish(new ModuleStart(this)); - context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE,Scope.MODULE)); - Source source = (Source) ((AtomicContext)context.getContext("source")).getTargetInstance(); - Assert.assertNotNull(source); - Target targetRef = source.getTarget(); - Assert.assertNotNull(targetRef); - Target target = (Target) ((AtomicContext)context.getContext("target")).getTargetInstance(); - Assert.assertSame(target, targetRef); - Source source2 = (Source) ((AtomicContext)context.getContext("source")).getTargetInstance(); - Assert.assertSame(target, source2.getTarget()); - context.publish(new ModuleStop(this)); - context.stop(); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java deleted file mode 100644 index c17d96a145..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java +++ /dev/null @@ -1,210 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader; - -import static javax.naming.Context.INITIAL_CONTEXT_FACTORY; -import java.io.StringReader; -import java.util.Hashtable; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.Name; -import javax.naming.NameClassPair; -import javax.naming.NamingEnumeration; -import javax.naming.Binding; -import javax.naming.NameParser; -import javax.naming.spi.InitialContextFactory; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.impl.JNDIPropertyFactory; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; - -/** - * @version $Rev$ $Date$ - */ -@SuppressWarnings({"AccessOfSystemProperties"}) -public class JNDIPropertyFactoryTestCase extends TestCase { - private JNDIPropertyFactory factory; - private XMLInputFactory xmlFactory; - private Property property; - private String oldICF; - - public void testLookup() throws XMLStreamException, ConfigurationLoadException { - String instance = getInstance(String.class, "<foo>foo:/hello</foo>"); - assertEquals("Hello World", instance); - } - - private <T> T getInstance(Class<T> type, String xml) throws XMLStreamException, ConfigurationLoadException { - property.setType(type); - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml)); - reader.next(); - ObjectFactory<T> objectFactory = (ObjectFactory<T>) factory.createObjectFactory(reader, property); - return objectFactory.getInstance(); - } - - protected void setUp() throws Exception { - super.setUp(); - factory = new JNDIPropertyFactory(); - xmlFactory = XMLInputFactory.newInstance(); - AssemblyFactory assemblyFactory = new AssemblyFactoryImpl(); - property = assemblyFactory.createProperty(); - - oldICF = System.getProperty(INITIAL_CONTEXT_FACTORY); - System.setProperty(INITIAL_CONTEXT_FACTORY, MockContextFactory.class.getName()); - } - - protected void tearDown() throws Exception { - if (oldICF != null) { - System.getProperty(INITIAL_CONTEXT_FACTORY, oldICF); - } - super.tearDown(); - } - - public static class MockContextFactory implements InitialContextFactory { - public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { - return new MockContext(); - } - } - - public static class MockContext implements Context { - public Object lookup(String name) throws NamingException { - if ("foo:/hello".equals(name)) { - return "Hello World"; - } - throw new AssertionError(); - } - - public Object lookup(Name name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public void bind(Name name, Object obj) throws NamingException { - throw new UnsupportedOperationException(); - } - - public void bind(String name, Object obj) throws NamingException { - throw new UnsupportedOperationException(); - } - - public void rebind(Name name, Object obj) throws NamingException { - throw new UnsupportedOperationException(); - } - - public void rebind(String name, Object obj) throws NamingException { - throw new UnsupportedOperationException(); - } - - public void unbind(Name name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public void unbind(String name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public void rename(Name oldName, Name newName) throws NamingException { - throw new UnsupportedOperationException(); - } - - public void rename(String oldName, String newName) throws NamingException { - throw new UnsupportedOperationException(); - } - - public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public NamingEnumeration<NameClassPair> list(String name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public NamingEnumeration<Binding> listBindings(String name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public void destroySubcontext(Name name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public void destroySubcontext(String name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public Context createSubcontext(Name name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public Context createSubcontext(String name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public Object lookupLink(Name name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public Object lookupLink(String name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public NameParser getNameParser(Name name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public NameParser getNameParser(String name) throws NamingException { - throw new UnsupportedOperationException(); - } - - public Name composeName(Name name, Name prefix) throws NamingException { - throw new UnsupportedOperationException(); - } - - public String composeName(String name, String prefix) throws NamingException { - throw new UnsupportedOperationException(); - } - - public Object addToEnvironment(String propName, Object propVal) throws NamingException { - throw new UnsupportedOperationException(); - } - - public Object removeFromEnvironment(String propName) throws NamingException { - throw new UnsupportedOperationException(); - } - - public Hashtable<?, ?> getEnvironment() throws NamingException { - throw new UnsupportedOperationException(); - } - - public void close() throws NamingException { - throw new UnsupportedOperationException(); - } - - public String getNameInNamespace() throws NamingException { - throw new UnsupportedOperationException(); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/MockReaderSupport.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/MockReaderSupport.java deleted file mode 100644 index 542a4d7b2b..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/MockReaderSupport.java +++ /dev/null @@ -1,210 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader; - -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.Location; -import javax.xml.namespace.QName; -import javax.xml.namespace.NamespaceContext; - -/** - * Base class for a mock XMLStreamReader. - * - * @version $Rev$ $Date$ - */ -public class MockReaderSupport implements XMLStreamReader { - public QName getName() { - throw new UnsupportedOperationException(); - } - - public Object getProperty(String name) throws IllegalArgumentException { - throw new UnsupportedOperationException(); - } - - public int next() throws XMLStreamException { - throw new UnsupportedOperationException(); - } - - public void require(int i, String name, String name1) throws XMLStreamException { - throw new UnsupportedOperationException(); - } - - public String getElementText() throws XMLStreamException { - throw new UnsupportedOperationException(); - } - - public int nextTag() throws XMLStreamException { - throw new UnsupportedOperationException(); - } - - public boolean hasNext() throws XMLStreamException { - throw new UnsupportedOperationException(); - } - - public void close() throws XMLStreamException { - throw new UnsupportedOperationException(); - } - - public String getNamespaceURI(String name) { - throw new UnsupportedOperationException(); - } - - public boolean isStartElement() { - throw new UnsupportedOperationException(); - } - - public boolean isEndElement() { - throw new UnsupportedOperationException(); - } - - public boolean isCharacters() { - throw new UnsupportedOperationException(); - } - - public boolean isWhiteSpace() { - throw new UnsupportedOperationException(); - } - - public String getAttributeValue(String name, String name1) { - throw new UnsupportedOperationException(); - } - - public int getAttributeCount() { - throw new UnsupportedOperationException(); - } - - public QName getAttributeName(int i) { - throw new UnsupportedOperationException(); - } - - public String getAttributeNamespace(int i) { - throw new UnsupportedOperationException(); - } - - public String getAttributeLocalName(int i) { - throw new UnsupportedOperationException(); - } - - public String getAttributePrefix(int i) { - throw new UnsupportedOperationException(); - } - - public String getAttributeType(int i) { - throw new UnsupportedOperationException(); - } - - public String getAttributeValue(int i) { - throw new UnsupportedOperationException(); - } - - public boolean isAttributeSpecified(int i) { - throw new UnsupportedOperationException(); - } - - public int getNamespaceCount() { - throw new UnsupportedOperationException(); - } - - public String getNamespacePrefix(int i) { - throw new UnsupportedOperationException(); - } - - public String getNamespaceURI(int i) { - throw new UnsupportedOperationException(); - } - - public NamespaceContext getNamespaceContext() { - throw new UnsupportedOperationException(); - } - - public int getEventType() { - throw new UnsupportedOperationException(); - } - - public String getText() { - throw new UnsupportedOperationException(); - } - - public char[] getTextCharacters() { - throw new UnsupportedOperationException(); - } - - public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { - throw new UnsupportedOperationException(); - } - - public int getTextStart() { - throw new UnsupportedOperationException(); - } - - public int getTextLength() { - throw new UnsupportedOperationException(); - } - - public String getEncoding() { - throw new UnsupportedOperationException(); - } - - public boolean hasText() { - throw new UnsupportedOperationException(); - } - - public Location getLocation() { - throw new UnsupportedOperationException(); - } - - public String getLocalName() { - throw new UnsupportedOperationException(); - } - - public boolean hasName() { - throw new UnsupportedOperationException(); - } - - public String getNamespaceURI() { - throw new UnsupportedOperationException(); - } - - public String getPrefix() { - throw new UnsupportedOperationException(); - } - - public String getVersion() { - throw new UnsupportedOperationException(); - } - - public boolean isStandalone() { - throw new UnsupportedOperationException(); - } - - public boolean standaloneSet() { - throw new UnsupportedOperationException(); - } - - public String getCharacterEncodingScheme() { - throw new UnsupportedOperationException(); - } - - public String getPITarget() { - throw new UnsupportedOperationException(); - } - - public String getPIData() { - throw new UnsupportedOperationException(); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryTestCase.java deleted file mode 100644 index 177e4e5005..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryTestCase.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader; - -import java.util.List; -import java.util.ArrayList; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamException; - -import junit.framework.TestCase; - -import org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyInitializationException; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; - -/** - * @version $Rev$ $Date$ - */ -public class StAXLoaderRegistryTestCase extends TestCase { - private StAXLoaderRegistryImpl registry; - private MockElementLoader loader; - private MockObject mockObject; - private MockReader reader; - private MockMonitor monitor; - private QName qname; - private ResourceLoaderImpl rl; - private LoaderContext loaderContext; - - public void testRegistrationEvents() throws XMLStreamException, ConfigurationLoadException { - reader.name = qname; - registry.registerLoader(qname, loader); - assertTrue(monitor.registered.contains(qname)); - assertEquals(1, monitor.registered.size()); - assertTrue(monitor.unregistered.isEmpty()); - assertTrue(monitor.loading.isEmpty()); - - registry.unregisterLoader(qname, loader); - assertTrue(monitor.registered.contains(qname)); - assertEquals(1, monitor.registered.size()); - assertTrue(monitor.unregistered.contains(qname)); - assertEquals(1, monitor.unregistered.size()); - assertTrue(monitor.loading.isEmpty()); - } - - public void testSuccessfulLoad() throws XMLStreamException, ConfigurationLoadException { - reader.name = qname; - registry.registerLoader(qname, loader); - assertSame(mockObject, registry.load(reader, loaderContext)); - assertEquals(1, monitor.loading.size()); - assertTrue(monitor.loading.contains(qname)); - } - - public void testFailedLoad() throws XMLStreamException, ConfigurationLoadException { - registry.registerLoader(qname, loader); - reader.name = new QName("foo"); - try { - registry.load(reader, loaderContext); - fail(); - } catch (ConfigurationLoadException e) { - assertEquals(1, monitor.loading.size()); - assertTrue(monitor.loading.contains(reader.name)); - } - } - - protected void setUp() throws Exception { - super.setUp(); - qname = new QName("test"); - monitor = new MockMonitor(); - registry = new StAXLoaderRegistryImpl(); - registry.setMonitor(monitor); - mockObject = new MockObject(); - loader = new MockElementLoader(); - reader = new MockReader(); - rl = new ResourceLoaderImpl(getClass().getClassLoader()); - loaderContext = new LoaderContext(rl); - } - - public static class MockMonitor implements StAXLoaderRegistryImpl.Monitor { - private List<QName> registered = new ArrayList<QName>(); - private List<QName> unregistered = new ArrayList<QName>(); - private List<QName> loading = new ArrayList<QName>(); - - public void registeringLoader(QName xmlType) { - registered.add(xmlType); - } - - public void unregisteringLoader(QName xmlType) { - unregistered.add(xmlType); - } - - public void elementLoad(QName xmlType) { - loading.add(xmlType); - } - } - - @SuppressWarnings({"NonStaticInnerClassInSecureContext"}) - public class MockElementLoader<MockObject> implements StAXElementLoader { - public AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assertEquals(qname, reader.getName()); - assertSame(rl, loaderContext.getResourceLoader()); - return mockObject; - } - } - - public static class MockObject implements AssemblyObject { - public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException { - throw new UnsupportedOperationException(); - } - - public void freeze() { - throw new UnsupportedOperationException(); - } - - public boolean accept(AssemblyVisitor visitor) { - throw new UnsupportedOperationException(); - } - } - - private static class MockReader extends MockReaderSupport { - private QName name; - - public QName getName() { - return name; - } - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.java deleted file mode 100644 index 0efe1ae82a..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader; - -import junit.framework.TestCase; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.loader.impl.StringParserPropertyFactory; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import java.beans.PropertyEditorManager; -import java.beans.PropertyEditorSupport; -import java.io.StringReader; -import java.net.URI; -import java.util.Arrays; - -/** - * @version $Rev$ $Date$ - */ -public class StringParserPropertyFactoryTestCase extends TestCase { - private StringParserPropertyFactory factory; - private XMLInputFactory xmlFactory; - private Property property; - - public void testSimpleString() throws XMLStreamException, ConfigurationLoadException { - String instance = getInstance(String.class, "<foo>Hello World</foo>"); - assertEquals("Hello World", instance); - } - - public void testByteArray() throws XMLStreamException, ConfigurationLoadException { - byte[] instance = getInstance(byte[].class, "<foo>01020304</foo>"); - assertTrue(Arrays.equals(new byte[]{1, 2, 3, 4}, instance)); - } - - public void testInteger() throws XMLStreamException, ConfigurationLoadException { - Integer instance = getInstance(Integer.class, "<foo>1234</foo>"); - assertEquals(Integer.valueOf(1234), instance); - } - - public void testInt() throws XMLStreamException, ConfigurationLoadException { - int instance = getInstance(Integer.TYPE, "<foo>1234</foo>"); - assertEquals(1234, instance); - } - - public void testBoolean() throws XMLStreamException, ConfigurationLoadException { - Boolean instance = getInstance(Boolean.class, "<foo>true</foo>"); - assertSame(Boolean.TRUE, instance); - } - - public void testConstructor() throws XMLStreamException, ConfigurationLoadException { - // java.net.URI has a ctr that takes a String - URI instance = getInstance(URI.class, "<foo>http://www.apache.org</foo>"); - assertEquals(URI.create("http://www.apache.org"), instance); - } - - public void testPropertyEditor() throws XMLStreamException, ConfigurationLoadException { - // register a property editor for java.lang.Class - PropertyEditorManager.registerEditor(Class.class, ClassEditor.class); - try { - Class<?> instance = getInstance(Class.class, "<foo>java.lang.Integer</foo>"); - assertEquals(Integer.class, instance); - } finally{ - PropertyEditorManager.registerEditor(Class.class, null); - } - } - - private <T> T getInstance(Class<T> type, String xml) throws XMLStreamException, ConfigurationLoadException { - property.setType(type); - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml)); - reader.next(); - ObjectFactory<T> objectFactory = (ObjectFactory<T>) factory.createObjectFactory(reader, property); - return objectFactory.getInstance(); - } - - protected void setUp() throws Exception { - super.setUp(); - factory = new StringParserPropertyFactory(); - xmlFactory = XMLInputFactory.newInstance(); - AssemblyFactory assemblyFactory = new AssemblyFactoryImpl(); - property = assemblyFactory.createProperty(); - } - - public static class ClassEditor extends PropertyEditorSupport { - public void setAsText(String text) throws IllegalArgumentException { - try { - setValue(Class.forName(text)); - } catch (ClassNotFoundException e) { - throw new IllegalArgumentException(text); - } - } - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentLoaderTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentLoaderTestCase.java deleted file mode 100644 index 37056b3283..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentLoaderTestCase.java +++ /dev/null @@ -1,151 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import java.util.List; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.extension.config.ImplementationProcessor; -import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector; -import org.apache.tuscany.core.config.processor.ProcessorUtils; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.core.loader.StAXPropertyFactory; -import org.apache.tuscany.core.loader.impl.StringParserPropertyFactory; -import org.apache.tuscany.core.system.assembly.SystemImplementation; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.AtomicComponent; - -/** - * @version $Rev$ $Date$ - */ -public class ComponentLoaderTestCase extends LoaderTestSupport { - private ComponentLoader loader; - private ComponentTypeIntrospector introspector; - - public void testStringProperty() throws XMLStreamException, ConfigurationLoadException { - String xml = "<properties><propString>HelloWorld</propString></properties>"; - Component component = createFooComponent(); - loadProperties(xml, component); - ConfiguredProperty prop = component.getConfiguredProperty("propString"); - assertEquals("HelloWorld", prop.getValue()); - } - - public void testIntProperty() throws XMLStreamException, ConfigurationLoadException { - String xml = "<properties><propInt>1234</propInt></properties>"; - Component component = createFooComponent(); - loadProperties(xml, component); - ConfiguredProperty prop = component.getConfiguredProperty("propInt"); - assertEquals(1234, prop.getValue()); - } - - public void testIntegerProperty() throws XMLStreamException, ConfigurationLoadException { - String xml = "<properties><propInteger>1234</propInteger></properties>"; - Component component = createFooComponent(); - loadProperties(xml, component); - ConfiguredProperty prop = component.getConfiguredProperty("propInteger"); - assertEquals(Integer.valueOf(1234), prop.getValue()); - } - - public void testCustomProperty() throws XMLStreamException, ConfigurationLoadException { - String xml = "<properties><propFoo factory='" + FooFactory.class.getName() + "'><name>Hello</name></propFoo></properties>"; - Component component = createFooComponent(); - loadProperties(xml, component); - ConfiguredProperty prop = component.getConfiguredProperty("propFoo"); - Foo instance = (Foo) prop.getValue(); - assertEquals("Hello", instance.name); - } - - private void loadProperties(String xml, Component component) throws XMLStreamException, ConfigurationLoadException { - XMLStreamReader reader = getReader(xml); - loader.loadProperties(reader, resourceLoader, component); - component.initialize(modelContext); - } - - private Component createFooComponent() { - SystemImplementation impl = assemblyFactory.createSystemImplementation(); - impl.setImplementationClass(ServiceImpl.class); - try { - impl.setComponentType(introspector.introspect(ServiceImpl.class)); - } catch (ConfigurationException e) { - throw new AssertionError(); - } - impl.initialize(null); - AtomicComponent component = assemblyFactory.createSimpleComponent(); - component.setImplementation(impl); - return component; - } - - protected void setUp() throws Exception { - super.setUp(); - loader = new ComponentLoader(); - loader.setFactory(assemblyFactory); - loader.setDefaultPropertyFactory(new StringParserPropertyFactory()); - introspector = ProcessorUtils.createCoreIntrospector(assemblyFactory); - } - - public static interface Service { - } - - public static class ServiceImpl implements Service { - public String propString; - public int propInt; - public Integer propInteger; - public Foo propFoo; - } - - public static class Foo { - public Foo() { - } - - private String name; - private Foo foo; - - public void setName(String val) { - name = val; - } - - public void setFoo(Foo val) { - foo = val; - } -/* - - private MyJaxBThing jaxBThing; - - public void setMyJaxBThing(MyJaxBThing thing) { - jaxBthing = thing; - } -*/ - } - - public static class FooFactory implements StAXPropertyFactory<Foo> { - public ObjectFactory<Foo> createObjectFactory(XMLStreamReader reader, Property property) throws XMLStreamException, ConfigurationLoadException { - reader.nextTag(); - String name = reader.getElementText(); - reader.next(); - Foo foo = new Foo(); - foo.setName(name); - return new SingletonObjectFactory<Foo>(foo); - } - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoaderTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoaderTestCase.java deleted file mode 100644 index 43b5bec143..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoaderTestCase.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Service; - -/** - * @version $Rev$ $Date$ - */ -public class ComponentTypeLoaderTestCase extends LoaderTestSupport { - - public void testMinimal() throws XMLStreamException, ConfigurationLoadException { - XMLStreamReader reader = getReader("<componentType xmlns='http://www.osoa.org/xmlns/sca/0.9'><service name='service1'/></componentType>"); - ComponentType type = (ComponentType) registry.load(reader, loaderContext); - type.initialize(null); - assertNotNull(type); - assertEquals(1, type.getServices().size()); - Service service = type.getService("service1"); - assertEquals("service1", service.getName()); - assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); - } - - protected void setUp() throws Exception { - super.setUp(); - registerLoader(new ComponentTypeLoader()); - registerLoader(new ServiceLoader()); - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/EntryPointLoaderTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/EntryPointLoaderTestCase.java deleted file mode 100644 index 8f207261fb..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/EntryPointLoaderTestCase.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.ENTRY_POINT; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * @version $Rev$ $Date$ - */ -public class EntryPointLoaderTestCase extends LoaderTestSupport { - - public void testMinimal() throws XMLStreamException, ConfigurationLoadException { - String xml = "<entryPoint xmlns='http://www.osoa.org/xmlns/sca/0.9' name='test'></entryPoint>"; - XMLStreamReader reader = getReader(xml); - EntryPoint ep = (EntryPoint) registry.load(reader, loaderContext); - reader.require(XMLStreamConstants.END_ELEMENT, ENTRY_POINT.getNamespaceURI(), ENTRY_POINT.getLocalPart()); - assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); - assertNotNull(ep); - assertEquals("test", ep.getName()); - } - - public void testInterface() throws XMLStreamException, ConfigurationLoadException { - String interfaceName = MockService.class.getName(); - String xml = "<entryPoint xmlns='http://www.osoa.org/xmlns/sca/0.9' name='test'><interface.java interface='" + interfaceName + "'/></entryPoint>"; - XMLStreamReader reader = getReader(xml); - EntryPoint ep = (EntryPoint) registry.load(reader, loaderContext); - reader.require(XMLStreamConstants.END_ELEMENT, ENTRY_POINT.getNamespaceURI(), ENTRY_POINT.getLocalPart()); - assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); - assertNotNull(ep); - assertEquals("test", ep.getName()); - ConfiguredService configuredService = ep.getConfiguredService(); - JavaServiceContract serviceContract = (JavaServiceContract) configuredService.getPort().getServiceContract(); - assertEquals(interfaceName, serviceContract.getInterfaceName()); - } - - protected void setUp() throws Exception { - super.setUp(); - registerLoader(new EntryPointLoader()); - registerLoader(new InterfaceJavaLoader()); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoaderTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoaderTestCase.java deleted file mode 100644 index 1fc5b367d5..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoaderTestCase.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.EXTERNAL_SERVICE; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamConstants; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * @version $Rev$ $Date$ - */ -public class ExternalServiceLoaderTestCase extends LoaderTestSupport { - - public void testMinimal() throws XMLStreamException, ConfigurationLoadException { - String xml = "<externalService xmlns='http://www.osoa.org/xmlns/sca/0.9' name='test'></externalService>"; - XMLStreamReader reader = getReader(xml); - ExternalService es = (ExternalService) registry.load(reader, loaderContext); - assertNotNull(es); - assertEquals("test", es.getName()); - reader.require(XMLStreamConstants.END_ELEMENT, EXTERNAL_SERVICE.getNamespaceURI(), EXTERNAL_SERVICE.getLocalPart()); - assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); - } - - public void testInterface() throws XMLStreamException, ConfigurationLoadException { - String interfaceName = MockService.class.getName(); - String xml = "<externalService xmlns='http://www.osoa.org/xmlns/sca/0.9' name='test'><interface.java interface='" + interfaceName + "'/></externalService>"; - XMLStreamReader reader = getReader(xml); - ExternalService es = (ExternalService) registry.load(reader, loaderContext); - reader.require(XMLStreamConstants.END_ELEMENT, EXTERNAL_SERVICE.getNamespaceURI(), EXTERNAL_SERVICE.getLocalPart()); - assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); - assertNotNull(es); - assertEquals("test", es.getName()); - ConfiguredService configuredService = es.getConfiguredService(); - JavaServiceContract serviceContract = (JavaServiceContract) configuredService.getPort().getServiceContract(); - assertEquals(interfaceName, serviceContract.getInterfaceName()); - } - - protected void setUp() throws Exception { - super.setUp(); - registerLoader(new ExternalServiceLoader()); - registerLoader(new InterfaceJavaLoader()); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderInterfaceStylesTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderInterfaceStylesTestCase.java deleted file mode 100644 index 8b4f840f71..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderInterfaceStylesTestCase.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.INTERFACE_WSDL; - -import java.io.InputStream; -import java.net.URL; - -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; -import org.apache.tuscany.core.loader.impl.WSDLDefinitionRegistryImpl; -import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.helper.XSDHelper; - -/** - * @version $Rev$ $Date$ - */ -public class InterfaceWSDLLoaderInterfaceStylesTestCase extends LoaderTestSupport { - private WSDLDefinitionRegistryImpl wsdlRegistry; - private ResourceLoader resourceLoader; - private ClassLoader oldCL; - - public void testInterface() throws Exception { - wsdlRegistry.loadDefinition("http://www.interfacestyles.org", getClass().getResource("interfacestyles.wsdl"), resourceLoader); - String xml = "<interface.wsdl xmlns='http://www.osoa.org/xmlns/sca/0.9' interface='http://www.interfacestyles.org#TestInterfaceStylesService'></interface.wsdl>"; - XMLStreamReader reader = getReader(xml); - WSDLServiceContract sc = (WSDLServiceContract) registry.load(reader, loaderContext); - reader.require(XMLStreamConstants.END_ELEMENT, INTERFACE_WSDL.getNamespaceURI(), INTERFACE_WSDL.getLocalPart()); - assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); - assertNotNull(sc); - - sc.initialize(modelContext); - - Class scInterface = sc.getInterface(); - assertNotNull(scInterface); - - assertNotNull(scInterface.getMethod("getAccountReportWrapped0", new Class[0])); - assertNotNull(scInterface.getMethod("getAccountReportWrapped1", new Class[] {String.class})); - assertNotNull(scInterface.getMethod("getAccountReportWrappedN", new Class[] {String.class, int.class})); - assertNotNull(scInterface.getMethod("getAccountReportBare0", new Class[0])); - assertNotNull(scInterface.getMethod("getAccountReportBare1Simple", new Class[]{String.class})); - assertNotNull(scInterface.getMethod("getAccountReportBare1Complex", new Class[]{Object.class})); - - } - - protected void setUp() throws Exception { - oldCL = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); - resourceLoader = new ResourceLoaderImpl(getClass().getClassLoader()); - super.setUp(); - - wsdlRegistry = new WSDLDefinitionRegistryImpl(); - wsdlRegistry.setMonitor(NULL_MONITOR); - URL wsdlURL = getClass().getResource("interfacestyles.wsdl"); - wsdlRegistry.loadDefinition("http://www.interfacestyles.org", wsdlURL, resourceLoader); - InterfaceWSDLLoader loader = new InterfaceWSDLLoader(); - loader.setWsdlRegistry(wsdlRegistry); - registerLoader(loader); - - InputStream xsdInputStream = wsdlURL.openStream(); - try { - XSDHelper xsdHelper = SDOUtil.createXSDHelper(modelContext.getTypeHelper()); - xsdHelper.define(xsdInputStream, null); - } finally { - xsdInputStream.close(); - } - } - - protected void tearDown() throws Exception { - Thread.currentThread().setContextClassLoader(oldCL); - super.tearDown(); - } - - private static final WSDLDefinitionRegistryImpl.Monitor NULL_MONITOR = new WSDLDefinitionRegistryImpl.Monitor() { - public void readingWSDL(String namespace, URL location) { - } - - public void cachingDefinition(String namespace, URL location) { - } - }; -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderTestCase.java deleted file mode 100644 index f97f13a1f7..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderTestCase.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import java.net.URL; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.INTERFACE_WSDL; -import org.apache.tuscany.core.loader.impl.WSDLDefinitionRegistryImpl; -import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; - -/** - * @version $Rev$ $Date$ - */ -public class InterfaceWSDLLoaderTestCase extends LoaderTestSupport { - private WSDLDefinitionRegistryImpl wsdlRegistry; - private ResourceLoader resourceLoader; - - public void testMinimal() throws XMLStreamException, ConfigurationLoadException { - String xml = "<interface.wsdl xmlns='http://www.osoa.org/xmlns/sca/0.9'></interface.wsdl>"; - XMLStreamReader reader = getReader(xml); - WSDLServiceContract sc = (WSDLServiceContract) registry.load(reader, loaderContext); - reader.require(XMLStreamConstants.END_ELEMENT, INTERFACE_WSDL.getNamespaceURI(), INTERFACE_WSDL.getLocalPart()); - assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); - assertNotNull(sc); - } - - public void testInterface() throws Exception { - wsdlRegistry.loadDefinition("http://www.example.org", getClass().getResource("example.wsdl"), resourceLoader); - String xml = "<interface.wsdl xmlns='http://www.osoa.org/xmlns/sca/0.9' interface='http://www.example.org#HelloWorld'></interface.wsdl>"; - XMLStreamReader reader = getReader(xml); - WSDLServiceContract sc = (WSDLServiceContract) registry.load(reader, loaderContext); - reader.require(XMLStreamConstants.END_ELEMENT, INTERFACE_WSDL.getNamespaceURI(), INTERFACE_WSDL.getLocalPart()); - assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); - assertNotNull(sc); - } - - public void testInterfaceWithLocation() throws Exception { - wsdlRegistry.loadDefinition("http://www.example.org", getClass().getResource("example.wsdl"), resourceLoader); - String xml = "<interface.wsdl xmlns='http://www.osoa.org/xmlns/sca/0.9' xmlns:wsdli='http://www.w3.org/2006/01/wsdl-instance' " + - "wsdli:wsdlLocation='http://www.example.org " + getClass().getResource("example.wsdl") + "' "+ - "interface='http://www.example.org#HelloWorld'"+ - "></interface.wsdl>"; - XMLStreamReader reader = getReader(xml); - WSDLServiceContract sc = (WSDLServiceContract) registry.load(reader, loaderContext); - reader.require(XMLStreamConstants.END_ELEMENT, INTERFACE_WSDL.getNamespaceURI(), INTERFACE_WSDL.getLocalPart()); - assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); - assertNotNull(sc); - } - - protected void setUp() throws Exception { - super.setUp(); - wsdlRegistry = new WSDLDefinitionRegistryImpl(); - wsdlRegistry.setMonitor(NULL_MONITOR); - resourceLoader = new ResourceLoaderImpl(getClass().getClassLoader()); - wsdlRegistry.loadDefinition("http://www.example.org", getClass().getResource("example.wsdl"), resourceLoader); - InterfaceWSDLLoader loader = new InterfaceWSDLLoader(); - loader.setWsdlRegistry(wsdlRegistry); - registerLoader(loader); - } - - private static final WSDLDefinitionRegistryImpl.Monitor NULL_MONITOR = new WSDLDefinitionRegistryImpl.Monitor() { - public void readingWSDL(String namespace, URL location) { - } - - public void cachingDefinition(String namespace, URL location) { - } - }; -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/LoaderTestSupport.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/LoaderTestSupport.java deleted file mode 100644 index 4e2aea5e83..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/LoaderTestSupport.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import java.io.StringReader; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.namespace.QName; - -import junit.framework.TestCase; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; - -/** - * Base class for loader tests with common fixture elements. - * - * @version $Rev$ $Date$ - */ -public abstract class LoaderTestSupport extends TestCase { - protected SystemAssemblyFactory assemblyFactory; - protected ResourceLoader resourceLoader; - protected LoaderContext loaderContext; - protected AssemblyContext modelContext; - protected XMLInputFactory xmlFactory; - protected StAXLoaderRegistryImpl registry; - - protected static final StAXLoaderRegistryImpl.Monitor NULL_MONITOR = new StAXLoaderRegistryImpl.Monitor() { - public void registeringLoader(QName xmlType) { - } - - public void unregisteringLoader(QName xmlType) { - } - - public void elementLoad(QName xmlType) { - } - }; - - protected void setUp() throws Exception { - super.setUp(); - assemblyFactory = new SystemAssemblyFactoryImpl(); - resourceLoader = new ResourceLoaderImpl(getClass().getClassLoader()); - loaderContext = new LoaderContext(resourceLoader); - modelContext = new AssemblyContextImpl(assemblyFactory, null, resourceLoader); - xmlFactory = XMLInputFactory.newInstance(); - registry = new StAXLoaderRegistryImpl(); - registry.setMonitor(NULL_MONITOR); - } - - protected XMLStreamReader getReader(String xml) throws XMLStreamException { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml)); - reader.next(); - return reader; - } - - protected void registerLoader(AbstractLoader<?> loader) { - loader.setFactory(assemblyFactory); - loader.setRegistry(registry); - loader.start(); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/MockService.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/MockService.java deleted file mode 100644 index c1ea3dbc1e..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/MockService.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -/** - * @version $Rev$ $Date$ - */ -public interface MockService { -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WSDLDefinitionRegistryTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WSDLDefinitionRegistryTestCase.java deleted file mode 100644 index 5543a41f91..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WSDLDefinitionRegistryTestCase.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation or its licensors as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import java.net.URL; -import java.io.IOException; - -import javax.wsdl.Definition; -import javax.wsdl.WSDLException; -import javax.xml.namespace.QName; - -import junit.framework.TestCase; -import org.apache.tuscany.core.loader.impl.WSDLDefinitionRegistryImpl; -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; - -/** - * @version $Rev$ $Date$ - */ -public class WSDLDefinitionRegistryTestCase extends TestCase { - private static final String NS = "http://www.example.org"; - private WSDLDefinitionRegistryImpl wsdlRegistry; - private ResourceLoader rl; - - - public void testLoadFromAbsoluteWSDLLocation() { - try { - Definition def = wsdlRegistry.loadDefinition(NS + ' ' + rl.getResource("org/apache/tuscany/core/loader/assembly/example.wsdl"), rl); - assertNotNull(def.getPortType(new QName(NS, "HelloWorld"))); - } catch (IOException e) { - fail(e.getMessage()); - } catch (WSDLException e) { - fail(e.getMessage()); - } - } - - public void testLoadFromRelativeWSDLLocation() { - try { - Definition def = wsdlRegistry.loadDefinition(NS + " org/apache/tuscany/core/loader/assembly/example.wsdl", rl); - assertNotNull(def.getPortType(new QName(NS, "HelloWorld"))); - } catch (IOException e) { - fail(e.getMessage()); - } catch (WSDLException e) { - fail(e.getMessage()); - } - } - - protected void setUp() throws Exception { - super.setUp(); - wsdlRegistry = new WSDLDefinitionRegistryImpl(); - wsdlRegistry.setMonitor(NULL_MONITOR); - rl = new ResourceLoaderImpl(getClass().getClassLoader()); - } - - private static final WSDLDefinitionRegistryImpl.Monitor NULL_MONITOR = new WSDLDefinitionRegistryImpl.Monitor() { - public void readingWSDL(String namespace, URL location) { - } - - public void cachingDefinition(String namespace, URL location) { - } - }; -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WireLoaderTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WireLoaderTestCase.java deleted file mode 100644 index 3a0331150d..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WireLoaderTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.loader.assembly; - -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.Wire; - -/** - * @version $Rev$ $Date$ - */ -public class WireLoaderTestCase extends LoaderTestSupport { - - public void testMinimal() throws XMLStreamException, ConfigurationLoadException { - String xml = "<wire xmlns='http://www.osoa.org/xmlns/sca/0.9'><source.uri>foo/fooService</source.uri><target.uri>bar</target.uri></wire>"; - XMLStreamReader reader = getReader(xml); - Wire wire = (Wire) registry.load(reader, loaderContext); - reader.require(XMLStreamConstants.END_ELEMENT, AssemblyConstants.WIRE.getNamespaceURI(), AssemblyConstants.WIRE.getLocalPart()); - assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); - assertNotNull(wire); - assertEquals("foo", wire.getSource().getPartName()); - assertEquals("fooService", wire.getSource().getServiceName()); - assertEquals("bar", wire.getTarget().getPartName()); - } - - public void testCompound() throws XMLStreamException, ConfigurationLoadException { - String xml = "<wire xmlns='http://www.osoa.org/xmlns/sca/0.9'><source.uri>foo/fooService</source.uri><target.uri>bar/bazService</target.uri></wire>"; - XMLStreamReader reader = getReader(xml); - Wire wire = (Wire) registry.load(reader, loaderContext); - reader.require(XMLStreamConstants.END_ELEMENT, AssemblyConstants.WIRE.getNamespaceURI(), AssemblyConstants.WIRE.getLocalPart()); - assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); - assertNotNull(wire); - assertEquals("foo", wire.getSource().getPartName()); - assertEquals("fooService", wire.getSource().getServiceName()); - assertEquals("bar", wire.getTarget().getPartName()); - assertEquals("bazService", wire.getTarget().getServiceName()); - } - - protected void setUp() throws Exception { - super.setUp(); - registerLoader(new WireLoader()); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockConfigContext.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockConfigContext.java deleted file mode 100644 index 820e4d36d8..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockConfigContext.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.mock; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.impl.AssemblyVisitorImpl; -import org.apache.tuscany.core.context.ConfigurationContext; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.model.assembly.AssemblyObject; - -import java.util.ArrayList; -import java.util.List; - -/** - * A mock configuration context - * - * @version $Rev$ $Date$ - */ -public class MockConfigContext implements ConfigurationContext { - - private List<ContextFactoryBuilder> builders = new ArrayList<ContextFactoryBuilder>(); - - public MockConfigContext(List<ContextFactoryBuilder> builders) { - this.builders = builders; - } - - public void build(AssemblyObject model) throws BuilderConfigException { - AssemblyVisitorImpl visitor = new AssemblyVisitorImpl(builders); - visitor.start(model); - } - - public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) throws BuilderConfigException { - } - - public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) throws BuilderConfigException { - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockFactory.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockFactory.java deleted file mode 100644 index 87e92d783c..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockFactory.java +++ /dev/null @@ -1,413 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.mock; - -import java.util.ArrayList; -import java.util.List; -import java.lang.reflect.Method; - -import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.client.BootstrapHelper; -import org.apache.tuscany.core.config.ComponentTypeIntrospector; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector; -import org.apache.tuscany.core.config.processor.ProcessorUtils; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.extension.config.ImplementationProcessor; -import org.apache.tuscany.core.extension.config.extensibility.DestroyInvokerExtensibilityElement; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; -import org.apache.tuscany.core.mock.component.Source; -import org.apache.tuscany.core.mock.component.SourceImpl; -import org.apache.tuscany.core.mock.component.Target; -import org.apache.tuscany.core.mock.component.TargetImpl; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.runtime.RuntimeContextImpl; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.SystemBinding; -import org.apache.tuscany.core.system.assembly.SystemModule; -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.context.SystemCompositeContextImpl; -import org.apache.tuscany.core.injection.MethodEventInvoker; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Part; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * Generates test components, modules, and runtime artifacts - * - * @version $Rev$ $Date$ - */ -public class MockFactory { - - private static SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); - private static AssemblyContext assemblyContext = new AssemblyContextImpl(systemFactory, null, null); - private static ComponentTypeIntrospector introspector; - private static ComponentType systemComponentType; - private static ComponentType compositeComponentType; - - private MockFactory() { - } - - public static ComponentType getComponentType() throws ConfigurationLoadException { - if (systemComponentType == null) { - systemComponentType = getIntrospector().introspect(SystemCompositeContextImpl.class); - } - return systemComponentType; - } - - public static ComponentType getCompositeComponentType() throws ConfigurationLoadException { - if (compositeComponentType == null) { - compositeComponentType = getIntrospector().introspect(CompositeContextImpl.class); - } - return compositeComponentType; - } - - public static ComponentTypeIntrospector getIntrospector() { - if (introspector == null) { - introspector = ProcessorUtils.createCoreIntrospector(systemFactory); - } - return introspector; - } - - /** - * Creates an composite component with the given name - */ - public static ModuleComponent createCompositeComponent(String name) throws ConfigurationLoadException { - ModuleComponent sc = systemFactory.createModuleComponent(); - Module impl = systemFactory.createModule(); - impl.setName(name); - //impl.setImplementationClass(CompositeContextImpl.class); - sc.setImplementation(impl); - impl.setImplementationClass(CompositeContextImpl.class); - impl.setComponentType(getCompositeComponentType()); - Service s = systemFactory.createService(); - JavaServiceContract ji = systemFactory.createJavaServiceContract(); - s.setServiceContract(ji); - ji.setScope(Scope.AGGREGATE); -// impl.setComponentType(systemFactory.createComponentType()); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setImplementation(impl); - return sc; - } - - /** - * Creates an composite component with the given name - */ - public static ModuleComponent createSystemCompositeComponent(String name) throws ConfigurationLoadException { - ModuleComponent sc = systemFactory.createModuleComponent(); - SystemModule impl = systemFactory.createSystemModule(); - impl.setName(name); - impl.setImplementationClass(SystemCompositeContextImpl.class); - impl.setComponentType(getComponentType()); - sc.setImplementation(impl); - Service s = systemFactory.createService(); - JavaServiceContract ji = systemFactory.createJavaServiceContract(); - s.setServiceContract(ji); - ji.setScope(Scope.AGGREGATE); - //impl.setComponentType(systemFactory.createComponentType()); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setImplementation(impl); - return sc; - } - - /** - * Creates a basic entry point with no configured reference using the system binding - * - * @param name the name of the entry point - * @param interfaz the inteface exposed by the entry point - * @param refName the name of the entry point reference - */ - public static EntryPoint createEPSystemBinding(String name, Class interfaz, String refName) { - return createEPSystemBinding(name, interfaz, refName, null); - } - - /** - * Creates an entry point wired to the given target (e.g. component, external service) using the system - * binding - * - * @param name the name of the entry point - * @param interfaz the inteface exposed by the entry point - * @param refName the name of the entry point reference - * @param target the target the entry point is wired to - */ - public static EntryPoint createEPSystemBinding(String name, Class interfaz, String refName, Part target) { - JavaServiceContract contract = systemFactory.createJavaServiceContract(); - contract.setInterface(interfaz); - - EntryPoint ep = systemFactory.createEntryPoint(); - ep.setName(name); - - Reference ref = systemFactory.createReference(); - ref.setName(refName); - ref.setServiceContract(contract); - ConfiguredReference configuredReference = systemFactory.createConfiguredReference(); - configuredReference.setPort(ref); - Service service = systemFactory.createService(); - service.setServiceContract(contract); - - ConfiguredService cService = systemFactory.createConfiguredService(); - cService.setPort(service); - cService.initialize(assemblyContext); - - configuredReference.getTargetConfiguredServices().add(cService); - ep.setConfiguredReference(configuredReference); - - Service epService = systemFactory.createService(); - epService.setServiceContract(contract); - - ConfiguredService epCService = systemFactory.createConfiguredService(); - epCService.initialize(assemblyContext); - epCService.setPort(epService); - - ep.setConfiguredService(epCService); - SystemBinding binding = systemFactory.createSystemBinding(); - ep.getBindings().add(binding); - if (target != null) { - if (target instanceof Component) { - ((Component) target).getConfiguredServices().add(cService); - // cService. - } else if (target instanceof ExternalService) { - ((ExternalService) target).setConfiguredService(cService); - } - target.initialize(assemblyContext); - } - ep.initialize(null); - return ep; - } - - /** - * Creates an entry point that should be wired to the given target (e.g. component, external service) - * using the system binding. The system assembly process should resolve the target name to an actual - * target configuration. - * - * @param name the name of the entry point - * @param interfaz the inteface exposed by the entry point - * @param refName the name of the entry point reference - * @param componentName the name of the target to resolve - */ - public static EntryPoint createEntryPointWithStringRef(String name, Class interfaz, String refName, String componentName) { - EntryPoint ep = createEPSystemBinding(name, interfaz, refName, null); - ConfiguredReference cRef = systemFactory.createConfiguredReference(); - Reference ref = systemFactory.createReference(); - cRef.setPort(ref); - Service service = systemFactory.createService(); - service.setName(componentName); - ConfiguredService cService = systemFactory.createConfiguredService(); - cService.setPort(service); - cRef.getTargetConfiguredServices().add(cService); - cRef.initialize(assemblyContext); - cService.initialize(assemblyContext); - JavaServiceContract contract = systemFactory.createJavaServiceContract(); - contract.setInterface(interfaz); - ref.setServiceContract(contract); - ep.setConfiguredReference(cRef); - ep.initialize(assemblyContext); - return ep; - } - - /** - * Creates an external service configured with a {@link SystemBinding} - */ - public static ExternalService createESSystemBinding(String name, String refName) { - ExternalService es = systemFactory.createExternalService(); - es.setName(name); - ConfiguredService configuredService = systemFactory.createConfiguredService(); - es.setConfiguredService(configuredService); - SystemBinding binding = systemFactory.createSystemBinding(); - binding.setTargetName(refName); - es.getBindings().add(binding); - es.initialize(null); - return es; - } - - /** - * Creates an external service that specifies an autowire of the given type - */ - public static ExternalService createAutowirableExternalService(String name, Class type) { - ExternalService es = systemFactory.createExternalService(); - es.setName(name); - JavaServiceContract inter = systemFactory.createJavaServiceContract(); - inter.setInterface(type); - Service service = systemFactory.createService(); - service.setServiceContract(inter); - ConfiguredService cService = systemFactory.createConfiguredService(); - cService.setPort(service); - cService.initialize(assemblyContext); - es.setConfiguredService(cService); - es.getBindings().add(systemFactory.createSystemBinding()); - es.initialize(null); - return es; - } - - /** - * Creates a test system module with a module-scoped component and entry point - */ - public static Module createSystemModule() throws ConfigurationLoadException { - Module module = systemFactory.createSystemModule(); - module.setName("system.module"); - - // create test component - Component component = systemFactory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, - ModuleScopeSystemComponentImpl.class, Scope.MODULE); - component.getImplementation().setComponentType(getIntrospector().introspect(ModuleScopeSystemComponent.class)); - module.getComponents().add(component); - - // create the entry point - EntryPoint ep = createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "target", component); - module.getEntryPoints().add(ep); - - module.initialize(assemblyContext); - module.setImplementationClass(SystemCompositeContextImpl.class); - module.setComponentType(getComponentType()); - return module; - } - - public static <T> Component createSystemComponent(String name, Class<T> service, Class<? extends T> impl, Scope scope) throws ConfigurationLoadException { - Component c = systemFactory.createSystemComponent(name, service, impl, scope); - c.getImplementation().setComponentType(getIntrospector().introspect(impl)); - for (Service s : c.getImplementation().getComponentType().getServices()) { - s.getServiceContract().setScope(scope); //hack - } - - return c; - } - - /** - * Creates a test system module with source and target components wired together. - * - * @see org.apache.tuscany.core.mock.component.Source - * @see org.apache.tuscany.core.mock.component.Target - */ - public static Module createSystemModuleWithWiredComponents(String moduleName, Scope sourceScope, Scope targetScope) throws ConfigurationLoadException { - - // create the target component - Component target = systemFactory.createSystemComponent("target", Target.class, TargetImpl.class, targetScope); - target.initialize(assemblyContext); - - // create the source componentType - Component source = systemFactory.createSystemComponent("source", Source.class, SourceImpl.class, sourceScope); - ComponentType sourceComponentType = source.getImplementation().getComponentType(); - List<Reference> references = sourceComponentType.getReferences(); - List<ConfiguredReference> configuredReferences = source.getConfiguredReferences(); - - // wire source to target - references.add(systemFactory.createReference("setTarget", Target.class)); - ConfiguredReference configuredReference = systemFactory.createConfiguredReference("setTarget", "target"); - configuredReferences.add(configuredReference); - - // wire multiplicity using a setter - references.add(systemFactory.createReference("setTargets", Target.class, Multiplicity.ONE_N)); - configuredReference = systemFactory.createConfiguredReference("setTargets", "target"); - configuredReferences.add(configuredReference); - - // wire multiplicity using a field - references.add(systemFactory.createReference("targetsThroughField", Target.class, Multiplicity.ONE_N)); - configuredReference = systemFactory.createConfiguredReference("targetsThroughField", "target"); - configuredReferences.add(configuredReference); - - // wire multiplicity using a setter - references.add(systemFactory.createReference("setArrayOfTargets", Target.class, Multiplicity.ONE_N)); - configuredReference = systemFactory.createConfiguredReference("setArrayOfTargets", "target"); - configuredReferences.add(configuredReference); - - source.initialize(assemblyContext); - - Module module = systemFactory.createSystemModule(); - module.setImplementationClass(SystemCompositeContextImpl.class); - module.setComponentType(getComponentType()); - module.setName(moduleName); - module.getComponents().add(source); - module.getComponents().add(target); - module.initialize(assemblyContext); - return module; - } - - /** - * Creates a test system module component with source and target components wired together. - * - * @see org.apache.tuscany.core.mock.component.Source - * @see org.apache.tuscany.core.mock.component.Target - */ - public static ModuleComponent createSystemModuleComponentWithWiredComponents(String moduleComponentName, Scope sourceScope, - Scope targetScope) throws ConfigurationLoadException { - ModuleComponent mc = systemFactory.createModuleComponent(); - mc.setName(moduleComponentName); - mc.setImplementation(createSystemModuleWithWiredComponents(moduleComponentName + ".module", sourceScope, targetScope)); - return mc; - } - - /** - * Creates a test system module component with a module-scoped component and entry point - */ - public static Module createSystemChildModule() throws ConfigurationLoadException { - Module module = systemFactory.createSystemModule(); - module.setName("system.test.module"); - module.setImplementationClass(SystemCompositeContextImpl.class); - module.setComponentType(getComponentType()); - - // create test component - Component component = systemFactory.createSystemComponent("TestService2", ModuleScopeSystemComponent.class, - ModuleScopeSystemComponentImpl.class, Scope.MODULE); - module.getComponents().add(component); - - // create the entry point - EntryPoint ep = createEPSystemBinding("TestService2EP", ModuleScopeSystemComponent.class, "target", component); - module.getEntryPoints().add(ep); - - module.initialize(assemblyContext); - return module; - } - - /** - * Returns a collection of bootstrap configuration builders - */ - public static List<ContextFactoryBuilder> createSystemBuilders() { - List<ContextFactoryBuilder> builders = new ArrayList<ContextFactoryBuilder>(); - builders.add((new SystemContextFactoryBuilder(null))); - builders.add(new SystemEntryPointBuilder()); - builders.add(new SystemExternalServiceBuilder()); - return builders; - } - - /** - * Creates a default {@link RuntimeContext} configured with support for Java component implementations - */ - public static RuntimeContext createCoreRuntime() { - NullMonitorFactory monitorFactory = new NullMonitorFactory(); - RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory), null); - runtime.start(); - return runtime; - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/AutowireSourceImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/AutowireSourceImpl.java deleted file mode 100644 index fb1cb86873..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/AutowireSourceImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.apache.tuscany.core.system.annotation.Autowire; - -import java.util.List; - -/** - * Mock system component implementation used in autowire tests - * - * @version $Rev$ $Date$ - */ -public class AutowireSourceImpl implements Source { - - @Autowire - protected Target target; - - private List<Target> targets; - - private List<Target> targetsThroughField; - - public void setTarget(Target target) { - this.target = target; - } - - public Target getTarget() { - return target; - } - - public List<Target> getTargets() { - return targets; - } - - public void setTargets(List<Target> targets) { - this.targets = targets; - } - - public List<Target> getTargetsThroughField() { - return targetsThroughField; - } - - private Target[] targetsArray; - - public Target[] getArrayOfTargets() { - return targetsArray; - } - - public void setArrayOfTargets(Target[] targets) { - targetsArray = targets; - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/GenericSystemComponent.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/GenericSystemComponent.java deleted file mode 100644 index 1fd02de992..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/GenericSystemComponent.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.mock.component; - -public interface GenericSystemComponent { - -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponent.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponent.java deleted file mode 100644 index dabbd9e4ef..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.mock.component; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public interface ModuleScopeSystemComponent extends GenericSystemComponent { - -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponentImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponentImpl.java deleted file mode 100644 index 58afde9354..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponentImpl.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.mock.component; - -/** - * @version $Rev$ $Date$ - */ -public class ModuleScopeSystemComponentImpl implements ModuleScopeSystemComponent { - - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Source.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Source.java deleted file mode 100644 index 6ce1059db1..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Source.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.mock.component; - -import java.util.List; - -/** - * Implementations are used in wiring tests - * - * @version $Rev$ $Date$ - */ -public interface Source { - - public Target getTarget(); - - public List<Target> getTargets(); - - public List<Target> getTargetsThroughField(); - - public Target[] getArrayOfTargets(); - -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java deleted file mode 100644 index 075e70699e..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.mock.component; - -import java.util.List; - -import org.osoa.sca.annotations.Destroy; - -/** - * Mock system component implementation used in wiring tests - * - * @version $Rev$ $Date$ - */ -public class SourceImpl implements Source { - - private Target target; - - private List<Target> targets; - - private List<Target> targetsThroughField; - - @Destroy - public void foo(){ - } - - public void setTarget(Target target) { - this.target = target; - } - - public Target getTarget() { - return target; - } - - public List<Target> getTargets() { - return targets; - } - - public void setTargets(List<Target> targets) { - this.targets = targets; - } - - public List<Target> getTargetsThroughField() { - return targetsThroughField; - } - - private Target[] targetsArray; - - public Target[] getArrayOfTargets() { - return targetsArray; - } - - public void setArrayOfTargets(Target[] targets) { - targetsArray = targets; - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Target.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Target.java deleted file mode 100644 index fb3642a495..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Target.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.mock.component; - -/** - * Implementations are used in wiring tests - * - * @version $Rev$ $Date$ - */ -public interface Target { - - public String getString(); - - public void setString(String val); -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java deleted file mode 100644 index 323bee0713..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.mock.component; - -/** - * Mock system component implementation used in wiring tests - * - * @version $Rev$ $Date$ - */ -public class TargetImpl implements Target { - - private String theString; - - public String getString() { - return theString; - } - - public void setString(String val) { - theString = val; - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeBootTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeBootTestCase.java deleted file mode 100644 index c4e1ea9962..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeBootTestCase.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.runtime; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.client.BootstrapHelper; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Lifecycle; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.mock.MockFactory; - -/** - * Tests runtime boot scenarios - * - * @version $Rev$ $Date$ - */ -public class RuntimeBootTestCase extends TestCase { - private RuntimeContext runtime; - private NullMonitorFactory monitorFactory; - private ContextFactoryBuilderRegistry builderRegistry; - private DefaultWireBuilder wireBuilder; - - public void testContextParents() { - CompositeContext rootContext = runtime.getRootContext(); - assertNotNull(rootContext); - assertEquals("tuscany.root", rootContext.getName()); - assertSame(runtime, rootContext.getParent()); - assertSame(rootContext, runtime.getContext("tuscany.root")); - - CompositeContext systemContext = runtime.getSystemContext(); - assertNotNull(systemContext); - assertEquals("tuscany.system", systemContext.getName()); - assertSame(runtime, systemContext.getParent()); - assertSame(systemContext, runtime.getContext("tuscany.system")); - } - - public void testRuntimeLifecycle() { - assertEquals(Lifecycle.RUNNING, runtime.getLifecycleState()); - runtime.stop(); - - assertEquals(Lifecycle.STOPPED, runtime.getLifecycleState()); - } - - public void testIncrementalBoot() throws Exception{ - - // start the runtime context - RuntimeContext runtimeContext = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder); - runtimeContext.start(); - - CompositeContext system = runtimeContext.getSystemContext(); - Assert.assertNotNull(system); - // register system components - system.registerModelObject(MockFactory.createSystemModule()); - // start the module scope - system.publish(new ModuleStart(this)); - // register the first module - - // register the second module - - // start the modules - - system.publish(new ModuleStop(this)); - runtimeContext.stop(); - Assert.assertEquals(Lifecycle.STOPPED,system.getLifecycleState()); - } - - protected void setUp() throws Exception { - super.setUp(); - - monitorFactory = new NullMonitorFactory(); - builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); - wireBuilder = new DefaultWireBuilder(); - runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder); - runtime.start(); - } - - protected void tearDown() throws Exception { - runtime.stop(); - super.tearDown(); - } -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeContextImplTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeContextImplTestCase.java deleted file mode 100644 index d9596239fa..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeContextImplTestCase.java +++ /dev/null @@ -1,286 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.runtime; - -import junit.framework.Assert; -import junit.framework.TestCase; -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.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.client.BootstrapHelper; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Lifecycle; -import org.apache.tuscany.core.context.ServiceNotFoundException; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.core.system.context.TestBuilder; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * Performs basic tests on the runtime context - * - * @version $Rev$ $Date$ - */ -public class RuntimeContextImplTestCase extends TestCase { - - private SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); - - private ContextFactoryBuilderRegistry builderRegistry; - - private SystemAssemblyFactory factory; - private MonitorFactory monitorFactory; - private RuntimeContext runtime; - - /** - * Tests explicit wiring of an external service to a system entry point that is wired to a child system - * module entry point - */ - public void testSystemExplicitWiring() throws Exception { - CompositeContext root = runtime.getRootContext(); - Assert.assertNotNull(root); - Assert.assertTrue(root.getLifecycleState() == Lifecycle.RUNNING); - - CompositeContext system = runtime.getSystemContext(); - Assert.assertNotNull(system); - system.registerModelObject(MockFactory.createSystemModule()); - - // register a child system context - system.registerModelObject(MockFactory.createSystemCompositeComponent("system.child")); - CompositeContext systemChild = (CompositeContext) system.getContext("system.child"); - systemChild.registerModelObject(MockFactory.createSystemChildModule()); - - // register a top-level system entry point that exposes the child entry point - EntryPoint ep = MockFactory.createEPSystemBinding("TestService2EP", ModuleScopeSystemComponent.class, "ref"); - ep.getBindings().add(systemFactory.createSystemBinding()); - Service service = systemFactory.createService(); - service.setName("system.child/TestService2EP"); - ep.getConfiguredReference().getTargetConfiguredServices().get(0).setPort(service); - JavaServiceContract inter = systemFactory.createJavaServiceContract(); - inter.setInterface(ModuleScopeSystemComponentImpl.class); - service.setServiceContract(inter); - system.registerModelObject(ep); - system.publish(new ModuleStart(this)); - Assert.assertNotNull(system.getContext("TestService1").getInstance(null)); - Assert.assertNotNull(system.getContext("TestService2EP").getInstance(null)); - - // create a test module and wire an external service to the system entry point - Component moduleComponent = MockFactory.createCompositeComponent("test.module"); - runtime.registerModelObject(moduleComponent); - CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("test.module"); - Assert.assertNotNull(moduleContext); - ExternalService es = MockFactory.createESSystemBinding("TestService2ES", "tuscany.system/TestService2EP"); - moduleContext.registerModelObject(es); - moduleContext.publish(new ModuleStart(this)); - Assert.assertNotNull(moduleContext.getContext("TestService2ES").getInstance(null)); - - moduleContext.publish(new ModuleStop(this)); - system.publish(new ModuleStop(this)); - } - - /** - * Tests autowiring an external service to a system entry point - */ - public void testSystemAutoWiring() throws Exception { - CompositeContext root = runtime.getRootContext(); - Assert.assertNotNull(root); - Assert.assertTrue(root.getLifecycleState() == Lifecycle.RUNNING); - - CompositeContext system = runtime.getSystemContext(); - Assert.assertNotNull(system); - system.registerModelObject(MockFactory.createSystemModule()); - - // create a test module and wire an external service to the system entry point - Component moduleComponent = MockFactory.createCompositeComponent("test.module"); - runtime.registerModelObject(moduleComponent); - CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("test.module"); - Assert.assertNotNull(moduleContext); - ExternalService es = MockFactory.createAutowirableExternalService("TestService2ES", ModuleScopeSystemComponent.class); - moduleContext.registerModelObject(es); - - system.publish(new ModuleStart(this)); - moduleContext.publish(new ModuleStart(this)); - // test that the autowire was resolved - Assert.assertNotNull(moduleContext.getContext("TestService2ES").getInstance(null)); - - moduleContext.publish(new ModuleStop(this)); - system.publish(new ModuleStop(this)); - } - - public void testServiceNotFound() throws Exception { - // create a test module - Component moduleComponent = MockFactory.createCompositeComponent("module"); - runtime.registerModelObject(moduleComponent); - CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("module"); - moduleContext.publish(new ModuleStart(this)); - try { - moduleContext.locateService("TestService"); - fail("Expected " + ServiceNotFoundException.class.getName()); - } catch (ServiceNotFoundException e) { - // expected - } - moduleContext.publish(new ModuleStop(this)); - } - - public void testExternalServiceReferenceNotFound() throws Exception { - CompositeContext system = runtime.getSystemContext(); - - // create a test module - Component moduleComponent = MockFactory.createCompositeComponent("module"); - runtime.registerModelObject(moduleComponent); - CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("module"); - ExternalService es = MockFactory.createESSystemBinding("TestServiceES", "tuscany.system/TestService1xEP"); - moduleContext.registerModelObject(es); - - // start the modules and test inter-module system wires - system.publish(new ModuleStart(this)); - moduleContext.publish(new ModuleStart(this)); - try { - moduleContext.locateService("TestServiceES"); - fail("Expected " + ServiceNotFoundException.class.getName()); - } catch (ServiceNotFoundException e) { - // expected - } - moduleContext.publish(new ModuleStop(this)); - system.publish(new ModuleStop(this)); - } - - public void testEntryPointReferenceNotFound() throws Exception { - // create a test module - Component moduleComponent = MockFactory.createCompositeComponent("module"); - runtime.registerModelObject(moduleComponent); - - Component component = factory.createSystemComponent("NoService", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - // do not register the above component! - - CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("module"); - EntryPoint epSystemBinding = MockFactory.createEPSystemBinding("TestServiceEP", ModuleScopeSystemComponent.class, "NoReference", component); - moduleContext.registerModelObject(epSystemBinding); - - moduleContext.publish(new ModuleStart(this)); - try { - moduleContext.locateService("TestServiceEP"); - fail("Expected " + ServiceNotFoundException.class.getName()); - } catch (ServiceNotFoundException e) { - // expected - } - moduleContext.publish(new ModuleStop(this)); - } - - /** - * Test two module components that have external services wired to entry points contained in each - */ - public void testCircularWires() throws Exception { - // create a test modules - Component module1 = MockFactory.createCompositeComponent("module1"); - runtime.registerModelObject(module1); - Component module2 = MockFactory.createCompositeComponent("module2"); - runtime.registerModelObject(module2); - - CompositeContextImpl moduleContext1 = (CompositeContextImpl) runtime.getContext("module1"); - CompositeContextImpl moduleContext2 = (CompositeContextImpl) runtime.getContext("module2"); - - Component component1 = factory.createSystemComponent("Component1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - EntryPoint entryPoint1 = MockFactory.createEPSystemBinding("EntryPoint1", ModuleScopeSystemComponent.class, "Component1", component1); - ExternalService externalService1 = MockFactory.createESSystemBinding("ExternalService1", "module2/EntryPoint2"); - moduleContext1.registerModelObject(component1); - moduleContext1.registerModelObject(entryPoint1); - moduleContext1.registerModelObject(externalService1); - - Component component2 = factory.createSystemComponent("Component2", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - EntryPoint entryPoint2 = MockFactory.createEPSystemBinding("EntryPoint2", ModuleScopeSystemComponent.class, "Component2", component2); - ExternalService externalService2 = MockFactory.createESSystemBinding("ExternalService2", "module1/EntryPoint1"); - moduleContext2.registerModelObject(component2); - moduleContext2.registerModelObject(entryPoint2); - moduleContext2.registerModelObject(externalService2); - - moduleContext1.publish(new ModuleStart(this)); - moduleContext2.publish(new ModuleStart(this)); - Assert.assertNotNull(moduleContext2.getContext("ExternalService2").getInstance(null)); - Assert.assertNotNull(moduleContext1.getContext("ExternalService1").getInstance(null)); - } - - /** - * Tests that a circular reference between an external service in one module and an entry point in another - * is caught as an error condition FIXME this must be implemented - */ - public void testInterModuleCircularReference() throws Exception { - // create a test modules - Component module1 = MockFactory.createCompositeComponent("module1"); - runtime.registerModelObject(module1); - Component module2 = MockFactory.createCompositeComponent("module2"); - runtime.registerModelObject(module2); - - CompositeContextImpl moduleContext1 = (CompositeContextImpl) runtime.getContext("module1"); - CompositeContextImpl moduleContext2 = (CompositeContextImpl) runtime.getContext("module2"); - ExternalService externalService1 = MockFactory.createESSystemBinding("ExternalService1", "module2/EntryPoint2"); - EntryPoint entryPoint1 = MockFactory.createEPSystemBinding("EntryPoint1", ModuleScopeSystemComponent.class, - "ExternalService1", externalService1); - ExternalService externalService2 = MockFactory.createESSystemBinding("ExternalService2", "module1/EntryPoint1"); - EntryPoint entryPoint2 = MockFactory.createEPSystemBinding("EntryPoint2", ModuleScopeSystemComponent.class, - "ExternalService2", externalService2); - try { - // FIXME this should throw a circular reference exception - moduleContext1.registerModelObject(externalService1); - moduleContext1.registerModelObject(entryPoint1); - moduleContext2.registerModelObject(externalService2); - moduleContext2.registerModelObject(entryPoint2); - // FIXME implement fail("Expected " + ConfigurationException.class.getName()); - } catch (ConfigurationException e) { - // expected - } - } - - public void testRuntimeBuilderAutowire() throws Exception { - - - CompositeContext system = runtime.getSystemContext(); - Component builder = factory.createSystemComponent("TestBuilder", ContextFactoryBuilder.class, TestBuilder.class, Scope.MODULE); - builder.getImplementation().setComponentType(MockFactory.getIntrospector().introspect(TestBuilder.class)); - system.registerModelObject(builder); - system.publish(new ModuleStart(this)); - Component module1 = MockFactory.createCompositeComponent("module1"); - runtime.registerModelObject(module1); - runtime.getContext("module1"); - Assert.assertTrue(((TestBuilder) system.getContext("TestBuilder").getInstance(null)).invoked()); - system.publish(new ModuleStop(this)); - } - - protected void setUp() throws Exception { - super.setUp(); - monitorFactory = new NullMonitorFactory(); - builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); - factory = new SystemAssemblyFactoryImpl(); - - runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, null); - runtime.start(); - } - - protected void tearDown() throws Exception { - runtime.stop(); - super.tearDown(); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/SystemBootstrapTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/SystemBootstrapTestCase.java deleted file mode 100644 index 45af495239..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/SystemBootstrapTestCase.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.runtime; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.client.BootstrapHelper; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.mock.component.GenericSystemComponent; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * Tests bootstrapping a system module - * - * @version $Rev: 385834 $ $Date: 2006-03-14 08:57:08 -0800 (Tue, 14 Mar 2006) $ - */ -public class SystemBootstrapTestCase extends TestCase { - private ContextFactoryBuilderRegistry builderRegistry; - - private SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl(); - - /** - * Simulates booting a runtime process - */ - public void testBoot() throws Exception { - RuntimeContext runtimeContext = new RuntimeContextImpl(new NullMonitorFactory(), builderRegistry,null); - runtimeContext.start(); - - CompositeContext systemContext = runtimeContext.getSystemContext(); - Assert.assertNotNull(systemContext); - Module systemModule = MockFactory.createSystemModule(); - // MockSystemAssemblyFactory.buildModule(systemModule, systemContext); - systemContext.registerModelObject(systemModule); - - // create a test module - Component moduleComponent = MockFactory.createCompositeComponent("module"); - runtimeContext.registerModelObject(moduleComponent); - CompositeContextImpl moduleContext = (CompositeContextImpl) runtimeContext.getContext("module"); - Assert.assertNotNull(moduleContext); - ExternalService es = MockFactory.createESSystemBinding("TestServiceES", "tuscany.system/TestService1EP"); - moduleContext.registerModelObject(es); - - // start the modules and test inter-module system wires - systemContext.publish(new ModuleStart(this)); - moduleContext.publish(new ModuleStart(this)); - - Assert.assertNotNull(systemContext.getContext("TestService1EP").getInstance(null)); - GenericSystemComponent testService = (GenericSystemComponent) systemContext.getContext("TestService1").getInstance(null); - Assert.assertNotNull(testService); - GenericSystemComponent testES = (GenericSystemComponent) moduleContext.getContext("TestServiceES").getInstance(null); - Assert.assertNotNull(testES); - Assert.assertSame(testService, testES); - } - - public void testRuntimeBoot() throws Exception { - RuntimeContext runtime = new RuntimeContextImpl(new NullMonitorFactory(), builderRegistry,null); - runtime.start(); - runtime.getRootContext(); - - CompositeContext system = runtime.getSystemContext(); - system.registerModelObject(MockFactory.createSystemModule()); - system.registerModelObject(MockFactory.createSystemCompositeComponent("module2")); - CompositeContext systemModule2 = (CompositeContext) system.getContext("module2"); - systemModule2.registerModelObject(MockFactory.createSystemChildModule()); - - EntryPoint ep = MockFactory.createEPSystemBinding("TestService2EP", ModuleScopeSystemComponent.class, "ref"); - ep.getBindings().add(factory.createSystemBinding()); - Service service = factory.createService(); - service.setName("module2/TestService2EP"); - JavaServiceContract inter = factory.createJavaServiceContract(); - inter.setInterface(ModuleScopeSystemComponentImpl.class); - service.setServiceContract(inter); - ep.getConfiguredReference().getTargetConfiguredServices().get(0).setPort(service); - system.registerModelObject(ep); - system.publish(new ModuleStart(this)); - Assert.assertNotNull(system.getContext("TestService1").getInstance(null)); - Assert.assertNotNull(system.getContext("TestService2EP").getInstance(null)); - - Assert.assertNotNull(((AutowireContext) system).resolveInstance(ModuleScopeSystemComponent.class)); - // create a test module - Component moduleComponent = MockFactory.createCompositeComponent("test.module"); - runtime.registerModelObject(moduleComponent); - CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("test.module"); - Assert.assertNotNull(moduleContext); - ExternalService es = MockFactory.createESSystemBinding("TestService2ES", "tuscany.system/TestService2EP"); - moduleContext.registerModelObject(es); - moduleContext.publish(new ModuleStart(this)); - Assert.assertNotNull(moduleContext.getContext("TestService2ES").getInstance(null)); - - moduleContext.publish(new ModuleStop(this)); - system.publish(new ModuleStop(this)); - runtime.stop(); - } - - protected void setUp() throws Exception { - super.setUp(); - builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(null); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/MonitorInjectionTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/MonitorInjectionTestCase.java deleted file mode 100644 index fe6bff635a..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/MonitorInjectionTestCase.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.builder; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.common.monitor.MonitorFactory; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; -import org.apache.tuscany.core.mock.MockConfigContext; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.system.annotation.Monitor; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.Scope; - -/** - * @version $Rev$ $Date$ - */ -public class MonitorInjectionTestCase extends TestCase { - private SystemContextFactoryBuilder builder; - private Component component; - - public static interface TestService { - } - - public static class TestComponent implements TestService { - @Monitor - protected Monitor1 monitor1; - Monitor2 monitor2; - - @Monitor - public void setMonitor2(Monitor2 monitor2) { - this.monitor2 = monitor2; - } - } - - public static interface Monitor1 { - } - - public static interface Monitor2 { - } - - public void testMonitorInjection() { - builder.build(component); - ContextFactory<?> contextFactory = (ContextFactory<?>) component.getContextFactory(); - Assert.assertNotNull(contextFactory); - contextFactory.prepare(createContext()); - Context ctx = contextFactory.createContext(); - - ctx.start(); - TestComponent instance = (TestComponent) ctx.getInstance(null); - assertSame(MONITOR1, instance.monitor1); - assertSame(MONITOR2, instance.monitor2); - } - - protected void setUp() throws Exception { - super.setUp(); - SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl(); - MockMonitorFactory monitorFactory = new MockMonitorFactory(); - builder = new SystemContextFactoryBuilder(monitorFactory); - component = factory.createSystemComponent("test", TestService.class, TestComponent.class, Scope.MODULE); - component.getImplementation().setComponentType(MockFactory.getIntrospector().introspect(TestComponent.class)); - } - - private static final Monitor1 MONITOR1 = new Monitor1() { - }; - private static final Monitor2 MONITOR2 = new Monitor2() { - }; - - public static class MockMonitorFactory implements MonitorFactory { - public <T> T getMonitor(Class<T> monitorInterface) { - if (Monitor1.class.equals(monitorInterface)) { - return monitorInterface.cast(MONITOR1); - } else if (Monitor2.class.equals(monitorInterface)) { - return monitorInterface.cast(MONITOR2); - } else { - throw new AssertionError(); - } - } - } - - private static CompositeContext createContext() { - return new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), new EventContextImpl(), new MockConfigContext(null)); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemComponentImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemComponentImpl.java deleted file mode 100644 index 3398a010e9..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemComponentImpl.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.builder; - -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.AutowireContext; -import org.apache.tuscany.core.context.ConfigurationContext; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.system.annotation.ParentContext; -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Scope; - -/** - * A system component used for unit testing - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class SystemComponentImpl { - - @Autowire - protected ConfigurationContext ctx; - - @ParentContext - protected CompositeContext parent; - - @Autowire - protected AutowireContext autowireCtx; - - private ConfigurationContext ctxSetter; - - private CompositeContext parentSetter; - - private AutowireContext autowireCtxSetter; - - public ConfigurationContext getConfigContext() { - return ctx; - } - - public CompositeContext getParentContext() { - return parent; - } - - public AutowireContext getAutowireContext() { - return autowireCtx; - } - - @Autowire - public void setConfigContext(ConfigurationContext configCtx) { - ctxSetter = configCtx; - } - - public ConfigurationContext getConfigContextSetter() { - return ctxSetter; - } - - @ParentContext - public void setParentContex(CompositeContext ctx) { - parentSetter = ctx; - } - - public CompositeContext getParentContextSetter() { - return parentSetter; - } - - @Autowire - public void setAutowireContext(AutowireContext ctx) { - autowireCtxSetter = ctx; - } - - public AutowireContext getAutowireContextSetter() { - return autowireCtx; - } - - private boolean inited; - - @Init - public void init(){ - inited=true; - } - - public boolean initialized(){ - return (inited); - } - - private boolean destroyed; - - @Destroy - public void destroy(){ - destroyed=true; - } - - public boolean destroyed(){ - return (destroyed); - } - - @Property - protected int testInt; - - public int getTestInt(){ - return testInt; - } - - @Property - protected double testDouble; - - public double getTestDouble(){ - return testDouble; - } - - @Property - protected float testFloat; - - public float getTestFloat(){ - return testFloat; - } - - @Property - protected short testShort; - - public short getTestShort(){ - return testShort; - } - - @Property - protected boolean testBoolean; - - public boolean getTestBoolean(){ - return testBoolean; - } - - @Property - protected byte testByte; - - public byte getTestByte(){ - return testByte; - } - - @Property - protected char testChar; - - public char getTestChar(){ - return testChar; - } - - @Property - protected String testString; - - public String getTestString(){ - return testString; - } - - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilderTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilderTestCase.java deleted file mode 100644 index f7543911a6..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilderTestCase.java +++ /dev/null @@ -1,173 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.builder; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; -import org.apache.tuscany.core.mock.MockConfigContext; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.SystemImplementation; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * Tests to system components are built properly - * - * @version $Rev$ $Date$ - */ -public class SystemContextFactoryBuilderTestCase extends TestCase { - - private SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl(); - - public void testComponentContextBuilder() throws Exception { - SystemContextFactoryBuilder builder = new SystemContextFactoryBuilder(null); - Component component = factory.createSystemComponent("test", null, SystemComponentImpl.class, Scope.AGGREGATE); - component.getImplementation().setComponentType(MockFactory.getIntrospector().introspect(SystemComponentImpl.class)); - ConfiguredProperty cProp = factory.createConfiguredProperty(); - Property prop = factory.createProperty(); - prop.setName("testInt"); - cProp.setValue(1); - cProp.setProperty(prop); - component.getConfiguredProperties().add(cProp); - - cProp = factory.createConfiguredProperty(); - prop = factory.createProperty(); - prop.setName("testString"); - cProp.setValue("test"); - cProp.setProperty(prop); - component.getConfiguredProperties().add(cProp); - - cProp = factory.createConfiguredProperty(); - prop = factory.createProperty(); - prop.setName("testDouble"); - cProp.setValue(1d); - cProp.setProperty(prop); - component.getConfiguredProperties().add(cProp); - - cProp = factory.createConfiguredProperty(); - prop = factory.createProperty(); - prop.setName("testFloat"); - cProp.setValue(1f); - cProp.setProperty(prop); - component.getConfiguredProperties().add(cProp); - - cProp = factory.createConfiguredProperty(); - prop = factory.createProperty(); - prop.setName("testShort"); - cProp.setValue((short) 1); - cProp.setProperty(prop); - component.getConfiguredProperties().add(cProp); - - cProp = factory.createConfiguredProperty(); - prop = factory.createProperty(); - prop.setName("testByte"); - cProp.setValue((byte) 1); - cProp.setProperty(prop); - component.getConfiguredProperties().add(cProp); - - cProp = factory.createConfiguredProperty(); - prop = factory.createProperty(); - prop.setName("testBoolean"); - cProp.setValue(Boolean.TRUE); - cProp.setProperty(prop); - component.getConfiguredProperties().add(cProp); - - cProp = factory.createConfiguredProperty(); - prop = factory.createProperty(); - prop.setName("testChar"); - cProp.setValue('1'); - cProp.setProperty(prop); - component.getConfiguredProperties().add(cProp); - - builder.build(component); - ContextFactory<AtomicContext> contextFactory = (ContextFactory<AtomicContext>) component.getContextFactory(); - Assert.assertNotNull(contextFactory); - contextFactory.prepare(createContext()); - AtomicContext ctx = contextFactory.createContext(); - - ctx.start(); - SystemComponentImpl instance = (SystemComponentImpl) ctx.getInstance(null); - Assert.assertNotNull(instance.getConfigContext()); - Assert.assertNotNull(instance.getParentContext()); - Assert.assertNotNull(instance.getAutowireContext()); - Assert.assertNotNull(instance.getConfigContextSetter()); - Assert.assertNotNull(instance.getParentContextSetter()); - Assert.assertNotNull(instance.getAutowireContextSetter()); - Assert.assertEquals(1, instance.getTestInt()); - Assert.assertEquals(1d, instance.getTestDouble()); - Assert.assertEquals(1f, instance.getTestFloat()); - Assert.assertEquals((short) 1, instance.getTestShort()); - Assert.assertTrue(instance.getTestBoolean()); - Assert.assertEquals('1', instance.getTestChar()); - Assert.assertEquals((byte) 1, instance.getTestByte()); - Assert.assertEquals("test", instance.getTestString()); - - Assert.assertTrue(instance.initialized()); - ctx.destroy(); - ctx.stop(); - Assert.assertTrue(instance.destroyed()); - } - - - public void testDefaultScopeIsModuleScope() throws Exception { - SystemContextFactoryBuilder builder = new SystemContextFactoryBuilder(null); - Component component = createSystemComponentWithNoScope("test", null, SystemComponentImpl.class); - builder.build(component); - ContextFactory<AtomicContext> contextFactory = (ContextFactory<AtomicContext>) component.getContextFactory(); - Assert.assertEquals(Scope.MODULE, contextFactory.getScope()); - } - - - - - private static CompositeContext createContext() { - return new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), new EventContextImpl(), - new MockConfigContext(null)); - } - - private <T> Component createSystemComponentWithNoScope(String name, Class<T> service, Class<? extends T> impl) { - JavaServiceContract jsc = factory.createJavaServiceContract(); - jsc.setInterface(service); - Service s = factory.createService(); - s.setServiceContract(jsc); - - ComponentType componentType = factory.createComponentType(); - componentType.getServices().add(s); - - SystemImplementation sysImpl = factory.createSystemImplementation(); - sysImpl.setImplementationClass(impl); - sysImpl.setComponentType(componentType); - - Component sc = factory.createSimpleComponent(); - sc.setName(name); - sc.setImplementation(sysImpl); - return sc; - } - - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java deleted file mode 100644 index 3d63664848..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.builder.impl; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.impl.AssemblyVisitorImpl; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.SystemBinding; -import org.apache.tuscany.core.system.assembly.SystemImplementation; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.ConfiguredPort; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.ContextFactoryHolder; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * Tests decorating a logical configuration model - * - * @version $Rev$ $Date$ - */ -public class AssemblyVisitorTestCase extends TestCase { - - private static final Object MARKER = new Object(); - - private SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl(); - private AssemblyContext assemblyContext = new AssemblyContextImpl(factory, null, null); - - public void testModelVisit() throws Exception { - ComponentType componentType; - Service service; - SystemImplementation impl; - Component component; - - Module module = factory.createModule(); - - // create target component - componentType = factory.createComponentType(); - service = factory.createService(); - service.setName("target"); - componentType.getServices().add(service); - impl = factory.createSystemImplementation(); - impl.setComponentType(componentType); - component = factory.createSimpleComponent(); - component.setName("target"); - component.setImplementation(impl); - component.initialize(assemblyContext); - module.getComponents().add(component); - - // create source component - componentType = factory.createComponentType(); - Reference ref = factory.createReference(); - ref.setName("ref"); - componentType.getReferences().add(ref); - impl = factory.createSystemImplementation(); - impl.setComponentType(componentType); - component = factory.createSimpleComponent(); - component.setName("source"); - component.setImplementation(impl); - ConfiguredReference cRef = factory.createConfiguredReference("ref", "target"); - component.getConfiguredReferences().add(cRef); - component.initialize(assemblyContext); - module.getComponents().add(component); - - EntryPoint ep = factory.createEntryPoint(); - JavaServiceContract contract = factory.createJavaServiceContract(); - contract.setInterface(ModuleScopeSystemComponent.class); - service = factory.createService(); - service.setServiceContract(contract); - ConfiguredService cService = factory.createConfiguredService(); - cService.setPort(service); - cService.initialize(assemblyContext); - ep.setConfiguredService(cService); - SystemBinding binding = factory.createSystemBinding(); - ep.getBindings().add(binding); - ConfiguredReference cEpRef = factory.createConfiguredReference(); - Reference epRef = factory.createReference(); - cEpRef.setPort(epRef); - ep.setConfiguredReference(cEpRef); - ep.initialize(assemblyContext); - module.getEntryPoints().add(ep); - - List<ContextFactoryBuilder> builders = new ArrayList<ContextFactoryBuilder>(); - builders.add(new TestBuilder()); - AssemblyVisitorImpl visitor = new AssemblyVisitorImpl(builders); - module.initialize(assemblyContext); - visitor.start(module); - - Assert.assertSame(MARKER, component.getContextFactory()); - Assert.assertSame(MARKER, cRef.getProxyFactory()); - Assert.assertSame(MARKER, ep.getContextFactory()); - Assert.assertSame(MARKER, cEpRef.getProxyFactory()); - - } - - private static class TestBuilder implements ContextFactoryBuilder { - public void build(AssemblyObject model) throws BuilderException { - if (model instanceof ConfiguredPort) { - ((ConfiguredPort) model).setProxyFactory(MARKER); - } - if (model instanceof ContextFactoryHolder) { - ((ContextFactoryHolder) model).setContextFactory(MARKER); - } - } - - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/AutowireTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/AutowireTestCase.java deleted file mode 100644 index 6316fe3a67..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/AutowireTestCase.java +++ /dev/null @@ -1,310 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package org.apache.tuscany.core.system.context; - -import junit.framework.TestCase; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.SystemCompositeContext; -import org.apache.tuscany.core.context.impl.CompositeContextImpl; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.mock.component.AutowireSourceImpl; -import org.apache.tuscany.core.mock.component.Source; -import org.apache.tuscany.core.mock.component.Target; -import org.apache.tuscany.core.mock.component.TargetImpl; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; - -/** - * Tests autowiring for serveral scenarios according to the following runtime scheme: - * - * <code> - * tuscany.runtime - * | - * + tuscany.system - * | | - * | + system1 - * | | | - * | | + system1a - * | | - * | + system2 - * | - * + tuscany.root - * | - * + app1 - * | - * + app1a - * | - * + app1b - * </code> - * - * @version $Rev$ $Date$ - */ -public class AutowireTestCase extends TestCase { - - private static SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); - - /** - * Covers the case where a component in app1a requests autowire, which is resolved by the runtime to a service - * exposed on an entry point in tuscany.system. The entry point is wired to an entry point on system1, which itself - * is wired to a component in system1 - */ - public void testScenario1() throws Exception { - RuntimeContext runtime = createScenario1Runtime(); - CompositeContext root = runtime.getRootContext(); - SystemCompositeContext system = runtime.getSystemContext(); - CompositeContext system1 = (CompositeContext) system.getContext("system1"); - system1.publish(new ModuleStart(this)); - Target target = (Target) system.getContext("target.system.ep").getInstance(null); - assertNotNull(target); - CompositeContext app1 = (CompositeContext) root.getContext("app1"); - app1.publish(new ModuleStart(this)); - CompositeContext app1a = (CompositeContext) app1.getContext("app1a"); - app1a.publish(new ModuleStart(this)); - app1a.publish(new ModuleStop(this)); - app1.publish(new ModuleStop(this)); - Source source = (Source) app1a.getContext("source").getInstance(null); - assertEquals(target, source.getTarget()); - source.getTarget().getString(); - runtime.stop(); - } - - /** - * Covers the case where a component in app1a requests autowire, which is resolved to service exposed as an entry - * point on app1b. The entry point is wired to a component in app1b. - */ - public void testScenario2() throws Exception { - RuntimeContext runtime = createScenario2Runtime(); - CompositeContext root = runtime.getRootContext(); - CompositeContext app1 = (CompositeContext) root.getContext("app1"); - app1.publish(new ModuleStart(this)); - CompositeContext app1b = (CompositeContext) app1.getContext("app1b"); - app1b.publish(new ModuleStart(this)); - CompositeContext app1a = (CompositeContext) app1.getContext("app1a"); - app1a.publish(new ModuleStart(this)); - Target target = (Target) app1b.getContext("target.ep").getInstance(null); - assertNotNull(target); - Source source = (Source) app1a.getContext("source").getInstance(null); - assertEquals(target, source.getTarget()); - source.getTarget().getString(); - runtime.stop(); - } - - /** - * Covers the case where a component in system1a requests autowire, which is resolved to an entry point exposed on - * system2. The entry point is wired to a component in system2. - */ - public void testScenario3() throws Exception { - RuntimeContext runtime = createScenario3Runtime(); - SystemCompositeContext system = runtime.getSystemContext(); - - CompositeContext system2 = (CompositeContext) system.getContext("system2"); - system2.publish(new ModuleStart(this)); - Target target = (Target) system2.getContext("target.ep").getInstance(null); - assertNotNull(target); - - CompositeContext system1 = (CompositeContext) system.getContext("system1"); - system1.publish(new ModuleStart(this)); - CompositeContext system1a = (CompositeContext) system1.getContext("system1a"); - system1a.publish(new ModuleStart(this)); - - Source source = (Source) system1a.getContext("source").getInstance(null); - assertEquals(target, source.getTarget()); - source.getTarget().getString(); - runtime.stop(); - } - - /** - * Covers the case where a component in system1a requests autowire, which is resolved to component in its parent, - * system1. - */ - public void testScenario4() throws Exception { - RuntimeContext runtime = createScenario4Runtime(); - SystemCompositeContext system = runtime.getSystemContext(); - CompositeContext system1 = (CompositeContext) system.getContext("system1"); - system1.publish(new ModuleStart(this)); - Target target = (Target) system1.getContext("target").getInstance(null); - assertNotNull(target); - CompositeContext system1a = (CompositeContext) system1.getContext("system1a"); - system1a.publish(new ModuleStart(this)); - - Source source = (Source) system1a.getContext("source").getInstance(null); - assertEquals(target, source.getTarget()); - source.getTarget().getString(); - runtime.stop(); - } - - /** - * Covers the case where a component in system1a requests autowire, which is resolved to component in the parent of - * its parent (grandparent), system. - */ - public void testScenario5() throws Exception { - RuntimeContext runtime = createScenario5Runtime(); - SystemCompositeContext system = runtime.getSystemContext(); - CompositeContext system1 = (CompositeContext) system.getContext("system1"); - system1.publish(new ModuleStart(this)); - Target target = (Target) system.getContext("target").getInstance(null); - assertNotNull(target); - CompositeContext system1a = (CompositeContext) system1.getContext("system1a"); - system1a.publish(new ModuleStart(this)); - - Source source = (Source) system1a.getContext("source").getInstance(null); - assertEquals(target, source.getTarget()); - source.getTarget().getString(); - runtime.stop(); - } - - private RuntimeContext createScenario1Runtime() throws Exception { - RuntimeContext runtime = MockFactory.createCoreRuntime(); - runtime.start(); - SystemCompositeContext system = runtime.getSystemContext(); - ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1"); - ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a"); - system1Component.getImplementation().getComponents().add(system1aComponent); - Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE); - system1Component.getImplementation().getComponents().add(target); - - EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target); - system1Component.getImplementation().getEntryPoints().add(ep); - system.registerModelObject(system1Component); - EntryPoint systemEp = MockFactory.createEPSystemBinding("target.system.ep", Target.class, "ref"); - - systemEp.getBindings().add(systemFactory.createSystemBinding()); - Service service = systemFactory.createService(); - service.setName("system1/target.ep"); - (systemEp.getConfiguredReference().getTargetConfiguredServices().get(0)).setPort(service); - - system.registerModelObject(systemEp); - ModuleComponent app1Component = createAppModuleComponent("app1"); - ModuleComponent app1aComponent = createAppModuleComponent("app1a"); - Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE); - app1aComponent.getImplementation().getComponents().add(source); - app1Component.getImplementation().getComponents().add(app1aComponent); - CompositeContext root = runtime.getRootContext(); - root.registerModelObject(app1Component); - system.publish(new ModuleStart(this)); - return runtime; - } - - private RuntimeContext createScenario2Runtime() throws Exception { - RuntimeContext runtime = MockFactory.createCoreRuntime(); - runtime.start(); - - ModuleComponent app1Component = createAppModuleComponent("app1"); - ModuleComponent app1aComponent = createAppModuleComponent("app1a"); - ModuleComponent app1bComponent = createAppModuleComponent("app1b"); - Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE); - app1aComponent.getImplementation().getComponents().add(source); - app1Component.getImplementation().getComponents().add(app1aComponent); - app1Component.getImplementation().getComponents().add(app1bComponent); - - Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE); - app1bComponent.getImplementation().getComponents().add(target); - - EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target); - ep.getBindings().add(systemFactory.createSystemBinding()); - Service service = systemFactory.createService(); - service.setName("target.ep"); - ep.getConfiguredReference().getTargetConfiguredServices().get(0).setPort(service); - app1bComponent.getImplementation().getEntryPoints().add(ep); - - CompositeContext root = runtime.getRootContext(); - root.registerModelObject(app1Component); - return runtime; - } - - private RuntimeContext createScenario3Runtime() throws Exception { - RuntimeContext runtime = MockFactory.createCoreRuntime(); - runtime.start(); - SystemCompositeContext system = runtime.getSystemContext(); - ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1"); - ModuleComponent system2Component = MockFactory.createSystemCompositeComponent("system2"); - ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a"); - system1Component.getImplementation().getComponents().add(system1aComponent); - - Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE); - system2Component.getImplementation().getComponents().add(target); - EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target); - system2Component.getImplementation().getEntryPoints().add(ep); - system.registerModelObject(system2Component); - - Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE); - system1aComponent.getImplementation().getComponents().add(source); - system.registerModelObject(system1Component); - system.publish(new ModuleStart(this)); - return runtime; - } - - private RuntimeContext createScenario4Runtime() throws Exception { - RuntimeContext runtime = MockFactory.createCoreRuntime(); - runtime.start(); - SystemCompositeContext system = runtime.getSystemContext(); - ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1"); - ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a"); - system1Component.getImplementation().getComponents().add(system1aComponent); - - Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE); - system1Component.getImplementation().getComponents().add(target); - - Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE); - system1aComponent.getImplementation().getComponents().add(source); - system.registerModelObject(system1Component); - system.publish(new ModuleStart(this)); - return runtime; - } - - private RuntimeContext createScenario5Runtime() throws Exception { - RuntimeContext runtime = MockFactory.createCoreRuntime(); - runtime.start(); - SystemCompositeContext system = runtime.getSystemContext(); - ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1"); - ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a"); - system1Component.getImplementation().getComponents().add(system1aComponent); - - Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE); - system.registerModelObject(target); - - Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE); - system1aComponent.getImplementation().getComponents().add(source); - system.registerModelObject(system1Component); - system.publish(new ModuleStart(this)); - return runtime; - } - - private ModuleComponent createAppModuleComponent(String name) throws ConfigurationLoadException { - AssemblyContext assemblyContext = new AssemblyContextImpl(systemFactory, null, null); - ModuleComponent mc = systemFactory.createModuleComponent(); - mc.setName(name); - Module module = systemFactory.createModule(); - module.setImplementationClass(CompositeContextImpl.class); - module.setComponentType(MockFactory.getComponentType()); - module.setName(name); - module.initialize(assemblyContext); - mc.setImplementation(module); - return mc; - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/CompositeNestingTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/CompositeNestingTestCase.java deleted file mode 100644 index 27ffc5794e..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/CompositeNestingTestCase.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.mock.component.Source; -import org.apache.tuscany.core.mock.component.Target; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Tests registering arbirarily deep child composite contexts - * - * @version $Rev$ $Date$ - */ -public class CompositeNestingTestCase extends TestCase { - - /** - * Tests registration of a 3-level deep hierarchy under the top-level system composite context - */ - public void testSystemContext() throws Exception { - RuntimeContext runtime = MockFactory.createCoreRuntime(); - ModuleComponent child1 = createHierarchy(); - runtime.getSystemContext().registerModelObject(child1); - CompositeContext child1Ctx = (CompositeContext) runtime.getSystemContext().getContext("child1"); - Assert.assertNotNull(child1Ctx); - child1Ctx.publish(new ModuleStart(this)); - analyzeLeafComponents(child1Ctx); - CompositeContext child2Ctx = (CompositeContext) child1Ctx.getContext("child2"); - Assert.assertNotNull(child2Ctx); - child2Ctx.publish(new ModuleStart(this)); - analyzeLeafComponents(child2Ctx); - CompositeContext child3Ctx = (CompositeContext) child2Ctx.getContext("child3"); - Assert.assertNotNull(child3Ctx); - child3Ctx.publish(new ModuleStart(this)); - analyzeLeafComponents(child3Ctx); - - Assert.assertNull(child1Ctx.getContext("child3")); // sanity check - } - - /** - * Tests registration of a 3-level deep hierarchy under the root application composite context - */ - public void testRootContext() throws Exception { - RuntimeContext runtime = MockFactory.createCoreRuntime(); - ModuleComponent child1 = createHierarchy(); - runtime.getRootContext().registerModelObject(child1); - CompositeContext child1Ctx = (CompositeContext) runtime.getRootContext().getContext("child1"); - Assert.assertNotNull(child1Ctx); - child1Ctx.publish(new ModuleStart(this)); - analyzeLeafComponents(child1Ctx); - CompositeContext child2Ctx = (CompositeContext) child1Ctx.getContext("child2"); - Assert.assertNotNull(child2Ctx); - child2Ctx.publish(new ModuleStart(this)); - analyzeLeafComponents(child2Ctx); - CompositeContext child3Ctx = (CompositeContext) child2Ctx.getContext("child3"); - Assert.assertNotNull(child3Ctx); - child3Ctx.publish(new ModuleStart(this)); - analyzeLeafComponents(child3Ctx); - - Assert.assertNull(child1Ctx.getContext("child3")); // sanity check - child1Ctx.publish(new ModuleStop(this)); - } - - private ModuleComponent createHierarchy() throws ConfigurationLoadException { - ModuleComponent child3 = MockFactory.createSystemModuleComponentWithWiredComponents("child3", Scope.MODULE, Scope.MODULE); - ModuleComponent child2 = MockFactory.createSystemModuleComponentWithWiredComponents("child2", Scope.MODULE, Scope.MODULE); - child2.getImplementation().getComponents().add(child3); - ModuleComponent child1 = MockFactory.createSystemModuleComponentWithWiredComponents("child1", Scope.MODULE, Scope.MODULE); - child1.getImplementation().getComponents().add(child2); - return child1; - } - - private void analyzeLeafComponents(CompositeContext ctx) throws Exception { - Source source = (Source) ctx.getContext("source").getInstance(null); - Assert.assertNotNull(source); - Target target = source.getTarget(); - Assert.assertNotNull(target); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/IntraCompositeWireTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/IntraCompositeWireTestCase.java deleted file mode 100644 index a956263cc8..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/IntraCompositeWireTestCase.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.SystemCompositeContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.mock.MockConfigContext; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.mock.component.Source; -import org.apache.tuscany.core.mock.component.Target; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.List; - -/** - * Tests intra-composite system component wiring scenarios - * - * @version $Rev$ $Date$ - */ -public class IntraCompositeWireTestCase extends TestCase { - - public void testModuleToModuleScope() throws Exception { - SystemCompositeContext context = createContext(); - context.start(); - context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE, Scope.MODULE)); - context.publish(new ModuleStart(this)); - Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); - Assert.assertNotNull(source); - Target targetRef = source.getTarget(); - Assert.assertNotNull(targetRef); - Target target = (Target) ((AtomicContext) context.getContext("target")).getTargetInstance(); - Assert.assertSame(target, targetRef); - Assert.assertSame(target, source.getTarget()); - context.publish(new ModuleStop(this)); - context.stop(); - } - - public void testStatelessToModuleScope() throws Exception { - SystemCompositeContext context = createContext(); - context.start(); - context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.INSTANCE, Scope.MODULE)); - context.publish(new ModuleStart(this)); - Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); - Assert.assertNotNull(source); - Target targetRef = source.getTarget(); - Assert.assertNotNull(targetRef); - source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); - Target target = (Target) ((AtomicContext) context.getContext("target")).getTargetInstance(); - Assert.assertSame(target, targetRef); - Assert.assertSame(target, source.getTarget()); - context.publish(new ModuleStop(this)); - context.stop(); - } - - public void testModuleToStatelessScope() throws Exception { - SystemCompositeContext context = createContext(); - context.start(); - context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE, Scope.INSTANCE)); - context.publish(new ModuleStart(this)); - Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); - Assert.assertNotNull(source); - Target targetRef = source.getTarget(); - Assert.assertNotNull(targetRef); - Target target = (Target) ((AtomicContext) context.getContext("target")).getTargetInstance(); - Assert.assertNotSame(target, targetRef); - Source source2 = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); - // should be the same since the module scope component was alreadyy created and the stateless - // component will be "attached" to it - Assert.assertSame(source.getTarget(), source2.getTarget()); - context.publish(new ModuleStop(this)); - context.stop(); - } - - public void testMultiplicity() throws Exception { - SystemCompositeContext context = createContext(); - context.start(); - context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE, Scope.MODULE)); - context.publish(new ModuleStart(this)); - Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); - Assert.assertNotNull(source); - Target target = (Target) ((AtomicContext) context.getContext("target")).getTargetInstance(); - Assert.assertNotNull(target); - // test setter injection - List<Target> targets = source.getTargets(); - Assert.assertEquals(1,targets.size()); - assertSame(target,targets.get(0)); - - // test field injection - targets = source.getTargetsThroughField(); - Assert.assertEquals(1,targets.size()); - assertSame(target,targets.get(0)); - - // test array injection - Target[] targetArray = source.getArrayOfTargets(); - Assert.assertEquals(1,targetArray.length); - assertSame(target,targetArray[0]); - - - } - - private SystemCompositeContext createContext() { - SystemCompositeContextImpl context = new SystemCompositeContextImpl(); - context.setName("system.context"); - context.setConfigurationContext(new MockConfigContext(MockFactory.createSystemBuilders())); - return context; - } - - - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeComponentContextTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeComponentContextTestCase.java deleted file mode 100644 index 75208f47b6..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeComponentContextTestCase.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" - * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.mock.MockConfigContext; -import org.apache.tuscany.core.mock.MockFactory; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; -import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.List; - -/** - * Tests the system composite context - * - * @version $Rev$ $Date$ - */ -public class SystemCompositeComponentContextTestCase extends TestCase { - private SystemAssemblyFactory factory; - private SystemCompositeContextImpl system; - - public void testChildLocate() throws Exception { - system.start(); - Component compositeComponent = MockFactory.createCompositeComponent("system.child"); - system.registerModelObject(compositeComponent); - CompositeContext childContext = (CompositeContext) system.getContext("system.child"); - Assert.assertNotNull(childContext); - - Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); - childContext.registerModelObject(component); - childContext.registerModelObject(ep); - childContext.publish(new ModuleStart(this)); - Assert.assertNotNull(system.getContext("system.child").getInstance(new QualifiedName("./TestService1EP"))); - childContext.publish(new ModuleStop(this)); - } - - public void testAutowireRegisterBeforeStart() throws Exception { - Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); - system.registerModelObject(component); - system.registerModelObject(ep); - system.start(); - system.publish(new ModuleStart(this)); - Assert.assertSame(system.getContext("TestService1EP").getInstance(null), system.resolveInstance(ModuleScopeSystemComponent.class)); - } - - public void testAutowireRegisterAfterStart() throws Exception { - Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); - system.registerModelObject(component); - system.start(); - system.publish(new ModuleStart(this)); - EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); - system.registerModelObject(ep); - Assert.assertSame(system.getContext("TestService1EP").getInstance(null), system.resolveInstance(ModuleScopeSystemComponent.class)); - } - - public void testAutowireModuleRegisterBeforeStart() throws Exception { - system.registerModelObject(MockFactory.createSystemModule()); - system.start(); - system.publish(new ModuleStart(this)); - Assert.assertSame(system.getContext("TestService1EP").getInstance(null), system.resolveInstance(ModuleScopeSystemComponent.class)); - } - - public void testAutowireModuleRegisterAfterStart() throws Exception { - system.start(); - system.publish(new ModuleStart(this)); - system.registerModelObject(MockFactory.createSystemModule()); - Assert.assertSame(system.getContext("TestService1EP").getInstance(null), system.resolveInstance(ModuleScopeSystemComponent.class)); - } - - protected void setUp() throws Exception { - super.setUp(); - factory = new SystemAssemblyFactoryImpl(); - List<ContextFactoryBuilder> builders = MockFactory.createSystemBuilders(); - - system = new SystemCompositeContextImpl("system", null, null, new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders)); - } - - protected void tearDown() throws Exception { - system.publish(new ModuleStop(this)); - system.stop(); - super.tearDown(); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeContextRegisterTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeContextRegisterTestCase.java deleted file mode 100644 index 4397e39bec..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeContextRegisterTestCase.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.context.CompositeContextRegisterTestCase; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; -import org.apache.tuscany.core.mock.MockConfigContext; -import org.apache.tuscany.core.mock.MockFactory; - -import java.util.List; - -/** - * Tests registration of model objects for an system composite context - * - * @version $Rev$ $Date$ - */ -public class SystemCompositeContextRegisterTestCase extends CompositeContextRegisterTestCase { - - protected CompositeContext createContext() { - List<ContextFactoryBuilder> builders = MockFactory.createSystemBuilders(); - return new SystemCompositeContextImpl("test.context", null, null, new DefaultScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders)); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeHierarchyTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeHierarchyTestCase.java deleted file mode 100644 index ba7a3ba5da..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeHierarchyTestCase.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import junit.framework.Assert; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.context.AbstractCompositeHierarchyTests; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; -import org.apache.tuscany.core.mock.MockConfigContext; -import org.apache.tuscany.core.mock.MockFactory; - -import java.util.List; - -/** - * Performs testing of various hierarchical scenarios - * - * @version $Rev$ $Date$ - */ -public class SystemCompositeHierarchyTestCase extends AbstractCompositeHierarchyTests { - - - - protected CompositeContext createContextHierachy() throws Exception { - List<ContextFactoryBuilder> mockBuilders = MockFactory.createSystemBuilders(); - CompositeContext parent = new SystemCompositeContextImpl("test.parent", null, null, new DefaultScopeStrategy(), new EventContextImpl(), new MockConfigContext(mockBuilders)); - parent.registerModelObject(MockFactory.createCompositeComponent("test.child")); - parent.start(); - CompositeContext child = (CompositeContext) parent.getContext("test.child"); - Assert.assertNotNull(child); - return parent; - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemObjectRegistrationTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemObjectRegistrationTestCase.java deleted file mode 100644 index 241346e24f..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemObjectRegistrationTestCase.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import junit.framework.TestCase; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.context.SystemCompositeContext; -import org.apache.tuscany.core.context.DuplicateNameException; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.runtime.RuntimeContextImpl; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.client.BootstrapHelper; -import org.apache.tuscany.common.monitor.MonitorFactory; -import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; - -/** - * @version $Rev$ $Date$ - */ -public class SystemObjectRegistrationTestCase extends TestCase { - private RuntimeContext runtime; - private SystemCompositeContext systemContext; - - public void testRegistration() throws ConfigurationException { - MockComponent instance = new MockComponent(); - systemContext.registerJavaObject("foo", MockComponent.class, instance); - assertSame(instance, systemContext.getContext("foo").getInstance(null)); - } - - public void testDuplicateRegistration() throws ConfigurationException { - MockComponent instance = new MockComponent(); - systemContext.registerJavaObject("foo", MockComponent.class, instance); - try { - systemContext.registerJavaObject("foo", MockComponent.class, instance); - fail(); - } catch (DuplicateNameException e) { - // ok - } - } - - public void testAutowireToObject() throws ConfigurationException { - MockComponent instance = new MockComponent(); - systemContext.registerJavaObject("foo", MockComponent.class, instance); - assertSame(instance, systemContext.resolveInstance(MockComponent.class)); - assertNull(systemContext.resolveExternalInstance(MockComponent.class)); - } - - protected void setUp() throws Exception { - super.setUp(); - MonitorFactory monitorFactory = new NullMonitorFactory(); - ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); - DefaultWireBuilder wireBuilder = new DefaultWireBuilder(); - runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder); - runtime.start(); - systemContext = runtime.getSystemContext(); - systemContext.publish(new ModuleStart(this)); - } - - protected void tearDown() throws Exception { - runtime.stop(); - super.tearDown(); - } - - private static class MockComponent { - public String hello(String message) { - return message; - } - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/TestBuilder.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/TestBuilder.java deleted file mode 100644 index c531c8f7f9..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/TestBuilder.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.system.context; - -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.model.assembly.AssemblyObject; - -@Scope("MODULE") -public class TestBuilder implements ContextFactoryBuilder { - private ContextFactoryBuilderRegistry builderRegistry; - - private boolean invoked = false; - - public TestBuilder() { - super(); - } - - @Init(eager = true) - public void init() { - builderRegistry.register(this); - } - - @Autowire - public void setBuilderRegistry(ContextFactoryBuilderRegistry builderRegistry) { - this.builderRegistry = builderRegistry; - } - - public void build(AssemblyObject object) throws BuilderException { - invoked = true; - } - - public boolean invoked() { - return invoked; - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java deleted file mode 100644 index 5e4b3e2f9e..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.wire.impl.InvokerInterceptor; -import org.apache.tuscany.core.wire.impl.MessageChannelImpl; -import org.apache.tuscany.core.wire.mock.MockHandler; -import org.apache.tuscany.core.wire.mock.SimpleTarget; -import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; -import org.apache.tuscany.core.wire.mock.SimpleTargetImpl; -import org.apache.tuscany.core.wire.mock.MockStaticInvoker; -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; - -import java.lang.reflect.Method; - -/** - * Tests error propagation through an innvocation - * - * @version $Rev$ $Date$ - */ -public class InvocationConfigurationErrorTestCase extends TestCase { - - - private Method hello; - - private MessageFactory factory = new MessageFactoryImpl(); - - public InvocationConfigurationErrorTestCase() { - super(); - } - - public InvocationConfigurationErrorTestCase(String arg0) { - super(arg0); - } - - public void setUp() throws Exception { - hello = SimpleTarget.class.getMethod("hello", String.class); - } - - public void testInvokeWithHandlers() throws Exception{ - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockHandler sourceRequestHandler = new MockHandler(); - MockHandler sourceResponseHandler = new MockHandler(); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addRequestHandler(sourceRequestHandler); - source.addResponseHandler(sourceResponseHandler); - source.addInterceptor(sourceInterceptor); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockHandler targetRequestHandler = new MockHandler(); - MockHandler targetResponseHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addResponseHandler(targetResponseHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - // connect the source to the target - source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); - source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); - source.build(); - target.build(); - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = factory.createMessage(); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertTrue(response.getBody() instanceof IllegalArgumentException); - Assert.assertEquals(1,sourceRequestHandler.getCount()); - Assert.assertEquals(1,sourceResponseHandler.getCount()); - Assert.assertEquals(1,sourceInterceptor.getCount()); - Assert.assertEquals(1,targetRequestHandler.getCount()); - Assert.assertEquals(1,targetResponseHandler.getCount()); - Assert.assertEquals(1,targetInterceptor.getCount()); - } - - public void testInvokeWithRequestHandlers() throws Exception{ - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockHandler sourceRequestHandler = new MockHandler(); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addRequestHandler(sourceRequestHandler); - source.addInterceptor(sourceInterceptor); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockHandler targetRequestHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - // connect the source to the target - source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); - source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); - source.build(); - target.build(); - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = factory.createMessage(); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertTrue(response.getBody() instanceof IllegalArgumentException); - Assert.assertEquals(1,sourceRequestHandler.getCount()); - Assert.assertEquals(1,sourceInterceptor.getCount()); - Assert.assertEquals(1,targetRequestHandler.getCount()); - Assert.assertEquals(1,targetInterceptor.getCount()); - } - - /** - * Tests basic wiring of a source to a target, including handlers and interceptors - */ - public void testInvokeWithInterceptorsOnly() throws Exception{ - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addInterceptor(sourceInterceptor); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - // connect the source to the target - source.setTargetInterceptor(target.getHeadInterceptor()); - source.build(); - target.build(); - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = factory.createMessage(); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertTrue(response.getBody() instanceof IllegalArgumentException); - Assert.assertEquals(1,sourceInterceptor.getCount()); - Assert.assertEquals(1,targetInterceptor.getCount()); - - } - -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java deleted file mode 100644 index 0519573439..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.wire.impl.InvokerInterceptor; -import org.apache.tuscany.core.wire.impl.MessageChannelImpl; -import org.apache.tuscany.core.wire.mock.SimpleTarget; -import org.apache.tuscany.core.wire.mock.MockHandler; -import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; -import org.apache.tuscany.core.wire.mock.MockStaticInvoker; -import org.apache.tuscany.core.wire.mock.SimpleTargetImpl; -import org.apache.tuscany.core.message.Message; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; - -import java.lang.reflect.Method; - -public class InvocationConfigurationTestCase extends TestCase { - - private Method hello; - - - private MessageFactory factory = new MessageFactoryImpl(); - - public InvocationConfigurationTestCase() { - super(); - } - - public InvocationConfigurationTestCase(String arg0) { - super(arg0); - } - - public void setUp() throws Exception { - hello = SimpleTarget.class.getMethod("hello", String.class); - } - - /** - * Tests basic wiring of a source to a target, including handlers and interceptors - */ - public void testInvokeWithHandlers() throws Exception { - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockHandler sourceRequestHandler = new MockHandler(); - MockHandler sourceResponseHandler = new MockHandler(); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addRequestHandler(sourceRequestHandler); - source.addResponseHandler(sourceResponseHandler); - source.addInterceptor(sourceInterceptor); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockHandler targetRequestHandler = new MockHandler(); - MockHandler targetResponseHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addResponseHandler(targetResponseHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - // connect the source to the target - source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); - source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); - source.build(); - target.build(); - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = factory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - Assert.assertEquals(1, sourceRequestHandler.getCount()); - Assert.assertEquals(1, sourceResponseHandler.getCount()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetRequestHandler.getCount()); - Assert.assertEquals(1, targetResponseHandler.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - public void testInvokeWithRequestHandlers() throws Exception { - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockHandler sourceRequestHandler = new MockHandler(); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addRequestHandler(sourceRequestHandler); - source.addInterceptor(sourceInterceptor); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockHandler targetRequestHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - // connect the source to the target - source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); - source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); - source.build(); - target.build(); - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = factory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - Assert.assertEquals(1, sourceRequestHandler.getCount()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetRequestHandler.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } - - /** - * Tests basic wiring of a source to a target, including handlers and interceptors - */ - public void testInvokeWithInterceptorsOnly() throws Exception { - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addInterceptor(sourceInterceptor); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - // connect the source to the target - source.setTargetInterceptor(target.getHeadInterceptor()); - source.build(); - target.build(); - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Message msg = factory.createMessage(); - msg.setBody("foo"); - msg.setTargetInvoker(invoker); - Message response = source.getHeadInterceptor().invoke(msg); - Assert.assertEquals("foo", response.getBody()); - Assert.assertEquals(1, sourceInterceptor.getCount()); - Assert.assertEquals(1, targetInterceptor.getCount()); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationErrorTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationErrorTestCase.java deleted file mode 100644 index 1d04e18757..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationErrorTestCase.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.wire.impl.InvokerInterceptor; -import org.apache.tuscany.core.wire.jdk.JDKInvocationHandler; -import org.apache.tuscany.core.wire.mock.MockHandler; -import org.apache.tuscany.core.wire.mock.MockStaticInvoker; -import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Map; - -/** - * Tests handling of exceptions thrown during an wire - * - * @version $Rev: 377006 $ $Date: 2006-02-11 09:41:59 -0800 (Sat, 11 Feb 2006) $ - */ -public class InvocationErrorTestCase extends TestCase { - - private Method checkedMethod; - private Method runtimeMethod; - - public InvocationErrorTestCase() { - super(); - } - - public InvocationErrorTestCase(String arg0) { - super(arg0); - } - - public void setUp() throws Exception { - checkedMethod = TestBean.class.getDeclaredMethod("checkedException", (Class[]) null); - runtimeMethod = TestBean.class.getDeclaredMethod("runtimeException", (Class[]) null); - Assert.assertNotNull(checkedMethod); - Assert.assertNotNull(runtimeMethod); - } - - public void testCheckedException() throws Exception { - Map<Method, InvocationConfiguration> config = new MethodHashMap(); - config.put(checkedMethod, getConfiguration(checkedMethod)); - InvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), config); - try { - TestBean proxy = (TestBean) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), - new Class[]{TestBean.class}, handler); - proxy.checkedException(); - } catch (TestException e) { - return; - } - Assert.fail(TestException.class.getName() + " should have been thrown"); - } - - public void testRuntimeException() throws Exception { - Map<Method, InvocationConfiguration> config = new MethodHashMap<InvocationConfiguration>(); - config.put(runtimeMethod, getConfiguration(runtimeMethod)); - InvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), config); - try { - TestBean proxy = (TestBean) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), - new Class[]{TestBean.class}, handler); - proxy.runtimeException(); - } catch (TestRuntimeException e) { - return; - } - Assert.fail(TestException.class.getName() + " should have been thrown"); - } - - private InvocationConfiguration getConfiguration(Method m) { - MockStaticInvoker invoker = new MockStaticInvoker(m, new TestBeanImpl()); - SourceInvocationConfiguration invocationConfiguration=new SourceInvocationConfiguration(m); - invocationConfiguration.addInterceptor(new MockSyncInterceptor()); - invocationConfiguration.addRequestHandler(new MockHandler()); - invocationConfiguration.setTargetInvoker(invoker); - invocationConfiguration.setTargetInterceptor(new InvokerInterceptor()); - invocationConfiguration.build(); - return invocationConfiguration; - } - - public interface TestBean { - - public void checkedException() throws TestException; - - public void runtimeException() throws TestRuntimeException; - - } - - public class TestBeanImpl implements TestBean { - - public void checkedException() throws TestException { - throw new TestException(); - } - - public void runtimeException() throws TestRuntimeException { - throw new TestRuntimeException(); - } - } - - public class TestException extends Exception { - } - - public class TestRuntimeException extends RuntimeException { - } - -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java deleted file mode 100644 index 28a2da23b5..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.jdk; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.wire.InvocationConfiguration; -import org.apache.tuscany.core.wire.MethodHashMap; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.mock.SimpleTarget; -import org.apache.tuscany.core.wire.mock.SimpleTargetImpl; -import org.apache.tuscany.core.wire.mock.MockStaticInvoker; -import org.apache.tuscany.core.wire.mock.MockHandler; -import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; -import org.apache.tuscany.core.wire.impl.InvokerInterceptor; -import org.apache.tuscany.core.wire.impl.MessageChannelImpl; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; - -import java.lang.reflect.Method; -import java.util.Map; - -public class JDKInvocationHandlerTestCase extends TestCase { - - private Method hello; - - public JDKInvocationHandlerTestCase() { - super(); - } - - public JDKInvocationHandlerTestCase(String arg0) { - super(arg0); - } - - public void setUp() throws Exception { - hello = SimpleTarget.class.getMethod("hello", String.class); - } - - public void testBasicInvoke() throws Throwable { - Map<Method, InvocationConfiguration> configs = new MethodHashMap<InvocationConfiguration>(); - configs.put(hello, getInvocationHandler(hello)); - JDKInvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), configs); - Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] { "foo" })); - } - - public void testErrorInvoke() throws Throwable { - Map<Method, InvocationConfiguration> configs = new MethodHashMap<InvocationConfiguration>(); - configs.put(hello, getInvocationHandler(hello)); - JDKInvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), configs); - try { - Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] {})); - fail("Expected " + IllegalArgumentException.class.getName()); - } catch (IllegalArgumentException e) { - // should throw - } - } - - public void testDirectErrorInvoke() throws Throwable { - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Map<Method, InvocationConfiguration> configs = new MethodHashMap<InvocationConfiguration>(); - configs.put(hello, source); - JDKInvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), configs); - try { - Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] {})); - fail("Expected " + IllegalArgumentException.class.getName()); - } catch (IllegalArgumentException e) { - // should throw - } - } - - public void testDirectInvoke() throws Throwable { - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - - Map<Method, InvocationConfiguration> configs = new MethodHashMap<InvocationConfiguration>(); - configs.put(hello, source); - JDKInvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), configs); - Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] { "foo" })); - } - - private InvocationConfiguration getInvocationHandler(Method m) { - SourceInvocationConfiguration source = new SourceInvocationConfiguration(m); - MockHandler sourceRequestHandler = new MockHandler(); - MockHandler sourceResponseHandler = new MockHandler(); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addRequestHandler(sourceRequestHandler); - source.addResponseHandler(sourceResponseHandler); - source.addInterceptor(sourceInterceptor); - - TargetInvocationConfiguration target = new TargetInvocationConfiguration(m); - MockHandler targetRequestHandler = new MockHandler(); - MockHandler targetResponseHandler = new MockHandler(); - MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); - target.addRequestHandler(targetRequestHandler); - target.addResponseHandler(targetResponseHandler); - target.addInterceptor(targetInterceptor); - target.addInterceptor(new InvokerInterceptor()); - - // connect the source to the target - source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); - source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); - source.build(); - target.build(); - MockStaticInvoker invoker = new MockStaticInvoker(m, new SimpleTargetImpl()); - source.setTargetInvoker(invoker); - return source; - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactoryTestCase.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactoryTestCase.java deleted file mode 100644 index 60f8cf837d..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactoryTestCase.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.wire.jdk; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.wire.MethodHashMap; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.core.wire.impl.InvokerInterceptor; -import org.apache.tuscany.core.wire.mock.MockStaticInvoker; -import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; -import org.apache.tuscany.core.wire.mock.SimpleTarget; -import org.apache.tuscany.core.wire.mock.SimpleTargetImpl; -import org.apache.tuscany.core.message.impl.MessageFactoryImpl; - -import java.lang.reflect.Method; -import java.util.Map; - -public class JDKWireFactoryFactoryTestCase extends TestCase { - - private Method hello; - - public JDKWireFactoryFactoryTestCase(String arg0) { - super(arg0); - } - - public void setUp() throws Exception { - hello = SimpleTarget.class.getMethod("hello", String.class); - } - - public void testSourceWireFactory() throws Exception { - SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addInterceptor(sourceInterceptor); - source.setTargetInterceptor(new InvokerInterceptor()); - source.setTargetInvoker(new MockStaticInvoker(hello, new SimpleTargetImpl())); - source.build(); - Map<Method, SourceInvocationConfiguration> configs = new MethodHashMap<SourceInvocationConfiguration>(); - configs.put(hello, source); - WireSourceConfiguration config = new WireSourceConfiguration("foo",new QualifiedName("foo"), configs, Thread.currentThread() - .getContextClassLoader(), new MessageFactoryImpl()); - JDKSourceWireFactory factory = new JDKSourceWireFactory(); - factory.setConfiguration(config); - factory.setBusinessInterface(SimpleTarget.class); - factory.initialize(); - SimpleTarget instance = (SimpleTarget) factory.createProxy(); - Assert.assertEquals("foo",instance.hello("foo")); - } - - public void testTargetWireFactory() throws Exception { - TargetInvocationConfiguration source = new TargetInvocationConfiguration(hello); - MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); - source.addInterceptor(sourceInterceptor); - source.addInterceptor(new InvokerInterceptor()); - source.setTargetInvoker(new MockStaticInvoker(hello, new SimpleTargetImpl())); - source.build(); - Map<Method, TargetInvocationConfiguration> configs = new MethodHashMap<TargetInvocationConfiguration>(); - configs.put(hello, source); - WireTargetConfiguration config = new WireTargetConfiguration(new QualifiedName("foo"), configs, Thread.currentThread() - .getContextClassLoader(), new MessageFactoryImpl()); - JDKTargetWireFactory factory = new JDKTargetWireFactory(); - factory.setConfiguration(config); - factory.setBusinessInterface(SimpleTarget.class); - factory.initialize(); - SimpleTarget instance = (SimpleTarget) factory.createProxy(); - Assert.assertEquals("foo",instance.hello("foo")); - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockHandler.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockHandler.java deleted file mode 100644 index 9def6b5b0e..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.mock; - -import org.apache.tuscany.core.wire.MessageHandler; -import org.apache.tuscany.core.message.Message; - -/** - * - */ -public class MockHandler implements MessageHandler { - - private int count =0; - - public boolean processMessage(Message message) { - //System.out.println("Invoking handler"); - count++; - return true; - } - - public int getCount(){ - return count; - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockScopeContext.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockScopeContext.java deleted file mode 100644 index 915885549a..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockScopeContext.java +++ /dev/null @@ -1,131 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.mock; - -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.RuntimeEventListener; -import org.apache.tuscany.core.context.ContextRuntimeException; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.ScopeRuntimeException; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.EventFilter; -import org.apache.tuscany.core.context.event.Event; -import org.apache.tuscany.model.assembly.AtomicComponent; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class MockScopeContext implements ScopeContext { - - Map<String, Object> components; - - public MockScopeContext() { - components = new HashMap<String, Object>(); - components.put("foo", new SimpleTargetImpl()); - components.put("bar", new SimpleTargetImpl()); - } - - public MockScopeContext(Map<String,Object> instances) { - components = instances; - } - - - public void start() { - } - - public void stop() { - } - - public void publish(Event object) { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void addListener(RuntimeEventListener listener) throws ContextRuntimeException { - } - - public void addListener(EventFilter filter, RuntimeEventListener listener) { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void removeListener(RuntimeEventListener listener) throws ContextRuntimeException { - } - - public String getName() { - return "Mock Scope Container"; - } - - public boolean isCacheable() { - return false; - } - - public int[] getEventTypes() { - return null; - } - - public AtomicContext getContext(String name) { - return null; - } - - public Object getInstance(QualifiedName name) throws ScopeRuntimeException { - return components.get(name.getPartName()); - } - - public AtomicContext getContextByKey(String name, Object key) { - return null; - } - - public void setComponent(AtomicComponent component) throws ScopeRuntimeException { - } - - public void removeContext(String name) throws ScopeRuntimeException { - } - - public void removeContextByKey(String name, Object key) throws ScopeRuntimeException { - } - - public AtomicComponent[] getComponents() { - return null; - } - - - public void registerFactories(List<ContextFactory<Context>> configurations) { - } - - public void registerFactory(ContextFactory<Context> configuration) { - } - - public int getLifecycleState(){ - return RUNNING; - } - - - public void setLifecycleState(int state) { - } - - - public void setName(String name) { - } - - - public void onEvent(Event event) { - //To change body of implemented methods use File | Settings | File Templates. - } -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockStaticInvoker.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockStaticInvoker.java deleted file mode 100644 index 66e8579cb4..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockStaticInvoker.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.mock; - -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.InvocationRuntimeException; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.apache.tuscany.core.message.Message; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * Caches component instances that do not need to be resolved for every wire, e.g. an wire originating from - * a lesser scope intended for a target with a wider scope - * - * @version $Rev: 377006 $ $Date: 2006-02-11 09:41:59 -0800 (Sat, 11 Feb 2006) $ - */ -public class MockStaticInvoker implements TargetInvoker { - - private Object instance; - - private Method operation; - - public MockStaticInvoker(Method operation, Object instance) { - this.operation = operation; - this.instance = instance; - } - - public boolean isCacheable() { - return true; - } - - public Object invokeTarget(Object payload) throws InvocationTargetException { - try { - if (payload != null && !payload.getClass().isArray()) { - return operation.invoke(instance, payload); - } else { - return operation.invoke(instance, (Object[]) payload); - } - } catch (IllegalAccessException e) { - throw new InvocationRuntimeException(e); - } - } - - 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 IllegalStateException("This interceptor must be the last interceptor in an interceptor chain"); - } - - public Object clone() throws CloneNotSupportedException { - try { - MockStaticInvoker invoker = (MockStaticInvoker) super.clone(); - invoker.instance = this.instance; - invoker.operation = this.operation; - return invoker; - } catch (CloneNotSupportedException e) { - return null; // will not happen - } - } -} diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockSyncInterceptor.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockSyncInterceptor.java deleted file mode 100644 index a64caed8eb..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockSyncInterceptor.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.mock; - -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.message.Message; - -public class MockSyncInterceptor implements Interceptor { - - private int count; - - private Interceptor next; - - public MockSyncInterceptor() { - } - - public Message invoke(Message msg) { - ++count; - //System.out.println("Invoking interceptor"); - return next.invoke(msg); - } - - public int getCount() { - return count; - } - - public void setNext(Interceptor next) { - this.next=next; - } -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSource.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSource.java deleted file mode 100644 index 8e8af9ec18..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSource.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.mock; - -public interface SimpleSource { - - public void invokeHello() throws Exception; - - public void invokeGoodbye() throws Exception; -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSourceImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSourceImpl.java deleted file mode 100644 index 900fa9c324..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSourceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.mock; - -public class SimpleSourceImpl implements SimpleSource { - - private SimpleTarget proxy; - - public SimpleSourceImpl(SimpleTarget proxy) { - this.proxy = proxy; - } - - public void invokeHello() throws Exception { - proxy.hello("hello"); - } - - public void invokeGoodbye() throws Exception { - proxy.goodbye("hello"); - } - -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTarget.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTarget.java deleted file mode 100644 index d63d3a0565..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTarget.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.mock; - -public interface SimpleTarget { - - public String hello(String message) throws Exception; - - public String goodbye(String message) throws Exception; - - public String echo(String message) throws Exception; - -} - diff --git a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTargetImpl.java b/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTargetImpl.java deleted file mode 100644 index 1b6fe93ac8..0000000000 --- a/branches/java-M1/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTargetImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.wire.mock; - -public class SimpleTargetImpl implements SimpleTarget { - - public SimpleTargetImpl() { - super(); - } - - public String hello(String message) throws Exception { - return message; - } - - public String goodbye(String message) throws Exception { - return message; - } - - public String echo(String message) throws Exception { - return message; - } - - -} - diff --git a/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/config/ModuleComponentLoaderTest1.module b/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/config/ModuleComponentLoaderTest1.module deleted file mode 100644 index b261cbe6c0..0000000000 --- a/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/config/ModuleComponentLoaderTest1.module +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<module xmlns="http://www.osoa.org/xmlns/sca/0.9" - xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" - name="ModuleComponentLoaderTest1"> - - <component name="HelloWorldServiceComponent"> - <implementation.java class="org.apache.tuscany.samples.helloworld.HelloWorldServiceComponentImpl"/> - </component> -</module> diff --git a/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.wsdl b/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.wsdl deleted file mode 100644 index 3a23e7b717..0000000000 --- a/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.wsdl +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<wsdl:definitions targetNamespace="http://www.example.org" - xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - name="example"> - - <wsdl:portType name="HelloWorld"> - </wsdl:portType> -</wsdl:definitions> diff --git a/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.xsd b/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.xsd deleted file mode 100644 index e34b6e92e0..0000000000 --- a/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.xsd +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - xmlns:ex="http://tuscany.apache.org/xmlns/example" - targetNamespace="http://tuscany.apache.org/xmlns/example" - > - - <element name="foo" type="string"/> -</schema> diff --git a/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/interfacestyles.wsdl b/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/interfacestyles.wsdl deleted file mode 100644 index eeab33193d..0000000000 --- a/branches/java-M1/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/interfacestyles.wsdl +++ /dev/null @@ -1,239 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.interfacestyles.org"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:account="http://www.interfacestyles.org"
- targetNamespace="http://www.interfacestyles.org" - name="TestInterfaceStylesService">
-
- <wsdl:types>
- <xsd:schema targetNamespace="http://www.interfacestyles.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:account="http://www.interfacestyles.org" - xmlns:sdojava="commonj.sdo/java" - sdojava:package="org.apache.tuscany.samples.bigbank.account">
-
- <xsd:element name="getAccountReportWrapped0">
- <xsd:complexType>
- <xsd:sequence>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="getAccountReportWrapped0Response">
- <xsd:complexType>
- <xsd:sequence>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="getAccountReportWrapped1"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="customerID" type="xsd:string"/> - </xsd:sequence> - </xsd:complexType> - </xsd:element>
- <xsd:element name="getAccountReportWrapped1Response"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="accountReport" type="account:AccountReport"/> - </xsd:sequence> - </xsd:complexType> - </xsd:element> -
- <xsd:element name="getAccountReportWrappedN">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="customerID" type="xsd:string"/>
- <xsd:element name="customerID2" type="xsd:int"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="getAccountReportWrappedNResponse">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="accountReport" type="account:AccountReport"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="getAccountReportBare0" type="xsd:string"/>
- <xsd:element name="getAccountReportBare0Response" type="xsd:int"/>
-
- <xsd:element name="getAccountReportBare1Simple" type="xsd:string"/>
- <xsd:element name="getAccountReportBare1SimpleResponse" type="xsd:int"/>
-
- <xsd:element name="getAccountReportBare1Complex" type="account:AccountRequest"/>
- <xsd:element name="getAccountReportBare1ComplexResponse" type="account:AccountReport"/>
-
- <xsd:complexType name="AccountRequest">
- <xsd:sequence>
- <xsd:element name="customerID" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="AccountReport">
- <xsd:sequence>
- <xsd:element name="accountSummaries" type="account:AccountSummary" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="AccountSummary">
- <xsd:attribute name="accountNumber" type="xsd:string"/>
- <xsd:attribute name="accountType" type="xsd:string"/>
- <xsd:attribute name="balance" type="xsd:float"/>
- </xsd:complexType>
-
- </xsd:schema>
- </wsdl:types>
-
- <wsdl:message name="getAccountReportWrapped0Request">
- <wsdl:part element="account:getAccountReportWrapped0" name="getAccountReportWrapped0Request"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportWrapped0Response">
- <wsdl:part element="account:getAccountReportWrapped0Response" name="getAccountReportWrapped0Response"/>
- </wsdl:message>
-
- <wsdl:message name="getAccountReportWrapped1Request">
- <wsdl:part element="account:getAccountReportWrapped1" name="getAccountReportWrapped1Request"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportWrapped1Response">
- <wsdl:part element="account:getAccountReportWrapped1Response" name="getAccountReportWrapped1Response"/>
- </wsdl:message>
-
- <wsdl:message name="getAccountReportWrappedNRequest">
- <wsdl:part element="account:getAccountReportWrappedN" name="getAccountReportWrappedNRequest"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportWrappedNResponse">
- <wsdl:part element="account:getAccountReportWrappedNResponse" name="getAccountReportWrappedNResponse"/>
- </wsdl:message>
-
- <wsdl:message name="getAccountReportBare0Request">
- </wsdl:message>
- <wsdl:message name="getAccountReportBare0Response">
- </wsdl:message>
-
- <wsdl:message name="getAccountReportBare1SimpleRequest">
- <wsdl:part element="account:getAccountReportBare1Simple" name="getAccountReportBare1SimpleRequest"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportBare1SimpleResponse">
- <wsdl:part element="account:getAccountReportBare1SimpleResponse" name="getAccountReportBare1SimpleResponse"/>
- </wsdl:message>
-
- <wsdl:message name="getAccountReportBare1ComplexRequest">
- <wsdl:part element="account:getAccountReportBare1Complex" name="getAccountReportBare1ComplexRequest"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportBare1ComplexResponse">
- <wsdl:part element="account:getAccountReportBare1ComplexResponse" name="getAccountReportBare1ComplexResponse"/>
- </wsdl:message>
-
- <wsdl:portType name="TestInterfaceStylesService">
- <wsdl:operation name="getAccountReportWrapped0">
- <wsdl:input message="tns:getAccountReportWrapped0Request"/>
- <wsdl:output message="tns:getAccountReportWrapped0Response"/>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportWrapped1">
- <wsdl:input message="tns:getAccountReportWrapped1Request"/>
- <wsdl:output message="tns:getAccountReportWrapped1Response"/>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportWrappedN">
- <wsdl:input message="tns:getAccountReportWrappedNRequest"/>
- <wsdl:output message="tns:getAccountReportWrappedNResponse"/>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare0">
- <wsdl:input message="tns:getAccountReportBare0Request"/>
- <wsdl:output message="tns:getAccountReportBare0Response"/>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare1Simple">
- <wsdl:input message="tns:getAccountReportBare1SimpleRequest"/>
- <wsdl:output message="tns:getAccountReportBare1SimpleResponse"/>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare1Complex">
- <wsdl:input message="tns:getAccountReportBare1ComplexRequest"/>
- <wsdl:output message="tns:getAccountReportBare1ComplexResponse"/>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="TestInterfaceStylesServiceSOAP" type="tns:TestInterfaceStylesService">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getAccountReportWrapped0">
- <soap:operation
- soapAction="http://www.interfacestyles.org/getAccountReportWrapped0"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportWrapped1">
- <soap:operation
- soapAction="http://www.interfacestyles.org/getAccountReportWrapped1"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportWrappedN">
- <soap:operation
- soapAction="http://www.interfacestyles.org/getAccountReportWrappedN"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare0">
- <soap:operation
- soapAction="http://www.interfacestyles.org/getAccountReportBare0"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare1Simple">
- <soap:operation
- soapAction="http://www.interfacestyles.org/getAccountReportBare1Simple"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare1Complex">
- <soap:operation
- soapAction="http://www.interfacestyles.org/getAccountReportBare1Complex"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="TestInterfaceStylesService">
- <wsdl:port binding="tns:TestInterfaceStylesServiceSOAP"
- name="TestInterfaceStylesServiceSOAP">
- <soap:address location="http://localhost:8080/testinterfacestyles/services/TestInterfaceStylesService"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/core/src/test/resources/system.fragment b/branches/java-M1/java/sca/core/src/test/resources/system.fragment deleted file mode 100644 index 74d04561cd..0000000000 --- a/branches/java-M1/java/sca/core/src/test/resources/system.fragment +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:system="http://org.apache.tuscany/xmlns/system/0.9" - name="org.apache.tuscany.container.java">
- -</moduleFragment>
diff --git a/branches/java-M1/java/sca/databinding/pom.xml b/branches/java-M1/java/sca/databinding/pom.xml deleted file mode 100644 index d7f337a955..0000000000 --- a/branches/java-M1/java/sca/databinding/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project> - - <parent> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-sca</artifactId> - <version>incubating-M1</version> - </parent> - - <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.tuscany.databinding</groupId> - <artifactId>tuscany-databinding</artifactId> - <packaging>pom</packaging> - <name>Tuscany SCA Data Bindings</name> - <version>incubating-M1</version> - - <modules> - <module>sdo</module> - </modules> - -</project> diff --git a/branches/java-M1/java/sca/databinding/sdo/pom.xml b/branches/java-M1/java/sca/databinding/sdo/pom.xml deleted file mode 100644 index 635711f294..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project> - - <parent> - <groupId>org.apache.tuscany.databinding</groupId> - <artifactId>tuscany-databinding</artifactId> - <version>incubating-M1</version> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>tuscany-databinding-sdo</artifactId> - <name>Tuscany Data Binding based on SDO</name> - <description>Data Binding based on SDO.</description> - <version>incubating-M1</version> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-core</artifactId> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/branches/java-M1/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java b/branches/java-M1/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java deleted file mode 100644 index 519d256036..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation or its licensors as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import commonj.sdo.helper.XSDHelper; -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.SidefileLoadException; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.loader.StAXUtil; -import org.apache.tuscany.core.loader.assembly.AbstractLoader; -import org.apache.tuscany.core.loader.assembly.AssemblyConstants; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.osoa.sca.annotations.Scope; - -/** - * Loader that handles <import.sdo> elements. - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class ImportSDOLoader extends AbstractLoader { - public static final QName IMPORT_SDO = new QName(AssemblyConstants.SCA_NAMESPACE, "import.sdo"); - - public QName getXMLType() { - return IMPORT_SDO; - } - - public AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { - assert IMPORT_SDO.equals(reader.getName()); - importFactory(reader, loaderContext); - importWSDLOrXSD(reader, loaderContext); - StAXUtil.skipToEndElement(reader); - return null; - } - - private void importFactory(XMLStreamReader reader, LoaderContext loaderContext) throws ConfigurationLoadException { - String factoryName = reader.getAttributeValue(null, "factory"); - if (factoryName != null) { - ResourceLoader resourceLoader = loaderContext.getResourceLoader(); - ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); - try { - // set TCCL as SDO needs it - Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader()); - Class<?> factoryClass = resourceLoader.loadClass(factoryName); - SDOUtil.registerStaticTypes(factoryClass); - } catch (ClassNotFoundException e) { - throw new ConfigurationLoadException(e.getMessage(), e); - } finally { - Thread.currentThread().setContextClassLoader(oldCL); - } - } - } - - @SuppressWarnings("deprecation") - private void importWSDLOrXSD(XMLStreamReader reader, LoaderContext loaderContext) throws ConfigurationLoadException { - String location = reader.getAttributeValue(null, "wsdlLocation"); - if (location == null) - location = reader.getAttributeValue(null, "schemaLocation"); - if (location != null) { - ResourceLoader resourceLoader = loaderContext.getResourceLoader(); - URL wsdlURL = resourceLoader.getResource(location); - ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); - try { -// Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader()); - InputStream xsdInputStream = wsdlURL.openStream(); - try { - AssemblyContext context = registry.getContext(); - XSDHelper xsdHelper = SDOUtil.createXSDHelper(context.getTypeHelper()); - xsdHelper.define(xsdInputStream, null); - } finally { - xsdInputStream.close(); - } - } catch (IOException e) { - SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); - sfe.setResourceURI(location); - throw sfe; - } finally { - Thread.currentThread().setContextClassLoader(oldCL); - } - } - } -} diff --git a/branches/java-M1/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java b/branches/java-M1/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java deleted file mode 100644 index 0f0cc13fd8..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.CopyHelper; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.injection.ObjectCreationException; - -/** - * Creates new instances of an SDO - * - * @version $Rev$ $Date$ - */ -public class SDOObjectFactory implements ObjectFactory<DataObject> { - - private DataObject dataObject; - - public SDOObjectFactory(DataObject dataObject) { - this.dataObject = dataObject; - } - - public DataObject getInstance() throws ObjectCreationException { - return CopyHelper.INSTANCE.copy(dataObject); - } - - public void releaseInstance(DataObject instance) { - } - -} - diff --git a/branches/java-M1/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOXMLHelper.java b/branches/java-M1/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOXMLHelper.java deleted file mode 100644 index d732676c76..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOXMLHelper.java +++ /dev/null @@ -1,264 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.databinding.sdo;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.core.wire.InvocationRuntimeException;
-import org.apache.tuscany.sdo.util.SDOUtil;
-import org.osoa.sca.ServiceRuntimeException;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.Property;
-import commonj.sdo.Type;
-import commonj.sdo.helper.DataFactory;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-import commonj.sdo.helper.XSDHelper;
-
-/**
- * Utility methods to convert between XML byte arrays, SDO DataObjects, and Java objects.
- *
- * Most of these methods rely on the schemas having been registered with XSDHelper.define
- */
-public final class SDOXMLHelper {
-
- private SDOXMLHelper() {
- // utility class, never contructed
- }
-
- /**
- * Deserialize an XML byte array into Java Objects
- *
- * @param xmlBytes
- * the byte array containing the XML
- * @param isWrapped
- *
- * @return the array of deserialized Java objects
- * @deprecated TUSCANY-333 use the method that takes a ClassLoader
- */
- public static Object[] toObjects(TypeHelper typeHelper, byte[] xmlBytes, boolean isWrapped) {
- DataObject dataObject = toDataObject(typeHelper, xmlBytes);
- return toObjects(dataObject, isWrapped);
- }
-
- /**
- * Convert a typed DataObject to Java objects
- *
- * @param dataObject
- * @param isWrapped
- * @return the array of Objects from the DataObject
- */
- public static Object[] toObjects(DataObject dataObject, boolean isWrapped) {
- if (isWrapped) {
- List ips = dataObject.getInstanceProperties();
- Object[] os = new Object[ips.size()];
- for (int i = 0; i < ips.size(); i++) {
- os[i] = dataObject.get((Property) ips.get(i));
- }
- return os;
- } else {
- Object object = dataObject;
- Type type = dataObject.getType();
- if (type.isSequenced()) {
- object = dataObject.getSequence().getValue(0);
- }
- return new Object[] { object };
- }
- }
-
- /**
- * Serializes objects to an XML byte array
- *
- * @param os
- * @param typeNS
- * @param typeName
- * @return a byte array containing the XML
- * @deprecated TUSCANY-333 use the method that takes a ClassLoader
- */
- public static byte[] toXMLBytes(TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) {
- DataObject dataObject = toDataObject(typeHelper, os, elementQName, isWrapped);
- return toXMLbytes(typeHelper, dataObject, elementQName);
- }
-
- /**
- * Convert a DataObject to an XML byte array
- *
- * @param dataObject
- * @param typeNS
- * @param typeName
- * @return a byte array containing the XML bytes
- * @deprecated TUSCANY-333 use the method that takes a ClassLoader
- */
- public static byte[] toXMLbytes(TypeHelper typeHelper, DataObject dataObject, QName elementQName) {
- try {
-
- ByteArrayOutputStream pos = new ByteArrayOutputStream();
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
- xmlHelper.save(dataObject, elementQName.getNamespaceURI(), elementQName.getLocalPart(), pos);
- pos.close();
-
- return pos.toByteArray();
-
- } catch (IOException e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Deserialize an XML byte array into a DataObject
- *
- * @param xmlBytes
- * @return a DataObject
- * @deprecated TUSCANY-333 use the method that takes a ClassLoader
- */
- public static DataObject toDataObject(TypeHelper typeHelper, byte[] xmlBytes) {
- try {
-
- XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper);
- XMLDocument document = xmlHelper.load(new ByteArrayInputStream(xmlBytes));
-
- return document.getRootObject();
-
- } catch (IOException e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Convert objects to typed DataObject
- *
- * @param typeNS
- * @param typeName
- * @param os
- * @return the DataObject
- * @deprecated TUSCANY-333 use the method that takes a ClassLoader
- */
- public static DataObject toDataObject(TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) {
- XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
-
- Property property = xsdHelper.getGlobalProperty(elementQName.getNamespaceURI(), elementQName.getLocalPart(), true);
- if (null == property) {
- throw new InvocationRuntimeException("Type '" + elementQName.toString() + "' not found in registered SDO types.");
- }
- if (isWrapped) {
- DataFactory dataFactory = SDOUtil.createDataFactory(typeHelper);
- DataObject dataObject = dataFactory.create(property.getType());
- List ips = dataObject.getInstanceProperties();
- for (int i = 0; i < ips.size(); i++) {
- dataObject.set(i, os[i]);
- }
- return dataObject;
- } else {
- Object value = os[0];
- Type type = property.getType();
- if (!type.isDataType()) {
- return (DataObject) value;
- } else {
- return SDOUtil.createDataTypeWrapper(type, value);
- }
- }
- }
-
-// ---
-
- public static DataObject toDataObject(ClassLoader classLoader, TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- if (tccl != classLoader) {
- Thread.currentThread().setContextClassLoader(classLoader);
- }
-
- return toDataObject(typeHelper, os, elementQName, isWrapped);
-
- } finally {
- if (tccl != classLoader) {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
- }
-
- public static DataObject toDataObject(ClassLoader classLoader, TypeHelper typeHelper, byte[] xmlBytes) {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- if (tccl != classLoader) {
- Thread.currentThread().setContextClassLoader(classLoader);
- }
-
- return toDataObject(typeHelper, xmlBytes);
-
- } finally {
- if (tccl != classLoader) {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
- }
-
- public static byte[] toXMLbytes(ClassLoader classLoader, TypeHelper typeHelper, DataObject dataObject, QName elementQName) {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- if (tccl != classLoader) {
- Thread.currentThread().setContextClassLoader(classLoader);
- }
-
- return toXMLbytes(typeHelper, dataObject, elementQName);
-
- } finally {
- if (tccl != classLoader) {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
- }
-
- public static byte[] toXMLBytes(ClassLoader classLoader, TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- if (tccl != classLoader) {
- Thread.currentThread().setContextClassLoader(classLoader);
- }
-
- return toXMLBytes(typeHelper, os, elementQName, isWrapped);
-
- } finally {
- if (tccl != classLoader) {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
- }
-
- public static Object[] toObjects(ClassLoader classLoader, TypeHelper typeHelper, byte[] xmlBytes, boolean isWrapped) {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- if (tccl != classLoader) {
- Thread.currentThread().setContextClassLoader(classLoader);
- }
-
- return toObjects(typeHelper, xmlBytes, isWrapped);
-
- } finally {
- if (tccl != classLoader) {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
- }
-}
diff --git a/branches/java-M1/java/sca/databinding/sdo/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/databinding/sdo/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/databinding/sdo/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/databinding/sdo/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/databinding/sdo/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/databinding/sdo/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/databinding/sdo/src/main/resources/system.fragment b/branches/java-M1/java/sca/databinding/sdo/src/main/resources/system.fragment deleted file mode 100644 index a963af3e2e..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/main/resources/system.fragment +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- xmlns:tuscany="http://org.apache.tuscany/xmlns/system/0.9"
- name="org.apache.tuscany.databinding.sdo">
-
- <component name="org.apache.tuscany.databinding.sdo.ImportSDOLoader">
- <tuscany:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
- </component>
-
-</moduleFragment>
diff --git a/branches/java-M1/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java b/branches/java-M1/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java deleted file mode 100644 index 31815a97b4..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation or its licensors as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.core.config.ConfigurationLoadException; - -/** - * @version $Rev$ $Date$ - */ -public class ImportSDOLoaderTestCase extends LoaderTestSupport { - private ImportSDOLoader loader; - - public void testMinimal() throws XMLStreamException, ConfigurationLoadException { - String xml = "<import.sdo xmlns='http://www.osoa.org/xmlns/sca/0.9'/>"; - XMLStreamReader reader = getReader(xml); - assertNull(loader.load(reader, null)); - } - - public void testFactory() throws XMLStreamException, ConfigurationLoadException { - String xml = "<import.sdo xmlns='http://www.osoa.org/xmlns/sca/0.9' factory='org.apache.tuscany.databinding.sdo.ImportSDOLoaderTestCase$MockFactory'/>"; - XMLStreamReader reader = getReader(xml); - assertFalse(inited); - assertNull(loader.load(reader, loaderContext)); - assertTrue(inited); - } - - protected void setUp() throws Exception { - super.setUp(); - loader = new ImportSDOLoader(); - } - - private static boolean inited = false; - - public static class MockFactory { - public static Object INSTANCE; - - static { - ImportSDOLoaderTestCase.inited = true; - } - } -} - diff --git a/branches/java-M1/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/LoaderTestSupport.java b/branches/java-M1/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/LoaderTestSupport.java deleted file mode 100644 index 821a7220dd..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/LoaderTestSupport.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation or its licensors as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.databinding.sdo; - -import java.io.StringReader; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamException; -import javax.xml.namespace.QName; - -import junit.framework.TestCase; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.core.loader.LoaderContext; -import org.apache.tuscany.core.loader.assembly.*; -import org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl; -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; - -/** - * Base class for loader tests with common fixture elements. - * - * @version $Rev$ $Date$ - */ -public abstract class LoaderTestSupport extends TestCase { - protected SystemAssemblyFactory assemblyFactory; - protected ResourceLoader resourceLoader; - protected LoaderContext loaderContext; - protected AssemblyContext modelContext; - protected XMLInputFactory xmlFactory; - protected StAXLoaderRegistryImpl registry; - - protected static final StAXLoaderRegistryImpl.Monitor NULL_MONITOR = new StAXLoaderRegistryImpl.Monitor() { - public void registeringLoader(QName xmlType) { - } - - public void unregisteringLoader(QName xmlType) { - } - - public void elementLoad(QName xmlType) { - } - }; - - protected void setUp() throws Exception { - super.setUp(); - assemblyFactory = new SystemAssemblyFactoryImpl(); - resourceLoader = new ResourceLoaderImpl(getClass().getClassLoader()); - loaderContext = new LoaderContext(resourceLoader); - modelContext = new AssemblyContextImpl(assemblyFactory, null, resourceLoader); - xmlFactory = XMLInputFactory.newInstance(); - registry = new StAXLoaderRegistryImpl(); - registry.setMonitor(org.apache.tuscany.databinding.sdo.LoaderTestSupport.NULL_MONITOR); - } - - protected XMLStreamReader getReader(String xml) throws XMLStreamException { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml)); - reader.next(); - return reader; - } - - protected void registerLoader(AbstractLoader<?> loader) { - loader.setFactory(assemblyFactory); - loader.setRegistry(registry); - loader.start(); - } -} diff --git a/branches/java-M1/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOXMLHelperTestCase.java b/branches/java-M1/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOXMLHelperTestCase.java deleted file mode 100644 index b72fa93046..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOXMLHelperTestCase.java +++ /dev/null @@ -1,141 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.databinding.sdo;
-
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sdo.util.DataObjectUtil;
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.DataFactory;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.helper.XSDHelper;
-
-public class SDOXMLHelperTestCase extends TestCase {
-
- private TypeHelper typeHelper;
-
- public static final QName GREETING_QN = new QName("http://helloworldaxis.samples.tuscany.apache.org", "getGreetings");
-
- private static final String GREETING_NAME = "petra";
-
- private static final String GREETING_XML = "<helloworldaxis:in0>petra</helloworldaxis:in0>";
-
- private DataObject greetingDOB;
-
- private byte[] greetingXML;
-
- private ClassLoader appCL;
-
- public static final QName DOCLIT_QN = new QName("http://www.example.org/creditscore/doclit/", "getCreditScoreRequest");
-
- // private static final Object[] CUSTOMER = { "111-22-3333", "John", "Smith" };
-
- private DataObject nonWrappedDOB;
-
- public void testXMLBytes1() {
- byte[] xmlBytes = SDOXMLHelper.toXMLbytes(appCL, typeHelper, greetingDOB, GREETING_QN);
- assertNotNull(xmlBytes);
- assertTrue(new String(xmlBytes).contains("<helloworldaxis:in0>petra</helloworldaxis:in0>"));
- }
-
- public void testXMLBytes2() {
- byte[] xmlBytes = SDOXMLHelper.toXMLBytes(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true);
- assertNotNull(xmlBytes);
- assertTrue(new String(xmlBytes).contains(GREETING_XML));
- }
-
- // TODO: nonwrapped doesn't work
- // public void testXMLBytes3() {
- // byte[] xmlBytes = SDOXMLHelper.toXMLBytes(typeHelper, CUSTOMER, DOCLIT_QN, false);
- // assertNotNull(xmlBytes);
- // assertTrue(new String(xmlBytes).contains(DOC_LIT_XML));
- // }
-
- public void testToDataObject1() {
- DataObject dataObject = SDOXMLHelper.toDataObject(appCL, typeHelper, greetingXML);
- assertNotNull(dataObject);
- assertEquals(GREETING_NAME, dataObject.getString(0));
- }
-
- public void testToDataObject2() {
- DataObject dataObject = SDOXMLHelper.toDataObject(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true);
- assertNotNull(dataObject);
- assertEquals(GREETING_NAME, dataObject.getString(0));
- }
-
- // TODO: nonwrapped doesn't work
- // public void testToDataObject3() {
- // DataObject dataObject = SDOXMLHelper.toDataObject(typeHelper, CUSTOMER, DOCLIT_QN, false);
- // assertNotNull(dataObject);
- // assertEquals(CUSTOMER[0], dataObject.getString(0));
- // assertEquals(CUSTOMER[1], dataObject.getString(1));
- // assertEquals(CUSTOMER[2], dataObject.getString(2));
- // }
-
- public void testToObjects1() {
- Object[] os = SDOXMLHelper.toObjects(appCL, typeHelper, greetingXML, true);
- assertNotNull(os);
- assertEquals(1, os.length);
- assertEquals(GREETING_NAME, os[0]);
- }
-
- public void testToObjects2() {
- Object[] os = SDOXMLHelper.toObjects(greetingDOB, true);
- assertNotNull(os);
- assertEquals(1, os.length);
- assertEquals(GREETING_NAME, os[0]);
- }
-
- public void testToObjects3() {
- Object[] os = SDOXMLHelper.toObjects(nonWrappedDOB, false);
- assertNotNull(os);
- // assertEquals(3, os.length); TODO: non-wrapped doesn't seem to work
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- DataObjectUtil.initRuntime();
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- try {
- appCL = getClass().getClassLoader();
- Thread.currentThread().setContextClassLoader(appCL);
- typeHelper = SDOUtil.createTypeHelper();
- XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper);
- URL url = getClass().getResource("helloworld.wsdl");
- xsdHelper.define(url.openStream(), null);
- url = getClass().getResource("CreditScoreDocLit.wsdl");
- xsdHelper.define(url.openStream(), null);
- greetingDOB = SDOXMLHelper.toDataObject(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true);
- greetingXML = SDOXMLHelper.toXMLBytes(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true);
-
- DataFactory dataFactory = SDOUtil.createDataFactory(typeHelper);
- nonWrappedDOB = dataFactory.create("http://www.example.org/creditscore/doclit/", "Customer");
- nonWrappedDOB.setString(0, "111-22-3333");
- nonWrappedDOB.setString(1, "John");
- nonWrappedDOB.setString(2, "Smith");
-
- } finally {
- Thread.currentThread().setContextClassLoader(cl);
- }
- }
-}
diff --git a/branches/java-M1/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLit.wsdl b/branches/java-M1/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLit.wsdl deleted file mode 100644 index 09d1a58589..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLit.wsdl +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.example.org/creditscore/doclit/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditScore"
- targetNamespace="http://www.example.org/creditscore/doclit/">
- <wsdl:types>
- <xsd:schema
- targetNamespace="http://www.example.org/creditscore/doclit/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:element name="getCreditScoreRequest" type="tns:Customer" />
- <xsd:complexType name="Customer">
- <xsd:sequence>
- <xsd:element name="ssn" type="xsd:string" />
- <xsd:element name="firstName" type="xsd:string" />
- <xsd:element name="lastName" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:element name="getCreditScoreResponse" type="tns:CreditReport"/>
- <xsd:complexType name="CreditReport">
- <xsd:sequence>
- <xsd:element name="score" type="xsd:int"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="getCreditScoreResponse">
- <wsdl:part element="tns:getCreditScoreResponse"
- name="getCreditScoreResponse" />
- </wsdl:message>
- <wsdl:message name="getCreditScoreRequest">
- <wsdl:part element="tns:getCreditScoreRequest"
- name="getCreditScoreRequest" />
- </wsdl:message>
- <wsdl:portType name="CreditScoreDocLit">
- <wsdl:operation name="getCreditScore">
- <wsdl:input message="tns:getCreditScoreRequest" />
- <wsdl:output message="tns:getCreditScoreResponse" />
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="CreditScoreDocLitSOAP" type="tns:CreditScoreDocLit">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getCreditScore">
- <soap:operation
- soapAction="http://www.example.org/creditscore/doclit/getCreditScore" />
- <wsdl:input>
- <soap:body parts="getCreditScoreRequest" use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body parts="getCreditScoreResponse" use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="CreditScore">
- <wsdl:port binding="tns:CreditScoreDocLitSOAP"
- name="CreditScoreDocLitSOAP">
- <soap:address location="http://www.example.org/" />
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLitWrapped.wsdl b/branches/java-M1/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLitWrapped.wsdl deleted file mode 100644 index 3952c74809..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLitWrapped.wsdl +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.example.org/creditscore/doclitwrapped/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditScore"
- targetNamespace="http://www.example.org/creditscore/doclitwrapped/">
- <wsdl:types>
- <xsd:schema
- targetNamespace="http://www.example.org/creditscore/doclitwrapped/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:element name="getCreditScoreResponse">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="score" type="xsd:int" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="getCreditScore">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="ssn" type="xsd:string" />
- <xsd:element name="firstName" type="xsd:string" />
- <xsd:element name="lastName" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="getCreditScoreResponse">
- <wsdl:part element="tns:getCreditScoreResponse"
- name="getCreditScoreResponse" />
- </wsdl:message>
- <wsdl:message name="getCreditScoreRequest">
- <wsdl:part element="tns:getCreditScore"
- name="getCreditScoreRequest" />
- </wsdl:message>
- <wsdl:portType name="CreditScoreDocLitWrapped">
- <wsdl:operation name="getCreditScore">
- <wsdl:input message="tns:getCreditScoreRequest" />
- <wsdl:output message="tns:getCreditScoreResponse" />
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="CreditScoreDocLitWrappedSOAP" type="tns:CreditScoreDocLitWrapped">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getCreditScore">
- <soap:operation
- soapAction="http://www.example.org/creditscore/doclitwrapped/getCreditScore" />
- <wsdl:input>
- <soap:body parts="getCreditScoreRequest" use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body parts="getCreditScoreResponse" use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="CreditScore">
- <wsdl:port binding="tns:CreditScoreDocLitWrappedSOAP"
- name="CreditScoreDocLitWrappedSOAP">
- <soap:address location="http://localhost:8080/CreditScoreService/services/CreditScoreDocLitWrappedSOAP"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/helloworld.wsdl b/branches/java-M1/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/helloworld.wsdl deleted file mode 100644 index e9312949d3..0000000000 --- a/branches/java-M1/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/helloworld.wsdl +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="stockquote">
- <!--WSDL created by Apache Axis version: 1.2.1
-Built on Jun 14, 2005 (09:15:57 EDT)-->
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="in0" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
-
- <wsdl:part element="impl:getGreetings" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
-
- <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
-
- </wsdl:message>
-
- <wsdl:portType name="HelloWorldServiceImpl">
-
- <wsdl:operation name="getGreetings">
-
- <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
-
- <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
-
- </wsdl:operation>
-
- </wsdl:portType>
-
- <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
-
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <wsdl:operation name="getGreetings">
-
- <wsdlsoap:operation soapAction=""/>
-
- <wsdl:input name="getGreetingsRequest">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:input>
-
- <wsdl:output name="getGreetingsResponse">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:output>
-
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldServiceImplService">
-
- <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
-
- <!-- Tuscany SCA Service --> -<!--
- <wsdlsoap:address location="http://localhost:8080/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
---> - <wsdlsoap:address location="http://localhost:9876/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
-
- <!-- Axis Web Service -->
- <!-- - <wsdlsoap:address location="http://localhost:8081/helloworldaxissvc/services/helloworld"/>
- --> -
- </wsdl:port>
-
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/model/pom.xml b/branches/java-M1/java/sca/model/pom.xml deleted file mode 100644 index c1b74166aa..0000000000 --- a/branches/java-M1/java/sca/model/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project> - <parent> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-sca</artifactId> - <version>incubating-M1</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>tuscany-model</artifactId> - <name>Tuscany Assembly Model</name> - <description>Data model for the Assembly model defined by the SCA specification.</description> - <version>incubating-M1</version> - - <dependencies> - <dependency> - <groupId>org.osoa</groupId> - <artifactId>sca-api</artifactId> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-common</artifactId> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>commonj</groupId> - <artifactId>sdo-api</artifactId> - <version>incubating-M1</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-sdo-impl</artifactId> - <version>incubating-M1</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>wsdl4j</groupId> - <artifactId>wsdl4j</artifactId> - <version>1.5.2</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>asm</groupId> - <artifactId>asm</artifactId> - <version>2.2</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java deleted file mode 100644 index e167882786..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.model; - -import org.apache.tuscany.common.TuscanyRuntimeException; - -/** - * The root runtime exception for the model. - * - * @version $Rev$ $Date$ - */ -@SuppressWarnings({"serial"}) -public abstract class ModelRuntimeException extends TuscanyRuntimeException { - - public ModelRuntimeException() { - super(); - } - - public ModelRuntimeException(String message) { - super(message); - } - - public ModelRuntimeException(String message, Throwable cause) { - super(message, cause); - } - - public ModelRuntimeException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java deleted file mode 100644 index 48aed5f35a..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; - -import commonj.sdo.helper.TypeHelper; - -/** - * Context object supplied by visitors that are processing the model. - */ -public interface AssemblyContext { - - /** - * Returns a factory that can be used to create other model objects - * - * @return a factory for model objects - */ - AssemblyFactory getAssemblyFactory(); - - /** - * Returns a loader for resources in the application environment. - * - * @return a loader for resources in the system environment - */ - ResourceLoader getApplicationResourceLoader(); - - /** - * Returns a loader that can be used to load sub-models. - * - * @return a loader for sub-models - */ - AssemblyModelLoader getAssemblyLoader(); - - /** - * Returns an SDO type helper. - * - * @return an SDO type helper - */ - TypeHelper getTypeHelper(); - - /** - * Returns the Web application module URI - * - * @return the module name of the Web app - */ - String getWebAppName(); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java deleted file mode 100644 index efbc6bffa4..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java +++ /dev/null @@ -1,260 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.model.types.java.JavaServiceContract; -import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; - -/** - * The Factory for the assembly model. Provides a create method for each non-abstract class of the model. - */ -public interface AssemblyFactory { - - /** - * Returns a new SimpleComponent. - * - * @return a new SimpleComponent - */ - AtomicComponent createSimpleComponent(); - - /** - * Returns a new ComponentType. - * - * @return a new ComponentType - */ - ComponentType createComponentType(); - - /** - * Returns a new EntryPoint. - * - * @return a new EntryPoint - */ - EntryPoint createEntryPoint(); - - /** - * Returns a new ExternalService. - * - * @return a new ExternalService - */ - ExternalService createExternalService(); - - /** - * Returns a new JavaServiceContract. - * - * @return a new JavaServiceContract - */ - JavaServiceContract createJavaServiceContract(); - - /** - * Returns a new Module. - * - * @return a new Module - */ - Module createModule(); - - /** - * Returns a new ModuleComponent. - * - * @return a new ModuleComponent - */ - ModuleComponent createModuleComponent(); - - /** - * Returns a new ModuleFragment. - * - * @return a new ModuleFragment - */ - ModuleFragment createModuleFragment(); - - /** - * Returns a new Reference. - * - * @return a new Reference - */ - Reference createReference(); - - /** - * Returns a new ConfiguredReference. - * - * @return a new ConfiguredReference - */ - ConfiguredReference createConfiguredReference(); - - /** - * Returns a new Service. - * - * @return a new Service - */ - Service createService(); - - /** - * Returns a new ConfiguredService. - * - * @return a new ConfiguredService - */ - ConfiguredService createConfiguredService(); - - /** - * Returns a new Subsystem. - * - * @return a new Subsystem - */ - Subsystem createSubsystem(); - - /** - * Returns a new Property. - * - * @return a new Property - */ - Property createProperty(); - - /** - * Returns a new ConfiguredProperty. - * - * @return a new ConfiguredProperty - */ - ConfiguredProperty createConfiguredProperty(); - - /** - * Returns a new WSDLServiceContract. - * - * @return a new WSDLServiceContract - */ - WSDLServiceContract createWSDLServiceContract(); - - /** - * Create a new ServiceURI from the given uri string. - * - * @param uri the URI for the service - * @return a new ServiceURI created from the supplied URI - */ - ServiceURI createServiceURI(String uri); - - /** - * Creates a new ServiceURI from a module component and a service name. - * - * @param moduleComponent the module component exposing the service - * @param serviceName the name of the service exposed by the module - * @return a new ServiceURI for the exposed service - */ - ServiceURI createServiceURI(ModuleComponent moduleComponent, String serviceName); - - /** - * Creates a new ServiceURI from a module component and configured port. - * - * @param moduleComponent the module component exposing the service - * @param part the part that is providing the service - * @param configuredPort the port on the part - * @return a new serviceURI for the exposed service - */ - ServiceURI createServiceURI(ModuleComponent moduleComponent, Part part, ConfiguredPort configuredPort); - - ServiceURI createServiceURI(ModuleComponent moduleComponent, String partName, String serviceName); - - /** - * Create a qname from a URI - * - * @param uri - * @return a new qname - */ - QName createQName(String uri); - - /** - * Create a wire - * - * @return an new wire - */ - Wire createWire(); - - /** - * Helper method for creating a reference. - * - * @param name the name of the reference - * @param service the Java type of the service - * @return a Reference - */ - Reference createReference(String name, Class<?> service); - - /** - * Helper method for creating a reference. - * - * @param name the name of the reference - * @param service the Java type of the service - * @param multiplicity the multiplicity of the reference - * @return a Reference - */ - Reference createReference(String name, Class<?> service, Multiplicity multiplicity); - - /** - * Helper method for creating a configured reference. - * - * @param name the name of the reference - * @param targets the targets for the reference - * @return a ConfiguredReference - */ - ConfiguredReference createConfiguredReference(String name, String... targets); - - /** - * Helper method for creating an EntryPoint wired to a single target. - * - * @param entryPointName the name of the entry point - * @param serviceContract the service contract the EntryPoint should expose - * @param binding the binding the EntryPoint should use - * @param targetName the target the EntryPoint exposes - * @return an EntryPoint that exposes the supplied service and is wired to the target - */ - EntryPoint createEntryPoint(String entryPointName, ServiceContract serviceContract, Binding binding, String targetName); - - /** - * Helper method for creating an EntryPoint wired to a single target. - * - * @param entryPointName the name of the entry point - * @param configuredService the configured service to expose - * @param binding the binding the EntryPoint should use - * @param configuredReference a configured reference to the target - * @return an EntryPoint that exposes the supplied service using the supplied bindng and which is wired - * using the supplied reference - */ - EntryPoint createEntryPoint(String entryPointName, ConfiguredService configuredService, Binding binding, ConfiguredReference configuredReference); - - /** - * Helper method for creating a simple Property. - * - * @param name the property name - * @param type the Java type of the property - * @return a Property with the supplied name and type - */ - Property createProperty(String name, Class<?> type); - - /** - * Returns a new ImportWSDL model object. - * - * @return a new ImportWSDL model object - */ - ImportWSDL createImportWSDL(); - - /** - * Returns a new ImportWSDL model object initialized with the supplied values. - * - * @param location the location where the WSDL definition can be found - * @param namespace the namespace URI for this import - * @return a new ImportWSDL model object - */ - ImportWSDL createImportWSDL(String location, String namespace); -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java deleted file mode 100644 index 69a7854df9..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import org.apache.tuscany.model.ModelRuntimeException; - -/** - * Denotes an exception initializing an assembly model artifact. - * - * @version $Rev$ $Date$ - */ -public class AssemblyInitializationException extends ModelRuntimeException { - private static final long serialVersionUID = 747289653378365323L; - - public AssemblyInitializationException() { - super(); - } - - public AssemblyInitializationException(String message) { - super(message); - } - - public AssemblyInitializationException(String message, Throwable cause) { - super(message, cause); - } - - public AssemblyInitializationException(Throwable cause) { - super(cause); - } - -} - diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java deleted file mode 100644 index d25f114902..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * Base interface for all assembly model objects providing methods for managing the model itself. - */ -public interface AssemblyObject { - - /** - * Initialize this model object. - * - * @param modelContext context providing access to the environment in which this model is being used - * @throws AssemblyInitializationException if an error ocurrs initializing the artifact - */ - void initialize(AssemblyContext modelContext) throws AssemblyInitializationException; - - /** - * Freeze this model object preventing any additional changes. - */ - void freeze(); - - /** - * Accept a visitor - * - * @param visitor a visitor that is visiting the model - * @return true if processing is complete and the visitor should stop traversing the model - */ - boolean accept(AssemblyVisitor visitor); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java deleted file mode 100644 index f153b9b4f6..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * A visitor that traverses the model performing some operation. - */ -public interface AssemblyVisitor { - - /** - * Visit the given model object. - * - * @param modelObject the assembly model object to visit - * @return true if processing is complete - */ - boolean visit(AssemblyObject modelObject); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java deleted file mode 100644 index 0c98bbbe95..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - -/** - * An atomic component, specifically not an {@link Composite}. - */ -public interface AtomicComponent extends Component<AtomicImplementation> { -} -
\ No newline at end of file diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java deleted file mode 100644 index 4d0703186b..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - -/** - * The implementation for a specific atomic component instance. - * This interface will typically be extended by component type implementations to indicate the - * specific implementation to be used by a runtime and to allow for additional runtime configuration - * properties. - */ -public interface AtomicImplementation extends Implementation { - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java deleted file mode 100644 index 51becc29c2..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - -/** - * The binding of an entry point or external service to a transport. - * This model object will typically be extended by binding implementations to allow - * specification of binding/transport specific information. - */ -public interface Binding extends AssemblyObject { - /** - * Returns the binding URI. - * @return the binding uri - * TODO do we need this? - */ - String getURI(); - - /** - * Sets binding URI. - * @param value the binding uri - * TODO do we need this? - */ - void setURI(String value); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java deleted file mode 100644 index b8d566f1d6..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import java.util.List; - - -/** - * A component is a configured instance of a generic {@link Implementation}. - */ -public interface Component<I extends Implementation> extends Part { - - /** - * Returns the Implementation for this configured instance. - * @return the Implementation for this configured instance - */ - I getImplementation(); - - /** - * Sets the Implementation for this configured instance - * @param value the Implementation for this configured instance - */ - void setImplementation(I value); - - /** - * Returns a list of configured property values for this configured instance. - * These values will be used to initialize the component when it is activated. - * @return a list of ConfiguredProperty values - */ - List<ConfiguredProperty> getConfiguredProperties(); - - /** - * Returns the ConfiguredProperty value for the specified property. - * - * @param name the name of the Property - * @return the configured property value for the named property - */ - ConfiguredProperty getConfiguredProperty(String name); - - /** - * Returns the configured references for the configured instance. - * - * @return the configured references for the configured instance - */ - List<ConfiguredReference> getConfiguredReferences(); - - /** - * Returns the ConfiguredReference value for the specified reference. - * @param name the name of the Property - * @return the configured reference value for the named reference - */ - ConfiguredReference getConfiguredReference(String name); - - /** - * Returns the configured services for the configured instance. - * @return the configured services for the configured instance - */ - List<ConfiguredService> getConfiguredServices(); - - /** - * Returns the ConfiguredService value for the specified property. - * @param name the name of the Property - * @return the configured service value for the named service - */ - ConfiguredService getConfiguredService(String name); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java deleted file mode 100644 index 58ac9bc9de..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import java.util.List; - - -/** - * A logical definition of a type of component separate from any specific implementation. - */ -public interface ComponentType extends Extensible { - - /** - * Returns a list of services exposed by this component type. - * @return a list of services exposed by this component type - */ - List<Service> getServices(); - - /** - * Returns the specfied service if exposed by this component type. - * @param name the name of the service - * @return the service identified by the supplied name, or null if there is no service with that name - */ - Service getService(String name); - - /** - * Returns the list of references this component type consumes. - * @return the list of references this component type consumes - */ - List<Reference> getReferences(); - - /** - * Returns the specified reference. - * @param name the name of the reference - * @return the reference identified by the supplied name, or null if there is no reference with that name - */ - Reference getReference(String name); - - /** - * Returns the list of properties that can be used to configure components with this component type. - * @return the list of properties that can be used to configure components with this component type - */ - List<Property> getProperties(); - - /** - * Returns the specified property - * @param name the name of the property - * @return the property with the supplied name, or null if there is no property with that name - */ - Property getProperty(String name); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java deleted file mode 100644 index 09f51945bb..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import java.util.List; - -/** - * A model object that describes a container for parts. - */ -public interface Composite extends Implementation { - - /** - * Returns the name of the composite. - * @return the name of the composite - */ - String getName(); - - /** - * Sets the name of the composite. - * @param name the name of the composite - */ - void setName(String name); - - /** - * Returns the named part. - * @param name - */ - Part getPart(String name); - - /** - * Returns all entry points contained in this composite. - * @return a list of all EntryPoint model objects contained in this composite - */ - List<EntryPoint> getEntryPoints(); - - /** - * Returns all components contained in this composite. - * @return a list of all Component model objects contained in this composite - */ - List<Component> getComponents(); - - /** - * Returns all external services contained in this composite. - * @return a list of all ExternalService model objects contained in this composite - */ - List<ExternalService> getExternalServices(); - - /** - * Returns the wires contained in this composite. - */ - List<Wire> getWires(); - - /** - * Returns the WSDL imports declared in this composite. - */ - List<ImportWSDL> getWSDLImports(); - - /** - * Returns the WSDL imports for the given namespace. - * @param namespace - */ - List<ImportWSDL> getWSDLImports(String namespace); - - /** - * Returns the configured service at the given address. - * @param address - */ - ConfiguredService getConfiguredService(ServiceURI address); - - /** - * Returns the implementation class. - */ - Class<?> getImplementationClass(); - - /** - * Sets the implementation class. - */ - void setImplementationClass(Class<?> value); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java deleted file mode 100644 index c78fe28ff5..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * Specialization of Component that represents a configured {@link Module}. - */ -public interface CompositeComponent<I extends Composite> extends Component<I> { - - /** - * Returns the uri that uniquely identifies this module component. - * @return the uri that uniquely identifies this module component - */ - String getURI(); - - /** - * Sets the uri that uniquely identifies this module component. - * @param uri the uri that uniquely identifies this module component - */ - void setURI(String uri); -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java deleted file mode 100644 index 7f562e99d9..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - -/** - * Represents a configured port (e.g. a configured reference or configured service). - */ -public interface ConfiguredPort<P extends Port> extends AssemblyObject, ProxyFactoryHolder { - - /** - * Returns the name of the port being configured. - * - * @return the name of the port being configured - */ - String getName(); - - /** - * Set the name of the port being configured. - * - * @param name the name of the port being configured - */ - void setName(String name); - - /** - * Returns the port that is being configured. - * @return the port that is being configured - */ - P getPort(); - - /** - * Sets the port that is being configured. - * @param port the port that is being configured - */ - void setPort(P port); - - /** - * Returns the part containing this port. - * @return the part that contains this port - */ - Part getPart(); - - /** - * Sets the configured part containing this port. - * @param part the configured part containing this port. - */ - void setPart(Part part); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java deleted file mode 100644 index 0d3a3e5011..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * The configured value of a {@link Property}. - */ -public interface ConfiguredProperty extends AssemblyObject { - - //FIXME remove the name attribute? - /** - * Returns the name of the property being configured. - * @return the name of the property being configured - */ - String getName(); - - /** - * Set the name of the property being configured. - * @param name the name of the property being configured - */ - void setName(String name); - - /** - * Returns the {@link Property} whose value is being set. - * @return the {@link Property} whose value is being set - */ - Property getProperty(); - - /** - * Sets the {@link Property} whose value is being set. - * @param property the {@link Property} whose value is being set - */ - void setProperty(Property property); - - /** - * Returns the value being set for this usage of the {@link Property}. - * @return the value being set for this usage of the {@link Property} - */ - Object getValue(); - - /** - * Sets the value being set for this usage of the {@link Property}. - * @param value the value being set for this usage of the {@link Property} - */ - void setValue(Object value); - - /** - * Returns the override option that determines if any configuration for this property - * that is contained in this composite can be overridden by configuration supplied from outside. - */ - OverrideOption getOverrideOption(); - - /** - * Set the override option that determines if any configuration for this property - * that is contained in this composite can be overridden by configuration supplied from outside. - * - * @param value the option that determines how property configuration can be overriden - */ - void setOverrideOption(OverrideOption value); -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java deleted file mode 100644 index 22cb734869..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import java.util.List; - -/** - * A configured reference associated with a particular usage. - * Each configuredReference represents a configured version of an logical - * reference defined in the ComponentType. If the logical reference - * has a multiplicity greater than 1 (0..n or 1..n) then the configured - * reference many have multiple targets. - */ -public interface ConfiguredReference extends ConfiguredPort<Reference> { - - /** - * List of URIs for the targets of this reference. - * - * @return the list of URIs for the targets of this reference - */ - List<String> getTargets(); - - /** - * Returns the list of configured services that are wired to this configured reference. - * - * @return the list of configured services that are wired to this configured reference - */ - List<ConfiguredService> getTargetConfiguredServices(); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java deleted file mode 100644 index 696250ea44..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - -/** - * A configured service associated with a particular usage. - */ -public interface ConfiguredService extends ConfiguredPort<Service> { - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java deleted file mode 100644 index 20259f245d..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * A model object that can hold a runtime context factory object. - */ -public interface ContextFactoryHolder { - - /** - * Sets the context factory - */ - void setContextFactory(Object contextFactory); - - /** - * Returns the context factory - */ - Object getContextFactory(); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java deleted file mode 100644 index a90b89c4f5..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import java.util.List; - - -/** - * An entry point exposed by its containing {@link Composite}. - * References from outside the composite can only be connected to its entry points. - */ -public interface EntryPoint extends Part { - - /** - * Returns the bindings supported by this entry point. - * A single entry point may be bound to multiple transports. - * - * @return a list of bindings supported by this entry point - */ - List<Binding> getBindings(); - - /** - * Returns the configured service exposed by this entry point. - * - * @return the configured service exposed by this entry point - */ - ConfiguredService getConfiguredService(); - - /** - * Sets the configured service exposed by this entry point. - * - * @param configuredService the configured service exposed by this entry point - */ - void setConfiguredService(ConfiguredService configuredService); - - /** - * Returns the configured reference that wires this entry point to the published service - * inside the composite. - * - * @return the reference that wires this entry point to the published service - */ - ConfiguredReference getConfiguredReference(); - - /** - * Sets the configured reference that wires this entry point to the published service - * inside the composite. - * - * @param configuredReference the configured reference that wires this entry point to - * the published service inside the composite - */ - void setConfiguredReference(ConfiguredReference configuredReference); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java deleted file mode 100644 index b4651a6186..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import java.util.List; - -/** - * An extensible model object. We actually need this even though we have the ability to load specializations - * of individual model objects - */ -public interface Extensible extends AssemblyObject { - - /** - * Returns the extensibility elements. - */ - List<Object> getExtensibilityElements(); - - /** - * Returns the extensibility attributes. - */ - List<Object> getExtensibilityAttributes(); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java deleted file mode 100644 index f2b72ec928..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import java.util.List; - - -/** - * An external service consumed by its containing {@link Composite}. - * All references used by the composite are specified as external services. - */ -public interface ExternalService extends Part { - - /** - * Returns the bindings that can be used by operations on this external service. - * A single external service may be bound to multiple transports. - */ - List<Binding> getBindings(); - - /** - * Returns the override option that determines if any wiring for this external service - * that is contained in this composite can be overridden by wired supplied from outside. - */ - OverrideOption getOverrideOption(); - - /** - * Set the override option that determines if any wiring for this external service - * that is contained in this composite can be overridden by wired supplied from outside. - * - * @param value the option that determines how wires can be overriden - */ - void setOverrideOption(OverrideOption value); - - /** - * Returns the configured service that this external service provides to other parts of the containing composite. - * @return the configured service that this external service provides to other parts of the containing composite - */ - ConfiguredService getConfiguredService(); - - /** - * Sets the configured service that this external service provides to other parts of the containing composite - * @param configuredService the configured service that this external service provides to other parts of the containing composite - */ - void setConfiguredService(ConfiguredService configuredService); -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java deleted file mode 100644 index 2777d985f8..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - -/** - * The implementation for a specific component instance. - * This interface will typically be extended by component type implementations to indicate the - * specific implementation to be used by a runtime and to allow for additional runtime configuration - * properties. - */ -public interface Implementation extends Extensible { - - /** - * Returns the generic component type corresponding to this implementation. - * @return the generic component type corresponding to this implementation - */ - ComponentType getComponentType(); - - /** - * Sets the generic component type corresponding to this implementation. - * @param componentType the generic component type corresponding to this implementation - */ - void setComponentType(ComponentType componentType); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java deleted file mode 100644 index 7c858a1b76..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import javax.wsdl.Definition; - -/** - * Model object that represents the import of an external WSDL definition. - * - * @version $Rev$ $Date$ - */ -public interface ImportWSDL extends AssemblyObject { - /** - * Returns the location where the WSDL definition can be found. - * @return the location where the WSDL definition can be found - */ - String getLocation(); - - /** - * Set the location where the WSDL definition can be found. - * @param uri the location where the WSDL definition can be found - */ - void setLocation(String uri); - - /** - * Returns the namespace URI for this import. - * @return the namespace URI for this import - */ - String getNamespace(); - - /** - * Sets the namespace URI for this import. - * @param uri the namespace URI for this import - */ - void setNamespace(String uri); - - /** - * Returns the WSDL Definition. - * @return the WSDL Definition - */ - Definition getDefinition(); - - /** - * Sets the WSDL Definition. - * @param definition the WSDL Definition - */ - void setDefinition(Definition definition); -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java deleted file mode 100644 index 40d1d1534b..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -import java.util.List; - -/** - * A specialized {@link Implementation} that defines a modular unit of assembly. - * A Module denotes the extent of assembly in which pass-by-reference semantics are supported. - */ -public interface Module extends Composite { - - /** - * Returns a list of assembly fragments that combine to form a single module. - * @return a list of assembly fragments that combine to form a single module - */ - List<ModuleFragment> getModuleFragments(); - - /** - * Returns the specified assembly fragment. - * @param name the name of the fragment - * @return the fragment with the specified name, or null if there is no fragment with that name - */ - ModuleFragment getModuleFragment(String name); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java deleted file mode 100644 index 00f6079096..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * Specialization of Component that represents a configured {@link Module}. - */ -public interface ModuleComponent extends CompositeComponent<Module> { - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java deleted file mode 100644 index dec1e8bfd3..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * A fragment of assembly configuration within a module. - * To support flexibility and reuse, modules can be defined in multiple fragments that are - * then combined by the runtime to form the complete module definition. - */ -public interface ModuleFragment extends Composite { -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java deleted file mode 100644 index c51ab7b8ea..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * Enumeration for multiplicity. - */ -public enum Multiplicity { - /** - * Indicates a relationship that is optionally connected to the requestor and which, if supplied, - * must be connected to exactly one provider. - */ - ZERO_ONE, - - /** - * Indicates a relationship that must be connected between exactly one requestor and - * exactly one provider. - */ - ONE_ONE, - - /** - * Indicates a relationship that is optionally connects the requestor to zero to unbounded providers. - */ - ZERO_N, - - /** - * Indicates a relationship that must be connected at the requestor and which connects it to - * zero to unbounded providers. - */ - ONE_N - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java deleted file mode 100644 index 68489d0200..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * Enumeration for override options that are used to control whether configuration information - * can be overridden by larger grained definitions. - */ -public enum OverrideOption { - /** - * Indicates that the supplied configuration cannot be overridden. - */ - NO, - - /** - * Indicates that the supplied configuration may be overriden. - */ - MAY, - - /** - * Indicates that the supplied configuration must be overriden. - */ - MUST - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java deleted file mode 100644 index 9645ad6d35..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - - -/** - * A configured object that is contained inside a {@link Composite}. - */ -public interface Part extends Extensible, ContextFactoryHolder { - /** - * Returns the name that uniquely identifies this component within its containing composite. - * @return the name that uniquely identifies this component within its containing composite - */ - String getName(); - - /** - * Sets the name that uniquely identifies this component within its containing composite. - * @param value the name that uniquely identifies this component within its containing composite - */ - void setName(String value); - - /** - * Returns the composite that contains this component. - * @return the composite that contains this component - */ - Composite getComposite(); - - /** - * Sets the composite that contains this component. - * @param the composite that contains this component - */ - void setComposite(Composite composite); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java deleted file mode 100644 index 13b9d0a1db..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * Abstraction for the association of a service contract with a requestor or provider. - */ -public interface Port extends AssemblyObject { - /** - * Returns the contract for invocations of a service using this port. - * @return the oontract for invocations of a service using this port - */ - ServiceContract getServiceContract(); - - /** - * Set the contract for invocations of a service using this port. - * @param contract the contract for invocations of a service using this port - */ - void setServiceContract(ServiceContract contract); - - /** - * Returns the name of the port where it is associated with a requestor or provider. - * @return the name of the port - */ - String getName(); - - /** - * Sets the name of the port where it is associated with a requestor or provider. - * @param name the name of the port where it is associated with a requestor or provider - */ - void setName(String name); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java deleted file mode 100644 index 1f238efce6..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - - -/** - * A description of a property that can be used to configure a component. - */ -public interface Property extends Extensible { - // todo should we decalre this as Property<T> where T would be the type of this Property? - - /** - * Returns the property name. - * @return the property name - */ - String getName(); - - /** - * Sets the property name. - * @param name the property name - */ - void setName(String name); - - /** - * Returns the default value of the property. - * @return the default value of ths property - */ - Object getDefaultValue(); - - /** - * Sets the default value of the property. - * @param value the default value of ths property - */ - void setDefaultValue(Object value); - - /** - * Returns true if the property allows multiple values. - * @return true if the property allows multiple values - */ - boolean isMany(); - - /** - * Sets whether or not the property allows multiple values. - * @param value true if the property should allow multiple values - */ - void setMany(boolean value); - - /** - * Returns true if a value must be supplied for the property. - * @return true is a value must be supplied for the property - */ - boolean isRequired(); - - /** - * Sets whether a value must be supplied for the property. - * For ease of use, it is recommended that a meaningful default value should - * be supplied for all properties; users should only be required to specify - * a value if there is no reasonable default. - * - * @param value set to true to require that a value be supplied for uses of this property - */ - void setRequired(boolean value); - - /** - * Returns the type of this property as used by the runtime. - * @return the type of this property as used by the runtime - */ - Class<?> getType(); - - /** - * Sets the type of this property as used by the runtime - * @param value the type of this property as used by the runtime - */ - void setType(Class<?> value); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java deleted file mode 100644 index 055448b2f5..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * A model object that can hold a runtime proxy factory object. - */ -public interface ProxyFactoryHolder { - - /** - * Sets the proxy factory - */ - void setProxyFactory(Object proxyFactory); - - /** - * Returns the proxy factory - */ - Object getProxyFactory(); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java deleted file mode 100644 index 8cc13e98ec..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - -/** - * The association of a port with a requestor. - */ -public interface Reference extends Port { - /** - * Returns the multiplicity allowed for wires connected to this reference. - * @return the multiplicity allowed for wires connected to this reference - */ - Multiplicity getMultiplicity(); - - /** - * Sets the multiplicity allowed for wires connected to this reference. - * @param multiplicity the multiplicity allowed for wires connected to this reference - */ - void setMultiplicity(Multiplicity multiplicity); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java deleted file mode 100644 index c7194292f0..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * The types of scope supported by assemblies. - */ -public enum Scope { - // todo define what these are - INSTANCE, - REQUEST, - SESSION, - MODULE, - AGGREGATE, - UNDEFINED - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java deleted file mode 100644 index c73002efba..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - -/** - * The association of a port with a provider. - */ -public interface Service extends Port { -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java deleted file mode 100644 index 1600e11663..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * The contract specified by a requestor or provider for invocations across a port. - */ -public interface ServiceContract extends Extensible { - - /** - * Returns the interface for invocations from the requestor to the provider. - * @return the interface for invocations from the requestor to the provider - */ - Class getInterface(); - - /** - * Sets the interface for invocations from the requestor to the provider. - * @param value the interface for invocations from the requestor to the provider - */ - void setInterface(Class value); - - /** - * Returns the callback interface for wire from the provider back to its requestor. - * @return the callback interface for wire from the provider back to its requestor - */ - Class getCallbackInterface(); - - /** - * Sets the callback interface for wire from the provider back to its requestor. - * @param value the callback interface for wire from the provider back to its requestor - */ - void setCallbackInterface(Class value); - - /** - * Returns the scope of this service contract. - * @return - */ - Scope getScope(); - - /** - * Sets the scope. - * @param scope of this service contract. - */ - void setScope(Scope scope); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java deleted file mode 100644 index 740febc360..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - -/** - * Represents a service URI. - */ -public interface ServiceURI { - - /** - * Returns true if the address scheme is sca - * @return - */ - public boolean isSCAScheme(); - - /** - * @return Returns the address. - */ - public String getAddress(); - - /** - * @return Returns the path. - */ - public String getPath(); - - /** - * Returns the module component name - * @return - */ - public String getModuleComponentName(); - - /** - * Returns the part name - * @return - */ - public String getPartName(); - - /** - * Returns the service name - * @return - */ - public String getServiceName(); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java deleted file mode 100644 index 709ba4da35..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - - -/** - * Represents a subsystem. - */ -public interface Subsystem extends Composite { - - /** - * Returns the subsystem uri. - * @return - */ - String getURI(); - - /** - * Sets the subsystem uri. - * @param value - */ - void setURI(String value); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java deleted file mode 100644 index dfe553210a..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly; - - -/** - * A connection between a requestor (source) and a provider (target). - */ -public interface Wire extends Extensible { - /** - * Returns the URI for the source of the request. - * @return the URI for the source of the request - */ - ServiceURI getSource(); - - /** - * Sets the URI for the source of the request. - * @param uri the URI for the source of the request - */ - void setSource(ServiceURI uri); - - /** - * Returns the URI for the target of the request. - * @return the URI for the target of the request - */ - ServiceURI getTarget(); - - /** - * Sets the URI for the target of the request. - * @param uri the URI for the target of the request - */ - void setTarget(ServiceURI uri); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java deleted file mode 100644 index a7f9012db7..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; -import org.apache.tuscany.sdo.util.SDOUtil; - -import commonj.sdo.helper.TypeHelper; - -/** - */ -public class AssemblyContextImpl implements AssemblyContext { - - private final AssemblyFactory assemblyFactory; - private final AssemblyModelLoader assemblyLoader; - private final ResourceLoader applicationResourceLoader; - private final TypeHelper typeHelper; - private String webAppName; - - public AssemblyContextImpl(AssemblyModelLoader assemblyLoader, ResourceLoader resourceLoader) { - this(new AssemblyFactoryImpl(), assemblyLoader, resourceLoader); - } - - public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader) { - this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper()); - } - - public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, String webAppName) { - this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper(), webAppName); - } - public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, TypeHelper typeHelper) { - this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper(), null); - } - - public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, TypeHelper typeHelper, String webAppName) { - this.assemblyFactory = assemblyFactory; - this.assemblyLoader = assemblyLoader; - this.applicationResourceLoader = artifactLoader; - this.typeHelper=typeHelper; - this.webAppName=webAppName; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyContext#getAssemblyFactory() - */ - public AssemblyFactory getAssemblyFactory() { - return assemblyFactory; - } - - public ResourceLoader getApplicationResourceLoader() { - return applicationResourceLoader; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyContext#getAssemblyLoader() - */ - public AssemblyModelLoader getAssemblyLoader() { - return assemblyLoader; - } - - /** - * @see org.apache.tuscany.model.assembly.AssemblyContext#getTypeHelper() - */ - public TypeHelper getTypeHelper() { - return typeHelper; - } - - public String getWebAppName() { - return webAppName; - } -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java deleted file mode 100644 index c88ea4448f..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java +++ /dev/null @@ -1,217 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.model.assembly.Part; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.ConfiguredPort; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.ModuleFragment; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceURI; -import org.apache.tuscany.model.assembly.AtomicComponent; -import org.apache.tuscany.model.assembly.Subsystem; -import org.apache.tuscany.model.assembly.Wire; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.apache.tuscany.model.assembly.ImportWSDL; -import org.apache.tuscany.model.types.java.JavaServiceContract; -import org.apache.tuscany.model.types.java.impl.JavaServiceContractImpl; -import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; -import org.apache.tuscany.model.types.wsdl.impl.WSDLServiceContractImpl; - -/** - * Default implementation of AssemblyFactory - */ -public class AssemblyFactoryImpl implements AssemblyFactory { - - /** - * Constructor - */ - public AssemblyFactoryImpl() { - super(); - } - - public AtomicComponent createSimpleComponent() { - return new AtomicComponentImpl(); - } - - public ComponentType createComponentType() { - return new ComponentTypeImpl(); - } - - public EntryPoint createEntryPoint() { - return new EntryPointImpl(); - } - - public ExternalService createExternalService() { - return new ExternalServiceImpl(); - } - - public JavaServiceContract createJavaServiceContract() { - return new JavaServiceContractImpl(); - } - - public Module createModule() { - return new ModuleImpl(); - } - - public ModuleFragment createModuleFragment() { - return new ModuleFragmentImpl(); - } - - public ModuleComponent createModuleComponent() { - return new ModuleComponentImpl(); - } - - public Property createProperty() { - return new PropertyImpl(); - } - - public ConfiguredProperty createConfiguredProperty() { - return new ConfiguredPropertyImpl(); - } - - public Reference createReference() { - return new ReferenceImpl(); - } - - public ConfiguredReference createConfiguredReference() { - return new ConfiguredReferenceImpl(); - } - - public Service createService() { - return new ServiceImpl(); - } - - public ConfiguredService createConfiguredService() { - return new ConfiguredServiceImpl(); - } - - public Subsystem createSubsystem() { - return new SubsystemImpl(); - } - - public WSDLServiceContract createWSDLServiceContract() { - return new WSDLServiceContractImpl(); - } - - public ServiceURI createServiceURI(String uri) { - return new ServiceURIImpl(uri); - } - - public ServiceURI createServiceURI(ModuleComponent moduleComponent, String serviceName) { - return new ServiceURIImpl(moduleComponent, serviceName); - } - - public ServiceURI createServiceURI(ModuleComponent moduleComponent, Part part, ConfiguredPort configuredPort) { - return new ServiceURIImpl(moduleComponent, part, configuredPort); - } - - public ServiceURI createServiceURI(ModuleComponent moduleComponent, String partName, String serviceName) { - return new ServiceURIImpl(moduleComponent,partName,serviceName); - } - - public QName createQName(String uri) { - int h = uri.indexOf('#'); - return new QName(uri.substring(0, h), uri.substring(h + 1)); - } - - public Wire createWire() { - return new WireImpl(); - } - - public Reference createReference(String name, Class<?> service) { - return createReference(name,service,Multiplicity.ZERO_ONE); - } - - public Reference createReference(String name, Class<?> service, Multiplicity multiplicity){ - JavaServiceContract refContract = createJavaServiceContract(); - refContract.setInterface(service); - Reference reference = createReference(); - reference.setName(name); - reference.setServiceContract(refContract); - reference.setMultiplicity(multiplicity); - return reference; - } - - public ConfiguredReference createConfiguredReference(String name, String... targets) { - ConfiguredReference ref = createConfiguredReference(); - ref.setName(name); - for (String target : targets) { - ref.getTargets().add(target); - } - return ref; - } - - public EntryPoint createEntryPoint(String entryPointName, ServiceContract serviceContract, Binding binding, String targetName) { - // create and configure the exposed service - Service service = createService(); - service.setName(entryPointName); - service.setServiceContract(serviceContract); - ConfiguredService configuredService = createConfiguredService(); - configuredService.setPort(service); - - // create and configure a reference to target - Reference reference = createReference(); - reference.setMultiplicity(Multiplicity.ONE_ONE); - reference.setServiceContract(serviceContract); - ConfiguredReference configuredReference = createConfiguredReference(null, targetName); - configuredReference.setPort(reference); - - return createEntryPoint(entryPointName, configuredService, binding, configuredReference); - } - - public EntryPoint createEntryPoint(String entryPointName, ConfiguredService configuredService, Binding binding, ConfiguredReference configuredReference) { - EntryPoint entryPoint = createEntryPoint(); - entryPoint.setName(entryPointName); - entryPoint.setConfiguredService(configuredService); - entryPoint.setConfiguredReference(configuredReference); - entryPoint.getBindings().add((Binding)binding); - return entryPoint; - } - - public Property createProperty(String name, Class<?> type) { - Property property = createProperty(); - property.setName(name); - property.setType(type); - return property; - } - - public ImportWSDL createImportWSDL() { - return new ImportWSDLImpl(); - } - - public ImportWSDL createImportWSDL(String location, String namespace) { - ImportWSDL importWSDL = createImportWSDL(); - importWSDL.setLocation(location); - importWSDL.setNamespace(namespace); - return importWSDL; - } -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java deleted file mode 100644 index 38056e1e1c..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.AssemblyVisitor; - -/** - * A base class for assembly model objects. - */ -public abstract class AssemblyObjectImpl implements AssemblyObject { - - private boolean frozen; - private boolean initialized; - - protected AssemblyObjectImpl() { - } - - public boolean accept(AssemblyVisitor visitor) { - return visitor.visit(this); - } - - /** - * Walk a visitor through a collection of model objects. - * @param collection - * @param visitor - */ - protected boolean accept(Collection collection, AssemblyVisitor visitor) { - for (Object member : collection) { - if (member instanceof AssemblyObject) { - if (!((AssemblyObject)member).accept(visitor)) - return false; - } - } - return true; - } - - public void freeze() { - if (!frozen) - frozen=true; - } - - /** - * Returns true if the object is frozen - */ - protected boolean isFrozen() { - return frozen; - } - - /** - * Freeze a list and its members - */ - protected <T> List<T> freeze(List<T> list) { - list=Collections.unmodifiableList(list); - for (Object member : list) { - if (member instanceof AssemblyObject) { - ((AssemblyObject)member).freeze(); - } - } - return list; - } - - /** - * Check that the current model object can be modified. - * @throws IllegalStateException - */ - protected void checkNotFrozen() { - if (frozen) - throw new IllegalStateException("Attempt to modify a frozen assembly model"); - } - - public void initialize(AssemblyContext modelContext) { - if (!initialized) - initialized=true; - } - - /** - * Returns true if the object is initialized - */ - protected boolean isInitialized() { - return initialized; - } - - /** - * Initialize members of a collection - */ - protected void initialize(Collection collection, AssemblyContext modelContext) { - for (Object member : collection) { - if (member instanceof AssemblyObject) { - ((AssemblyObject)member).initialize(modelContext); - } - } - } - - /** - * Check that the current model object is initialized. - * @throws IllegalStateException - */ - protected void checkInitialized() { - if (!initialized) - throw new IllegalStateException("Attempt to use an uninitialized assembly model"); - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java deleted file mode 100644 index 186d685d12..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AtomicComponent; -import org.apache.tuscany.model.assembly.AtomicImplementation; - -/** - * An implementation of AtomicComponent. - */ -public class AtomicComponentImpl extends ComponentImpl<AtomicImplementation> implements AtomicComponent { - - protected AtomicComponentImpl() { - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java deleted file mode 100644 index 1f85afa2cc..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AtomicImplementation; - -/** - * An implementation of AtomicImplementation. - */ -public abstract class AtomicImplementationImpl extends ImplementationImpl implements AtomicImplementation { - - protected AtomicImplementationImpl() { - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java deleted file mode 100644 index c13dabb17e..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Binding; - -/** - * An implementation of Binding. - */ -public class BindingImpl extends ExtensibleImpl implements Binding { - - private String uri; - - protected BindingImpl() { - } - - public String getURI() { - return uri; - } - - public void setURI(String value) { - checkNotFrozen(); - uri=value; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - return true; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java deleted file mode 100644 index a952ebe34d..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyInitializationException; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.ConfiguredPort; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.util.NotifyingList; - -/** - * An implementation of Component. - */ -public abstract class ComponentImpl<I extends Implementation> extends PartImpl implements Component<I> { - - /** - * A list of configured ports synchronized with a map - */ - private class ConfiguredPortList<E extends ConfiguredPort> extends NotifyingList<E>{ - - Map<String, E> map; - - private ConfiguredPortList(Map<String, E> map) { - this.map=map; - } - - protected void added(E element) { - String name=element.getPort()!=null? element.getPort().getName():element.getName(); - map.put(name, element); - element.setPart(ComponentImpl.this); - } - protected void removed(E element) { - String name=element.getPort()!=null? element.getPort().getName():element.getName(); - map.remove(name); - element.setPart(null); - } - } - - private Map<String, ConfiguredReference> configuredReferencesMap = new HashMap<String, ConfiguredReference>(); - private List<ConfiguredReference> configuredReferences = new ConfiguredPortList<ConfiguredReference>(configuredReferencesMap); - - private Map<String, ConfiguredService> configuredServicesMap = new HashMap<String, ConfiguredService>(); - private List<ConfiguredService> configuredServices = new ConfiguredPortList<ConfiguredService>(configuredServicesMap); - - /** - * A list of properties synchronized with a map - */ - private class ConfiguredPropertyList<E extends ConfiguredProperty> extends NotifyingList<E>{ - - protected void added(E element) { - String name=element.getProperty()!=null? element.getProperty().getName():element.getName(); - configuredPropertiesMap.put(name, element); - } - protected void removed(E element) { - String name=element.getProperty()!=null? element.getProperty().getName():element.getName(); - configuredPropertiesMap.remove(name); - } - } - - private List<ConfiguredProperty> configuredProperties = new ConfiguredPropertyList<ConfiguredProperty>(); - private Map<String, ConfiguredProperty> configuredPropertiesMap=new HashMap<String, ConfiguredProperty>(); - - private I implementation; - - public I getImplementation() { - return implementation; - } - - public void setImplementation(I value) { - checkNotFrozen(); - implementation = value; - } - - public List<ConfiguredService> getConfiguredServices() { - return configuredServices; - } - - public ConfiguredService getConfiguredService(String name) { - return configuredServicesMap.get(name); - } - - public List<ConfiguredReference> getConfiguredReferences() { - return configuredReferences; - } - - public ConfiguredReference getConfiguredReference(String name) { - return configuredReferencesMap.get(name); - } - - public List<ConfiguredProperty> getConfiguredProperties() { - return configuredProperties; - } - - public ConfiguredProperty getConfiguredProperty(String name) { - return configuredPropertiesMap.get(name); - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize the implementation - if (implementation == null) { - throw new AssemblyInitializationException("No implementation for component [" + getName() + ']'); - } - implementation.initialize(modelContext); - - // Derive the configured services from the component implementation - ComponentType componentType=implementation.getComponentType(); - AssemblyFactory factory = modelContext.getAssemblyFactory(); - for (Service service : componentType.getServices()) { - ConfiguredService configuredService = factory.createConfiguredService(); - configuredService.setPort(service); - configuredServices.add(configuredService); - configuredService.initialize(modelContext); - } - - // Derive the configured references from the references on the component info - for (Reference reference : componentType.getReferences()) { - ConfiguredReference configuredReference = configuredReferencesMap.get(reference.getName()); - if (configuredReference==null) { - configuredReference=factory.createConfiguredReference(); - configuredReference.setPort(reference); - configuredReferences.add(configuredReference); - configuredReference.initialize(modelContext); - } else { - configuredReference.setPort(reference); - configuredReference.initialize(modelContext); - } - } - for (ConfiguredReference configuredReference : configuredReferences) { - if (configuredReference.getPort()==null) { - throw new AssemblyInitializationException("Undefined reference ["+configuredReference.getName()+"]"); - } - } - - // Derive the configured properties from the properties on the component info - for (Property property : componentType.getProperties()) { - ConfiguredProperty configuredProperty = configuredPropertiesMap.get(property.getName()); - if (configuredProperty != null) { - configuredProperty.setProperty(property); - configuredProperty.initialize(modelContext); - } - } - for (ConfiguredProperty configuredProperty : configuredProperties) { - if (configuredProperty.getProperty()==null) { - throw new AssemblyInitializationException("Undefined property ["+configuredProperty.getName()+"]"); - } - } - - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze configured services, references and properties - configuredServices = freeze(configuredServices); - configuredReferences = freeze(configuredReferences); - configuredProperties = freeze(configuredProperties); - if (implementation != null) - implementation.freeze(); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (!accept(configuredServices, visitor)) - return false; - if (!accept(configuredReferences, visitor)) - return false; - if (!accept(configuredProperties, visitor)) - return false; - if (implementation != null) { - if (!implementation.accept(visitor)) - return false; - } - - return true; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java deleted file mode 100644 index 617206b6af..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Port; -import org.apache.tuscany.model.assembly.Property; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.util.NotifyingList; - -/** - * An implementation of ComponentType. - */ -public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType { - - /** - * A list of ports synchronized with a map - */ - private class PortList<E extends Port> extends NotifyingList<E>{ - - Map<String, E> map; - - private PortList(Map<String, E> map) { - this.map=map; - } - - protected void added(E element) { - map.put(element.getName(), element); - } - protected void removed(E element) { - map.remove(element.getName()); - } - } - - private Map<String, Reference> referencesMap=new HashMap<String, Reference>(); - private List<Reference> references=new PortList<Reference>(referencesMap); - - private Map<String, Service> servicesMap=new HashMap<String, Service>(); - private List<Service> services=new PortList<Service>(servicesMap); - - /** - * A list of properties synchronized with a map - */ - private class PropertyList<E extends Property> extends NotifyingList<E>{ - - protected void added(E element) { - propertiesMap.put(element.getName(), element); - } - protected void removed(E element) { - propertiesMap.remove(element.getName()); - } - } - - private Map<String, Property> propertiesMap=new HashMap<String, Property>(); - private List<Property> properties=new PropertyList<Property>(); - - protected ComponentTypeImpl() { - } - - public List<Reference> getReferences() { - return references; - } - - public Reference getReference(String name) { - return referencesMap.get(name); - } - - public List<Service> getServices() { - return services; - } - - public Service getService(String name) { - return servicesMap.get(name); - } - - public List<Property> getProperties() { - return properties; - } - - public Property getProperty(String name) { - return propertiesMap.get(name); - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize references, properties and services - for (Reference reference : references) { - reference.initialize(modelContext); - } - for (Property property : properties) { - property.initialize(modelContext); - } - for (Service service : services) { - service.initialize(modelContext); - } - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze lists of services, references and properties - services=freeze(services); - references=freeze(references); - properties=freeze(properties); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (!accept(services, visitor)) - return false; - if (!accept(references, visitor)) - return false; - if (!accept(properties, visitor)) - return false; - - return true; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java deleted file mode 100644 index fff32e3398..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java +++ /dev/null @@ -1,357 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Composite; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.ImportWSDL; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.OverrideOption; -import org.apache.tuscany.model.assembly.Part; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.apache.tuscany.model.assembly.ServiceURI; -import org.apache.tuscany.model.assembly.Wire; -import org.apache.tuscany.model.util.NotifyingList; - -/** - * An implementation of Composite. - */ -public abstract class CompositeImpl extends ExtensibleImpl implements Composite { - - private String name; - private ComponentType componentType; - private Class<?> implementationClass; - - /** - * A list of parts synchronized with a map - */ - private class PartList<E extends Part> extends NotifyingList<E> { - protected void added(E element) { - partsMap.put(element.getName(), element); - element.setComposite(CompositeImpl.this); - } - - protected void removed(E element) { - partsMap.remove(element.getName()); - element.setComposite(null); - } - } - - private Map<String, Part> partsMap = new HashMap<String, Part>(); - - private List<Component> components = new PartList<Component>(); - private List<EntryPoint> entryPoints = new PartList<EntryPoint>(); - private List<ExternalService> externalServices = new PartList<ExternalService>(); - - private List<Wire> wires = new ArrayList<Wire>(); - - /** - * A list of WSDL imports synchronized with a map - */ - private class ImportWSDLList extends NotifyingList<ImportWSDL> { - protected void added(ImportWSDL element) { - List<ImportWSDL> importList = wsdlImportsMap.get(element.getNamespace()); - if (importList == null) { - importList = new ArrayList<ImportWSDL>(); - wsdlImportsMap.put(element.getNamespace(), importList); - } - importList.add(element); - } - - protected void removed(ImportWSDL element) { - List<ImportWSDL> importList = wsdlImportsMap.get(element.getNamespace()); - if (importList != null) { - importList.remove(element); - if (importList.isEmpty()) - wsdlImportsMap.remove(element.getNamespace()); - } - } - } - - private Map<String, List<ImportWSDL>> wsdlImportsMap = new HashMap<String, List<ImportWSDL>>(); - - private List<ImportWSDL> wsdlImports = new ImportWSDLList(); - - protected CompositeImpl() { - } - - public String getName() { - return name; - } - - public void setName(String newName) { - checkNotFrozen(); - name = newName; - } - - public List<Component> getComponents() { - return components; - } - - public List<EntryPoint> getEntryPoints() { - return entryPoints; - } - - public List<ExternalService> getExternalServices() { - return externalServices; - } - - public Part getPart(String name) { - return partsMap.get(name); - } - - public List<Wire> getWires() { - return wires; - } - - public List<ImportWSDL> getWSDLImports() { - return wsdlImports; - } - - public List<ImportWSDL> getWSDLImports(String namespace) { - return wsdlImportsMap.get(namespace); - } - - public ComponentType getComponentType() { - return componentType; - } - - public void setComponentType(ComponentType componentType) { - checkNotFrozen(); - this.componentType = componentType; - } - - public ConfiguredService getConfiguredService(ServiceURI address) { - String partName = address.getPartName(); - String serviceName = address.getServiceName(); - Part part = getPart(partName); - if (part instanceof Component) { - Component<?> component = (Component<?>) part; - if (serviceName != null) { - return component.getConfiguredService(serviceName); - } else { - if (!component.getConfiguredServices().isEmpty()) { - return component.getConfiguredServices().get(0); - } else { - return null; - } - } - - } - if (part instanceof ExternalService) { - ExternalService externalService = (ExternalService) part; - return externalService.getConfiguredService(); - } else - return null; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize WSDL imports - for (ImportWSDL importWSDL : wsdlImports) { - importWSDL.initialize(modelContext); - } - - // Initialize parts - for (Part part : externalServices) { - part.initialize(modelContext); - } - for (Part part : components) { - part.initialize(modelContext); - } - for (Part part : entryPoints) { - part.initialize(modelContext); - } - - // Derive the component type from the entry points and external services in the composite - // Also derive properties from the overridable properties of the components in the composite - if (componentType == null) { - AssemblyFactory factory = modelContext.getAssemblyFactory(); - componentType = factory.createComponentType(); - for (EntryPoint entryPoint : getEntryPoints()) { - Service service = factory.createService(); - service.setName(entryPoint.getName()); - ServiceContract serviceContract = entryPoint.getConfiguredService().getPort().getServiceContract(); - if (serviceContract != null) - service.setServiceContract(serviceContract); - componentType.getServices().add(service); - - ConfiguredReference configuredReference = entryPoint.getConfiguredReference(); - ServiceURI sourceURI = factory.createServiceURI(null, entryPoint, configuredReference); - for (String target : configuredReference.getTargets()) { - ServiceURI targetURI = factory.createServiceURI(null, target); - Wire wire = factory.createWire(); - wire.setSource(sourceURI); - wire.setTarget(targetURI); - getWires().add(wire); - } - } - for (ExternalService externalService : getExternalServices()) { - if (externalService.getOverrideOption() == null || externalService.getOverrideOption() == OverrideOption.NO) - continue; - Reference reference = factory.createReference(); - reference.setName(externalService.getName()); - ServiceContract serviceContract = externalService.getConfiguredService().getPort().getServiceContract(); - if (serviceContract != null) - reference.setServiceContract(serviceContract); - componentType.getReferences().add(reference); - } - for (Component<Implementation> component : getComponents()) { - for (ConfiguredProperty configuredProperty : component.getConfiguredProperties()) { - if (configuredProperty.getOverrideOption() == null || configuredProperty.getOverrideOption() == OverrideOption.NO) - continue; - componentType.getProperties().add(configuredProperty.getProperty()); - } - - for (ConfiguredReference configuredReference : component.getConfiguredReferences()) { - // Create a wire - ServiceURI sourceURI = factory.createServiceURI(null, component, configuredReference); - for (String target : configuredReference.getTargets()) { - ServiceURI targetURI = factory.createServiceURI(null, target); - Wire wire = factory.createWire(); - wire.setSource(sourceURI); - wire.setTarget(targetURI); - getWires().add(wire); - } - } - } - } - componentType.initialize(modelContext); - - // Wire the parts in this composite - wire(modelContext); - } - - /** - * Wire the parts in this composite. - * @param modelContext - */ - protected void wire(AssemblyContext modelContext) { - for (Wire wire : getWires()) { - - // Get the source reference - ServiceURI sourceURI = wire.getSource(); - ConfiguredReference configuredReference = null; - String partName = sourceURI.getPartName(); - String referenceName = sourceURI.getServiceName(); - if (referenceName != null) { - //Component<?> component = (Component<?>)getPart(partName); -// if (component != null) { - Part part = getPart(partName); - if (part instanceof Component) { - configuredReference = ((Component) part).getConfiguredReference(referenceName); - } else if (part instanceof EntryPoint) { - configuredReference = ((EntryPoint) part).getConfiguredReference(); - } - } else { - EntryPoint entryPoint = (EntryPoint) getPart(partName); - if (entryPoint != null) { - configuredReference = entryPoint.getConfiguredReference(); - } - } - if (configuredReference == null) { - throw new IllegalArgumentException("Cannot find wire source " + sourceURI.getPath()); - } else { - - // Resolve the target service endpoint - ServiceURI targetURI = wire.getTarget(); - ConfiguredService configuredService = getConfiguredService(targetURI); - if (configuredService != null) { - - // Wire the reference to the target - Multiplicity multiplicity = configuredReference.getPort().getMultiplicity(); - if (multiplicity == Multiplicity.ZERO_N || multiplicity == Multiplicity.ONE_N) { - configuredReference.getTargetConfiguredServices().add(configuredService); - } else { - configuredReference.getTargetConfiguredServices().clear(); - configuredReference.getTargetConfiguredServices().add(configuredService); - } - } else { - throw new IllegalArgumentException("Cannot find service '" + targetURI.getPath() +"'."); - } - } - } - } - - public Class<?> getImplementationClass() { - return implementationClass; - } - - public void setImplementationClass(Class<?> clazz) { - checkNotFrozen(); - this.implementationClass = clazz; - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze component type - if (componentType != null) - componentType.freeze(); - - // Freeze lists - wsdlImports = freeze(wsdlImports); - components = freeze(components); - entryPoints = freeze(entryPoints); - externalServices = freeze(externalServices); - wires = freeze(wires); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (!accept(wsdlImports, visitor)) - return false; - - if (!accept(partsMap.values(), visitor)) - return false; - - if (!accept(wires, visitor)) - return false; - - if (componentType != null) { - if (!componentType.accept(visitor)) - return false; - } - - return true; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java deleted file mode 100644 index f1007e8c07..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Part; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.ConfiguredPort; -import org.apache.tuscany.model.assembly.Port; - -/** - * Implementation of ConfiguredPort. - */ -public abstract class ConfiguredPortImpl<P extends Port> extends AssemblyObjectImpl implements ConfiguredPort<P> { - private String name; - private Part part; - private P port; - - private Object proxyFactory; - - protected ConfiguredPortImpl() { - } - - public String getName() { - return name; - } - - public void setName(String name) { - checkNotFrozen(); - this.name=name; - } - - public P getPort() { - return port; - } - - public void setPort(P port) { - checkNotFrozen(); - this.port = port; - } - - public Part getPart() { - return part; - } - - public void setPart(Part part) { - checkNotFrozen(); - this.part=part; - } - - public Object getProxyFactory() { - return proxyFactory; - } - - public void setProxyFactory(Object proxyFactory) { - checkNotFrozen(); - this.proxyFactory = proxyFactory; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - if (port!=null) { - name=port.getName(); - port.initialize(modelContext); - } - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - if (port!=null) - port.freeze(); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (port!=null) { - if (!port.accept(visitor)) - return false; - } - - return true; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java deleted file mode 100644 index 4c64676451..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.OverrideOption; -import org.apache.tuscany.model.assembly.Property; - -/** - * Implementation of ConfiguredProperty - */ -public class ConfiguredPropertyImpl extends AssemblyObjectImpl implements ConfiguredProperty { - private String name; - private OverrideOption overrideOption; - private Object value; - private Property property; - - protected ConfiguredPropertyImpl() { - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Property getProperty() { - return property; - } - - public void setProperty(Property property) { - checkNotFrozen(); - this.property = property; - } - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - checkNotFrozen(); - this.value = value; - } - - public OverrideOption getOverrideOption() { - return overrideOption; - } - - public void setOverrideOption(OverrideOption value) { - checkNotFrozen(); - this.overrideOption=value; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - if (property!=null) - property.initialize(modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - if (property!=null) - property.freeze(); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (property!=null) { - if (!property.accept(visitor)) - return false; - } - - return true; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java deleted file mode 100644 index f21a5be52e..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Reference; - -/** - * An implementation of ConfiguredReference. - */ -public class ConfiguredReferenceImpl extends ConfiguredPortImpl<Reference> implements ConfiguredReference { - - private List<String> targets = new ArrayList<String>(); - - private List<ConfiguredService> targetConfiguredServices = new ArrayList<ConfiguredService>(); - - protected ConfiguredReferenceImpl() { - } - - public List<String> getTargets() { - return targets; - } - - public List<ConfiguredService> getTargetConfiguredServices() { - return targetConfiguredServices; - } - - public void freeze() { - super.freeze(); - - targetConfiguredServices = freeze(targetConfiguredServices); - targets = freeze(targets); - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java deleted file mode 100644 index 923af1882c..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Service; - -/** - * An implementation of ConfiguredService. - */ -public class ConfiguredServiceImpl extends ConfiguredPortImpl<Service> implements ConfiguredService { - - protected ConfiguredServiceImpl() { - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java deleted file mode 100644 index a894a7c48f..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; - -/** - * An implementation of EntryPoint. - */ -public class EntryPointImpl extends PartImpl implements EntryPoint { - - private ConfiguredService configuredService; - private ConfiguredReference configuredReference; - private List<Binding> bindings=new ArrayList<Binding>(); - - protected EntryPointImpl() { - } - - public ConfiguredReference getConfiguredReference() { - return configuredReference; - } - - public void setConfiguredReference(ConfiguredReference configuredReference) { - checkNotFrozen(); - configuredReference.setPart(this); - this.configuredReference=configuredReference; - } - - public ConfiguredService getConfiguredService() { - return configuredService; - } - - public void setConfiguredService(ConfiguredService configuredService) { - checkNotFrozen(); - configuredService.setPart(this); - this.configuredService=configuredService; - } - - public List<Binding> getBindings() { - return bindings; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize the service contract and reference to the published service - if (configuredReference != null) { - configuredReference.initialize(modelContext); - } - if (configuredService != null) { - configuredService.initialize(modelContext); - } - - // Initialize the bindings - initialize(bindings, modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze the service contract and configured reference - if (configuredReference != null) - configuredReference.freeze(); - if (configuredService != null) - configuredService.freeze(); - - // Freeze the bindings - bindings=freeze(bindings); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (configuredReference!=null) { - if (!configuredReference.accept(visitor)) - return false; - } - - if (configuredService!=null) { - if (!configuredService.accept(visitor)) - return false; - } - - if (!accept(bindings, visitor)) - return false; - - return true; - } -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java deleted file mode 100644 index 6adf66dc9e..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Extensible; - -/** - * An implementation of Extensible. - */ -public abstract class ExtensibleImpl extends AssemblyObjectImpl implements Extensible { - - private List<Object> extensibilityElements = new ArrayList<Object>(); - private List<Object> extensibilityAttributes = new ArrayList<Object>(); - - protected ExtensibleImpl() { - } - - public List<Object> getExtensibilityElements() { - return extensibilityElements; - } - - public List<Object> getExtensibilityAttributes() { - return extensibilityAttributes; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize extensibility elements and attributes - initialize(extensibilityElements, modelContext); - initialize(extensibilityAttributes, modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze extensibility elements and attributes - freeze(extensibilityElements); - freeze(extensibilityAttributes); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (!accept(extensibilityElements, visitor)) - return false; - return accept(extensibilityAttributes, visitor); - - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java deleted file mode 100644 index 9110731c34..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.OverrideOption; - -/** - * An implementation ExternalService. - */ -public class ExternalServiceImpl extends PartImpl implements ExternalService { - - private ConfiguredService configuredService; - private OverrideOption overrideOption; - private List<Binding> bindings=new ArrayList<Binding>(); - - private Object contextFactory; - - protected ExternalServiceImpl() { - } - - public OverrideOption getOverrideOption() { - return overrideOption; - } - - public void setOverrideOption(OverrideOption newOverridable) { - checkNotFrozen(); - overrideOption=newOverridable; - } - - public List<Binding> getBindings() { - return bindings; - } - - public ConfiguredService getConfiguredService() { - return configuredService; - } - - public void setConfiguredService(ConfiguredService configuredService) { - checkNotFrozen(); - configuredService.setPart(this); - this.configuredService=configuredService; - } - - public Object getContextFactory() { - return contextFactory; - } - - public void setContextFactory(Object contextFactory) { - this.contextFactory=contextFactory; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize the configured service - if (configuredService != null) { - configuredService.initialize(modelContext); - } - - // Initialize the bindings - initialize(bindings, modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - // Freeze the configured service - if (configuredService!= null) - configuredService.freeze(); - - // Freeze the bindings - bindings=freeze(bindings); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (configuredService!=null) { - if (!configuredService.accept(visitor)) - return false; - } - - if (!accept(bindings, visitor)) - return false; - - return true; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java deleted file mode 100644 index a44d80cc66..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Implementation; - -/** - * An implementation of Implementation. - */ -public abstract class ImplementationImpl extends ExtensibleImpl implements Implementation { - - private ComponentType componentType; - - public ComponentType getComponentType() { - return componentType; - } - - public void setComponentType(ComponentType componentType) { - checkNotFrozen(); - this.componentType=componentType; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Initialize the component type - if (componentType!=null) { - componentType.initialize(modelContext); - } - - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - if (componentType!=null) - componentType.freeze(); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (componentType!=null) { - if (!componentType.accept(visitor)) - return false; - } - return true; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java deleted file mode 100644 index 56aedd18f5..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.net.URL; - -import javax.wsdl.Definition; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.ImportWSDL; - -/** - * Implementation of ImportWSDL. - * - * @version $Rev$ $Date$ - */ -public class ImportWSDLImpl extends AssemblyObjectImpl implements ImportWSDL { - private String location; - private String namespace; - private Definition definition; - - protected ImportWSDLImpl() { - } - - public String getLocation() { - return location; - } - - public void setLocation(String uri) { - checkNotFrozen(); - this.location = uri; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String uri) { - checkNotFrozen(); - this.namespace = uri; - } - - public Definition getDefinition() { - return definition; - } - - public void setDefinition(Definition definition) { - checkNotFrozen(); - this.definition = definition; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Load the WSDL definition if necessary - ResourceLoader resourceLoader = modelContext.getApplicationResourceLoader(); - if (definition == null) { - URL url = resourceLoader.getResource(location); - if (url == null) - throw new IllegalArgumentException("Cannot find " + location); - definition = modelContext.getAssemblyLoader().loadDefinition(url.toString()); - } - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java deleted file mode 100644 index 60cb42a981..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; - -/** - * An implementation of ModuleComponent. - */ -public class ModuleComponentImpl extends ComponentImpl<Module> implements ModuleComponent { - - private String uri; - - protected ModuleComponentImpl() { - } - - public String getURI() { - return uri; - } - - public void setURI(String value) { - checkNotFrozen(); - uri=value; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java deleted file mode 100644 index 08536d23b8..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.ModuleFragment; - -/** - * An implementation of ModuleFragment. - */ -public class ModuleFragmentImpl extends CompositeImpl implements ModuleFragment { - - protected ModuleFragmentImpl() { - } - - protected void wire(AssemblyContext modelContext) { - // No wiring inside a module fragment - // Wires are handled at the module level - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java deleted file mode 100644 index f64317ac86..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleFragment; -import org.apache.tuscany.model.util.NotifyingList; - -/** - * An implementation of Module. - */ -public class ModuleImpl extends CompositeImpl implements Module { - - /** - * A list of module fragments synchronized with a map - */ - private class ModuleFragmentList<E extends ModuleFragment> extends NotifyingList<E> { - protected void added(E element) { - moduleFragmentsMap.put(element.getName(), element); - } - - protected void removed(E element) { - moduleFragmentsMap.remove(element.getName()); - } - } - - private List<ModuleFragment> moduleFragments = new ModuleFragmentList<ModuleFragment>(); - private Map<String, ModuleFragment> moduleFragmentsMap = new HashMap<String, ModuleFragment>(); - - /** - * Constructor - */ - protected ModuleImpl() { - } - - public List<ModuleFragment> getModuleFragments() { - return moduleFragments; - } - - public ModuleFragment getModuleFragment(String name) { - checkInitialized(); - return moduleFragmentsMap.get(name); - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - - // Initialize module fragments - for (ModuleFragment moduleFragment : moduleFragments) { - - // Add all WSDL imports, components, entry points and external services from the module fragments - getWSDLImports().addAll(moduleFragment.getWSDLImports()); - getComponents().addAll(moduleFragment.getComponents()); - getEntryPoints().addAll(moduleFragment.getEntryPoints()); - getExternalServices().addAll(moduleFragment.getExternalServices()); - - // Add all the wires from the module fragments - getWires().addAll(moduleFragment.getWires()); - - moduleFragment.initialize(modelContext); - } - - // Initialize the composite - super.initialize(modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - moduleFragments = freeze(moduleFragments); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - return accept(moduleFragments, visitor); - - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java deleted file mode 100644 index 3743c7505b..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Composite; -import org.apache.tuscany.model.assembly.Part; - -/** - * Implementation of Part. - */ -public abstract class PartImpl extends ExtensibleImpl implements Part { - private Composite composite; - private String name; - - private Object contextFactory; - - protected PartImpl() { - } - - public String getName() { - return name; - } - - public void setName(String value) { - checkNotFrozen(); - name=value; - } - - public Composite getComposite() { - return composite; - } - - public void setComposite(Composite composite) { - checkNotFrozen(); - this.composite=composite; - } - - public Object getContextFactory() { - return contextFactory; - } - - public void setContextFactory(Object contextFactory) { - checkNotFrozen(); - this.contextFactory=contextFactory; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java deleted file mode 100644 index c11cee590a..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.Port; -import org.apache.tuscany.model.assembly.ServiceContract; - -/** - * An implementation of Port. - */ -public abstract class PortImpl extends AssemblyObjectImpl implements Port { - - private ServiceContract serviceContract; - private String name; - - protected PortImpl() { - } - - public String getName() { - return name; - } - - public void setName(String value) { - checkNotFrozen(); - name=value; - } - - public ServiceContract getServiceContract() { - return serviceContract; - } - - public void setServiceContract(ServiceContract value) { - checkNotFrozen(); - serviceContract=value; - } - - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - if (serviceContract!=null) - serviceContract.initialize(modelContext); - } - - public void freeze() { - if (isFrozen()) - return; - super.freeze(); - - if (serviceContract!=null) - serviceContract.freeze(); - } - - public boolean accept(AssemblyVisitor visitor) { - if (!super.accept(visitor)) - return false; - - if (serviceContract!=null) { - if (!serviceContract.accept(visitor)) - return false; - } - - return true; - } -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java deleted file mode 100644 index e91245504b..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Property; - -/** - * An implementation of Property. - */ -public class PropertyImpl extends ExtensibleImpl implements Property { - - private Object defaultValue; - private String name; - private boolean many; - private boolean required; - private Class<?> type; - - protected PropertyImpl() { - } - - public Object getDefaultValue() { - return defaultValue; - } - - public String getName() { - return name; - } - - public Class<?> getType() { - return type; - } - - public boolean isMany() { - return many; - } - - public boolean isRequired() { - return required; - } - - public void setDefaultValue(Object value) { - checkNotFrozen(); - defaultValue = value; - } - - public void setMany(boolean value) { - checkNotFrozen(); - many = value; - } - - public void setName(String value) { - checkNotFrozen(); - name = value; - } - - public void setRequired(boolean value) { - checkNotFrozen(); - required = value; - } - - public void setType(Class<?> value) { - checkNotFrozen(); - type = value; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java deleted file mode 100644 index 1a064e5092..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Reference; - -/** - * An implementation of Reference. - */ -public class ReferenceImpl extends PortImpl implements Reference { - - private Multiplicity multiplicity; - - protected ReferenceImpl() { - } - - public Multiplicity getMultiplicity() { - return multiplicity; - } - - public void setMultiplicity(Multiplicity multiplicity) { - checkNotFrozen(); - this.multiplicity=multiplicity; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java deleted file mode 100644 index f71702792b..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.ServiceContract; - -/** - * An implementation of ServiceContract. - */ -public class ServiceContractImpl extends ExtensibleImpl implements ServiceContract { - - private Class interface_; - private Class callbackInterface; - private Scope scope; - - protected ServiceContractImpl() { - } - - public Class getCallbackInterface() { - return callbackInterface; - } - - public Class getInterface() { - return interface_; - } - - public Scope getScope() { - return scope; - } - - public void setCallbackInterface(Class value) { - checkNotFrozen(); - callbackInterface=value; - } - - public void setInterface(Class value) { - checkNotFrozen(); - interface_=value; - } - - public void setScope(Scope scope) { - checkNotFrozen(); - this.scope=scope; - } -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java deleted file mode 100644 index d1432d0149..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.Service; - -/** - * An implementation of Service. - */ -public class ServiceImpl extends PortImpl implements Service { - - protected ServiceImpl() { - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java deleted file mode 100644 index ef180814ff..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java +++ /dev/null @@ -1,210 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.ConfiguredPort; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.Part; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceURI; - -/** - * An implementation of ServiceURI. - */ -public class ServiceURIImpl implements ServiceURI { - - private String address; - private Boolean isSCAScheme; - private boolean isParsed; - private String moduleComponentName; - private String partName; - private String serviceName; - - /** - * Constructs a new ServiceURIImpl. - * @param address - */ - protected ServiceURIImpl(String address) { - this.address = address; - } - - /** - * Constructs a new ServiceURIImpl. - * @param moduleComponent - * @param partName - * @param portName - */ - protected ServiceURIImpl(ModuleComponent moduleComponent, String partName, String portName) { - if (moduleComponent != null) - moduleComponentName = moduleComponent.getName(); - else - moduleComponentName = ""; - this.partName = partName; - this.serviceName = portName; - } - - /** - * Constructs a new ServiceURIImpl. - * @param moduleComponent - * @param configuredPort - */ - protected ServiceURIImpl(ModuleComponent moduleComponent, Part part, ConfiguredPort configuredPort) { - if (moduleComponent != null) - moduleComponentName = moduleComponent.getName(); - else - moduleComponentName = ""; - if (configuredPort instanceof ConfiguredService) { - partName = part.getName(); - ConfiguredService configuredService = (ConfiguredService) configuredPort; - Service service = configuredService.getPort(); - if (service != null) { - serviceName = configuredService.getPort().getName(); - address = "sca:///" + moduleComponentName + '/' + partName + '/' + serviceName; - } else { - address = "sca:///" + moduleComponentName + '/' + partName; - } - - } else if (configuredPort instanceof ConfiguredReference) { - ConfiguredReference configuredReference = (ConfiguredReference) configuredPort; - partName = part.getName(); - serviceName = configuredReference.getPort().getName(); - if (serviceName!=null) - address = "sca:///" + moduleComponentName + '/' + partName + '/' + serviceName; - else - address = "sca:///" + moduleComponentName + '/' + partName; - } - - isSCAScheme = Boolean.TRUE; - isParsed = true; - } - - /** - * Constructor - * - * @param moduleComponent - * @param targetServiceName - */ - protected ServiceURIImpl(ModuleComponent moduleComponent, String targetServiceName) { - if (moduleComponent != null) - moduleComponentName = moduleComponent.getName(); - else - moduleComponentName = ""; - int s = targetServiceName.indexOf('/'); - if (s == -1) { - partName = targetServiceName; - address = "sca:///" + moduleComponentName + '/' + partName; - } else { - partName = targetServiceName.substring(0, s); - this.serviceName = targetServiceName.substring(s + 1); - address = "sca:///" + moduleComponentName + '/' + partName + '/' + this.serviceName; - } - isSCAScheme = Boolean.TRUE; - isParsed = true; - } - - public boolean isSCAScheme() { - if (isSCAScheme == null) { - if (address != null && address.startsWith("sca://")) { - isSCAScheme = Boolean.TRUE; - } else { - isSCAScheme = Boolean.FALSE; - } - } - return isSCAScheme.booleanValue(); - } - - public String getAddress() { - return address; - } - - public String getPath() { - StringBuffer path = new StringBuffer(); - String mc = getModuleComponentName(); - if (mc != null) { - path.append(mc); - } - String p = getPartName(); - if (p !=null) { - if (path.length()!=0) - path.append('/'); - path.append(p); - } - String s = getServiceName(); - if (s !=null) { - if (path.length()!=0) - path.append('/'); - path.append(s); - } - return path.toString(); - } - - /** - * Parse the address. - */ - private void parse() { - isParsed = true; - if (isSCAScheme()) { - int s1 = address.indexOf('/', 6); - if (s1 == -1) - return; - s1++; - int s2 = address.indexOf('/', s1); - if (s2 == -1) - return; - moduleComponentName = address.substring(s1, s2); - s2++; - int s3 = address.indexOf('/', s2); - if (s3 == -1) { - partName = address.substring(s2); - return; - } - partName = address.substring(s2, s3); - s3++; - serviceName = address.substring(s3); - } - } - - /** - * Returns the module component name - */ - public String getModuleComponentName() { - if (!isParsed) - parse(); - return moduleComponentName; - } - - /** - * Returns the part name - */ - public String getPartName() { - if (!isParsed) - parse(); - return partName; - } - - /** - * Returns the service name - */ - public String getServiceName() { - if (!isParsed) - parse(); - return serviceName; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java deleted file mode 100644 index 334e34ba5b..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.Subsystem; - -/** - * An implementation of Subsystem. - */ -public class SubsystemImpl extends CompositeImpl implements Subsystem { - - private String uri; - - protected SubsystemImpl() { - } - - public String getURI() { - return uri; - } - - public void setURI(String value) { - checkNotFrozen(); - uri=value; - } - - public ComponentType getComponentType() { - //TODO implement - return null; - } - - public void setComponentType(ComponentType componentType) { - } - - - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java deleted file mode 100644 index c7c4bda7a1..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.impl; - -import org.apache.tuscany.model.assembly.ServiceURI; -import org.apache.tuscany.model.assembly.Wire; - -/** - * An implementation of Wire. - */ -public class WireImpl extends ExtensibleImpl implements Wire { - - private ServiceURI source; - private ServiceURI target; - - protected WireImpl() { - } - - public ServiceURI getSource() { - return source; - } - - public void setSource(ServiceURI uri) { - checkNotFrozen(); - source=uri; - } - - public ServiceURI getTarget() { - return target; - } - - public void setTarget(ServiceURI uri) { - checkNotFrozen(); - target=uri; - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java deleted file mode 100644 index 95793cc439..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.loader; - -import java.util.List; - -import javax.wsdl.Definition; - -/** - * An assembly model loader. - */ -public interface AssemblyModelLoader { - - /** - * Load a WSDL definition - */ - Definition loadDefinition(String uri); - - /** - * Load definitions by namespace - */ - List<Definition> loadDefinitions(String namespace); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java deleted file mode 100644 index 6c5e0ef75d..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.model.scdl.loader.impl; - -import org.apache.tuscany.common.TuscanyRuntimeException; - -/** - * The root runtime exception for the model loader. - * - * @version $Rev$ $Date$ - */ -public class AssemblyModelLoadException extends TuscanyRuntimeException { - private static final long serialVersionUID = -5891723952359470362L; - - public AssemblyModelLoadException() { - super(); - } - - public AssemblyModelLoadException(String message) { - super(message); - } - - public AssemblyModelLoadException(String message, Throwable cause) { - super(message, cause); - } - - public AssemblyModelLoadException(Throwable cause) { - super(cause); - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java deleted file mode 100644 index 8413350e50..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.scdl.loader.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.wsdl.Definition; -import javax.wsdl.WSDLException; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; - -import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; - -/** - */ -public class SCDLAssemblyModelLoaderImpl implements AssemblyModelLoader { - private WSDLReader wsdlReader; - private Map<String, Definition> definitions=new HashMap<String, Definition>(); - private Map<String, List<Definition>> definitionsByNamespace=new HashMap<String, List<Definition>>(); - - public Definition loadDefinition(String uri) { - Definition definition=definitions.get(uri); - if (definition!=null) - return definition; - - try { - if (wsdlReader==null) { - wsdlReader=WSDLFactory.newInstance().newWSDLReader(); - wsdlReader.setFeature("javax.wsdl.verbose", false); - } - definition = wsdlReader.readWSDL(uri); - } catch (WSDLException e) { - throw new IllegalArgumentException(e); - } - if (definition==null) - throw new IllegalArgumentException("Could not load WSDL definition at "+uri); - - definitions.put(uri, definition); - - String namespace=definition.getTargetNamespace(); - List<Definition> list=definitionsByNamespace.get(namespace); - if (list==null) { - list=new ArrayList<Definition>(); - definitionsByNamespace.put(namespace, list); - } - list.add(definition); - - return definition; - } - - public List<Definition> loadDefinitions(String namespace) { - return definitionsByNamespace.get(namespace); - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java deleted file mode 100644 index 68f9dfa6f8..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.types.java; - -import org.apache.tuscany.model.assembly.ServiceContract; - - -/** - * Represents a Java service contract. - */ -public interface JavaServiceContract extends ServiceContract { - - String getInterfaceName(); - - void setInterfaceName(String interfaceName); - - String getCallbackInterfaceName(); - - void setCallbackInterfaceName(String callbackInterfaceName); -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java deleted file mode 100644 index d384bcd670..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.types.java.impl; - -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.impl.ServiceContractImpl; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * An implementation of JavaServiceContract. - */ -public class JavaServiceContractImpl extends ServiceContractImpl implements JavaServiceContract { - - private String interfaceName; - private String callbackInterfaceName; - - /** - * Constructor - */ - public JavaServiceContractImpl() { - } - - /** - * @param interfaceName The interfaceName to set. - */ - public void setInterfaceName(String interfaceName) { - this.interfaceName = interfaceName; - } - - /** - * @param callbackInterfaceName The callbackInterfaceName to set. - */ - public void setCallbackInterfaceName(String callbackInterfaceName) { - this.callbackInterfaceName = callbackInterfaceName; - } - - public String getInterfaceName() { - return interfaceName; - } - - public String getCallbackInterfaceName() { - return callbackInterfaceName; - } - - /** - * @see org.apache.tuscany.model.assembly.impl.ExtensibleImpl#initialize(org.apache.tuscany.model.assembly.AssemblyContext) - */ - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - - // Load the interface - if (getInterface()==null && interfaceName!=null) { - try { - Class<?> interfaceClass=modelContext.getApplicationResourceLoader().loadClass(interfaceName); - setInterface(interfaceClass); - } catch (ClassNotFoundException e) { - throw new IllegalArgumentException(e); - } - } - - // Load the callback interface - if (getCallbackInterface()==null && callbackInterfaceName!=null) { - try { - Class<?> callbackInterfaceClass=modelContext.getApplicationResourceLoader().loadClass(callbackInterfaceName); - setInterface(callbackInterfaceClass); - } catch (ClassNotFoundException e) { - throw new IllegalArgumentException(e); - } - } - - super.initialize(modelContext); - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java deleted file mode 100644 index 999242a4c2..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.types.wsdl; - -import javax.wsdl.PortType; - -import org.apache.tuscany.model.assembly.ServiceContract; - -/** - * A WSDL service contract. - */ -public interface WSDLServiceContract extends ServiceContract { - - /** - * Returns the WSDL portType. - * @return the WSDL portType - */ - PortType getPortType(); - - /** - * Sets the WSDL portType. - * @param portType - */ - void setPortType(PortType portType); - - /** - * Returns the callback WSDL portType. - * @return the callback WSDL portType - */ - PortType getCallbackPortType(); - - /** - * Sets the callback WSDL portType. - * @param portType - */ - void setCallbackPortType(PortType portType); -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java deleted file mode 100644 index a596eb539f..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java +++ /dev/null @@ -1,234 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.types.wsdl.impl; - -import static org.objectweb.asm.Opcodes.ACC_ABSTRACT; -import static org.objectweb.asm.Opcodes.ACC_INTERFACE; -import static org.objectweb.asm.Opcodes.ACC_PUBLIC; -import static org.objectweb.asm.Opcodes.V1_5; - -import java.util.ArrayList; -import java.util.List; - -import javax.wsdl.Operation; -import javax.wsdl.Part; -import javax.wsdl.PortType; -import javax.xml.namespace.QName; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.impl.ServiceContractImpl; -import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; -import org.apache.tuscany.model.util.XMLNameUtil; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Type; - -import commonj.sdo.Property; -import commonj.sdo.helper.TypeHelper; -import commonj.sdo.helper.XSDHelper; - -/** - * An implementation of WSDLServiceContract. - */ -public class WSDLServiceContractImpl extends ServiceContractImpl implements WSDLServiceContract { - - private PortType portType; - - private PortType callbackPortType; - - private static final String[] EMPTY_STRINGS = new String[0]; - - /** - * Constructor - */ - public WSDLServiceContractImpl() { - } - - public PortType getPortType() { - return portType; - } - - public void setPortType(PortType portType) { - checkNotFrozen(); - this.portType = portType; - } - - public PortType getCallbackPortType() { - return callbackPortType; - } - - public void setCallbackPortType(PortType portType) { - checkNotFrozen(); - callbackPortType = portType; - } - - /** - * @see org.apache.tuscany.model.assembly.impl.ExtensibleImpl#initialize(org.apache.tuscany.model.assembly.AssemblyContext) - */ - public void initialize(AssemblyContext modelContext) { - if (isInitialized()) - return; - super.initialize(modelContext); - - // Load the Java interface for the portType - if (portType != null && getInterface() == null) { - QName qname = portType.getQName(); - String interfaceName = XMLNameUtil.getFullyQualifiedClassNameFromQName(qname.getNamespaceURI(), qname.getLocalPart()); - Class<?> interfaceClass; - try { - // Load the interface - interfaceClass = modelContext.getApplicationResourceLoader().loadClass(interfaceName); - } catch (ClassNotFoundException e) { - // Generate the interface on the fly - interfaceClass = generateJavaInterface(modelContext.getTypeHelper(), modelContext.getApplicationResourceLoader(), portType, interfaceName); - } - super.setInterface(interfaceClass); - } - - // Load the Java interface for the callback portType - if (callbackPortType != null && getCallbackInterface() == null) { - QName qname = callbackPortType.getQName(); - String interfaceName = XMLNameUtil.getFullyQualifiedClassNameFromQName(qname.getNamespaceURI(), qname.getLocalPart()); - Class<?> interfaceClass; - try { - // Load the interface - interfaceClass = modelContext.getApplicationResourceLoader().loadClass(interfaceName); - } catch (ClassNotFoundException e) { - // Generate the interface on the fly - interfaceClass = generateJavaInterface(modelContext.getTypeHelper(), modelContext.getApplicationResourceLoader(), portType, interfaceName); - } - super.setCallbackInterface(interfaceClass); - } - } - - /** - * Generate a Java interface from a WSDL portType. - * - * @param portType - * @param interfaceName - * @return a Java interface that provides the same service contract as the WSDL portType - */ - @SuppressWarnings("unchecked") - private static Class<?> generateJavaInterface(TypeHelper typeHelper, ResourceLoader resourceLoader, PortType portType, String interfaceName) { - - ClassLoader cl=Thread.currentThread().getContextClassLoader(); - try { - Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader()); - - // Create an XSD helper - XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper); - - ClassWriter cw = new ClassWriter(false); - - // Generate the interface - interfaceName = interfaceName.replace('.', '/'); - cw.visit(V1_5, ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, interfaceName, null, "java/lang/Object", EMPTY_STRINGS); - - // Generate methods from the WSDL operations - for (Operation operation : (List<Operation>) portType.getOperations()) { - - //FIXME Workaround for TUSCANY-170, we will need to make this consistent with the algorithm used by Axis2 WSDL2Java - // to generate method names from operations names - //String methodName = XMLNameUtil.getJavaNameFromXMLName(operation.getName(), false); - String methodName = operation.getName(); - - // FIXME later we may want to wwitch to use the Axis2 WSDL2Java (not to generate the Java source, - // just to figure the WSDL to Java mapping) - - // Derive the method signature from the input message part (and check if it's a doc-wrapped or doc-bare operation) - List<Class> inputTypes=new ArrayList<Class>(); - boolean wrapped = false; - if (operation.getInput() != null && operation.getInput().getMessage()!=null && !operation.getInput().getMessage().getParts().isEmpty()) { - QName qname=((Part)operation.getInput().getMessage().getParts().values().iterator().next()).getElementName(); - if (qname!=null) { - Property property = xsdHelper.getGlobalProperty(qname.getNamespaceURI(), qname.getLocalPart(), true); - commonj.sdo.Type type = property.getType(); - if (property.getName().equals(operation.getName())) { - String localName = xsdHelper.getLocalName(type); - if (localName.indexOf("_._")!=-1) { - for (Property param : (List<Property>)type.getProperties()) { - Class inputType = param.getType().getInstanceClass(); - if (inputType == null) - inputType = Object.class; - inputTypes.add(inputType); - } - wrapped=true; - } - } - - // Bare doc style - if (!wrapped) { - Class inputType = type.getInstanceClass(); - if (inputType == null) - inputType = Object.class; - inputTypes.add(inputType); - } - - } else { - // FIXME only support elements for now - } - } - - // Derive the return type from the output message part (also support doc-wrapped and doc-bare here) - Class outputType=Void.class; - if (operation.getOutput() != null && operation.getOutput().getMessage()!=null && !operation.getOutput().getMessage().getParts().isEmpty()) { - QName qname=((Part)operation.getOutput().getMessage().getParts().values().iterator().next()).getElementName(); - if (qname!=null) { - Property property = xsdHelper.getGlobalProperty(qname.getNamespaceURI(), qname.getLocalPart(), true); - commonj.sdo.Type type = property.getType(); - if (wrapped) { - if (!type.getProperties().isEmpty()) { - outputType=((Property)type.getProperties().get(0)).getType().getInstanceClass(); - if (outputType==null) - outputType=Object.class; - } - } else { - outputType = type.getInstanceClass(); - if (outputType==null) - outputType=Object.class; - } - } else { - // FIXME only support elements for now - } - } - - // FIXME integrate XSD to Java type mapping here - StringBuffer inputSignature=new StringBuffer(); - for (Class inputType : inputTypes) { - inputSignature.append(Type.getDescriptor(inputType)); - } - String outputSignature = Type.getDescriptor(outputType); - - cw.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, methodName, '(' + inputSignature.toString() + ')' + outputSignature, null, null).visitEnd(); - } - - // Generate the bytecodes - cw.visitEnd(); - byte[] bytes = cw.toByteArray(); - - // Add the class to the resource loader - - return resourceLoader.addClass(bytes); - - } finally { - Thread.currentThread().setContextClassLoader(cl); - } - - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java deleted file mode 100644 index 1f064e0977..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * A list that invokes added or removed methods when elements are added or removed. - * - */ -public abstract class NotifyingList<E> extends ArrayList<E> { - - private boolean frozen; - - public NotifyingList() { - } - - public void freeze() { - frozen=true; - } - - protected void checkNotFrozen() { - if (frozen) - throw new IllegalStateException("Attempt to modify a frozen list"); - } - - public boolean add(E element) { - checkNotFrozen(); - boolean result=super.add(element); - added(element); - return result; - } - - public void add(int index, E element) { - checkNotFrozen(); - super.add(index, element); - added(element); - } - - public boolean addAll(Collection<? extends E> c) { - checkNotFrozen(); - boolean result=super.addAll(c); - for (E element : c) - added(element); - return result; - } - - public boolean addAll(int index, Collection<? extends E> c) { - checkNotFrozen(); - boolean result=super.addAll(index, c); - for (E element : c) - added(element); - return result; - } - - public void clear() { - checkNotFrozen(); - List<E> l=new ArrayList<E>(this); - super.clear(); - for (E element : l) - removed(element); - } - - public E remove(int index) { - checkNotFrozen(); - E element=super.remove(index); - removed(element); - return element; - } - - @SuppressWarnings("unchecked") - public boolean remove(Object element) { - checkNotFrozen(); - boolean result=super.remove(element); - removed((E)element); - return result; - } - - @SuppressWarnings("unchecked") - public boolean removeAll(Collection<?> c) { - checkNotFrozen(); - boolean result=super.removeAll(c); - for (E element : (Collection<? extends E>)c) - removed(element); - return result; - } - - protected abstract void added(E element); - - protected abstract void removed(E element); - -} diff --git a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java b/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java deleted file mode 100644 index f493356594..0000000000 --- a/branches/java-M1/java/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java +++ /dev/null @@ -1,212 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.util; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder; - - - -/** - * A utility class that converts between XML names and Java names. - */ -public final class XMLNameUtil { - - private static final List<String> DOMAINS = Arrays.asList(new String[]{"COM", "com", "ORG", "org"}); - - /** - * Constructor - */ - private XMLNameUtil() { - super(); - } - - /** - * Return an EPackage name for the given namespace. - * - * @param namespace - * @return an EPackage name for the given namespace - */ - public static String getPackageNameFromNamespace(String namespace) { - return org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder.getDefaultPackageName(namespace); - } - - /** - * Trim the file extension from a path. - * @param path - * @return - */ - private static String trimFileExtension(String path) { - int s=path.lastIndexOf('/'); - int d=path.lastIndexOf('.'); - if (d>s) { - return path.substring(0,d); - } else { - return path; - } - } - - /** - * Returns a namespace prefix for the given package Name. - * - * @param packageName - * @return a namespace prefix for the given package Name - */ - public static String getNSPrefixFromPackageName(String packageName) { - int index = packageName.lastIndexOf('.'); - return index == -1 ? packageName : packageName.substring(index + 1); - } - - /** - * Parse the given name. - * - * @param sourceName - * @param separator - * @return some stuff parsed from the name - */ - private static List<String> parseName(String sourceName, char separator) { - List<String> result = new ArrayList<String>(); - if (sourceName != null) { - StringBuilder currentWord = new StringBuilder(64); - boolean lastIsLower = false; - int index; - int length; - for (index = 0, length = sourceName.length(); index < length; ++index) { - char curChar = sourceName.charAt(index); - if (!Character.isJavaIdentifierPart(curChar)) { - curChar = separator; - } - if (Character.isUpperCase(curChar) - || (!lastIsLower && Character.isDigit(curChar)) - || curChar == separator) { - - if (lastIsLower && currentWord.length() > 1 - || curChar == separator && currentWord.length() > 0) { - result.add(currentWord.toString()); - currentWord = new StringBuilder(64); - } - lastIsLower = false; - } else { - if (!lastIsLower) { - int currentWordLength = currentWord.length(); - if (currentWordLength > 1) { - char lastChar = currentWord.charAt(--currentWordLength); - currentWord.setLength(currentWordLength); - result.add(currentWord.toString()); - currentWord = new StringBuilder(64); - currentWord.append(lastChar); - } - } - lastIsLower = true; - } - - if (curChar != separator) { - currentWord.append(curChar); - } - } - - result.add(currentWord.toString()); - } - return result; - } - - /** - * Returns a valid Java name from an XML Name. - * - * @param name - * @param isUpperCase - * @return a valid Java name from an XML Name - */ - public static String getJavaNameFromXMLName(String name, boolean isUpperCase) { - List<String> parsedName = parseName(name, '_'); - StringBuilder result = new StringBuilder(64 * parsedName.size()); - for (String nameComponent: parsedName) { - if (nameComponent.length() > 0) { - if (result.length() > 0 || isUpperCase) { - result.append(Character.toUpperCase(nameComponent.charAt(0))); - result.append(nameComponent.substring(1)); - } else { - result.append(nameComponent); - } - } - } - - if (result.length() == 0) { - return "_"; - } - if (Character.isJavaIdentifierStart(result.charAt(0))) { - return isUpperCase ? result.toString() : decapitalizeName(result.toString()); - } - return "_" + result; - } - - /** - * Returns a valid fully qualified class name from a QName. - * @param namespace - * @param name - * @return a valid fully qualified class name from a QName - */ - public static String getFullyQualifiedClassNameFromQName(String namespace, String name) { - return XMLNameUtil.getPackageNameFromNamespace(namespace) + '.' - + XMLNameUtil.getJavaNameFromXMLName(name, true); - } - - /** - * Decapitalize a name. - * @param name - * @return a decapitalized name - */ - public static String decapitalizeName(String name) { - if (name.length() == 0) { - return name; - } else { - String lowerName = name.toLowerCase(); - int i; - for (i = 0; i < name.length(); i++) { - if (name.charAt(i) == lowerName.charAt(i)) { - break; - } - } - if (i > 1 && i < name.length()) { - --i; - } - return name.substring(0, i).toLowerCase() + name.substring(i); - } - } - - /** - * Capitalize a name. - * @param name - * @return a capitalized name - */ - public static String capitalizeName(String name) { - int l = name.length(); - if (l == 0) { - return name; - } else if (l == 1) { - return name.toUpperCase(); - } else { - return name.substring(0, 1).toUpperCase() + name.substring(1); - } - } - -} diff --git a/branches/java-M1/java/sca/model/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/model/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/model/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/model/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/model/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/model/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/model/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/model/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/model/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-sca.xsd b/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-sca.xsd deleted file mode 100644 index 3b003ce77a..0000000000 --- a/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-sca.xsd +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sca="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sdo="commonj.sdo/xml" - elementFormDefault="qualified"> - - <include schemaLocation="sca-core.xsd"/> - - <element name="binding.sca" type="sca:SCABinding" substitutionGroup="sca:binding" sdo:name="bindingSca"/> - <complexType name="SCABinding"> - <complexContent> - <extension base="sca:Binding"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> -</schema> diff --git a/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-webservice.xsd b/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-webservice.xsd deleted file mode 100644 index 79131506c4..0000000000 --- a/branches/java-M1/java/sca/model/src/main/resources/model/sca-binding-webservice.xsd +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sca="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sdo="commonj.sdo/xml" - elementFormDefault="qualified"> - - <include schemaLocation="sca-core.xsd"/> - - <element name="binding.ws" type="sca:WebServiceBinding" substitutionGroup="sca:binding" sdo:name="bindingWs"/> - <complexType name="WebServiceBinding"> - <complexContent> - <extension base="sca:Binding"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="port" type="anyURI" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> -</schema> diff --git a/branches/java-M1/java/sca/model/src/main/resources/model/sca-core.xsd b/branches/java-M1/java/sca/model/src/main/resources/model/sca-core.xsd deleted file mode 100644 index 7d3ca73676..0000000000 --- a/branches/java-M1/java/sca/model/src/main/resources/model/sca-core.xsd +++ /dev/null @@ -1,239 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sca="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sdo="commonj.sdo/xml" - xmlns:sdojava="commonj.sdo/java" - sdojava:package="org.apache.tuscany.model.scdl" - elementFormDefault="qualified"> - - <element name="componentType" type="sca:ComponentType"/> - <complexType name="ComponentType"> - <sequence> - <element minOccurs="0" maxOccurs="unbounded" name="service" type="sca:Service"/> - <element minOccurs="0" maxOccurs="unbounded" name="reference" type="sca:Reference"/> - <element minOccurs="0" maxOccurs="unbounded" name="property" type="sca:Property"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="Service"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:interface"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <element name="interface" type="sca:Interface"/> - <complexType name="Interface"/> - - <complexType name="Reference"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:interface"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="Property"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="type" type="QName" use="required" sdo:name="dataType"/> - <attribute name="many" type="boolean" default="false" use="optional"/> - <attribute name="required" type="boolean" default="false" use="optional"/> - <attribute name="default" type="string" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - - <element name="moduleFragment" type="sca:ModuleFragment"/> - <complexType name="ModuleFragment"> - <sequence> - <!-- This is a Tuscany extension --> - <element minOccurs="0" maxOccurs="unbounded" name="import" type="sca:Import"/> - <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/> - <element minOccurs="0" maxOccurs="unbounded" name="component" type="sca:Component"/> - <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/> - <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:ModuleWire"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <element name="module" type="sca:Module"/> - <complexType name="Module"> - <complexContent> - <extension base="sca:ModuleFragment"/> - </complexContent> - </complexType> - - <complexType name="EntryPoint"> - <sequence> - <element minOccurs="0" maxOccurs="1" ref="sca:interface"/> - <element minOccurs="1" maxOccurs="unbounded" ref="sca:binding"/> - <element minOccurs="1" maxOccurs="unbounded" name="reference" type="anyURI"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - <!-- a multiplicity 1..1 or 0..n sample - <reference>StockQuoteComponent</reference> - type must be URI - a multiplicity 1..n or 0..n sample - <reference>StockQuoteComponent1</reference> - type must be URI - <reference>StockQuoteComponent2</reference> - --> - - <element name="binding" type="sca:Binding"/> - <complexType name="Binding"> - <attribute name="uri" type="anyURI" use="optional"/> - </complexType> - - <complexType name="Component"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:implementation"/> - <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/> - <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - <!-- a multiplicity 1..1 or 0..1 sample - <references> - <v:stockQuote>StockQuoteComponent</v:stockquote> - type must be URI - </references> - a multiplicity 1..n or 0..n sample - <references> - <v:stockQuote>StockQuoteComponent1</v:stockQuote> - type must be URI - <v:stockQuote>StockQuoteComponent2</v:stockQuote> - </references> - --> - - <element name="implementation" type="sca:Implementation"/> - <complexType name="Implementation"/> - - <complexType name="PropertyValues"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="ReferenceValues"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - - <complexType name="ExternalService"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:interface"/> - <element minOccurs="0" maxOccurs="unbounded" ref="sca:binding"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="overridable" type="sca:OverrideOptions" default="may" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - - <complexType name="ModuleWire"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:source.uri"/> - <element minOccurs="1" maxOccurs="1" ref="sca:target.uri"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <element name="source" type="anyType"/> - <element name="target" type="anyType"/> - - <element name="source.uri" type="anyURI" substitutionGroup="sca:source" sdo:name="sourceUri"/> - <element name="target.uri" type="anyURI" substitutionGroup="sca:target" sdo:name="targetUri"/> - - <element name="subsystem" type="sca:Subsystem"/> - <complexType name="Subsystem"> - <sequence> - <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/> - <element minOccurs="0" maxOccurs="unbounded" name="moduleComponent" type="sca:ModuleComponent"/> - <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/> - <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:SystemWire"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="uri" type="anyURI" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="ModuleComponent"> - <sequence> - <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/> - <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="name" type="NCName" use="required"/> - <attribute name="module" type="NCName" use="required"/> - <attribute name="uri" type="anyURI" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </complexType> - - <complexType name="SystemWire"> - <sequence> - <element minOccurs="1" maxOccurs="1" ref="sca:source"/> - <element minOccurs="1" maxOccurs="1" ref="sca:target"/> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - </complexType> - - <element name="source.epr" type="anyType" substitutionGroup="sca:source" sdo:name="sourceEpr"/> - <element name="target.epr" type="anyType" substitutionGroup="sca:target" sdo:name="targetEpr"/> - - <simpleType name="Multiplicity"> - <restriction base="string"> - <enumeration value="0..1" sdo:name="_01"/> - <enumeration value="1..1" sdo:name="_11"/> - <enumeration value="0..n" sdo:name="_0n"/> - <enumeration value="1..n" sdo:name="_1n"/> - </restriction> - </simpleType> - - <simpleType name="OverrideOptions"> - <restriction base="string"> - <enumeration value="no"/> - <enumeration value="may"/> - <enumeration value="must"/> - </restriction> - </simpleType> - - <!-- This is a Tuscany extension --> - <element name="import" type="sca:Import"/> - <complexType name="Import"/> - -</schema> diff --git a/branches/java-M1/java/sca/model/src/main/resources/model/sca-implementation-java.xsd b/branches/java-M1/java/sca/model/src/main/resources/model/sca-implementation-java.xsd deleted file mode 100644 index d7998a355c..0000000000 --- a/branches/java-M1/java/sca/model/src/main/resources/model/sca-implementation-java.xsd +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sca="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sdo="commonj.sdo/xml" - elementFormDefault="qualified"> - - <include schemaLocation="sca-core.xsd"/> - - <element name="implementation.java" type="sca:JavaImplementation" substitutionGroup="sca:implementation" sdo:name="implementationJava"/> - <complexType name="JavaImplementation"> - <complexContent> - <extension base="sca:Implementation"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="class" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> -</schema> diff --git a/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-java.xsd b/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-java.xsd deleted file mode 100644 index 2b3f263b52..0000000000 --- a/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-java.xsd +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sca="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sdo="commonj.sdo/xml" - elementFormDefault="qualified"> - - <include schemaLocation="sca-core.xsd"/> - - <element name="interface.java" type="sca:JavaInterface" substitutionGroup="sca:interface" sdo:name="interfaceJava"/> - <complexType name="JavaInterface"> - <complexContent> - <extension base="sca:Interface"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="interface" type="NCName" use="required"/> - <attribute name="callbackInterface" type="NCName" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> -</schema> diff --git a/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-wsdl.xsd b/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-wsdl.xsd deleted file mode 100644 index 3649f4d898..0000000000 --- a/branches/java-M1/java/sca/model/src/main/resources/model/sca-interface-wsdl.xsd +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sca="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sdo="commonj.sdo/xml" - elementFormDefault="qualified"> - - <include schemaLocation="sca-core.xsd"/> - - <element name="interface.wsdl" type="sca:WSDLPortType" substitutionGroup="sca:interface" sdo:name="interfaceWsdl"/> - <complexType name="WSDLPortType"> - <complexContent> - <extension base="sca:Interface"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="interface" type="anyURI" use="required"/> - <attribute name="callbackInterface" type="anyURI" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> - - <!-- This is a Tuscany extension --> - <element name="import.wsdl" type="sca:WSDLImport" substitutionGroup="sca:import" sdo:name="importWsdl"/> - <complexType name="WSDLImport"> - <complexContent> - <extension base="sca:Import"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="namespace" type="anyURI" use="optional"/> - <attribute name="location" type="anyURI" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> - - <!-- This is a Tuscany extension --> - <element name="import.sdo" type="sca:SDOImport" substitutionGroup="sca:import" sdo:name="importSdo"/> - <complexType name="SDOImport"> - <complexContent> - <extension base="sca:Import"> - <sequence> - <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="location" type="anyURI" use="optional"/> - <attribute name="factory" type="NCName" use="optional"/> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> - -</schema> diff --git a/branches/java-M1/java/sca/model/src/main/resources/model/sca.xsd b/branches/java-M1/java/sca/model/src/main/resources/model/sca.xsd deleted file mode 100644 index d49dfeff79..0000000000 --- a/branches/java-M1/java/sca/model/src/main/resources/model/sca.xsd +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.osoa.org/xmlns/sca/0.9" - xmlns:sdojava="commonj.sdo/java" - xmlns:sca="http://www.osoa.org/xmlns/sca/0.9" - sdojava:package="org.apache.tuscany.model.scdl"> - - <include schemaLocation="sca-core.xsd"/> - - <include schemaLocation="sca-interface-java.xsd"/> - <include schemaLocation="sca-interface-wsdl.xsd"/> - - <include schemaLocation="sca-implementation-java.xsd"/> - - <include schemaLocation="sca-binding-webservice.xsd"/> - <include schemaLocation="sca-binding-sca.xsd"/> - -</schema> diff --git a/branches/java-M1/java/sca/model/src/main/resources/org/apache/tuscany/model/Messages.properties b/branches/java-M1/java/sca/model/src/main/resources/org/apache/tuscany/model/Messages.properties deleted file mode 100644 index 4581e44bff..0000000000 --- a/branches/java-M1/java/sca/model/src/main/resources/org/apache/tuscany/model/Messages.properties +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. -# -# Licensed 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. -# ==================================================================== -# To code developer: -# Do NOT change the properties between this line and the -# "%%% END OF TRANSLATED PROPERTIES %%%" line. -# Make a new property name, append to the end of the file and change -# the code to use the new property. -# ==================================================================== - -# ===================================================================== -# %%% END OF TRANSLATED PROPERTIES %%% -# ===================================================================== -# NLS_MESSAGEFORMAT_ALL diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountReport.java b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountReport.java deleted file mode 100644 index b1b5913adc..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountReport.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.tests.bigbank.account.services.account; - -import java.util.List; - -/** - * @model - */ - -public interface AccountReport { - - /** - * @model type="services.account.AccountSummary" - */ - - List getAccountSummaries(); -} diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.java b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.java deleted file mode 100644 index 83df13439a..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.tests.bigbank.account.services.account; - -import org.osoa.sca.annotations.Remotable; - -@Remotable -public interface AccountService { - - public AccountReport getAccountReport(String customerID); -} diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.wsdl b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.wsdl deleted file mode 100644 index baf9ecd81d..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.wsdl +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.bigbank.com/AccountService/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.bigbank.com/AccountService/"
-
- name="AccountService">
-
- <wsdl:types>
- <xsd:schema targetNamespace="http://www.bigbank.com/AccountService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <xsd:element name="customerID" type="xsd:string"/>
- <xsd:element name="getAccountReportResponse" type="tns:AccountReport"/>
-
- <xsd:complexType name="AccountReport">
- <xsd:sequence>
- <xsd:element name="accountSummary" type="tns:AccountSummary" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="AccountSummary">
- <xsd:sequence>
- <xsd:element name="accountNumber" type="xsd:string"/>
- <xsd:element name="accountType" type="xsd:string"/>
- <xsd:element name="balance" type="xsd:float"/>
- </xsd:sequence>
- </xsd:complexType>
-
- </xsd:schema>
- </wsdl:types>
- <wsdl:message name="getAccountReportRequest">
- <wsdl:part element="tns:customerID" name="getAccountReportRequest"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportResponse">
- <wsdl:part element="tns:getAccountReportResponse" name="getAccountReportResponse"/>
- </wsdl:message>
- <wsdl:portType name="AccountService">
- <wsdl:operation name="getAccountReport">
- <wsdl:input message="tns:getAccountReportRequest"/>
- <wsdl:output message="tns:getAccountReportResponse"/>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="AccountServiceSOAP" type="tns:AccountService">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getAccountReport">
- <soap:operation
- soapAction="http://www.bigbank.com/AccountService/getAccountReport"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="AccountService">
- <wsdl:port binding="tns:AccountServiceSOAP"
- name="AccountServiceSOAP">
- <soap:address location="http://localhost:8080/tuscany-model/services/AccountService"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java deleted file mode 100644 index a5619bb41e..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.tests.bigbank.account.services.account; - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata.AccountDataService; -import org.apache.tuscany.model.assembly.tests.bigbank.account.services.stockquote.StockQuoteService; - -public class AccountServiceImpl implements AccountService { - - @Property - public String currency = "USD"; - - @Reference - public AccountDataService accountDataService; - @Reference - public StockQuoteService stockQuoteService; - - public AccountServiceImpl() { - } - - public AccountReport getAccountReport(String customerID) { - return null; - } - -} diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountSummary.java b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountSummary.java deleted file mode 100644 index c1650c79fa..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountSummary.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.tests.bigbank.account.services.account; - -/** - * @model - */ - -public interface AccountSummary { - - /** - * @model - */ - String getAccountNumber(); - - void setAccountNumber(String accountNumber); - - /** - * @model - */ - String getAccountType(); - - void setAccountType(String accountType); - - /** - * @model - */ - float getBalance(); - - void setBalance(float balance); -} - diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java deleted file mode 100644 index 04ae8e5bd5..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata; - -public interface AccountDataService { - - CheckingAccount getCheckingAccount(String customerID); - - SavingsAccount getSavingsAccount(String customerID); - - StockAccount getStockAccount(String customerID); -} diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java deleted file mode 100644 index 4d5eee1f01..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata; - -public class AccountDataServiceImpl implements AccountDataService { - - public CheckingAccount getCheckingAccount(String customerID) { - - CheckingAccount checkingAccount = new CheckingAccount(); - checkingAccount.setAccountNumber(customerID + "_CHA12345"); - checkingAccount.setBalance(1500.0f); - - return checkingAccount; - } - - public SavingsAccount getSavingsAccount(String customerID) { - - SavingsAccount savingsAccount = new SavingsAccount(); - savingsAccount.setAccountNumber(customerID + "_SAA12345"); - savingsAccount.setBalance(1500.0f); - - return savingsAccount; - } - - public StockAccount getStockAccount(String customerID) { - - StockAccount stockAccount = new StockAccount(); - stockAccount.setAccountNumber(customerID + "_STA12345"); - stockAccount.setSymbol("IBM"); - stockAccount.setQuantity(100); - - return stockAccount; - } -} diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java deleted file mode 100644 index d4f2f8be6c..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata; - -public class CheckingAccount { - - private String accountNumber; - private float balance; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - public float getBalance() { - return balance; - } - - public void setBalance(float balance) { - this.balance = balance; - } -} diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java deleted file mode 100644 index 73474585da..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata; - -public class SavingsAccount { - - private String accountNumber; - private float balance; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - public float getBalance() { - return balance; - } - - public void setBalance(float balance) { - this.balance = balance; - } -} diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/StockAccount.java b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/StockAccount.java deleted file mode 100644 index eeb7238abc..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/StockAccount.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata; - -public class StockAccount { - - private String accountNumber; - private String symbol; - private int quantity; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - public int getQuantity() { - return quantity; - } - - public void setQuantity(int quantity) { - this.quantity = quantity; - } - - public String getSymbol() { - return symbol; - } - - public void setSymbol(String symbol) { - this.symbol = symbol; - } -} diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java deleted file mode 100644 index 7545e9fbbb..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.tests.bigbank.account.services.stockquote; - -public interface StockQuoteService { - - public float getQuote(String symbol); -} - -
\ No newline at end of file diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java deleted file mode 100644 index 85f85340ec..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.model.assembly.tests.bigbank.account.services.stockquote; - -/* Dummy'd up StockQuoteService, override webservice for now */ - -public class StockQuoteServiceImpl implements StockQuoteService { - - public float getQuote(String symbol) { - // Just hardcode for now - return 83.00f; - } - -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl b/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl deleted file mode 100644 index 6af61ef80e..0000000000 --- a/branches/java-M1/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl +++ /dev/null @@ -1,98 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions targetNamespace="http://webservice.stockquote" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice.stockquote" xmlns:intf="http://webservice.stockquote" xmlns:tns1="http://stockquote" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="stockquote">
- <!--WSDL created by Apache Axis version: 1.2.1
-Built on Jun 14, 2005 (09:15:57 EDT)-->
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
- <complexType name="GetQuoteRequest">
- <sequence>
- <element name="symbol" nillable="true" type="xsd:string"/>
- </sequence>
- </complexType>
- <complexType name="GetQuoteResponse">
- <sequence>
- <element name="price" type="xsd:float"/>
- </sequence>
- </complexType>
- </schema>
- <schema elementFormDefault="qualified" targetNamespace="http://webservice.stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
- <import namespace="http://stockquote"/>
- <element name="request" type="tns1:GetQuoteRequest"/>
- <element name="getQuoteReturn" type="tns1:GetQuoteResponse"/>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getQuoteResponse">
-
- <wsdl:part element="impl:getQuoteReturn" name="getQuoteReturn"/>
-
- </wsdl:message>
-
- <wsdl:message name="getQuoteRequest">
-
- <wsdl:part element="impl:request" name="request"/>
-
- </wsdl:message>
-
- <wsdl:portType name="StockQuoteWebService">
-
- <wsdl:operation name="getQuote" parameterOrder="request">
-
- <wsdl:input message="impl:getQuoteRequest" name="getQuoteRequest"/>
-
- <wsdl:output message="impl:getQuoteResponse" name="getQuoteResponse"/>
-
- </wsdl:operation>
-
- </wsdl:portType>
-
- <wsdl:binding name="StockQuoteWebServiceSoapBinding" type="impl:StockQuoteWebService">
-
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-
- <wsdl:operation name="getQuote">
-
- <wsdlsoap:operation soapAction=""/>
-
- <wsdl:input name="getQuoteRequest">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:input>
-
- <wsdl:output name="getQuoteResponse">
-
- <wsdlsoap:body use="literal"/>
-
- </wsdl:output>
-
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:service name="StockQuoteWebServiceService">
-
- <wsdl:port binding="impl:StockQuoteWebServiceSoapBinding" name="StockQuoteWebService">
-
- <wsdlsoap:address location="http://localhost:8123/StockQuoteWebService/services/StockQuoteWebService"/>
-
- </wsdl:port>
-
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/java-M1/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.module b/branches/java-M1/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.module deleted file mode 100644 index 7290f9c0c3..0000000000 --- a/branches/java-M1/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.module +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
-
- name="tuscany.model.assembly.tests.bigbank.account">
-
- <entryPoint name="AccountService">
- <interface.java interface="org.apache.tuscany.model.assembly.tests.bigbank.account.services.account.AccountService"/>
- <binding.ws port="http://www.bigbank.com/AccountService#wsdl.endpoint(AccountService/AccountServiceSOAP)"/> - <!--
- <reference>AccountServiceComponent</reference> - -->
- </entryPoint>
-
- <component name="AccountServiceComponent">
- <implementation.java class="org.apache.tuscany.model.assembly.tests.bigbank.account.services.account.AccountServiceImpl"/> - <!--
- <properties>
- <v:currency>EURO</v:currency>
- </properties>
- <references>
- <v:accountDataService>AccountDataServiceComponent</v:accountDataService>
- <v:stockQuoteService>StockQuoteService</v:stockQuoteService>
- </references> - -->
- </component>
-
- <component name="AccountDataServiceComponent">
- <implementation.java class="org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata.AccountDataServiceImpl"/>
- </component>
-
- <component name="StockQuoteService">
- <implementation.java class="org.apache.tuscany.model.assembly.tests.bigbank.account.services.stockquote.StockQuoteServiceImpl"/>
- </component>
-
- <!--
- <externalService name="StockQuoteService">
- <interface.java interface="org.apache.tuscany.model.assembly.tests.bigbank.account.services.stockquote"/>
- <binding.ws port="http://www.quickstockquote.com/StockQuoteService#wsdl.endpoint(StockQuote/StockQuoteServiceSOAP)"/>
- </externalService>
- -->
-
-</module>
-
diff --git a/branches/java-M1/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.subsystem b/branches/java-M1/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.subsystem deleted file mode 100644 index bff90f010d..0000000000 --- a/branches/java-M1/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.subsystem +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<subsystem xmlns="http://www.osoa.org/xmlns/sca/0.9"
-
- name="tuscany.runtime.bigbank.account">
-
- <moduleComponent name="AccountModuleComponent" module="tuscany.runtime.bigbank.account"/>
-
-</subsystem>
-
diff --git a/branches/java-M1/java/sca/plugins/plugin.java2wsdl/pom.xml b/branches/java-M1/java/sca/plugins/plugin.java2wsdl/pom.xml deleted file mode 100644 index 6ade2cf913..0000000000 --- a/branches/java-M1/java/sca/plugins/plugin.java2wsdl/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<project>
- <parent>
- <groupId>org.apache.tuscany.sca.plugins</groupId>
- <artifactId>tuscany-sca-plugins</artifactId>
- <version>incubating-M1</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>tuscany-plugin-java2wsdl</artifactId>
- <packaging>maven-plugin</packaging>
- <name>Tuscany SCA - Maven Plugin for Java2WSDL</name>
- <description>Implementation of Java2WSDL Generator</description>
- <version>incubating-M1</version>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany</groupId>
- <artifactId>tuscany-sca-tools</artifactId>
- <version>${pom.version}</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.4</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java b/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java deleted file mode 100644 index f1b9d91523..0000000000 --- a/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java +++ /dev/null @@ -1,156 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tuscany.tools.java2wsdl.plugin;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ws.java2wsdl.Java2WSDLConstants;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorFactory;
-import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
-
-/**
- * @version $Rev$ $Date$
- * @goal generate
- * @phase generate-sources
- * @description Generate WSDL from a given Java class / interface
- */
-public class Java2WSDLGeneratorMojo extends AbstractMojo
-{
-
- /**
- * The name of the class for which the WSDL must be generated
- * @parameter
- *
- */
- private String sourceClassName;
-
- /**
- * The location where the wsdls should be generated into
- * @parameter expression="${project.build.directory}\\java2wsdl-wsdl"
- */
- private String targetLocation;
-
- /**
- * The name of the wsdl file
- * @parameter
- */
- private String wsdlFilename;
-
-
- /**
- * Classpaths to be included
- * @parameter
- *
- */
- String[] classpaths;
-
- /**
- * The name of the service
- * @parameter
- */
- private String serviceName;
-
- /**
- * The binding style for the service
- * @parameter
- */
- private String bindingStyle;
-
- /**
- * The binding use option
- * @parameter
- */
- private String bindingUse;
-
- /**
- * The soap address
- * @parameter
- */
- private String soapAddress;
-
- public void execute() throws MojoExecutionException
- {
- try
- {
- Java2WSDLGeneratorFactory.getInstance().createGenerator().generateWSDL(createOptionsMap ());
- }
- catch ( Exception e )
- {
- throw new MojoExecutionException("Exception in Java2WSDL Maven Plugin ", e);
- }
- }
-
- protected Map createOptionsMap()
- {
- Map optionsMap = new Hashtable();
-
- optionsMap.put(Java2WSDLConstants.CLASSNAME_OPTION,
- new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSNAME_OPTION, new String[]{sourceClassName}));
-
- if ( targetLocation != null )
- {
- optionsMap.put(Java2WSDLConstants.OUTPUT_LOCATION_OPTION,
- new Java2WSDLCommandLineOption(Java2WSDLConstants.OUTPUT_LOCATION_OPTION, new String[]{targetLocation}));
- }
-
- if ( wsdlFilename != null )
- {
- optionsMap.put(Java2WSDLConstants.OUTPUT_FILENAME_OPTION,
- new Java2WSDLCommandLineOption(Java2WSDLConstants.OUTPUT_FILENAME_OPTION, new String[]{wsdlFilename}));
- }
-
- if ( classpaths != null && classpaths.length > 0 )
- {
- optionsMap.put(Java2WSDLConstants.CLASSPATH_OPTION,
- new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSPATH_OPTION, classpaths));
- }
-
- if ( serviceName != null )
- {
- optionsMap.put(Java2WSDLConstants.SERVICE_NAME_OPTION,
- new Java2WSDLCommandLineOption(Java2WSDLConstants.SERVICE_NAME_OPTION, new String[]{serviceName}));
- }
-
- if ( bindingStyle != null )
- {
- optionsMap.put(Java2WSDLConstants.STYLE_OPTION,
- new Java2WSDLCommandLineOption(Java2WSDLConstants.STYLE_OPTION, new String[]{bindingStyle}));
- }
-
- if ( bindingUse != null )
- {
- optionsMap.put(Java2WSDLConstants.USE_OPTION,
- new Java2WSDLCommandLineOption(Java2WSDLConstants.USE_OPTION, new String[]{bindingUse}));
- }
-
- if ( soapAddress != null )
- {
- optionsMap.put(Java2WSDLConstants.LOCATION_OPTION,
- new Java2WSDLCommandLineOption(Java2WSDLConstants.LOCATION_OPTION, new String[]{soapAddress}));
- }
-
- return optionsMap;
- }
-}
diff --git a/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/pom.xml b/branches/java-M1/java/sca/plugins/plugin.wsdl2java/pom.xml deleted file mode 100644 index e340ceb602..0000000000 --- a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<project>
- <parent>
- <groupId>org.apache.tuscany.sca.plugins</groupId>
- <artifactId>tuscany-sca-plugins</artifactId>
- <version>incubating-M1</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>tuscany-plugin-wsdl2java</artifactId>
- <packaging>maven-plugin</packaging>
- <name>Tuscany SCA - Maven Plugin for WSDL2Java</name>
- <description>Implementation of WSDL2Java Generator</description>
- <version>incubating-M1</version>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany</groupId>
- <artifactId>tuscany-sca-tools</artifactId>
- <version>${pom.version}</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.4</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java b/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java deleted file mode 100644 index 37ff6655d7..0000000000 --- a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java +++ /dev/null @@ -1,150 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tools.wsdl2java.plugin; - -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.util.List; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator; - -/** - * @version $Rev$ $Date$ - * @goal generate - * @phase generate-sources - * @description Generate SDO interface classes from an XML Schema - */ -public class WSDL2JavaGeneratorMojo extends AbstractMojo { - /** - * The directory containing wsdl files; defaults to ${basedir}/src/main/wsdl - * @parameter expression="${basedir}/src/main/wsdl" - */ - private String wsdlDir; - - /** - * Name of the wsdl file; if omitted all files in the directory are processed - * @parameter - */ - private File wsdlFile; - - /** - * The Java package to generate into. By default the value is derived from the schema URI. - * - * @parameter - */ - private String javaPackage; - - /** - * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source - * - * @parameter expression="${project.build.directory}/wsdl2java-source" - */ - private String targetDirectory; - - /** - * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source - * - * @parameter - */ - private WSDLFileOption[] wsdlFiles; - - /** - * @parameter expression="${project.compileSourceRoots}" - * @readonly - */ - private List compilerSourceRoots; - - public void execute() throws MojoExecutionException { - - if(null != wsdlFiles){ - for(int i=0; i< wsdlFiles.length ; ++i ){ - System.err.println("wsdlFiles" + wsdlFiles[i].getFileName()); - WSDLFileOption wf = wsdlFiles[i]; - - if(null == wf.getTargetDirectory()) - wf.setTargetDirectory(targetDirectory); - if(null == wf.getJavaPackage()){ - wf.setJavaPackage(javaPackage); - } - if(wf.getFileName() == null || wf.getFileName().length() ==0){ - throw new MojoExecutionException("no fileName specfied for wsdl."); - } - if(!wf.getFileName().canRead() || !wf.getFileName().isFile()){ - - throw new MojoExecutionException("file can not be read:"+wf.getFileName()); - } - - } - }else{ - - - - if (wsdlFile == null) { - - File[] files = new File(wsdlDir).listFiles(FILTER); - - wsdlFiles= new WSDLFileOption[files.length]; - for(int i= files.length -1; i> -1; --i){ - - - wsdlFiles[i] = new WSDLFileOption(); - wsdlFiles[i].setFileName(files[i]); - wsdlFiles[i].setJavaPackage(javaPackage); - wsdlFiles[i].setPorts(null); - wsdlFiles[i].setTargetDirectory(targetDirectory); - - - } - - } else { - wsdlFiles= new WSDLFileOption[]{new WSDLFileOption()}; - wsdlFiles[0].setFileName(wsdlFile); - wsdlFiles[0].setJavaPackage(javaPackage); - wsdlFiles[0].setPorts(null); - wsdlFiles[0].setTargetDirectory(targetDirectory); - } - } - - int genOptions = 0; - - for (int i = 0; i < wsdlFiles.length; i++) { - File file = wsdlFiles[i].getFileName(); - File marker = new File(targetDirectory, ".gen#" + file.getName()+".wsdl2java"); - if (file.lastModified() > marker.lastModified()) { - getLog().info("Generating Java service interfaces from " + file); - WSDL2JavaGenerator.generateFromWSDL(file.toString(), wsdlFiles[i].getPorts(), wsdlFiles[i].getTargetDirectory(), wsdlFiles[i].getJavaPackage(), null, genOptions); - } - try { - marker.createNewFile(); - } catch (IOException e) { - throw new MojoExecutionException(e.getMessage(), e); - } - marker.setLastModified(System.currentTimeMillis()); - } - - compilerSourceRoots.add(targetDirectory); - } - - private static final FileFilter FILTER = new FileFilter() { - public boolean accept(File pathname) { - return (pathname.isFile() || !pathname.isHidden()); - } - }; -}
\ No newline at end of file diff --git a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java b/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java deleted file mode 100644 index 2d2ae5ed2d..0000000000 --- a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java +++ /dev/null @@ -1,90 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.wsdl2java.plugin;
-
-import java.io.File;
-
-public class WSDLFileOption {
- /**
- * Name of the wsdl file; if omitted all files in the directory are processed
- *
- */
- private File fileName;
-
- /**
- * The Java package to generate into. By default the value is derived from the schema URI.
- *
- *
- */
- private String javaPackage;
-
- /**
- * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source
- *
- *
- */
- private String targetDirectory;
-
- /**
- * @parameter expression="${project.compileSourceRoots}"
- * @readonly
- */
-
- private String ports[];
-
- /**
- * @parameter expression="${project.compileSourceRoots}"
- * @readonly
- */
-
-
- public WSDLFileOption(){}
-
- public String getJavaPackage() {
- return javaPackage;
- }
-
- public void setJavaPackage(String javaPackage) {
- this.javaPackage = javaPackage;
- }
-
-
- public String[] getPorts() {
- return ports;
- }
-
- public void setPorts(String[] ports) {
- this.ports = ports;
- }
-
- public String getTargetDirectory() {
- return targetDirectory;
- }
-
- public void setTargetDirectory(String targetDirectory) {
- this.targetDirectory = targetDirectory;
- }
-
- public File getFileName() {
- return fileName;
- }
-
- public void setFileName(File fileName) {
- this.fileName = fileName;
- }
-
-}
diff --git a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/plugins/pom.xml b/branches/java-M1/java/sca/plugins/pom.xml deleted file mode 100644 index a8c04a4b37..0000000000 --- a/branches/java-M1/java/sca/plugins/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.
- -->
-<project>
- <parent>
- <groupId>org.apache.tuscany</groupId>
- <artifactId>tuscany-sca</artifactId>
- <version>incubating-M1</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.tuscany.sca.plugins</groupId>
- <artifactId>tuscany-sca-plugins</artifactId>
- <packaging>pom</packaging>
- <name>Tuscany SCA Maven Plugins</name>
- <version>incubating-M1</version>
-
- <modules>
- <module>plugin.wsdl2java</module>
- <module>plugin.java2wsdl</module>
- </modules>
-</project>
diff --git a/branches/java-M1/java/sca/pom.xml b/branches/java-M1/java/sca/pom.xml deleted file mode 100644 index a73f1f5619..0000000000 --- a/branches/java-M1/java/sca/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project> - <parent> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-project</artifactId> - <version>incubating-M1</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>tuscany-sca</artifactId> - <packaging>pom</packaging> - <name>Tuscany SCA Implementation Project</name> - <version>incubating-M1</version> - - <modules> - <module>common</module> - <module>model</module> - <module>core</module> - <module>bindings</module> - <module>databinding</module> - <module>containers</module> - <module>tomcat</module> - <module>tools</module> - <module>plugins</module> - </modules> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <includes> - <include>**/*TestCase.java</include> - </includes> - <reportFormat>brief</reportFormat> - <useFile>false</useFile> - </configuration> - </plugin> - </plugins> - <testResources> - <testResource> - <directory>src/test/java</directory> - <includes> - <include>**/*.componentType</include> - </includes> - </testResource> - <testResource> - <directory>src/test/resources</directory> - <includes> - <include>**/*</include> - </includes> - </testResource> - </testResources> - </build> -</project> diff --git a/branches/java-M1/java/sca/tomcat/pom.xml b/branches/java-M1/java/sca/tomcat/pom.xml deleted file mode 100644 index ff16f54136..0000000000 --- a/branches/java-M1/java/sca/tomcat/pom.xml +++ /dev/null @@ -1,105 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project> - <parent> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-sca</artifactId> - <version>incubating-M1</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>tuscany-tomcat</artifactId> - <name>Tuscany Apache Tomcat Integration</name> - <description>Integration of the Tuscany runtime with Apache Tomcat.</description> - <version>incubating-M1</version> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca.containers</groupId> - <artifactId>tuscany-container-java</artifactId> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.tuscany.sca.bindings</groupId> - <artifactId>tuscany-binding-axis2</artifactId> - <version>${pom.version}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>tomcat</groupId> - <artifactId>servlet-api</artifactId> - <version>5.0.18</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>tomcat</groupId> - <artifactId>catalina</artifactId> - <version>5.5.15</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>tomcat</groupId> - <artifactId>tomcat-util</artifactId> - <version>5.5.15</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>tomcat</groupId> - <artifactId>tomcat-coyote</artifactId> - <version>5.5.15</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>tomcat</groupId> - <artifactId>tomcat-http</artifactId> - <version>5.5.15</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>tomcat</groupId> - <artifactId>naming-factory</artifactId> - <version>5.5.15</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>tomcat</groupId> - <artifactId>naming-resources</artifactId> - <version>5.5.15</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.0.4</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>commons-modeler</groupId> - <artifactId>commons-modeler</artifactId> - <version>1.1M1</version> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/ContainerLoader.java b/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/ContainerLoader.java deleted file mode 100644 index 60c9a7961f..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/ContainerLoader.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat; - -import java.beans.PropertyChangeListener; - -import org.apache.catalina.Container; -import org.apache.catalina.Loader; - -/** - * Implementation of a TomcatLoader that allows privileged servlets from the container - * classloader to be loaded into an unprivileged application. This allows the Tuscany - * integration code to add servlets to the application, for example, to handle web - * services requests. - * - * @version $Rev$ $Date$ - */ -public class ContainerLoader implements Loader { - private static final String INFO = ContainerLoader.class.getName() + "/SNAPSHOT"; - private final ClassLoader cl; - private Container container; - - /** - * Constructor specifying the classloader to be used. - * - * @param cl the classloader this Loader wraps, typically the container classloader - */ - public ContainerLoader(ClassLoader cl) { - this.cl = cl; - } - - public void backgroundProcess() { - } - - public ClassLoader getClassLoader() { - return cl; - } - - public Container getContainer() { - return container; - } - - public void setContainer(Container container) { - this.container = container; - } - - public boolean getDelegate() { - return false; - } - - public void setDelegate(boolean delegate) { - throw new UnsupportedOperationException(); - } - - public String getInfo() { - return INFO; - } - - public boolean getReloadable() { - return false; - } - - public void setReloadable(boolean reloadable) { - throw new UnsupportedOperationException(); - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - throw new UnsupportedOperationException(); - } - - public void addRepository(String repository) { - throw new UnsupportedOperationException(); - } - - public String[] findRepositories() { - throw new UnsupportedOperationException(); - } - - public boolean modified() { - throw new UnsupportedOperationException(); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - throw new UnsupportedOperationException(); - } -} diff --git a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TomcatHost.java b/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TomcatHost.java deleted file mode 100644 index 8351da8edd..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TomcatHost.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat; - -import javax.servlet.Servlet; - -import org.osoa.sca.annotations.Scope; - -import org.apache.tuscany.core.webapp.ServletHost; - -/** - * SCA Component that acts as a proxy for the Tomcat Host container that created the runtime. - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class TomcatHost implements ServletHost { - private TuscanyHost host; - - public void setHost(TuscanyHost host) { - this.host = host; - } - - public TuscanyHost getHost() { - return host; - } - - public void registerMapping(String mapping, Servlet servlet) { - host.registerMapping(mapping, servlet); - } - - public void unregisterMapping(String mapping) { - host.unregisterMapping(mapping); - } - - public Servlet getMapping(String mapping) { - return host.getMapping(mapping); - } -} diff --git a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java b/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java deleted file mode 100644 index 7e3edf67f9..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java +++ /dev/null @@ -1,152 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat; - -import javax.servlet.ServletContext; - -import org.apache.catalina.Context; -import org.apache.catalina.Lifecycle; -import org.apache.catalina.LifecycleEvent; -import org.apache.catalina.LifecycleListener; -import org.apache.catalina.util.StringManager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; -import org.apache.tuscany.core.client.BootstrapHelper; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.EventException; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; -import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; - -/** - * @version $Rev$ $Date$ - */ -public class TuscanyContextListener implements LifecycleListener { - private static final Log log = LogFactory.getLog(TuscanyContextListener.class); - private static final StringManager sm = StringManager.getManager("org.apache.tuscany.tomcat"); - private static final String TUSCANY_RUNTIME_NAME = RuntimeContext.class.getName(); - public static final String MODULE_COMPONENT_NAME = "org.apache.tuscany.core.webapp.ModuleComponentContext"; - - private final AssemblyFactory modelFactory; - private final AssemblyModelLoader modelLoader; - private final RuntimeContext runtime; - private CompositeContext moduleContext; - private TuscanyValve valve; - - public TuscanyContextListener(RuntimeContext runtimeContext, AssemblyFactory modelFactory, AssemblyModelLoader modelLoader) { - this.runtime = runtimeContext; - this.modelFactory = modelFactory; - this.modelLoader = modelLoader; - } - - public void lifecycleEvent(LifecycleEvent event) { - String type = event.getType(); - if (Lifecycle.AFTER_START_EVENT.equals(type)) { - startContext((Context) event.getLifecycle()); - } else if (Lifecycle.STOP_EVENT.equals(type)) { - stopContext((Context) event.getLifecycle()); - } - } - - private void startContext(Context ctx) { - ClassLoader appLoader = ctx.getLoader().getClassLoader(); - if (appLoader.getResource("sca.module") == null) { - return; - } - - log.info(sm.getString("context.configLoad", ctx.getName())); - try { - loadContext(ctx); - } catch (ConfigurationException e) { - log.error(sm.getString("context.configError"), e); - // todo mark application as unavailable - return; - } - - try { - moduleContext.publish(new ModuleStart(this)); - } catch (EventException e) { - log.error(sm.getString("context.moduleStartError"), e); - // todo unload module component from runtime - // todo mark application as unavailable - return; - } catch (RuntimeException e) { - log.error(sm.getString("context.unknownRuntimeException"), e); - // todo unload module component from runtime - throw e; - } - - // add a valve to this context's pipeline that will associate the request with the runtime - if (valve == null) { - valve = new TuscanyValve(moduleContext); - } else { - valve.setContext(moduleContext); - valve.setEnabled(true); - } - ctx.getPipeline().addValve(valve); - // add the RuntimeContext in as a servlet context parameter - ServletContext servletContext = ctx.getServletContext(); - servletContext.setAttribute(TUSCANY_RUNTIME_NAME, runtime); - servletContext.setAttribute(MODULE_COMPONENT_NAME, moduleContext); - } - - private void loadContext(Context ctx) throws ConfigurationException { - ResourceLoader resourceLoader = new ResourceLoaderImpl(ctx.getLoader().getClassLoader()); - ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); - try { - AssemblyContextImpl modelContext = new AssemblyContextImpl(modelFactory, modelLoader, resourceLoader, ctx.getName()); - - ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(runtime.getSystemContext(), modelContext); - - // Load the SCDL configuration of the application module - ModuleComponent moduleComponent = loader.loadModuleComponent(ctx.getName(), ctx.getPath()); - - // Register it under the root application context - CompositeContext rootContext = runtime.getRootContext(); - rootContext.registerModelObject(moduleComponent); - moduleContext = (CompositeContext) rootContext.getContext(moduleComponent.getName()); - //TODO remove the hack below - moduleContext.setAssemblyContext(modelContext); - } finally { - Thread.currentThread().setContextClassLoader(oldCl); - } - } - - private void stopContext(Context ctx) { - if (moduleContext != null) { - moduleContext.publish(new ModuleStop(this)); - } - CompositeContext rootContext = runtime.getRootContext(); - rootContext.removeContext(moduleContext.getName()); - valve.setEnabled(false); - //ctx.getPipeline().removeValve(valve); - //valve = null; - moduleContext.stop(); - moduleContext = null; - // todo unload module component from runtime - } - -} diff --git a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyHost.java b/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyHost.java deleted file mode 100644 index 37984ef40d..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyHost.java +++ /dev/null @@ -1,185 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat; - -import javax.servlet.Servlet; - -import org.apache.catalina.Container; -import org.apache.catalina.Context; -import org.apache.catalina.LifecycleException; -import org.apache.catalina.Wrapper; -import org.apache.catalina.core.StandardContext; -import org.apache.catalina.core.StandardHost; -import org.apache.catalina.util.StringManager; -import org.apache.tomcat.util.buf.MessageBytes; -import org.apache.tomcat.util.http.mapper.MappingData; - -import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.client.BootstrapHelper; -import org.apache.tuscany.core.config.ConfigurationLoadException; -import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.SystemCompositeContext; -import org.apache.tuscany.core.context.event.ModuleStart; -import org.apache.tuscany.core.context.event.ModuleStop; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.runtime.RuntimeContextImpl; -import org.apache.tuscany.core.webapp.ServletHost; -import org.apache.tuscany.model.assembly.AssemblyContext; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; - -/** - * A specialied Tomcat Host that extends the Standardhost implementation and adds SCA capabilities. - * <p/> - * As children are added, they are examined for the presence of SCA configuration - * information and if any is found then the web application is treated as an - * SCA Module defintion which is used to create a ModuleComponent. The name of the - * context is used as the name of the ModuleComponent and its context path is used - * as the URI. - * - * @version $Rev$ $Date$ - */ -@SuppressWarnings({"serial"}) -public class TuscanyHost extends StandardHost implements ServletHost { - private static final String SYSTEM_MODULE_COMPONENT = "org.apache.tuscany.core.system"; - - private static final StringManager sm = StringManager.getManager("org.apache.tuscany.tomcat"); - - private RuntimeContext runtime; - private AssemblyModelLoader modelLoader; - private AssemblyFactory modelFactory; - - public synchronized void start() throws LifecycleException { - startRuntime(); - super.start(); - } - - public synchronized void stop() throws LifecycleException { - super.stop(); - stopRuntime(); - } - - private void startRuntime() { - // Create an assembly model context - AssemblyContext modelContext = BootstrapHelper.getModelContext(getClass().getClassLoader()); - modelFactory = modelContext.getAssemblyFactory(); - modelLoader = modelContext.getAssemblyLoader(); - - // Create and start the runtime - NullMonitorFactory monitorFactory = new NullMonitorFactory(); - ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); - runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, new DefaultWireBuilder()); - runtime.start(); - - // Load and start the system configuration - try { - SystemCompositeContext systemContext = runtime.getSystemContext(); - BootstrapHelper.bootstrapStaxLoader(systemContext, modelContext); - ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext); - ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT); - CompositeContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent); - context.publish(new ModuleStart(this)); - - TomcatHost host = systemContext.resolveInstance(TomcatHost.class); - host.setHost(this); - } catch (ConfigurationLoadException e) { - getLogger().warn(sm.getString("runtime.loadSystemFailed", e.getResourceURI()), e); - return; - } catch (Exception e) { - getLogger().warn(sm.getString("runtime.registerSystemFailed"), e); - runtime.stop(); - runtime = null; - return; - } - - getLogger().info(sm.getString("runtime.started")); - } - - private void stopRuntime() { - if (runtime == null) { - return; - } - runtime.getSystemContext().publish(new ModuleStop(this)); - - runtime.stop(); - runtime = null; - getLogger().info(sm.getString("runtime.stopped")); - } - - public synchronized void addChild(Container child) { - if (!(child instanceof StandardContext)) { - throw new IllegalArgumentException(sm.getString("tuscanyHost.notContext")); - } - StandardContext ctx = (StandardContext) child; - ctx.addLifecycleListener(new TuscanyContextListener(runtime, modelFactory, modelLoader)); - super.addChild(child); - } - - public String toString() { - StringBuilder sb = new StringBuilder(132); - if (getParent() != null) { - sb.append(getParent().toString()).append('.'); - } - sb.append("TuscanyHost[").append(getName()).append(']'); - return (sb.toString()); - } - - public void registerMapping(String mapping, Servlet servlet) { - Context ctx = map(mapping); - if (ctx == null) { - throw new UnsupportedOperationException("Cannot find context for mapping " + mapping); - } - String contextPath = ctx.getPath(); - assert mapping.startsWith(contextPath); - mapping = mapping.substring(contextPath.length()); - Wrapper wrapper = new TuscanyWrapper(servlet); - wrapper.setName(mapping.substring(0,mapping.lastIndexOf('/'))); - ctx.addChild(wrapper); - wrapper.addMapping(mapping); - ctx.getMapper().addWrapper(mapping, wrapper, false); - } - - public void unregisterMapping(String mapping) { - } - - public Servlet getMapping(String mapping) { - Context ctx = map(mapping); - if (ctx == null) { - return null; - } - String contextPath = ctx.getPath(); - assert mapping.startsWith(contextPath); - - MappingData mappingData = new MappingData(); - MessageBytes mb = MessageBytes.newInstance(); - mb.setString(mapping); - try { - ctx.getMapper().map(mb, mappingData); - } catch (Exception e) { - return null; - } - if (!(mappingData.wrapper instanceof TuscanyWrapper)) { - return null; - } - TuscanyWrapper wrapper = (TuscanyWrapper) mappingData.wrapper; - return wrapper.getServlet(); - } -} diff --git a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java b/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java deleted file mode 100644 index 352a04bde0..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat; - -import java.io.IOException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpSession; - -import org.apache.catalina.connector.Request; -import org.apache.catalina.connector.Response; -import org.apache.catalina.valves.ValveBase; -import org.osoa.sca.CurrentModuleContext; -import org.osoa.sca.ModuleContext; -import org.osoa.sca.SCA; - -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.event.HttpSessionBound; -import org.apache.tuscany.core.context.event.RequestStart; -import org.apache.tuscany.core.context.event.RequestEnd; -import org.apache.tuscany.core.webapp.LazyHTTPSessionId; - -/** - * Valve that can be added to a pipeline to automatically set the SCA environment as each request is processed. - * - * @version $Rev$ $Date$ - */ -public class TuscanyValve extends ValveBase { - /** - * Name of the note that contains the request id - */ - private static final String REQUEST_ID = "org.apache.tuscany.tomcat.REQUEST_ID"; - - private static final ContextBinder BINDER = new ContextBinder(); - - private CompositeContext moduleComponentContext; - - private boolean enabled = true; - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public void setContext(CompositeContext moduleComponentContext) { - this.moduleComponentContext = moduleComponentContext; - } - - public TuscanyValve(CompositeContext moduleComponentContext) { - this.moduleComponentContext = moduleComponentContext; - } - - public void invoke(Request request, Response response) throws IOException, ServletException { - if (!enabled){ - return; - } - Object oldRequestId = request.getNote(REQUEST_ID); - ModuleContext oldContext = CurrentModuleContext.getContext(); - // bind the current module context to the thread for use by CurrentModuleContext - BINDER.setContext((ModuleContext) moduleComponentContext); - try { - if (oldRequestId != null) { - // the request has already been started, just invoke the next valve - next.invoke(request, response); - } else { - // tell the runtime a new request is starting - Object requestId = new Object(); - - HttpSession session = request.getSession(false); - if (session != null) { - // A session is already active - moduleComponentContext .publish(new HttpSessionBound(this,session)); - } else { - // Create a lazy wrapper since a session is not yet active - moduleComponentContext.publish(new HttpSessionBound(this, new LazyHTTPSessionId(request))); - } - - try { - moduleComponentContext.publish(new RequestStart(this, requestId)); - } catch (Exception e) { - throw new ServletException(e.getMessage(), e); - } - request.setNote(REQUEST_ID, requestId); - - try { - // invoke the next valve in the pipeline - next.invoke(request, response); - } finally { - // notify the runtime the request is ending - request.removeNote(REQUEST_ID); - try { - moduleComponentContext.publish(new RequestEnd(this, requestId)); - } catch (Exception e) { - // the application already did its work, log and ignore - // todo log this exception - } - } - } - } finally { - // restore the previous module context onto the thread - BINDER.setContext(oldContext); - } - } - - private static class ContextBinder extends SCA { - public void setContext(ModuleContext context) { - setModuleContext(context); - } - - public void start() { - throw new AssertionError(); - } - - public void stop() { - throw new AssertionError(); - } - } -} diff --git a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyWrapper.java b/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyWrapper.java deleted file mode 100644 index de53ad4d45..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyWrapper.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat; - -import javax.servlet.Servlet; - -import org.apache.catalina.core.StandardWrapper; - -/** - * @version $Rev$ $Date$ - */ -public class TuscanyWrapper extends StandardWrapper { - private static final long serialVersionUID = 1L; - - private final Servlet servlet; - - public TuscanyWrapper(Servlet servlet) { - super(); - this.servlet = servlet; - } - - public synchronized Servlet loadServlet() { - return servlet; - } - - public Servlet getServlet() { - return servlet; - } -} diff --git a/branches/java-M1/java/sca/tomcat/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/tomcat/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/tomcat/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/tomcat/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/tomcat/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/tomcat/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties b/branches/java-M1/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties deleted file mode 100644 index 43fc99958e..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. -# -# Licensed 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. - -runtime.loadSystemFailed = Error loading system configuration from: {0} -runtime.registerSystemFailed = Error registering system configuration: -runtime.started = Started Tuscany runtime -runtime.stopped = Stopped Tuscany runtime - -tuscanyHost.notContext = Child of a TuscanyHost must be a StandardContext -context.configLoad = Loading SCA configuration for application {0} - -context.configError = Error loading the SCA configuration -context.moduleStartError = Error starting SCA module -context.unknownRuntimeException = Unexpected RuntimeException diff --git a/branches/java-M1/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/Messages.properties b/branches/java-M1/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/Messages.properties deleted file mode 100644 index f926ca6488..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/Messages.properties +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. -# -# Licensed 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. -# ==================================================================== -# To code developer: -# Do NOT change the properties between this line and the -# "%%% END OF TRANSLATED PROPERTIES %%%" line. -# Make a new property name, append to the end of the file and change -# the code to use the new property. -# ==================================================================== - -# ===================================================================== -# %%% END OF TRANSLATED PROPERTIES %%% -# ===================================================================== -# NLS_MESSAGEFORMAT_ALL - -SCA_STARTING =Tuscany: Starting SCA runtime. -SCA_STARTED =Tuscany: Started SCA runtime. -SCA_STOPPING =Tuscany: Stopping SCA runtime. -SCA_STOPPED =Tuscany: Stopped SCA runtime. -SCA_STARTING_MODULE =Tuscany: Starting SCA module component {0}. -SCA_LOADED_MODULE =Tuscany: Loaded SCA module {0}. -SCA_STARTED_MODULE =Tuscany: Started SCA module component {0}. -SCA_STOPPING_MODULE =Tuscany: Stopping SCA module component {0}. -SCA_STOPPED_MODULE =Tuscany: Stopped SCA module component {0}. -SCA_START_MODULE_FAILED =Tuscany: Error starting SCA module component {0}: {1}. -SCA_STOP_MODULE_FAILED =Tuscany: Error stopping SCA module component {0}: {1}. -SCA_START_WEBAPP_FAILED =Tuscany: Error starting Web application {0}: {1}. -SCA_STOP_WEBAPP_FAILED =Tuscany: Error stopping Web application {0}: {1}.
\ No newline at end of file diff --git a/branches/java-M1/java/sca/tomcat/src/main/resources/system.fragment b/branches/java-M1/java/sca/tomcat/src/main/resources/system.fragment deleted file mode 100644 index e379e1d90b..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/main/resources/system.fragment +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" - xmlns:tuscany="http://org.apache.tuscany/xmlns/system/0.9" - name="org.apache.tuscany.tomcat"> - - <entryPoint name="org.apache.tuscany.tomcat.TomcatHost"> - <interface.java interface="org.apache.tuscany.tomcat.TomcatHost"/> - <tuscany:binding.system/> - <reference>TomcatHost</reference> - </entryPoint> - - <component name="TomcatHost"> - <tuscany:implementation.system class="org.apache.tuscany.tomcat.TomcatHost"/> - </component> - -</moduleFragment> diff --git a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java b/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java deleted file mode 100644 index babe25adc7..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java +++ /dev/null @@ -1,298 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat.integration; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.Vector; - -import javax.servlet.ServletInputStream; -import javax.servlet.ServletOutputStream; - -import junit.framework.TestCase; - -import org.apache.catalina.Globals; -import org.apache.catalina.Host; -import org.apache.catalina.connector.Connector; -import org.apache.catalina.connector.Request; -import org.apache.catalina.connector.Response; -import org.apache.catalina.core.ApplicationFilterFactory; -import org.apache.catalina.core.StandardEngine; - -/** - * @version $Rev$ $Date$ - */ -public class AbstractTomcatTest extends TestCase { - protected Map<String, Class<?>> classes; - protected Host host; - protected MockRequest request; - protected MockResponse response; - protected StandardEngine engine; - - protected void setUp() throws Exception { - super.setUp(); - classes = new HashMap<String, Class<?>>(); - classes.put(TestServlet.class.getName(), TestServlet.class); - classes.put(HelloWorldService.class.getName(), HelloWorldService.class); - classes.put(HelloWorldImpl.class.getName(), HelloWorldImpl.class); - } - - protected void setupTomcat(File baseDir, Host host) throws Exception { - File appBase = new File(baseDir, "webapps").getCanonicalFile(); - - // Configure a Tomcat Engine - engine = new StandardEngine(); - engine.setName("Catalina"); - engine.setDefaultHost("localhost"); - engine.setBaseDir(baseDir.getAbsolutePath()); - - this.host = host; - host.setName("localhost"); - host.setAppBase(appBase.getAbsolutePath()); - engine.addChild(host); - - // buildSource a empty request/response - Connector connector = new Connector("HTTP/1.1"); - request = new MockRequest(); - request.setConnector(connector); - response = new MockResponse(); - request.setResponse(response); - request.setMethod("POST"); - request.setScheme("http"); - } - - public static class MockRequest extends Request { - private String method; - private String scheme; - private String requestURI; - private String contentType; - private Map<String,String> headers = new HashMap<String,String>(); - private ServletInputStream inputStream; - - public void setScheme(String scheme) { - this.scheme = scheme; - } - - public void setMethod(String method) { - this.method = method; - } - - public void setRequestURI(String requestURI) { - this.requestURI = requestURI; - } - - public String getScheme() { - return scheme; - } - - public String getMethod() { - return method; - } - - public int getServerPort() { - return 80; - } - - public String getServerName() { - return "localhost"; - } - - public String getRequestURI() { - return requestURI; - } - - public void setAttribute(String name, Object value) { - if (name.startsWith("org.apache.tomcat.")) { - return; - } - super.setAttribute(name, value); - } - - public Object getAttribute(String name) { - if (name.equals(Globals.DISPATCHER_TYPE_ATTR)) { - return (dispatcherType == null) - ? ApplicationFilterFactory.REQUEST_INTEGER - : dispatcherType; - } else if (name.equals(Globals.DISPATCHER_REQUEST_PATH_ATTR)) { - return (requestDispatcherPath == null) - ? getRequestPathMB().toString() - : requestDispatcherPath.toString(); - } - - return attributes.get(name); - } - - public String getHeader(String name) { - return headers.get(name); - } - - public Enumeration getHeaderNames() { - return Collections.enumeration(headers.keySet()); - } - - public void setContentType(String contentType) { - this.contentType = contentType; - } - - public String getContentType() { - return contentType; - } - - public ServletInputStream getInputStream() throws IOException { - return inputStream; - } - - public InputStream getStream() { - return inputStream; - } - - public void setStream(ServletInputStream stream) { - inputStream = stream; - } - - @Override - public String getRemoteHost() { - - return "locahost"; - } - - @Override - public int getRemotePort() { - - return 1080; - } - - @Override - public String getRemoteAddr() { - - return "127.0.0.1"; - } - - @Override - public Enumeration getParameterNames() { - return new Vector().elements(); - } - - @Override - public String getParameter(String param) { - if ("wsdl".equals(param)) { - return ""; - } else { - return null; - } - } - } - - public static class MockResponse extends Response { - private boolean suspended; - private String contentType; - private int status = 200; - private Map<String, String> headers = new HashMap<String, String>(); - private MockOutputStream outputStream = new MockOutputStream(); - - public boolean isCommitted() { - return false; - } - - public boolean isAppCommitted() { - return false; - } - - public void sendAcknowledgement() { - } - - public void setSuspended(boolean suspended) { - this.suspended = suspended; - } - - public boolean isSuspended() { - return suspended; - } - - public void setStatus(int status, String message) { - this.status = status; - } - - public int getStatus() { - return status; - } - - public void reset() { - } - - public void addHeader(String name, String value) { - headers.put(name, value); - } - - public String[] getHeaderNames() { - return (String[]) headers.keySet().toArray(new String[headers.size()]); - } - - public String getContentType() { - return contentType; - } - - public void setContentType(String contentType) { - this.contentType = contentType; - } - - public OutputStream getStream() { - return outputStream; - } - - public ServletOutputStream getOutputStream() throws IOException { - return outputStream; - } - } - - public static class MockInputStream extends ServletInputStream { - private final byte[] bytes; - private int index; - - public MockInputStream(byte[] bytes) { - this.bytes = bytes; - } - - public int read() throws IOException { - if (index == bytes.length) { - return -1; - } - else { - return bytes[index++]; - } - } - } - - public static class MockOutputStream extends ServletOutputStream { - private ByteArrayOutputStream os = new ByteArrayOutputStream(); - - public void write(int b) throws IOException { - os.write(b); - } - - public String toString() { - return os.toString(); - } - } -} diff --git a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldImpl.java b/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldImpl.java deleted file mode 100644 index 4db61fa58c..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat.integration; - -import org.osoa.sca.annotations.Service; - -/** - * @version $Rev$ $Date$ - */ -@Service(HelloWorldService.class) -public class HelloWorldImpl implements HelloWorldService { - public String getGreetings(String name) { - return "Hello " + name; - } -} diff --git a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldService.java b/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldService.java deleted file mode 100644 index a9b78cadf4..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldService.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat.integration; - -/** - * @version $Rev$ $Date$ - */ -public interface HelloWorldService { - public String getGreetings(String name); -} diff --git a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestClassLoader.java b/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestClassLoader.java deleted file mode 100644 index 486fec5bd4..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestClassLoader.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2006 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat.integration; - -import java.util.Map; -import java.net.URL; - -import org.apache.catalina.loader.WebappClassLoader; - -/** - * A version of Tomcat's application classloader that only allows certain classes to be loaded. - * This is used in the integration tests to make sure that no Tuscany classes are exposed to the - * application except the ones needed to run the tests. - * - * @version $Rev$ $Date$ - */ -@SuppressWarnings({"CustomClassloader"}) -public class TestClassLoader extends WebappClassLoader { - private final Map<String, Class<?>> classes; - - public TestClassLoader(Map<String, Class<?>> classes, URL url, ClassLoader parent) { - super(parent); - this.classes = classes; - addURL(url); - } - - public Class<?> findClass(String name) throws ClassNotFoundException { - Class<?> clazz = classes.get(name); - if (clazz != null) { - return clazz; - } - if (name.startsWith("java.") || name.startsWith("javax.") || name.startsWith("org.osoa.")) { - return super.findClass(name); - } - throw new ClassNotFoundException(name); - } -} diff --git a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestServlet.java b/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestServlet.java deleted file mode 100644 index 2cd8ce06a2..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestServlet.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat.integration; - -import java.io.IOException; -import javax.servlet.GenericServlet; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; - -import org.osoa.sca.CurrentModuleContext; -import org.osoa.sca.ModuleContext; - -/** - * @version $Rev$ $Date$ - */ -@SuppressWarnings({"serial"}) -public class TestServlet extends GenericServlet { - - public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { - Object runtime = getServletContext().getAttribute("org.apache.tuscany.core.runtime.RuntimeContext"); - if (runtime == null || "org.apache.tuscany.core.runtime.RuntimeContext".equals(runtime.getClass().getName())) { - throw new ServletException("Runtime not bound to org.apache.tuscany.core.runtime.RuntimeContext"); - } - - Object module = getServletContext().getAttribute("org.apache.tuscany.core.webapp.ModuleComponentContext"); - if (module == null || "org.apache.tuscany.core.context.CompositeContext".equals(module.getClass().getName())) { - throw new ServletException("Module composite not bound to org.apache.tuscany.core.webapp.ModuleComponentContext"); - } - - ModuleContext moduleContext = CurrentModuleContext.getContext(); - if (moduleContext == null) { - throw new ServletException("No module context returned"); - } - String name = moduleContext.getName(); - if (!"/testContext".equals(name)) { - throw new ServletException("Invalid module context name: " + name); - } - - HelloWorldService helloService = (HelloWorldService) moduleContext.locateService("HelloWorld"); - String greetings = helloService.getGreetings("World"); - if (!"Hello World".equals(greetings)) { - throw new ServletException("Serivce returned " + greetings); - } - } -} diff --git a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java b/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java deleted file mode 100644 index 75bd85cf65..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java +++ /dev/null @@ -1,200 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat.integration; - -import org.apache.catalina.Valve; -import org.apache.catalina.Loader; -import org.apache.catalina.Wrapper; -import org.apache.catalina.core.StandardContext; -import org.apache.catalina.core.StandardWrapper; -import org.apache.catalina.startup.ContextConfig; -import org.apache.tomcat.util.buf.MessageBytes; -import org.apache.tomcat.util.http.mapper.MappingData; - -import org.apache.tuscany.tomcat.TuscanyHost; -import org.apache.tuscany.tomcat.TuscanyValve; -import org.apache.tuscany.tomcat.ContainerLoader; - -import java.io.File; -import java.io.IOException; -import javax.servlet.Servlet; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; - -/** - * @version $Rev$ $Date$ - */ -public class TomcatIntegrationTestCase extends AbstractTomcatTest { - protected File app1; - private Loader loader; - private StandardContext ctx; - - public void testComponentIntegration() throws Exception { - // define our test servlet - StandardWrapper wrapper = new StandardWrapper(); - wrapper.setServletClass(TestServlet.class.getName()); - ctx.addChild(wrapper); - - host.addChild(ctx); - boolean found = false; - for (Valve valve: ctx.getPipeline().getValves()) { - if (valve instanceof TuscanyValve) { - found = true; - break; - } - } - assertTrue("TuscanyValve not in pipeline", found); - - request.setContext(ctx); - request.setWrapper(wrapper); - host.invoke(request, response); - - host.removeChild(ctx); - } - - public void testWebServiceIntegration() throws Exception { - host.addChild(ctx); - - Wrapper wrapper = (Wrapper) ctx.findChild("/services"); - assertNotNull("No webservice wrapper present", wrapper); - request.setContext(ctx); - request.setRequestURI("/services/HelloWorldService"); - request.setWrapper(wrapper); - request.setContentType("text/xml"); - String xml = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:q0=\"http://helloworldaxis.samples.tuscany.apache.org\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" + - "<soapenv:Body>\n" + - "<q0:getGreetings>\n" + - "<q0:in0>World</q0:in0>\n" + - "</q0:getGreetings>\n" + - "</soapenv:Body>\n" + - "</soapenv:Envelope>\n"; - request.setStream(new MockInputStream(xml.getBytes("UTF-8"))); - host.invoke(request, response); - xml = "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header /><soapenv:Body><helloworldaxis:getGreetingsResponse xmlns:helloworldaxis=\"http://helloworldaxis.samples.tuscany.apache.org\">\n" + - " <helloworldaxis:getGreetingsReturn>Hello World</helloworldaxis:getGreetingsReturn>\n" + - "</helloworldaxis:getGreetingsResponse></soapenv:Body></soapenv:Envelope>"; - assertEquals(xml, response.getOutputStream().toString()); - - assertEquals(200, response.getStatus()); - host.removeChild(ctx); - } - - /** - * Test ?WSDL works - */ - public void testWebServiceIntegrationWSDL() throws Exception { -// ?WSDL doesn't work right now: TUSCANY-61 -// Wrapper wrapper = (Wrapper) ctx.findChild("/services"); -// assertNotNull("No webservice wrapper present", wrapper); -// request.setContext(ctx); -// request.setRequestURI("/services/HelloWorldService"); -// request.setMethod("GET"); -// -// request.setWrapper(wrapper); -// -// host.invoke(request, response); -// -// assertEquals(200, response.getStatus()); -// -// String s = response.getOutputStream().toString(); // would be better to validate with WSDl4J -// assertTrue(s.contains("<wsdl:service name=\"HelloWorldServiceImplService\">")); -// -// host.removeChild(ctx); - } - - public void testServletMapping() throws Exception { - TuscanyHost tuscanyHost = (TuscanyHost) host; - host.addChild(ctx); - - MockServlet servlet = new MockServlet(); - tuscanyHost.registerMapping("/testContext/magicServlet", servlet); - assertSame(ctx, host.map("/testContext/magicServlet")); - MessageBytes uri = MessageBytes.newInstance(); - uri.setString("/testContext/magicServlet"); - MappingData mappingData = new MappingData(); - ctx.getMapper().map(uri, mappingData); - assertTrue(mappingData.requestPath.equals("/magicServlet")); - - assertSame(servlet, tuscanyHost.getMapping("/testContext/magicServlet")); - host.removeChild(ctx); - } - - public void testServletMappingWithWildard() throws Exception { - TuscanyHost tuscanyHost = (TuscanyHost) host; - host.addChild(ctx); - - MockServlet servlet = new MockServlet(); - tuscanyHost.registerMapping("/testContext/magicServlet/*", servlet); - assertSame(ctx, host.map("/testContext/magicServlet/foo")); - MessageBytes uri = MessageBytes.newInstance(); - uri.setString("/testContext/magicServlet/foo"); - MappingData mappingData = new MappingData(); - mappingData.recycle(); - ctx.getMapper().map(uri, mappingData); - assertTrue(mappingData.requestPath.equals("/magicServlet/foo")); - - assertSame(servlet, tuscanyHost.getMapping("/testContext/magicServlet/bar")); - host.removeChild(ctx); - } - - protected void setUp() throws Exception { - super.setUp(); - app1 = new File(getClass().getResource("/app1").toURI()); - File baseDir = new File(app1, "../../tomcat").getCanonicalFile(); - setupTomcat(baseDir, new TuscanyHost()); - engine.start(); - - TestClassLoader cl = new TestClassLoader(classes, new File(app1, "WEB-INF/classes").toURL(), getClass().getClassLoader()); - cl.start(); - loader = new ContainerLoader(cl); - - // create the webapp Context - ctx = new StandardContext(); - ctx.addLifecycleListener(new ContextConfig()); - ctx.setName("/testContext"); - ctx.setDocBase(app1.getAbsolutePath()); - ctx.setLoader(loader); - } - - protected void tearDown() throws Exception { - engine.stop(); - super.tearDown(); - } - - public static class MockServlet implements Servlet { - public void init(ServletConfig servletConfig) throws ServletException { - throw new UnsupportedOperationException(); - } - - public ServletConfig getServletConfig() { - throw new UnsupportedOperationException(); - } - - public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { - } - - public String getServletInfo() { - throw new UnsupportedOperationException(); - } - - public void destroy() { - throw new UnsupportedOperationException(); - } - } -} diff --git a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatStandaloneTestCase.java b/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatStandaloneTestCase.java deleted file mode 100644 index 1aeb966625..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatStandaloneTestCase.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tomcat.integration; - -import java.io.File; - -import org.apache.catalina.Valve; -import org.apache.catalina.Wrapper; -import org.apache.catalina.core.StandardContext; -import org.apache.catalina.core.StandardHost; -import org.apache.catalina.startup.ContextConfig; - -import org.apache.tuscany.tomcat.TuscanyValve; - -/** - * @version $Rev$ $Date$ - */ -@SuppressWarnings({"ClassLoader2Instantiation"}) -public class TomcatStandaloneTestCase extends AbstractTomcatTest { - protected File app2; - - public void testRuntimeIntegration() throws Exception { - StandardContext ctx = new StandardContext(); - - // caution: this sets the parent of the webapp loader to the test classloader so it can find TestServlet - // anything that relies on the TCCL may not work correctly - ClassLoader cl = TestServlet.class.getClassLoader(); - ctx.setParentClassLoader(cl); - - ctx.addLifecycleListener(new ContextConfig()); - ctx.setName("/testContext"); - ctx.setDocBase(app2.getAbsolutePath()); - -// Doesn't work, see TUSCANY-328 -// host.addChild(ctx); -// boolean found = false; -// for (Valve valve: ctx.getPipeline().getValves()) { -// if (valve instanceof TuscanyValve) { -// found = true; -// break; -// } -// } -// assertFalse("TuscanyValve in pipeline", found); - -// request.setContext(ctx); -// request.setWrapper((Wrapper) ctx.findChild("TestServlet")); -// host.invoke(request, response); - -// host.removeChild(ctx); - } - - protected void setUp() throws Exception { - super.setUp(); - app2 = new File(getClass().getResource("/app2").toURI()); - File baseDir = new File(app2, "../../tomcat").getCanonicalFile(); - setupTomcat(baseDir, new StandardHost()); - engine.start(); - } - - protected void tearDown() throws Exception { - engine.stop(); - super.tearDown(); - } - -} diff --git a/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/axis2.xml b/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/axis2.xml deleted file mode 100644 index 07566475de..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/axis2.xml +++ /dev/null @@ -1,183 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<axisconfig name="AxisJava2.0"> - <!-- ================================================= --> - <!-- Parameters --> - <!-- ================================================= --> - <parameter name="hotdeployment" locked="false">false</parameter> - <parameter name="hotupdate" locked="false">false</parameter> - <parameter name="enableMTOM" locked="false">false</parameter> - <!-- Uncomment this to enable REST support --> - <!-- <parameter name="enableREST" locked="false">true</parameter>--> - - - <parameter name="userName" locked="false">admin</parameter> - <parameter name="password" locked="false">axis2</parameter> - - <parameter name="seralizeLocation" locked="false">.</parameter> - <hostConfiguration> - <ip>127.0.0.1</ip> - <port>5555</port> - </hostConfiguration> - - - <!--if you want to extract the service archive file and work with that please uncomment this--> - <!--else , it wont extract archive file or does not take into consideration if someone drop--> - <!--exploded directory into /service directory--> - <!--<parameter name="extractServiceArchive" locked="false">true</parameter>--> - - - <!-- The way of adding listener to the system--> - <!-- <listener class="org.apache.axis2.ObserverIMPL">--> - <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>--> - <!-- </listener>--> - - <!-- ================================================= --> - <!-- Message Receivers --> - <!-- ================================================= --> - <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for --> - <!--all the other MEP implement it and add the correct entry to here , so that you can refer from--> - <!--any operation --> - <!--Note : You can ovride this for particular service by adding the same element with your requirement--> - <messageReceivers> - <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" - class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> - <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" - class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> - </messageReceivers> - <!-- ================================================= --> - <!-- Transport Ins --> - <!-- ================================================= --> - <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer"> - <parameter name="port" locked="false">6060</parameter> - </transportReceiver> - - <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver - <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener"> - <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter> - <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter> - <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter> - <parameter name="transport.mail.pop3.port" locked="false">110</parameter> - <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter> - </transportReceiver> --> - - <!--REMOVED FOR TUSCANY transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer"> - <parameter name="port" locked="false">6060</parameter> - </transportReceiver --> - - <!--REMOVED FOR TUSCANY transportReceiver name="jms" class="org.apache.axis2.transport.jms.SimpleJMSListener"> - <parameter name="transport.jms.Destination" locked="false">dynamicQueues/FOO</parameter> - <parameter name="java.naming.factory.initial" locked="false"> - org.activemq.jndi.ActiveMQInitialContextFactory</parameter> - <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter> - </transportReceiver> - --> - - <!-- ================================================= --> - <!-- Transport Outs --> - <!-- ================================================= --> - - <!--REMOVED FOR TUSCANY transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/> --> - <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/> - <!--REMOVED FOR TUSCANY transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/> --> - <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> - <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> - <parameter name="Transfer-Encoding" locked="false">chunked</parameter> - </transportSender> - <transportSender name="https" - class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> - <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> - <parameter name="Transfer-Encoding" locked="false">chunked</parameter> - </transportSender> - - <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver - <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender"> - <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter> - <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter> - <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter> - <parameter name="transport.mail.smtp.port" locked="false">25</parameter> - </transportSender> - --> - - <!-- ================================================= --> - <!-- Global Modules --> - <!-- ================================================= --> - <!-- Comment this to disable Addressing --> - <!--REMOVED FOR TUSCANY module ref="addressing"/> --> - - - <!--Configuring module , providing parameters for modules whether they refer or not--> - <!--<moduleConfig name="addressing">--> - <!--<parameter name="addressingPara" locked="false">N/A</parameter>--> - <!--</moduleConfig>--> - - <!-- ================================================= --> - <!-- Phases --> - <!-- ================================================= --> - <phaseOrder type="inflow"> - <!-- System pre defined phases --> - <phase name="TransportIn"/> - <phase name="PreDispatch"/> - <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase"> - <handler name="AddressingBasedDispatcher" - class="org.apache.axis2.engine.AddressingBasedDispatcher"> - <order phase="Dispatch"/> - </handler> - - <handler name="RequestURIBasedDispatcher" - class="org.apache.axis2.engine.RequestURIBasedDispatcher"> - <order phase="Dispatch"/> - </handler> - - <handler name="SOAPActionBasedDispatcher" - class="org.apache.axis2.engine.SOAPActionBasedDispatcher"> - <order phase="Dispatch"/> - </handler> - - <handler name="SOAPMessageBodyBasedDispatcher" - class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher"> - <order phase="Dispatch"/> - </handler> - <handler name="InstanceDispatcher" - class="org.apache.axis2.engine.InstanceDispatcher"> - <order phase="PostDispatch"/> - </handler> - </phase> - <!-- System pre defined phases --> - <!-- After Postdispatch phase module author or or service author can add any phase he want --> - <phase name="userphase1"/> - </phaseOrder> - <phaseOrder type="outflow"> - <!-- user can add his own phases to this area --> - <phase name="userphase1"/> - <!--system predefined phase--> - <!--these phase will run irrespective of the service--> - <phase name="PolicyDetermination"/> - <phase name="MessageOut"/> - </phaseOrder> - <phaseOrder type="INfaultflow"> - <!-- user can add his own phases to this area --> - <phase name="userphase1"/> - </phaseOrder> - <phaseOrder type="Outfaultflow"> - <!-- user can add his own phases to this area --> - <phase name="userphase1"/> - <phase name="PolicyDetermination"/> - <phase name="MessageOut"/> - </phaseOrder> -</axisconfig> - diff --git a/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/sca.module b/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/sca.module deleted file mode 100644 index 4d19c4d192..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/sca.module +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" - name="testModule"> - - <import.sdo wsdlLocation="wsdl/helloworld.wsdl"/> - <import.wsdl wsdlLocation="wsdl/helloworld.wsdl"/> - - <entryPoint name="HelloWorldService"> - <interface.wsdl interface="http://helloworldaxis.samples.tuscany.apache.org#wsdl.interface(HelloWorldServiceImpl)"/> - <binding.ws port="http://helloworldaxis.samples.tuscany.apache.org#wsdl.endpoint(HelloWorldServiceImplService/helloworld)"/> - <reference>HelloWorld/HelloWorldService</reference> - </entryPoint> - - <component name="HelloWorld"> - <implementation.java class="org.apache.tuscany.tomcat.integration.HelloWorldImpl"/> - </component> - -</module> diff --git a/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/wsdl/helloworld.wsdl b/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/wsdl/helloworld.wsdl deleted file mode 100644 index 3d299481e5..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/wsdl/helloworld.wsdl +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld"> - <!--WSDL created by Apache Axis version: 1.2.1 -Built on Jun 14, 2005 (09:15:57 EDT)--> - <wsdl:types> - <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema"> - <element name="getGreetings"> - <complexType> - <sequence> - <element name="in0" type="xsd:string"/> - </sequence> - </complexType> - </element> - <element name="getGreetingsResponse"> - <complexType> - <sequence> - <element name="getGreetingsReturn" type="xsd:string"/> - </sequence> - </complexType> - </element> - </schema> - </wsdl:types> - - <wsdl:message name="getGreetingsRequest"> - - <wsdl:part element="impl:getGreetings" name="parameters"/> - - </wsdl:message> - - <wsdl:message name="getGreetingsResponse"> - - <wsdl:part element="impl:getGreetingsResponse" name="parameters"/> - - </wsdl:message> - - <wsdl:portType name="HelloWorldServiceImpl"> - - <wsdl:operation name="getGreetings"> - - <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/> - - <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/> - - </wsdl:operation> - - </wsdl:portType> - - <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl"> - - <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> - - <wsdl:operation name="getGreetings"> - - <wsdlsoap:operation soapAction=""/> - - <wsdl:input name="getGreetingsRequest"> - - <wsdlsoap:body use="literal"/> - - </wsdl:input> - - <wsdl:output name="getGreetingsResponse"> - - <wsdlsoap:body use="literal"/> - - </wsdl:output> - - </wsdl:operation> - - </wsdl:binding> - - <wsdl:service name="HelloWorldServiceImplService"> - - <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld"> - - <wsdlsoap:address location="http://localhost:8080/sample-helloworldws/services/HelloWorldService"/> - - </wsdl:port> - - </wsdl:service> - -</wsdl:definitions> diff --git a/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/web.xml b/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/web.xml deleted file mode 100644 index f109ddf404..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/resources/app1/WEB-INF/web.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE web-app - PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" - "http://java.sun.com/dtd/web-app_2_3.dtd"> -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<web-app> -</web-app> diff --git a/branches/java-M1/java/sca/tomcat/src/test/resources/app1/index.html b/branches/java-M1/java/sca/tomcat/src/test/resources/app1/index.html deleted file mode 100644 index 71653b974f..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/resources/app1/index.html +++ /dev/null @@ -1,18 +0,0 @@ -<html> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<body>Hello World</body> -</html> diff --git a/branches/java-M1/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/sca.module b/branches/java-M1/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/sca.module deleted file mode 100644 index 90ad0d44e0..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/sca.module +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- name="testModule">
-
- <import.sdo wsdlLocation="wsdl/helloworld.wsdl"/>
- <import.wsdl wsdlLocation="wsdl/helloworld.wsdl"/>
-
- <entryPoint name="HelloWorldService">
- <interface.wsdl interface="http://helloworldaxis.samples.tuscany.apache.org#wsdl.interface(HelloWorldServiceImpl)"/>
- <binding.ws port="http://helloworldaxis.samples.tuscany.apache.org#wsdl.endpoint(HelloWorldServiceImplService/helloworld)"/>
- <reference>HelloWorld/HelloWorldService</reference>
- </entryPoint>
-
- <component name="HelloWorld">
- <implementation.java class="org.apache.tuscany.tomcat.integration.HelloWorldImpl"/>
- </component>
-
-</module>
diff --git a/branches/java-M1/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/wsdl/helloworld.wsdl b/branches/java-M1/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/wsdl/helloworld.wsdl deleted file mode 100644 index 3d299481e5..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/wsdl/helloworld.wsdl +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable. - - Licensed 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. - --> -<wsdl:definitions targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld"> - <!--WSDL created by Apache Axis version: 1.2.1 -Built on Jun 14, 2005 (09:15:57 EDT)--> - <wsdl:types> - <schema elementFormDefault="qualified" targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema"> - <element name="getGreetings"> - <complexType> - <sequence> - <element name="in0" type="xsd:string"/> - </sequence> - </complexType> - </element> - <element name="getGreetingsResponse"> - <complexType> - <sequence> - <element name="getGreetingsReturn" type="xsd:string"/> - </sequence> - </complexType> - </element> - </schema> - </wsdl:types> - - <wsdl:message name="getGreetingsRequest"> - - <wsdl:part element="impl:getGreetings" name="parameters"/> - - </wsdl:message> - - <wsdl:message name="getGreetingsResponse"> - - <wsdl:part element="impl:getGreetingsResponse" name="parameters"/> - - </wsdl:message> - - <wsdl:portType name="HelloWorldServiceImpl"> - - <wsdl:operation name="getGreetings"> - - <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/> - - <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/> - - </wsdl:operation> - - </wsdl:portType> - - <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl"> - - <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> - - <wsdl:operation name="getGreetings"> - - <wsdlsoap:operation soapAction=""/> - - <wsdl:input name="getGreetingsRequest"> - - <wsdlsoap:body use="literal"/> - - </wsdl:input> - - <wsdl:output name="getGreetingsResponse"> - - <wsdlsoap:body use="literal"/> - - </wsdl:output> - - </wsdl:operation> - - </wsdl:binding> - - <wsdl:service name="HelloWorldServiceImplService"> - - <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld"> - - <wsdlsoap:address location="http://localhost:8080/sample-helloworldws/services/HelloWorldService"/> - - </wsdl:port> - - </wsdl:service> - -</wsdl:definitions> diff --git a/branches/java-M1/java/sca/tomcat/src/test/resources/app2/WEB-INF/web.xml b/branches/java-M1/java/sca/tomcat/src/test/resources/app2/WEB-INF/web.xml deleted file mode 100644 index 9bd3882e81..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/resources/app2/WEB-INF/web.xml +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE web-app - PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" - "http://java.sun.com/dtd/web-app_2_3.dtd"> - -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<web-app> - <context-param> - <param-name>org.apache.tuscany.core.webapp.ModuleComponentName</param-name> - <param-value>/testContext</param-value> - </context-param> - <filter> - <filter-name>TuscanyFilter</filter-name> - <filter-class>org.apache.tuscany.core.webapp.TuscanyRequestFilter</filter-class> - </filter> - <filter-mapping> - <filter-name>TuscanyFilter</filter-name> - <servlet-name>TestServlet</servlet-name> - </filter-mapping> - <listener> - <listener-class>org.apache.tuscany.core.webapp.TuscanyServletListener</listener-class> - </listener> - <servlet> - <servlet-name>TestServlet</servlet-name> - <servlet-class>org.apache.tuscany.tomcat.integration.TestServlet</servlet-class> - </servlet> - <servlet-mapping> - <servlet-name>TestServlet</servlet-name> - <url-pattern>/servlet</url-pattern> - </servlet-mapping> -</web-app> diff --git a/branches/java-M1/java/sca/tomcat/src/test/resources/app2/index.html b/branches/java-M1/java/sca/tomcat/src/test/resources/app2/index.html deleted file mode 100644 index 55ecbd81ba..0000000000 --- a/branches/java-M1/java/sca/tomcat/src/test/resources/app2/index.html +++ /dev/null @@ -1,3 +0,0 @@ -<html> -<body>Hello World</body> -</html>
\ No newline at end of file diff --git a/branches/java-M1/java/sca/tools/pom.xml b/branches/java-M1/java/sca/tools/pom.xml deleted file mode 100644 index 52f6b0c682..0000000000 --- a/branches/java-M1/java/sca/tools/pom.xml +++ /dev/null @@ -1,155 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * Copyright (c) 2005-2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - --> -<project> - <parent> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-sca</artifactId> - <version>incubating-M1</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>tuscany-sca-tools</artifactId> - <name>Tuscany SCA Tools</name> - <description>SCA Tools.</description> - <version>incubating-M1</version> - - <repositories> - <repository> - <id>eclipse.emf</id> - <url>http://download.eclipse.org/tools/emf/maven2</url> - <snapshots> - <enabled>true</enabled> - </snapshots> - </repository> - </repositories> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-sdo-impl</artifactId> - <version>incubating-M1</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-model</artifactId> - <version>incubating-M1</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.eclipse.emf</groupId> - <artifactId>codegen</artifactId> - <version>2.2.0-RC4</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.eclipse.emf</groupId> - <artifactId>codegen-ecore</artifactId> - <version>2.2.0-RC4</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>axis2</groupId> - <artifactId>axis2-kernel</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>axis2</groupId> - <artifactId>axis2-codegen</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>wsdl4j</groupId> - <artifactId>wsdl4j</artifactId> - <version>1.5.2</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.0.4</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.12</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>ws-commons</groupId> - <artifactId>policy</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>ws-commons</groupId> - <artifactId>axiom-api</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>ws-commons</groupId> - <artifactId>axiom-impl</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>stax</groupId> - <artifactId>stax-api</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>woodstox</groupId> - <artifactId>wstx-asl</artifactId> - <version>2.9.3</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.ws.commons</groupId> - <artifactId>XmlSchema</artifactId> - <version>1.0.2</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>annogen</groupId> - <artifactId>annogen</artifactId> - <version>0.1.0</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - -</project> diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java deleted file mode 100644 index dfd5506af9..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java +++ /dev/null @@ -1,314 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Map;
-
-import org.apache.ws.java2wsdl.Java2WSDLConstants;
-import org.apache.ws.java2wsdl.Java2WSDLUtils;
-import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
-
-/**
- * This class encapsulates the parameters that effect the generation of the
- * WSDL. For example they contain all user settings such as source class,
- * target location etc.
- *
- */
-public class GenerationParameters
-{
- public static final String WSDL_FILENAME_SUFFIX = ".wsdl";
-
- private Map cmdLineOptions = null;
- private FileOutputStream outputFileStream = null;
- private String sourceClassName = null;
-
- private String targetNamespace = null;
- private String targetNamespacePrefix = null;
- private String schemaTargetNamespace = null;
- private String schemaTargetNamespacePrefix = null;
- private ClassLoader classLoader = null;
- private String serviceName = null;
- private String style = null;
- private String use = null;
- private String locationUri = null;
-
- public GenerationParameters(Map cmdLineOptions) throws Exception
- {
- this.cmdLineOptions = cmdLineOptions;
- loadParameters();
- }
-
- protected void loadParameters() throws Exception
- {
- initializeSourceClassName();
- resolveFileOutputStream();
- resolveClassLoader4InputClasspath();
- initializeOtherParams();
- }
-
- private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption) {
- //short option gets precedence
- Java2WSDLCommandLineOption option = null;
- if (longOption != null) {
- option = (Java2WSDLCommandLineOption) cmdLineOptions.get(longOption);
- if (option != null) {
- return option;
- }
- }
- if (shortOption != null) {
- option = (Java2WSDLCommandLineOption) cmdLineOptions.get(shortOption);
- }
-
- return option;
- }
-
- protected void initializeSourceClassName() throws Exception
- {
- Java2WSDLCommandLineOption option =
- loadOption(Java2WSDLConstants.CLASSNAME_OPTION, Java2WSDLConstants.CLASSNAME_OPTION_LONG);
- sourceClassName = option == null ? null : option.getOptionValue();
-
- if (sourceClassName == null || sourceClassName.equals("")) {
- throw new Exception("class name must be present!");
- }
- }
-
- /**
- * @throws Exception
- */
- protected void resolveFileOutputStream() throws Exception
- {
- File outputFolder;
- Java2WSDLCommandLineOption option = loadOption(Java2WSDLConstants.OUTPUT_LOCATION_OPTION,
- Java2WSDLConstants.OUTPUT_LOCATION_OPTION_LONG);
- String outputFolderName = option == null ? System.getProperty("user.dir") : option.getOptionValue();
-
- outputFolder = new File(outputFolderName);
- if (!outputFolder.exists()) {
- outputFolder.mkdirs();
- } else if (!outputFolder.isDirectory()) {
- throw new Exception("The specified location " + outputFolderName + "is not a folder");
- }
-
- option = loadOption(Java2WSDLConstants.OUTPUT_FILENAME_OPTION,
- Java2WSDLConstants.OUTPUT_FILENAME_OPTION_LONG);
- String outputFileName = option == null ? null : option.getOptionValue();
- //derive a file name from the class name if the filename is not specified
- if (outputFileName == null)
- {
- outputFileName = Java2WSDLUtils.getSimpleClassName(sourceClassName) + WSDL_FILENAME_SUFFIX;
- }
-
- //first create a file in the given location
- File outputFile = new File(outputFolder, outputFileName);
- try
- {
- if (!outputFile.exists())
- {
- outputFile.createNewFile();
- }
- outputFileStream = new FileOutputStream(outputFile);
- }
- catch (IOException e)
- {
- throw new Exception(e);
- }
- }
-
- protected void resolveClassLoader4InputClasspath() throws Exception
- {
- Java2WSDLCommandLineOption option = null;
-
- if (option != null) {
- ArrayList optionValues = option.getOptionValues();
- URL[] urls = new URL[optionValues.size()];
- String[] classPathEntries = (String[]) optionValues.toArray(new String[optionValues.size()]);
-
- try {
- for (int i = 0; i < classPathEntries.length; i++) {
- String classPathEntry = classPathEntries[i];
- //this should be a file(or a URL)
- if (Java2WSDLUtils.isURL(classPathEntry)) {
- urls[i] = new URL(classPathEntry);
- } else {
- urls[i] = new File(classPathEntry).toURL();
- }
- }
- } catch (MalformedURLException e) {
- throw new Exception(e);
- }
-
- classLoader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader());
-
- } else {
- classLoader = Thread.currentThread().getContextClassLoader();
- }
- }
-
- protected void initializeOtherParams()
- {
-// set the other parameters to the builder
- Java2WSDLCommandLineOption option = loadOption(Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_OPTION,
- Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_OPTION_LONG);
- schemaTargetNamespace = (option == null) ? null : option.getOptionValue();
-
- option = loadOption(Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION,
- Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG);
- schemaTargetNamespacePrefix = (option == null) ? null : option.getOptionValue();
-
- option = loadOption(Java2WSDLConstants.TARGET_NAMESPACE_OPTION,
- Java2WSDLConstants.TARGET_NAMESPACE_OPTION_LONG);
- targetNamespace = (option == null) ? null : option.getOptionValue();
-
- option = loadOption(Java2WSDLConstants.TARGET_NAMESPACE_PREFIX_OPTION,
- Java2WSDLConstants.TARGET_NAMESPACE_PREFIX_OPTION_LONG);
- targetNamespacePrefix = (option == null) ? null : option.getOptionValue();
-
- option = loadOption(Java2WSDLConstants.SERVICE_NAME_OPTION,
- Java2WSDLConstants.SERVICE_NAME_OPTION_LONG);
- serviceName = (option == null) ? Java2WSDLUtils.getSimpleClassName(sourceClassName) : option.getOptionValue();
-
- option = loadOption(Java2WSDLConstants.STYLE_OPTION,Java2WSDLConstants.STYLE_OPTION);
- style = (option == null) ? null : option.getOptionValue();
-
-
- option = loadOption(Java2WSDLConstants.LOCATION_OPTION,
- Java2WSDLConstants.LOCATION_OPTION);
- locationUri = (option == null) ? null : option.getOptionValue();
-
- option = loadOption(Java2WSDLConstants.USE_OPTION,Java2WSDLConstants.USE_OPTION);
- use = (option == null) ? null : option.getOptionValue();
- }
-
- public ClassLoader getClassLoader()
- {
- return classLoader;
- }
-
- public void setClassLoader(ClassLoader classLoader)
- {
- this.classLoader = classLoader;
- }
-
- public String getLocationUri()
- {
- return locationUri;
- }
-
- public void setLocationUri(String locationUri)
- {
- this.locationUri = locationUri;
- }
-
- public FileOutputStream getOutputFileStream()
- {
- return outputFileStream;
- }
-
- public void setOutputFileStream(FileOutputStream outputFileStream)
- {
- this.outputFileStream = outputFileStream;
- }
-
- public String getSchemaTargetNamespace()
- {
- return schemaTargetNamespace;
- }
-
- public void setSchemaTargetNamespace(String schemaTargetNamespace)
- {
- this.schemaTargetNamespace = schemaTargetNamespace;
- }
-
- public String getSchemaTargetNamespacePrefix()
- {
- return schemaTargetNamespacePrefix;
- }
-
- public void setSchemaTargetNamespacePrefix(String schemaTargetNamespacePrefix)
- {
- this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix;
- }
-
- public String getServiceName()
- {
- return serviceName;
- }
-
- public void setServiceName(String serviceName)
- {
- this.serviceName = serviceName;
- }
-
- public String getSourceClassName()
- {
- return sourceClassName;
- }
-
- public void setSourceClassName(String sourceClassName)
- {
- this.sourceClassName = sourceClassName;
- }
-
- public String getStyle()
- {
- return style;
- }
-
- public void setStyle(String style)
- {
- this.style = style;
- }
-
- public String getTargetNamespace()
- {
- return targetNamespace;
- }
-
- public void setTargetNamespace(String targetNamespace)
- {
- this.targetNamespace = targetNamespace;
- }
-
- public String getTargetNamespacePrefix()
- {
- return targetNamespacePrefix;
- }
-
- public void setTargetNamespacePrefix(String targetNamespacePrefix)
- {
- this.targetNamespacePrefix = targetNamespacePrefix;
- }
-
- public String getUse()
- {
- return use;
- }
-
- public void setUse(String use)
- {
- this.use = use;
- }
-}
-
diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java deleted file mode 100644 index 5538ec1cfa..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java +++ /dev/null @@ -1,59 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser;
-import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator;
-
-/**
- * This class provides the tooling abstraction to Tuscany Java2WSDL and can be
- * invoked from command line with the follwing options as with Axis2 Java2WSDL
- *
- */
-public class Java2WSDL {
- /**
- * @param args
- */
- public static void main(String[] args)
- {
- //parse the cmd line args
- Java2WSDLCommandLineOptionParser commandLineOptionParser =
- new Java2WSDLCommandLineOptionParser(args);
- // validate the arguments
- validateCommandLineOptions(commandLineOptionParser);
-
- Java2WSDLGeneratorFactory.getInstance().createGenerator().
- generateWSDL(commandLineOptionParser.getAllOptions());
-
- // Uncomment the following statement to directly run the Axis2 tool
- // without
- // runAxis2Tool(args);
- }
-
- private static void runAxis2Tool(String[] args) {
- org.apache.ws.java2wsdl.Java2WSDL.main(args);
- }
-
- private static void validateCommandLineOptions(Java2WSDLCommandLineOptionParser parser) {
- if (parser.getAllOptions().size() == 0) {
- org.apache.ws.java2wsdl.Java2WSDL.printUsage();
- } else if (parser.getInvalidOptions(new Java2WSDLOptionsValidator()).size() > 0) {
- org.apache.ws.java2wsdl.Java2WSDL.printUsage();
- }
-
- }
-}
diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java deleted file mode 100644 index 0decbd6011..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java +++ /dev/null @@ -1,46 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-import java.io.OutputStream;
-import java.util.Map;
-
-/**
- * This is the Java2WSDL Generator facade that will be used by Tuscany
- * components for java to wsdl conversion.
- *
- */
-public interface Java2WSDLGenerator {
- public void generateWSDL(String[] args);
-
- public void generateWSDL(Map commandLineOptions);
-
- public void addWSDLGenListener(WSDLGenListener l);
-
- public void removeWSDLGenListener(WSDLGenListener l);
-
- public Map getCommandLineOptions();
-
- public void setCommandLineOptoins(Map cmdLineOpts);
-
- public WSDLModel getWSDLModel();
-
- public OutputStream getOutputStream();
-
- public void setOutputStream(OutputStream outStream);
-
-}
diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java deleted file mode 100644 index 3e9e745aee..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java +++ /dev/null @@ -1,87 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-import java.util.Vector;
-
-/**
- * Factory that creates Java2WSDL Generators. Presently the there is a Default
- * Generator that wraps around the AXIS2 Java2WSDL implementation. The factory
- * can be extended to create generators that wrap around other implementations
- * if required.
- */
-
-public class Java2WSDLGeneratorFactory {
- /*
- * singleton instance of this factory class
- */
- private static Java2WSDLGeneratorFactory factory = null;
-
- /**
- * code for the default generator
- */
- public static final int DEFAULT_GENERATOR = 0;
-
- /**
- * Default Generator class name
- */
- public static final String DEFAULT_GENERATOR_CLASSNAME = "org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorImpl";
-
- /**
- * list of generator classnames in a position that corresponds to their
- * code. For example the default generator's code is 0 and hence this
- * generator's classname is stored at index '0' of the list
- */
- protected Vector<String> generatorClassNames = new Vector<String>();
-
- /**
- * @return the singleton instance of this generator factory
- */
- public static Java2WSDLGeneratorFactory getInstance() {
- if (factory == null) {
- factory = new Java2WSDLGeneratorFactory();
- }
- return factory;
- }
-
- private Java2WSDLGeneratorFactory() {
- generatorClassNames.addElement(DEFAULT_GENERATOR_CLASSNAME);
- }
-
- public Java2WSDLGenerator createGenerator() {
- return createGenerator(DEFAULT_GENERATOR);
- }
-
- /**
- * creates an instance of a Java2WSDL Generator based on the input type
- *
- * @param genType
- * type of the generator to be created
- * @return an instance of a Java2WSDL Generator
- */
- public Java2WSDLGenerator createGenerator(int genType) {
- try {
- return (Java2WSDLGenerator) (Class.forName(generatorClassNames
- .elementAt(genType)).newInstance());
- } catch (Exception e) {
- System.out
- .println(" Unable to create Java2WSDL generator due to .....");
- System.out.println(e);
- return null;
- }
- }
-}
diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java deleted file mode 100644 index 1e3498be3d..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java +++ /dev/null @@ -1,286 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-import java.io.OutputStream;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import org.apache.ws.java2wsdl.Java2WSDL;
-import org.apache.axis2.wsdl.util.CommandLineOption;
-import org.apache.axis2.wsdl.util.CommandLineOptionParser;
-import org.apache.axis2.wsdl.util.Java2WSDLOptionsValidator;
-import org.apache.ws.java2wsdl.Java2WSDLUtils;
-
-/**
- * This is an implementation of the Java2WSDLGenerator facade. This
- * implementation is a decorator around the Axis2 implementation of the
- * Java2WSDL conversion. The WSDL generation is divided into phases that are
- * stringed up as a template method. The phases are - User Input Validation -
- * WSDL Java Model Generation - Serialization of WSDL Java Model The function of
- * each phase is accomplished by delegation to the appropriate classes in Axis2.
- * At the start and end of each phase an event is published to subcribers
- * denoting the start and end of the phase.
- *
- * Such a spliting up of the Java2WSDL conversion into phases has been designed
- * to enable interceptors to modify the model or apply transformations to the
- * output. Typically the interceptors can subscribe to the start and end events
- * of these phases and hence be able to intercept.
- *
- * Note: This class contains substantial AXIS2 Java2WSDL code refactored into
- * it. These will be removed as and when the Axis2 code is fixed.
- *
- */
-public class Java2WSDLGeneratorImpl implements Java2WSDLGenerator
-{
- private List<WSDLGenListener> genPhaseListeners = new Vector<WSDLGenListener>();
- private GenerationParameters genParams = null;
- private Map<String, CommandLineOption> commandLineOptions = null;
- private TuscanyJava2WSDLBuilder java2WsdlBuilder;
- private OutputStream outputStream = null;
-
- /*public static final String HTTP = "http://";
-
- public static final String WSDL_FILENAME_SUFFIX = ".wsdl";
-
- public static final String DEFAULT_PREFIX = "wsdl";
-
- public static final char PACKAGE_CLASS_DELIMITER = '.';
-
- public static final String DEFAULT_TARGET_NAMESPACE_PREFIX = "tns";
-
- public static final String DEFAULT_SCHEMA_TARGET_NAMESPACE_PREFIX = "stns";
-
- private String sourceClassName = null;
-
-
-
- private ClassLoader classLoader;
-
- private WSDLDescription wsdlDescription = null;
-
- private WSDLModel wsdlModel = null;*/
-
- public Java2WSDLGeneratorImpl()
- {
-
- }
-
- private void multicastGenPhaseCompletionEvent(int genPhase) {
- WSDLGenEvent event = new WSDLGenEvent(this, genPhase);
- Iterator iterator = genPhaseListeners.iterator();
- while (iterator.hasNext()) {
- ((WSDLGenListener) iterator.next()).WSDLGenPhaseCompleted(event);
- }
- }
-
- private void initJava2WSDLBuilder() throws Exception
- {
-// Now we are done with loading the basic values - time to create the builder
- java2WsdlBuilder = new TuscanyJava2WSDLBuilder(genParams.getOutputFileStream(),
- genParams.getSourceClassName(),
- genParams.getClassLoader());
- java2WsdlBuilder.setSchemaTargetNamespace(genParams.getSchemaTargetNamespace());
- java2WsdlBuilder.setSchemaTargetNamespacePrefix(genParams.getSchemaTargetNamespacePrefix());
- java2WsdlBuilder.setTargetNamespace(genParams.getTargetNamespace());
- java2WsdlBuilder.setTargetNamespacePrefix(genParams.getTargetNamespacePrefix());
- java2WsdlBuilder.setServiceName(genParams.getServiceName() == null ?
- Java2WSDLUtils.getSimpleClassName(genParams.getSourceClassName()) : genParams.getServiceName());
-
- if (genParams.getStyle() != null)
- {
- java2WsdlBuilder.setStyle(genParams.getStyle());
- }
-
- if (genParams.getLocationUri() != null) {
- java2WsdlBuilder.setLocationUri(genParams.getLocationUri());
- }
-
- if (genParams.getUse() != null)
- {
- java2WsdlBuilder.setUse(genParams.getUse());
- }
- }
-
- protected boolean validateInputArgs(String[] args)
- {
- boolean isValid = true;
- CommandLineOptionParser parser = new CommandLineOptionParser(args);
- if (parser.getAllOptions().size() == 0) {
- Java2WSDL.printUsage();
- isValid = false;
- } else if (parser.getInvalidOptions(new Java2WSDLOptionsValidator())
- .size() > 0) {
- Java2WSDL.printUsage();
- isValid = false;
- }
-
- if (isValid)
- {
- commandLineOptions = parser.getAllOptions();
- }
-
- return isValid;
- }
-
- public boolean buildWSDLDocument() throws Exception
- {
- boolean isComplete = true;
- initJava2WSDLBuilder();
- java2WsdlBuilder.buildWSDL();
-
- return isComplete;
- }
-
- public boolean serializeWSDLDocument() throws Exception {
- boolean isComplete = true;
-
- if ( getOutputStream() == null )
- {
- setOutputStream(genParams.getOutputFileStream());
- }
-
- java2WsdlBuilder.getWsdlDocument().serialize(getOutputStream());
- getOutputStream().flush();
- getOutputStream().close();;
-
- return isComplete;
- }
-
- /*
- * This is the template method that splits the Java2WSDL generation cycle
- * into phase / steps.
- *
- * @see tuscany.tools.Java2WSDLGeneratorIfc#generateWSDL(java.lang.String[])
- */
- public void generateWSDL(Map commandLineOptions)
- {
- try
- {
- // load the user options into an easy to access abstraction
- genParams = new GenerationParameters(commandLineOptions);
-
- // if the WSDL Model generation was successul
- if ( buildWSDLDocument() )
- {
- // multicast event for generation of wsdl model
- multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_CREATION);
- // if the serialization of the generated (and fixed) model
- // is successful
- if (serializeWSDLDocument()) {
- // multicast event for writing of the WSDL Model to
- // supplied output stream
- multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_WRITING);
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- // TODO Auto-generated method stub
-
- }
-
- public void generateWSDL(String[] args)
- {
- // if the argument input are found to be valid
- if (validateInputArgs(args))
- {
- //multicast event for input args validation complete
- multicastGenPhaseCompletionEvent(WSDLGenListener.INPUT_ARGS_VALIDATION);
- generateWSDL(commandLineOptions);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see tuscany.tools.Java2WSDLGeneratorIfc#addWSDLGenListener(tuscany.tools.WSDLGenListener)
- */
- public void addWSDLGenListener(WSDLGenListener l) {
- genPhaseListeners.add(l);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see tuscany.tools.Java2WSDLGeneratorIfc#removeWSDLGenListener(tuscany.tools.WSDLGenListener)
- */
- public void removeWSDLGenListener(WSDLGenListener l) {
- genPhaseListeners.remove(l);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see tuscany.tools.Java2WSDLGeneratorIfc#getCommandLineOptions()
- */
- public Map getCommandLineOptions() {
- return commandLineOptions;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see tuscany.tools.Java2WSDLGeneratorIfc#setCommandLineOptoins(java.util.Map)
- */
- public void setCommandLineOptoins(Map cmdLineOpts) {
- commandLineOptions = cmdLineOpts;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see tuscany.tools.Java2WSDLGeneratorIfc#getOutputStream()
- */
- public OutputStream getOutputStream() {
- // TODO Auto-generated method stub
- return outputStream;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see tuscany.tools.Java2WSDLGeneratorIfc#setOutputStream(java.io.OutputStream)
- */
- public void setOutputStream(OutputStream outStream) {
- outputStream = outStream;
- }
-
-
- public TuscanyJava2WSDLBuilder getJava2WsdlBuilder()
- {
- return java2WsdlBuilder;
- }
-
- public void setJava2WsdlBuilder(TuscanyJava2WSDLBuilder java2WsdlBuilder)
- {
- this.java2WsdlBuilder = java2WsdlBuilder;
- }
-
- public WSDLModel getWSDLModel()
- {
- // TODO Auto-generated method stub
- return null;
- }
-}
diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java deleted file mode 100644 index 49c3e4df9f..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java +++ /dev/null @@ -1,428 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-import java.io.ByteArrayInputStream;
-import java.io.StringWriter;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.java2wsdl.Java2WSDLConstants;
-import org.apache.ws.java2wsdl.utils.TypeTable;
-import org.codehaus.jam.JMethod;
-
-public class TuscanyJava2OMBuilder implements Java2WSDLConstants {
-
- private TypeTable typeTable = null;
-
- private static int prefixCount = 1;
-
- private static final String NAMESPACE_PREFIX = "ns";
-
- private JMethod method [];
-
- private Collection schemaCollection;
-
- private String serviceName;
-
- private String targetNamespace;
-
- private String targetNamespacePrefix;
-
- private OMNamespace ns1;
-
- private OMNamespace soap;
-
- private OMNamespace soap12;
-
- private OMNamespace tns;
-
- private OMNamespace wsdl;
-
- private OMNamespace mime;
-
- private OMNamespace http;
-
- private String style;
-
- private String use;
-
- private String locationURL;
-
- public TuscanyJava2OMBuilder(JMethod[] method, Collection schemaCollection,
- TypeTable typeTab, String serviceName, String targetNamespace,
- String targetNamespacePrefix, String style, String use,
- String locationURL) {
- this.method = method;
- this.schemaCollection = schemaCollection;
- this.typeTable = typeTab;
- if (style == null) {
- this.style = DOCUMNT;
- } else {
- this.style = style;
- }
- if (use == null) {
- this.use = LITERAL;
- } else {
- this.use = use;
- }
-
- if (locationURL == null) {
- this.locationURL = DEFAULT_LOCATION_URL;
- } else {
- this.locationURL = locationURL;
- }
- this.serviceName = serviceName;
-
- if (targetNamespace != null && !targetNamespace.trim().equals("")) {
- this.targetNamespace = targetNamespace;
- } else {
- this.targetNamespace = DEFAULT_TARGET_NAMESPACE;
- }
-
- if (targetNamespacePrefix != null
- && !targetNamespacePrefix.trim().equals("")) {
- this.targetNamespacePrefix = targetNamespacePrefix;
- } else {
- this.targetNamespacePrefix = DEFAULT_TARGET_NAMESPACE_PREFIX;
- }
- }
-
- public OMElement generateOM() throws Exception {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- wsdl = fac.createOMNamespace(WSDL_NAMESPACE,
- DEFAULT_WSDL_NAMESPACE_PREFIX);
- OMElement ele = fac.createOMElement("definitions", wsdl);
-
- ele.addAttribute("targetNamespace", targetNamespace, null);
- generateNamespaces(fac, ele);
- generateTypes(fac, ele);
- generateMessages(fac, ele);
- generatePortType(fac, ele);
- generateBinding(fac, ele);
- generateService(fac, ele);
- return ele;
- }
-
- private void generateNamespaces(OMFactory fac, OMElement defintions) {
- soap = defintions.declareNamespace(URI_WSDL11_SOAP, SOAP11_PREFIX);
- tns = defintions.declareNamespace(targetNamespace,
- targetNamespacePrefix);
- soap12 = defintions.declareNamespace(URI_WSDL12_SOAP, SOAP12_PREFIX);
- http = defintions.declareNamespace(HTTP_NAMESPACE, HTTP_PREFIX);
- mime = defintions.declareNamespace(MIME_NAMESPACE, MIME_PREFIX);
- }
-
- private void generateTypes(OMFactory fac, OMElement defintions)
- throws Exception {
- OMElement wsdlTypes = fac.createOMElement("types", wsdl);
- StringWriter writer = new StringWriter();
-
- // wrap the Schema elements with this start and end tags to create a
- // document root
- // under which the schemas can fall into
- writer.write("<xmlSchemas>");
- writeSchemas(writer);
- writer.write("</xmlSchemas>");
- XMLStreamReader xmlReader = XMLInputFactory.newInstance()
- .createXMLStreamReader(
- new ByteArrayInputStream(writer.toString().getBytes()));
-
- StAXOMBuilder staxOMBuilders = new StAXOMBuilder(fac, xmlReader);
- Iterator iterator = staxOMBuilders.getDocumentElement()
- .getChildElements();
- while (iterator.hasNext()) {
- wsdlTypes.addChild((OMNode) iterator.next());
- }
- defintions.addChild(wsdlTypes);
- }
-
- private void writeSchemas(StringWriter writer) {
- Iterator iterator = schemaCollection.iterator();
- XmlSchema xmlSchema = null;
- //Iterator typeIterator = null;
- while (iterator.hasNext()) {
- xmlSchema = (XmlSchema) iterator.next();
- //typeIterator = xmlSchema.getSchemaTypes().getValues();
- /*while (typeIterator.hasNext()) {
- xmlSchema.getItems().add((XmlSchemaObject) typeIterator.next());
-
- }*/
- xmlSchema.write(writer);
- }
- }
-
- private void generateMessages(OMFactory fac, OMElement definitions) {
- Hashtable namespaceMap = new Hashtable();
- String namespacePrefix = null;
- String namespaceURI = null;
- QName messagePartType = null;
- for (int i = 0; i < method.length; i++) {
- JMethod jmethod = method[i];
-
- // only if a type for the message part has already been defined
- if ((messagePartType = typeTable.getComplexSchemaType(jmethod
- .getSimpleName())) != null) {
- namespaceURI = messagePartType.getNamespaceURI();
- // avoid duplicate namespaces
- if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) {
- namespacePrefix = generatePrefix();
- namespaceMap.put(namespaceURI, namespacePrefix);
- }
-
- //Request Message
- OMElement requestMessge = fac.createOMElement(
- MESSAGE_LOCAL_NAME, wsdl);
- requestMessge.addAttribute(ATTRIBUTE_NAME, jmethod
- .getSimpleName()
- + MESSAGE_SUFFIX, null);
- definitions.addChild(requestMessge);
- OMElement requestPart = fac.createOMElement(
- PART_ATTRIBUTE_NAME, wsdl);
- requestMessge.addChild(requestPart);
- requestPart.addAttribute(ATTRIBUTE_NAME, "part1", null);
-
- requestPart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
- namespacePrefix + COLON_SEPARATOR
- + jmethod.getSimpleName(), null);
- }
-
- // only if a type for the message part has already been defined
- if ((messagePartType = typeTable.getComplexSchemaType(jmethod
- .getSimpleName()
- + RESPONSE)) != null) {
- namespaceURI = messagePartType.getNamespaceURI();
- if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) {
- namespacePrefix = generatePrefix();
- namespaceMap.put(namespaceURI, namespacePrefix);
- }
- //Response Message
- OMElement responseMessge = fac.createOMElement(
- MESSAGE_LOCAL_NAME, wsdl);
- responseMessge.addAttribute(ATTRIBUTE_NAME, jmethod
- .getSimpleName()
- + RESPONSE_MESSAGE, null);
- definitions.addChild(responseMessge);
- OMElement responsePart = fac.createOMElement(
- PART_ATTRIBUTE_NAME, wsdl);
- responseMessge.addChild(responsePart);
- responsePart.addAttribute(ATTRIBUTE_NAME, "part1", null);
-
- responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
- namespacePrefix + COLON_SEPARATOR
- + jmethod.getSimpleName() + RESPONSE, null);
- }
- }
-
- // now add these unique namespaces to the the definitions element
- Enumeration enumeration = namespaceMap.keys();
- while (enumeration.hasMoreElements()) {
- namespaceURI = (String) enumeration.nextElement();
- definitions.declareNamespace(namespaceURI, (String) namespaceMap
- .get(namespaceURI));
- }
- }
-
- /**
- * Generate the porttypes
- */
- private void generatePortType(OMFactory fac, OMElement defintions) {
- JMethod jmethod = null;
- OMElement operation = null;
- OMElement message = null;
- OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, wsdl);
- defintions.addChild(portType);
- portType.addAttribute(ATTRIBUTE_NAME, serviceName + PORT_TYPE_SUFFIX,
- null);
- //adding message refs
- for (int i = 0; i < method.length; i++) {
- jmethod = method[i];
- operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl);
- portType.addChild(operation);
- operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(),
- null);
-
- message = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
- message.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
- + COLON_SEPARATOR + jmethod.getSimpleName()
- + MESSAGE_SUFFIX, null);
- operation.addChild(message);
-
- if (!jmethod.getReturnType().isVoidType()) {
- message = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
- message.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
- + COLON_SEPARATOR + jmethod.getSimpleName()
- + RESPONSE_MESSAGE, null);
- operation.addChild(message);
- }
- }
-
- }
-
- /**
- * Generate the service
- */
- public void generateService(OMFactory fac, OMElement defintions) {
- OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, wsdl);
- defintions.addChild(service);
- service.addAttribute(ATTRIBUTE_NAME, serviceName, null);
- OMElement port = fac.createOMElement(PORT, wsdl);
- service.addChild(port);
- port.addAttribute(ATTRIBUTE_NAME, serviceName + SOAP11PORT, null);
- port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + COLON_SEPARATOR
- + serviceName + BINDING_NAME_SUFFIX, null);
- addExtensionElement(fac, port, soap, SOAP_ADDRESS, LOCATION, locationURL
- + serviceName);
-
- port = fac.createOMElement(PORT, wsdl);
- service.addChild(port);
- port.addAttribute(ATTRIBUTE_NAME, serviceName + SOAP12PORT, null);
- port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + COLON_SEPARATOR
- + serviceName + SOAP12BINDING_NAME_SUFFIX, null);
- addExtensionElement(fac, port, soap12, SOAP_ADDRESS, LOCATION, locationURL
- + serviceName);
- }
-
- /**
- * Generate the bindings
- */
- private void generateBinding(OMFactory fac, OMElement defintions) {
- generateSoap11Binding(fac, defintions);
- generateSoap12Binding(fac, defintions);
- }
-
- private void generateSoap11Binding(OMFactory fac, OMElement defintions) {
- OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl);
- defintions.addChild(binding);
- binding.addAttribute(ATTRIBUTE_NAME, serviceName + BINDING_NAME_SUFFIX,
- null);
- binding.addAttribute("type", tns.getPrefix() + COLON_SEPARATOR
- + serviceName + PORT_TYPE_SUFFIX, null);
-
- addExtensionElement(fac, binding, soap, BINDING_LOCAL_NAME, TRANSPORT,
- TRANSPORT_URI, STYLE, style);
-
- for (int i = 0; i < method.length; i++) {
- JMethod jmethod = method[i];
- OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
- wsdl);
- binding.addChild(operation);
-
- addExtensionElement(fac, operation, soap, OPERATION_LOCAL_NAME,
- SOAP_ACTION, URN_PREFIX + COLON_SEPARATOR
- + jmethod.getSimpleName(), STYLE, style);
- operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(),
- null);
-
- OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
- addExtensionElement(fac, input, soap, SOAP_BODY, SOAP_USE, use,
- "namespace", targetNamespace);
- operation.addChild(input);
-
- if (!jmethod.getReturnType().isVoidType()) {
- OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
- addExtensionElement(fac, output, soap, SOAP_BODY, SOAP_USE, use,
- "namespace", targetNamespace);
- operation.addChild(output);
- }
- }
- }
-
- private void generateSoap12Binding(OMFactory fac, OMElement defintions) {
- OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl);
- defintions.addChild(binding);
- binding.addAttribute(ATTRIBUTE_NAME, serviceName + SOAP12BINDING_NAME_SUFFIX,
- null);
- binding.addAttribute("type", tns.getPrefix() + COLON_SEPARATOR
- + serviceName + PORT_TYPE_SUFFIX, null);
-
- addExtensionElement(fac, binding, soap12, BINDING_LOCAL_NAME, TRANSPORT,
- TRANSPORT_URI, STYLE, style);
-
- for (int i = 0; i < method.length; i++) {
- JMethod jmethod = method[i];
- OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
- wsdl);
- binding.addChild(operation);
- operation.declareNamespace(URI_WSDL12_SOAP, SOAP12_PREFIX);
-
- addExtensionElement(fac, operation, soap12, OPERATION_LOCAL_NAME,
- SOAP_ACTION, URN_PREFIX + COLON_SEPARATOR
- + jmethod.getSimpleName(), STYLE, style);
- operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(),
- null);
-
- OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
- addExtensionElement(fac, input, soap12, SOAP_BODY, SOAP_USE, use,
- "namespace", targetNamespace);
- operation.addChild(input);
-
- if (!jmethod.getReturnType().isVoidType()) {
- OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
- addExtensionElement(fac, output, soap12, SOAP_BODY, SOAP_USE, use,
- "namespace", targetNamespace);
- operation.addChild(output);
- }
- }
- }
-
-// private void addExtensionElement(OMFactory fac, OMElement element, String name, OMNamespace namespace,
-// Hashtable attrs) {
-// OMElement soapbinding = fac.createOMElement(name, namespace);
-// element.addChild(soapbinding);
-// Enumeration enumeration = attrs.keys();
-// String attrName = null;
-// while (enumeration.hasMoreElements()) {
-// attrName = (String) enumeration.nextElement();
-// soapbinding.addAttribute(attrName, (String) attrs.get(attrName), null);
-// }
-// }
-
- private void addExtensionElement(OMFactory fac, OMElement element, OMNamespace namespace,
- String name, String att1Name, String att1Value, String att2Name,
- String att2Value) {
- OMElement soapbinding = fac.createOMElement(name, namespace);
- element.addChild(soapbinding);
- soapbinding.addAttribute(att1Name, att1Value, null);
- soapbinding.addAttribute(att2Name, att2Value, null);
- }
-
- private void addExtensionElement(OMFactory fac, OMElement element, OMNamespace namespace,
- String name, String att1Name, String att1Value) {
- OMElement soapbinding = fac.createOMElement(name, namespace);
- element.addChild(soapbinding);
- soapbinding.addAttribute(att1Name, att1Value, null);
- }
-
- private String generatePrefix() {
- return NAMESPACE_PREFIX + prefixCount++;
- }
-
-}
diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java deleted file mode 100644 index ede8b6e692..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java +++ /dev/null @@ -1,165 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-import java.io.OutputStream;
-import java.util.Collection;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.ws.java2wsdl.Java2WSDLConstants;
-import org.apache.ws.java2wsdl.Java2WSDLUtils;
-import org.apache.ws.java2wsdl.SchemaGenerator;
-
-public class TuscanyJava2WSDLBuilder {
-
- private OutputStream out;
- private String className;
- private ClassLoader classLoader;
- private String wsdlPrefix = "wsdl";
-
- private String serviceName = null;
-
- //these apply for the WSDL
- private String targetNamespace = null;
- private String targetNamespacePrefix = null;
-
- private String schemaTargetNamespace = null;
- private String schemaTargetNamespacePrefix = null;
- private String style = Java2WSDLConstants.DOCUMNT;
- private String use = Java2WSDLConstants.LITERAL;
- private String locationUri = Java2WSDLConstants.DEFAULT_LOCATION_URL;
-
- private OMElement wsdlDocument = null;
-
- public String getSchemaTargetNamespace() {
- return schemaTargetNamespace;
- }
-
- public String getStyle() {
- return style;
- }
-
- public String getLocationUri() {
- return locationUri;
- }
-
- public void setLocationUri(String locationUri) {
- this.locationUri = locationUri;
- }
-
- public void setStyle(String style) {
- this.style = style;
- }
-
- public String getUse() {
- return use;
- }
-
- public void setUse(String use) {
- this.use = use;
- }
-
- public void setSchemaTargetNamespace(String schemaTargetNamespace) {
- this.schemaTargetNamespace = schemaTargetNamespace;
- }
-
- public String getSchemaTargetNamespacePrefix() {
- return schemaTargetNamespacePrefix;
- }
-
- public void setSchemaTargetNamespacePrefix(String schemaTargetNamespacePrefix) {
- this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix;
- }
-
- public String getTargetNamespace() {
- return targetNamespace;
- }
-
- public void setTargetNamespace(String targetNamespace) {
- this.targetNamespace = targetNamespace;
- }
-
- public String getTargetNamespacePrefix() {
- return targetNamespacePrefix;
- }
-
- public void setTargetNamespacePrefix(String targetNamespacePrefix) {
- this.targetNamespacePrefix = targetNamespacePrefix;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
-
- public String getWsdlPrefix() {
- return wsdlPrefix;
- }
-
- public void setWsdlPrefix(String wsdlPrefix) {
- this.wsdlPrefix = wsdlPrefix;
- }
-
- /**
- * @param out
- * @param className
- * @param classLoader
- */
- public TuscanyJava2WSDLBuilder(OutputStream out, String className, ClassLoader classLoader) {
- this.out = out;
- this.className = className;
- this.classLoader = classLoader;
- }
-
-
- /**
- * Externally visible generator method
- *
- * @throws Exception
- */
- public void buildWSDL() throws Exception
- {
- SchemaGenerator sg = new SchemaGenerator(classLoader, className,
- schemaTargetNamespace, schemaTargetNamespacePrefix);
- Collection schemaCollection = sg.generateSchema();
- TuscanyJava2OMBuilder java2OMBuilder = new TuscanyJava2OMBuilder(sg.getMethods(),
- schemaCollection,
- sg.getTypeTable(),
- serviceName == null ? Java2WSDLUtils.getSimpleClassName(className) : serviceName,
- targetNamespace == null ? Java2WSDLUtils.namespaceFromClassName(className, classLoader).toString():targetNamespace,
- targetNamespacePrefix,
- style,
- use,
- locationUri);
- wsdlDocument = java2OMBuilder.generateOM();
- }
-
- public OMElement getWsdlDocument()
- {
- return wsdlDocument;
- }
-
- public void setWsdlDocument(OMElement wsdlDocument)
- {
- this.wsdlDocument = wsdlDocument;
- }
-}
-
diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java deleted file mode 100644 index 951742a255..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-import java.util.EventObject;
-
-public class WSDLGenEvent extends EventObject {
- private int generationPhase = WSDLGenListener.UNKNOWN;
-
- public WSDLGenEvent(Object source, int genPhase) {
- super(source);
- this.generationPhase = genPhase;
- }
-
- public int getGenerationPhase() {
- return generationPhase;
- }
-
- public void setGenerationPhase(int generationPhase) {
- this.generationPhase = generationPhase;
- }
-}
diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java deleted file mode 100644 index b4ae356bf6..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-public interface WSDLGenListener {
- public static int UNKNOWN = 0;
-
- public static int INPUT_ARGS_PARSING = 1;
-
- public static int INPUT_ARGS_VALIDATION = 2;
-
- public static int WSDL_MODEL_CREATION = 3;
-
- public static int WSDL_MODEL_WRITING = 4;
-
- public static String[] phaseAsString = { "Unknown",
- "Input Arguments Parsing", "Input Arguments Validation",
- "WSDL Model Creation", "WSDL Model Writing" };
-
- public void WSDLGenPhaseStarted(WSDLGenEvent event);
-
- public void WSDLGenPhaseCompleted(WSDLGenEvent event);
-}
diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLModel.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLModel.java deleted file mode 100644 index 69446eb0ca..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLModel.java +++ /dev/null @@ -1,29 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-
-/**
- * This class provides a higher level abstraction to parts of the WSDL model
- * generated by Axis to enable easy and straight forward access to these parts
- * when the Tuscany Java2WSDL is applying fixes to the model.
- *
- */
-public class WSDLModel
-{
- //this class is to be populated later after identifying requirements for it.
-}
diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java deleted file mode 100644 index 7bb2559b62..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java +++ /dev/null @@ -1,200 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tools.wsdl2java.generate; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.axis2.description.AxisMessage; -import org.apache.axis2.description.AxisOperation; -import org.apache.axis2.util.FileWriter; -import org.apache.axis2.wsdl.WSDLConstants; -import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; -import org.apache.axis2.wsdl.codegen.emitter.JavaEmitter; -import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter; -import org.apache.axis2.wsdl.databinding.TypeMapper; -import org.apache.tuscany.model.util.XMLNameUtil; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * Overrides the Axis2 JavaEmitter to generate unwrapped methods. - */ -public class JavaInterfaceEmitter extends JavaEmitter { - - private CodeGenConfiguration codegenConfiguration; - private TypeMapper typeMapper; - - public void setCodeGenConfiguration(CodeGenConfiguration configuration) { - super.setCodeGenConfiguration(configuration); - codegenConfiguration=configuration; - } - - public void setMapper(TypeMapper typeMapper) { - super.setMapper(typeMapper); - this.typeMapper = typeMapper; - } - - private List getParameterElementList(Document doc, AxisMessage message, boolean wrapped) { - List parameterElementList = new ArrayList(); - - if (message != null && message.getElementQName()!=null) { - - SDODataBindingTypeMappingEntry typeMappingEntry = - (SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(message.getElementQName()); - List typeMappings; - if (wrapped) { - typeMappings = (List)typeMappingEntry.getPropertyClassNames(); - } else { - typeMappings = new ArrayList(); - typeMappings.add(typeMappingEntry.getClassName()); - } - - for (int i=0; i<typeMappings.size(); i++) { - Element param = doc.createElement("param"); - parameterElementList.add(param); - - String typeMapping = (String)typeMappings.get(i); - - addAttribute(doc, "name", this.typeMapper.getParameterName(message.getElementQName()), param); - addAttribute(doc, "type", (typeMapping == null) - ? "" - : typeMapping, param); - - // add an extra attribute to say whether the type mapping is the default - if (TypeMapper.DEFAULT_CLASS_NAME.equals(typeMapping)) { - addAttribute(doc, "default", "yes", param); - } - - addAttribute(doc, "value", null, param); - - // add this as a body parameter - addAttribute(doc, "location", "body", param); - - } - } - - return parameterElementList; - } - - private List getParameterElementList(Document doc, List parameters, String location) { - List parameterElementList = new ArrayList(); - - if ((parameters != null) && !parameters.isEmpty()) { - int count = parameters.size(); - - for (int i = 0; i < count; i++) { - Element param = doc.createElement("param"); - QName name = (QName) parameters.get(i); - - addAttribute(doc, "name", this.typeMapper.getParameterName(name), param); - - String typeMapping = this.typeMapper.getTypeMappingName(name); - String typeMappingStr = (typeMapping == null) - ? "" - : typeMapping; - - addAttribute(doc, "type", typeMappingStr, param); - addAttribute(doc, "location", location, param); - parameterElementList.add(param); - } - } - - return parameterElementList; - } - - protected boolean isWrapped(AxisOperation operation) { - boolean wrapped = false; - - if (isInputPresentForMEP(operation.getMessageExchangePattern())) { - QName qname = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getElementQName(); - if (qname != null && qname.getLocalPart().equals(operation.getName().getLocalPart())) { - - SDODataBindingTypeMappingEntry typeMappingEntry = - (SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(qname); - if (typeMappingEntry.isAnonymous()) { - wrapped = true; - } - } - } - - return wrapped; - } - - private boolean isInputPresentForMEP(String MEP) { - return WSDLConstants.MEP_URI_IN_ONLY.equals(MEP) || - WSDLConstants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) || - WSDLConstants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) || - WSDLConstants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) || - WSDLConstants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) || - WSDLConstants.MEP_URI_IN_OUT.equals(MEP); - } - - protected Element getInputElement(Document doc, AxisOperation operation, List headerParameterQNameList) { - return getElement(doc, "input", operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE), isWrapped(operation), headerParameterQNameList); - } - - protected Element getOutputElement(Document doc, AxisOperation operation, List headerParameterQNameList) { - return getElement(doc, "output", operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE), isWrapped(operation), headerParameterQNameList); - } - - protected Element getElement(Document doc, String elementName, AxisMessage message, boolean wrapped, List headerParameterQNameList) { - Element element = doc.createElement(elementName); - - List parameterElementList = getParameterElementList(doc, message, wrapped); - for (int i = 0; i < parameterElementList.size(); i++) { - element.appendChild((Element) parameterElementList.get(i)); - } - - List outputElementList = getParameterElementList(doc, headerParameterQNameList, "header"); - - for (int i = 0; i < outputElementList.size(); i++) { - element.appendChild((Element) outputElementList.get(i)); - } - - return element; - } - - protected void writeInterface(boolean writeDatabinders) throws Exception { - Document interfaceModel = createDOMDocumentForInterface(writeDatabinders); - if (!codegenConfiguration.getOutputLocation().exists()) { - codegenConfiguration.getOutputLocation().mkdirs(); - } - InterfaceWriter interfaceWriter = new InterfaceWriter(this.codegenConfiguration - .getOutputLocation(), this.codegenConfiguration.getOutputLanguage()); - - String packageName = interfaceModel.getDocumentElement().getAttribute("package"); - String className = interfaceModel.getDocumentElement().getAttribute("name"); - - System.out.println(">> Generating Java class " + packageName + "." + className); - File outputFile = FileWriter.createClassFile(this.codegenConfiguration.getOutputLocation(), - packageName, className, ".java"); - if (outputFile.exists()) { - outputFile.delete(); - } - - writeClass(interfaceModel, interfaceWriter); - } - - protected String makeJavaClassName(String word) { - return XMLNameUtil.getJavaNameFromXMLName(word, true); - } - -} diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java deleted file mode 100644 index 7c31e0535c..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java +++ /dev/null @@ -1,219 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tools.wsdl2java.generate; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import javax.wsdl.Binding; -import javax.wsdl.Definition; -import javax.wsdl.Port; -import javax.wsdl.PortType; -import javax.wsdl.Service; -import javax.wsdl.WSDLException; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; -import javax.xml.namespace.QName; -import javax.xml.parsers.ParserConfigurationException; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.description.AxisService; -import org.apache.axis2.description.WSDL2AxisServiceBuilder; -import org.apache.axis2.util.XMLUtils; -import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; -import org.apache.axis2.wsdl.codegen.CodeGenerationException; -import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension; -import org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension; -import org.apache.axis2.wsdl.codegen.extension.PackageFinder; -import org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension; -import org.apache.axis2.wsdl.databinding.JavaTypeMapper; -import org.apache.tuscany.model.util.XMLNameUtil; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -public class JavaInterfaceGenerator { - - private List codegenExtensions = new ArrayList(); - private List<CodeGenConfiguration> codegenConfigurations= new LinkedList<CodeGenConfiguration>(); - - - - - public JavaInterfaceGenerator(String uri, String ports[], String outputLocation, String packageName, - Map<QName, SDODataBindingTypeMappingEntry> typeMapping) throws CodeGenerationException { - - Definition definition; - try { - definition = readWSDL(uri); - } catch (WSDLException e) { - throw new CodeGenerationException(e); - } - - HashSet interestedPorts= ports == null ? null : new HashSet(Arrays.asList(ports)); - - // Service service=(Service)definition.getServices().values().().next(); - - HashSet<QName> donePortTypes= new HashSet<QName>(); - - for (Iterator sIter = definition.getServices().values().iterator(); sIter.hasNext(); ) { - Service service = (Service) sIter.next(); - - QName serviceQname = service.getQName(); - for (Iterator pIter= service.getPorts().values().iterator(); pIter.hasNext(); ) { - Port port= (Port) pIter.next(); - if(interestedPorts != null && ! interestedPorts.contains(port.getName())) continue;//not iterested. - PortType portType= getPortType(port); - if(null == portType) continue; // not connected. - QName pQName= portType.getQName(); - if(donePortTypes.contains(pQName)) continue; //allready did it. - donePortTypes.add(pQName); - - if (packageName == null) { - packageName = XMLNameUtil.getPackageNameFromNamespace(definition.getTargetNamespace()); - } - JavaTypeMapper typeMapper = new JavaTypeMapper(); - for (Map.Entry<QName, SDODataBindingTypeMappingEntry> e : typeMapping.entrySet()) { - typeMapper.addTypeMappingObject(e.getKey(), e.getValue()); - } - AxisService axisService; - try { - axisService = new WSDL2AxisServiceBuilder(definition, serviceQname, port.getName()).populateService(); - } catch (AxisFault e) { - throw new CodeGenerationException(e); - } - axisService.setName(port.getBinding().getPortType().getQName().getLocalPart()); - CodeGenConfiguration codegenConfiguration = new CodeGenConfiguration(Collections.EMPTY_MAP); - codegenConfigurations.add(codegenConfiguration); - codegenConfiguration.setAxisService(axisService); - codegenConfiguration.setAdvancedCodeGenEnabled(false); - codegenConfiguration.setAsyncOn(false); - codegenConfiguration.setDatabindingType("sdo"); - codegenConfiguration.setGenerateAll(true); - codegenConfiguration.setGenerateDeployementDescriptor(false); - codegenConfiguration.setOutputLanguage("java"); - codegenConfiguration.setOutputLocation(new File(outputLocation)); - codegenConfiguration.setPackageName(packageName); - codegenConfiguration.setPackClasses(false); - codegenConfiguration.setPolicyMap(Collections.EMPTY_MAP); - codegenConfiguration.setPortName(port.getName()); - codegenConfiguration.setServerSide(false); - codegenConfiguration.setServiceName(service.getQName().getLocalPart()); - codegenConfiguration.setSyncOn(true); - codegenConfiguration.setTypeMapper(typeMapper); - codegenConfiguration.setWriteMessageReceiver(false); - codegenConfiguration.setWriteTestCase(false); - addExtension(new WSDLValidatorExtension(), codegenConfiguration); - addExtension(new PackageFinder(), codegenConfiguration); - addExtension(new SDODataBindingCodegenExtension(typeMapper), codegenConfiguration); - addExtension(new DefaultDatabindingExtension(), codegenConfiguration); - } - } - } - - - private PortType getPortType(Port port) { - Binding binding = port.getBinding(); - if(null != binding){ - return binding.getPortType(); - } - return null; - - } - - - @SuppressWarnings("unchecked") - private void addExtension(CodeGenExtension ext, CodeGenConfiguration codegenConfiguration) { - ext.init(codegenConfiguration); - codegenExtensions.add(ext); - } - - public void generate() throws CodeGenerationException { - try { - for (int i = 0; i < codegenExtensions.size(); i++) { - ((CodeGenExtension)codegenExtensions.get(i)).engage(); - } - - for(CodeGenConfiguration codegenConfiguration : codegenConfigurations){ - JavaInterfaceEmitter emitter = new JavaInterfaceEmitter(); - emitter.setCodeGenConfiguration(codegenConfiguration); - emitter.setMapper(codegenConfiguration.getTypeMapper()); - - emitter.writeInterface(false); - } - - } catch (Exception e) { - throw new CodeGenerationException(e); - } - } - - /** - * Read the WSDL file - * @param uri - * @return - * @throws WSDLException - */ - private Definition readWSDL(String uri) throws WSDLException { - - WSDLReader reader = - WSDLFactory.newInstance().newWSDLReader(); - reader.setFeature("javax.wsdl.importDocuments", true); - - File file = new File(uri); - String baseURI; - - if (uri.startsWith("http://")){ - baseURI = uri; - } else{ - if(file.getParentFile() == null){ - try { - baseURI = new File(".").getCanonicalFile().toURI().toString(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } else { - baseURI = file.getParentFile().toURI().toString(); - } - } - - Document doc; - try { - doc = XMLUtils.newDocument(uri); - } catch (ParserConfigurationException e) { - throw new WSDLException(WSDLException.PARSER_ERROR, - "Parser Configuration Error", - e); - } catch (SAXException e) { - throw new WSDLException(WSDLException.PARSER_ERROR, - "Parser SAX Error", - e); - - } catch (IOException e) { - throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e); - } - - return reader.readWSDL(baseURI, doc); - } - -} diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java deleted file mode 100644 index 2523b7efd6..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tools.wsdl2java.generate; - -import org.apache.axis2.wsdl.codegen.extension.AbstractDBProcessingExtension; -import org.apache.axis2.wsdl.databinding.TypeMapper; - -/** - * SDO data binding codegen extension. - */ -public class SDODataBindingCodegenExtension extends AbstractDBProcessingExtension { - - private TypeMapper typeMapper; - - public SDODataBindingCodegenExtension(TypeMapper typeMapper) { - this.typeMapper=typeMapper; - } - - protected boolean testFallThrough(String dbFrameworkName) { - return !dbFrameworkName.equals("sdo"); - } - - public void engage() { - if (testFallThrough(configuration.getDatabindingType())) { - return; - } - - // Set the type mapper into the config - configuration.setTypeMapper(typeMapper); - - } - -} diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java deleted file mode 100644 index 2f2e5521be..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tools.wsdl2java.generate; - -import java.util.List; - -/** - * This represents a type mapping entry, used by the JavaInterfaceEmitter to generate - * method signatures. - */ -public class SDODataBindingTypeMappingEntry { - - private final boolean anonymous; - private final List<String> propertyClassNames; - private final String className; - - public SDODataBindingTypeMappingEntry(String className, boolean anonymous, List<String> propertyClassNames) { - this.className = className; - this.anonymous = anonymous; - this.propertyClassNames = propertyClassNames; - } - - public boolean isAnonymous() { - return anonymous; - } - - public String getClassName() { - return className; - } - - public List<String> getPropertyClassNames() { - return propertyClassNames; - } - -} diff --git a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java b/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java deleted file mode 100644 index 5cf3426c7e..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java +++ /dev/null @@ -1,347 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tools.wsdl2java.generate; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sdo.helper.XSDHelperImpl; -import org.apache.tuscany.sdo.util.DataObjectUtil; -import org.eclipse.emf.codegen.ecore.genmodel.GenClass; -import org.eclipse.emf.codegen.ecore.genmodel.GenModel; -import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory; -import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; -import org.eclipse.emf.codegen.util.CodeGenUtil; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.BasicExtendedMetaData; -import org.eclipse.emf.ecore.util.ExtendedMetaData; - -import commonj.sdo.helper.XSDHelper; - -public class WSDL2JavaGenerator { - - /** - * Generate Java interfaces from WSDL Usage arguments: [ -targetDirectory - * <target-root-directory> ] [ -javaPackage <java-package-name> ] - * <wsdl-file> For example: generate somedir/somefile.wsdl Basic options: - * -targetDirectory Generates the Java source code in the specified - * directory. By default, the code is generated in the same directory as the - * input wsdl file. -javaPackage Overrides the Java package for the - * generated classes. By default the package name is derived from the - * targetNamespace of the WSDL definition being generated. For example, if - * the targetNamespace is "http://www.example.com/simple", the default - * package will be "com.example.simple". - */ - public static void main(String args[]) { - if (args.length == 0) { - printUsage(); - return; - } - - String portName = null; - String targetDirectory = null; - String wsdlJavaPackage = null; - String xsdJavaPackage = null; - - int index = 0; - for (; index < args.length && args[index].startsWith("-"); ++index) { - if (args[index].equalsIgnoreCase("-port")) { - portName = args[++index]; - } else if (args[index].equalsIgnoreCase("-targetDirectory")) { - targetDirectory = args[++index]; - } else if (args[index].equalsIgnoreCase("-javaPackage")) { - wsdlJavaPackage = args[++index]; - } - // else if (...) - else { - printUsage(); - return; - } - } - - String wsdlFileName = args[index]; - if (wsdlFileName == null || targetDirectory == null) { - printUsage(); - return; - } - - generateFromWSDL(wsdlFileName, portName!=null? new String[]{portName}:null, targetDirectory, wsdlJavaPackage, xsdJavaPackage, 0); - - } - - @SuppressWarnings("unchecked") - public static void generateFromWSDL(String wsdlFileName, String targetDirectory, - String wsdlJavaPackage, - String xsdJavaPackage, int genOptions){ - generateFromWSDL( wsdlFileName, null, targetDirectory, - wsdlJavaPackage, - xsdJavaPackage, genOptions); - - } - - - @SuppressWarnings("unchecked") - public static void generateFromWSDL(String wsdlFileName, String[] ports, - String targetDirectory, String wsdlJavaPackage, - String xsdJavaPackage, int genOptions) - { - - // Initialize the SDO runtime - DataObjectUtil.initRuntime(); - EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); - ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); - XSDHelper xsdHelper = new XSDHelperImpl(extendedMetaData); - - try { - - // Load the WSDL file - File inputFile = new File(wsdlFileName).getAbsoluteFile(); - InputStream inputStream = new FileInputStream(inputFile); - - // Define SDO metadata - xsdHelper.define(inputStream, inputFile.toURI().toString()); - - if (targetDirectory == null) { - targetDirectory = new File(wsdlFileName).getCanonicalFile().getParent(); - } else { - targetDirectory = new File(targetDirectory).getCanonicalPath(); - } - - // Populate the typeMapping table that will be given to the Axis2 WSDL2Java - Map<QName, SDODataBindingTypeMappingEntry> typeMapping = - new HashMap<QName, SDODataBindingTypeMappingEntry>(); - if (!packageRegistry.values().isEmpty()) { - ResourceSet resourceSet = DataObjectUtil.createResourceSet(); - - // Populate list of GenPackages and a map of GenClasses keyed by EClass - List<GenPackage> genPackages = new ArrayList<GenPackage>(); - Map<EClass, GenClass> genClasses = new HashMap<EClass, GenClass>(); - for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) { - EPackage currentEPackage = (EPackage)iter.next(); - String currentBasePackage = extractBasePackageName(currentEPackage, xsdJavaPackage); - String currentPrefix = CodeGenUtil.capName(currentEPackage.getName()); - - GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage, - currentPrefix, genOptions, resourceSet); - genPackages.add(currentGenPackage); - for (GenClass genClass : (List<GenClass>)currentGenPackage.getGenClasses()) { - genClasses.put(genClass.getEcoreClass(), genClass); - } - - } - - // Process all the SDO packages - // Populate the qname -> interfaceName typeMapping table - for (GenPackage currentGenPackage : genPackages) { - EPackage currentEPackage = currentGenPackage.getEcorePackage(); - - // Populate the type mappings for all the complex types - for (GenClass genClass : (List<GenClass>)currentGenPackage.getGenClasses()) { - QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), - extendedMetaData.getName(genClass.getEcoreClass())); - String interfaceName = currentGenPackage.getInterfacePackageName() + '.' - + genClass.getInterfaceName(); - SDODataBindingTypeMappingEntry typeMappingEntry = - new SDODataBindingTypeMappingEntry(interfaceName, false, null); - typeMapping.put(qname, typeMappingEntry); - } - - // Process all the global XSD elements - EClass documentRoot = extendedMetaData.getDocumentRoot(currentEPackage); - if (documentRoot != null) { - for (EStructuralFeature element : (List<EStructuralFeature>)extendedMetaData - .getElements(documentRoot)) { - EClassifier elementType = element.getEType(); - - // Handle a complex type - if (elementType instanceof EClass) { - EClass eClass = (EClass)elementType; - - GenClass genClass = genClasses.get(elementType); - QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), - extendedMetaData.getName(element)); - String interfaceName = genClass.getGenPackage().getInterfacePackageName() - + '.' + genClass.getInterfaceName(); - boolean anonymous = extendedMetaData.isAnonymous(eClass); - - // Build list of property class names - List<String> propertyClassNames=new ArrayList<String>(); - for (EStructuralFeature feature : (List<EStructuralFeature>)eClass.getEStructuralFeatures()) { - EClassifier propertyType = feature.getEType(); - if (propertyType instanceof EClass) { - GenClass propertyGenClass = genClasses.get(propertyType); - String propertyClassName = propertyGenClass.getGenPackage().getInterfacePackageName() - + '.' + propertyGenClass.getInterfaceName(); - propertyClassNames.add(propertyClassName); - } else if (propertyType instanceof EClassifier) { - String propertyClassName = propertyType.getInstanceClass().getName(); - propertyClassNames.add(propertyClassName); - } - } - - SDODataBindingTypeMappingEntry typeMappingEntry = - new SDODataBindingTypeMappingEntry(interfaceName, anonymous, propertyClassNames); - typeMapping.put(qname, typeMappingEntry); - - } else { - - // Handle a simple type - QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), - extendedMetaData.getName(element)); - String className = elementType.getInstanceClass().getName(); - SDODataBindingTypeMappingEntry typeMappingEntry = - new SDODataBindingTypeMappingEntry(className, false, null); - typeMapping.put(qname, typeMappingEntry); - } - } - } - } - } - - try { - JavaInterfaceGenerator codeGenerator = new JavaInterfaceGenerator(wsdlFileName, - ports, - targetDirectory, - wsdlJavaPackage, - typeMapping); - codeGenerator.generate(); - } catch (Exception e) { - throw new IllegalArgumentException(e); - } - - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - } - - @SuppressWarnings("unchecked") - public static GenPackage createGenPackage(EPackage ePackage, String basePackage, String prefix, - int genOptions, ResourceSet resourceSet) { - GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions); - - URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore"); - URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel"); - - Resource ecoreResource = resourceSet.createResource(ecoreURI); - ecoreResource.getContents().add(ePackage); - - Resource genModelResource = resourceSet.createResource(genModelURI); - genModelResource.getContents().add(genModel); - - return (GenPackage)genModel.getGenPackages().get(0); - } - - public static GenModel ecore2GenModel(EPackage ePackage, String basePackage, - String prefix, int genOptions) { - GenModel genModel = GenModelFactory.eINSTANCE.createGenModel(); - genModel.initialize(Collections.singleton(ePackage)); - - genModel.setRootExtendsInterface(""); - genModel.setRootImplementsInterface("commonj.sdo.DataObject"); - genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.DataObjectImpl"); - genModel.setFeatureMapWrapperInterface("commonj.sdo.Sequence"); - genModel.setFeatureMapWrapperInternalInterface("org.apache.tuscany.sdo.util.BasicSequence"); - genModel.setFeatureMapWrapperClass("org.apache.tuscany.sdo.util.BasicSequence"); - genModel.setSuppressEMFTypes(true); - genModel.setSuppressEMFMetaData(true); - genModel.setSuppressEMFModelTags(true); - genModel.setCanGenerate(true); - // FIXME workaround java.lang.NoClassDefFoundError: - // org/eclipse/jdt/core/jdom/IDOMNode with 02162006 build - genModel.setFacadeHelperClass("Hack"); - genModel.setForceOverwrite(true); - - GenPackage genPackage = (GenPackage)genModel.getGenPackages().get(0); - - if (basePackage != null) { - genPackage.setBasePackage(basePackage); - } - if (prefix != null) { - genPackage.setPrefix(prefix); - } - - return genModel; - } - - public static String extractBasePackageName(EPackage ePackage, String javaPackage) { - String qualifiedName = javaPackage != null ? javaPackage : ePackage.getName(); - String name = /* CodeGenUtil. */shortName(qualifiedName); - String baseName = qualifiedName.substring(0, qualifiedName.length() - name.length()); - if (javaPackage != null || !name.equals(qualifiedName)) { - ePackage.setName(name); - } - return baseName != null ? /* CodeGenUtil. */safeQualifiedName(baseName) : null; - } - - public static String shortName(String qualifiedName) { - int index = qualifiedName.lastIndexOf("."); - return index != -1 ? qualifiedName.substring(index + 1) : qualifiedName; - } - - public static String safeQualifiedName(String qualifiedName) { - StringBuffer safeQualifiedName = new StringBuffer(); - for (StringTokenizer stringTokenizer = new StringTokenizer(qualifiedName, "."); - stringTokenizer.hasMoreTokens();) { - String name = stringTokenizer.nextToken(); - safeQualifiedName.append(CodeGenUtil.safeName(name)); - if (stringTokenizer.hasMoreTokens()) { - safeQualifiedName.append('.'); - } - } - return safeQualifiedName.toString(); - } - - protected static void printDiagnostic(Diagnostic diagnostic, String indent) { - System.out.print(indent); - System.out.println(diagnostic.getMessage()); - for (Iterator i = diagnostic.getChildren().iterator(); i.hasNext();) { - printDiagnostic((Diagnostic)i.next(), indent + " "); - } - } - - protected static void printUsage() { - System.out.println("Usage arguments:"); - System.out.println(" [ -targetDirectory <target-root-directory> ]"); - System.out.println(" [ -javaPackage <java-package-name> ]"); - System.out.println(" <wsdl-file>"); - System.out.println(""); - System.out.println("For example:"); - System.out.println(""); - System.out.println(" generate somedir/somefile.wsdl"); - } - - -} diff --git a/branches/java-M1/java/sca/tools/src/main/resources/META-INF/LICENSE.txt b/branches/java-M1/java/sca/tools/src/main/resources/META-INF/LICENSE.txt deleted file mode 100644 index 25d78feeac..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,1277 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - -APACHE TUSCANY SUBCOMPONENTS: - -The Apache Tuscany distribution includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - -=============================================================================== - -For the Eclipse Modeling Framework component and the Celtix binding: - -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE -PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF -THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and -documentation distributed under this Agreement, and -b) in the case of each subsequent Contributor: - -i) changes to the Program, and - -ii) additions to the Program; - -where such changes and/or additions to the Program originate from and -are distributed by that particular Contributor. A Contribution -'originates' from a Contributor if it was added to the Program by such -Contributor itself or anyone acting on such Contributor's behalf. -Contributions do not include additions to the Program which: (i) are -separate modules of software distributed in conjunction with the -Program under their own license agreement, and (ii) are not derivative -works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor -which are necessarily infringed by the use or sale of its Contribution -alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this -Agreement, including all Contributors. - -2. GRANT OF RIGHTS - -a) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free copyright -license to reproduce, prepare derivative works of, publicly display, -publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and -object code form. - -b) Subject to the terms of this Agreement, each Contributor hereby -grants Recipient a non-exclusive, worldwide, royalty-free patent -license under Licensed Patents to make, use, sell, offer to sell, -import and otherwise transfer the Contribution of such Contributor, if -any, in source code and object code form. This patent license shall -apply to the combination of the Contribution and the Program if, at -the time the Contribution is added by the Contributor, such addition -of the Contribution causes such combination to be covered by the -Licensed Patents. The patent license shall not apply to any other -combinations which include the Contribution. No hardware per se is -licensed hereunder. - -c) Recipient understands that although each Contributor grants the -licenses to its Contributions set forth herein, no assurances are -provided by any Contributor that the Program does not infringe the -patent or other intellectual property rights of any other entity. Each -Contributor disclaims any liability to Recipient for claims brought by -any other entity based on infringement of intellectual property rights -or otherwise. As a condition to exercising the rights and licenses -granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For -example, if a third party patent license is required to allow -Recipient to distribute the Program, it is Recipient's responsibility -to acquire that license before distributing the Program. - -d) Each Contributor represents that to its knowledge it has sufficient -copyright rights in its Contribution, if any, to grant the copyright -license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form -under its own license agreement, provided that: - -a) it complies with the terms and conditions of this Agreement; and - -b) its license agreement: - -i) effectively disclaims on behalf of all Contributors all warranties -and conditions, express and implied, including warranties or -conditions of title and non-infringement, and implied warranties or -conditions of merchantability and fitness for a particular purpose; - -ii) effectively excludes on behalf of all Contributors all liability -for damages, including direct, indirect, special, incidental and -consequential damages, such as lost profits; - -iii) states that any provisions which differ from this Agreement are -offered by that Contributor alone and not by any other party; and - -iv) states that source code for the Program is available from such -Contributor, and informs licensees how to obtain it in a reasonable -manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - -a) it must be made available under this Agreement; and - -b) a copy of this Agreement must be included with each copy of the -Program. - -Contributors may not remove or alter any copyright notices contained -within the Program. - -Each Contributor must identify itself as the originator of its -Contribution, if any, in a manner that reasonably allows subsequent -Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain -responsibilities with respect to end users, business partners and the -like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a -commercial product offering should do so in a manner which does not -create potential liability for other Contributors. Therefore, if a -Contributor includes the Program in a commercial product offering, -such Contributor ("Commercial Contributor") hereby agrees to defend -and indemnify every other Contributor ("Indemnified Contributor") -against any losses, damages and costs (collectively "Losses") arising -from claims, lawsuits and other legal actions brought by a third party -against the Indemnified Contributor to the extent caused by the acts -or omissions of such Commercial Contributor in connection with its -distribution of the Program in a commercial product offering. The -obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. -In order to qualify, an Indemnified Contributor must: a) promptly -notify the Commercial Contributor in writing of such claim, and b) -allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such -claim at its own expense. - -For example, a Contributor might include the Program in a commercial -product offering, Product X. That Contributor is then a Commercial -Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance -claims and warranties are such Commercial Contributor's responsibility -alone. Under this section, the Commercial Contributor would have to -defend claims against the other Contributors related to those -performance claims and warranties, and if a court requires any other -Contributor to pay any damages as a result, the Commercial Contributor -must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS -PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY -OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to -the risks and costs of program errors, compliance with applicable -laws, damage to or loss of data, programs or equipment, and -unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR -ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING -WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR -DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this Agreement, and without further -action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity -(including a cross-claim or counterclaim in a lawsuit) alleging that -the Program itself (excluding combinations of the Program with other -software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of -the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it -fails to comply with any of the material terms or conditions of this -Agreement and does not cure such failure in a reasonable period of -time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use -and distribution of the Program as soon as reasonably practicable. -However, Recipient's obligations under this Agreement and any licenses -granted by Recipient relating to the Program shall continue and -survive. - -Everyone is permitted to copy and distribute copies of this Agreement, -but in order to avoid inconsistency the Agreement is copyrighted and -may only be modified in the following manner. The Agreement Steward -reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement -Steward has the right to modify this Agreement. The Eclipse Foundation -is the initial Agreement Steward. The Eclipse Foundation may assign -the responsibility to serve as the Agreement Steward to a suitable -separate entity. Each new version of the Agreement will be given a -distinguishing version number. The Program (including Contributions) -may always be distributed subject to the version of the Agreement -under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the -Program (including its Contributions) under the new version. Except as -expressly stated in Sections 2(a) and 2(b) above, Recipient receives -no rights or licenses to the intellectual property of any Contributor -under this Agreement, whether expressly, by implication, estoppel or -otherwise. All rights in the Program not expressly granted under this -Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and -the intellectual property laws of the United States of America. No -party to this Agreement will bring a legal action under this Agreement -more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation. - -=============================================================================== - -For the Rhino JavaScript container component: - -Mozilla Public License 1.1 (MPL 1.1) - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the -Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to -the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original Code, -prior Modifications used by a Contributor, and the Modifications made by that -particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the -combination of the Original Code and Modifications, in each case including -portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally -accepted in the software development community for the electronic transfer of -data. - - 1.5. "Executable" means Covered Code in any form other than Source -Code. - - 1.6. "Initial Developer" means the individual or entity identified as -the Initial Developer in the Source Code notice required by Exhibit A. - - 1.7. "Larger Work" means a work which combines Covered Code or -portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum -extent possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the -substance or structure of either the Original Code or any previous -Modifications. When Covered Code is released as a series of files, a -Modification is: - A. Any addition to or deletion from the contents of a file -containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or -previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code -which is described in the Source Code notice required by Exhibit A as Original -Code, and which, at the time of its release under this License is not already -Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or -hereafter acquired, including without limitation, method, process, and -apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for -making modifications to it, including all modules it contains, plus any -associated interface definition files, scripts used to control compilation and -installation of an Executable, or source code differential comparisons against -either the Original Code or another well known, available Covered Code of the -Contributor's choice. The Source Code can be in a compressed or archival form, -provided the appropriate decompression or de-archiving software is widely -available for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity -exercising rights under, and complying with all of the terms of, this License -or a future version of this License issued under Section 6.1. For legal -entities, "You" includes any entity which controls, is controlled by, or is -under common control with You. For purposes of this definition, "control" -means (a) the power, direct or indirect, to cause the direction or management -of such entity, whether by contract or otherwise, or (b) ownership of more -than fifty percent (50%) of the outstanding shares or beneficial ownership of -such entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, -non-exclusive license, subject to third party intellectual property claims: - (a) under intellectual property rights (other than patent or -trademark) Licensable by Initial Developer to use, reproduce, modify, display, -perform, sublicense and distribute the Original Code (or portions thereof) -with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or selling -of Original Code, to make, have made, use, practice, sell, and offer for sale, -and/or otherwise dispose of the Original Code (or portions thereof). - (c) the licenses granted in this Section 2.1(a) and -(b) are effective on the date Initial Developer first distributes Original -Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is -granted: 1) for code that You delete from the Original Code; 2) separate from -the Original Code; or 3) for infringements caused by: i) the modification of -the Original Code or ii) the combination of the Original Code with other -software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor -hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or -trademark) Licensable by Contributor, to use, reproduce, modify, display, -perform, sublicense and distribute the Modifications created by such -Contributor (or portions thereof) either on an unmodified basis, with other -Modifications, as Covered Code and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling -of Modifications made by that Contributor either alone and/or in combination -with its Contributor Version (or portions of such combination), to make, use, -sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications -made by that Contributor (or portions thereof); and 2) the combination of -Modifications made by that Contributor with its Contributor Version (or -portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are -effective on the date Contributor first makes Commercial Use of the Covered -Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is -granted: 1) for any code that Contributor has deleted from the Contributor -Version; 2) separate from the Contributor Version; 3) for infringements -caused by: i) third party modifications of Contributor Version or ii) the -combination of Modifications made by that Contributor with other software -(except as part of the Contributor Version) or other devices; or 4) under -Patent Claims infringed by Covered Code in the absence of Modifications made -by that Contributor. - - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are -governed by the terms of this License, including without limitation Section -2.2. The Source Code version of Covered Code may be distributed only under the -terms of this License or a future version of this License released under -Section 6.1, and You must include a copy of this License with every copy of -the Source Code You distribute. You may not offer or impose any terms on any -Source Code version that alters or restricts the applicable version of this -License or the recipients' rights hereunder. However, You may include an -additional document offering the additional rights described in Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be -made available in Source Code form under the terms of this License either on -the same media as an Executable version or via an accepted Electronic -Distribution Mechanism to anyone to whom you made an Executable version -available; and if made available via Electronic Distribution Mechanism, must -remain available for at least twelve (12) months after the date it initially -became available, or at least six (6) months after a subsequent version of -that particular Modification has been made available to such recipients. You -are responsible for ensuring that the Source Code version remains available -even if the Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a -file documenting the changes You made to create that Covered Code and the date -of any change. You must include a prominent statement that the Modification is -derived, directly or indirectly, from Original Code provided by the Initial -Developer and including the name of the Initial Developer in (a) the Source -Code, and (b) in any notice in an Executable version or related documentation -in which You describe the origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's -intellectual property rights is required to exercise the rights granted by -such Contributor under Sections 2.1 or 2.2, Contributor must include a text -file with the Source Code distribution titled "LEGAL" which describes the -claim and the party making the claim in sufficient detail that a recipient -will know whom to contact. If Contributor obtains such knowledge after the -Modification is made available as described in Section 3.2, Contributor shall -promptly modify the LEGAL file in all copies Contributor makes available -thereafter and shall take other steps (such as notifying appropriate mailing -lists or newsgroups) reasonably calculated to inform those who received the -Covered Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming -interface and Contributor has knowledge of patent licenses which are -reasonably necessary to implement that API, Contributor must also include this -information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to -Section 3.4(a) above, Contributor believes that Contributor's Modifications -are Contributor's original creation(s) and/or Contributor has sufficient -rights to grant the rights conveyed by this License. - - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source -Code. If it is not possible to put such notice in a particular Source Code -file due to its structure, then You must include such notice in a location -(such as a relevant directory) where a user would be likely to look for such a -notice. If You created one or more Modification(s) You may add your name as a -Contributor to the notice described in Exhibit A. You must also duplicate -this License in any documentation for the Source Code where You describe -recipients' rights or ownership rights relating to Covered Code. You may -choose to offer, and to charge a fee for, warranty, support, indemnity or -liability obligations to one or more recipients of Covered Code. However, You -may do so only on Your own behalf, and not on behalf of the Initial Developer -or any Contributor. You must make it absolutely clear than any such warranty, -support, indemnity or liability obligation is offered by You alone, and You -hereby agree to indemnify the Initial Developer and every Contributor for any -liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the -requirements of Section 3.1-3.5 have been met for that Covered Code, and if -You include a notice stating that the Source Code version of the Covered Code -is available under the terms of this License, including a description of how -and where You have fulfilled the obligations of Section 3.2. The notice must -be conspicuously included in any notice in an Executable version, related -documentation or collateral in which You describe recipients' rights relating -to the Covered Code. You may distribute the Executable version of Covered Code -or ownership rights under a license of Your choice, which may contain terms -different from this License, provided that You are in compliance with the -terms of this License and that the license for the Executable version does not -attempt to limit or alter the recipient's rights in the Source Code version -from the rights set forth in this License. If You distribute the Executable -version under a different license You must make it absolutely clear that any -terms which differ from this License are offered by You alone, not by the -Initial Developer or any Contributor. You hereby agree to indemnify the -Initial Developer and every Contributor for any liability incurred by the -Initial Developer or such Contributor as a result of any such terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code -not governed by the terms of this License and distribute the Larger Work as a -single product. In such a case, You must make sure the requirements of this -License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Code due to statute, -judicial order, or regulation then You must: (a) comply with the terms of this -License to the maximum extent possible; and (b) describe the limitations and -the code they affect. Such description must be included in the LEGAL file -described in Section 3.4 and must be included with all distributions of the -Source Code. Except to the extent prohibited by statute or regulation, such -description must be sufficiently detailed for a recipient of ordinary skill to -be able to understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has attached -the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised -and/or new versions of the License from time to time. Each version will be -given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the -License, You may always continue to use it under the terms of that version. -You may also choose to use such Covered Code under the terms of any subsequent -version of the License published by Netscape. No one other than Netscape has -the right to modify the terms applicable to Covered Code created under this -License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may -only do in order to apply it to code which is not already Covered Code -governed by this License), You must (a) rename Your license so that the -phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or -any confusingly similar phrase do not appear in your license (except to note -that your license differs from this License) and (b) otherwise make it clear -that Your version of the license contains terms which differ from the Mozilla -Public License and Netscape Public License. (Filling in the name of the -Initial Developer, Original Code or Contributor in the notice described in -Exhibit A shall not of themselves be deemed to be modifications of this -License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, -FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED -CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY -OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR -CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS -LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS -DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate -automatically if You fail to comply with terms herein and fail to cure such -breach within 30 days of becoming aware of the breach. All sublicenses to the -Covered Code which are properly granted shall survive any termination of this -License. Provisions which, by their nature, must remain in effect beyond the -termination of this License shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement -claim (excluding declatory judgment actions) against Initial Developer or a -Contributor (the Initial Developer or Contributor against whom You file such -action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly -infringes any patent, then any and all rights granted by such Participant to -You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice -from Participant terminate prospectively, unless if within 60 days after -receipt of notice You either: (i) agree in writing to pay Participant a -mutually agreeable reasonable royalty for Your past and future use of -Modifications made by such Participant, or (ii) withdraw Your litigation claim -with respect to the Contributor Version against such Participant. If within -60 days of notice, a reasonable royalty and payment arrangement are not -mutually agreed upon in writing by the parties or the litigation claim is not -withdrawn, the rights granted by Participant to You under Sections 2.1 and/or -2.2 automatically terminate at the expiration of the 60 day notice period -specified above. - - (b) any software, hardware, or device, other than such Participant's -Contributor Version, directly or indirectly infringes any patent, then any -rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are -revoked effective as of the date You first made, used, sold, distributed, or -had made, Modifications made by that Participant. - - 8.3. If You assert a patent infringement claim against Participant -alleging that such Participant's Contributor Version directly or indirectly -infringes any patent where such claim is resolved (such as by license or -settlement) prior to the initiation of patent infringement litigation, then -the reasonable value of the licenses granted by such Participant under -Sections 2.1 or 2.2 shall be taken into account in determining the amount or -value of any payment or license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, all -end user license agreements (excluding distributors and resellers) which have -been validly granted by You or any distributor hereunder prior to termination -shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT -(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL -DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY -SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, -WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER -FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, -EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH -DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH -OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT -APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS -EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in 48 -C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and -"commercial computer software documentation," as such terms are used in 48 -C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. -227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users -acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject matter -hereof. If any provision of this License is held to be unenforceable, such -provision shall be reformed only to the extent necessary to make it -enforceable. This License shall be governed by California law provisions -(except to the extent applicable law, if any, provides otherwise), excluding -its conflict-of-law provisions. With respect to disputes in which at least one -party is a citizen of, or an entity chartered or registered to do business in -the United States of America, any litigation relating to this License shall be -subject to the jurisdiction of the Federal Courts of the Northern District of -California, with venue lying in Santa Clara County, California, with the -losing party responsible for costs, including without limitation, court costs -and reasonable attorneys' fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation which provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is -responsible for claims and damages arising, directly or indirectly, out of its -utilization of rights under this License and You agree to work with Initial -Developer and Contributors to distribute such responsibility on an equitable -basis. Nothing herein is intended or shall be deemed to constitute any -admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as -Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits -you to utilize portions of the Covered Code under Your choice of the MPL or -the alternative licenses, if any, specified by the Initial Developer in the -file described in Exhibit A. - - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License -Version 1.1 (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" -basis, WITHOUT WARRANTY OF - ANY KIND, either express or implied. See the License for the specific -language governing rights and - limitations under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. -Portions created by - ______________________ are Copyright (C) ______ -_______________________. All Rights - Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms of -the _____ license (the [___] License), in which case the provisions of -[______] License are applicable instead of those above. If you wish to allow -use of your version of this file only under the terms of the [____] License -and not to allow others to use your version of this file under the MPL, -indicate your decision by deleting the provisions above and replace them -with the notice and other provisions required by the [___] License. If you do -not delete the provisions above, a recipient may use your version of this file -under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of -the notices in the Source Code files of the Original Code. You should use the -text of this Exhibit A rather than the text found in the Original Code Source -Code for Your Modifications.] - - -=============================================================================== - -For the JAX-WS Reference Implementation component: - -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - diff --git a/branches/java-M1/java/sca/tools/src/main/resources/META-INF/NOTICE b/branches/java-M1/java/sca/tools/src/main/resources/META-INF/NOTICE deleted file mode 100644 index d48810c0ec..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,18 +0,0 @@ -========================================================================= -== NOTICE file corresponding to the section 4 d of == -== the Apache License, Version 2.0, == -== in this case for the Apache Tuscany distribution. == -========================================================================= - -This product includes software developed by the Apache Software Foundation -(http://www.apache.org/). - -This product also includes software developed by: -- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) -- the Celtix project (http://celtix.objectweb.org/) -- the Mozilla Rhino project (http://www.mozilla.org/rhino/) -- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) - -Please read the LICENSE.txt file present in the root directory of this -distribution. - diff --git a/branches/java-M1/java/sca/tools/src/main/resources/META-INF/README.txt b/branches/java-M1/java/sca/tools/src/main/resources/META-INF/README.txt deleted file mode 100644 index 9b26d1690a..0000000000 --- a/branches/java-M1/java/sca/tools/src/main/resources/META-INF/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Apache Tuscany M1 build (May, 2006) -=================================== - -http://incubator.apache.org/tuscany/ - -Tuscany is an effort undergoing incubation at the Apache Software Foundation -(ASF), sponsored by the Web Services 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. - - -Support -------- - -Any problem with this release can be reported to the Tuscany mailing list -or in the JIRA issue tracker. - -Mailing list subscription: - tuscany-dev-subscribe@ws.apache.org - -Jira: - http://issues.apache.org/jira/browse/Tuscany - - -Thank you for using Tuscany! - - -The Tuscany Team. - diff --git a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Account.java b/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Account.java deleted file mode 100644 index 110f206700..0000000000 --- a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Account.java +++ /dev/null @@ -1,51 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-import java.math.BigDecimal;
-
-public class Account {
- int accountType;
-
- String accountNo;
-
- BigDecimal balance;
-
- public String getAccountNo() {
- return accountNo;
- }
-
- public void setAccountNo(String accountNo) {
- this.accountNo = accountNo;
- }
-
- public int getAccountType() {
- return accountType;
- }
-
- public void setAccountType(int accountType) {
- this.accountType = accountType;
- }
-
- public BigDecimal getBalance() {
- return balance;
- }
-
- public void setBalance(BigDecimal balance) {
- this.balance = balance;
- }
-}
diff --git a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Customer.java b/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Customer.java deleted file mode 100644 index a1ff6d9771..0000000000 --- a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Customer.java +++ /dev/null @@ -1,27 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-public class Customer {
- private String name = "";
-
- public int custType = 0;
-
- public String getName() {
- return name;
- }
-}
diff --git a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java b/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java deleted file mode 100644 index 8f84925f58..0000000000 --- a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java +++ /dev/null @@ -1,32 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-public class CustomerValue {
-
- public int getValue(String custId, String stockSymbol) {
- return 0;
- }
-
- public Customer getCustomerDetails(String custId) {
- return new Customer();
- }
-
- /*
- * private String privateOperation() { return ""; }
- */
-}
diff --git a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java b/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java deleted file mode 100644 index a117c47626..0000000000 --- a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java +++ /dev/null @@ -1,44 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.tools.java2wsdl.generate;
-
-public class CustomerWithAccount {
-
- private Customer customer = new Customer();
-
- private Account[] accounts;
-
- public int getValue(String custId, String stockSymbol) {
- return 123;
- }
-
- public Customer getCustomerDetails(String custId) {
- return customer;
- }
-
- public Account getCustomerAccount(String custId, String accountId) {
- return accounts[0];
- }
-
- public Account[] getAccounts() {
- return accounts;
- }
-
- public void setAccounts(Account[] accounts) {
- this.accounts = accounts;
- }
-}
diff --git a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java b/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java deleted file mode 100644 index c064ee4abe..0000000000 --- a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tools.java2wsdl.generate; - -import java.io.File; - -import junit.framework.TestCase; - -/** - * A JUnit test case to test the Tuscany Java 2 WSDL Generation - */ -public class TuscanyJava2WSDLTestCase extends TestCase { - - /** - * setup the pre-requisites for the test case to run - * - * @exception Exception - */ - protected void setUp() throws Exception { - // System.out.println("inside setup"); - super.setUp(); - } - - /** - * @exception Exception - */ - protected void tearDown() throws Exception { - // System.out.println("inside tearDown"); - super.tearDown(); - } - - /** - * Simple WSDL generation test. - */ - public void testSimpleWSDLGeneration() { - String[] arguments = new String[] { "-cn", - "org.apache.tuscany.tools.java2wsdl.generate.CustomerValue", - "-o", "target/java2wsdl-source", }; - - Java2WSDL.main(arguments); - - File file = new File("target/java2wsdl-source/CustomerValue.wsdl"); - assertTrue(file.exists() && file.isFile()); - } - - /** - * Test WSDL generation where a parameter Object[] is involved. - */ - public void testWsdlGeneration2() { - - String[] arguments = new String[] { - "-cn", - "org.apache.tuscany.tools.java2wsdl.generate.CustomerWithAccount", - "-o", "target/java2wsdl-source", }; - Java2WSDL.main(arguments); - - File file = new File("target/java2wsdl-source/CustomerWithAccount.wsdl"); - assertTrue(file.exists() && file.isFile()); - } - - /** - * Test WSDL generation from a java interface and then generate the java - * interface using the generated WSDL. - */ - public void testRoundTrip() { - // TODO implement round trip - // this should re-generate java interfaces from the generated wsdl - // and compile (?) the generated java code. - // fail(); - - } -} diff --git a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java b/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java deleted file mode 100644 index a5ee20f9fb..0000000000 --- a/branches/java-M1/java/sca/tools/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.tools.wsdl2java.generate; - -import junit.framework.TestCase; - -/** - * Test case for WSDL2Java - */ -public class WSDL2JavaGeneratorTestCase extends TestCase { - - public void testAccountService() { - - String basedir = System.getProperty("basedir"); - if (basedir == null) - basedir ="."; - - - String[] args=new String[] { "-targetDirectory", basedir + "/target/wsdl2java-source", - "-javaPackage", "org.apache.tuscany.tools.wsdl2java.generate.account", - basedir + "/src/test/resources/AccountService.wsdl"}; - - WSDL2JavaGenerator.main(args); - - } - - -} diff --git a/branches/java-M1/java/sca/tools/src/test/resources/AccountService.wsdl b/branches/java-M1/java/sca/tools/src/test/resources/AccountService.wsdl deleted file mode 100644 index 8a694fa4fd..0000000000 --- a/branches/java-M1/java/sca/tools/src/test/resources/AccountService.wsdl +++ /dev/null @@ -1,239 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
-
- Licensed 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.
- -->
-<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:tns="http://www.bigbank.com/Account/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:account="http://www.bigbank.com/Account/"
- targetNamespace="http://www.bigbank.com/Account/" - name="AccountService">
-
- <wsdl:types>
- <xsd:schema targetNamespace="http://www.bigbank.com/Account/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:account="http://www.bigbank.com/Account/" - xmlns:sdojava="commonj.sdo/java" - sdojava:package="org.apache.tuscany.samples.bigbank.account">
-
- <xsd:element name="getAccountReportWrapped0">
- <xsd:complexType>
- <xsd:sequence>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="getAccountReportWrapped0Response">
- <xsd:complexType>
- <xsd:sequence>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="getAccountReportWrapped1"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="customerID" type="xsd:string"/> - </xsd:sequence> - </xsd:complexType> - </xsd:element>
- <xsd:element name="getAccountReportWrapped1Response"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="accountReport" type="account:AccountReport"/> - </xsd:sequence> - </xsd:complexType> - </xsd:element> -
- <xsd:element name="getAccountReportWrappedN">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="customerID" type="xsd:string"/>
- <xsd:element name="customerID2" type="xsd:int"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="getAccountReportWrappedNResponse">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="accountReport" type="account:AccountReport"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="getAccountReportBare0" type="xsd:string"/>
- <xsd:element name="getAccountReportBare0Response" type="xsd:int"/>
-
- <xsd:element name="getAccountReportBare1Simple" type="xsd:string"/>
- <xsd:element name="getAccountReportBare1SimpleResponse" type="xsd:int"/>
-
- <xsd:element name="getAccountReportBare1Complex" type="account:AccountRequest"/>
- <xsd:element name="getAccountReportBare1ComplexResponse" type="account:AccountReport"/>
-
- <xsd:complexType name="AccountRequest">
- <xsd:sequence>
- <xsd:element name="customerID" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="AccountReport">
- <xsd:sequence>
- <xsd:element name="accountSummaries" type="account:AccountSummary" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="AccountSummary">
- <xsd:attribute name="accountNumber" type="xsd:string"/>
- <xsd:attribute name="accountType" type="xsd:string"/>
- <xsd:attribute name="balance" type="xsd:float"/>
- </xsd:complexType>
-
- </xsd:schema>
- </wsdl:types>
-
- <wsdl:message name="getAccountReportWrapped0Request">
- <wsdl:part element="account:getAccountReportWrapped0" name="getAccountReportWrapped0Request"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportWrapped0Response">
- <wsdl:part element="account:getAccountReportWrapped0Response" name="getAccountReportWrapped0Response"/>
- </wsdl:message>
-
- <wsdl:message name="getAccountReportWrapped1Request">
- <wsdl:part element="account:getAccountReportWrapped1" name="getAccountReportWrapped1Request"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportWrapped1Response">
- <wsdl:part element="account:getAccountReportWrapped1Response" name="getAccountReportWrapped1Response"/>
- </wsdl:message>
-
- <wsdl:message name="getAccountReportWrappedNRequest">
- <wsdl:part element="account:getAccountReportWrappedN" name="getAccountReportWrappedNRequest"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportWrappedNResponse">
- <wsdl:part element="account:getAccountReportWrappedNResponse" name="getAccountReportWrappedNResponse"/>
- </wsdl:message>
-
- <wsdl:message name="getAccountReportBare0Request">
- </wsdl:message>
- <wsdl:message name="getAccountReportBare0Response">
- </wsdl:message>
-
- <wsdl:message name="getAccountReportBare1SimpleRequest">
- <wsdl:part element="account:getAccountReportBare1Simple" name="getAccountReportBare1SimpleRequest"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportBare1SimpleResponse">
- <wsdl:part element="account:getAccountReportBare1SimpleResponse" name="getAccountReportBare1SimpleResponse"/>
- </wsdl:message>
-
- <wsdl:message name="getAccountReportBare1ComplexRequest">
- <wsdl:part element="account:getAccountReportBare1Complex" name="getAccountReportBare1ComplexRequest"/>
- </wsdl:message>
- <wsdl:message name="getAccountReportBare1ComplexResponse">
- <wsdl:part element="account:getAccountReportBare1ComplexResponse" name="getAccountReportBare1ComplexResponse"/>
- </wsdl:message>
-
- <wsdl:portType name="Account_Service">
- <wsdl:operation name="getAccountReportWrapped0">
- <wsdl:input message="tns:getAccountReportWrapped0Request"/>
- <wsdl:output message="tns:getAccountReportWrapped0Response"/>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportWrapped1">
- <wsdl:input message="tns:getAccountReportWrapped1Request"/>
- <wsdl:output message="tns:getAccountReportWrapped1Response"/>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportWrappedN">
- <wsdl:input message="tns:getAccountReportWrappedNRequest"/>
- <wsdl:output message="tns:getAccountReportWrappedNResponse"/>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare0">
- <wsdl:input message="tns:getAccountReportBare0Request"/>
- <wsdl:output message="tns:getAccountReportBare0Response"/>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare1Simple">
- <wsdl:input message="tns:getAccountReportBare1SimpleRequest"/>
- <wsdl:output message="tns:getAccountReportBare1SimpleResponse"/>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare1Complex">
- <wsdl:input message="tns:getAccountReportBare1ComplexRequest"/>
- <wsdl:output message="tns:getAccountReportBare1ComplexResponse"/>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="AccountServiceSOAP" type="tns:Account_Service">
- <soap:binding style="document"
- transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getAccountReportWrapped0">
- <soap:operation
- soapAction="http://www.bigbank.com/Account/getAccountReportWrapped0"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportWrapped1">
- <soap:operation
- soapAction="http://www.bigbank.com/Account/getAccountReportWrapped1"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportWrappedN">
- <soap:operation
- soapAction="http://www.bigbank.com/Account/getAccountReportWrappedN"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare0">
- <soap:operation
- soapAction="http://www.bigbank.com/Account/getAccountReportBare0"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare1Simple">
- <soap:operation
- soapAction="http://www.bigbank.com/Account/getAccountReportBare1Simple"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="getAccountReportBare1Complex">
- <soap:operation
- soapAction="http://www.bigbank.com/Account/getAccountReportBare1Complex"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="AccountService">
- <wsdl:port binding="tns:AccountServiceSOAP"
- name="AccountServiceSOAP">
- <soap:address location="http://localhost:8080/sample-account/services/AccountService"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>
|