Package org.apache.tuscany.sca.node.configuration

Examples of org.apache.tuscany.sca.node.configuration.ContributionConfiguration


    }

    public NodeConfiguration read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {

        NodeConfiguration node = null;
        ContributionConfiguration contribution = null;
        DeploymentComposite composite = null;
        BindingConfiguration binding = null;

        // Skip to end element
        while (true) {
            int event = reader.getEventType();
            switch (event) {
                case XMLStreamConstants.START_ELEMENT:
                    QName name = reader.getName();
                    if (NODE.equals(name)) {
                        node = nodeConfigurationFactory.createNodeConfiguration();
                        node.setURI(reader.getAttributeValue(null, "uri"));
                        node.setDomainURI(reader.getAttributeValue(null, "domain"));
                        node.setDomainRegistryURI(reader.getAttributeValue(null, "domainRegistry"));
                    } else if (CONTRIBUTION.equals(name)) {
                        contribution = nodeConfigurationFactory.createContributionConfiguration();
                        contribution.setURI(reader.getAttributeValue(null, "uri"));
                        contribution.setLocation(reader.getAttributeValue(null, "location"));
                        contribution.setMetaDataURL(reader.getAttributeValue(null, "metaDataURL"));
                        String startDeployables = reader.getAttributeValue(null, "startDeployables");
                        if (startDeployables != null) {
                            contribution.setStartDeployables(Boolean.parseBoolean(startDeployables));
                        }
                        String dependentURIs = reader.getAttributeValue(null, "dependentURIs");
                        if (dependentURIs != null) {
                            contribution.setDependentContributionURIs(Arrays.asList(dependentURIs.split(",")));
                        }
                        node.getContributions().add(contribution);
                    } else if (BINDING.equals(name)) {
                        binding = nodeConfigurationFactory.createBindingConfiguration();
                        binding.setBindingType(getQName(reader, "name"));
                        String baseURIs = reader.getAttributeValue(null, "baseURIs");
                        if (baseURIs != null) {
                            StringTokenizer tokenizer = new StringTokenizer(baseURIs);
                            while (tokenizer.hasMoreTokens()) {
                                binding.getBaseURIs().add(tokenizer.nextToken());
                            }
                        }
                        node.getBindings().add(binding);
                    } else if (DEPLOYMENT_COMPOSITE.equals(name)) {
                        composite = nodeConfigurationFactory.createDeploymentComposite();
                        composite.setLocation(reader.getAttributeValue(null, "location"));
                        if (contribution != null) {
                            contribution.getDeploymentComposites().add(composite);
                        }
                    } else if(BASE_URI.equals(name)) {
                        // We also support <baseURI> element
                        String baseURI = reader.getElementText();
                        if (baseURI != null && binding != null) {
View Full Code Here


        NodeConfiguration config = factory.createNodeConfiguration();

        // Read a feed containing links to the composite and the contributions assigned to
        // the node
        ContributionConfiguration contribution = null;
        boolean id = false;
        QName name = null;

        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {

                case START_ELEMENT:
                    name = reader.getName();

                    if (ENTRY_QNAME.equals(name)) {

                        // Read an <entry>
                        contribution = factory.createContributionConfiguration();
                    } else if (ID_QNAME.equals(name)) {

                        // Read an <id>
                        id = true;

                    } else if (LINK_QNAME.equals(name)) {

                        // Read a <link>
                        String href = getString(reader, HREF);

                        if (contribution != null) {
                            contribution.setLocation(href);
                        }
                    } else if (CONTENT_QNAME.equals(name)) {
                        // Read a <content>
                    } else if (FEED_QNAME.equals(name)) {
                        // Read a <feed>
                    }
                    break;

                case XMLStreamConstants.CHARACTERS:

                    // Read characters inside an <id> element
                    if (id) {
                        if (contribution != null) {
                            contribution.setURI(reader.getText());
                        }
                    }
                    break;

                case END_ELEMENT:
View Full Code Here

        }
        return addBinding(binding);
    }

    public NodeConfiguration addContribution(String contributionURI, String location) {
        ContributionConfiguration contribution = new ContributionConfigurationImpl(contributionURI, location);
        return addContribution(contribution);
    }
View Full Code Here

        return addContribution(contributionURI.toString(), url);
    }

    public NodeConfiguration addContribution(URL... locations) {
        for (URL url : locations) {
            ContributionConfiguration contribution = new ContributionConfigurationImpl(url.toString(), url.toString());
            addContribution(contribution);
        }
        return this;
    }
View Full Code Here

        }
        return addBinding(binding);
    }

    public NodeConfiguration addContribution(String contributionURI, String location) {
        ContributionConfiguration contribution = new ContributionConfigurationImpl(contributionURI, location);
        return addContribution(contribution);
    }
View Full Code Here

        return addContribution(contributionURI.toString(), url);
    }

    public NodeConfiguration addContribution(URL... locations) {
        for (URL url : locations) {
            ContributionConfiguration contribution = new ContributionConfigurationImpl(url.toString(), url.toString());
            addContribution(contribution);
        }
        return this;
    }
