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
 InputStream getArtifactContent(ArtifactType artifactType, String artifactUuid)
          Please see javadoc in getArtifactContent(String, String, String).
 InputStream getArtifactContent(String artifactModel, String 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)
          Please see javadoc in getFullArtifactEntry(String, String, String).
 org.jboss.resteasy.plugins.providers.atom.Entry getFullArtifactEntry(String artifactModel, String 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, int page, int pageSize, String orderBy, boolean ascending)
          Executes the given s-ramp query xpath and returns a Feed of the matching artifacts.
 org.jboss.resteasy.plugins.providers.atom.Entry uploadArtifact(ArtifactType artifactType, InputStream content, String artifactFileName)
          Please refer to javadoc in uploadArtifact(String, String, InputStream, String)
 org.jboss.resteasy.plugins.providers.atom.Entry uploadArtifact(String artifactModel, String artifactType, InputStream content, String artifactFileName)
          Uploads an artifact to the s-ramp repository.
 
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(String artifactModel,
                                                                            String artifactType,
                                                                            String artifactUuid)
                                                                     throws SrampClientException,
                                                                            SrampServerException
Gets an Atom Entry for the given S-RAMP artifact by UUID.

Parameters:
artifactModel - the artifact model (core, xsd, wsdl, etc)
artifactType - the artifact type (XmlDocument, XsdDocument, etc)
artifactUuid - the S-RAMP uuid of the artifact
Returns:
an Atom Entry
Throws:
SrampClientException
SrampServerException

getFullArtifactEntry

public org.jboss.resteasy.plugins.providers.atom.Entry getFullArtifactEntry(ArtifactType artifactType,
                                                                            String artifactUuid)
                                                                     throws SrampClientException,
                                                                            SrampServerException
Please see javadoc in getFullArtifactEntry(String, String, String).

Parameters:
artifactType -
artifactUuid -
Throws:
SrampClientException
SrampServerException

getArtifactContent

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

Parameters:
artifactModel - the artifact model (core, xsd, wsdl, etc)
artifactType - the artifact type (XmlDocument, XsdDocument, etc)
artifactUuid - the S-RAMP uuid of the artifact
Returns:
an InputStream to the S-RAMP artifact content
Throws:
SrampClientException
SrampServerException

getArtifactContent

public InputStream getArtifactContent(ArtifactType artifactType,
                                      String artifactUuid)
                               throws SrampClientException,
                                      SrampServerException
Please see javadoc in getArtifactContent(String, String, String).

Parameters:
artifactType -
artifactUuid -
Throws:
SrampClientException
SrampServerException

uploadArtifact

public org.jboss.resteasy.plugins.providers.atom.Entry uploadArtifact(String artifactModel,
                                                                      String artifactType,
                                                                      InputStream content,
                                                                      String artifactFileName)
                                                               throws SrampClientException,
                                                                      SrampServerException
Uploads an artifact to the s-ramp repository.

Parameters:
artifactModel - the new artifact's model
artifactType - the new artifact's type
content - the byte content of the artifact
artifactFileName - the file name of the artifact (optional, can be null)
Returns:
an Atom entry representing the new artifact in the s-ramp repository
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 uploadArtifact(String, String, InputStream, String)

Parameters:
artifactType -
content -
artifactFileName -
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.