org.apache.tuscany.sca.contribution.service
Interface ContributionRepository

All Known Implementing Classes:
ContributionRepositoryImpl

public interface ContributionRepository

Contribution repository


Method Summary
 void addContribution(Contribution contribution)
          Adds a contribution to the repository.
 java.net.URL find(java.lang.String contribution)
          Look up the contribution by URI
 Contribution getContribution(java.lang.String uri)
          Returns the contribution with the given URI.
 java.util.List<Contribution> getContributions()
          Returns the contributions available in the repository.
 java.net.URI getDomain()
          Get the URI of the SCA domain
 java.util.List<java.lang.String> list()
          Get list of URIs for all the contributions in the repository
 void remove(java.lang.String contribution)
          Remove a contribution from the repository
 void removeContribution(Contribution contribution)
          Removes a contribution from the repository.
 java.net.URL store(java.lang.String contribution, java.net.URL sourceURL)
          Copy a contribution from the source URL to the repository
 java.net.URL store(java.lang.String contribution, java.net.URL sourceURL, java.io.InputStream contributionStream)
          Copies a contribution to the repository.
 void updateContribution(Contribution contribution)
          Updates a contribution in the repository
 

Method Detail

getDomain

java.net.URI getDomain()
Get the URI of the SCA domain

Returns:
The domain URI

store

java.net.URL store(java.lang.String contribution,
                   java.net.URL sourceURL,
                   java.io.InputStream contributionStream)
                   throws java.io.IOException
Copies a contribution to the repository.

Parameters:
contribution - A URl pointing to the contribution being copied to the repository
sourceURL - URL of the source. this would be used to calculate the right filename to be stored on the repository when a inputStream is being provided
contributionStream - InputStream with the content of the distribution
Returns:
A URL pointing to the content of the contribution in the repository
Throws:
java.io.IOException

store

java.net.URL store(java.lang.String contribution,
                   java.net.URL sourceURL)
                   throws java.io.IOException
Copy a contribution from the source URL to the repository

Parameters:
contribution - A URl pointing to the contribution being copied to the repository
sourceURL - URL of the source. this would be used to calculate the right filename to be stored on the repository when a inputStream is being provided
Returns:
A URL pointing to the content of the contribution in the repository
Throws:
java.io.IOException

find

java.net.URL find(java.lang.String contribution)
Look up the contribution by URI

Parameters:
contribution - The URI of the contribution
Returns:
A URL pointing to the content of the contribution in the repository, it will be null if the contribution cannot be found in the repository

remove

void remove(java.lang.String contribution)
Remove a contribution from the repository

Parameters:
contribution - The URI of the contribution to be removed

list

java.util.List<java.lang.String> list()
Get list of URIs for all the contributions in the repository

Returns:
A list of contribution URIs

getContributions

java.util.List<Contribution> getContributions()
Returns the contributions available in the repository.

Returns:
The list of contributions.

addContribution

void addContribution(Contribution contribution)
Adds a contribution to the repository.

Parameters:
contribution - The new contribution.

removeContribution

void removeContribution(Contribution contribution)
Removes a contribution from the repository.

Parameters:
contribution - The contribution to remove

updateContribution

void updateContribution(Contribution contribution)
Updates a contribution in the repository

Parameters:
contribution - The contribution to update

getContribution

Contribution getContribution(java.lang.String uri)
Returns the contribution with the given URI.

Parameters:
uri - the URI of the contribution
Returns:
The contribution