diff options
Diffstat (limited to 'tags/java-stable-20060304/sca/container.js')
57 files changed, 0 insertions, 3643 deletions
diff --git a/tags/java-stable-20060304/sca/container.js/LICENSE.txt b/tags/java-stable-20060304/sca/container.js/LICENSE.txt deleted file mode 100644 index d645695673..0000000000 --- a/tags/java-stable-20060304/sca/container.js/LICENSE.txt +++ /dev/null @@ -1,202 +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. diff --git a/tags/java-stable-20060304/sca/container.js/pom.xml b/tags/java-stable-20060304/sca/container.js/pom.xml deleted file mode 100644 index aa90b1dc4d..0000000000 --- a/tags/java-stable-20060304/sca/container.js/pom.xml +++ /dev/null @@ -1,75 +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>SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>tuscany-container-js</artifactId> - <name>Tuscany JavaScript Component Implementation Type</name> - <description>Tuscany JavaScript Component Implementation Type.</description> - <version>SNAPSHOT</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>provided</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.tuscany</groupId> - <artifactId>tuscany-sdo-plugin</artifactId> - <executions> - <execution> - <configuration> - <schemaFile>${basedir}/src/main/resources/model/sca-implementation-js.xsd</schemaFile> - <generateLoader>true</generateLoader> - <generateSwitch>true</generateSwitch> - <noNotification>true</noNotification> - <noUnsettable>true</noUnsettable> - </configuration> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/JavaScriptAssemblyFactory.java b/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/JavaScriptAssemblyFactory.java deleted file mode 100644 index 0072bcdaa1..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/JavaScriptAssemblyFactory.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.js.assembly; - -import org.apache.tuscany.model.assembly.AssemblyFactory; - -public interface JavaScriptAssemblyFactory extends AssemblyFactory { - - /** - * Returns a new object of class '<em>JavaScript Implementation</em>'. - */ - JavaScriptImplementation createJavaScriptImplementation(); - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/JavaScriptImplementation.java b/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/JavaScriptImplementation.java deleted file mode 100644 index 6edaf2b60a..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/JavaScriptImplementation.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.js.assembly; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.model.assembly.ComponentImplementation; - -/** - * A representation of a JavaScript component implementation type - * - * @version $Rev$ $Date$ - */ -public interface JavaScriptImplementation extends ComponentImplementation { - - public ResourceLoader getResourceLoader(); - - public String getScriptFile(); - - public void setScriptFile(String fn); -} diff --git a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptAssemblyFactoryImpl.java b/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptAssemblyFactoryImpl.java deleted file mode 100644 index 21930d22ec..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptAssemblyFactoryImpl.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.js.assembly.impl; - -import org.apache.tuscany.container.js.assembly.JavaScriptAssemblyFactory; -import org.apache.tuscany.container.js.assembly.JavaScriptImplementation; -import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; - -public class JavaScriptAssemblyFactoryImpl extends AssemblyFactoryImpl implements JavaScriptAssemblyFactory { - - public JavaScriptAssemblyFactoryImpl() { - super(); - } - - public JavaScriptImplementation createJavaScriptImplementation() { - return new JavaScriptImplementationImpl(); - } - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationImpl.java b/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationImpl.java deleted file mode 100644 index c6b58a25c6..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.apache.tuscany.container.js.assembly.impl; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; - -import org.apache.tuscany.common.resource.ResourceLoader; -import org.apache.tuscany.container.js.assembly.JavaScriptImplementation; -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.model.assembly.ModelInitException; -import org.apache.tuscany.model.assembly.impl.ComponentImplementationImpl; - -/** - * Default implementation of a JavScript component implementation type - * - * @version $Rev$ $Date$ - */ -public class JavaScriptImplementationImpl extends ComponentImplementationImpl implements JavaScriptImplementation { - - private ResourceLoader resourceLoader; - - public JavaScriptImplementationImpl() { - super(); - } - - public ResourceLoader getResourceLoader() { - return null; - } - - public void initialize(AssemblyModelContext modelContext) throws ModelInitException { - if (isInitialized()) { - return; - } - this.resourceLoader = modelContext.getApplicationResourceLoader(); - if(resourceLoader == null){ - throw new ModelInitException("No resource loader set on model context"); - } - getScriptFile(); - - // Initialize the component type - ComponentType componentType = getComponentType(); - if (componentType == null) { - try { - componentType = createComponentType(modelContext); - } catch (IOException e) { - throw new ModelInitException("Error retrieving component type file",e); - } - setComponentType(componentType); - } - - super.initialize(modelContext); - - } - - String script; - - public String getScriptFile() { - return script; - } - - public void setScriptFile(String fn) { - script = fn; - } - - private String scriptCode; - - public String getScript() throws ModelInitException { - if (scriptCode != null) { - return scriptCode; - } - try { - URL url = resourceLoader.getResource(getScriptFile()); - if (url == null) { - ModelInitException ce = new ModelInitException("Script not found"); - ce.setIdentifier(getScriptFile()); - throw ce; - } - InputStream inputStream = url.openStream(); - try { - StringBuffer sb = new StringBuffer(); - int n = 0; - while ((n = inputStream.read()) != -1) { - sb.append((char) n); - } - scriptCode = sb.toString(); - return scriptCode; - } finally { - inputStream.close(); - } - } catch (IOException e) { - ModelInitException ce = new ModelInitException("Error reading script file",e); - ce.setIdentifier(getScriptFile()); - throw ce; - } - } - - /** - * Create the component type - * - * @param modelContext - * @param implementationClass - */ - private ComponentType createComponentType(AssemblyModelContext modelContext) throws IOException{ - String prefix = script.substring(0,script.lastIndexOf('.')); - URL componentTypeFile = resourceLoader.getResource(prefix + ".componentType"); - if (componentTypeFile != null) { - return modelContext.getAssemblyLoader().loadComponentType(componentTypeFile.toString()); - } else { - // TODO we could introspect the JavaScript source - return modelContext.getAssemblyFactory().createComponentType(); - } - } - - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/builder/JavaScriptComponentContextBuilder.java b/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/builder/JavaScriptComponentContextBuilder.java deleted file mode 100644 index 37ec68942a..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/builder/JavaScriptComponentContextBuilder.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.container.js.builder; - -import java.lang.reflect.Method; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.container.js.assembly.JavaScriptImplementation; -import org.apache.tuscany.container.js.assembly.impl.JavaScriptImplementationImpl; -import org.apache.tuscany.container.js.config.JavaScriptComponentRuntimeConfiguration; -import org.apache.tuscany.container.js.rhino.RhinoScript; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder; -import org.apache.tuscany.core.context.AggregateContext; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.invocation.InvocationConfiguration; -import org.apache.tuscany.core.invocation.MethodHashMap; -import org.apache.tuscany.core.invocation.ProxyConfiguration; -import org.apache.tuscany.core.invocation.impl.InvokerInterceptor; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.model.assembly.AssemblyModelObject; -import org.apache.tuscany.model.assembly.ComponentImplementation; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.ModelInitException; -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.assembly.SimpleComponent; -import org.osoa.sca.annotations.Init; - -/** - * Builds {@link org.apache.tuscany.container.js.config.JavaScriptComponentRuntimeConfiguration}s from a JavaScript - * component type - * - * @version $Rev$ $Date$ - */ -@org.osoa.sca.annotations.Scope("MODULE") -public class JavaScriptComponentContextBuilder implements RuntimeConfigurationBuilder<AggregateContext> { - - private ProxyFactoryFactory factory; - private MessageFactory msgFactory; - private RuntimeConfigurationBuilder referenceBuilder; - private RuntimeContext runtimeContext; - - // ---------------------------------- - // Constructors - // ---------------------------------- - - public JavaScriptComponentContextBuilder() { - } - - // ---------------------------------- - // Methods - // ---------------------------------- - - @Init(eager = true) - public void init() { - runtimeContext.addBuilder(this); - } - - /** - * @param runtimeContext The runtimeContext to set. - */ - @Autowire - public void setRuntimeContext(RuntimeContext runtimeContext) { - this.runtimeContext = runtimeContext; - } - - /** - * Sets the factory used to construct proxies implmementing the business interface required by a reference - */ - @Autowire - public void setProxyFactoryFactory(ProxyFactoryFactory factory) { - this.factory = factory; - } - - /** - * Sets the factory used to construct invocation messages - */ - @Autowire - public void setMessageFactory(MessageFactory msgFactory) { - this.msgFactory = msgFactory; - } - - /** - * Sets a builder responsible for creating source-side and target-side invocation chains for a reference. The - * reference builder may be hierarchical, containing other child reference builders that operate on specific - * metadata used to construct and invocation chain. - * - * @see org.apache.tuscany.core.builder.impl.HierarchicalBuilder - */ - public void setReferenceBuilder(RuntimeConfigurationBuilder builder) { - this.referenceBuilder = builder; - } - - public void build(AssemblyModelObject modelObject, AggregateContext context) throws BuilderException { - if (modelObject instanceof SimpleComponent) { - SimpleComponent component = (SimpleComponent) modelObject; - ComponentImplementation impl = component.getComponentImplementation(); - if (impl instanceof JavaScriptImplementation) { - Scope scope = ((JavaScriptImplementation) impl).getComponentType().getServices().get(0).getServiceContract() - .getScope(); - Map<String, Class> services = new HashMap(); - for (Service service : ((JavaScriptImplementation) impl).getComponentType().getServices()) { - services.put(service.getName(), service.getServiceContract().getInterface()); - } - Map<String, Object> properties = new HashMap(); - // TODO support properties - String script = null; - if (impl instanceof JavaScriptImplementationImpl) { // fixme - try { - script = ((JavaScriptImplementationImpl) impl).getScript(); - } catch (ModelInitException e) { - throw new BuilderConfigException(e); - } - } - - RhinoScript invoker = createRhinoInvoker(component.getName(), script, properties); - JavaScriptComponentRuntimeConfiguration config = new JavaScriptComponentRuntimeConfiguration(component.getName(), - scope, services, properties, invoker); - - // create target-side invocation chains for each service offered by the implementation - for (ConfiguredService configuredService : component.getConfiguredServices()) { - Service service = configuredService.getService(); - ServiceContract contract = service.getServiceContract(); - Map<Method, InvocationConfiguration> iConfigMap = new MethodHashMap(); - ProxyFactory proxyFactory = factory.createProxyFactory(); - for (Method method : contract.getInterface().getMethods()) { - InvocationConfiguration iConfig = new InvocationConfiguration(method); - iConfigMap.put(method, iConfig); - } - QualifiedName qName = new QualifiedName(component.getName() + QualifiedName.NAME_SEPARATOR + service.getName()); - ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, contract.getInterface().getClassLoader(), msgFactory); - proxyFactory.setBusinessInterface(contract.getInterface()); - proxyFactory.setProxyConfiguration(pConfiguration); - configuredService.setProxyFactory(proxyFactory); - if (referenceBuilder != null) { - // invoke the reference builder to handle target-side metadata - referenceBuilder.build(configuredService, context); - } - // add tail interceptor - for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) { - iConfig.addTargetInterceptor(new InvokerInterceptor()); - } - config.addTargetProxyFactory(service.getName(), proxyFactory); - } - - // handle references - List<ConfiguredReference> configuredReferences = component.getConfiguredReferences(); - if (configuredReferences != null) { - for (ConfiguredReference reference : configuredReferences) { - ProxyFactory proxyFactory = factory.createProxyFactory(); - ServiceContract interfaze = reference.getReference().getServiceContract(); - Map<Method, InvocationConfiguration> iConfigMap = new MethodHashMap(); - for (Method method : interfaze.getInterface().getMethods()) { - InvocationConfiguration iConfig = new InvocationConfiguration(method); - iConfigMap.put(method, iConfig); - } - String targetCompName = reference.getTargetConfiguredServices().get(0).getAggregatePart().getName(); - String targetSerivceName = reference.getTargetConfiguredServices().get(0).getService().getName(); - - QualifiedName qName = new QualifiedName(targetCompName + "/" + targetSerivceName); - - // QualifiedName qName = new QualifiedName(reference.getPart().getName() + "/" - // + reference.getPort().getName()); - ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, interfaze.getInterface().getClassLoader(), msgFactory); - proxyFactory.setBusinessInterface(interfaze.getInterface()); - proxyFactory.setProxyConfiguration(pConfiguration); - reference.setProxyFactory(proxyFactory); - if (referenceBuilder != null) { - // invoke the reference builder to handle metadata associated with the reference - referenceBuilder.build(reference, context); - } - config.addSourceProxyFactory(reference.getReference().getName(), proxyFactory); - } - } - component.getComponentImplementation().setRuntimeConfiguration(config); - } - } - } - - /** - * Creates a representation of the JavaScript implementation script that is used to perform invocations - * - * @param name - * @param script the Script source - * @param properties configured properties for the component - * @return - */ - private RhinoScript createRhinoInvoker(String name, String script, Map properties) { - RhinoScript ri = new RhinoScript(name, script, properties); - return ri; - } -} diff --git a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/builder/JavaScriptTargetWireBuilder.java b/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/builder/JavaScriptTargetWireBuilder.java deleted file mode 100644 index 74433db823..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/builder/JavaScriptTargetWireBuilder.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.apache.tuscany.container.js.builder; - -import java.lang.reflect.Method; - -import org.apache.tuscany.container.js.config.JavaScriptComponentRuntimeConfiguration; -import org.apache.tuscany.container.js.rhino.RhinoTargetInvoker; -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.invocation.InvocationConfiguration; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -/** - * 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 implements WireBuilder { - - private RuntimeContext runtimeContext; - - @Autowire - public void setRuntimeContext(RuntimeContext context) { - runtimeContext = context; - } - - public JavaScriptTargetWireBuilder() { - } - - @Init(eager=true) - public void init() { - runtimeContext.addBuilder(this); - } - - public void connect(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) throws BuilderConfigException { - if (!(JavaScriptComponentRuntimeConfiguration.class.isAssignableFrom(targetType))) { - return; - } - for (InvocationConfiguration sourceInvocationConfig : sourceFactory.getProxyConfiguration().getInvocationConfigurations() - .values()) { - Method method = sourceInvocationConfig.getMethod(); - RhinoTargetInvoker invoker = new RhinoTargetInvoker(sourceFactory.getProxyConfiguration().getTargetName() - .getPartName(), method.getName(), targetScopeContext); - if (downScope) { - // the source scope is shorter than the target, so the invoker can cache the target instance - // invoker.setCacheable(true); - } else { - // invoker.setCacheable(false); - } - sourceInvocationConfig.setTargetInvoker(invoker); - } - } - - public void completeTargetChain(ProxyFactory targetFactory, Class targetType, ScopeContext targetScopeContext) - throws BuilderConfigException { - if (!(JavaScriptComponentRuntimeConfiguration.class.isAssignableFrom(targetType))) { - return; - } - for (InvocationConfiguration targetInvocationConfig : targetFactory.getProxyConfiguration().getInvocationConfigurations() - .values()) { - Method method = targetInvocationConfig.getMethod(); - RhinoTargetInvoker invoker = new RhinoTargetInvoker(targetFactory.getProxyConfiguration().getTargetName() - .getPartName(), method.getName(), targetScopeContext); - targetInvocationConfig.setTargetInvoker(invoker); - } - } - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/config/JavaScriptComponentRuntimeConfiguration.java b/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/config/JavaScriptComponentRuntimeConfiguration.java deleted file mode 100644 index b24f98f32a..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/config/JavaScriptComponentRuntimeConfiguration.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.container.js.config; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.container.js.context.JavaScriptComponentContext; -import org.apache.tuscany.container.js.rhino.RhinoScript; -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.RuntimeConfiguration; -import org.apache.tuscany.core.context.SimpleComponentContext; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Creates instance contexts for JavaScript component types - * - * @version $Rev$ $Date$ - */ -public class JavaScriptComponentRuntimeConfiguration implements RuntimeConfiguration<SimpleComponentContext> { - - private Scope scope; - - private String name; - - private Map<String, Class> services; - - private Map<String, Object> properties; - - private RhinoScript invoker; - - public JavaScriptComponentRuntimeConfiguration(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 SimpleComponentContext createInstanceContext() throws ContextCreationException { - return new JavaScriptComponentContext(name, services, properties, sourceProxyFactories, targetProxyFactories, invoker - .copy()); - } - - public Scope getScope() { - return scope; - } - - public String getName() { - return name; - } - - private Map<String, ProxyFactory> targetProxyFactories = new HashMap<String, ProxyFactory>(); - - public void addTargetProxyFactory(String serviceName, ProxyFactory factory) { - targetProxyFactories.put(serviceName, factory); - } - - public ProxyFactory getTargetProxyFactory(String serviceName) { - return targetProxyFactories.get(serviceName); - } - - public Map<String, ProxyFactory> getTargetProxyFactories() { - return targetProxyFactories; - } - - private Map<String, ProxyFactory> sourceProxyFactories = new HashMap<String, ProxyFactory>(); - - public void addSourceProxyFactory(String referenceName, ProxyFactory factory) { - sourceProxyFactories.put(referenceName, factory); - } - - public ProxyFactory getSourceProxyFactory(String referenceName) { - return sourceProxyFactories.get(referenceName); - } - - public Map<String, ProxyFactory> getSourceProxyFactories() { - return sourceProxyFactories; - } - - public void prepare() { - - } - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/context/JavaScriptComponentContext.java b/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/context/JavaScriptComponentContext.java deleted file mode 100644 index 8a4db7eb44..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/context/JavaScriptComponentContext.java +++ /dev/null @@ -1,161 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.js.context; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.apache.tuscany.container.js.rhino.RhinoScript; -import org.apache.tuscany.core.context.AbstractContext; -import org.apache.tuscany.core.context.CoreRuntimeException; -import org.apache.tuscany.core.context.LifecycleEventListener; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.SimpleComponentContext; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.invocation.spi.ProxyCreationException; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; - -public class JavaScriptComponentContext extends AbstractContext implements SimpleComponentContext { - - private Map<String, Class> services; - - private RhinoScript rhinoInvoker; - - private Map<String, Object> properties; - - private Map<String, ProxyFactory> sourceProxyFactories; - - private Map<String, ProxyFactory> targetProxyFactories; - - private Object instance; - - public JavaScriptComponentContext(String name, Map<String, Class> services, Map<String, Object> properties, - Map<String, ProxyFactory> sourceProxyFactories, Map<String, ProxyFactory> 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 synchronized Object getInstance(QualifiedName qName, boolean notify) throws TargetException { - String portName=qName.getPortName(); - ProxyFactory 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 }); - notifyListeners(notify); - return proxy; - } catch (ProxyCreationException e) { - TargetException te = new TargetException("Error returning target", e); - e.setIdentifier(qName.getPortName()); - e.addContextName(getName()); - throw te; - } - } - - public Object getImplementationInstance() throws TargetException { - return getImplementationInstance(true); - } - - public Object getImplementationInstance(boolean notify) throws TargetException { - rhinoInvoker.updateScriptScope(properties); // create prop values - return rhinoInvoker; - } - -// private Object createProxy(Class[] ifaces) throws ProxyCreationException { -// // final RhinoInvoker rhinoInvoker = implementation.getRhinoInvoker().copy(); -// rhinoInvoker.updateScriptScope(properties); // create prop values -// final Map refs = createInvocationContext(); -// InvocationHandler ih = new InvocationHandler() { -// public Object invoke(Object proxy, Method method, Object[] args) { -// return rhinoInvoker.invoke(method.getName(), args, method.getReturnType(), refs); -// // return rhinoInvoker.invoke(method.getName(), args, method.getReturnType(),createInvocationContext()); -// } -// }; -// return Proxy.newProxyInstance(ifaces[0].getClassLoader(), ifaces, ih); -// } - - private void notifyListeners(boolean notify) { - if (notify) { - for (Iterator iter = contextListener.iterator(); iter.hasNext();) { - LifecycleEventListener listener = (LifecycleEventListener) iter.next(); - listener.onInstanceCreate(this); - } - } - } - - /** - * Creates a map containing any properties and their values - */ - // private Map createPropertyValues() { - // Map<String,Object> context = new HashMap<String,Object>(); - // List<ConfiguredProperty> configuredProperties = component.getConfiguredProperties(); - // if (configuredProperties != null) { - // for (ConfiguredProperty property : configuredProperties) { - // context.put(property.getProperty().getName(), property.getValue()); - // } - // } - // return context; - // } - /** - * Creates a map containing any ServiceReferences - */ - private Map createInvocationContext() throws ProxyCreationException { - Map<String, Object> context = new HashMap<String, Object>(); - for (Map.Entry<String, ProxyFactory> entry : sourceProxyFactories.entrySet()) { - context.put(entry.getKey(), entry.getValue().createProxy()); - } - return context; - } - - public boolean isEagerInit() { - return false; - } - - public boolean isDestroyable() { - return false; - } - - public void start() throws CoreRuntimeException { - } - - public void stop() throws CoreRuntimeException { - } - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/loader/JavaScriptSCDLModelLoader.java b/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/loader/JavaScriptSCDLModelLoader.java deleted file mode 100644 index ed7d267c89..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/loader/JavaScriptSCDLModelLoader.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.apache.tuscany.container.js.loader; - -import org.apache.tuscany.container.js.assembly.JavaScriptAssemblyFactory; -import org.apache.tuscany.container.js.assembly.JavaScriptImplementation; -import org.apache.tuscany.container.js.assembly.impl.JavaScriptAssemblyFactoryImpl; -import org.apache.tuscany.container.js.scdl.ScdlFactory; -import org.apache.tuscany.container.js.scdl.impl.ScdlPackageImpl; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.loader.SCDLModelLoaderRegistry; -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelObject; -import org.apache.tuscany.model.scdl.loader.SCDLModelLoader; -import org.apache.tuscany.sdo.util.SDOUtil; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Reference; - -/** - * Populates the assembly model from an SCDL model - */ -@org.osoa.sca.annotations.Scope("MODULE") -public class JavaScriptSCDLModelLoader implements SCDLModelLoader { - - private RuntimeContext runtimeContext; - private SCDLModelLoaderRegistry loaderRegistry; - private JavaScriptAssemblyFactory jsFactory; - - static { - // Register the JavaScript SCDL model - SDOUtil.registerStaticTypes(ScdlFactory.class); - } - - /** - * @param runtimeContext The runtimeContext to set. - */ - @Autowire - public void setRuntimeContext(RuntimeContext runtimeContext) { - this.runtimeContext = runtimeContext; - } - -// @Reference - public void setLoaderRegistry(SCDLModelLoaderRegistry registry) { - this.loaderRegistry = registry; - } - - @Init(eager=true) - public void init() { - runtimeContext.addLoader(this); -// loaderRegistry.registerLoader(this); - } - - @Destroy - public void destroy() { -// loaderRegistry.unregisterLoader(this); - } - - /** - * Constructs a new JavaSCDLModelLoader. - */ - public JavaScriptSCDLModelLoader() { - this.jsFactory=new JavaScriptAssemblyFactoryImpl(); - } - - /** - * @see org.apache.tuscany.model.scdl.loader.SCDLModelLoader#load(org.apache.tuscany.model.assembly.AssemblyModelContext, java.lang.Object) - */ - public AssemblyModelObject load(AssemblyModelContext modelContext, Object object) { - if (object instanceof org.apache.tuscany.container.js.scdl.JavaScriptImplementation) { - org.apache.tuscany.container.js.scdl.JavaScriptImplementation scdlImplementation=(org.apache.tuscany.container.js.scdl.JavaScriptImplementation)object; - JavaScriptImplementation implementation=jsFactory.createJavaScriptImplementation(); - implementation.setScriptFile(scdlImplementation.getScriptFile()); - return implementation; - } else - return null; - } -} diff --git a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/rhino/RhinoScript.java b/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/rhino/RhinoScript.java deleted file mode 100644 index 4ddee12fe4..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/rhino/RhinoScript.java +++ /dev/null @@ -1,298 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF 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.js.rhino; - -import java.util.Iterator; -import java.util.Map; - -import org.mozilla.javascript.Context; -import org.mozilla.javascript.ContextFactory; -import org.mozilla.javascript.Function; -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 { - - private String scriptName; - - private String script; - - private 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); - } - - /** - * 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) { - this.scriptName = scriptName; - this.script = script; - initScriptScope(scriptName, script, context); - 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 invocation 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 invocation 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 arg, Class responseClass, Map contexts) { - Context cx = Context.enter(); - try { - Function function = getFunction(scriptScope, functionName); - Scriptable invocationScope = getInvocationScope(cx, contexts); - Object[] args = processArgs(arg, invocationScope); - Object jsResponse = function.call(cx, invocationScope, invocationScope, args); - Object response = processResponse(jsResponse, responseClass); - return response; - } finally { - Context.exit(); - } - } - - /** - * Turn args to JS objects and convert any OMElement to E4X XML - */ - protected Object[] processArgs(Object arg, Scriptable scope) { - // TODO: implement pluggable way to transform objects (eg SDO or AXIOM) to E4X XML objects - // if (arg instanceof OMElement) { - // try { - // arg = E4XAXIOMUtils.toScriptableObject((OMElement) arg, scope); - // } catch (XmlException e) { - // throw new RuntimeException(e); - // } - // } else if (arg instanceof MessageContext) { - // arg = new E4XMessageContext((MessageContext) arg, 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(Object response, Class responseClass) { - // TODO: implement pluggable way to transform E4X XML into specific objects (eg SDO or AXIOM) - // } else if (response instanceof XMLObject) { - // response = E4XAXIOMUtils.toOMElement((XMLObject) response); - if (Context.getUndefinedValue().equals(response)) { - response = null; - } else if (response instanceof Wrapper) { - response = ((Wrapper) response).unwrap(); - } else { - if (responseClass != null) { - response = Context.toType(response, responseClass); - } else { - response = Context.toType(response, String.class); - } - } - return response; - } - - /** - * Create a Rhino scope and compile the script into it - */ - protected void initScriptScope(String fileName, String scriptCode, Map context) { - Context cx = Context.enter(); - try { - - this.scriptScope = cx.initStandardObjects(null, 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 invocation. If the invocation 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 invocation 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/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/rhino/RhinoTargetInvoker.java b/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/rhino/RhinoTargetInvoker.java deleted file mode 100644 index 62cf40f333..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/java/org/apache/tuscany/container/js/rhino/RhinoTargetInvoker.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.apache.tuscany.container.js.rhino; - -import java.lang.reflect.InvocationTargetException; - -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.invocation.Interceptor; -import org.apache.tuscany.core.invocation.TargetInvoker; -import org.apache.tuscany.core.message.Message; - -public class RhinoTargetInvoker implements TargetInvoker { - - private ScopeContext container; - - private QualifiedName name; - - private String operation; - - private RhinoScript target; - - public RhinoTargetInvoker(String serviceName, String operation, ScopeContext container) { - assert (serviceName != null) : "No service name specified"; - assert (container != null) : "No scope container specified"; - assert (operation != null) : "No operation specified"; - this.name = new QualifiedName(serviceName); - this.container = container; - this.operation = operation; - } - - public Object invokeTarget(Object payload) throws InvocationTargetException { - if (cacheable) { - if (target == null) { - target = (RhinoScript) container.getContext(name.getPartName()).getImplementationInstance(); - } - return target.invoke(operation, payload); - } else { - return ((RhinoScript) container.getContext(name.getPartName()).getImplementationInstance()) - .invoke(operation, payload); - } - } - - private boolean cacheable; - - public boolean isCacheable() { - return cacheable; - } - - public void setCacheable(boolean val) { - cacheable = val; - } - - 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() { - try { - RhinoTargetInvoker invoker = (RhinoTargetInvoker) super.clone(); - invoker.container = this.container; - invoker.cacheable = this.cacheable; - invoker.name = this.name; - invoker.operation = this.operation; - invoker.target = null; - return invoker; - } catch (CloneNotSupportedException e) { - return null; // will not happen - } - } -} diff --git a/tags/java-stable-20060304/sca/container.js/src/main/resources/model/sca-implementation-js.xsd b/tags/java-stable-20060304/sca/container.js/src/main/resources/model/sca-implementation-js.xsd deleted file mode 100644 index c68161d7bd..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/resources/model/sca-implementation-js.xsd +++ /dev/null @@ -1,41 +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:js="http://org.apache.tuscany/xmlns/js/0.9" - xmlns:sca="http://www.osoa.org/xmlns/sca/0.9" - elementFormDefault="qualified" - xmlns:sdojava="commonj.sdo/java" - sdojava:package="org.apache.tuscany.container.js.scdl" - targetNamespace="http://org.apache.tuscany/xmlns/js/0.9"> - - <import namespace="http://www.osoa.org/xmlns/sca/0.9" schemaLocation="../../../../../model/src/main/resources/model/sca-core.xsd"/> - - <element name="implementation.js" substitutionGroup="sca:implementation" type="js:JavaScriptImplementation"/> - - <complexType name="JavaScriptImplementation"> - <complexContent> - <extension base="sca:Implementation"> - <sequence> - <any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="lax"/> - </sequence> - <attribute name="scriptFile" type="NCName" use="required"/> - <anyAttribute namespace="##any" processContents="lax"/> - </extension> - </complexContent> - </complexType> - -</schema> diff --git a/tags/java-stable-20060304/sca/container.js/src/main/resources/org/apache/tuscany/container/js/handler/JavaScriptComponentConfigurationHandler.componentType b/tags/java-stable-20060304/sca/container.js/src/main/resources/org/apache/tuscany/container/js/handler/JavaScriptComponentConfigurationHandler.componentType deleted file mode 100644 index c737a08a0b..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/resources/org/apache/tuscany/container/js/handler/JavaScriptComponentConfigurationHandler.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"> - - <service name="handler"> - <interface.js interface="org.apache.tuscany.core.message.handler.MessageHandler"/> - </service> - -</componentType> diff --git a/tags/java-stable-20060304/sca/container.js/src/main/resources/system.fragment b/tags/java-stable-20060304/sca/container.js/src/main/resources/system.fragment deleted file mode 100644 index 4c17a7ac1c..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/main/resources/system.fragment +++ /dev/null @@ -1,33 +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.js">
-
- <component name="org.apache.tuscany.container.js.builder.JavaScriptComponentContextBuilder">
- <system:implementation.system class="org.apache.tuscany.container.js.builder.JavaScriptComponentContextBuilder"/>
- </component>
-
- <component name="org.apache.tuscany.container.js.loader.JavaScriptSCDLModelLoader"> - <system:implementation.system class="org.apache.tuscany.container.js.loader.JavaScriptSCDLModelLoader"/> - </component> - - <component name="org.apache.tuscany.container.js.builder.JavaScriptTargetWireBuilder"> - <system:implementation.system class="org.apache.tuscany.container.js.builder.JavaScriptTargetWireBuilder"/> - </component> - -</moduleFragment>
diff --git a/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorld.java b/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorld.java deleted file mode 100644 index ed03753557..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorld.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.apache.tuscany.container.js.sample.helloworld; - -public interface HelloWorld { - - public String getGreeting(String s); - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.componentType b/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.componentType deleted file mode 100644 index cce77fab00..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.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.js.sample.helloworld.HelloWorld"/> - </service> - -</componentType>
\ No newline at end of file diff --git a/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.js b/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.js deleted file mode 100644 index cb63914377..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.js +++ /dev/null @@ -1,4 +0,0 @@ - -function getGreeting(s) { - return "jsHello " + s; -}
\ No newline at end of file diff --git a/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/Main.java b/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/Main.java deleted file mode 100644 index 2e63a5a21e..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/Main.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.apache.tuscany.container.js.sample.helloworld; - -import org.apache.tuscany.core.client.TuscanyRuntime; -import org.osoa.sca.CurrentModuleContext; -import org.osoa.sca.ModuleContext; - -public class Main { - - public static final void main(String[] args) throws Exception { - - TuscanyRuntime tuscany = new TuscanyRuntime("jsHello", null); - tuscany.start(); - ModuleContext moduleContext = CurrentModuleContext.getContext(); - - HelloWorld s = - (HelloWorld) moduleContext.locateService("HelloWorldJSComponent"); - - String value = s.getGreeting("Petra"); - - System.out.println(value); - - tuscany.stop(); - } - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/samples/java/sca.module b/tags/java-stable-20060304/sca/container.js/src/samples/java/sca.module deleted file mode 100644 index 25c35fa6d0..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/samples/java/sca.module +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2005 BEA Sytems Inc. - Copyright (c) 2005 International Business Machines - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT 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="sampleHelloworld"> - - <component name="HelloWorldJSComponent"> - <implementation.js scriptFile="org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.js"/> - </component> - -</module> diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationTestCase.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationTestCase.java deleted file mode 100644 index c751b0a2ef..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationTestCase.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.container.js.assembly.impl; - -import junit.framework.TestCase; - -/** - * FIXME commented out until SCDL loading works - * - * @version $Rev: 368822 $ $Date: 2006-01-13 18:54:38 +0000 (Fri, 13 Jan 2006) $ - */ -public class JavaScriptImplementationTestCase extends TestCase { - - private JavaScriptImplementationImpl impl = (JavaScriptImplementationImpl) new JavaScriptAssemblyFactoryImpl() - .createJavaScriptImplementation(); - - public void testDummy(){} // remove when tests added back - -// public void testNoImplementationClass() { -// impl.setScriptFile("no.such.script.js"); -// try { -// impl.initialize(new AssemblyModelContextImpl(null, null)); -// impl.getComponentType(); -// fail("Expected IllegalArgumentException"); -// } catch (IllegalArgumentException e) { -// // ok -// } -// } - -// public void testHelloWorldWithSidefile() { -// impl.setScriptFile("org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js"); -// impl.initialize(new AssemblyModelContextImpl(new AssemblyLoaderImpl(), ResourceLoaderFactory.getResourceLoader(Thread -// .currentThread().getContextClassLoader()))); -// ComponentType type = impl.getComponentType(); -// Assert.assertNotNull(type); -// List<Property> props = type.getProperties(); -// Assert.assertEquals(1, props.size()); -// Assert.assertTrue(props.get(0).getName().equals("text")); -// -// Assert.assertTrue(type.getReferences().isEmpty()); -// -// List<Service> services = type.getServices(); -// Assert.assertEquals(1, services.size()); -// Assert.assertTrue(services.get(0).getName().equals("HelloWorldService")); -// } - - // static { - // // bootstrap this somehow - // AssemblyPackage.eINSTANCE.getClass(); - // } - - protected void setUp() throws Exception { - super.setUp(); - Thread.currentThread().setContextClassLoader(JavaScriptImplementationTestCase.class.getClassLoader()); - } - - protected void tearDown() throws Exception { - Thread.currentThread().setContextClassLoader(null); - super.tearDown(); - } -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/mock/HelloWorldService.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/mock/HelloWorldService.java deleted file mode 100644 index 8edb27a473..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/mock/HelloWorldService.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.js.assembly.mock; - -/** - * @version $Rev: 368822 $ $Date: 2006-01-13 18:54:38 +0000 (Fri, 13 Jan 2006) $ - */ -public interface HelloWorldService { - String hello(String name); -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/JavaScriptAssemblyLoaderTestCase.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/JavaScriptAssemblyLoaderTestCase.java deleted file mode 100644 index 91ce8a73eb..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/JavaScriptAssemblyLoaderTestCase.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.js.assembly.tests; - -import junit.framework.TestCase; - -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl; - -/** - */ -public class JavaScriptAssemblyLoaderTestCase extends TestCase { - - private AssemblyModelContext modelContext; - - /** - * - */ - public JavaScriptAssemblyLoaderTestCase() { - super(); - } - - public void testLoader() { -/* - - AssemblyLoader loader = modelContext.getAssemblyLoader(); - Module module = loader.getModule(getClass().getResource("sca.module").toString()); - module.initialize(modelContext); - - Assert.assertTrue(module.getName().equals("tuscany.container.js.assembly.tests.bigbank.account")); - - Component component = module.getComponent("AccountServiceComponent"); - Assert.assertTrue(component != null); - - EntryPoint entryPoint = module.getEntryPoint("AccountService"); - Assert.assertTrue(entryPoint != null); - - Object value = component.getConfiguredProperty("currency").getValue(); - Assert.assertTrue(value.equals("EURO")); - - ConfiguredService configuredService = component.getConfiguredReference("accountDataService").getConfiguredServices().get(0); - Assert.assertTrue(configuredService.getPart().getName().equals("AccountDataServiceComponent")); - - InterfaceType interfaceType = configuredService.getService().getInterfaceContract().getInterfaceType(); - OperationType operationType = interfaceType.getOperationType("getCheckingAccount"); - Type type = operationType.getInputType(); - Property arg = (Property) type.getProperties().get(0); - Assert.assertTrue(arg.getType().getInstanceClass() == String.class); -*/ - - } - - protected void setUp() throws Exception { - super.setUp(); - - Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); - modelContext = new AssemblyModelContextImpl(null,null); - } - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountReport.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountReport.java deleted file mode 100644 index 90c47d400c..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/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.js.assembly.tests.bigbank.account.services.account; - -import java.util.List; - -/** - * @model - */ - -public interface AccountReport { - - /** - * @model type="services.account.AccountSummary" - */ - - List getAccountSummaries(); -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.java deleted file mode 100644 index ff555e178f..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/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.js.assembly.tests.bigbank.account.services.account; - -import org.osoa.sca.annotations.Remotable; - -@Remotable -public interface AccountService { - - public AccountReport getAccountReport(String customerID); -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountSummary.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountSummary.java deleted file mode 100644 index ad3b4ad737..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/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.js.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/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java deleted file mode 100644 index 42d8994392..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/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.js.assembly.tests.bigbank.account.services.accountdata; - -public interface AccountDataService { - - CheckingAccount getCheckingAccount(String customerID); - - SavingsAccount getSavingsAccount(String customerID); - - StockAccount getStockAccount(String customerID); -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java deleted file mode 100644 index 24b91020f7..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/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.js.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/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java deleted file mode 100644 index 43b755e0fb..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/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.js.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/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java deleted file mode 100644 index 3f8cb65ad7..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/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.js.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/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/StockAccount.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/StockAccount.java deleted file mode 100644 index ae6cdd6ff6..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/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.js.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/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java deleted file mode 100644 index 8720bcdaf6..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/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.js.assembly.tests.bigbank.account.services.stockquote; - -public interface StockQuoteService { - - public float getQuote(String symbol); -} - -
\ No newline at end of file diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java deleted file mode 100644 index 9765b67c2f..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/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.js.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/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl deleted file mode 100644 index 01df4ef054..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/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=""> - <!--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/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/builder/JSComponentContextBuilderTestCase.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/builder/JSComponentContextBuilderTestCase.java deleted file mode 100644 index d21c17636a..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/builder/JSComponentContextBuilderTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.apache.tuscany.container.js.builder; - -import java.util.Collection; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; -import org.apache.tuscany.container.js.assembly.mock.HelloWorldService; -import org.apache.tuscany.container.js.config.JavaScriptComponentRuntimeConfiguration; -import org.apache.tuscany.container.js.mock.MockAssemblyFactory; -import org.apache.tuscany.core.builder.RuntimeConfiguration; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.InstanceContext; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.impl.EventContextImpl; -import org.apache.tuscany.core.context.scope.ModuleScopeContext; -import org.apache.tuscany.core.invocation.jdk.JDKProxyFactoryFactory; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.SimpleComponent; -import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl; -import org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl; - -public class JSComponentContextBuilderTestCase extends TestCase { - - public void testBasicInvocation() throws Exception { - JavaScriptComponentContextBuilder jsBuilder = new JavaScriptComponentContextBuilder(); - jsBuilder.setProxyFactoryFactory(new JDKProxyFactoryFactory()); - JavaScriptTargetWireBuilder jsWireBuilder = new JavaScriptTargetWireBuilder(); - SimpleComponent component = MockAssemblyFactory.createComponent("foo", - "org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js", HelloWorldService.class, Scope.MODULE); - component.initialize(new AssemblyModelContextImpl(new AssemblyFactoryImpl(), new SCDLAssemblyModelLoaderImpl(null), new ResourceLoaderImpl(Thread.currentThread().getContextClassLoader()))); - jsBuilder.build(component, null); - ModuleScopeContext context = new ModuleScopeContext(new EventContextImpl()); - RuntimeConfiguration<InstanceContext> config = (RuntimeConfiguration) component.getComponentImplementation() - .getRuntimeConfiguration(); - context.registerConfiguration(config); - context.start(); - context.onEvent(EventContext.MODULE_START, null); - for (ProxyFactory proxyFactory : (Collection<ProxyFactory>) config.getTargetProxyFactories().values()) { - jsWireBuilder.completeTargetChain(proxyFactory, JavaScriptComponentRuntimeConfiguration.class, context); - proxyFactory.initialize(); - } - InstanceContext ctx = config.createInstanceContext(); - HelloWorldService hello = (HelloWorldService) ctx.getInstance(new QualifiedName("foo/HelloWorldService")); - Assert.assertNotNull(hello); - Assert.assertEquals("Hello foo", hello.hello("foo")); - } -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/builder/MockHandlerBuilder.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/builder/MockHandlerBuilder.java deleted file mode 100644 index 5f5e8d769a..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/builder/MockHandlerBuilder.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.container.js.builder; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.invocation.InvocationConfiguration; -import org.apache.tuscany.core.invocation.MessageHandler; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.model.assembly.AssemblyModelObject; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; - -/** - * Adds a handler to a source or target proxy configuration - * - * @version $Rev$ $Date$ - */ -public class MockHandlerBuilder implements RuntimeConfigurationBuilder { - - 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(AssemblyModelObject modelObject, Context context) throws BuilderException { - if (source) { - if (!(modelObject instanceof ConfiguredReference)) { - return; - } else { - ConfiguredReference cref = (ConfiguredReference) modelObject; - ProxyFactory pFactory = (ProxyFactory) cref.getProxyFactory(); - for (InvocationConfiguration config : pFactory.getProxyConfiguration().getInvocationConfigurations().values()) { - if (request) { - config.addRequestHandler(handler); - } else { - config.addResponseHandler(handler); - } - } - } - } else { - if (!(modelObject instanceof ConfiguredService)) { - return; - } else { - ConfiguredService cservice = (ConfiguredService) modelObject; - ProxyFactory pFactory = (ProxyFactory) cservice.getProxyFactory(); - for (InvocationConfiguration config : pFactory.getProxyConfiguration().getInvocationConfigurations().values()) { - if (request) { - config.addRequestHandler(handler); - } else { - config.addResponseHandler(handler); - } - } - } - - } - } - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/builder/MockInterceptorBuilder.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/builder/MockInterceptorBuilder.java deleted file mode 100644 index 0ed27101dd..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/builder/MockInterceptorBuilder.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.js.builder; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.invocation.Interceptor; -import org.apache.tuscany.core.invocation.InvocationConfiguration; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.model.assembly.AssemblyModelObject; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; - -/** - * Adds an interceptor to a source or target proxy configuration - * - * @version $Rev$ $Date$ - */ -public class MockInterceptorBuilder implements RuntimeConfigurationBuilder { - - private Interceptor interceptor; - - private boolean source; - - /** - * 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; - this.source = source; - } - - public void build(AssemblyModelObject modelObject, Context context) throws BuilderException { - if (source) { - if (!(modelObject instanceof ConfiguredReference)) { - return; - } else { - ConfiguredReference cref = (ConfiguredReference) modelObject; - ProxyFactory pFactory = (ProxyFactory) cref.getProxyFactory(); - for (InvocationConfiguration config : pFactory.getProxyConfiguration().getInvocationConfigurations().values()) { - config.addSourceInterceptor(interceptor); - } - } - } else { - if (!(modelObject instanceof ConfiguredService)) { - return; - } else { - ConfiguredService cservice = (ConfiguredService) modelObject; - ProxyFactory pFactory = (ProxyFactory) cservice.getProxyFactory(); - for (InvocationConfiguration config : pFactory.getProxyConfiguration().getInvocationConfigurations().values()) { - config.addTargetInterceptor(interceptor); - } - } - - } - } - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/config/ModuleComponentConfigurationLoaderTestCase.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/config/ModuleComponentConfigurationLoaderTestCase.java deleted file mode 100644 index 4f9ba1ab49..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/config/ModuleComponentConfigurationLoaderTestCase.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.js.config; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; -import org.apache.tuscany.container.js.assembly.impl.JavaScriptImplementationImpl; -import org.apache.tuscany.container.js.loader.JavaScriptSCDLModelLoader; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; -import org.apache.tuscany.core.config.impl.ModuleComponentConfigurationLoaderImpl; -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ComponentImplementation; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.ModuleComponent; -import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl; -import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; -import org.apache.tuscany.model.scdl.loader.SCDLModelLoader; -import org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl; - -/** - * @version $Rev: 368822 $ $Date: 2006-01-13 18:54:38 +0000 (Fri, 13 Jan 2006) $ - */ -public class ModuleComponentConfigurationLoaderTestCase extends TestCase { - private ModuleComponentConfigurationLoader loader; - - public void testFoo() throws ConfigurationException { - URL xml = ModuleComponentConfigurationLoaderTestCase.class.getResource("ModuleComponentLoaderTest1.module"); - ModuleComponent moduleComponent = loader.loadModuleComponent("test", "test", xml.toString()); - Assert.assertEquals("test", moduleComponent.getName()); - Module module = moduleComponent.getModuleImplementation(); - Assert.assertEquals("ModuleComponentLoaderTest1", module.getName()); - List<Component> components = module.getComponents(); - Assert.assertEquals(1, components.size()); - Component component = components.get(0); - Assert.assertEquals("HelloWorldServiceComponent", component.getName()); - - component = module.getComponent("HelloWorldServiceComponent"); - Assert.assertEquals("HelloWorldServiceComponent", component.getName()); - - ComponentImplementation implementation = component.getComponentImplementation(); - Assert.assertTrue(implementation instanceof JavaScriptImplementationImpl); - } - - protected void setUp() throws Exception { - super.setUp(); - Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); - List<SCDLModelLoader> scdlLoaders=new ArrayList<SCDLModelLoader>(); - JavaScriptSCDLModelLoader jsLoader=new JavaScriptSCDLModelLoader(); - scdlLoaders.add(jsLoader); - AssemblyModelLoader modelLoader=new SCDLAssemblyModelLoaderImpl(scdlLoaders); - AssemblyModelContext modelContext=new AssemblyModelContextImpl( - new AssemblyFactoryImpl(), modelLoader,new ResourceLoaderImpl(this.getClass().getClassLoader())); - loader = new ModuleComponentConfigurationLoaderImpl(modelContext); - } -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/integration/JSComponentContextTestCase.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/integration/JSComponentContextTestCase.java deleted file mode 100644 index cd29f59327..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/integration/JSComponentContextTestCase.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.container.js.integration; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.container.js.assembly.mock.HelloWorldService; -import org.apache.tuscany.container.js.builder.JavaScriptComponentContextBuilder; -import org.apache.tuscany.container.js.builder.JavaScriptTargetWireBuilder; -import org.apache.tuscany.container.js.builder.MockInterceptorBuilder; -import org.apache.tuscany.container.js.invocation.mock.MockSyncInterceptor; -import org.apache.tuscany.container.js.mock.MockAssemblyFactory; -import org.apache.tuscany.container.js.mock.MockModuleFactory; -import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder; -import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; -import org.apache.tuscany.core.builder.impl.HierarchicalBuilder; -import org.apache.tuscany.core.context.AggregateContext; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.impl.AggregateContextImpl; -import org.apache.tuscany.core.invocation.jdk.JDKProxyFactoryFactory; -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.builder.SystemComponentContextBuilder; -import org.apache.tuscany.core.system.builder.SystemEntryPointBuilder; -import org.apache.tuscany.core.system.builder.SystemExternalServiceBuilder; -import org.apache.tuscany.model.assembly.Scope; - -/** - * Integration tests for JavaScript components and aggregate contexts - * - * @version $Rev$ $Date$ - */ -public class JSComponentContextTestCase extends TestCase { - - public void testBasicInvocation() throws Exception { - MessageFactory msgFactory = new MessageFactoryImpl(); - - List<RuntimeConfigurationBuilder> builders = new ArrayList(); - builders.add((new SystemComponentContextBuilder())); - builders.add(new SystemEntryPointBuilder()); - builders.add(new SystemExternalServiceBuilder()); - - JavaScriptComponentContextBuilder javaBuilder = new JavaScriptComponentContextBuilder(); - javaBuilder.setMessageFactory(msgFactory); - javaBuilder.setProxyFactoryFactory(new JDKProxyFactoryFactory()); - - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, true); - HierarchicalBuilder refBuilder = new HierarchicalBuilder(); - refBuilder.addBuilder(interceptorBuilder); - javaBuilder.setReferenceBuilder(refBuilder); - builders.add(javaBuilder); - - DefaultWireBuilder defaultWireBuilder = new DefaultWireBuilder(); - - RuntimeContext runtime = new RuntimeContextImpl(null, null, builders, defaultWireBuilder); - runtime.addBuilder(new JavaScriptTargetWireBuilder()); - runtime.start(); - runtime.getRootContext().registerModelObject( - MockAssemblyFactory.createSystemComponent("test.module", AggregateContextImpl.class.getName(), - Scope.AGGREGATE)); - AggregateContext child = (AggregateContext) runtime.getRootContext().getContext("test.module"); - child.registerModelObject(MockModuleFactory.createModule()); - child.fireEvent(EventContext.MODULE_START, null); - HelloWorldService source = (HelloWorldService) child.locateInstance("source/HelloWorldService"); - Assert.assertNotNull(source); - Assert.assertEquals("Hello foo",source.hello("foo")); - //Assert.assertEquals(1, mockInterceptor.getCount()); - child.fireEvent(EventContext.MODULE_STOP, null); - runtime.stop(); - } - -} - diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/invocation/mock/MockHandler.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/invocation/mock/MockHandler.java deleted file mode 100644 index 7064ec5d65..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/invocation/mock/MockHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * - */ -package org.apache.tuscany.container.js.invocation.mock; - -import org.apache.tuscany.core.invocation.MessageHandler; -import org.apache.tuscany.core.message.Message; - -/** - * A test handler - * - * @version $Rev$ $Date$ - */ -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/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/invocation/mock/MockSyncInterceptor.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/invocation/mock/MockSyncInterceptor.java deleted file mode 100644 index caab4b3756..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/invocation/mock/MockSyncInterceptor.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.js.invocation.mock; - -import org.apache.tuscany.core.invocation.Interceptor; -import org.apache.tuscany.core.message.Message; - -/** - * A test interceptor - * - * @version $Rev$ $Date$ - */ -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/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/mock/MockAssemblyFactory.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/mock/MockAssemblyFactory.java deleted file mode 100644 index 5cb80b29aa..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/mock/MockAssemblyFactory.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.container.js.mock; - -import org.apache.tuscany.container.js.assembly.JavaScriptAssemblyFactory; -import org.apache.tuscany.container.js.assembly.JavaScriptImplementation; -import org.apache.tuscany.container.js.assembly.impl.JavaScriptAssemblyFactoryImpl; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.context.AggregateContext; -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.AssemblyModelContext; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.SimpleComponent; -import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * Generates test components and module assemblies - * - * @version $Rev: 377775 $ $Date: 2006-02-14 09:18:31 -0800 (Tue, 14 Feb 2006) $ - */ -public class MockAssemblyFactory { - - private static JavaScriptAssemblyFactory factory = new JavaScriptAssemblyFactoryImpl(); - - private static SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); - - public static SimpleComponent createComponent(String name, String scriptFile, Class type, Scope scope) { - SimpleComponent sc = factory.createSimpleComponent(); - JavaScriptImplementation impl = factory.createJavaScriptImplementation(); - impl.setComponentType(factory.createComponentType()); - impl.setScriptFile(scriptFile); - sc.setComponentImplementation(impl); - Service s = factory.createService(); - String serviceName = type.getName().substring(type.getName().lastIndexOf('.')+1); - s.setName(serviceName); - JavaServiceContract contract = factory.createJavaServiceContract(); - s.setServiceContract(contract); - contract.setScope(scope); - contract.setInterface(type); - impl.getComponentType().getServices().add(s); - ConfiguredService cService = factory.createConfiguredService(); - cService.setService(s); - cService.initialize(new AssemblyModelContextImpl(null,null)); - sc.getConfiguredServices().add(cService); - sc.setName(name); - sc.setComponentImplementation(impl); - return sc; - } - - public static Component createSystemComponent(String name, String type, Scope scope) throws NoSuchMethodException, - ClassNotFoundException { - Class claz = JavaIntrospectionHelper.loadClass(type); - Component sc = null; - if (AggregateContext.class.isAssignableFrom(claz)) { - sc = systemFactory.createModuleComponent(); - } else { - sc = systemFactory.createSimpleComponent(); - } - SystemImplementation impl = systemFactory.createSystemImplementation(); - impl.setImplementationClass(claz); - sc.setComponentImplementation(impl); - Service s = systemFactory.createService(); - JavaServiceContract ji = systemFactory.createJavaServiceContract(); - s.setServiceContract(ji); - ji.setScope(scope); - impl.setComponentType(systemFactory.createComponentType()); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setComponentImplementation(impl); - return sc; - } - - // public static SimpleComponent createComponent(String name, String scriptFile, String serviceName, ScopeEnum - // scope) - // throws NoSuchMethodException, ClassNotFoundException { - // SimpleComponent sc = new PojoSimpleComponent(); - // PojoJavaScriptImplementation impl = new PojoJavaScriptImplementation(); - // impl.setScriptFile(scriptFile); - // impl.initialize(new AssemblyModelContextImpl()); - // - // sc.setComponentImplementation(impl); - // Service s = new PojoService(); - // s.setName(serviceName.substring(serviceName.lastIndexOf('.') + 1)); - // PojoJavaInterface ji = new PojoJavaInterface(); - // ji.setInterface(serviceName); - // Class claz = JavaIntrospectionHelper.loadClass(serviceName); - // PojoInterfaceType iType = new PojoInterfaceType(); - // iType.setInstanceClass(claz); - // for (Method m : claz.getMethods()) { - // // assume no method overloading - // PojoOperationType type = new PojoOperationType(); - // type.setName(m.getName()); - // for (Class inputType : m.getParameterTypes()) { - // type.setOutputType(new SDOType(null,null,inputType,Collections.EMPTY_LIST)); - // } - // iType.addOperationType(type); - // } - // ji.setInterfaceType(iType); - // - // - // s.setInterfaceContract(ji); - // ji.setScope(scope); - // impl.getServices().add(s); - // sc.setName(name); - // sc.setComponentImplementation(impl); - // PojoConfiguredService cService = new PojoConfiguredService(); - // cService.setService(s); - // sc.getConfiguredServices().add(cService); - // return sc; - // } - // - // public static Component createSystemComponent(String name, String type, ScopeEnum scope) throws - // NoSuchMethodException, - // ClassNotFoundException { - // - // Class claz = JavaIntrospectionHelper.loadClass(type); - // PojoComponent sc = null; - // if (AggregateContext.class.isAssignableFrom(claz)) { - // sc = new PojoAggregateComponent(); - // } else { - // sc = new PojoSimpleComponent(); - // } - // SystemImplementation impl = new PojoSystemImplementation(); - // impl.setClass(type); - // sc.setComponentImplementation(impl); - // Service s = new PojoService(); - // JavaInterface ji = new PojoJavaInterface(); - // s.setInterfaceContract(ji); - // ji.setScope(scope); - // impl.getServices().add(s); - // sc.setName(name); - // sc.setComponentImplementation(impl); - // return sc; - // } - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/mock/MockModuleFactory.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/mock/MockModuleFactory.java deleted file mode 100644 index fe66104000..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/mock/MockModuleFactory.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.container.js.mock; - -import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; -import org.apache.tuscany.container.js.assembly.mock.HelloWorldService; -import org.apache.tuscany.model.assembly.AssemblyFactory; -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Module; -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.AssemblyFactoryImpl; -import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl; -import org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl; -import org.apache.tuscany.model.types.java.JavaServiceContract; - -/** - * Generates mock modules - * - * @version $Rev$ $Date$ - */ -public class MockModuleFactory { - - private static AssemblyFactory factory = new AssemblyFactoryImpl(); - - private static AssemblyModelContext assemblyContext = new AssemblyModelContextImpl(new AssemblyFactoryImpl(), - new SCDLAssemblyModelLoaderImpl(null), new ResourceLoaderImpl(Thread.currentThread().getContextClassLoader())); - - private MockModuleFactory() { - } - - public static Module createModule() throws Exception { - Component sourceComponent = MockAssemblyFactory.createComponent("source", - "org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js", HelloWorldService.class, Scope.MODULE); - Component targetComponent = MockAssemblyFactory.createComponent("target", - "org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js", HelloWorldService.class, Scope.MODULE); - - Service targetService = factory.createService(); - JavaServiceContract targetContract = factory.createJavaServiceContract(); - targetContract.setInterface(HelloWorldService.class); - targetService.setServiceContract(targetContract); - targetService.setName("GenericComponent"); - ConfiguredService cTargetService = factory.createConfiguredService(); - cTargetService.setService(targetService); - cTargetService.initialize(assemblyContext); - targetComponent.getConfiguredServices().add(cTargetService); - targetComponent.initialize(assemblyContext); - - Reference ref = factory.createReference(); - ConfiguredReference cref = factory.createConfiguredReference(); - ref.setName("setGenericComponent"); - JavaServiceContract inter = factory.createJavaServiceContract(); - inter.setInterface(HelloWorldService.class); - ref.setServiceContract(inter); - cref.setReference(ref); - cref.getTargetConfiguredServices().add(cTargetService); - 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; - } - - // public static Module createModule() throws Exception { - // Component sourceComponent = - // MockAssemblyFactory.createComponent("source","org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js",HelloWorldService.class.getCanonicalName(),ScopeEnum.MODULE_LITERAL); - // Component targetComponent = - // MockAssemblyFactory.createComponent("target","org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js",HelloWorldService.class.getCanonicalName(),ScopeEnum.MODULE_LITERAL); - // PojoReference ref = new PojoReference(); - // PojoConfiguredReference cref = new PojoConfiguredReference(); - // ref.setName("helloWorld"); - // PojoInterface inter = new PojoJavaInterface(); - // PojoInterfaceType type = new PojoInterfaceType(); - // type.setInstanceClass(HelloWorldService.class); - // PojoOperationType oType = new PojoOperationType(); - // oType.setName("hello"); - // SDOType inputType = new SDOType("String","",String.class,null); - // oType.setInputType(inputType); - // type.addOperationType(oType); - // inter.setInterfaceType(type); - // ref.setInterfaceContract(inter); - // cref.setReference(ref); - // cref.setPart(targetComponent); - // PojoPort port = new PojoPort(); - // port.setName("HelloWorldService"); - // cref.setPort(port); - // sourceComponent.getConfiguredReferences().add(cref); - // PojoModule module = new PojoModule(); - // module.setName("test.module"); - // module.addComponent(sourceComponent); - // module.addComponent(targetComponent); - // return module; - // } - -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.java b/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.java deleted file mode 100644 index 9269c1cf7e..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/java/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.java +++ /dev/null @@ -1,184 +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.js.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.mozilla.javascript.EcmaError; - -/** - * Tests for the RhinoInvoker - */ -public class RhinoInvokerTestCase extends TestCase { - - private static final String scriptName = "RhinoInvokerTestCase.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", "petra", null); - assertEquals("petra", x); - } - - public void testCopy() { - RhinoScript ri = new RhinoScript(scriptName, script); - Object x = ri.invoke("echo", "petra", null); - assertEquals("petra", x); - - ri = ri.copy(); - x = ri.invoke("echo", "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", "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", "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 invocation scope) - */ - public void testScopes3() { - RhinoScript ri = new RhinoScript(scriptName, script); - ri.invoke("setGlobalVarY", "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", "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/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.componentType b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.componentType deleted file mode 100644 index 3e9bb5bc28..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/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.js.assembly.mock.HelloWorldService" remoteable="true"/> - </service> - <property name="text" type="xsd:string"/> -</componentType>
\ No newline at end of file diff --git a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js deleted file mode 100644 index 6c5f697040..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js +++ /dev/null @@ -1,4 +0,0 @@ - -function hello(name) { - return "Hello " + name; -} diff --git a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountService.wsdl b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountService.wsdl deleted file mode 100644 index ecd07d3934..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/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=""/> - </wsdl:port> - </wsdl:service> -</wsdl:definitions> diff --git a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountServiceImpl.componentType b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountServiceImpl.componentType deleted file mode 100644 index 9f75ba9134..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountServiceImpl.componentType +++ /dev/null @@ -1,19 +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="test1MediatorService"> - <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.account.AccountService"/> - </service> - - <reference name="accountDataService"> - <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.accountdata.AccountDataService"/> - </reference> - - <reference name="stockQuoteService"> - <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.stockquote.StockQuoteService"/> - </reference> - - <property name="currency" type="xsd:string" default="USD"/> - -</componentType>
\ No newline at end of file diff --git a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.wsdl b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.wsdl deleted file mode 100644 index ecd07d3934..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/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=""/> - </wsdl:port> - </wsdl:service> -</wsdl:definitions> diff --git a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountServiceImpl.componentType b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountServiceImpl.componentType deleted file mode 100644 index 9f75ba9134..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountServiceImpl.componentType +++ /dev/null @@ -1,19 +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="test1MediatorService"> - <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.account.AccountService"/> - </service> - - <reference name="accountDataService"> - <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.accountdata.AccountDataService"/> - </reference> - - <reference name="stockQuoteService"> - <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.stockquote.StockQuoteService"/> - </reference> - - <property name="currency" type="xsd:string" default="USD"/> - -</componentType>
\ No newline at end of file diff --git a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.componentType b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.componentType deleted file mode 100644 index 0217420bea..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.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="AccountDataService"> - <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.accountdata.AccountDataService"/> - </service> - -</componentType>
\ No newline at end of file diff --git a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.componentType b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.componentType deleted file mode 100644 index e67876ba35..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.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="StockQuoteService"> - <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.stockquote.StockQuoteService"/> - </service> - -</componentType>
\ No newline at end of file diff --git a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl deleted file mode 100644 index 01df4ef054..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/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=""> - <!--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/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/sca.module b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/sca.module deleted file mode 100644 index 86f516c128..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/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" - xmlns:js="http://org.apache.tuscany/xmlns/js/0.9" - name="tuscany.container.js.assembly.tests.bigbank.account"> - - <entryPoint name="AccountService"> - <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.account.AccountService"/> - <binding.ws port="http://www.bigbank.com/AccountService#AccountServiceSOAP"/> - <reference>AccountServiceComponent</reference> - </entryPoint> - - <component name="AccountServiceComponent"> - <js:implementation.js scriptFile="org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountServiceImpl.js"/> - <properties> - <v:currency>EURO</v:currency> - </properties> - <references> - <v:accountDataService>AccountDataServiceComponent</v:accountDataService> - <v:stockQuoteService>StockQuoteService</v:stockQuoteService> - </references> - </component> - - <component name="AccountDataServiceComponent"> - <js:implementation.js scriptFile="org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.js"/> - </component> - - <component name="StockQuoteService"> - <js:implementation.js scriptFile="org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.js"/> - </component> - - <!-- - <externalService name="StockQuoteService"> - <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.stockquote"/> - <binding.ws port="http://www.quickstockquote.com/StockQuoteService#StockQuoteServiceSOAP"/> - </externalService> - --> - -</module> - diff --git a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/config/ModuleComponentLoaderTest1.module b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/config/ModuleComponentLoaderTest1.module deleted file mode 100644 index d8e2c425ea..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/config/ModuleComponentLoaderTest1.module +++ /dev/null @@ -1,25 +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="ModuleComponentLoaderTest1"> - - <component name="HelloWorldServiceComponent"> - <js:implementation.js scriptFile="org.apache.tuscany.container.js.assembly.mock.HelloWorldImpl.js"/> - </component> -</module> diff --git a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.js b/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.js deleted file mode 100644 index 2de740d5f8..0000000000 --- a/tags/java-stable-20060304/sca/container.js/src/test/resources/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.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; -} |