org.overlord.sramp.client
Class SrampAtomApiClient

java.lang.Object
  extended by org.overlord.sramp.client.SrampAtomApiClient

public class SrampAtomApiClient
extends Object

Class used to communicate with the S-RAMP server.

Author:
eric.wittmann@redhat.com

Constructor Summary
SrampAtomApiClient(String endpoint)
          Constructor.
 
Method Summary
 void deleteArtifact(String uuid, ArtifactType type)
          Delets an artifact from the s-ramp repository.
 InputStream getArtifactContent(ArtifactType artifactType, String artifactUuid)
          Gets the content for an artifact as an input stream.
 org.jboss.resteasy.plugins.providers.atom.Entry getFullArtifactEntry(ArtifactType artifactType, String artifactUuid)
          Gets an Atom Entry for the given S-RAMP artifact by UUID.
 org.jboss.resteasy.plugins.providers.atom.Feed query(String srampQuery)
          Provides a very simple mechanism for querying.
 org.jboss.resteasy.plugins.providers.atom.Feed query(String srampQuery, int page, int pageSize, String orderBy, boolean ascending)
          Executes the given s-ramp query xpath and returns a Feed of the matching artifacts.
 void updateArtifact(BaseArtifactType artifact, InputStream content)
          Updates the content of the artifact.
 void updateArtifactMetaData(BaseArtifactType artifact)
          Called to update the meta-data stored in the s-ramp repository for the given s-ramp artifact.
 org.jboss.resteasy.plugins.providers.atom.Entry uploadArtifact(ArtifactType artifactType, InputStream content, String artifactFileName)
          Please refer to javadoc in SrampAtomApiClient#uploadArtifact(String, String, InputStream, String)
 Map<String,?> uploadBatch(SrampArchive archive)
          Performs a batch operation by uploading an s-ramp package archive to the s-ramp server for processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SrampAtomApiClient

public SrampAtomApiClient(String endpoint)
Constructor.

Parameters:
endpoint -
Method Detail

getFullArtifactEntry

public org.jboss.resteasy.plugins.providers.atom.Entry getFullArtifactEntry(ArtifactType artifactType,
                                                                            String artifactUuid)
                                                                     throws SrampClientException,
                                                                            SrampServerException
Gets an Atom Entry for the given S-RAMP artifact by UUID.

Parameters:
artifactType -
artifactUuid -
Throws:
SrampClientException
SrampServerException

getArtifactContent

public InputStream getArtifactContent(ArtifactType artifactType,
                                      String artifactUuid)
                               throws SrampClientException,
                                      SrampServerException
Gets the content for an artifact as an input stream. The caller must close the resulting

Parameters:
artifactType - the artifact type
artifactUuid - the S-RAMP uuid of the artifact
Returns:
an InputStream to the S-RAMP artifact content
Throws:
SrampClientException
SrampServerException

uploadArtifact

public org.jboss.resteasy.plugins.providers.atom.Entry uploadArtifact(ArtifactType artifactType,
                                                                      InputStream content,
                                                                      String artifactFileName)
                                                               throws SrampClientException,
                                                                      SrampServerException
Please refer to javadoc in SrampAtomApiClient#uploadArtifact(String, String, InputStream, String)

Parameters:
artifactType -
content -
artifactFileName -
Throws:
SrampClientException
SrampServerException

uploadBatch

public Map<String,?> uploadBatch(SrampArchive archive)
                          throws SrampClientException,
                                 SrampServerException
Performs a batch operation by uploading an s-ramp package archive to the s-ramp server for processing. The contents of the s-ramp archive will be processed, and the results will be returned as a Map. The Map is indexed by the S-RAMP Archive entry path, and each each value in the Map will either be a BaseArtifactType or an SrampServerException, depending on success vs. failure of that entry.

Parameters:
archive - the s-ramp package archive to upload
Returns:
the collection of results (one per entry in the s-ramp package)
Throws:
SrampClientException
SrampServerException

updateArtifactMetaData

public void updateArtifactMetaData(BaseArtifactType artifact)
                            throws SrampClientException
Called to update the meta-data stored in the s-ramp repository for the given s-ramp artifact.

Parameters:
artifact -
Throws:
SrampClientException

updateArtifact

public void updateArtifact(BaseArtifactType artifact,
                           InputStream content)
                    throws SrampClientException
Updates the content of the artifact.

Parameters:
artifactType -
uuid -
content -
Throws:
SrampClientException

deleteArtifact

public void deleteArtifact(String uuid,
                           ArtifactType type)
                    throws SrampClientException,
                           SrampServerException
Delets an artifact from the s-ramp repository.

Parameters:
uuid -
type -
Throws:
SrampClientException
SrampServerException

query

public org.jboss.resteasy.plugins.providers.atom.Feed query(String srampQuery)
                                                     throws SrampClientException,
                                                            SrampServerException
Provides a very simple mechanism for querying. Defaults many of the parameters.

Parameters:
srampQuery - the s-ramp query (xpath formatted)
Throws:
SrampClientException
SrampServerException

query

public org.jboss.resteasy.plugins.providers.atom.Feed query(String srampQuery,
                                                            int page,
                                                            int pageSize,
                                                            String orderBy,
                                                            boolean ascending)
                                                     throws SrampClientException,
                                                            SrampServerException
Executes the given s-ramp query xpath and returns a Feed of the matching artifacts.

Parameters:
srampQuery - the s-ramp query (xpath formatted)
page - which page of results to return (0 indexed)
pageSize - the size of the page of results to return
orderBy - the s-ramp property to use for sorting (name, uuid, createdOn, etc)
ascending - the direction of the sort
Returns:
an Atom Feed
Throws:
SrampClientException
SrampServerException


Copyright © 2011-2012 JBoss, a division of Red Hat. All Rights Reserved.