org.apache.portals.graffito.persistence
Interface ContentPersistenceService

All Known Implementing Classes:
ContentPersistenceServiceImpl

public interface ContentPersistenceService

Cms Persistence Service. The persistenceService service manages a set of content stores and dispatch all requests to thoses stores. By default, there is a Master Graffito Store and different content stores. The Master Graffito Store contains all content stores references and if needed some cms objects like documents & folders. When a service like the ContentModelService send a request to do on a cms object, the persistenceService service try to find the correct content store and send it the request.

Author:
Lombart Christophe

Field Summary
static java.lang.String CONTENT
          Content Interface name - use to instantiate CmsOjbect
static java.lang.String DOCUMENT
          Content Interface name - use to instantiate CmsOjbect
static java.lang.String FILE_SYSTEM_SERVER
          File System Store Interface name - use to instantiate FileSystem Server reference
static java.lang.String FOLDER
          Folder Interface name - use to instantiate CmsOjbect
static java.lang.String GRAFFITO_SERVER
          Graffito Store Interface name - use to instantiate GraffitoServer reference
static java.lang.String HISTPORY
          Hisotry Interface name - use to instantiate a version history element
static java.lang.String LINK
          Link Interface name - use to instantiate CmsOjbect
static java.lang.String VERSIONNED_CONTENT
          Content Interface name - use to instantiate CmsOjbect
static java.lang.String WEBDAV_SERVER
          Webdav Server Interface name - use to instantiate Webdav server reference
 
Method Summary
 java.lang.Object createObject(java.lang.String objectName)
          Factory method to create cms objects.
 void delete(java.lang.Object object)
          Delete any kind of object from a persistenceService store (CmsObject, Server, ...) .
 void delete(java.lang.String cmsObjectUri)
          Delete a CmsObject
 void deleteAll(java.lang.Class clazz, org.apache.portals.graffito.services.search.Filter filter)
          Delete several objects from a persistenceService store.
 java.util.Collection getChildren(java.lang.String uri)
          Get all cms objects (documents & folders) found in an parent uri.
 org.apache.portals.graffito.model.core.CmsObject getCmsObject(java.lang.String uri)
          Get a cms object from the persistent store depending on an uri.
 org.apache.portals.graffito.model.core.CmsObject getCmsObject(java.lang.String uri, java.lang.String versionNum)
          Get a cms object from the persistent store depending on an uri and a version number.
 java.util.Collection getCollectionByQuery(java.lang.Class clazz, org.apache.portals.graffito.services.search.Filter filter)
          Get a collection of objects (CmsObject, Server, HistoryElement, ...) from the persistenceService store.
 java.util.Collection getContents(java.lang.String uri)
          Get contents found in a parent uri.
 java.util.Collection getFolders(java.lang.String uri)
          Get folders found in a parent uri.
 ContentStore getGraffitoMasterStore()
          Get a persistenceService store associated to a scope.
 org.apache.portals.graffito.model.core.HistoryElement getHistory(org.apache.portals.graffito.model.core.VersionnedContent versionnedContent)
          Get the version history element defined from a versionned content.
 java.util.Iterator getIteratorByQuery(java.lang.Class clazz, org.apache.portals.graffito.services.search.Filter filter)
          Get an iterator of objects (CmsObject, Server, HistoryElement, ...) from the persistenceService store.
 java.util.Collection getLinks(java.lang.String uri)
          Get links found in a parent uri.
 java.lang.Object getObjectbyQuery(java.lang.Class clazz, org.apache.portals.graffito.services.search.Filter filter)
          Get a cms related object from the persistent store (can be a document, a folder or Server, ...).
 org.apache.portals.graffito.model.server.Server getServer(java.lang.String scope)
          Get a server reference based on the scope
 java.util.Collection getServers(boolean withMasterServer)
          Get all registered servers
 ContentStore getStore(java.lang.String scope)
          Get a content store associated to a scope.
 void insert(java.lang.Object object)
          Insert any kind of object (CmsObject, Server, HistoryElement, ...)
 void insertHistoryElement(org.apache.portals.graffito.model.core.HistoryElement historyElement)
          Add a new history element
 org.apache.portals.graffito.services.search.Filter newFilter()
          Instantiate a new filter object.
 void registerServer(org.apache.portals.graffito.model.server.Server server)
          Add a new Server reference into the content tree.
 void unRegisterServer(org.apache.portals.graffito.model.server.Server server)
          Drop a server from the content tree
 void update(java.lang.Object object)
          Update any kind of object (CmsObject, Server, HistoryElement, ...)
 

