org.modeshape.web.jcr.rest.client
Interface IRestClient

All Known Implementing Classes:
JsonRestClient

public interface IRestClient

The IRestClient interface is the API for all REST clients used by the Eclipse ModeShape plugin.


Method Summary
 Collection<Repository> getRepositories(Server server)
          Obtains the ModeShape repositories defined within the specified server.
 URL getUrl(File file, String path, Workspace workspace)
           
 Collection<Workspace> getWorkspaces(Repository repository)
          Obtains the workspaces defined within the specified ModeShape respository.
 Status publish(Workspace workspace, String path, File file)
          Publishes, or uploads, a local file to the workspace at the specified path.
 List<QueryRow> query(Workspace workspace, String language, String statement)
          Executes the given query in the workspace.
 List<QueryRow> query(Workspace workspace, String language, String statement, int offset, int limit)
          Executes the given query in the workspace.
 Status unpublish(Workspace workspace, String path, File file)
          Unpublishes, or deletes, the resource at the specified path in the workspace.
 

Method Detail

getRepositories

Collection<Repository> getRepositories(Server server)
                                       throws Exception
Obtains the ModeShape repositories defined within the specified server.

Parameters:
server - the server whose repositories are being requested (never null)
Returns:
the repositories within the specified server (never null)
Throws:
Exception - if there is a problem obtaining the repositories

getUrl

URL getUrl(File file,
           String path,
           Workspace workspace)
           throws Exception
Parameters:
file - the file whose URL is being requested (never null)
path - the path in the ModeShape workspace where the file is/could be located (never null)
workspace - the workspace where the file is/could be located (never null)
Returns:
the workspace URL for the specified file (never null)
Throws:
Exception - if there is a problem obtaining the URL or if the file is a directory

getWorkspaces

Collection<Workspace> getWorkspaces(Repository repository)
                                    throws Exception
Obtains the workspaces defined within the specified ModeShape respository.

Parameters:
repository - the repository whose workspaces are being requested (never null)
Returns:
the workspaces within the specified repository (never null)
Throws:
Exception - if there is a problem obtaining the workspaces

publish

Status publish(Workspace workspace,
               String path,
               File file)
Publishes, or uploads, a local file to the workspace at the specified path.

Parameters:
workspace - the workspace where the resource will be published (never null)
path - the unencoded path to the folder where the file will be published (never null)
file - the resource being published (never null)
Returns:
a status of the publishing operation outcome (never null)

unpublish

Status unpublish(Workspace workspace,
                 String path,
                 File file)
Unpublishes, or deletes, the resource at the specified path in the workspace. If a file being unpublished is not found in the workspace an info status is returned.

Parameters:
workspace - the workspace where the resource will be unpublished (never null)
path - the unencoded path to the folder where the file is published (never null)
file - the file being unpublished (never null)
Returns:
a status of the unpublishing operation outcome (never null)

query

List<QueryRow> query(Workspace workspace,
                     String language,
                     String statement)
                     throws Exception
Executes the given query in the workspace.

Parameters:
workspace - the workspace where the resource will be unpublished (never null)
language - the JCR query language to use (never null)
statement - the query itself (never null)
Returns:
the list of rows returned by the query (never null)
Throws:
Exception - if there is a problem obtaining the workspaces

query

List<QueryRow> query(Workspace workspace,
                     String language,
                     String statement,
                     int offset,
                     int limit)
                     throws Exception
Executes the given query in the workspace.

Parameters:
workspace - the workspace where the resource will be unpublished (never null)
language - the JCR query language to use (never null)
statement - the query itself (never null)
offset - the first row to be returned; if this value is negative, rows are returned starting with the first row
limit - the maximum number of rows to be returned; if this value is negative, all rows are returned
Returns:
the list of rows returned by the query (never null)
Throws:
Exception - if there is a problem obtaining the workspaces


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.