org.apache.chemistry.opencmis.client.bindings.spi.atompub
Class AbstractAtomPubService

java.lang.Object
  extended by org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService
All Implemented Interfaces:
LinkAccess
Direct Known Subclasses:
AclServiceImpl, DiscoveryServiceImpl, MultiFilingServiceImpl, NavigationServiceImpl, ObjectServiceImpl, PolicyServiceImpl, RelationshipServiceImpl, RepositoryServiceImpl, VersioningServiceImpl

public class AbstractAtomPubService
extends java.lang.Object
implements LinkAccess

Base class for all AtomPub clients.


Nested Class Summary
protected static class AbstractAtomPubService.IdentifierType
           
 
Field Summary
protected static java.lang.String NAME_COLLECTION
           
protected static java.lang.String NAME_NUM_ITEMS
           
protected static java.lang.String NAME_PATH_SEGMENT
           
protected static java.lang.String NAME_RELATIVE_PATH_SEGMENT
           
protected static java.lang.String NAME_URI_TEMPLATE
           
 
Constructor Summary
AbstractAtomPubService()
           
 
Method Summary
protected  void addCollection(java.lang.String repositoryId, java.lang.String collection, java.lang.String link)
          Adds a collection to the cache.
protected  void addLink(java.lang.String repositoryId, java.lang.String id, AtomLink link)
          Adds a link to the cache.
protected  void addLink(java.lang.String repositoryId, java.lang.String id, java.lang.String rel, java.lang.String type, java.lang.String link)
          Adds a link to the cache.
protected  void addRepositoryLink(java.lang.String repositoryId, AtomLink link)
          Adds a repository link to the cache.
protected  void addRepositoryLink(java.lang.String repositoryId, java.lang.String rel, java.lang.String link)
          Adds a repository link to the cache.
protected  void addTemplate(java.lang.String repositoryId, java.lang.String type, java.lang.String link)
          Adds an URI template to the cache.
protected  void addTypeLink(java.lang.String repositoryId, java.lang.String typeId, AtomLink link)
          Adds a type link to the cache.
protected  void addTypeLink(java.lang.String repositoryId, java.lang.String typeId, java.lang.String rel, java.lang.String type, java.lang.String link)
          Adds a type link to the cache.
protected  CmisBaseException convertStatusCode(int code, java.lang.String message, java.lang.String errorContent, java.lang.Throwable t)
          Converts a HTTP status code into an Exception.
protected  CmisObjectType createIdObject(java.lang.String objectId)
          Creates a CMIS object that only contains an id in the property list.
protected  void delete(UrlBuilder url)
          Performs a DELETE on an URL, checks the response code and returns the result.
protected  java.lang.String extractErrorMessage(java.lang.String message, java.lang.String errorContent)
           
protected  java.lang.String extractException(java.lang.String errorContent)
           
protected  java.lang.String getCollection(java.lang.String repositoryId, java.lang.String collection)
          Gets a collection from the cache.
protected  java.lang.String getLink(java.lang.String repositoryId, java.lang.String id, java.lang.String rel)
          Gets a link from the cache.
protected  java.lang.String getLink(java.lang.String repositoryId, java.lang.String id, java.lang.String rel, java.lang.String type)
          Gets a link from the cache.
protected  LinkCache getLinkCache()
          Returns the link cache or creates a new cache if it doesn't exist.
protected  ObjectData getObjectInternal(java.lang.String repositoryId, AbstractAtomPubService.IdentifierType idOrPath, java.lang.String objectIdOrPath, ReturnVersion returnVersion, java.lang.String filter, java.lang.Boolean includeAllowableActions, IncludeRelationships includeRelationships, java.lang.String renditionFilter, java.lang.Boolean includePolicyIds, java.lang.Boolean includeAcl, ExtensionsData extension)
          Retrieves an object from the server and caches the links.
protected  java.util.List<RepositoryInfo> getRepositoriesInternal(java.lang.String repositoryId)
          Retrieves the Service Document from the server and caches the repository info objects, collections, links, URI templates, etc.
protected  java.lang.String getRepositoryLink(java.lang.String repositoryId, java.lang.String rel)
          Gets a repository link from the cache.
protected  java.lang.String getServiceDocURL()
          Returns the service document URL of this session.
protected  BindingSession getSession()
          Gets the current session.
protected  java.lang.String getTemplateLink(java.lang.String repositoryId, java.lang.String type, java.util.Map<java.lang.String,java.lang.Object> parameters)
          Gets an URI template from the cache.
