org.apache.portals.graffito.persistence.impl
Class ContentPersistenceServiceImpl

java.lang.Object
  extended by org.apache.portals.graffito.persistence.impl.ContentPersistenceServiceImpl
All Implemented Interfaces:
ContentPersistenceService

public class ContentPersistenceServiceImpl
extends java.lang.Object
implements ContentPersistenceService

Default implementation for org.apache.portals.graffito.persistenceService.ContentPersistenceService


Field Summary
 
Fields inherited from interface org.apache.portals.graffito.persistence.ContentPersistenceService
CONTENT, DOCUMENT, FILE_SYSTEM_SERVER, FOLDER, GRAFFITO_SERVER, HISTPORY, LINK, VERSIONNED_CONTENT, WEBDAV_SERVER
 
Constructor Summary
ContentPersistenceServiceImpl(org.apache.portals.graffito.model.server.Server graffitoMasterServer, ContentStoreService contentStoreService)
          Constructor.
 
Method Summary
 java.lang.Object createObject(java.lang.String omName)
          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 uri)
          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 parentUri)
          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 versionNumber)
          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 persistenceStoreName)
          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, ...)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentPersistenceServiceImpl

public ContentPersistenceServiceImpl(org.apache.portals.graffito.model.server.Server graffitoMasterServer,
                                     ContentStoreService contentStoreService)
Constructor.

Parameters:
graffitoMasterServer - the Graffito Master Server.
contentStoreService - The content store service used by this persistenceService store
Method Detail

createObject

public java.lang.Object createObject(java.lang.String omName)
                              throws org.apache.portals.graffito.exception.CmsInstantiateException
Description copied from interface: ContentPersistenceService
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, ... .

Specified by:
createObject in interface ContentPersistenceService
Parameters:
omName - 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
See Also:
ContentPersistenceService.createObject(java.lang.String)

insert

public void insert(java.lang.Object object)
            throws ContentPersistenceException,
                   org.apache.portals.graffito.exception.CmsPermissionException
Description copied from interface: ContentPersistenceService
Insert any kind of object (CmsObject, Server, HistoryElement, ...)

Specified by:
insert in interface ContentPersistenceService
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
See Also:
ContentPersistenceService.insert(java.lang.Object)

update

public void update(java.lang.Object object)
            throws ContentPersistenceException,
                   org.apache.portals.graffito.exception.CmsPermissionException
Description copied from interface: ContentPersistenceService
Update any kind of object (CmsObject, Server, HistoryElement, ...)

Specified by:
update in interface ContentPersistenceService
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
See Also:
ContentPersistenceService.update(java.lang.Object)

delete

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

Specified by:
delete in interface ContentPersistenceService
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
See Also:
ContentPersistenceService.delete(java.lang.Object)

delete

public void delete(java.lang.String uri)
            throws ContentPersistenceException,
                   org.apache.portals.graffito.exception.CmsPermissionException
Description copied from interface: ContentPersistenceService
Delete a CmsObject

Specified by:
delete in interface ContentPersistenceService
Parameters:
uri - 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
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#delete(java.lang.String)

deleteAll

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

Specified by:
deleteAll in interface ContentPersistenceService
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
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#deleteAll(Class, Filter)

getCmsObject

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

Specified by:
getCmsObject in interface ContentPersistenceService
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
See Also:
ContentPersistenceService.getCmsObject(String)

getCmsObject

public org.apache.portals.graffito.model.core.CmsObject getCmsObject(java.lang.String uri,
                                                                     java.lang.String versionNumber)
                                                              throws ContentPersistenceException,
                                                                     org.apache.portals.graffito.exception.CmsPermissionException
Description copied from interface: ContentPersistenceService
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

Specified by:
getCmsObject in interface ContentPersistenceService
Parameters:
uri - object uri
versionNumber - 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
See Also:
ContentPersistenceService.getCmsObject(String, String)

getChildren

public java.util.Collection getChildren(java.lang.String parentUri)
                                 throws ContentPersistenceException
Description copied from interface: ContentPersistenceService
Get all cms objects (documents & folders) found in an parent uri.

Specified by:
getChildren in interface ContentPersistenceService
Parameters:
parentUri - 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
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#getChildren(java.lang.String)

getContents

public java.util.Collection getContents(java.lang.String uri)
                                 throws ContentPersistenceException
Description copied from interface: ContentPersistenceService
Get contents found in a parent uri.

Specified by:
getContents in interface ContentPersistenceService
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
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#getContents(java.lang.String)

getLinks

public java.util.Collection getLinks(java.lang.String uri)
                              throws ContentPersistenceException
Description copied from interface: ContentPersistenceService
Get links found in a parent uri.

Specified by:
getLinks in interface ContentPersistenceService
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
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#getLinks(java.lang.String)

