org.apache.tuscany.sca.contribution.service.impl
Class ContributionServiceImpl

java.lang.Object
  extended by org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl
All Implemented Interfaces:
ContributionService

public class ContributionServiceImpl
extends java.lang.Object
implements ContributionService

Service interface that manages artifacts contributed to a Tuscany runtime.


Constructor Summary
ContributionServiceImpl(ContributionRepository repository, PackageProcessor packageProcessor, URLArtifactProcessor documentProcessor, StAXArtifactProcessor staxProcessor, ExtensibleContributionListener contributionListener, ModelResolver policyDefinitionsResolver, ModelResolverExtensionPoint modelResolvers, ModelFactoryExtensionPoint modelFactories, AssemblyFactory assemblyFactory, ContributionFactory contributionFactory, javax.xml.stream.XMLInputFactory xmlFactory, java.util.List<SCADefinitions> policyDefinitions, Monitor monitor)
           
 
Method Summary
 void addDeploymentComposite(Contribution contribution, Composite composite)
          Add a composite model to the contribution
 Contribution contribute(java.lang.String contributionURI, java.net.URL sourceURL, boolean storeInRepository)
          Contribute an artifact to the SCA Domain.
 Contribution contribute(java.lang.String contributionURI, java.net.URL sourceURL, java.io.InputStream input)
          Contribute an artifact to the SCA Domain.
 Contribution contribute(java.lang.String contributionURI, java.net.URL sourceURL, java.io.InputStream input, ModelResolver modelResolver)
          Contribute an artifact to the SCA Domain.
 Contribution contribute(java.lang.String contributionURI, java.net.URL sourceURL, ModelResolver modelResolver, boolean storeInRepository)
          Contribute an artifact to the SCA Domain.
 Contribution getContribution(java.lang.String uri)
          Get the model for an installed contribution
 void remove(java.lang.String uri)
          Remove a contribution and notify listener that contribution was removed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContributionServiceImpl

public ContributionServiceImpl(ContributionRepository repository,
                               PackageProcessor packageProcessor,
                               URLArtifactProcessor documentProcessor,
                               StAXArtifactProcessor staxProcessor,
                               ExtensibleContributionListener contributionListener,
                               ModelResolver policyDefinitionsResolver,
                               ModelResolverExtensionPoint modelResolvers,
                               ModelFactoryExtensionPoint modelFactories,
                               AssemblyFactory assemblyFactory,
                               ContributionFactory contributionFactory,
                               javax.xml.stream.XMLInputFactory xmlFactory,
                               java.util.List<SCADefinitions> policyDefinitions,
                               Monitor monitor)
Method Detail

contribute

public Contribution contribute(java.lang.String contributionURI,
                               java.net.URL sourceURL,
                               boolean storeInRepository)
                        throws ContributionException,
                               java.io.IOException
Description copied from interface: ContributionService
Contribute an artifact to the SCA Domain. The type of the contribution is determined by the Content-Type of the resource or, if that is undefined, by some implementation-specific means (such as mapping an extension in the URL's path).

Specified by:
contribute in interface ContributionService
Parameters:
contributionURI - The URI that is used as the contribution unique ID.
sourceURL - The location of the resource containing the artifact
storeInRepository - Flag that identifies if you want to copy the contribution to the repository
Returns:
The contribution model representing the contribution
Throws:
ContributionException - if there was a problem with the contribution
java.io.IOException - if there was a problem reading the resource

contribute

public Contribution contribute(java.lang.String contributionURI,
                               java.net.URL sourceURL,
                               ModelResolver modelResolver,
                               boolean storeInRepository)
                        throws ContributionException,
                               java.io.IOException
Description copied from interface: ContributionService
Contribute an artifact to the SCA Domain. The type of the contribution is determined by the Content-Type of the resource or, if that is undefined, by some implementation-specific means (such as mapping an extension in the URL's path).

Specified by:
contribute in interface ContributionService
Parameters:
contributionURI - The URI that is used as the contribution unique ID.
sourceURL - The location of the resource containing the artifact
modelResolver - The model resolver to use to resolve models in the scope of this contribution
storeInRepository - Flag that identifies if you want to copy the contribution to the repository
Returns:
The contribution model representing the contribution
Throws:
ContributionException - if there was a problem with the contribution
java.io.IOException - if there was a problem reading the resource

contribute

public Contribution contribute(java.lang.String contributionURI,
                               java.net.URL sourceURL,
                               java.io.InputStream input)
                        throws ContributionException,
                               java.io.IOException
Description copied from interface: ContributionService
Contribute an artifact to the SCA Domain.

Specified by:
contribute in interface ContributionService
Parameters:
contributionURI - The URI that is used as the contribution unique ID.
sourceURL - The location of the resource containing the artifact. This is used to identify what name should be used when storing the contribution on the repository
input - A stream containing the resource being contributed; the stream will not be closed but the read position after the call is undefined
Returns:
The contribution model representing the contribution
Throws:
ContributionException - if there was a problem with the contribution
java.io.IOException - if there was a problem reading the stream

contribute

public Contribution contribute(java.lang.String contributionURI,
                               java.net.URL sourceURL,
                               java.io.InputStream input,
                               ModelResolver modelResolver)
                        throws ContributionException,
                               java.io.IOException
Description copied from interface: ContributionService
Contribute an artifact to the SCA Domain.

Specified by:
contribute in interface ContributionService
Parameters:
contributionURI - The URI that is used as the contribution unique ID.
sourceURL - The location of the resource containing the artifact. This is used to identify what name should be used when storing the contribution on the repository
input - A stream containing the resource being contributed; the stream will not be closed but the read position after the call is undefined
modelResolver - The model resolver to use to resolve models in the scope of this contribution
Returns:
The contribution model representing the contribution
Throws:
ContributionException - if there was a problem with the contribution
java.io.IOException - if there was a problem reading the stream

getContribution

public Contribution getContribution(java.lang.String uri)
Description copied from interface: ContributionService
Get the model for an installed contribution

Specified by:
getContribution in interface ContributionService
Parameters:
uri - The URI of an installed contribution
Returns:
The model for the contribution or null if there is no such contribution

remove

public void remove(java.lang.String uri)
            throws ContributionException
Remove a contribution and notify listener that contribution was removed

Specified by:
remove in interface ContributionService
Parameters:
uri - The URI of the contribution
Throws:
ContributionException

addDeploymentComposite

public void addDeploymentComposite(Contribution contribution,
                                   Composite composite)
                            throws ContributionException
Add a composite model to the contribution

Specified by:
addDeploymentComposite in interface ContributionService
Parameters:
contribution - The contribution to where
Throws:
ContributionException