Field Detail

FOLDER

static final java.lang.String FOLDER
Folder Interface name - use to instantiate CmsOjbect

See Also:
Constant Field Values

CONTENT

static final java.lang.String CONTENT
Content Interface name - use to instantiate CmsOjbect

See Also:
Constant Field Values

VERSIONNED_CONTENT

static final java.lang.String VERSIONNED_CONTENT
Content Interface name - use to instantiate CmsOjbect

See Also:
Constant Field Values

DOCUMENT

static final java.lang.String DOCUMENT
Content Interface name - use to instantiate CmsOjbect

See Also:
Constant Field Values

HISTPORY

static final java.lang.String HISTPORY
Hisotry Interface name - use to instantiate a version history element

See Also:
Constant Field Values

LINK

static final java.lang.String LINK
Link Interface name - use to instantiate CmsOjbect

See Also:
Constant Field Values

WEBDAV_SERVER

static final java.lang.String WEBDAV_SERVER
Webdav Server Interface name - use to instantiate Webdav server reference

See Also:
Constant Field Values

GRAFFITO_SERVER

static final java.lang.String GRAFFITO_SERVER
Graffito Store Interface name - use to instantiate GraffitoServer reference

See Also:
Constant Field Values

FILE_SYSTEM_SERVER

static final java.lang.String FILE_SYSTEM_SERVER
File System Store Interface name - use to instantiate FileSystem Server reference

See Also:
Constant Field Values
Method Detail

createObject

java.lang.Object createObject(java.lang.String objectName)
                              throws org.apache.portals.graffito.exception.CmsInstantiateException
Factory method to create cms objects. It is a generic factory used to create all CMS related objects like Document, Folder but also Server, HistoryElement, ... .

Parameters:
objectName - The object interface name
Returns:
a new instantiated cms object
Throws:
org.apache.portals.graffito.exception.CmsInstantiateException - when the cms object instance can't be created

insert

void insert(java.lang.Object object)
            throws ContentPersistenceException,
                   org.apache.portals.graffito.exception.CmsPermissionException
Insert any kind of object (CmsObject, Server, HistoryElement, ...)

Parameters:
object - The object to be inserted
Throws:
ContentPersistenceException - when it is not possible to insert the object
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

update

void update(java.lang.Object object)
            throws ContentPersistenceException,
                   org.apache.portals.graffito.exception.CmsPermissionException
Update any kind of object (CmsObject, Server, HistoryElement, ...)

Parameters:
object - The object to be updated.
Throws:
ContentPersistenceException - when it is not possible to insert the object
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

delete

void delete(java.lang.Object object)
            throws ContentPersistenceException,
                   org.apache.portals.graffito.exception.CmsPermissionException
Delete any kind of object from a persistenceService store (CmsObject, Server, ...) .

Parameters:
object - the object to be delete
Throws:
ContentPersistenceException - unknown object or system error
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

delete

void delete(java.lang.String cmsObjectUri)
            throws ContentPersistenceException,
                   org.apache.portals.graffito.exception.CmsPermissionException
Delete a CmsObject

Parameters:
cmsObjectUri - The uri of the cms object to delete
Throws:
ContentPersistenceException - unknown object or system error
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

deleteAll

