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

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

public class ContributionRepositoryImpl
extends java.lang.Object
implements ContributionRepository

The default implementation of ContributionRepository


Constructor Summary
ContributionRepositoryImpl(java.lang.String repository, javax.xml.stream.XMLInputFactory factory, Monitor monitor)
          Constructor with repository root
 
Method Summary
 void addContribution(Contribution contribution)
          Contribution Registry methods
protected  void error(java.lang.String message, java.lang.Object model, java.lang.Exception ex)
          Marshals exceptions into the monitor
protected  void error(java.lang.String message, java.lang.Object model, java.lang.Object... messageParameters)
          Marshals errors into the monitor
 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
protected  void warning(java.lang.String message, java.lang.Object model, java.lang.String... messageParameters)
          Marshals warnings into the monitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContributionRepositoryImpl

public ContributionRepositoryImpl(java.lang.String repository,
                                  javax.xml.stream.XMLInputFactory factory,
                                  Monitor monitor)
                           throws java.io.IOException
Constructor with repository root

Parameters:
repository -
factory -
Throws:
java.io.IOException
Method Detail

warning

protected void warning(java.lang.String message,
                       java.lang.Object model,
                       java.lang.String... messageParameters)
Marshals warnings into the monitor

Parameters:
message -
model -
messageParameters -

error

protected void error(java.lang.String message,
                     java.lang.Object model,
                     java.lang.Object... messageParameters)
Marshals errors into the monitor

Parameters:
problems -
message -
model -

error

protected void error(java.lang.String message,
                     java.lang.Object model,
                     java.lang.Exception ex)
Marshals exceptions into the monitor

Parameters:
problems -
message -
model -

getDomain

public java.net.URI getDomain()
Description copied from interface: ContributionRepository
Get the URI of the SCA domain

Specified by:
getDomain in interface ContributionRepository
Returns:
The domain URI

store

public java.net.URL store(java.lang.String contribution,
                          java.net.URL sourceURL,
                          java.io.InputStream contributionStream)
                   throws java.io.IOException
Description copied from interface: ContributionRepository
Copies a contribution to the repository.

Specified by:
store in interface ContributionRepository
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

public java.net.URL store(java.lang.String contribution,
                          java.net.URL sourceURL)
                   throws java.io.IOException
Description copied from interface: ContributionRepository
Copy a contribution from the source URL to the repository

Specified by:
store in interface ContributionRepository
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

public java.net.URL find(java.lang.String contribution)
Description copied from interface: ContributionRepository
Look up the contribution by URI

Specified by:
find in interface ContributionRepository
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

public void remove(java.lang.String contribution)
Description copied from interface: ContributionRepository
Remove a contribution from the repository

Specified by:
remove in interface ContributionRepository
Parameters:
contribution - The URI of the contribution to be removed

list

public java.util.List<java.lang.String> list()
Description copied from interface: ContributionRepository
Get list of URIs for all the contributions in the repository

Specified by:
list in interface ContributionRepository
Returns:
A list of contribution URIs

addContribution

public void addContribution(Contribution contribution)
Contribution Registry methods

Specified by:
addContribution in interface ContributionRepository
Parameters:
contribution - The new contribution.

removeContribution

public void removeContribution(Contribution contribution)
Description copied from interface: ContributionRepository
Removes a contribution from the repository.

Specified by:
removeContribution in interface ContributionRepository
Parameters:
contribution - The contribution to remove

updateContribution

public void updateContribution(Contribution contribution)
Description copied from interface: ContributionRepository
Updates a contribution in the repository

Specified by:
updateContribution in interface ContributionRepository
Parameters:
contribution - The contribution to update

getContribution

public Contribution getContribution(java.lang.String uri)
Description copied from interface: ContributionRepository
Returns the contribution with the given URI.

Specified by:
getContribution in interface ContributionRepository
Parameters:
uri - the URI of the contribution
Returns:
The contribution

getContributions

public java.util.List<Contribution> getContributions()
Description copied from interface: ContributionRepository
Returns the contributions available in the repository.

Specified by:
getContributions in interface ContributionRepository
Returns:
The list of contributions.