Package org.apache.tuscany.sca.contribution

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


    public void remove(String contribution) throws ContributionException {
        this.contributionRegistry.remove(contribution);
    }

    public void addDeploymentComposite(Contribution contribution, Composite composite) throws ContributionException {
        DeployedArtifact artifact = this.contributionFactory.createDeployedArtifact();
        artifact.setURI(composite.getURI());
        artifact.setModel(composite);

        contribution.getArtifacts().add(artifact);

        contribution.getDeployables().add(composite);
    }
View Full Code Here


        URL contributionURL = new URL(contribution.getLocation());
        for (URI a : artifacts) {
            URL artifactURL = packageProcessor.getArtifactURL(new URL(contribution.getLocation()), a);
           
            // Add the deployed artifact model to the resolver
            DeployedArtifact artifact = this.contributionFactory.createDeployedArtifact();
            artifact.setURI(a.toString());
            artifact.setLocation(artifactURL.toString());
            contribution.getArtifacts().add(artifact);
            modelResolver.addModel(artifact);

            // Let the artifact processor read the artifact into a model
            Object model = this.artifactProcessor.read(contributionURL, a, artifactURL);
            if (model != null) {
                artifact.setModel(model);
               
                // Add the loaded model to the model resolver
                modelResolver.addModel(model);
            }
           
View Full Code Here

        List deployables = contributionService.getContribution(contributionId).getDeployables();
        Composite composite1 = (Composite)deployables.get(deployables.size() - 1);
        assertEquals("contributionComposite", composite1.getName().toString());

        DeployedArtifact artifact = null;
        contribution = contributionService.getContribution(contributionId);
        String id = artifactId.toString();
        for (DeployedArtifact a : contribution.getArtifacts()) {
            if (id.equals(a.getURI())) {
                artifact = a;
                break;
            }
        }
        Composite composite2 = (Composite)artifact.getModel();
        assertEquals("contributionComposite", composite2.getName().toString());
    }
View Full Code Here

    }

    public void resolve(ResourceImplementation impl, ModelResolver resolver) throws ContributionResolveException {
       
        // Resolve the resource directory location
        DeployedArtifact artifact = contributionFactory.createDeployedArtifact();
        artifact.setURI(impl.getLocation());
        DeployedArtifact resolved = resolver.resolveModel(DeployedArtifact.class, artifact);
        if (resolved.getLocation() != null) {
            try {
                impl.setLocationURL(new URL(resolved.getLocation()));
                impl.setUnresolved(false);
            } catch (IOException e) {
                throw new ContributionResolveException(e);
            }
        }
View Full Code Here

    /**
     * Add a composite model to the contribution
     */
    public void addDeploymentComposite(Contribution contribution, Composite composite) throws ContributionException {
        DeployedArtifact artifact = this.contributionFactory.createDeployedArtifact();
        artifact.setURI(composite.getURI());
        artifact.setModel(composite);

        contribution.getArtifacts().add(artifact);

        contribution.getDeployables().add(composite);
    }
View Full Code Here

        URL contributionURL = new URL(contribution.getLocation());
        for (URI a : artifacts) {
            URL artifactURL = packageProcessor.getArtifactURL(new URL(contribution.getLocation()), a);
           
            // Add the deployed artifact model to the resolver
            DeployedArtifact artifact = this.contributionFactory.createDeployedArtifact();
            artifact.setURI(a.toString());
            artifact.setLocation(artifactURL.toString());
            contribution.getArtifacts().add(artifact);
            modelResolver.addModel(artifact);

            // Let the artifact processor read the artifact into a model
            Object model = this.artifactProcessor.read(contributionURL, a, artifactURL);
            if (model != null) {
                artifact.setModel(model);
               
                // Add the loaded model to the model resolver
                modelResolver.addModel(model);
            }
        }
View Full Code Here

        Model y = resolver.resolveModel(Model.class, x);
        assertTrue(x == y);
    }
   
    public void testResolvedArtifact() {
        DeployedArtifact artifact = factory.createDeployedArtifact();
        artifact.setURI("foo/bar");
        resolver.addModel(artifact);
        DeployedArtifact x = factory.createDeployedArtifact();
        x.setURI("foo/bar");
        x = resolver.resolveModel(DeployedArtifact.class, x);
        assertTrue(x == artifact);
    }
View Full Code Here

        assertTrue(clazz.isUnresolved());
        assertTrue(clazz.getJavaClass() == null);
    }
   
    public void testResolvedArtifact() {
        DeployedArtifact artifact = factory.createDeployedArtifact();
        artifact.setURI("foo/bar");
        resolver.addModel(artifact);
        DeployedArtifact x = factory.createDeployedArtifact();
        x.setURI("foo/bar");
        x = resolver.resolveModel(DeployedArtifact.class, x);
        assertTrue(x == artifact);
    }
View Full Code Here

                component.setImplementation(implementation);
            }

            for (ComponentProperty componentProperty : component.getProperties()) {
                if (componentProperty.getFile() != null) {
                    DeployedArtifact deployedArtifact =
                        contributionFactory.createDeployedArtifact();
                    deployedArtifact.setURI(componentProperty.getFile());
                    deployedArtifact =
                        resolver.resolveModel(DeployedArtifact.class, deployedArtifact);
                    if (deployedArtifact.getLocation() != null) {
                        componentProperty.setFile(deployedArtifact.getLocation());
                    }
                }
            }
            resolveIntents(component.getRequiredIntents(), resolver);
            resolvePolicySets(component.getPolicySets(), resolver);
View Full Code Here

                URL url = null;
                if (importLocation.startsWith("/")) {
                    // The URI is relative to the contribution
                    String uri = importLocation.substring(1);

                    DeployedArtifact proxyArtifact = contributionFactory.createDeployedArtifact();
                    proxyArtifact.setURI(uri);

                    //use contribution resolution (this supports import/export)
                    DeployedArtifact importedArtifact =
                        contribution.getModelResolver().resolveModel(DeployedArtifact.class, proxyArtifact);
                    if (importedArtifact.getLocation() != null) {
                        //get the artifact URL
                        url = new URL(importedArtifact.getLocation());
                    }
                } else {
                    url = new URL(new URL(parentLocation), importLocation);
                }
                if (url == null) {
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.contribution.DeployedArtifact

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.