void deleteAll(java.lang.Class clazz,
               org.apache.portals.graffito.services.search.Filter filter)
               throws ContentPersistenceException,
                      org.apache.portals.graffito.exception.CmsPermissionException
Delete several objects from a persistenceService store.

Parameters:
clazz - The class on wich the filter has to be executed
filter - Filter used to select the object to delete
Throws:
ContentPersistenceException - unknown object or system error
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

newFilter

org.apache.portals.graffito.services.search.Filter newFilter()
Instantiate a new filter object. This filter is store independant.

Returns:
a new filter object

getObjectbyQuery

java.lang.Object getObjectbyQuery(java.lang.Class clazz,
                                  org.apache.portals.graffito.services.search.Filter filter)
                                  throws ContentPersistenceException,
                                         org.apache.portals.graffito.exception.CmsPermissionException
Get a cms related object from the persistent store (can be a document, a folder or Server, ...).

Parameters:
clazz - Class or interface used for the filter. Represent the extend to be search
filter - used to retrieve the cms object.The criteria should provide only one object
Returns:
object the object to be retrieved
Throws:
ContentPersistenceException - when it is not possible to find the associated store
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

getCmsObject

org.apache.portals.graffito.model.core.CmsObject getCmsObject(java.lang.String uri)
                                                              throws ContentPersistenceException,
                                                                     org.apache.portals.graffito.exception.CmsPermissionException
Get a cms object from the persistent store depending on an uri. If the cms object is a document, this method returns the lastest

Parameters:
uri - Object uri
Returns:
the object found or null
Throws:
ContentPersistenceException - when it is not possible to find the associated store
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

getCmsObject

org.apache.portals.graffito.model.core.CmsObject getCmsObject(java.lang.String uri,
                                                              java.lang.String versionNum)
                                                              throws ContentPersistenceException,
                                                                     org.apache.portals.graffito.exception.CmsPermissionException
Get a cms object from the persistent store depending on an uri and a version number. If the cms object is a document, this method returns the lastest

Parameters:
uri - object uri
versionNum - The document version number
Returns:
the object found or null
Throws:
ContentPersistenceException - when it is not possible to find the associated store
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

getChildren

java.util.Collection getChildren(java.lang.String uri)
                                 throws ContentPersistenceException
Get all cms objects (documents & folders) found in an parent uri.

Parameters:
uri - The parent folder uri from which the cms objects have to be retrieved. it can be a server scope or a folder uri.
Returns:
the cms object children found
Throws:
ContentPersistenceException - when it is not possible to find the associated store

getFolders

java.util.Collection getFolders(java.lang.String uri)
                                throws ContentPersistenceException
Get folders found in a parent uri.

Parameters:
uri - The parent folder uri from which the folders have to be retrieved. it can be a server scope or a parent folder uri.
Returns:
the folder children found
Throws:
ContentPersistenceException - when it is not possible to find the associated store

getContents

java.util.Collection getContents(java.lang.String uri)
                                 throws ContentPersistenceException
Get contents found in a parent uri.

Parameters:
uri - The parent folder uri from which the contents have to be retrieved. it can be a server scope or a parent folder uri.
Returns:
the folder children found
Throws:
ContentPersistenceException - when it is not possible to find the associated store

getLinks

java.util.Collection getLinks(java.lang.String uri)
                              throws ContentPersistenceException
Get links found in a parent uri.

Parameters:
uri - The parent folder uri from which the links have to be retrieved. it can be a server scope or a parent folder uri.
Returns:
the children found
Throws:
ContentPersistenceException - when it is not possible to find the associated store

insertHistoryElement

void insertHistoryElement(org.apache.portals.graffito.model.core.HistoryElement historyElement)
                          throws ContentPersistenceException,
                                 org.apache.portals.graffito.exception.CmsPermissionException
Add a new history element

Parameters:
historyElement -
Throws:
ContentPersistenceException - when it is not possible to insert the object
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

getHistory

