Package org.apache.tuscany.sca.implementation.node

Examples of org.apache.tuscany.sca.implementation.node.NodeImplementation


            binding.setURI("http://localhost:" + (8100 + i));
            nodeService.getBindings().add(binding);
            node.getServices().add(nodeService);

            // Assign a deployable to the node
            NodeImplementation nodeImplementation = nodeFactory.createNodeImplementation();
            Composite deployable = workspace.getDeployables().get(i);
            nodeImplementation.setComposite(deployable);
            node.setImplementation(nodeImplementation);
        }
       
        // Print the model describing the nodes that we just built
        System.out.println("cloud.composite");
View Full Code Here


            // bindings that it configures
            Component nodeComponent = null;
            QName nodeCompositeName = null;
            for (Composite cloudComposite : cloudsComposite.getIncludes()) {
                for (Component nc : cloudComposite.getComponents()) {
                    NodeImplementation nodeImplementation = (NodeImplementation)nc.getImplementation();
                    if (nodeImplementation.getComposite().getName().equals(compositeName) &&
                        nodeImplementation.getComposite().getURI().equals(contributionURI)) {
                        nodeImplementation.setComposite(composite);
                        nodeComponent = nc;
                        nodeCompositeName = cloudComposite.getName();
                        break;
                    }
                }
View Full Code Here

        for (Component component: composite.getComponents()) {
            Implementation implementation = component.getImplementation();
            if (implementation instanceof NodeImplementation) {
               
                // Get the application composite assigned to the node
                NodeImplementation nodeImplementation = (NodeImplementation)implementation;
                Composite applicationComposite = nodeImplementation.getComposite();
               
                // Get the default bindings configured on the node
                List<Binding> defaultBindings = new ArrayList<Binding>();
                for (ComponentService componentService: component.getServices()) {
                    defaultBindings.addAll(componentService.getBindings());
View Full Code Here

                binding.setURI("http://localhost:" + (8100 + nodeID));
                nodeService.getBindings().add(binding);
                node.getServices().add(nodeService);

                // Assign a deployable to the node
                NodeImplementation nodeImplementation = nodeFactory.createNodeImplementation();
                nodeImplementation.setComposite(deployable);
                node.setImplementation(nodeImplementation);
               
                // Keep track of what contributions will be needed by the node
                nodeDependencies.put(node, contributionDependencies.get(contribution));
               
                nodeID++;
            }
        }
       
        // Print the model describing the nodes that we just built
        System.out.println("cloud.composite");
        System.out.println(print(cloudComposite));
       
        // Build the nodes, this will apply their default binding configuration to the
        // composites assigned to them
        nodeCompositeBuilder.build(cloudComposite);
       
        // Create a composite model for the domain
        Composite domainComposite = assemblyFactory.createComposite();
        domainComposite.setName(new QName("http://sample", "domain"));
       
        // Add all deployables to it, normally the domain administrator would select
        // the deployables to include
        domainComposite.getIncludes().addAll(workspace.getDeployables());
       
        // Build the domain composite and wire the components included in it
        domainCompositeBuilder.build(domainComposite);

        // Print out the resulting domain composite
        System.out.println("domain.composite");
        System.out.println(print(domainComposite));
       
        // Now start our SCA nodes
        List<SCANode> runtimeNodes = new ArrayList<SCANode>();
        NodeLauncher launcher = NodeLauncher.newInstance();
        for (Component node: cloudComposite.getComponents()) {
           
            // Create a composite containing the components that we want to run
            // on the node
            Composite runnable = assemblyFactory.createComposite();
            runnable.setName(new QName("http://sample", node.getName()));
            NodeImplementation nodeImplementation = (NodeImplementation)node.getImplementation();
            for (Component component: nodeImplementation.getComposite().getComponents()) {
                for (Component configured: domainComposite.getComponents()) {
                    if (configured.getName().equals(component.getName())) {
                        runnable.getComponents().add(configured);
                        break;
                    }
View Full Code Here

    }

    public NodeImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
       
        // Read an <implementation.node> element
        NodeImplementation implementation = implementationFactory.createNodeImplementation();
        implementation.setUnresolved(true);

        // Read the composite attribute
        QName qname = getQName(reader, "composite");
        if (qname != null) {
            Composite composite = assemblyFactory.createComposite();
            composite.setName(qname);
            composite.setUnresolved(true);
            implementation.setComposite(composite);
        }

        // Skip to end element
        while (reader.hasNext()) {
            if (reader.next() == END_ELEMENT && IMPLEMENTATION_NODE.equals(reader.getName())) {
View Full Code Here

     * @return
     */
    private static String relatedLink(Composite composite) {
        for (Component component: composite.getComponents()) {
            if (component.getImplementation() instanceof NodeImplementation) {
                NodeImplementation nodeImplementation = (NodeImplementation)component.getImplementation();
                Composite deployable = nodeImplementation.getComposite();
                String contributionURI = deployable.getURI();
                QName qname = deployable.getName();
                String key = compositeKey(contributionURI, qname);
                return "/composite-source/" + key;
            }
View Full Code Here

            // bindings that it configures
            Component nodeComponent = null;
            QName nodeCompositeName = null;
            for (Composite cloudComposite : cloudsComposite.getIncludes()) {
                for (Component nc : cloudComposite.getComponents()) {
                    NodeImplementation nodeImplementation = (NodeImplementation)nc.getImplementation();
                    if (nodeImplementation.getComposite().getName().equals(compositeName) &&
                        nodeImplementation.getComposite().getURI().equals(contributionURI)) {
                        nodeImplementation.setComposite(composite);
                        nodeComponent = nc;
                        nodeCompositeName = cloudComposite.getName();
                        break;
                    }
                }
View Full Code Here

     * @return
     */
    private Composite nodeComposite(Composite composite) {
        Composite nodeComposite = assemblyFactory.createComposite();
        Component nodeComponent = assemblyFactory.createComponent();
        NodeImplementation nodeImplementation = nodeImplementationFactory.createNodeImplementation();
        nodeImplementation.setComposite(composite);
        nodeComponent.setImplementation(nodeImplementation);
        ComponentService nodeService = assemblyFactory.createComponentService();
        nodeService.getBindings().addAll(defaultBindings);
        nodeComponent.getServices().add(nodeService);
        nodeComposite.getComponents().add(nodeComponent);
View Full Code Here

        for (Component component: composite.getComponents()) {
            Implementation implementation = component.getImplementation();
            if (implementation instanceof NodeImplementation) {
               
                // Get the application composite assigned to the node
                NodeImplementation nodeImplementation = (NodeImplementation)implementation;
                Composite applicationComposite = nodeImplementation.getComposite();
               
                // Get the default bindings configured on the node
                List<Binding> defaultBindings = new ArrayList<Binding>();
                for (ComponentService componentService: component.getServices()) {
                    defaultBindings.addAll(componentService.getBindings());
View Full Code Here

     * @return
     */
    private Composite nodeComposite(Composite composite) {
        Composite nodeComposite = assemblyFactory.createComposite();
        Component nodeComponent = assemblyFactory.createComponent();
        NodeImplementation nodeImplementation = nodeImplementationFactory.createNodeImplementation();
        nodeImplementation.setComposite(composite);
        nodeComponent.setImplementation(nodeImplementation);
        ComponentService nodeService = assemblyFactory.createComponentService();
        nodeService.getBindings().addAll(defaultBindings);
        nodeComponent.getServices().add(nodeService);
        nodeComposite.getComponents().add(nodeComponent);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.implementation.node.NodeImplementation

Copyright © 2018 www.massapicom. 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.