You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by cl...@apache.org on 2006/09/20 19:37:21 UTC
svn commit: r448311 [11/25] - in /incubator/graffito/trunk: ./ api/
api/src/java/org/apache/portals/graffito/context/
api/src/java/org/apache/portals/graffito/exception/
api/src/java/org/apache/portals/graffito/services/core/
api/src/java/org/apache/po...
Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentStreamImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentStreamImpl.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentStreamImpl.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentStreamImpl.java Wed Sep 20 12:37:05 2006
@@ -1,175 +1,175 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.portals.graffito.model.dm.impl;
-
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.portals.graffito.model.dm.DocumentStream;
-import org.apache.portals.graffito.util.StreamUtil;
-
-
-/**
- * CMS Version implementation.
- *
- * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
- *
- */
-public class DocumentStreamImpl implements DocumentStream, Serializable
-{
- protected final static Log log = LogFactory.getLog(DocumentStreamImpl.class);
-
- protected Long documentStreamId;
-
- protected byte[] content;
-
- protected String encoding;
-
- protected String isoCode;
-
- /**
- * @return Returns the documentStreamId.
- */
- public Long getDocumentStreamId()
- {
- return documentStreamId;
- }
-
- /**
- * @param documentStreamId The documentStreamId to set.
- */
- public void setDocumentStreamId(Long documentStreamId)
- {
- this.documentStreamId = documentStreamId;
- }
- /**
- *
- * @see org.apache.portals.graffito.model.dm.DocumentStream#getContentStream()
- */
- public InputStream getContentStream()
- {
- return new ByteArrayInputStream(content);
- }
-
- /**
- *
- * @see org.apache.portals.graffito.model.dm.DocumentStream#getContentByte()
- */
- public byte[] getContentByte()
- {
-
- return content;
- }
-
-
- /**
- *
- * @see org.apache.portals.graffito.model.dm.DocumentStream#getContentAsString()
- */
- public String getContentAsString()
- {
- if (encoding != null)
- {
- try
- {
- return new String(content, encoding);
- }
- catch (UnsupportedEncodingException e)
- {
- }
- }
- return new String(content);
- }
-
-
- /**
- *
- * @see org.apache.portals.graffito.model.dm.DocumentStream#setContent(java.io.InputStream)
- */
- public void setContent(InputStream stream)
- {
-
- content = StreamUtil.getContentByte(stream);
-
- }
-
- /**
- *
- * @see org.apache.portals.graffito.model.dm.DocumentStream#setContent(byte[])
- */
- public void setContent(byte[] stream)
- {
-
- content = stream;
-
- }
-
- /**
- * @return Returns the encoding.
- */
- public String getEncoding()
- {
- return encoding;
- }
-
- /**
- * @param encoding The encoding to set.
- */
- public void setEncoding(String encoding)
- {
- this.encoding = encoding;
- }
-
-
- /**
- * @see org.apache.portals.graffito.model.dm.DocumentStream#getIsoCode()
- */
- public String getIsoCode()
- {
- return this.isoCode;
- }
- /**
- * @see org.apache.portals.graffito.model.dm.DocumentStream#setIsoCode(java.lang.String)
- */
- public void setIsoCode(String isoCode)
- {
- this.isoCode = isoCode;
-
- }
-
- /**
- *
- * @see java.lang.Object#clone()
- */
- public Object clone()
- {
- DocumentStream clone = new DocumentStreamImpl();
- clone.setContent(this.getContentByte());
- clone.setEncoding(this.getEncoding());
- clone.setIsoCode(this.getIsoCode());
-
- return clone;
-
- }
-}
-
-
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.dm.impl;
+
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.model.dm.DocumentStream;
+import org.apache.portals.graffito.util.StreamUtil;
+
+
+/**
+ * CMS Version implementation.
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class DocumentStreamImpl implements DocumentStream, Serializable
+{
+ protected final static Log log = LogFactory.getLog(DocumentStreamImpl.class);
+
+ protected Long documentStreamId;
+
+ protected byte[] content;
+
+ protected String encoding;
+
+ protected String isoCode;
+
+ /**
+ * @return Returns the documentStreamId.
+ */
+ public Long getDocumentStreamId()
+ {
+ return documentStreamId;
+ }
+
+ /**
+ * @param documentStreamId The documentStreamId to set.
+ */
+ public void setDocumentStreamId(Long documentStreamId)
+ {
+ this.documentStreamId = documentStreamId;
+ }
+ /**
+ *
+ * @see org.apache.portals.graffito.model.dm.DocumentStream#getContentStream()
+ */
+ public InputStream getContentStream()
+ {
+ return new ByteArrayInputStream(content);
+ }
+
+ /**
+ *
+ * @see org.apache.portals.graffito.model.dm.DocumentStream#getContentByte()
+ */
+ public byte[] getContentByte()
+ {
+
+ return content;
+ }
+
+
+ /**
+ *
+ * @see org.apache.portals.graffito.model.dm.DocumentStream#getContentAsString()
+ */
+ public String getContentAsString()
+ {
+ if (encoding != null)
+ {
+ try
+ {
+ return new String(content, encoding);
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ }
+ }
+ return new String(content);
+ }
+
+
+ /**
+ *
+ * @see org.apache.portals.graffito.model.dm.DocumentStream#setContent(java.io.InputStream)
+ */
+ public void setContent(InputStream stream)
+ {
+
+ content = StreamUtil.getContentByte(stream);
+
+ }
+
+ /**
+ *
+ * @see org.apache.portals.graffito.model.dm.DocumentStream#setContent(byte[])
+ */
+ public void setContent(byte[] stream)
+ {
+
+ content = stream;
+
+ }
+
+ /**
+ * @return Returns the encoding.
+ */
+ public String getEncoding()
+ {
+ return encoding;
+ }
+
+ /**
+ * @param encoding The encoding to set.
+ */
+ public void setEncoding(String encoding)
+ {
+ this.encoding = encoding;
+ }
+
+
+ /**
+ * @see org.apache.portals.graffito.model.dm.DocumentStream#getIsoCode()
+ */
+ public String getIsoCode()
+ {
+ return this.isoCode;
+ }
+ /**
+ * @see org.apache.portals.graffito.model.dm.DocumentStream#setIsoCode(java.lang.String)
+ */
+ public void setIsoCode(String isoCode)
+ {
+ this.isoCode = isoCode;
+
+ }
+
+ /**
+ *
+ * @see java.lang.Object#clone()
+ */
+ public Object clone()
+ {
+ DocumentStream clone = new DocumentStreamImpl();
+ clone.setContent(this.getContentByte());
+ clone.setEncoding(this.getEncoding());
+ clone.setIsoCode(this.getIsoCode());
+
+ return clone;
+
+ }
+}
+
+
Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentStreamImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/permission/impl/CmsPermissionCollection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/permission/impl/CmsPermissionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/FileSystemServerImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/FileSystemServerImpl.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/FileSystemServerImpl.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/FileSystemServerImpl.java Wed Sep 20 12:37:05 2006
@@ -1,47 +1,47 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.portals.graffito.model.server.impl;
-
-import org.apache.portals.graffito.model.server.FileSystemServer;
-
-
-/**
- * File System Server
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: $
- */
-public class FileSystemServerImpl extends ServerImpl implements FileSystemServer
-{
- private static final long serialVersionUID = 1;
- String root;
-
- /**
- * @return Returns the root.
- */
- public String getRoot()
- {
- return root;
- }
- /**
- * @param root The root to set.
- */
- public void setRoot(String root)
- {
- this.root = root;
- }
-}
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.server.impl;
+
+import org.apache.portals.graffito.model.server.FileSystemServer;
+
+
+/**
+ * File System Server
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class FileSystemServerImpl extends ServerImpl implements FileSystemServer
+{
+ private static final long serialVersionUID = 1;
+ String root;
+
+ /**
+ * @return Returns the root.
+ */
+ public String getRoot()
+ {
+ return root;
+ }
+ /**
+ * @param root The root to set.
+ */
+ public void setRoot(String root)
+ {
+ this.root = root;
+ }
+}
Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/FileSystemServerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/GraffitoServerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/ServerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/WebdavServerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentPersistenceException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentPersistenceService.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentPersistenceService.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentPersistenceService.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentPersistenceService.java Wed Sep 20 12:37:05 2006
@@ -1,326 +1,326 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation or its licensors,
- * as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.portals.graffito.persistence;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.portals.graffito.exception.CmsIncorrectServerException;
-import org.apache.portals.graffito.exception.CmsInstantiateException;
-import org.apache.portals.graffito.exception.CmsPermissionException;
-import org.apache.portals.graffito.model.core.CmsObject;
-import org.apache.portals.graffito.model.core.HistoryElement;
-import org.apache.portals.graffito.model.core.VersionnedContent;
-import org.apache.portals.graffito.model.server.Server;
-import org.apache.portals.graffito.services.search.Filter;
-import org.apache.portals.graffito.store.ContentStore;
-
-/**
- * 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 <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
- *
- */
-public interface ContentPersistenceService
-{
- /** Folder Interface name - use to instantiate CmsOjbect */
- public final static String FOLDER = "Folder";
-
- /** Content Interface name - use to instantiate CmsOjbect */
- public final static String CONTENT = "Content";
-
- /** Content Interface name - use to instantiate CmsOjbect */
- public final static String VERSIONNED_CONTENT = "VersionnedContent";
-
- /** Content Interface name - use to instantiate CmsOjbect */
- public final static String DOCUMENT = "Document";
-
- /** Hisotry Interface name - use to instantiate a version history element */
- public final static String HISTPORY = "HistoryElement";
-
- /** Link Interface name - use to instantiate CmsOjbect */
- public final static String LINK = "Link";
-
- /** Webdav Server Interface name - use to instantiate Webdav server reference */
- public final static String WEBDAV_SERVER = "WebdavServer";
-
- /** Graffito Store Interface name - use to instantiate GraffitoServer reference */
- public final static String GRAFFITO_SERVER = "GraffitoServer";
-
- /** File System Store Interface name - use to instantiate FileSystem Server reference */
- public final static String FILE_SYSTEM_SERVER = "FileSystemServer";
-
- /**
- * 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, ... .
- *
- * @param objectName The object interface name
- * @return a new instantiated cms object
- * @throws CmsInstantiateException when the cms object instance can't be created
- */
- public Object createObject(String objectName) throws CmsInstantiateException;
-
- /**
- * Insert any kind of object (CmsObject, Server, HistoryElement, ...)
- *
- * @param object The object to be inserted
- * @throws ContentPersistenceException when it is not possible to insert the object
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public void insert(Object object) throws ContentPersistenceException, CmsPermissionException;
-
- /**
- * Update any kind of object (CmsObject, Server, HistoryElement, ...)
- *
- * @param object The object to be updated.
- * @throws ContentPersistenceException when it is not possible to insert the object
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public void update(Object object) throws ContentPersistenceException, CmsPermissionException;
-
- /**
- * Delete any kind of object from a persistenceService store (CmsObject, Server, ...) .
- *
- * @param object the object to be delete
- *
- * @throws ContentPersistenceException unknown object or system error
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public void delete(Object object) throws ContentPersistenceException, CmsPermissionException;
-
-
- /**
- * Delete a CmsObject
- *
- * @param cmsObjectUri The uri of the cms object to delete
- *
- * @throws ContentPersistenceException unknown object or system error
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public void delete(String cmsObjectUri) throws ContentPersistenceException, CmsPermissionException;
-
- /**
- * Delete several objects from a persistenceService store.
- *
- * @param clazz The class on wich the filter has to be executed
- * @param filter Filter used to select the object to delete
- *
- * @throws ContentPersistenceException unknown object or system error
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public void deleteAll(Class clazz, Filter filter) throws ContentPersistenceException, CmsPermissionException;
-
-
- /**
- * Instantiate a new filter object. This filter is store independant.
- *
- * @return a new filter object
- */
- public Filter newFilter();
-
- /**
- * Get a cms related object from the persistent store (can be a document, a folder or Server, ...).
- *
- * @param clazz Class or interface used for the filter. Represent the extend to be search
- * @param filter used to retrieve the cms object.The criteria should provide only one object
- *
- * @return object the object to be retrieved
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public Object getObjectbyQuery(Class clazz, Filter filter) throws ContentPersistenceException, 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
- *
- * @param uri Object uri
- *
- * @return the object found or null
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public CmsObject getCmsObject(String uri) throws ContentPersistenceException, 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
- *
- * @param uri object uri
- * @param versionNum The document version number
- * @return the object found or null
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public CmsObject getCmsObject(String uri, String versionNum) throws ContentPersistenceException, CmsPermissionException;
-
- /**
- * Get all cms objects (documents & folders) found in an parent uri.
- * @param uri The parent folder uri from which the cms objects have to be retrieved. it can be a server scope or a folder uri.
- * @return the cms object children found
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- */
- public Collection getChildren(String uri) throws ContentPersistenceException;
-
-
- /**
- * Get folders found in a parent uri.
- * @param uri The parent folder uri from which the folders have to be retrieved. it can be a server scope or a parent folder uri.
- * @return the folder children found
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- */
- public Collection getFolders(String uri) throws ContentPersistenceException;
-
- /**
- * Get contents found in a parent uri.
- * @param uri The parent folder uri from which the contents have to be retrieved. it can be a server scope or a parent folder uri.
- * @return the folder children found
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- */
- public Collection getContents(String uri) throws ContentPersistenceException;
-
- /**
- * Get links found in a parent uri.
- * @param uri The parent folder uri from which the links have to be retrieved. it can be a server scope or a parent folder uri.
- * @return the children found
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- */
- public Collection getLinks(String uri) throws ContentPersistenceException;
-
- /**
- * Add a new history element
- *
- * @param historyElement
- * @throws ContentPersistenceException when it is not possible to insert the object
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public void insertHistoryElement(HistoryElement historyElement) throws ContentPersistenceException, 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 {@link HistoryElement#getPrevious()}
- * @param versionnedContent The content for which the history has to be retrieved
- * @return The History element found
- * @throws ContentPersistenceException when it is not possible to find the store associated to the associated document
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public HistoryElement getHistory(VersionnedContent versionnedContent) throws ContentPersistenceException, CmsPermissionException;
-
- /**
- * Get a collection of objects (CmsObject, Server, HistoryElement, ...) from the persistenceService store.
- * This method filters de cms object in function of the user permissions.
- *
- * @param clazz Class or interface used for the filter. Represent the extend to be search
- * @param filter used to retrieve the cms object.The criteria should provide only one object
- *
- * @return object found collection or null
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- */
- public Collection getCollectionByQuery(Class clazz, 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.
- *
- * @param clazz Class or interface used for the filter. Represent the extend to be search
- * @param filter used to retrieve the cms object.The criteria should provide only one object
- *
- * @return object found iterator or null
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- */
- public Iterator getIteratorByQuery(Class clazz, Filter filter) throws ContentPersistenceException;
-
-
- /**
- * Get a server reference based on the scope
- *
- * @param scope the scope associated to the server to search. The scope is an uri prefix like "/myserver"
- * @return the server found or null
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public Server getServer(String scope) throws ContentPersistenceException, CmsPermissionException;
-
- /**
- * Add a new Server reference into the content tree.
- *
- * @param server the server to add into the content tree
- * @throws CmsPermissionException when the user has not suffisiant privileges
- * @throws CmsIncorrectServerException when the server is not correct
- */
- public void registerServer(Server server) throws CmsPermissionException, CmsIncorrectServerException;
-
- /**
- * Drop a server from the content tree
- *
- * @param server the server to remove from tne content tree
- * @throws CmsPermissionException when the user has not suffisiant privileges
- * @throws CmsIncorrectServerException when it is not possible to unregister the server
- */
- public void unRegisterServer(Server server) throws CmsPermissionException, CmsIncorrectServerException;
-
- /**
- * Get all registered servers
- * @param withMasterServer If true the Graffito Master server will be in the server list
- * @return the server list
- * @throws CmsPermissionException when the user has not suffisiant privileges
- */
- public Collection getServers(boolean withMasterServer) throws CmsPermissionException;;
-
- /**
- * Get a content store associated to a scope. A scope is a based uri path
- *
- * @param scope Scope based uri path used to search a PersistencStore
- * @return the content store found or null
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- */
- public ContentStore getStore(String scope) throws ContentPersistenceException;
-
- /**
- * Get a persistenceService store associated to a scope. A scope is a based uri
- * path
- *
- * @return the persistenceService master store
- *
- * @throws ContentPersistenceException when it is not possible to find the associated store
- *
- */
- public ContentStore getGraffitoMasterStore() throws ContentPersistenceException;
-
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.persistence;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.portals.graffito.exception.CmsIncorrectServerException;
+import org.apache.portals.graffito.exception.CmsInstantiateException;
+import org.apache.portals.graffito.exception.CmsPermissionException;
+import org.apache.portals.graffito.model.core.CmsObject;
+import org.apache.portals.graffito.model.core.HistoryElement;
+import org.apache.portals.graffito.model.core.VersionnedContent;
+import org.apache.portals.graffito.model.server.Server;
+import org.apache.portals.graffito.services.search.Filter;
+import org.apache.portals.graffito.store.ContentStore;
+
+/**
+ * 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 <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ *
+ */
+public interface ContentPersistenceService
+{
+ /** Folder Interface name - use to instantiate CmsOjbect */
+ public final static String FOLDER = "Folder";
+
+ /** Content Interface name - use to instantiate CmsOjbect */
+ public final static String CONTENT = "Content";
+
+ /** Content Interface name - use to instantiate CmsOjbect */
+ public final static String VERSIONNED_CONTENT = "VersionnedContent";
+
+ /** Content Interface name - use to instantiate CmsOjbect */
+ public final static String DOCUMENT = "Document";
+
+ /** Hisotry Interface name - use to instantiate a version history element */
+ public final static String HISTPORY = "HistoryElement";
+
+ /** Link Interface name - use to instantiate CmsOjbect */
+ public final static String LINK = "Link";
+
+ /** Webdav Server Interface name - use to instantiate Webdav server reference */
+ public final static String WEBDAV_SERVER = "WebdavServer";
+
+ /** Graffito Store Interface name - use to instantiate GraffitoServer reference */
+ public final static String GRAFFITO_SERVER = "GraffitoServer";
+
+ /** File System Store Interface name - use to instantiate FileSystem Server reference */
+ public final static String FILE_SYSTEM_SERVER = "FileSystemServer";
+
+ /**
+ * 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, ... .
+ *
+ * @param objectName The object interface name
+ * @return a new instantiated cms object
+ * @throws CmsInstantiateException when the cms object instance can't be created
+ */
+ public Object createObject(String objectName) throws CmsInstantiateException;
+
+ /**
+ * Insert any kind of object (CmsObject, Server, HistoryElement, ...)
+ *
+ * @param object The object to be inserted
+ * @throws ContentPersistenceException when it is not possible to insert the object
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public void insert(Object object) throws ContentPersistenceException, CmsPermissionException;
+
+ /**
+ * Update any kind of object (CmsObject, Server, HistoryElement, ...)
+ *
+ * @param object The object to be updated.
+ * @throws ContentPersistenceException when it is not possible to insert the object
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public void update(Object object) throws ContentPersistenceException, CmsPermissionException;
+
+ /**
+ * Delete any kind of object from a persistenceService store (CmsObject, Server, ...) .
+ *
+ * @param object the object to be delete
+ *
+ * @throws ContentPersistenceException unknown object or system error
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public void delete(Object object) throws ContentPersistenceException, CmsPermissionException;
+
+
+ /**
+ * Delete a CmsObject
+ *
+ * @param cmsObjectUri The uri of the cms object to delete
+ *
+ * @throws ContentPersistenceException unknown object or system error
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public void delete(String cmsObjectUri) throws ContentPersistenceException, CmsPermissionException;
+
+ /**
+ * Delete several objects from a persistenceService store.
+ *
+ * @param clazz The class on wich the filter has to be executed
+ * @param filter Filter used to select the object to delete
+ *
+ * @throws ContentPersistenceException unknown object or system error
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public void deleteAll(Class clazz, Filter filter) throws ContentPersistenceException, CmsPermissionException;
+
+
+ /**
+ * Instantiate a new filter object. This filter is store independant.
+ *
+ * @return a new filter object
+ */
+ public Filter newFilter();
+
+ /**
+ * Get a cms related object from the persistent store (can be a document, a folder or Server, ...).
+ *
+ * @param clazz Class or interface used for the filter. Represent the extend to be search
+ * @param filter used to retrieve the cms object.The criteria should provide only one object
+ *
+ * @return object the object to be retrieved
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public Object getObjectbyQuery(Class clazz, Filter filter) throws ContentPersistenceException, 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
+ *
+ * @param uri Object uri
+ *
+ * @return the object found or null
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public CmsObject getCmsObject(String uri) throws ContentPersistenceException, 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
+ *
+ * @param uri object uri
+ * @param versionNum The document version number
+ * @return the object found or null
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public CmsObject getCmsObject(String uri, String versionNum) throws ContentPersistenceException, CmsPermissionException;
+
+ /**
+ * Get all cms objects (documents & folders) found in an parent uri.
+ * @param uri The parent folder uri from which the cms objects have to be retrieved. it can be a server scope or a folder uri.
+ * @return the cms object children found
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ */
+ public Collection getChildren(String uri) throws ContentPersistenceException;
+
+
+ /**
+ * Get folders found in a parent uri.
+ * @param uri The parent folder uri from which the folders have to be retrieved. it can be a server scope or a parent folder uri.
+ * @return the folder children found
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ */
+ public Collection getFolders(String uri) throws ContentPersistenceException;
+
+ /**
+ * Get contents found in a parent uri.
+ * @param uri The parent folder uri from which the contents have to be retrieved. it can be a server scope or a parent folder uri.
+ * @return the folder children found
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ */
+ public Collection getContents(String uri) throws ContentPersistenceException;
+
+ /**
+ * Get links found in a parent uri.
+ * @param uri The parent folder uri from which the links have to be retrieved. it can be a server scope or a parent folder uri.
+ * @return the children found
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ */
+ public Collection getLinks(String uri) throws ContentPersistenceException;
+
+ /**
+ * Add a new history element
+ *
+ * @param historyElement
+ * @throws ContentPersistenceException when it is not possible to insert the object
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public void insertHistoryElement(HistoryElement historyElement) throws ContentPersistenceException, 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 {@link HistoryElement#getPrevious()}
+ * @param versionnedContent The content for which the history has to be retrieved
+ * @return The History element found
+ * @throws ContentPersistenceException when it is not possible to find the store associated to the associated document
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public HistoryElement getHistory(VersionnedContent versionnedContent) throws ContentPersistenceException, CmsPermissionException;
+
+ /**
+ * Get a collection of objects (CmsObject, Server, HistoryElement, ...) from the persistenceService store.
+ * This method filters de cms object in function of the user permissions.
+ *
+ * @param clazz Class or interface used for the filter. Represent the extend to be search
+ * @param filter used to retrieve the cms object.The criteria should provide only one object
+ *
+ * @return object found collection or null
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ */
+ public Collection getCollectionByQuery(Class clazz, 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.
+ *
+ * @param clazz Class or interface used for the filter. Represent the extend to be search
+ * @param filter used to retrieve the cms object.The criteria should provide only one object
+ *
+ * @return object found iterator or null
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ */
+ public Iterator getIteratorByQuery(Class clazz, Filter filter) throws ContentPersistenceException;
+
+
+ /**
+ * Get a server reference based on the scope
+ *
+ * @param scope the scope associated to the server to search. The scope is an uri prefix like "/myserver"
+ * @return the server found or null
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public Server getServer(String scope) throws ContentPersistenceException, CmsPermissionException;
+
+ /**
+ * Add a new Server reference into the content tree.
+ *
+ * @param server the server to add into the content tree
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ * @throws CmsIncorrectServerException when the server is not correct
+ */
+ public void registerServer(Server server) throws CmsPermissionException, CmsIncorrectServerException;
+
+ /**
+ * Drop a server from the content tree
+ *
+ * @param server the server to remove from tne content tree
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ * @throws CmsIncorrectServerException when it is not possible to unregister the server
+ */
+ public void unRegisterServer(Server server) throws CmsPermissionException, CmsIncorrectServerException;
+
+ /**
+ * Get all registered servers
+ * @param withMasterServer If true the Graffito Master server will be in the server list
+ * @return the server list
+ * @throws CmsPermissionException when the user has not suffisiant privileges
+ */
+ public Collection getServers(boolean withMasterServer) throws CmsPermissionException;;
+
+ /**
+ * Get a content store associated to a scope. A scope is a based uri path
+ *
+ * @param scope Scope based uri path used to search a PersistencStore
+ * @return the content store found or null
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ */
+ public ContentStore getStore(String scope) throws ContentPersistenceException;
+
+ /**
+ * Get a persistenceService store associated to a scope. A scope is a based uri
+ * path
+ *
+ * @return the persistenceService master store
+ *
+ * @throws ContentPersistenceException when it is not possible to find the associated store
+ *
+ */
+ public ContentStore getGraffitoMasterStore() throws ContentPersistenceException;
+
}
Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentPersistenceService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentStoreService.java
------------------------------------------------------------------------------
svn:eol-style = native