Examples of DeploymentComposite


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

    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) {
                            baseURI = baseURI.trim();
                            binding.addBaseURI(baseURI);
                        }
                        // getElementText() moves the event to END_ELEMENT
                        continue;
                    } else if (COMPOSITE.equals(name)) {
                        /*
                        Object model = processor.read(reader);
                        if (model instanceof Composite) {
                            // FIXME: We need to capture the text here
                            // composite.setComposite((Composite)model);
                        }
                        */
                        StringWriter sw = new StringWriter();
                        XMLStreamWriter writer = helper.createXMLStreamWriter(sw);
                        helper.save(reader, writer);
                        composite.setContent(sw.toString());
                    } else {
                        node.getExtensions().add(processor.read(reader, context));
                    }
                    break;

View Full Code Here

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

        return this;
    }

    public ContributionConfiguration addDeploymentComposite(Reader reader) {
        try {
            DeploymentComposite composite = new DeploymentCompositeImpl();
            char[] buf = new char[8192];
            StringWriter sw = new StringWriter();
            int size = 0;
            while (size >= 0) {
                size = reader.read(buf);
                if (size > 0) {
                    sw.write(buf, 0, size);
                }
            }
            reader.close();
            composite.setContent(sw.toString());
            return addDeploymentComposite(composite);
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here

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

            throw new IllegalArgumentException(e);
        }
    }

    public ContributionConfiguration addDeploymentComposite(String content) {
        DeploymentComposite composite = new DeploymentCompositeImpl();
        composite.setContent(content);
        return addDeploymentComposite(composite);
    }
View Full Code Here

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

        composite.setContent(content);
        return addDeploymentComposite(composite);
    }

    public ContributionConfiguration addDeploymentComposite(URI location) {
        DeploymentComposite composite = new DeploymentCompositeImpl();
        composite.setLocation(location.toString());
        return addDeploymentComposite(composite);
    }
View Full Code Here

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

        composite.setLocation(location.toString());
        return addDeploymentComposite(composite);
    }

    public ContributionConfiguration addDeploymentComposite(URL location) {
        DeploymentComposite composite = new DeploymentCompositeImpl();
        composite.setLocation(location.toString());
        return addDeploymentComposite(composite);
    }
View Full Code Here

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

        return this;
    }

    public ContributionConfiguration addDeploymentComposite(Reader reader) {
        try {
            DeploymentComposite composite = new DeploymentCompositeImpl();
            char[] buf = new char[8192];
            StringWriter sw = new StringWriter();
            int size = 0;
            while (size >= 0) {
                size = reader.read(buf);
                if (size > 0) {
                    sw.write(buf, 0, size);
                }
            }
            reader.close();
            composite.setContent(sw.toString());
            return addDeploymentComposite(composite);
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        }
    }
View Full Code Here

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

            throw new IllegalArgumentException(e);
        }
    }

    public ContributionConfiguration addDeploymentComposite(String content) {
        DeploymentComposite composite = new DeploymentCompositeImpl();
        composite.setContent(content);
        return addDeploymentComposite(composite);
    }
View Full Code Here

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

        composite.setContent(content);
        return addDeploymentComposite(composite);
    }

    public ContributionConfiguration addDeploymentComposite(URI location) {
        DeploymentComposite composite = new DeploymentCompositeImpl();
        composite.setLocation(location.toString());
        return addDeploymentComposite(composite);
    }
View Full Code Here

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

        composite.setLocation(location.toString());
        return addDeploymentComposite(composite);
    }

    public ContributionConfiguration addDeploymentComposite(URL location) {
        DeploymentComposite composite = new DeploymentCompositeImpl();
        composite.setLocation(location.toString());
        return addDeploymentComposite(composite);
    }
View Full Code Here

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

    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) {
                            baseURI = baseURI.trim();
                            binding.addBaseURI(baseURI);
                        }
                        // getElementText() moves the event to END_ELEMENT
                        continue;
                    } else if (COMPOSITE.equals(name)) {
                        /*
                        Object model = processor.read(reader);
                        if (model instanceof Composite) {
                            // FIXME: We need to capture the text here
                            // composite.setComposite((Composite)model);
                        }
                        */
                        StringWriter sw = new StringWriter();
                        XMLStreamWriter writer = helper.createXMLStreamWriter(sw);
                        helper.save(reader, writer);
                        composite.setContent(sw.toString());
                    } else {
                        Object ext = processor.read(reader, context);
                        if (ext instanceof Endpoint) {
                            node.getEndpointDescriptions().add((Endpoint)ext);
                        } else {
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.