protected  TypeDefinition getTypeDefinitionInternal(java.lang.String repositoryId, java.lang.String typeId)
          Retrieves a type definition.
protected  java.lang.String getTypeLink(java.lang.String repositoryId, java.lang.String typeId, java.lang.String rel)
          Gets a type link from the cache.
protected  java.lang.String getTypeLink(java.lang.String repositoryId, java.lang.String typeId, java.lang.String rel, java.lang.String type)
          Gets a type link from the cache.
protected  boolean is(java.lang.String name, AtomElement element)
           
protected  boolean isAclMergeRequired(Acl addAces, Acl removeAces)
          Checks if at least one ACE list is not empty.
protected  boolean isInt(java.lang.String name, AtomElement element)
           
protected  boolean isNextLink(AtomElement element)
           
protected  boolean isStr(java.lang.String name, AtomElement element)
           
protected  java.lang.String loadCollection(java.lang.String repositoryId, java.lang.String collection)
          Gets a collection from the cache if it is there or loads it into the cache if it is not there.
 java.lang.String loadContentLink(java.lang.String repositoryId, java.lang.String id)
          Gets the content link from the cache if it is there or loads it into the cache if it is not there.
 java.lang.String loadLink(java.lang.String repositoryId, java.lang.String id, java.lang.String rel, java.lang.String type)
          Gets a link from the cache if it is there or loads it into the cache if it is not there.
protected  java.lang.String loadRepositoryLink(java.lang.String repositoryId, java.lang.String rel)
          Gets a repository link from the cache if it is there or loads it into the cache if it is not there.
protected  java.lang.String loadTemplateLink(java.lang.String repositoryId, java.lang.String type, java.util.Map<java.lang.String,java.lang.Object> parameters)
          Gets a template link from the cache if it is there or loads it into the cache if it is not there.
protected  java.lang.String loadTypeLink(java.lang.String repositoryId, java.lang.String typeId, java.lang.String rel, java.lang.String type)
          Gets a link from the cache if it is there or loads it into the cache if it is not there.
protected  void lockLinks()
          Locks the link cache.
protected  void lockTypeLinks()
          Locks the type link cache.
protected  Acl mergeAcls(Acl originalAces, Acl addAces, Acl removeAces)
          Merges the new ACL from original, add and remove ACEs lists.
protected
<T extends AtomBase>
T
parse(java.io.InputStream stream, java.lang.Class<T> clazz)
          Parses an input stream.
protected  HttpUtils.Response post(UrlBuilder url, java.lang.String contentType, HttpUtils.Output writer)
          Performs a POST on an URL, checks the response code and returns the result.
protected  HttpUtils.Response put(UrlBuilder url, java.lang.String contentType, HttpUtils.Output writer)
          Performs a PUT on an URL, checks the response code and returns the result.
protected  HttpUtils.Response put(UrlBuilder url, java.lang.String contentType, java.util.Map<java.lang.String,java.lang.String> headers, HttpUtils.Output writer)
          Performs a PUT on an URL, checks the response code and returns the result.
protected  HttpUtils.Response read(UrlBuilder url)
          Performs a GET on an URL, checks the response code and returns the result.
protected  void removeLinks(java.lang.String repositoryId, java.lang.String id)
          Removes all links of an object.
protected  void removeTypeLinks(java.lang.String repositoryId, java.lang.String id)
          Removes all links of a type.
protected  void setSession(BindingSession session)
          Sets the current session.
protected  void throwLinkException(java.lang.String repositoryId, java.lang.String id, java.lang.String rel, java.lang.String type)
          Checks a link throw an appropriate exception.
protected  void unlockLinks()
          Unlocks the link cache.
protected  void unlockTypeLinks()
          Unlocks the type link cache.
protected  AtomAcl updateAcl(java.lang.String repositoryId, java.lang.String objectId, Acl acl, AclPropagation aclPropagation)
          Updates the ACL of an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_COLLECTION

protected static final java.lang.String NAME_COLLECTION
See Also:
Constant Field Values

NAME_URI_TEMPLATE

protected static final java.lang.String NAME_URI_TEMPLATE
See Also:
Constant Field Values

NAME_PATH_SEGMENT

protected static final java.lang.String NAME_PATH_SEGMENT
See Also:
Constant Field Values

NAME_RELATIVE_PATH_SEGMENT

protected static final java.lang.String NAME_RELATIVE_PATH_SEGMENT
See Also:
Constant Field Values

