You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2006/08/12 00:56:56 UTC
svn commit: r430912 [14/17] - in /incubator/tuscany/java: samples/sca/
samples/sca/bigbank/src/main/resources/META-INF/
samples/sca/bigbank/src/main/resources/META-INF/sca/
samples/sca/calculator/src/main/resources/META-INF/
samples/sca/calculator/src/...
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java Fri Aug 11 15:56:46 2006
@@ -1,122 +1,122 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.javascript;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.container.javascript.rhino.RhinoScript;
-import org.apache.tuscany.container.javascript.rhino.RhinoScriptInstance;
-import org.apache.tuscany.spi.ObjectCreationException;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.ScopeContainer;
-import org.apache.tuscany.spi.component.TargetException;
-import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.extension.AtomicComponentExtension;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.OutboundWire;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireService;
-
-/**
- * The JavaScript component implementation.
- */
-public class JavaScriptComponent<T> extends AtomicComponentExtension<T> {
-
- private final List<Class<?>> services;
-
- private final Map<String, Object> properties;
-
- private RhinoScript rhinoScript;
-
- public JavaScriptComponent(String name, RhinoScript rhinoScript, List<Class<?>> services, Map<String, Object> properties,
- CompositeComponent parent, ScopeContainer scopeContainer, WireService wireService, WorkContext workContext) {
- super(name, parent, scopeContainer, wireService, workContext, null, 0);
-
- this.rhinoScript = rhinoScript;
- this.services = services;
- this.properties = properties;
- this.scope = scopeContainer.getScope();
- }
-
- public Object createInstance() throws ObjectCreationException {
-
- Map<String, Object> context = new HashMap<String, Object>(getProperties());
-
- for (List<OutboundWire> referenceWires : getOutboundWires().values()) {
- for (OutboundWire<?> wire : referenceWires) {
- context.put(wire.getReferenceName(), wireService.createProxy(wire));
- }
- }
-
- Object instance = rhinoScript.createRhinoScriptInstance(context);
-
- return instance;
- }
-
- public List<Class<?>> getServiceInterfaces() {
- return services;
- }
-
- public TargetInvoker createTargetInvoker(String serviceName, Method method) {
- return new JavaScriptInvoker(method.getName(), this);
- }
-
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- public RhinoScriptInstance getTargetInstance() throws TargetException {
- return scopeContainer.getInstance(this);
- }
-
- @SuppressWarnings("unchecked")
- public T getServiceInstance(String service) throws TargetException {
- InboundWire<?> wire = getInboundWire(service);
- if (wire == null) {
- TargetException e = new TargetException("ServiceDefinition not found"); // TODO better error message
- e.setIdentifier(service);
- throw e;
- }
- return (T) wireService.createProxy(wire);
- }
-
- @SuppressWarnings("unchecked")
- public T getServiceInstance() throws TargetException {
- // TODO this should return a default service from a wire
- final RhinoScriptInstance target = (RhinoScriptInstance) getTargetInstance();
- ClassLoader cl = getServiceInterfaces().get(0).getClassLoader();
- InvocationHandler ih = new InvocationHandler() {
- public Object invoke(Object arg0, Method method, Object[] args) throws Throwable {
- return target.invokeFunction(method.getName(), args);
- }
- };
-
- Class<?>[] ifaces = new Class<?>[getServiceInterfaces().size()];
- for (int i = 0; i < getServiceInterfaces().size(); i++) {
- ifaces[i] = getServiceInterfaces().get(i);
- }
- T proxy = (T) Proxy.newProxyInstance(cl, ifaces, ih);
-
- return proxy;
- }
-
-}
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.javascript;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+import org.apache.tuscany.container.javascript.rhino.RhinoScriptInstance;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.AtomicComponentExtension;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+
+/**
+ * The JavaScript component implementation.
+ */
+public class JavaScriptComponent<T> extends AtomicComponentExtension<T> {
+
+ private final List<Class<?>> services;
+
+ private final Map<String, Object> properties;
+
+ private RhinoScript rhinoScript;
+
+ public JavaScriptComponent(String name, RhinoScript rhinoScript, List<Class<?>> services, Map<String, Object> properties,
+ CompositeComponent parent, ScopeContainer scopeContainer, WireService wireService, WorkContext workContext) {
+ super(name, parent, scopeContainer, wireService, workContext, null, 0);
+
+ this.rhinoScript = rhinoScript;
+ this.services = services;
+ this.properties = properties;
+ this.scope = scopeContainer.getScope();
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+
+ Map<String, Object> context = new HashMap<String, Object>(getProperties());
+
+ for (List<OutboundWire> referenceWires : getOutboundWires().values()) {
+ for (OutboundWire<?> wire : referenceWires) {
+ context.put(wire.getReferenceName(), wireService.createProxy(wire));
+ }
+ }
+
+ Object instance = rhinoScript.createRhinoScriptInstance(context);
+
+ return instance;
+ }
+
+ public List<Class<?>> getServiceInterfaces() {
+ return services;
+ }
+
+ public TargetInvoker createTargetInvoker(String serviceName, Method method) {
+ return new JavaScriptInvoker(method.getName(), this);
+ }
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public RhinoScriptInstance getTargetInstance() throws TargetException {
+ return scopeContainer.getInstance(this);
+ }
+
+ @SuppressWarnings("unchecked")
+ public T getServiceInstance(String service) throws TargetException {
+ InboundWire<?> wire = getInboundWire(service);
+ if (wire == null) {
+ TargetException e = new TargetException("ServiceDefinition not found"); // TODO better error message
+ e.setIdentifier(service);
+ throw e;
+ }
+ return (T) wireService.createProxy(wire);
+ }
+
+ @SuppressWarnings("unchecked")
+ public T getServiceInstance() throws TargetException {
+ // TODO this should return a default service from a wire
+ final RhinoScriptInstance target = (RhinoScriptInstance) getTargetInstance();
+ ClassLoader cl = getServiceInterfaces().get(0).getClassLoader();
+ InvocationHandler ih = new InvocationHandler() {
+ public Object invoke(Object arg0, Method method, Object[] args) throws Throwable {
+ return target.invokeFunction(method.getName(), args);
+ }
+ };
+
+ Class<?>[] ifaces = new Class<?>[getServiceInterfaces().size()];
+ for (int i = 0; i < getServiceInterfaces().size(); i++) {
+ ifaces[i] = getServiceInterfaces().get(i);
+ }
+ T proxy = (T) Proxy.newProxyInstance(cl, ifaces, ih);
+
+ return proxy;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentBuilder.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentBuilder.java (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentBuilder.java Fri Aug 11 15:56:46 2006
@@ -1,56 +1,56 @@
-package org.apache.tuscany.container.javascript;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.container.javascript.rhino.RhinoScript;
-import org.apache.tuscany.spi.builder.BuilderConfigException;
-import org.apache.tuscany.spi.component.Component;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.ScopeContainer;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
-import org.apache.tuscany.spi.model.ComponentDefinition;
-import org.apache.tuscany.spi.model.ComponentType;
-import org.apache.tuscany.spi.model.ServiceDefinition;
-
-/**
- * Extension point for creating {@link JavaScriptComponent}s from an assembly configuration
- */
-public class JavaScriptComponentBuilder extends ComponentBuilderExtension<JavaScriptImplementation> {
-
- protected Class<JavaScriptImplementation> getImplementationType() {
- return JavaScriptImplementation.class;
- }
-
- @SuppressWarnings("unchecked")
- public Component<?> build(CompositeComponent<?> parent, ComponentDefinition<JavaScriptImplementation> componentDefinition,
- DeploymentContext deploymentContext) throws BuilderConfigException {
-
- String name = componentDefinition.getName();
- JavaScriptImplementation implementation = componentDefinition.getImplementation();
- ComponentType componentType = implementation.getComponentType();
-
- // get list of services provided by this component
- Collection<ServiceDefinition> collection = componentType.getServices().values();
- List<Class<?>> services = new ArrayList<Class<?>>(collection.size());
- for (ServiceDefinition serviceDefinition : collection) {
- services.add(serviceDefinition.getServiceContract().getInterfaceClass());
- }
-
- RhinoScript rhinoScript = implementation.getRhinoScript();
-
- // TODO properties
- Map<String, Object> properties = new HashMap<String, Object>();
-
- // TODO scopes
- // ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(componentType.getLifecycleScope());
- ScopeContainer scopeContainer = deploymentContext.getModuleScope();
-
- return new JavaScriptComponent(name, rhinoScript, services, properties, parent, scopeContainer, wireService, workContext);
- }
-
-}
+package org.apache.tuscany.container.javascript;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentBuilderExtension;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+/**
+ * Extension point for creating {@link JavaScriptComponent}s from an assembly configuration
+ */
+public class JavaScriptComponentBuilder extends ComponentBuilderExtension<JavaScriptImplementation> {
+
+ protected Class<JavaScriptImplementation> getImplementationType() {
+ return JavaScriptImplementation.class;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Component<?> build(CompositeComponent<?> parent, ComponentDefinition<JavaScriptImplementation> componentDefinition,
+ DeploymentContext deploymentContext) throws BuilderConfigException {
+
+ String name = componentDefinition.getName();
+ JavaScriptImplementation implementation = componentDefinition.getImplementation();
+ ComponentType componentType = implementation.getComponentType();
+
+ // get list of services provided by this component
+ Collection<ServiceDefinition> collection = componentType.getServices().values();
+ List<Class<?>> services = new ArrayList<Class<?>>(collection.size());
+ for (ServiceDefinition serviceDefinition : collection) {
+ services.add(serviceDefinition.getServiceContract().getInterfaceClass());
+ }
+
+ RhinoScript rhinoScript = implementation.getRhinoScript();
+
+ // TODO properties
+ Map<String, Object> properties = new HashMap<String, Object>();
+
+ // TODO scopes
+ // ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(componentType.getLifecycleScope());
+ ScopeContainer scopeContainer = deploymentContext.getModuleScope();
+
+ return new JavaScriptComponent(name, rhinoScript, services, properties, parent, scopeContainer, wireService, workContext);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentTypeLoader.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentTypeLoader.java (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentTypeLoader.java Fri Aug 11 15:56:46 2006
@@ -1,112 +1,112 @@
-/**
- *
- * Copyright 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.container.javascript;
-
-import java.net.URL;
-
-import org.apache.tuscany.container.javascript.rhino.RhinoScript;
-import org.apache.tuscany.core.implementation.IntrospectionRegistry;
-import org.apache.tuscany.core.implementation.Introspector;
-import org.apache.tuscany.core.implementation.JavaServiceContract;
-import org.apache.tuscany.core.implementation.ProcessingException;
-import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
-import org.apache.tuscany.spi.loader.LoaderException;
-import org.apache.tuscany.spi.loader.LoaderRegistry;
-import org.apache.tuscany.spi.model.ComponentType;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.model.ServiceDefinition;
-import org.mozilla.javascript.Scriptable;
-import org.osoa.sca.annotations.Constructor;
-
-/**
- * @version $Rev: 423297 $ $Date: 2006-07-19 00:56:32 +0100 (Wed, 19 Jul 2006) $
- */
-public class JavaScriptComponentTypeLoader extends ComponentTypeLoaderExtension<JavaScriptImplementation> {
- private Introspector introspector;
-
- @Constructor( { "registry", "introspector" })
- public JavaScriptComponentTypeLoader(@Autowire LoaderRegistry loaderRegistry, @Autowire IntrospectionRegistry introspector) {
- super(loaderRegistry);
- // this.introspector = introspector;
- }
-
- @Override
- protected Class<JavaScriptImplementation> getImplementationClass() {
- return JavaScriptImplementation.class;
- }
-
- public void load(CompositeComponent<?> parent, JavaScriptImplementation implementation, DeploymentContext deploymentContext)
- throws LoaderException {
- String scriptName = implementation.getRhinoScript().getScriptName();
- URL resource = implementation.getClassLoader().getResource(getBaseName(scriptName) + ".componentType");
- ComponentType componentType;
- if (resource == null) {
- componentType = loadByIntrospection(parent, implementation, deploymentContext);
- if (componentType == null) {
- throw new RuntimeException("must use .componentType side file or JS SCA variable definition");
- }
- } else {
- componentType = loadFromSidefile(resource, deploymentContext);
- }
-
- implementation.setComponentType(componentType);
- }
-
- protected ComponentType loadByIntrospection(CompositeComponent<?> parent, JavaScriptImplementation implementation,
- DeploymentContext deploymentContext) throws ProcessingException {
- ComponentType componentType = null;
-
- RhinoScript rhinoScript = implementation.getRhinoScript();
- Scriptable scope = rhinoScript.getScriptScope();
- Scriptable sca = (Scriptable) scope.get("SCA", scope);
- if (sca != null) {
- componentType = new ComponentType();
-
- Object serviceClass = sca.get("serviceClass", scope);
- if (serviceClass != null) {
- ServiceDefinition service = new ServiceDefinition();
- ServiceContract sc = new JavaServiceContract();
- try {
- sc.setInterfaceClass(Class.forName(serviceClass.toString(), true, implementation.getClassLoader()));
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
- service.setServiceContract(sc);
- componentType.add(service);
- }
- }
-
- return componentType;
- }
-
- protected ComponentType loadFromSidefile(URL url, DeploymentContext deploymentContext) throws LoaderException {
- return loaderRegistry.load(null, url, ComponentType.class, deploymentContext);
- }
-
- private String getBaseName(String scriptName) {
- String baseName = scriptName;
- int lastDot = baseName.lastIndexOf('.');
- if (lastDot != -1) {
- baseName = baseName.substring(0, lastDot);
- }
- return baseName;
- }
-
-}
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.net.URL;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+import org.apache.tuscany.core.implementation.IntrospectionRegistry;
+import org.apache.tuscany.core.implementation.Introspector;
+import org.apache.tuscany.core.implementation.JavaServiceContract;
+import org.apache.tuscany.core.implementation.ProcessingException;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.mozilla.javascript.Scriptable;
+import org.osoa.sca.annotations.Constructor;
+
+/**
+ * @version $Rev: 423297 $ $Date: 2006-07-19 00:56:32 +0100 (Wed, 19 Jul 2006) $
+ */
+public class JavaScriptComponentTypeLoader extends ComponentTypeLoaderExtension<JavaScriptImplementation> {
+ private Introspector introspector;
+
+ @Constructor( { "registry", "introspector" })
+ public JavaScriptComponentTypeLoader(@Autowire LoaderRegistry loaderRegistry, @Autowire IntrospectionRegistry introspector) {
+ super(loaderRegistry);
+ // this.introspector = introspector;
+ }
+
+ @Override
+ protected Class<JavaScriptImplementation> getImplementationClass() {
+ return JavaScriptImplementation.class;
+ }
+
+ public void load(CompositeComponent<?> parent, JavaScriptImplementation implementation, DeploymentContext deploymentContext)
+ throws LoaderException {
+ String scriptName = implementation.getRhinoScript().getScriptName();
+ URL resource = implementation.getClassLoader().getResource(getBaseName(scriptName) + ".componentType");
+ ComponentType componentType;
+ if (resource == null) {
+ componentType = loadByIntrospection(parent, implementation, deploymentContext);
+ if (componentType == null) {
+ throw new RuntimeException("must use .componentType side file or JS SCA variable definition");
+ }
+ } else {
+ componentType = loadFromSidefile(resource, deploymentContext);
+ }
+
+ implementation.setComponentType(componentType);
+ }
+
+ protected ComponentType loadByIntrospection(CompositeComponent<?> parent, JavaScriptImplementation implementation,
+ DeploymentContext deploymentContext) throws ProcessingException {
+ ComponentType componentType = null;
+
+ RhinoScript rhinoScript = implementation.getRhinoScript();
+ Scriptable scope = rhinoScript.getScriptScope();
+ Scriptable sca = (Scriptable) scope.get("SCA", scope);
+ if (sca != null) {
+ componentType = new ComponentType();
+
+ Object serviceClass = sca.get("serviceClass", scope);
+ if (serviceClass != null) {
+ ServiceDefinition service = new ServiceDefinition();
+ ServiceContract sc = new JavaServiceContract();
+ try {
+ sc.setInterfaceClass(Class.forName(serviceClass.toString(), true, implementation.getClassLoader()));
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ service.setServiceContract(sc);
+ componentType.add(service);
+ }
+ }
+
+ return componentType;
+ }
+
+ protected ComponentType loadFromSidefile(URL url, DeploymentContext deploymentContext) throws LoaderException {
+ return loaderRegistry.load(null, url, ComponentType.class, deploymentContext);
+ }
+
+ private String getBaseName(String scriptName) {
+ String baseName = scriptName;
+ int lastDot = baseName.lastIndexOf('.');
+ if (lastDot != -1) {
+ baseName = baseName.substring(0, lastDot);
+ }
+ return baseName;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponentTypeLoader.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementation.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementation.java (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementation.java Fri Aug 11 15:56:46 2006
@@ -1,57 +1,57 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.javascript;
-
-import org.apache.tuscany.container.javascript.rhino.RhinoScript;
-import org.apache.tuscany.spi.model.AtomicImplementation;
-import org.apache.tuscany.spi.model.ComponentType;
-
-/**
- * Model object for a JavaScript implementation.
- */
-public class JavaScriptImplementation extends AtomicImplementation<ComponentType> {
-
- private RhinoScript rhinoScript;
-
- private ClassLoader cl;
-
- private ComponentType componentType;
-
- public ComponentType getComponentType() {
- return componentType;
- }
-
- public void setComponentType(ComponentType componentType) {
- this.componentType = componentType;
- }
-
- public ClassLoader getClassLoader() {
- return cl;
- }
-
- public void setClassLoader(ClassLoader cl) {
- this.cl = cl;
- }
-
- public RhinoScript getRhinoScript() {
- return rhinoScript;
- }
-
- public void setRhinoScript(RhinoScript rhinoScript) {
- this.rhinoScript = rhinoScript;
- }
-}
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.javascript;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+import org.apache.tuscany.spi.model.AtomicImplementation;
+import org.apache.tuscany.spi.model.ComponentType;
+
+/**
+ * Model object for a JavaScript implementation.
+ */
+public class JavaScriptImplementation extends AtomicImplementation<ComponentType> {
+
+ private RhinoScript rhinoScript;
+
+ private ClassLoader cl;
+
+ private ComponentType componentType;
+
+ public ComponentType getComponentType() {
+ return componentType;
+ }
+
+ public void setComponentType(ComponentType componentType) {
+ this.componentType = componentType;
+ }
+
+ public ClassLoader getClassLoader() {
+ return cl;
+ }
+
+ public void setClassLoader(ClassLoader cl) {
+ this.cl = cl;
+ }
+
+ public RhinoScript getRhinoScript() {
+ return rhinoScript;
+ }
+
+ public void setRhinoScript(RhinoScript rhinoScript) {
+ this.rhinoScript = rhinoScript;
+ }
+}
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementation.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoader.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoader.java (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoader.java Fri Aug 11 15:56:46 2006
@@ -1,109 +1,109 @@
-/*
- *
- * Copyright 2006 The Apache Software Foundation or its licensors as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.container.javascript;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.container.javascript.rhino.RhinoScript;
-import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.apache.tuscany.spi.extension.LoaderExtension;
-import org.apache.tuscany.spi.loader.LoaderException;
-import org.apache.tuscany.spi.loader.LoaderRegistry;
-import org.apache.tuscany.spi.loader.LoaderUtil;
-import org.apache.tuscany.spi.loader.MissingResourceException;
-import org.osoa.sca.annotations.Constructor;
-
-/**
- * Loader for handling JavaScript <js:implementation.js> elements.
- */
-public class JavaScriptImplementationLoader extends LoaderExtension<JavaScriptImplementation> {
- private static final QName IMPLEMENTATION_JAVASCRIPT = new QName("http://tuscany.apache.org/xmlns/js/1.0", "implementation.js");
-
- @Constructor({"registry"})
- public JavaScriptImplementationLoader(@Autowire LoaderRegistry registry) {
- super(registry);
- }
-
- public QName getXMLType() {
- return IMPLEMENTATION_JAVASCRIPT;
- }
-
- public JavaScriptImplementation load(CompositeComponent parent, XMLStreamReader reader, DeploymentContext deploymentContext)
- throws XMLStreamException, LoaderException {
-
- String script = reader.getAttributeValue(null, "script");
- if (script == null) {
- throw new MissingResourceException("No script supplied");
- }
-
- ClassLoader cl = deploymentContext.getClassLoader();
- String source = loadSource(cl, script);
-
- LoaderUtil.skipToEndElement(reader);
-
- JavaScriptImplementation implementation = new JavaScriptImplementation();
- RhinoScript rhinoScript = new RhinoScript(script, source, null, cl);
- implementation.setRhinoScript(rhinoScript);
- implementation.setClassLoader(cl);
- registry.loadComponentType(parent, implementation, deploymentContext);
- return implementation;
- }
-
- protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
- URL url = cl.getResource(resource);
- if (url == null) {
- throw new MissingResourceException(resource);
- }
- InputStream is;
- try {
- is = url.openStream();
- } catch (IOException e) {
- MissingResourceException mre = new MissingResourceException(resource, e);
- mre.setIdentifier(resource);
- throw mre;
- }
- try {
- Reader reader = new InputStreamReader(is, "UTF-8");
- char[] buffer = new char[1024];
- StringBuilder source = new StringBuilder();
- int count;
- while ((count = reader.read(buffer)) > 0) {
- source.append(buffer, 0, count);
- }
- return source.toString();
- } catch (IOException e) {
- LoaderException le = new LoaderException(e);
- le.setIdentifier(resource);
- throw le;
- } finally {
- try {
- is.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
-}
+/*
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.javascript;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScript;
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.LoaderExtension;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.LoaderUtil;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.osoa.sca.annotations.Constructor;
+
+/**
+ * Loader for handling JavaScript <js:implementation.js> elements.
+ */
+public class JavaScriptImplementationLoader extends LoaderExtension<JavaScriptImplementation> {
+ private static final QName IMPLEMENTATION_JAVASCRIPT = new QName("http://tuscany.apache.org/xmlns/js/1.0", "implementation.js");
+
+ @Constructor({"registry"})
+ public JavaScriptImplementationLoader(@Autowire LoaderRegistry registry) {
+ super(registry);
+ }
+
+ public QName getXMLType() {
+ return IMPLEMENTATION_JAVASCRIPT;
+ }
+
+ public JavaScriptImplementation load(CompositeComponent parent, XMLStreamReader reader, DeploymentContext deploymentContext)
+ throws XMLStreamException, LoaderException {
+
+ String script = reader.getAttributeValue(null, "script");
+ if (script == null) {
+ throw new MissingResourceException("No script supplied");
+ }
+
+ ClassLoader cl = deploymentContext.getClassLoader();
+ String source = loadSource(cl, script);
+
+ LoaderUtil.skipToEndElement(reader);
+
+ JavaScriptImplementation implementation = new JavaScriptImplementation();
+ RhinoScript rhinoScript = new RhinoScript(script, source, null, cl);
+ implementation.setRhinoScript(rhinoScript);
+ implementation.setClassLoader(cl);
+ registry.loadComponentType(parent, implementation, deploymentContext);
+ return implementation;
+ }
+
+ protected String loadSource(ClassLoader cl, String resource) throws LoaderException {
+ URL url = cl.getResource(resource);
+ if (url == null) {
+ throw new MissingResourceException(resource);
+ }
+ InputStream is;
+ try {
+ is = url.openStream();
+ } catch (IOException e) {
+ MissingResourceException mre = new MissingResourceException(resource, e);
+ mre.setIdentifier(resource);
+ throw mre;
+ }
+ try {
+ Reader reader = new InputStreamReader(is, "UTF-8");
+ char[] buffer = new char[1024];
+ StringBuilder source = new StringBuilder();
+ int count;
+ while ((count = reader.read(buffer)) > 0) {
+ source.append(buffer, 0, count);
+ }
+ return source.toString();
+ } catch (IOException e) {
+ LoaderException le = new LoaderException(e);
+ le.setIdentifier(resource);
+ throw le;
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+}
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptImplementationLoader.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java Fri Aug 11 15:56:46 2006
@@ -1,81 +1,81 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.javascript;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.apache.tuscany.container.javascript.rhino.RhinoScriptInstance;
-import org.apache.tuscany.spi.wire.InvocationRuntimeException;
-import org.apache.tuscany.spi.wire.Message;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-
-/**
- * Dispatches to a Groovy implementation instance
- *
- * @version $$Rev: 424672 $$ $$Date: 2006-07-23 05:46:01 +0100 (Sun, 23 Jul 2006) $$
- */
-public class JavaScriptInvoker implements TargetInvoker, Cloneable {
-
- private JavaScriptComponent context;
-
- private String methodName;
-
- private boolean cacheable;
-
- public JavaScriptInvoker(String methodName, JavaScriptComponent context) {
- this.context = context;
- this.methodName = methodName;
- }
-
- public boolean isCacheable() {
- return cacheable;
- }
-
- public void setCacheable(boolean cacheable) {
- this.cacheable = cacheable;
- }
-
- public boolean isOptimizable() {
- return false;
- }
-
- /**
- * Dispatches to the the target.
- */
- public Object invokeTarget(final Object payload) throws InvocationTargetException {
- RhinoScriptInstance target = context.getTargetInstance();
- Object[] args = (Object[]) payload;
- return target.invokeFunction(methodName, args);
- }
-
- public Message invoke(Message msg) throws InvocationRuntimeException {
- 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 JavaScriptInvoker clone() throws CloneNotSupportedException {
- return (JavaScriptInvoker) super.clone();
- }
-
-}
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.javascript;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.container.javascript.rhino.RhinoScriptInstance;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * Dispatches to a Groovy implementation instance
+ *
+ * @version $$Rev: 424672 $$ $$Date: 2006-07-23 05:46:01 +0100 (Sun, 23 Jul 2006) $$
+ */
+public class JavaScriptInvoker implements TargetInvoker, Cloneable {
+
+ private JavaScriptComponent context;
+
+ private String methodName;
+
+ private boolean cacheable;
+
+ public JavaScriptInvoker(String methodName, JavaScriptComponent context) {
+ this.context = context;
+ this.methodName = methodName;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+
+ public void setCacheable(boolean cacheable) {
+ this.cacheable = cacheable;
+ }
+
+ public boolean isOptimizable() {
+ return false;
+ }
+
+ /**
+ * Dispatches to the the target.
+ */
+ public Object invokeTarget(final Object payload) throws InvocationTargetException {
+ RhinoScriptInstance target = context.getTargetInstance();
+ Object[] args = (Object[]) payload;
+ return target.invokeFunction(methodName, args);
+ }
+
+ public Message invoke(Message msg) throws InvocationRuntimeException {
+ 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 JavaScriptInvoker clone() throws CloneNotSupportedException {
+ return (JavaScriptInvoker) super.clone();
+ }
+
+}
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptInvoker.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvoker.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvoker.java (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvoker.java Fri Aug 11 15:56:46 2006
@@ -1,79 +1,79 @@
-package org.apache.tuscany.container.javascript.rhino;
-
-import org.apache.xmlbeans.XmlObject;
-import org.mozilla.javascript.Context;
-import org.mozilla.javascript.Function;
-import org.mozilla.javascript.Scriptable;
-import org.mozilla.javascript.ScriptableObject;
-import org.mozilla.javascript.Wrapper;
-import org.mozilla.javascript.xml.XMLObject;
-
-/**
- * An invoker for a specific function in a JavaScript script
- */
-public class RhinoFunctionInvoker {
-
- private Scriptable instanceScope;
-
- private Function function;
-
- private Class responseClass;
-
- public RhinoFunctionInvoker(Scriptable instanceScope, Function function, Class responseClass) {
- this.instanceScope = instanceScope;
- this.function = function;
- this.responseClass = responseClass;
- }
-
- public Object invoke(Object[] args) {
- Context cx = Context.enter();
- try {
-
- Object[] jsArgs = toJavaScript(args, instanceScope, cx);
- Object jsResponse = function.call(cx, instanceScope, instanceScope, jsArgs);
- Object response = fromJavaScript(jsResponse);
- return response;
-
- } finally {
- Context.exit();
- }
- }
-
- protected Object[] toJavaScript(Object[] arg, Scriptable scope, Context cx) {
- Object[] jsArgs;
- if (arg == null) {
- jsArgs = new Object[0];
- } else if (arg.length == 1 && arg[0] instanceof XmlObject) {
- Object jsXML = cx.getWrapFactory().wrap(cx, scope, (XmlObject) arg[0], XmlObject.class);
- jsArgs = new Object[] { cx.newObject(scope, "XML", new Object[] { jsXML }) };
- } else {
- jsArgs = new Object[arg.length];
- for (int i = 0; i < jsArgs.length; i++) {
- jsArgs[i] = Context.toObject(arg[i], scope);
- }
- }
- return jsArgs;
- }
-
- protected Object fromJavaScript(Object o) {
- Object response;
- if (Context.getUndefinedValue().equals(o)) {
- response = null;
- } else if (o instanceof XMLObject) {
- // TODO: E4X Bug? Shouldn't need this copy, but without it the outer element gets lost???
- Scriptable jsXML = (Scriptable) ScriptableObject.callMethod((Scriptable) o, "copy", new Object[0]);
- Wrapper wrapper = (Wrapper) ScriptableObject.callMethod(jsXML, "getXmlObject", new Object[0]);
- response = wrapper.unwrap();
- } else if (o instanceof Wrapper) {
- response = ((Wrapper) o).unwrap();
- } else {
- if (responseClass != null) {
- response = Context.jsToJava(o, responseClass);
- } else {
- response = Context.jsToJava(o, String.class);
- }
- }
- return response;
- }
-
-}
+package org.apache.tuscany.container.javascript.rhino;
+
+import org.apache.xmlbeans.XmlObject;
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.Function;
+import org.mozilla.javascript.Scriptable;
+import org.mozilla.javascript.ScriptableObject;
+import org.mozilla.javascript.Wrapper;
+import org.mozilla.javascript.xml.XMLObject;
+
+/**
+ * An invoker for a specific function in a JavaScript script
+ */
+public class RhinoFunctionInvoker {
+
+ private Scriptable instanceScope;
+
+ private Function function;
+
+ private Class responseClass;
+
+ public RhinoFunctionInvoker(Scriptable instanceScope, Function function, Class responseClass) {
+ this.instanceScope = instanceScope;
+ this.function = function;
+ this.responseClass = responseClass;
+ }
+
+ public Object invoke(Object[] args) {
+ Context cx = Context.enter();
+ try {
+
+ Object[] jsArgs = toJavaScript(args, instanceScope, cx);
+ Object jsResponse = function.call(cx, instanceScope, instanceScope, jsArgs);
+ Object response = fromJavaScript(jsResponse);
+ return response;
+
+ } finally {
+ Context.exit();
+ }
+ }
+
+ protected Object[] toJavaScript(Object[] arg, Scriptable scope, Context cx) {
+ Object[] jsArgs;
+ if (arg == null) {
+ jsArgs = new Object[0];
+ } else if (arg.length == 1 && arg[0] instanceof XmlObject) {
+ Object jsXML = cx.getWrapFactory().wrap(cx, scope, (XmlObject) arg[0], XmlObject.class);
+ jsArgs = new Object[] { cx.newObject(scope, "XML", new Object[] { jsXML }) };
+ } else {
+ jsArgs = new Object[arg.length];
+ for (int i = 0; i < jsArgs.length; i++) {
+ jsArgs[i] = Context.toObject(arg[i], scope);
+ }
+ }
+ return jsArgs;
+ }
+
+ protected Object fromJavaScript(Object o) {
+ Object response;
+ if (Context.getUndefinedValue().equals(o)) {
+ response = null;
+ } else if (o instanceof XMLObject) {
+ // TODO: E4X Bug? Shouldn't need this copy, but without it the outer element gets lost???
+ Scriptable jsXML = (Scriptable) ScriptableObject.callMethod((Scriptable) o, "copy", new Object[0]);
+ Wrapper wrapper = (Wrapper) ScriptableObject.callMethod(jsXML, "getXmlObject", new Object[0]);
+ response = wrapper.unwrap();
+ } else if (o instanceof Wrapper) {
+ response = ((Wrapper) o).unwrap();
+ } else {
+ if (responseClass != null) {
+ response = Context.jsToJava(o, responseClass);
+ } else {
+ response = Context.jsToJava(o, String.class);
+ }
+ }
+ return response;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoFunctionInvoker.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScript.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScript.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScript.java (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScript.java Fri Aug 11 15:56:46 2006
@@ -1,193 +1,193 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.javascript.rhino;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.mozilla.javascript.Context;
-import org.mozilla.javascript.ContextFactory;
-import org.mozilla.javascript.ImporterTopLevel;
-import org.mozilla.javascript.Script;
-import org.mozilla.javascript.Scriptable;
-
-/**
- * A RhinoScript represents a compiled JavaScript script
- */
-public class RhinoScript {
-
- protected String scriptName;
-
- protected String script;
-
- protected Scriptable scriptScope;
-
- protected Map<String, Class> responseClasses;
-
- /*
- * 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
- */
- 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 RhinoScript.
- *
- * @param scriptName
- * the name of the script. Can be anything, only used in messages to identify the script
- * @param script
- * the complete script
- */
- public RhinoScript(String scriptName, String script) {
- this(scriptName, script, (Map) null, null);
- }
-
- /**
- * Create a new RhinoInvoker.
- *
- * @param scriptName
- * the name of the script. Can be anything, only used in messages to identify the script
- * @param script
- * the complete script
- * @param context
- * name-value pairs that are added in to the scope where the script is compiled. May be null. The value objects are made available to
- * the script by using a variable with the name.
- * @param classLoader
- * the ClassLoader Rhino should use to locate any user Java classes used in the script
- */
- public RhinoScript(String scriptName, String script, Map context, ClassLoader cl) {
- this.scriptName = scriptName;
- this.script = script;
- this.responseClasses = new HashMap<String, Class>();
- initScriptScope(scriptName, script, context, cl);
- }
-
- /**
- * Create a new invokeable instance of the script
- *
- * @return a RhinoScriptInstance
- */
- public RhinoScriptInstance createRhinoScriptInstance() {
- return createRhinoScriptInstance(null);
- }
-
- /**
- * Create a new invokeable instance of the script
- *
- * @param context
- * objects to add to scope of the script instance
- * @return a RhinoScriptInstance
- */
- public RhinoScriptInstance createRhinoScriptInstance(Map<String, Object> context) {
- Scriptable instanceScope = createInstanceScope(context);
- RhinoScriptInstance rsi = new RhinoScriptInstance(scriptScope, instanceScope, context, responseClasses);
- return rsi;
- }
-
- /**
- * Initialize the Rhino Scope for this script instance
- */
- protected Scriptable createInstanceScope(Map<String, Object> context) {
- Context cx = Context.enter();
- try {
-
- Scriptable instanceScope = cx.newObject(scriptScope);
- instanceScope.setPrototype(scriptScope);
- instanceScope.setParentScope(null);
-
- addContexts(instanceScope, context);
-
- return instanceScope;
-
- } finally {
- Context.exit();
- }
- }
-
- /**
- * Create a Rhino scope and compile the script into it
- */
- protected void initScriptScope(String fileName, String scriptCode, Map context, ClassLoader cl) {
- Context cx = Context.enter();
- try {
- if (cl != null) {
- // TODO: broken with the way the tuscany launcher now uses class loaders
- // cx.setApplicationClassLoader(cl);
- }
- this.scriptScope = new ImporterTopLevel(cx, true);
- Script compiledScript = cx.compileString(scriptCode, fileName, 1, null);
- compiledScript.exec(cx, scriptScope);
- addContexts(scriptScope, context);
-
- } finally {
- Context.exit();
- }
- }
-
- /**
- * 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));
- }
- }
- }
- }
-
- public String getScript() {
- return script;
- }
-
- public String getScriptName() {
- return scriptName;
- }
-
- public Scriptable getScriptScope() {
- return scriptScope;
- }
-
- public Map<String, Class> getResponseClasses() {
- return responseClasses;
- }
-
- /**
- * Set the Java type of a response value. JavaScript is dynamically typed so Rhino cannot always work out what the intended Java type of a
- * response should be, for example should the statement "return 42" be a Java int, or Integer or Double etc. When Rhino can't determine the type
- * it will default to returning a String, using this method enables overriding the Rhino default to use a specific Java type.
- */
- public void setResponseClass(String functionName, Class responseClasses) {
- this.responseClasses.put(functionName, responseClasses);
- }
-
-}
\ No newline at end of file
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.javascript.rhino;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ContextFactory;
+import org.mozilla.javascript.ImporterTopLevel;
+import org.mozilla.javascript.Script;
+import org.mozilla.javascript.Scriptable;
+
+/**
+ * A RhinoScript represents a compiled JavaScript script
+ */
+public class RhinoScript {
+
+ protected String scriptName;
+
+ protected String script;
+
+ protected Scriptable scriptScope;
+
+ protected Map<String, Class> responseClasses;
+
+ /*
+ * 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
+ */
+ 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 RhinoScript.
+ *
+ * @param scriptName
+ * the name of the script. Can be anything, only used in messages to identify the script
+ * @param script
+ * the complete script
+ */
+ public RhinoScript(String scriptName, String script) {
+ this(scriptName, script, (Map) null, null);
+ }
+
+ /**
+ * Create a new RhinoInvoker.
+ *
+ * @param scriptName
+ * the name of the script. Can be anything, only used in messages to identify the script
+ * @param script
+ * the complete script
+ * @param context
+ * name-value pairs that are added in to the scope where the script is compiled. May be null. The value objects are made available to
+ * the script by using a variable with the name.
+ * @param classLoader
+ * the ClassLoader Rhino should use to locate any user Java classes used in the script
+ */
+ public RhinoScript(String scriptName, String script, Map context, ClassLoader cl) {
+ this.scriptName = scriptName;
+ this.script = script;
+ this.responseClasses = new HashMap<String, Class>();
+ initScriptScope(scriptName, script, context, cl);
+ }
+
+ /**
+ * Create a new invokeable instance of the script
+ *
+ * @return a RhinoScriptInstance
+ */
+ public RhinoScriptInstance createRhinoScriptInstance() {
+ return createRhinoScriptInstance(null);
+ }
+
+ /**
+ * Create a new invokeable instance of the script
+ *
+ * @param context
+ * objects to add to scope of the script instance
+ * @return a RhinoScriptInstance
+ */
+ public RhinoScriptInstance createRhinoScriptInstance(Map<String, Object> context) {
+ Scriptable instanceScope = createInstanceScope(context);
+ RhinoScriptInstance rsi = new RhinoScriptInstance(scriptScope, instanceScope, context, responseClasses);
+ return rsi;
+ }
+
+ /**
+ * Initialize the Rhino Scope for this script instance
+ */
+ protected Scriptable createInstanceScope(Map<String, Object> context) {
+ Context cx = Context.enter();
+ try {
+
+ Scriptable instanceScope = cx.newObject(scriptScope);
+ instanceScope.setPrototype(scriptScope);
+ instanceScope.setParentScope(null);
+
+ addContexts(instanceScope, context);
+
+ return instanceScope;
+
+ } finally {
+ Context.exit();
+ }
+ }
+
+ /**
+ * Create a Rhino scope and compile the script into it
+ */
+ protected void initScriptScope(String fileName, String scriptCode, Map context, ClassLoader cl) {
+ Context cx = Context.enter();
+ try {
+ if (cl != null) {
+ // TODO: broken with the way the tuscany launcher now uses class loaders
+ // cx.setApplicationClassLoader(cl);
+ }
+ this.scriptScope = new ImporterTopLevel(cx, true);
+ Script compiledScript = cx.compileString(scriptCode, fileName, 1, null);
+ compiledScript.exec(cx, scriptScope);
+ addContexts(scriptScope, context);
+
+ } finally {
+ Context.exit();
+ }
+ }
+
+ /**
+ * 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));
+ }
+ }
+ }
+ }
+
+ public String getScript() {
+ return script;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public Scriptable getScriptScope() {
+ return scriptScope;
+ }
+
+ public Map<String, Class> getResponseClasses() {
+ return responseClasses;
+ }
+
+ /**
+ * Set the Java type of a response value. JavaScript is dynamically typed so Rhino cannot always work out what the intended Java type of a
+ * response should be, for example should the statement "return 42" be a Java int, or Integer or Double etc. When Rhino can't determine the type
+ * it will default to returning a String, using this method enables overriding the Rhino default to use a specific Java type.
+ */
+ public void setResponseClass(String functionName, Class responseClasses) {
+ this.responseClasses.put(functionName, responseClasses);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScript.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstance.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstance.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstance.java (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstance.java Fri Aug 11 15:56:46 2006
@@ -1,82 +1,82 @@
-package org.apache.tuscany.container.javascript.rhino;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.mozilla.javascript.Context;
-import org.mozilla.javascript.Function;
-import org.mozilla.javascript.Scriptable;
-import org.mozilla.javascript.UniqueTag;
-
-/**
- * An invokeable instance of a JavaScript script.
- */
-public class RhinoScriptInstance {
-
- private Scriptable scriptScope;
-
- private Scriptable instanceScope;
-
- private Map<String, Class> responseClasses;
-
- public RhinoScriptInstance(Scriptable scriptScope, Scriptable instanceScope, Map<String, Object> context, Map<String, Class> responseClasses) {
- this.scriptScope = scriptScope;
- this.instanceScope = instanceScope;
- this.responseClasses = responseClasses;
- if (this.responseClasses == null) {
- this.responseClasses = new HashMap<String, Class>();
- }
- addContexts(instanceScope, context);
- }
-
- public Object invokeFunction(String functionName, Object[] args) {
- RhinoFunctionInvoker invoker = createRhinoFunctionInvoker(functionName);
- return invoker.invoke(args);
- }
-
- public RhinoFunctionInvoker createRhinoFunctionInvoker(String functionName) {
- Function function = getFunction(functionName);
- Class responseClass = responseClasses.get(functionName);
- RhinoFunctionInvoker invoker = new RhinoFunctionInvoker(instanceScope, function, responseClass);
- return invoker;
- }
-
- /**
- * 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) {
- Context.enter();
- try {
- 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));
- }
- }
- } finally {
- Context.exit();
- }
- }
- }
-
- /**
- * Get the Rhino Function object for the named script function
- */
- protected Function getFunction(String functionName) {
-
- Object handleObj = scriptScope.get(functionName, instanceScope);
- if (UniqueTag.NOT_FOUND.equals(handleObj)) {
- // Bit of a hack so E4X scripts don't need to define a function for every operation
- handleObj = scriptScope.get("process", instanceScope);
- }
- if (!(handleObj instanceof Function)) {
- throw new RuntimeException("script function '" + functionName + "' is undefined or not a function");
- }
-
- return (Function) handleObj;
- }
-
-}
+package org.apache.tuscany.container.javascript.rhino;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.Function;
+import org.mozilla.javascript.Scriptable;
+import org.mozilla.javascript.UniqueTag;
+
+/**
+ * An invokeable instance of a JavaScript script.
+ */
+public class RhinoScriptInstance {
+
+ private Scriptable scriptScope;
+
+ private Scriptable instanceScope;
+
+ private Map<String, Class> responseClasses;
+
+ public RhinoScriptInstance(Scriptable scriptScope, Scriptable instanceScope, Map<String, Object> context, Map<String, Class> responseClasses) {
+ this.scriptScope = scriptScope;
+ this.instanceScope = instanceScope;
+ this.responseClasses = responseClasses;
+ if (this.responseClasses == null) {
+ this.responseClasses = new HashMap<String, Class>();
+ }
+ addContexts(instanceScope, context);
+ }
+
+ public Object invokeFunction(String functionName, Object[] args) {
+ RhinoFunctionInvoker invoker = createRhinoFunctionInvoker(functionName);
+ return invoker.invoke(args);
+ }
+
+ public RhinoFunctionInvoker createRhinoFunctionInvoker(String functionName) {
+ Function function = getFunction(functionName);
+ Class responseClass = responseClasses.get(functionName);
+ RhinoFunctionInvoker invoker = new RhinoFunctionInvoker(instanceScope, function, responseClass);
+ return invoker;
+ }
+
+ /**
+ * 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) {
+ Context.enter();
+ try {
+ 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));
+ }
+ }
+ } finally {
+ Context.exit();
+ }
+ }
+ }
+
+ /**
+ * Get the Rhino Function object for the named script function
+ */
+ protected Function getFunction(String functionName) {
+
+ Object handleObj = scriptScope.get(functionName, instanceScope);
+ if (UniqueTag.NOT_FOUND.equals(handleObj)) {
+ // Bit of a hack so E4X scripts don't need to define a function for every operation
+ handleObj = scriptScope.get("process", instanceScope);
+ }
+ if (!(handleObj instanceof Function)) {
+ throw new RuntimeException("script function '" + functionName + "' is undefined or not a function");
+ }
+
+ return (Function) handleObj;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/rhino/RhinoScriptInstance.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/main/resources/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/main/resources/META-INF/sca/default.scdl?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/main/resources/META-INF/sca/default.scdl (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/main/resources/META-INF/sca/default.scdl Fri Aug 11 15:56:46 2006
@@ -1,37 +1,37 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-<!--
- JavaScript configuration for the launcher environment.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
-
- name="org.apache.tuscany.launcher.JavaScriptImplementation">
-
- <component name="javascript.implementationLoader">
- <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptImplementationLoader"/>
- </component>
-
- <component name="javascript.componentTypeLoader">
- <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptComponentTypeLoader"/>
- </component>
-
- <component name="javascript.componentBuilder">
- <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptComponentBuilder"/>
- </component>
-
-</composite>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.launcher.JavaScriptImplementation">
+
+ <component name="javascript.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptImplementationLoader"/>
+ </component>
+
+ <component name="javascript.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptComponentTypeLoader"/>
+ </component>
+
+ <component name="javascript.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.javascript.JavaScriptComponentBuilder"/>
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/main/resources/META-INF/sca/default.scdl
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/main/resources/META-INF/sca/rmi_extension.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/main/resources/META-INF/sca/rmi_extension.scdl?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/main/resources/META-INF/sca/rmi_extension.scdl (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/main/resources/META-INF/sca/rmi_extension.scdl Fri Aug 11 15:56:46 2006
@@ -1,37 +1,37 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-<!--
- Default system configuration for the launcher environment.
-
- $Rev: 423526 $ $Date: 2006-07-19 22:31:58 +0530 (Wed, 19 Jul 2006) $
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
- name="org.apache.tuscany.binding.rmi">
-
- <component name="binding.rmi.bindingLoader">
- <system:implementation.system class="org.apache.tuscany.binding.rmi.RMIBindingLoader"/>
- </component>
-
- <component name="binding.rmi.bindingBuilder">
- <system:implementation.system class="org.apache.tuscany.binding.rmi.RMIBindingBuilder"/>
- </component>
-
- <component name="binding.rmi.bindingInvoker">
- <system:implementation.system class="org.apache.tuscany.binding.rmi.RMIInvoker"/>
- </component>
-</composite>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+<!--
+ Default system configuration for the launcher environment.
+
+ $Rev: 423526 $ $Date: 2006-07-19 22:31:58 +0530 (Wed, 19 Jul 2006) $
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.binding.rmi">
+
+ <component name="binding.rmi.bindingLoader">
+ <system:implementation.system class="org.apache.tuscany.binding.rmi.RMIBindingLoader"/>
+ </component>
+
+ <component name="binding.rmi.bindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.binding.rmi.RMIBindingBuilder"/>
+ </component>
+
+ <component name="binding.rmi.bindingInvoker">
+ <system:implementation.system class="org.apache.tuscany.binding.rmi.RMIInvoker"/>
+ </component>
+</composite>
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/main/resources/META-INF/sca/rmi_extension.scdl
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/sca/containers/container.javascript/src/test/java/helloworld/HelloWorldService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.javascript/src/test/java/helloworld/HelloWorldService.java?rev=430912&r1=430911&r2=430912&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.javascript/src/test/java/helloworld/HelloWorldService.java (original)
+++ incubator/tuscany/java/sca/containers/container.javascript/src/test/java/helloworld/HelloWorldService.java Fri Aug 11 15:56:46 2006
@@ -1,7 +1,7 @@
-package helloworld;
-
-public interface HelloWorldService {
-
- String sayHello(String s);
-
-}
+package helloworld;
+
+public interface HelloWorldService {
+
+ String sayHello(String s);
+
+}
Propchange: incubator/tuscany/java/sca/containers/container.javascript/src/test/java/helloworld/HelloWorldService.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org