Examples of RhinoScript


Examples of org.apache.tuscany.container.javascript.rhino.RhinoScript

        String source = loadSource(cl, script);

        LoaderUtil.skipToEndElement(reader);

        JavaScriptImplementation implementation = new JavaScriptImplementation();
        RhinoScript rhinoScript = new RhinoScript(script, source, null, cl);
        implementation.setRhinoScript(rhinoScript);
        registry.loadComponentType(parent, implementation, deploymentContext);
        return implementation;
    }
View Full Code Here

Examples of org.apache.tuscany.container.javascript.rhino.RhinoScript

                                                          JavaScriptImplementation implementation,
                                                          DeploymentContext deploymentContext) throws
                                                                                               MissingResourceException,
                                                                                               InvalidServiceContractException {

        RhinoScript rhinoScript = implementation.getRhinoScript();
        RhinoSCAConfig scaConfig = rhinoScript.getSCAConfig();
        if (!scaConfig.hasSCAConfig()) {
            throw new IllegalArgumentException(
                "must use either .componentType side file or JS SCA varriable definition");
        }

        // FIXME this should be a system service, not instantiated here
        JavaScriptComponentType componentType = new JavaScriptIntrospector(null, processorRegistry)
            .introspectScript(scaConfig, rhinoScript.getClassLoader());

        return componentType;
    }
View Full Code Here

Examples of org.apache.tuscany.container.javascript.rhino.RhinoScript

        Map<String, Object> properties = new HashMap<String, Object>();
        for (PropertyValue propertyValue : propertyValues) {
            properties.put(propertyValue.getName(), propertyValue.getValueFactory().getInstance());
        }

        RhinoScript rhinoScript = implementation.getRhinoScript();

        // TODO: have ComponentBuilderExtension pass ScopeContainer in on build method?
        ScopeContainer scopeContainer;
        Scope scope = componentType.getLifecycleScope();
        if (Scope.MODULE == scope) {
View Full Code Here

Examples of org.apache.tuscany.container.javascript.rhino.RhinoScript

            }
            // System.out.println(" **** - " + sb.toString());

            sb.append(getXmlObjectFunction);

            RhinoScript rhinoScript = implementation.getRhinoScript();
            sb.append(rhinoScript.getScript());
            rhinoScript.setScript(sb.toString());
            rhinoScript.initScriptScope(rhinoScript.getScriptName(), sb.toString(), null, rhinoScript.getClassLoader());
            implementation.setRhinoScript(rhinoScript);

        } catch (Exception e) {
            throw new BuilderConfigException(e);
        }
View Full Code Here

Examples of org.apache.tuscany.container.javascript.rhino.RhinoScript

//        scope.stop();
    }

    protected void setUp() throws Exception {
        super.setUp();
        rhinoScript = new RhinoScript("test", SCRIPT);
    }
View Full Code Here

Examples of org.apache.tuscany.container.javascript.rhino.RhinoScript

        scope.stop();*/
    }

    protected void setUp() throws Exception {
        super.setUp();
        implClass = new RhinoScript("test", SCRIPT);
    }
View Full Code Here

Examples of org.apache.tuscany.container.javascript.rhino.RhinoScript

        scope.stop();
    }

    protected void setUp() throws Exception {
        super.setUp();
        implClass1 = new RhinoScript("script1", SCRIPT);
        implClass2 = new RhinoScript("script2", SCRIPT2);
    }
View Full Code Here

Examples of org.apache.tuscany.container.javascript.rhino.RhinoScript

        public void cachingDefinition(String namespace, URL location) {
        }
    };

    public void testJavaInterface() throws MissingResourceException, InvalidServiceContractException {
        RhinoScript rs =
            new RhinoScript("javaInterfaceTest", "SCA = { javaInterface : 'helloworld.HelloWorldService',};",
                null, getClass().getClassLoader());
        RhinoSCAConfig scaConfig = new RhinoSCAConfig(rs.getScriptScope());
        JavaScriptIntrospector introspector =
            new JavaScriptIntrospector(null, new JavaInterfaceProcessorRegistryImpl());
        ComponentType comonentType = introspector.introspectScript(scaConfig, rs.getClassLoader());
        assertNotNull(comonentType);
        Map services = comonentType.getServices();
        assertEquals(1, services.size());
        ServiceDefinition serviceDefinition = (ServiceDefinition) services.values().iterator().next();
        ServiceContract serviceContract = serviceDefinition.getServiceContract();
View Full Code Here

Examples of org.apache.tuscany.container.javascript.rhino.RhinoScript

//        assertEquals(new QName("http://helloworld", "HelloWorld"), wsdlServiceContract.getPortType().getQName());
    }

    public void testWSDLPortType() throws WSDLException, IOException, MissingResourceException,
                                          InvalidServiceContractException {
        RhinoScript rs = new RhinoScript("wsdlPortType",
            "SCA = { wsdlPortType : 'HelloWorld', wsdlNamespace : 'http://helloworld',};", null,
            getClass().getClassLoader());
        RhinoSCAConfig scaConfig = new RhinoSCAConfig(rs.getScriptScope());

        WSDLDefinitionRegistryImpl wsdlReg = new WSDLDefinitionRegistryImpl();
        wsdlReg.setSchemaRegistry(new XMLSchemaRegistryImpl());
        wsdlReg.setMonitor(NULL_MONITOR);
        URL wsdlURL =
            getClass().getClassLoader().getResource("org/apache/tuscany/container/javascript/rhino/helloworld.wsdl");
        wsdlReg.loadDefinition("http://helloworld", wsdlURL);

        JavaScriptIntrospector introspector =
            new JavaScriptIntrospector(wsdlReg, new JavaInterfaceProcessorRegistryImpl());
        ComponentType comonentType = introspector.introspectScript(scaConfig, rs.getClassLoader());
        assertNotNull(comonentType);
        Map services = comonentType.getServices();
        assertEquals(1, services.size());
        ServiceDefinition serviceDefinition = (ServiceDefinition) services.values().iterator().next();
        ServiceContract serviceContract = serviceDefinition.getServiceContract();
View Full Code Here

Examples of org.apache.tuscany.container.rhino.rhino.RhinoScript

        super.setUp();
        this.script = readResource(scriptName);
    }

    public void testSimpleInvocation() {
        RhinoScript ri = new RhinoScript(scriptName, script);
        Object x = ri.invoke("echo", new Object[] { "petra" }, null);
        assertEquals("petra", x);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.