NAME_NUM_ITEMS

protected static final java.lang.String NAME_NUM_ITEMS
See Also:
Constant Field Values
Constructor Detail

AbstractAtomPubService

public AbstractAtomPubService()
Method Detail

setSession

protected void setSession(BindingSession session)
Sets the current session.


getSession

protected BindingSession getSession()
Gets the current session.


getServiceDocURL

protected java.lang.String getServiceDocURL()
Returns the service document URL of this session.


getLinkCache

protected LinkCache getLinkCache()
Returns the link cache or creates a new cache if it doesn't exist.


getLink

protected java.lang.String getLink(java.lang.String repositoryId,
                                   java.lang.String id,
                                   java.lang.String rel,
                                   java.lang.String type)
Gets a link from the cache.


getLink

protected java.lang.String getLink(java.lang.String repositoryId,
                                   java.lang.String id,
                                   java.lang.String rel)
Gets a link from the cache.


loadLink

public java.lang.String loadLink(java.lang.String repositoryId,
                                 java.lang.String id,
                                 java.lang.String rel,
                                 java.lang.String type)
Gets a link from the cache if it is there or loads it into the cache if it is not there.

Specified by:
loadLink in interface LinkAccess

loadContentLink

public java.lang.String loadContentLink(java.lang.String repositoryId,
                                        java.lang.String id)
Gets the content link from the cache if it is there or loads it into the cache if it is not there.

Specified by:
loadContentLink in interface LinkAccess

addLink

protected void addLink(java.lang.String repositoryId,
                       java.lang.String id,
                       java.lang.String rel,
                       java.lang.String type,
                       java.lang.String link)
Adds a link to the cache.


addLink

protected void addLink(java.lang.String repositoryId,
                       java.lang.String id,
                       AtomLink link)
Adds a link to the cache.


removeLinks

protected void removeLinks(java.lang.String repositoryId,
                           java.lang.String id)
Removes all links of an object.


lockLinks

protected void lockLinks()
Locks the link cache.


unlockLinks

protected void unlockLinks()
Unlocks the link cache.


throwLinkException

protected void throwLinkException(java.lang.String repositoryId,
                                  java.lang.String id,
                                  java.lang.String rel,
                                  java.lang.String type)
Checks a link throw an appropriate exception.


getTypeLink

protected java.lang.String getTypeLink(java.lang.String repositoryId,
                                       java.lang.String typeId,
                                       java.lang.String rel,
                                       java.lang.String type)
Gets a type link from the cache.


getTypeLink

protected java.lang.String getTypeLink(java.lang.String repositoryId,
                                       java.lang.String typeId,
                                       java.lang.String rel)
Gets a type link from the cache.


loadTypeLink

protected java.lang.String loadTypeLink(java.lang.String repositoryId,
                                        java.lang.String typeId,
                                        java.lang.String rel,
                                        java.lang.String type)
Gets a link from the cache if it is there or loads it into the cache if it is not there.


addTypeLink

protected void addTypeLink(java.lang.String repositoryId,
                           java.lang.String typeId,
                           java.lang.String rel,
                           java.lang.String type,
                           java.lang.String link)
Adds a type link to the cache.


addTypeLink

protected void addTypeLink(java.lang.String repositoryId,
                           java.lang.String typeId,
                           AtomLink link)
Adds a type link to the cache.


removeTypeLinks

protected void removeTypeLinks(java.lang.String repositoryId,
                               java.lang.String id)
Removes all links of a type.


lockTypeLinks

protected void lockTypeLinks()
Locks the type link cache.


unlockTypeLinks

protected void unlockTypeLinks()
Unlocks the type link cache.


getCollection

protected java.lang.String getCollection(java.lang.String repositoryId,
                                         java.lang.String collection)
Gets a collection from the cache.


loadCollection

protected java.lang.String loadCollection(java.lang.String repositoryId,
                                          java.lang.String collection)
Gets a collection from the cache if it is there or loads it into the cache if it is not there.


addCollection

protected void addCollection(java.lang.String repositoryId,
                             java.lang.String collection,
                             java.lang.String link)
Adds a collection to the cache.


getRepositoryLink

protected java.lang.String getRepositoryLink(java.lang.String repositoryId,
                                             java.lang.String rel)
Gets a repository link from the cache.


loadRepositoryLink

protected java.lang.String loadRepositoryLink(java.lang.String repositoryId,
                                              java.lang.String rel)
Gets a repository link from the cache if it is there or loads it into the cache if it is not there.