View Full Code Here

    }

    public NodeConfiguration read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {

        NodeConfiguration node = null;
        ContributionConfiguration contribution = null;
        DeploymentComposite composite = null;
        BindingConfiguration binding = null;

        // Skip to end element
        while (true) {
            int event = reader.getEventType();
            switch (event) {
                case XMLStreamConstants.START_ELEMENT:
                    QName name = reader.getName();
                    if (NODE.equals(name)) {
                        node = nodeConfigurationFactory.createNodeConfiguration();
                        node.setURI(reader.getAttributeValue(null, "uri"));
                        node.setDomainURI(reader.getAttributeValue(null, "domain"));
                        node.setDomainRegistryURI(reader.getAttributeValue(null, "domainRegistry"));
                    } else if (CONTRIBUTION.equals(name)) {
                        contribution = nodeConfigurationFactory.createContributionConfiguration();
                        contribution.setURI(reader.getAttributeValue(null, "uri"));
                        contribution.setLocation(reader.getAttributeValue(null, "location"));
                        contribution.setMetaDataURL(reader.getAttributeValue(null, "metaDataURL"));
                        String startDeployables = reader.getAttributeValue(null, "startDeployables");
                        if (startDeployables != null) {
                            contribution.setStartDeployables(Boolean.parseBoolean(startDeployables));
                        }
                        String dependentURIs = reader.getAttributeValue(null, "dependentURIs");
                        if (dependentURIs != null) {
                            contribution.setDependentContributionURIs(Arrays.asList(dependentURIs.split(",")));
                        }
                        node.getContributions().add(contribution);
                    } else if (BINDING.equals(name)) {
                        binding = nodeConfigurationFactory.createBindingConfiguration();
                        binding.setBindingType(getQName(reader, "name"));
                        String baseURIs = reader.getAttributeValue(null, "baseURIs");
                        if (baseURIs != null) {
                            StringTokenizer tokenizer = new StringTokenizer(baseURIs);
                            while (tokenizer.hasMoreTokens()) {
                                binding.getBaseURIs().add(tokenizer.nextToken());
                            }
                        }
                        node.getBindings().add(binding);
                    } else if (DEPLOYMENT_COMPOSITE.equals(name)) {
                        composite = nodeConfigurationFactory.createDeploymentComposite();
                        composite.setLocation(reader.getAttributeValue(null, "location"));
                        if (contribution != null) {
                            contribution.getDeploymentComposites().add(composite);
                        }
                    } else if(BASE_URI.equals(name)) {
                        // We also support <baseURI> element
                        String baseURI = reader.getElementText();
                        if (baseURI != null && binding != null) {
View Full Code Here

        NodeConfiguration config = factory.createNodeConfiguration();

        // Read a feed containing links to the composite and the contributions assigned to
        // the node
        ContributionConfiguration contribution = null;
        boolean id = false;
        QName name = null;

        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {

                case START_ELEMENT:
                    name = reader.getName();

                    if (ENTRY_QNAME.equals(name)) {

                        // Read an <entry>
                        contribution = factory.createContributionConfiguration();
                    } else if (ID_QNAME.equals(name)) {

                        // Read an <id>
                        id = true;

                    } else if (LINK_QNAME.equals(name)) {

                        // Read a <link>
                        String href = getString(reader, HREF);

                        if (contribution != null) {
                            contribution.setLocation(href);
                        }
                    } else if (CONTENT_QNAME.equals(name)) {
                        // Read a <content>
                    } else if (FEED_QNAME.equals(name)) {
                        // Read a <feed>
                    }
                    break;

                case XMLStreamConstants.CHARACTERS:

                    // Read characters inside an <id> element
                    if (id) {
                        if (contribution != null) {
                            contribution.setURI(reader.getText());
                        }
                    }
                    break;

                case END_ELEMENT:
View Full Code Here

        }
        return addBinding(binding);
    }

    public NodeConfiguration addContribution(String contributionURI, String location) {
        ContributionConfiguration contribution = new ContributionConfigurationImpl(contributionURI, location);
        return addContribution(contribution);
    }
View Full Code Here

        return addContribution(contributionURI.toString(), location.toString());
    }

    public NodeConfiguration addContribution(URL... locations) {
        for (URL url : locations) {
            ContributionConfiguration contribution = new ContributionConfigurationImpl(url.toString(), url.toString());
            addContribution(contribution);
        }
        return this;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.node.configuration.ContributionConfiguration

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.