Examples of Contribution


Examples of org.apache.tuscany.sca.contribution.Contribution

    public String installContribution(String uri, String contributionURL, String metaDataURL, List<String> dependentContributionURIs, boolean startDeployables) throws ContributionReadException, ActivationException, ValidationException {
        if (uri == null) {
            uri = getDefaultContributionURI(contributionURL);
        }
        Monitor monitor = deployer.createMonitor();
        Contribution contribution = deployer.loadContribution(IOHelper.createURI(uri), IOHelper.getLocationAsURL(contributionURL), monitor);
        monitor.analyzeProblems();
        if (metaDataURL != null) {
            mergeContributionMetaData(metaDataURL, contribution);
        }
        installContribution(contribution, dependentContributionURIs, startDeployables);
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.Contribution

    private NodeUtil() {
    }

    static Contribution contribution(ContributionFactory contributionFactory, org.apache.tuscany.sca.node.Contribution c) {
        Contribution contribution = contributionFactory.createContribution();
        contribution.setURI(c.getURI());
        contribution.setLocation(c.getLocation());
        contribution.setUnresolved(true);
        return contribution;
    }
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.Contribution

   
    public ContributionModelResolver(Contribution contribution, FactoryExtensionPoint modelFactories) {
    }

    public void addModel(Object resolved, ProcessorContext context) {
        Contribution contribution = (Contribution)resolved;
        map.put(contribution.getURI(), contribution);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.Contribution

    public <T> T resolveModel(Class<T> modelClass, T unresolved, ProcessorContext context) {
       
        // Lookup a contribution for the given URI
        String uri = ((Contribution)unresolved).getURI();
        if (uri != null) {
            Contribution resolved = (Contribution) map.get(uri);
            if (resolved != null) {
                return modelClass.cast(resolved);
            }
            return unresolved;
        } else {
           
            // If no URI was specified, just return the first contribution
            if (!map.isEmpty()) {
                Contribution resolved = map.values().iterator().next();
                return modelClass.cast(resolved);
            } else {
                return unresolved;
            }
        }
View Full Code Here

Examples of org.apache.tuscany.sca.contribution.Contribution

            }
            URL contributionURL = uri.toURL();

            // Load the contribution
            logger.log(quietLogging? Level.FINE : Level.INFO, "Loading contribution: " + contributionURL);
            Contribution contribution = deployer.loadContribution(contributionURI, contributionURL, context.getMonitor());
            contributions.add(contribution);

            boolean attached = false;
            for (DeploymentComposite dc : contrib.getDeploymentComposites()) {
                if (dc.getContent() != null) {
                    Reader xml = new StringReader(dc.getContent());
                    attached = attachDeploymentComposite(contribution, xml, null, attached, context);
                } else if (dc.getLocation() != null) {
                    URI dcURI = createURI(dc.getLocation());
                    if (!dcURI.isAbsolute()) {
                        Composite composite = null;
                        // The location is pointing to an artifact within the contribution
                        for (Artifact a : contribution.getArtifacts()) {
                            if (dcURI.toString().equals(a.getURI())) {
                                composite = (Composite)a.getModel();
                                if (!attached) {
                                    contribution.getDeployables().clear();
                                    attached = true;
                                }
                                contribution.getDeployables().add(composite);
                                break;
                            }
                        }
                        if (composite == null) {
                            // Not found
                            throw new ServiceRuntimeException("Deployment composite " + dcURI
                                + " cannot be found within contribution "
                                + contribution.getLocation());
                        }
                    } else {
                        URL url = dcURI.toURL();
                        InputStream is = openStream(url);
                        Reader xml = new InputStreamReader(is, "UTF-8");
View Full Code Here

Examples of org.apache.tuscany.sca.node.Contribution

    @BeforeClass
    public static void setUp() throws Exception {
        final NodeFactory nf = NodeFactory.newInstance();
        String here = SampleNativeJMSAsyncTestCase.class.getProtectionDomain().getCodeSource().getLocation().toString();
        // Create the node using the pattern "name of composite file to start" / Contribution to use
        node = nf.createNode("testnativejmsasync.composite", new Contribution("test", here));
        node.start();
    }
View Full Code Here

Examples of org.apache.tuscany.sca.node.Contribution

    }

    List<?> start(final String name, final String cloc, final String dcuri) {
        if(nodes.containsKey(name))
            return emptyList();
        final Node node = dcuri != null? nf.createNode(dcuri, new Contribution(cloc, cloc)) : nf.createNode(new Contribution(cloc, cloc));
        nodes.put(name, new Nodeconf(name, cloc, dcuri, node));
        node.start();
        return emptyList();
    }
View Full Code Here

Examples of org.apache.tuscany.sca.node.Contribution

   
    @BeforeClass
    public static void setUp() throws Exception {
        // Start test composite on a Tuscany node
        final NodeFactory nf = NodeFactory.newInstance();
        node = nf.createNode("test.composite", new Contribution("test", here()));
        node.start();
       
        // Mock up a test Web service on http://localhost:8086/wsupper
        jetty = new JettyServer((ExtensionPointRegistry)nf.getExtensionPointRegistry());
        jetty.start();
View Full Code Here

Examples of org.apache.tuscany.sca.node.Contribution

    public void startServer() throws Exception {
        try {

            NodeFactory factory = NodeFactory.newInstance();
            String contribution = ContributionLocationHelper.getContributionLocation(OrderService_Service.class);
            node = factory.createNode("orderws.composite", new Contribution("order", contribution)).start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    
    }
View Full Code Here

Examples of org.apache.tuscany.sca.node.Contribution

public class CalculatorTestCase {

    @Test
    public void testCalculator() throws Exception {
       
        Node node = NodeFactory.newInstance().createNode(new Contribution("c1", "./target/classes"));
        node.start();
       
        CalculatorService calculator = node.getService(CalculatorService.class, "CalculatorServiceComponent");
       
        assertEquals(calculator.add(3, 2), 5.0, 0);
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.