addRepositoryLink

protected void addRepositoryLink(java.lang.String repositoryId,
                                 java.lang.String rel,
                                 java.lang.String link)
Adds a repository link to the cache.


addRepositoryLink

protected void addRepositoryLink(java.lang.String repositoryId,
                                 AtomLink link)
Adds a repository link to the cache.


getTemplateLink

protected java.lang.String getTemplateLink(java.lang.String repositoryId,
                                           java.lang.String type,
                                           java.util.Map<java.lang.String,java.lang.Object> parameters)
Gets an URI template from the cache.


loadTemplateLink

protected java.lang.String loadTemplateLink(java.lang.String repositoryId,
                                            java.lang.String type,
                                            java.util.Map<java.lang.String,java.lang.Object> parameters)
Gets a template link from the cache if it is there or loads it into the cache if it is not there.


addTemplate

protected void addTemplate(java.lang.String repositoryId,
                           java.lang.String type,
                           java.lang.String link)
Adds an URI template to the cache.


convertStatusCode

protected CmisBaseException convertStatusCode(int code,
                                              java.lang.String message,
                                              java.lang.String errorContent,
                                              java.lang.Throwable t)
Converts a HTTP status code into an Exception.


extractException

protected java.lang.String extractException(java.lang.String errorContent)

extractErrorMessage

protected java.lang.String extractErrorMessage(java.lang.String message,
                                               java.lang.String errorContent)

is

protected boolean is(java.lang.String name,
                     AtomElement element)

isStr

protected boolean isStr(java.lang.String name,
                        AtomElement element)

isInt

protected boolean isInt(java.lang.String name,
                        AtomElement element)

isNextLink

protected boolean isNextLink(AtomElement element)

createIdObject

protected CmisObjectType createIdObject(java.lang.String objectId)
Creates a CMIS object that only contains an id in the property list.


parse

protected <T extends AtomBase> T parse(java.io.InputStream stream,
                                       java.lang.Class<T> clazz)
Parses an input stream.


read

protected HttpUtils.Response read(UrlBuilder url)
Performs a GET on an URL, checks the response code and returns the result.


post

protected HttpUtils.Response post(UrlBuilder url,
                                  java.lang.String contentType,
                                  HttpUtils.Output writer)
Performs a POST on an URL, checks the response code and returns the result.


put

protected HttpUtils.Response put(UrlBuilder url,
                                 java.lang.String contentType,
                                 HttpUtils.Output writer)
Performs a PUT on an URL, checks the response code and returns the result.


put

protected HttpUtils.Response put(UrlBuilder url,
                                 java.lang.String contentType,
                                 java.util.Map<java.lang.String,java.lang.String> headers,
                                 HttpUtils.Output writer)
Performs a PUT on an URL, checks the response code and returns the result.


delete

protected void delete(UrlBuilder url)
Performs a DELETE on an URL, checks the response code and returns the result.


isAclMergeRequired

protected boolean isAclMergeRequired(Acl addAces,
                                     Acl removeAces)
Checks if at least one ACE list is not empty.


mergeAcls

protected Acl mergeAcls(Acl originalAces,
                        Acl addAces,
                        Acl removeAces)
Merges the new ACL from original, add and remove ACEs lists.


getRepositoriesInternal

protected java.util.List<RepositoryInfo> getRepositoriesInternal(java.lang.String repositoryId)
Retrieves the Service Document from the server and caches the repository info objects, collections, links, URI templates, etc.


getObjectInternal

protected ObjectData getObjectInternal(java.lang.String repositoryId,
                                       AbstractAtomPubService.IdentifierType idOrPath,
                                       java.lang.String objectIdOrPath,
                                       ReturnVersion returnVersion,
                                       java.lang.String filter,
                                       java.lang.Boolean includeAllowableActions,
                                       IncludeRelationships includeRelationships,
                                       java.lang.String renditionFilter,
                                       java.lang.Boolean includePolicyIds,
                                       java.lang.Boolean includeAcl,
                                       ExtensionsData extension)
Retrieves an object from the server and caches the links.


getTypeDefinitionInternal

protected TypeDefinition getTypeDefinitionInternal(java.lang.String repositoryId,
                                                   java.lang.String typeId)
Retrieves a type definition.


updateAcl

protected AtomAcl updateAcl(java.lang.String repositoryId,
                            java.lang.String objectId,
                            Acl acl,
                            AclPropagation aclPropagation)
Updates the ACL of an object.



Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.