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

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


     */
    private ConfiguredNodeImplementation findNodeConfiguration(final String compositeURI, ClassLoader classLoader)
        throws Exception {
        NodeImplementationFactory nodeImplementationFactory =
            modelFactories.getFactory(NodeImplementationFactory.class);
        ConfiguredNodeImplementation config = nodeImplementationFactory.createConfiguredNodeImplementation();

        // Default to thread context classloader
        if (classLoader == null) {
            classLoader = Thread.currentThread().getContextClassLoader();
        }
        String contributionArtifactPath = compositeURI;
        URL contributionArtifactURL = null;
        if (compositeURI != null) {
            contributionArtifactURL = getResource(classLoader, compositeURI);
            if (contributionArtifactURL == null) {
                throw new IllegalArgumentException("Composite not found: " + contributionArtifactPath);
            }
            // Set to relative URI to avoid duplicate loading
            Composite composite = createComposite(compositeURI);
            config.setComposite(composite);
        } else {
            // No composite is specified, tring to search the SCA metadata files
            contributionArtifactPath = Contribution.SCA_CONTRIBUTION_META;
            contributionArtifactURL = getResource(classLoader, Contribution.SCA_CONTRIBUTION_META);

            if (contributionArtifactURL == null) {
                contributionArtifactPath = Contribution.SCA_CONTRIBUTION_GENERATED_META;
                contributionArtifactURL = getResource(classLoader, Contribution.SCA_CONTRIBUTION_GENERATED_META);
            }
            if (contributionArtifactURL == null) {
                contributionArtifactPath = Contribution.SCA_CONTRIBUTION_DEPLOYABLES;
                contributionArtifactURL = getResource(classLoader, Contribution.SCA_CONTRIBUTION_DEPLOYABLES);
            }
           
            // No contribution can be discovered
            if (contributionArtifactURL == null) {
                throw new IllegalArgumentException("No default contribution can be discovered on the classpath");
            }
           
            // No composite will be created, all deployable composites will be used later
        }

        Contribution c = getContribution(contributionArtifactURL, contributionArtifactPath);
        config.getContributions().add(c);

        return config;
    }
View Full Code Here


        try {
            // Initialize the runtime
            initRuntime();

            URI uri = compositeURI == null ? null : URI.create(compositeURI);
            ConfiguredNodeImplementation configuration = null;
            if (contributions == null || contributions.length == 0) {
                if (uri != null && uri.getScheme() != null) {
                    throw new IllegalArgumentException("No SCA contributions are provided");
                }
                configuration = findNodeConfiguration(compositeURI, null);
            } else {

                // Create a node configuration
                NodeImplementationFactory nodeImplementationFactory =
                    modelFactories.getFactory(NodeImplementationFactory.class);
                configuration = nodeImplementationFactory.createConfiguredNodeImplementation();

                Composite composite = compositeURI == null ? null : createComposite(compositeURI);
                configuration.setComposite(composite);
 

                // Create contribution models
                ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
                for (SCAContribution c : contributions) {
                    Contribution contribution = createContribution(contributionFactory, c);
                    configuration.getContributions().add(contribution);
                }
            }

            // Configure the node
            configureNode(configuration, null);
View Full Code Here

        try {
            // Initialize the runtime
            initRuntime();

            ConfiguredNodeImplementation configuration = null;
            if (contributions == null || contributions.length == 0) {
                configuration = findNodeConfiguration(compositeURI, null);
            } else {
                // Create a node configuration
                NodeImplementationFactory nodeImplementationFactory =
                    modelFactories.getFactory(NodeImplementationFactory.class);
                configuration = nodeImplementationFactory.createConfiguredNodeImplementation();

                // Defer reading the composite content until the contributions have been loaded (TUSCANY-3569)

                // Create contribution models
                ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
                for (SCAContribution c : contributions) {
                    Contribution contribution = createContribution(contributionFactory, c);
                    configuration.getContributions().add(contribution);
                }
            }

            // Configure the node
            configureNode(configuration, compositeContent);
View Full Code Here

TOP

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

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.