Package org.apache.tuscany.sca.impl

Examples of org.apache.tuscany.sca.impl.NodeImpl


            boolean sharedRuntime = runtime != null;
            if (runtime == null) {
                runtime = newInstance();
            }
            EndpointRegistry endpointRegistry = new EndpointRegistryImpl(runtime.extensionPointRegistry, null, null);
            NodeImpl node = new NodeImpl("default", runtime.deployer, runtime.compositeActivator, endpointRegistry, runtime.extensionPointRegistry, sharedRuntime? null : runtime);

            if (dependentContributionURLs != null) {
                for (int i=dependentContributionURLs.length-1; i>-1; i--) {
                    node.installContribution(null, dependentContributionURLs[i], null, null, false);
                }
            }

            String curi = node.installContribution(null, contributionURL, null, null, compositeURI == null);
            if (compositeURI != null) {
                node.start(curi, compositeURI);
            }
            return node;
           
        } catch (Exception e) {
            throw new RuntimeException(e);
View Full Code Here


        String domainName = "default";
        if (domainURI != null){
            domainName = getDomainName(domainURI);
        }
        EndpointRegistry endpointRegistry = domainRegistryFactory.getEndpointRegistry(domainURI, domainName);
        return new NodeImpl(domainName, deployer, compositeActivator, endpointRegistry, extensionPointRegistry, null);
    }
View Full Code Here

    public static Node runComposite(URI domainURI, String compositeURI, String contributionURL, String... dependentContributionURLs) {
        try {
            TuscanyRuntime runtime = newInstance();
            String domain = domainURI == null ? DEFAUL_DOMAIN_NAME : domainURI.toString();
            DomainRegistry domainRegistry = runtime.domainRegistryFactory.getEndpointRegistry(domain, null);
            NodeImpl node = new NodeImpl(runtime.deployer, runtime.compositeActivator, domainRegistry, runtime.extensionPointRegistry, runtime);

            if (dependentContributionURLs != null) {
                for (int i=dependentContributionURLs.length-1; i>-1; i--) {
                    node.installContribution(null, dependentContributionURLs[i], null, null);
                }
            }

            String curi = node.installContribution(null, contributionURL, null, null);
            if (compositeURI != null) {
                node.startComposite(curi, compositeURI);
            } else {
                for (String compURI : node.getDeployableCompositeURIs(curi)) {
                    node.startComposite(curi, compURI);
                }
            }
            return node;
           
        } catch (Exception e) {
View Full Code Here

    public Node createNode(String domainURI) {
        if (domainURI == null){
            domainURI = DEFAUL_DOMAIN_NAME;
        }
        DomainRegistry domainRegistry = domainRegistryFactory.getEndpointRegistry(domainURI, null);
        return new NodeImpl(deployer, compositeActivator, domainRegistry, extensionPointRegistry, null);
    }
View Full Code Here

        }
        String domainName = domainProps.getProperty("domainName", directory.getName());
        String domainURI = domainProps.getProperty("domainURI", domainName);

        DomainRegistry domainRegistry = domainRegistryFactory.getEndpointRegistry(domainURI, domainName);
        Node node = new NodeImpl(deployer, compositeActivator, domainRegistry, extensionPointRegistry, null);

        List<String> installed = new ArrayList<String>();
        for (File f : directory.listFiles()) {
            if (f.getName().endsWith(".jar") || f.getName().endsWith(".zip") || (f.isDirectory() && !f.getName().startsWith("."))) {
                String fn = f.getName().lastIndexOf('.') == -1 ? f.getName() : f.getName().substring(0, f.getName().lastIndexOf('.'));
                // ignore the contribution if it has an associated exploded folder version
                if (!f.isDirectory() && new File(f.getParent(), fn).isDirectory()) {
                    continue;
                }
                String metaData = null;
                for (File f2 : directory.listFiles()) {
                    if (f2.getName().startsWith(fn) && f2.getName().endsWith(".xml")) {
                        metaData = f2.getPath();
                        break;
                    }
                }
               
                List<String> dependencyURIs = new ArrayList<String>();
                File dependencyFile = new File(directory, fn + ".dependencies");
                if (dependencyFile.exists()) {
                    BufferedReader br = new BufferedReader(new FileReader(dependencyFile));
                    String s;
                    while ((s = br.readLine()) != null)   {
                        if (!s.startsWith("#") && s.trim().length() > 0) {
                            dependencyURIs.addAll(Arrays.asList(s.trim().split("[ ,]+")));
                        }
                    }
                    br.close();
                }

                String curi = node.installContribution(null, f.getPath(), metaData, dependencyURIs);
                installed.add(curi);

                for (File f2 : directory.listFiles()) {
                    if (f2.getName().startsWith(fn) && f2.getName().endsWith(".composite")) {
                        node.addDeploymentComposite(curi, new FileReader(f2));
                    }
                }
            }
        }

        for (String curi : installed) {
            node.startDeployables(curi);
        }

        return node;
    }
View Full Code Here

     * @param configURL  the URL to the XML configuration file
     * @return Node  the configured Node
     */
    public Node createNodeFromXML(String configURL) throws ContributionReadException, ActivationException, ValidationException {
        NodeConfiguration configuration = loadConfiguration(configURL);
        NodeImpl node = (NodeImpl)createNode(configuration.getDomainURI());
        for ( ContributionConfiguration c : configuration.getContributions()) {
            String curi = node.installContribution(c.getURI(), c.getLocation(), c.getMetaDataURL(), c.getDependentContributionURIs());
            if (c.isStartDeployables()) {
                for (String compURI : node.getDeployableCompositeURIs(curi)) {
                    node.startComposite(curi, compURI);
                }
            }
        }
        return node;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.impl.NodeImpl

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.