getFolders

public java.util.Collection getFolders(java.lang.String uri)
                                throws ContentPersistenceException
Description copied from interface: ContentPersistenceService
Get folders found in a parent uri.

Specified by:
getFolders in interface ContentPersistenceService
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
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#getFolders(java.lang.String)

getHistory

public org.apache.portals.graffito.model.core.HistoryElement getHistory(org.apache.portals.graffito.model.core.VersionnedContent versionnedContent)
                                                                 throws ContentPersistenceException,
                                                                        org.apache.portals.graffito.exception.CmsPermissionException
Description copied from interface: ContentPersistenceService
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()

Specified by:
getHistory in interface ContentPersistenceService
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
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#getHistory(org.apache.portals.graffito.model.core.VersionnedContent)

insertHistoryElement

public void insertHistoryElement(org.apache.portals.graffito.model.core.HistoryElement historyElement)
                          throws ContentPersistenceException,
                                 org.apache.portals.graffito.exception.CmsPermissionException
Description copied from interface: ContentPersistenceService
Add a new history element

Specified by:
insertHistoryElement in interface ContentPersistenceService
Throws:
ContentPersistenceException - when it is not possible to insert the object
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#insertHistoryElement(org.apache.portals.graffito.model.core.HistoryElement)

newFilter

public org.apache.portals.graffito.services.search.Filter newFilter()
Description copied from interface: ContentPersistenceService
Instantiate a new filter object. This filter is store independant.

Specified by:
newFilter in interface ContentPersistenceService
Returns:
a new filter object
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#newFilter()

getCollectionByQuery

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

Specified by:
getCollectionByQuery in interface ContentPersistenceService
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
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#getCollectionByQuery(java.lang.Class, org.apache.portals.graffito.services.search.Filter)

getIteratorByQuery

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

Specified by:
getIteratorByQuery in interface ContentPersistenceService
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
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#getIteratorByQuery(java.lang.Class, org.apache.portals.graffito.services.search.Filter)

getObjectbyQuery

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

Specified by:
getObjectbyQuery in interface ContentPersistenceService
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:
org.apache.portals.graffito.exception.CmsPermissionException - when the user has not suffisiant privileges
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#getObjectbyQuery(java.lang.Class, org.apache.portals.graffito.services.search.Filter)

getGraffitoMasterStore

public ContentStore getGraffitoMasterStore()
Description copied from interface: ContentPersistenceService
Get a persistenceService store associated to a scope. A scope is a based uri path

Specified by:
getGraffitoMasterStore in interface ContentPersistenceService
Returns:
the persistenceService master store
See Also:
ContentPersistenceService.getGraffitoMasterStore()

getStore

public ContentStore getStore(java.lang.String persistenceStoreName)
Description copied from interface: ContentPersistenceService
Get a content store associated to a scope. A scope is a based uri path

Specified by:
getStore in interface ContentPersistenceService
Parameters:
persistenceStoreName - Scope based uri path used to search a PersistencStore
Returns:
the content store found or null
See Also:
ContentPersistenceService.getStore(String)

getServer

public org.apache.portals.graffito.model.server.Server getServer(java.lang.String scope)
                                                          throws ContentPersistenceException,
                                                                 org.apache.portals.graffito.exception.CmsPermissionException
Description copied from interface: ContentPersistenceService
Get a server reference based on the scope

Specified by:
getServer in interface ContentPersistenceService
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
See Also:
ContentPersistenceService.getServer(String)

registerServer

public void registerServer(org.apache.portals.graffito.model.server.Server server)
                    throws org.apache.portals.graffito.exception.CmsPermissionException,
                           org.apache.portals.graffito.exception.CmsIncorrectServerException
Description copied from interface: ContentPersistenceService
Add a new Server reference into the content tree.

Specified by:
registerServer in interface ContentPersistenceService
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
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#registerServer(org.apache.portals.graffito.model.server.Server)

unRegisterServer

public void unRegisterServer(org.apache.portals.graffito.model.server.Server server)
                      throws org.apache.portals.graffito.exception.CmsPermissionException,
                             org.apache.portals.graffito.exception.CmsIncorrectServerException
Description copied from interface: ContentPersistenceService
Drop a server from the content tree

Specified by:
unRegisterServer in interface ContentPersistenceService
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
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#unRegisterServer(org.apache.portals.graffito.model.server.Server)

getServers

public java.util.Collection getServers(boolean withMasterServer)
Description copied from interface: ContentPersistenceService
Get all registered servers

Specified by:
getServers in interface ContentPersistenceService
Parameters:
withMasterServer - If true the Graffito Master server will be in the server list
Returns:
the server list
See Also:
org.apache.portals.graffito.persistenceService.ContentPersistenceService#getServers(boolean)


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