org.apache.portals.graffito.model.core.HistoryElement getHistory(org.apache.portals.graffito.model.core.VersionnedContent versionnedContent)
                                                                 throws ContentPersistenceException,
                                                                        org.apache.portals.graffito.exception.CmsPermissionException
Get the version history element defined from a versionned content. From this history element, it is possible to find previous version history element by calling HistoryElement.getPrevious()

Parameters:
versionnedContent - The content for which the history has to be retrieved
Returns:
The History element found
Throws:
ContentPersistenceException - when it is not possible to find the store associated to the associated document
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

getCollectionByQuery

java.util.Collection getCollectionByQuery(java.lang.Class clazz,
                                          org.apache.portals.graffito.services.search.Filter filter)
                                          throws ContentPersistenceException
Get a collection of objects (CmsObject, Server, HistoryElement, ...) from the persistenceService store. This method filters de cms object in function of the user permissions.

Parameters:
clazz - Class or interface used for the filter. Represent the extend to be search
filter - used to retrieve the cms object.The criteria should provide only one object
Returns:
object found collection or null
Throws:
ContentPersistenceException - when it is not possible to find the associated store

getIteratorByQuery

java.util.Iterator getIteratorByQuery(java.lang.Class clazz,
                                      org.apache.portals.graffito.services.search.Filter filter)
                                      throws ContentPersistenceException
Get an iterator of objects (CmsObject, Server, HistoryElement, ...) from the persistenceService store. This method filters de cms object in function of the user permissions.

Parameters:
clazz - Class or interface used for the filter. Represent the extend to be search
filter - used to retrieve the cms object.The criteria should provide only one object
Returns:
object found iterator or null
Throws:
ContentPersistenceException - when it is not possible to find the associated store

getServer

org.apache.portals.graffito.model.server.Server getServer(java.lang.String scope)
                                                          throws ContentPersistenceException,
                                                                 org.apache.portals.graffito.exception.CmsPermissionException
Get a server reference based on the scope

Parameters:
scope - the scope associated to the server to search. The scope is an uri prefix like "/myserver"
Returns:
the server found or null
Throws:
ContentPersistenceException - when it is not possible to find the associated store
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

registerServer

void registerServer(org.apache.portals.graffito.model.server.Server server)
                    throws org.apache.portals.graffito.exception.CmsPermissionException,
                           org.apache.portals.graffito.exception.CmsIncorrectServerException
Add a new Server reference into the content tree.

Parameters:
server - the server to add into the content tree
Throws:
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges
org.apache.portals.graffito.exception.CmsIncorrectServerException - when the server is not correct

unRegisterServer

void unRegisterServer(org.apache.portals.graffito.model.server.Server server)
                      throws org.apache.portals.graffito.exception.CmsPermissionException,
                             org.apache.portals.graffito.exception.CmsIncorrectServerException
Drop a server from the content tree

Parameters:
server - the server to remove from tne content tree
Throws:
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges
org.apache.portals.graffito.exception.CmsIncorrectServerException - when it is not possible to unregister the server

getServers

java.util.Collection getServers(boolean withMasterServer)
                                throws org.apache.portals.graffito.exception.CmsPermissionException
Get all registered servers

Parameters:
withMasterServer - If true the Graffito Master server will be in the server list
Returns:
the server list
Throws:
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges

getStore

ContentStore getStore(java.lang.String scope)
                      throws ContentPersistenceException
Get a content store associated to a scope. A scope is a based uri path

Parameters:
scope - Scope based uri path used to search a PersistencStore
Returns:
the content store found or null
Throws:
ContentPersistenceException - when it is not possible to find the associated store

getGraffitoMasterStore

ContentStore getGraffitoMasterStore()
                                    throws ContentPersistenceException
Get a persistenceService store associated to a scope. A scope is a based uri path

Returns:
the persistenceService master store
Throws:
ContentPersistenceException - when it is not possible to find the associated store


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.