incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r448311 [13/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...
Date Wed, 20 Sep 2006 19:37:21 GMT
Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/ContentStore.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/ContentStore.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/ContentStore.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/ContentStore.java Wed Sep 20 12:37:05 2006
@@ -1,192 +1,192 @@
-/*
- * 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.store;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-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.persistence.ContentPersistenceException;
-import org.apache.portals.graffito.services.search.Filter;
-
-
-/**
- * Graffito content store.
- * 
- * This interface can be used to plug any kind of  content server into Graffito. 
- *
- * Depending on the content server type, the implementation has to manage the permissions.
- * 
- */
-public interface ContentStore
-{
-    
-    /**
-     * Get a cms object
-     * @param uri The cms object uri
-     * @return The cms object found or null  
-     * @throws CmsPermissionException when the user has not suffisiant privileges  
-     */
-    public CmsObject getCmsObject(String uri) throws CmsPermissionException ;
-    
-    /**
-     * Get cms object childen found in a folder.
-     * @param parentUri The parent folder uri from which the cms objects have to be retrieved
-     * @throws CmsPermissionException when the user has not suffisiant privileges  
-     * 
-     * @return a collection of cms object found
-     */
-    public Collection getChildren(String parentUri) throws CmsPermissionException ;
-
-    /**
-     * Get folders found in a parent folder.
-     * @param parentUri The parent folder uri from which the folders have to be retrieved
-     * @throws CmsPermissionException when the user has not suffisiant privileges  
-     * 
-     * @return a collection of folder children found
-     */
-    public Collection getFolders(String parentUri) throws CmsPermissionException ;  
-
-    /**
-     * Get contents found in a parent folder.
-     * @param parentUri The parent folder uri from which the contents have to be retrieved
-     * @return a collection of content children found
-     * @throws CmsPermissionException when the user has not suffisiant privileges  
-     */
-
-    public Collection getContents(String parentUri) throws CmsPermissionException ;  
-
-    /**
-     * Get links found in a parent folder.
-     * @param parentUri The parent folder uri from which the links have to be retrieved
-     * @throws CmsPermissionException when the user has not suffisiant privileges  
-     * 
-     * @return a collection of link children found
-     */
-    public Collection getLinks(String parentUri) throws CmsPermissionException ;  
-    
-    /**
-     * 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 content. From this history element, it is possible to find previous version history element by calling {@link HistoryElement#getPrevious()} 
-     * @param versionnedContent The versionned content for which the version history has be found
-     * @return The History element found
-     * 
-     * @throws CmsPermissionException when the user has not suffisiant privileges
-     */
-    public HistoryElement getHistory(VersionnedContent versionnedContent) throws CmsPermissionException;
-    
-    
-    /**
-     * Instantiate a new empty filter object
-     * @return the instantiated filter object
-     */
-    public Filter newFilter();
-    
-
-    /**
-     * Get an object matching to a query
-     * @param clazz The class on which the query has to be exexuted
-     * @param filter The filter used by the query 
-     * @return The object found or null
-     * @throws CmsPermissionException when the user has not suffisiant privileges 
-     */
-    public Object getObjectByQuery(Class clazz, Filter filter) throws CmsPermissionException ;
-        
-    /**
-     * Get collection of object matching to a query 
-     * @param clazz The class on which the query has to be exexuted
-     * @param filter The filter used by the query 
-     * @return a collection of {@link CmsObject} 
-     * 
-     * @throws CmsPermissionException when the user has not suffisiant privileges  
-     */
-    public Collection getCollectionByQuery(Class clazz, Filter filter) throws CmsPermissionException ;;
-
-    
-    /**
-     * Get an iterator of object matching to a query    
-     * @param clazz The class on which the query has to be exexuted
-     * @param filter The filter used by the query 
-     * @return an iterator of of {@link CmsObject} 
-     * 
-     * @throws CmsPermissionException when the user has not suffisiant privileges  
-     */
-    public Iterator getIteratorByQuery(Class clazz, Filter filter) throws CmsPermissionException ;;
-    
-    /**
-     * Delete any kind of object (CmsObject, Server, HistoryElement,  ...)
-     * @param object The object to delete
-     * @throws ContentPersistenceException when it is not possible to delete the object
-     * @throws CmsPermissionException when the user has not suffisiant privileges 
-     */
-    public void delete(Object object) throws ContentPersistenceException, CmsPermissionException;
-
-    /**
-     * Delete all object matching to a query 
-     * @param clazz The class on which the query has to be exexuted
-     * @param filter The filter used by the query 
-     * @throws ContentPersistenceException when it is not possible to delete the objects
-     * @throws CmsPermissionException when the user has not suffisiant privileges 
-     */
-    public void deleteAll(Class clazz, Filter filter) throws ContentPersistenceException, CmsPermissionException;
-
-    /**
-     * Insert a new object in the content store
-     * @param object The object to insert
-     * @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 a new object in the content store
-     * @param object The object to update
-     * @throws ContentPersistenceException when it is not possible to update the object
-     * @throws CmsPermissionException when the user has not suffisiant privileges 
-     */
-    public void update(Object object) throws ContentPersistenceException, CmsPermissionException;
-    
-    /**
-     * Check if the connection to this store is closed
-     * @return true if the connection is close
-     */
-    public boolean isClosed();
-    
-    /**
-     * Close the connection to this store
-     */
-    public void close();
-    
-    /**
-     * Get the content store scope
-     * @return the content store scope
-     */
-    public String getScope();
-    
-}
+/*
+ * 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.store;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+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.persistence.ContentPersistenceException;
+import org.apache.portals.graffito.services.search.Filter;
+
+
+/**
+ * Graffito content store.
+ * 
+ * This interface can be used to plug any kind of  content server into Graffito. 
+ *
+ * Depending on the content server type, the implementation has to manage the permissions.
+ * 
+ */
+public interface ContentStore
+{
+    
+    /**
+     * Get a cms object
+     * @param uri The cms object uri
+     * @return The cms object found or null  
+     * @throws CmsPermissionException when the user has not suffisiant privileges  
+     */
+    public CmsObject getCmsObject(String uri) throws CmsPermissionException ;
+    
+    /**
+     * Get cms object childen found in a folder.
+     * @param parentUri The parent folder uri from which the cms objects have to be retrieved
+     * @throws CmsPermissionException when the user has not suffisiant privileges  
+     * 
+     * @return a collection of cms object found
+     */
+    public Collection getChildren(String parentUri) throws CmsPermissionException ;
+
+    /**
+     * Get folders found in a parent folder.
+     * @param parentUri The parent folder uri from which the folders have to be retrieved
+     * @throws CmsPermissionException when the user has not suffisiant privileges  
+     * 
+     * @return a collection of folder children found
+     */
+    public Collection getFolders(String parentUri) throws CmsPermissionException ;  
+
+    /**
+     * Get contents found in a parent folder.
+     * @param parentUri The parent folder uri from which the contents have to be retrieved
+     * @return a collection of content children found
+     * @throws CmsPermissionException when the user has not suffisiant privileges  
+     */
+
+    public Collection getContents(String parentUri) throws CmsPermissionException ;  
+
+    /**
+     * Get links found in a parent folder.
+     * @param parentUri The parent folder uri from which the links have to be retrieved
+     * @throws CmsPermissionException when the user has not suffisiant privileges  
+     * 
+     * @return a collection of link children found
+     */
+    public Collection getLinks(String parentUri) throws CmsPermissionException ;  
+    
+    /**
+     * 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 content. From this history element, it is possible to find previous version history element by calling {@link HistoryElement#getPrevious()} 
+     * @param versionnedContent The versionned content for which the version history has be found
+     * @return The History element found
+     * 
+     * @throws CmsPermissionException when the user has not suffisiant privileges
+     */
+    public HistoryElement getHistory(VersionnedContent versionnedContent) throws CmsPermissionException;
+    
+    
+    /**
+     * Instantiate a new empty filter object
+     * @return the instantiated filter object
+     */
+    public Filter newFilter();
+    
+
+    /**
+     * Get an object matching to a query
+     * @param clazz The class on which the query has to be exexuted
+     * @param filter The filter used by the query 
+     * @return The object found or null
+     * @throws CmsPermissionException when the user has not suffisiant privileges 
+     */
+    public Object getObjectByQuery(Class clazz, Filter filter) throws CmsPermissionException ;
+        
+    /**
+     * Get collection of object matching to a query 
+     * @param clazz The class on which the query has to be exexuted
+     * @param filter The filter used by the query 
+     * @return a collection of {@link CmsObject} 
+     * 
+     * @throws CmsPermissionException when the user has not suffisiant privileges  
+     */
+    public Collection getCollectionByQuery(Class clazz, Filter filter) throws CmsPermissionException ;;
+
+    
+    /**
+     * Get an iterator of object matching to a query    
+     * @param clazz The class on which the query has to be exexuted
+     * @param filter The filter used by the query 
+     * @return an iterator of of {@link CmsObject} 
+     * 
+     * @throws CmsPermissionException when the user has not suffisiant privileges  
+     */
+    public Iterator getIteratorByQuery(Class clazz, Filter filter) throws CmsPermissionException ;;
+    
+    /**
+     * Delete any kind of object (CmsObject, Server, HistoryElement,  ...)
+     * @param object The object to delete
+     * @throws ContentPersistenceException when it is not possible to delete the object
+     * @throws CmsPermissionException when the user has not suffisiant privileges 
+     */
+    public void delete(Object object) throws ContentPersistenceException, CmsPermissionException;
+
+    /**
+     * Delete all object matching to a query 
+     * @param clazz The class on which the query has to be exexuted
+     * @param filter The filter used by the query 
+     * @throws ContentPersistenceException when it is not possible to delete the objects
+     * @throws CmsPermissionException when the user has not suffisiant privileges 
+     */
+    public void deleteAll(Class clazz, Filter filter) throws ContentPersistenceException, CmsPermissionException;
+
+    /**
+     * Insert a new object in the content store
+     * @param object The object to insert
+     * @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 a new object in the content store
+     * @param object The object to update
+     * @throws ContentPersistenceException when it is not possible to update the object
+     * @throws CmsPermissionException when the user has not suffisiant privileges 
+     */
+    public void update(Object object) throws ContentPersistenceException, CmsPermissionException;
+    
+    /**
+     * Check if the connection to this store is closed
+     * @return true if the connection is close
+     */
+    public boolean isClosed();
+    
+    /**
+     * Close the connection to this store
+     */
+    public void close();
+    
+    /**
+     * Get the content store scope
+     * @return the content store scope
+     */
+    public String getScope();
+    
+}

Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/ContentStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/AbstractGraffitoStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/fs/FileSystemContentStore.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/fs/FileSystemContentStore.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/fs/FileSystemContentStore.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/fs/FileSystemContentStore.java Wed Sep 20 12:37:05 2006
@@ -1,240 +1,240 @@
-/*
- * Copyright 2000-2004 The Apache Software Foundation.
- * 
- * 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.store.impl.fs;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-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.FileSystemServer;
-import org.apache.portals.graffito.model.server.Server;
-import org.apache.portals.graffito.persistence.ContentPersistenceException;
-import org.apache.portals.graffito.security.CmsAccessController;
-import org.apache.portals.graffito.services.search.Filter;
-import org.apache.portals.graffito.store.ContentStore;
-import org.apache.portals.graffito.store.impl.AbstractGraffitoStore;
-
-/**
- * File System Content Store
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: $
- */
-public class FileSystemContentStore extends AbstractGraffitoStore implements ContentStore
-{
-    
-    private FileSystemServer fileSystemServer;
-    
-    
-    /**
-     * Constructor based on the a server object.
-     * 
-     * @param server
-     *            The server object contains all information to connect to this
-     *            content store
-     * @param cmsAccessController
-     *            The CmsAccesController used to check the permissions
-     *            
-     * @throws CmsInstantiateException
-     *             when it is not possible to instantiate this store
-     */
-    public FileSystemContentStore(Server server, CmsAccessController cmsAccessController) throws CmsInstantiateException
-    {
-        super(server, cmsAccessController);
-        fileSystemServer = (FileSystemServer) server;
-    }
-    
-    
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#getCmsObject(java.lang.String)
-     */
-    public CmsObject getCmsObject(String uri) throws CmsPermissionException
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#getChildren(java.lang.String)
-     */
-    public Collection getChildren(String parentUri)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#getFolders(java.lang.String)
-     */
-    public Collection getFolders(String parentUri)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#getDocuments(java.lang.String)
-     */
-    public Collection getDocuments(String parentUri)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public Collection getLinks(String parentUri)
-    {
-        // TODO Auto-generated method stub
-        return null;        
-    }
-    
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#insertHistoryElement(org.apache.portals.graffito.model.HistoryElement)
-     */
-    public void insertHistoryElement(HistoryElement historyElement)
-            throws ContentPersistenceException, CmsPermissionException
-    {
-        // TODO Auto-generated method stub
-
-    }
-
-    
-    
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#getContents(java.lang.String)
-     */
-    public Collection getContents(String parentUri) throws CmsPermissionException
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#getHistory(org.apache.portals.graffito.model.core.VersionnedContent)
-     */
-    public HistoryElement getHistory(VersionnedContent versionnedContent) throws CmsPermissionException
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#newFilter()
-     */
-    public Filter newFilter()
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#getObjectByQuery(java.lang.Class, org.apache.portals.graffito.search.Filter)
-     */
-    public Object getObjectByQuery(Class clazz, Filter filter)
-            throws CmsPermissionException
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#getCollectionByQuery(java.lang.Class, org.apache.portals.graffito.search.Filter)
-     */
-    public Collection getCollectionByQuery(Class clazz, Filter filter)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#getIteratorByQuery(java.lang.Class, org.apache.portals.graffito.search.Filter)
-     */
-    public Iterator getIteratorByQuery(Class clazz, Filter filter)
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#delete(java.lang.Object)
-     */
-    public void delete(Object object) throws ContentPersistenceException,
-            CmsPermissionException
-    {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#deleteAll(java.lang.Class, org.apache.portals.graffito.search.Filter)
-     */
-    public void deleteAll(Class clazz, Filter filter)
-            throws ContentPersistenceException, CmsPermissionException
-    {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#insert(java.lang.Object)
-     */
-    public void insert(Object object) throws ContentPersistenceException,
-            CmsPermissionException
-    {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#update(java.lang.Object)
-     */
-    public void update(Object object) throws ContentPersistenceException,
-            CmsPermissionException
-    {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#isClosed()
-     */
-    public boolean isClosed()
-    {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#close()
-     */
-    public void close()
-    {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.portals.graffito.store.ContentStore#getScope()
-     */
-    public String getScope()
-    {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-}
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * 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.store.impl.fs;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+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.FileSystemServer;
+import org.apache.portals.graffito.model.server.Server;
+import org.apache.portals.graffito.persistence.ContentPersistenceException;
+import org.apache.portals.graffito.security.CmsAccessController;
+import org.apache.portals.graffito.services.search.Filter;
+import org.apache.portals.graffito.store.ContentStore;
+import org.apache.portals.graffito.store.impl.AbstractGraffitoStore;
+
+/**
+ * File System Content Store
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class FileSystemContentStore extends AbstractGraffitoStore implements ContentStore
+{
+    
+    private FileSystemServer fileSystemServer;
+    
+    
+    /**
+     * Constructor based on the a server object.
+     * 
+     * @param server
+     *            The server object contains all information to connect to this
+     *            content store
+     * @param cmsAccessController
+     *            The CmsAccesController used to check the permissions
+     *            
+     * @throws CmsInstantiateException
+     *             when it is not possible to instantiate this store
+     */
+    public FileSystemContentStore(Server server, CmsAccessController cmsAccessController) throws CmsInstantiateException
+    {
+        super(server, cmsAccessController);
+        fileSystemServer = (FileSystemServer) server;
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#getCmsObject(java.lang.String)
+     */
+    public CmsObject getCmsObject(String uri) throws CmsPermissionException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#getChildren(java.lang.String)
+     */
+    public Collection getChildren(String parentUri)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#getFolders(java.lang.String)
+     */
+    public Collection getFolders(String parentUri)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#getDocuments(java.lang.String)
+     */
+    public Collection getDocuments(String parentUri)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getLinks(String parentUri)
+    {
+        // TODO Auto-generated method stub
+        return null;        
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#insertHistoryElement(org.apache.portals.graffito.model.HistoryElement)
+     */
+    public void insertHistoryElement(HistoryElement historyElement)
+            throws ContentPersistenceException, CmsPermissionException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    
+    
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#getContents(java.lang.String)
+     */
+    public Collection getContents(String parentUri) throws CmsPermissionException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#getHistory(org.apache.portals.graffito.model.core.VersionnedContent)
+     */
+    public HistoryElement getHistory(VersionnedContent versionnedContent) throws CmsPermissionException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#newFilter()
+     */
+    public Filter newFilter()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#getObjectByQuery(java.lang.Class, org.apache.portals.graffito.search.Filter)
+     */
+    public Object getObjectByQuery(Class clazz, Filter filter)
+            throws CmsPermissionException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#getCollectionByQuery(java.lang.Class, org.apache.portals.graffito.search.Filter)
+     */
+    public Collection getCollectionByQuery(Class clazz, Filter filter)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#getIteratorByQuery(java.lang.Class, org.apache.portals.graffito.search.Filter)
+     */
+    public Iterator getIteratorByQuery(Class clazz, Filter filter)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#delete(java.lang.Object)
+     */
+    public void delete(Object object) throws ContentPersistenceException,
+            CmsPermissionException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#deleteAll(java.lang.Class, org.apache.portals.graffito.search.Filter)
+     */
+    public void deleteAll(Class clazz, Filter filter)
+            throws ContentPersistenceException, CmsPermissionException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#insert(java.lang.Object)
+     */
+    public void insert(Object object) throws ContentPersistenceException,
+            CmsPermissionException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#update(java.lang.Object)
+     */
+    public void update(Object object) throws ContentPersistenceException,
+            CmsPermissionException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#isClosed()
+     */
+    public boolean isClosed()
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#close()
+     */
+    public void close()
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.portals.graffito.store.ContentStore#getScope()
+     */
+    public String getScope()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/fs/FileSystemContentStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/DefaultOjbFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/GraffitoOJBStore.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/GraffitoOJBStore.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/GraffitoOJBStore.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/GraffitoOJBStore.java Wed Sep 20 12:37:05 2006
@@ -1,503 +1,503 @@
-/*
- * 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.store.impl.ojb;
-
-import java.net.URL;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.Iterator;
-
-import org.apache.ojb.broker.PBKey;
-import org.apache.ojb.broker.PersistenceBroker;
-import org.apache.ojb.broker.metadata.ConnectionRepository;
-import org.apache.ojb.broker.metadata.DescriptorRepository;
-import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
-import org.apache.ojb.broker.metadata.MetadataException;
-import org.apache.ojb.broker.metadata.MetadataManager;
-import org.apache.ojb.broker.metadata.RepositoryPersistor;
-import org.apache.ojb.broker.query.Criteria;
-import org.apache.ojb.broker.query.Query;
-import org.apache.ojb.broker.query.QueryFactory;
-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.Content;
-import org.apache.portals.graffito.model.core.Folder;
-import org.apache.portals.graffito.model.core.HistoryElement;
-import org.apache.portals.graffito.model.core.Link;
-import org.apache.portals.graffito.model.core.VersionnedContent;
-import org.apache.portals.graffito.model.core.impl.FolderImpl;
-import org.apache.portals.graffito.model.core.impl.VersionnedContentImpl;
-import org.apache.portals.graffito.model.permission.CmsPermission;
-import org.apache.portals.graffito.model.server.GraffitoServer;
-import org.apache.portals.graffito.model.server.Server;
-import org.apache.portals.graffito.persistence.ContentPersistenceException;
-import org.apache.portals.graffito.security.CmsAccessController;
-import org.apache.portals.graffito.services.search.Filter;
-import org.apache.portals.graffito.services.search.impl.FilterImpl;
-import org.apache.portals.graffito.store.ContentStore;
-import org.apache.portals.graffito.store.impl.AbstractGraffitoStore;
-
-/**
- * 
- * Implementation for an OJB (Persistence Broker) Store
- * 
- *  
- */
-public class GraffitoOJBStore extends AbstractGraffitoStore implements ContentStore
-{
-    
-    private OjbFactory ojbFactory;
-    private PBKey pbKey;
-
-    /**
-     * Constructor based on the a server object.
-     * 
-     * @param server
-     *            The server object contains all information to connect to this
-     *            content store
-     * @param cmsAccessController
-     *            The CmsAccesController used to check the permissions
-     *            
-     * @throws CmsInstantiateException
-     *             when it is not possible to instantiate this store
-     */
-    public GraffitoOJBStore(Server server, CmsAccessController cmsAccessController) throws CmsInstantiateException
-    {
-        super(server, cmsAccessController);
-
-        // TODO : replace the following lines.
-        // * OjbSecureArrayList is an OJB Managable collection used to check the
-        // permissions when the method pb.getCollectionByQuery is called
-        // * OjbSecureIterator is a secure iterator used by this store in order
-        // to filter cms object
-        OjbSecureArrayList.setCmsAccessController(cmsAccessController);
-        OjbSecureIterator.setCmsAccessController(cmsAccessController);
-
-        GraffitoServer graffitoServer = (GraffitoServer) server;
-        try
-        {
-
-            ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
-            // check if the server alias is already registred in the OJB
-            // repository
-            this.scope = server.getScope();
-            pbKey = cr.getStandardPBKeyForJcdAlias(server.getAlias());
-            if (pbKey == null)
-            {
-
-                JdbcConnectionDescriptor jcd = new JdbcConnectionDescriptor();
-                // Use the datasource if defined
-                if ((graffitoServer.getDatasource() != null) && (!graffitoServer.getDatasource().equals("")))
-                {
-                    jcd.setDatasourceName(graffitoServer.getDatasource());
-                }
-                else
-                {
-                    jcd.setUserName(graffitoServer.getLogin());
-                    jcd.setPassWord(graffitoServer.getPassword());
-                }
-
-                jcd.setJcdAlias(graffitoServer.getAlias());
-                jcd.setDbAlias(graffitoServer.getDbAlias());
-                jcd.setDbms(graffitoServer.getPlateform());
-                jcd.setDriver(graffitoServer.getDriver());
-                jcd.setJdbcLevel(graffitoServer.getJdbcLevel());
-                jcd.setProtocol(graffitoServer.getProtocol());
-                jcd.setSubProtocol(graffitoServer.getSubProtocol());
-
-                // Add new descriptor
-                cr.addDescriptor(jcd);
-                pbKey = new PBKey(server.getAlias(), graffitoServer.getLogin(), graffitoServer.getPassword());
-            }
-            mergeRepository();
-        }
-        catch (MetadataException e)
-        {
-            // if the connection already exist
-            log.error("An error occurs when building a Graffito : " + server.getAlias(), e);
-            throw new CmsInstantiateException("An error occurs when building a GraffitoStore : "
-                    + server.getAlias(), e);
-        }
-
-    }
-
- /**
-     * @see org.apache.portals.graffito.store.ContentStore#getCmsObject(String)
-     */
-    public CmsObject getCmsObject(String uri) throws CmsPermissionException
-    {
-        if (!cmsAccessController.hasPermission(uri, CmsPermission.VIEW))
-        {
-            throw new CmsPermissionException("Not sufficient permission to get the cms object : " + uri);
-        }
-        Criteria criteria = new Criteria();
-        criteria.addEqualTo("uri", uri);
-        Query query = QueryFactory.newQuery(CmsObject.class, criteria);
-        CmsObject cmsObject = (CmsObject) getBroker().getObjectByQuery(query);
-        return cmsObject;
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#getChildren(java.lang.String)
-     */
-    public Collection getChildren(String parentUri)  throws CmsPermissionException 
-    {
-        Filter filter = this.newFilter();
-        
-        // Check if the parenturi is the root store uri
-        if (this.scope.equals(parentUri))
-        {           
-            filter.addIsNull("parentId");
-        }
-        else
-        {                 
-            FolderImpl folder = (FolderImpl) this.getCmsObject(parentUri);
-            filter.addEqualTo("parentId", folder.getObjectId());
-        }
-
-        Collection c = this.getCollectionByQuery(CmsObject.class, filter);
-        
-        return c;
-        
-
-    }
-
-    /**
-     * 
-     * @see org.apache.portals.graffito.store.ContentStore#getLinks(java.lang.String)
-     */
-    public Collection getLinks(String parentUri) throws CmsPermissionException 
-    {
-        Filter filter = this.newFilter();
-
-        // Check if the parenturi is the root store uri
-        if (this.scope.equals(parentUri))
-        {
-            filter.addIsNull("parentId");
-        }
-        else
-        {
-            FolderImpl folder = (FolderImpl) this.getCmsObject(parentUri);
-            filter.addEqualTo("parentId", folder.getObjectId());
-        }
-
-        return this.getCollectionByQuery(Link.class, filter);
-    }
-    
-    
- /**
-     * @see org.apache.portals.graffito.store.ContentStore#getContents(java.lang.String)
-     */
-
-    public Collection getContents(String parentUri) throws CmsPermissionException 
-    {
-        Filter filter = this.newFilter();
-
-        // Check if the parenturi is the root store uri
-        if (this.scope.equals(parentUri))
-        {
-            filter.addIsNull("parentId");
-        }
-        else
-        {
-            FolderImpl folder = (FolderImpl) this.getCmsObject(parentUri);
-            filter.addEqualTo("parentId", folder.getObjectId());
-        }
-
-        return this.getCollectionByQuery(Content.class, filter);
-    }
-    
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#getFolders(java.lang.String)
-     */
-    public Collection getFolders(String parentUri) throws CmsPermissionException 
-    {
-        Filter filter = this.newFilter();
-
-        // Check if the parenturi is the root store uri
-        if (this.scope.equals(parentUri))
-        {
-            filter.addIsNull("parentId");
-        }
-        else
-        {
-            FolderImpl folder = (FolderImpl) this.getCmsObject(parentUri);
-            filter.addEqualTo("parentId", folder.getObjectId());
-        }
-
-        return this.getCollectionByQuery(Folder.class, filter);
-    }
-    
- 
-    /**
-     * 
-     * @see org.apache.portals.graffito.store.ContentStore#getHistory(org.apache.portals.graffito.model.core.VersionnedContent)
-     */
-    public HistoryElement getHistory(VersionnedContent content) throws CmsPermissionException
-    {
-        // Find the first element in the history
-        Filter filter = this.newFilter();
-        filter.setScope(content.getUri());
-        filter.addEqualTo("versionnedContentId", ((VersionnedContentImpl) content).getObjectId());
-        HistoryElement historyElement = (HistoryElement) this.getObjectByQuery(HistoryElement.class, filter);
-        return historyElement;
-
-    }
-
-
-    /**
-     * 
-     * @see org.apache.portals.graffito.store.ContentStore#insertHistoryElement(org.apache.portals.graffito.model.core.HistoryElement)
-     */
-    public void insertHistoryElement(HistoryElement historyElement) throws ContentPersistenceException, CmsPermissionException
-    {
-        this.insert(historyElement);
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#newFilter()
-     */
-    public Filter newFilter()
-    {
-        Filter filter = new FilterImpl();
-        return filter;
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#getObjectByQuery(Class,
-     *      Filter)
-     */
-    public Object getObjectByQuery(Class clazz, Filter filter) throws CmsPermissionException
-    {
-        Query query = this.convert2Query(clazz, filter);
-        Object object = getBroker().getObjectByQuery(query);
-        if (!cmsAccessController.hasPermission(object, CmsPermission.VIEW))
-        {
-            throw new CmsPermissionException("Not sufficient permission to get the object by query");
-        }
-        return object;
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#getCollectionByQuery(Class,
-     *      Filter)
-     */
-    public Collection getCollectionByQuery(Class clazz, Filter filter)
-    {
-
-        Query query = this.convert2Query(clazz, filter);
-        OjbSecureArrayList result = (OjbSecureArrayList) getBroker().getCollectionByQuery(
-                OjbSecureArrayList.class, query);
-        return result;
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#getIteratorByQuery(Class,
-     *      Filter)
-     */
-    public Iterator getIteratorByQuery(Class clazz, Filter filter)
-    {
-        Query query = this.convert2Query(clazz, filter);
-        Iterator iterator = getBroker().getIteratorByQuery(query);
-        return new OjbSecureIterator(iterator);
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#delete(Object)
-     */
-    public void delete(Object object) throws ContentPersistenceException, CmsPermissionException
-    {
-
-        try
-        {
-            if (!cmsAccessController.hasPermission(object, CmsPermission.DELETE))
-            {
-                throw new CmsPermissionException("Not sufficient permission to delete the object");
-            }
-            getBroker().delete(object);
-        }
-        catch (Exception e)
-        {
-            throw new ContentPersistenceException(e);
-        }
-
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#deleteAll(Class, Filter)
-     */
-    public void deleteAll(Class clazz, Filter filter) throws ContentPersistenceException,
-            CmsPermissionException
-    {
-        try
-        {
-
-            // Convert Graffito filter object into OJB criteria
-            Criteria criteria = ((FilterImpl) filter).getCriteria();
-
-            Query query = QueryFactory.newQuery(clazz, criteria);
-
-            Collection deletes = getBroker().getCollectionByQuery(query);
-            Iterator itr = deletes.iterator();
-            while (itr.hasNext())
-            {
-                Object object = itr.next();
-                if (!cmsAccessController.hasPermission(object, CmsPermission.DELETE))
-                {
-                    throw new CmsPermissionException("Not sufficient permission to delete the object");
-                }
-                getBroker().delete(object);
-            }
-        }
-        catch (Exception e)
-        {
-            throw new ContentPersistenceException(e);
-        }
-
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#insert(java.lang.Object)
-     */
-    public void insert(Object object) throws ContentPersistenceException, CmsPermissionException
-    {
-        if (!cmsAccessController.hasPermission(object, CmsPermission.INSERT))
-        {
-            throw new CmsPermissionException("Not sufficient permission to insert the object");
-        }
-        this.store(object);
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#update(java.lang.Object)
-     */
-    public void update(Object object) throws ContentPersistenceException, CmsPermissionException
-    {
-        if (!cmsAccessController.hasPermission(object, CmsPermission.UPDATE))
-        {
-            throw new CmsPermissionException("Not sufficient permission to update the object");
-        }
-        this.store(object);
-    }
-
-    private void store(Object object) throws ContentPersistenceException
-    {
-        try
-        {
-            getBroker().store(object);
-
-        }
-        catch (Exception e)
-        {
-            throw new ContentPersistenceException(e);
-        }
-
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#isClosed()
-     */
-    public boolean isClosed()
-    {
-        return getBroker().isClosed();
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#close()
-     */
-    public void close()
-    {
-        getBroker().close();
-        ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
-        cr.removeDescriptor(pbKey);
-    }
-
-    /**
-     * @see org.apache.portals.graffito.store.ContentStore#getScope()
-     */
-    public String getScope()
-    {
-        return this.scope;
-    }
-    
-    private PersistenceBroker getBroker()
-    {
-
-        PersistenceBroker broker = ojbFactory.getPersistenceBroker(this.pbKey, true);
-        return broker;
-    }
-
-    private void mergeRepository()
-    {
-        URL descriptorUrl = null;
-        try
-        {
-            MetadataManager metaManager = MetadataManager.getInstance();
-            RepositoryPersistor persistor = new RepositoryPersistor();
-            Enumeration descriptors = getClass().getClassLoader()
-                    .getResources("META-INF/repository_graffito.xml");
-            while (descriptors.hasMoreElements())
-            {
-                descriptorUrl = (URL) descriptors.nextElement();
-                log.info("Merging OJB respository: " + descriptorUrl);
-                DescriptorRepository repo = persistor.readDescriptorRepository(descriptorUrl.openStream());
-                metaManager.mergeDescriptorRepository(repo);
-            }
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-            log.warn("Impossible to merge descriptor : " + descriptorUrl);
-        }
-    }
-
-    /**
-     * Convert Graffito filter object into OJB query object
-     * 
-     * @param filter
-     *            The Graffito filter object to convert
-     * @param clazz
-     *            The class on which the query has to be executed
-     * @return The OJB query
-     */
-    private Query convert2Query(Class clazz, Filter filter)
-    {
-        Criteria criteria = ((FilterImpl) filter).getCriteria();
-        String filterScope = filter.getScope();
-        // if the class is a CmsObject, check the filter scope is defined in
-        // order to limit the search on this one
-        if (clazz.equals(CmsObject.class) && filterScope != null && !filterScope.equals(""))
-        {
-            criteria.addLike("uri", filterScope + "%");
-        }
-        Query query = QueryFactory.newQuery(clazz, criteria);
-        return query;
-
-    }
-
-    /**
-     * Initialise the Ojb factory to use with this PB content store.
-     * 
-     * @param ojbFactory
-     *            The ojbFactory to set.
-     */
-    public void setOjbFactory(OjbFactory ojbFactory)
-    {
-        this.ojbFactory = ojbFactory;
-    }
+/*
+ * 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.store.impl.ojb;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+
+import org.apache.ojb.broker.PBKey;
+import org.apache.ojb.broker.PersistenceBroker;
+import org.apache.ojb.broker.metadata.ConnectionRepository;
+import org.apache.ojb.broker.metadata.DescriptorRepository;
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
+import org.apache.ojb.broker.metadata.MetadataException;
+import org.apache.ojb.broker.metadata.MetadataManager;
+import org.apache.ojb.broker.metadata.RepositoryPersistor;
+import org.apache.ojb.broker.query.Criteria;
+import org.apache.ojb.broker.query.Query;
+import org.apache.ojb.broker.query.QueryFactory;
+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.Content;
+import org.apache.portals.graffito.model.core.Folder;
+import org.apache.portals.graffito.model.core.HistoryElement;
+import org.apache.portals.graffito.model.core.Link;
+import org.apache.portals.graffito.model.core.VersionnedContent;
+import org.apache.portals.graffito.model.core.impl.FolderImpl;
+import org.apache.portals.graffito.model.core.impl.VersionnedContentImpl;
+import org.apache.portals.graffito.model.permission.CmsPermission;
+import org.apache.portals.graffito.model.server.GraffitoServer;
+import org.apache.portals.graffito.model.server.Server;
+import org.apache.portals.graffito.persistence.ContentPersistenceException;
+import org.apache.portals.graffito.security.CmsAccessController;
+import org.apache.portals.graffito.services.search.Filter;
+import org.apache.portals.graffito.services.search.impl.FilterImpl;
+import org.apache.portals.graffito.store.ContentStore;
+import org.apache.portals.graffito.store.impl.AbstractGraffitoStore;
+
+/**
+ * 
+ * Implementation for an OJB (Persistence Broker) Store
+ * 
+ *  
+ */
+public class GraffitoOJBStore extends AbstractGraffitoStore implements ContentStore
+{
+    
+    private OjbFactory ojbFactory;
+    private PBKey pbKey;
+
+    /**
+     * Constructor based on the a server object.
+     * 
+     * @param server
+     *            The server object contains all information to connect to this
+     *            content store
+     * @param cmsAccessController
+     *            The CmsAccesController used to check the permissions
+     *            
+     * @throws CmsInstantiateException
+     *             when it is not possible to instantiate this store
+     */
+    public GraffitoOJBStore(Server server, CmsAccessController cmsAccessController) throws CmsInstantiateException
+    {
+        super(server, cmsAccessController);
+
+        // TODO : replace the following lines.
+        // * OjbSecureArrayList is an OJB Managable collection used to check the
+        // permissions when the method pb.getCollectionByQuery is called
+        // * OjbSecureIterator is a secure iterator used by this store in order
+        // to filter cms object
+        OjbSecureArrayList.setCmsAccessController(cmsAccessController);
+        OjbSecureIterator.setCmsAccessController(cmsAccessController);
+
+        GraffitoServer graffitoServer = (GraffitoServer) server;
+        try
+        {
+
+            ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
+            // check if the server alias is already registred in the OJB
+            // repository
+            this.scope = server.getScope();
+            pbKey = cr.getStandardPBKeyForJcdAlias(server.getAlias());
+            if (pbKey == null)
+            {
+
+                JdbcConnectionDescriptor jcd = new JdbcConnectionDescriptor();
+                // Use the datasource if defined
+                if ((graffitoServer.getDatasource() != null) && (!graffitoServer.getDatasource().equals("")))
+                {
+                    jcd.setDatasourceName(graffitoServer.getDatasource());
+                }
+                else
+                {
+                    jcd.setUserName(graffitoServer.getLogin());
+                    jcd.setPassWord(graffitoServer.getPassword());
+                }
+
+                jcd.setJcdAlias(graffitoServer.getAlias());
+                jcd.setDbAlias(graffitoServer.getDbAlias());
+                jcd.setDbms(graffitoServer.getPlateform());
+                jcd.setDriver(graffitoServer.getDriver());
+                jcd.setJdbcLevel(graffitoServer.getJdbcLevel());
+                jcd.setProtocol(graffitoServer.getProtocol());
+                jcd.setSubProtocol(graffitoServer.getSubProtocol());
+
+                // Add new descriptor
+                cr.addDescriptor(jcd);
+                pbKey = new PBKey(server.getAlias(), graffitoServer.getLogin(), graffitoServer.getPassword());
+            }
+            mergeRepository();
+        }
+        catch (MetadataException e)
+        {
+            // if the connection already exist
+            log.error("An error occurs when building a Graffito : " + server.getAlias(), e);
+            throw new CmsInstantiateException("An error occurs when building a GraffitoStore : "
+                    + server.getAlias(), e);
+        }
+
+    }
+
+ /**
+     * @see org.apache.portals.graffito.store.ContentStore#getCmsObject(String)
+     */
+    public CmsObject getCmsObject(String uri) throws CmsPermissionException
+    {
+        if (!cmsAccessController.hasPermission(uri, CmsPermission.VIEW))
+        {
+            throw new CmsPermissionException("Not sufficient permission to get the cms object : " + uri);
+        }
+        Criteria criteria = new Criteria();
+        criteria.addEqualTo("uri", uri);
+        Query query = QueryFactory.newQuery(CmsObject.class, criteria);
+        CmsObject cmsObject = (CmsObject) getBroker().getObjectByQuery(query);
+        return cmsObject;
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#getChildren(java.lang.String)
+     */
+    public Collection getChildren(String parentUri)  throws CmsPermissionException 
+    {
+        Filter filter = this.newFilter();
+        
+        // Check if the parenturi is the root store uri
+        if (this.scope.equals(parentUri))
+        {           
+            filter.addIsNull("parentId");
+        }
+        else
+        {                 
+            FolderImpl folder = (FolderImpl) this.getCmsObject(parentUri);
+            filter.addEqualTo("parentId", folder.getObjectId());
+        }
+
+        Collection c = this.getCollectionByQuery(CmsObject.class, filter);
+        
+        return c;
+        
+
+    }
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.store.ContentStore#getLinks(java.lang.String)
+     */
+    public Collection getLinks(String parentUri) throws CmsPermissionException 
+    {
+        Filter filter = this.newFilter();
+
+        // Check if the parenturi is the root store uri
+        if (this.scope.equals(parentUri))
+        {
+            filter.addIsNull("parentId");
+        }
+        else
+        {
+            FolderImpl folder = (FolderImpl) this.getCmsObject(parentUri);
+            filter.addEqualTo("parentId", folder.getObjectId());
+        }
+
+        return this.getCollectionByQuery(Link.class, filter);
+    }
+    
+    
+ /**
+     * @see org.apache.portals.graffito.store.ContentStore#getContents(java.lang.String)
+     */
+
+    public Collection getContents(String parentUri) throws CmsPermissionException 
+    {
+        Filter filter = this.newFilter();
+
+        // Check if the parenturi is the root store uri
+        if (this.scope.equals(parentUri))
+        {
+            filter.addIsNull("parentId");
+        }
+        else
+        {
+            FolderImpl folder = (FolderImpl) this.getCmsObject(parentUri);
+            filter.addEqualTo("parentId", folder.getObjectId());
+        }
+
+        return this.getCollectionByQuery(Content.class, filter);
+    }
+    
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#getFolders(java.lang.String)
+     */
+    public Collection getFolders(String parentUri) throws CmsPermissionException 
+    {
+        Filter filter = this.newFilter();
+
+        // Check if the parenturi is the root store uri
+        if (this.scope.equals(parentUri))
+        {
+            filter.addIsNull("parentId");
+        }
+        else
+        {
+            FolderImpl folder = (FolderImpl) this.getCmsObject(parentUri);
+            filter.addEqualTo("parentId", folder.getObjectId());
+        }
+
+        return this.getCollectionByQuery(Folder.class, filter);
+    }
+    
+ 
+    /**
+     * 
+     * @see org.apache.portals.graffito.store.ContentStore#getHistory(org.apache.portals.graffito.model.core.VersionnedContent)
+     */
+    public HistoryElement getHistory(VersionnedContent content) throws CmsPermissionException
+    {
+        // Find the first element in the history
+        Filter filter = this.newFilter();
+        filter.setScope(content.getUri());
+        filter.addEqualTo("versionnedContentId", ((VersionnedContentImpl) content).getObjectId());
+        HistoryElement historyElement = (HistoryElement) this.getObjectByQuery(HistoryElement.class, filter);
+        return historyElement;
+
+    }
+
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.store.ContentStore#insertHistoryElement(org.apache.portals.graffito.model.core.HistoryElement)
+     */
+    public void insertHistoryElement(HistoryElement historyElement) throws ContentPersistenceException, CmsPermissionException
+    {
+        this.insert(historyElement);
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#newFilter()
+     */
+    public Filter newFilter()
+    {
+        Filter filter = new FilterImpl();
+        return filter;
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#getObjectByQuery(Class,
+     *      Filter)
+     */
+    public Object getObjectByQuery(Class clazz, Filter filter) throws CmsPermissionException
+    {
+        Query query = this.convert2Query(clazz, filter);
+        Object object = getBroker().getObjectByQuery(query);
+        if (!cmsAccessController.hasPermission(object, CmsPermission.VIEW))
+        {
+            throw new CmsPermissionException("Not sufficient permission to get the object by query");
+        }
+        return object;
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#getCollectionByQuery(Class,
+     *      Filter)
+     */
+    public Collection getCollectionByQuery(Class clazz, Filter filter)
+    {
+
+        Query query = this.convert2Query(clazz, filter);
+        OjbSecureArrayList result = (OjbSecureArrayList) getBroker().getCollectionByQuery(
+                OjbSecureArrayList.class, query);
+        return result;
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#getIteratorByQuery(Class,
+     *      Filter)
+     */
+    public Iterator getIteratorByQuery(Class clazz, Filter filter)
+    {
+        Query query = this.convert2Query(clazz, filter);
+        Iterator iterator = getBroker().getIteratorByQuery(query);
+        return new OjbSecureIterator(iterator);
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#delete(Object)
+     */
+    public void delete(Object object) throws ContentPersistenceException, CmsPermissionException
+    {
+
+        try
+        {
+            if (!cmsAccessController.hasPermission(object, CmsPermission.DELETE))
+            {
+                throw new CmsPermissionException("Not sufficient permission to delete the object");
+            }
+            getBroker().delete(object);
+        }
+        catch (Exception e)
+        {
+            throw new ContentPersistenceException(e);
+        }
+
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#deleteAll(Class, Filter)
+     */
+    public void deleteAll(Class clazz, Filter filter) throws ContentPersistenceException,
+            CmsPermissionException
+    {
+        try
+        {
+
+            // Convert Graffito filter object into OJB criteria
+            Criteria criteria = ((FilterImpl) filter).getCriteria();
+
+            Query query = QueryFactory.newQuery(clazz, criteria);
+
+            Collection deletes = getBroker().getCollectionByQuery(query);
+            Iterator itr = deletes.iterator();
+            while (itr.hasNext())
+            {
+                Object object = itr.next();
+                if (!cmsAccessController.hasPermission(object, CmsPermission.DELETE))
+                {
+                    throw new CmsPermissionException("Not sufficient permission to delete the object");
+                }
+                getBroker().delete(object);
+            }
+        }
+        catch (Exception e)
+        {
+            throw new ContentPersistenceException(e);
+        }
+
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#insert(java.lang.Object)
+     */
+    public void insert(Object object) throws ContentPersistenceException, CmsPermissionException
+    {
+        if (!cmsAccessController.hasPermission(object, CmsPermission.INSERT))
+        {
+            throw new CmsPermissionException("Not sufficient permission to insert the object");
+        }
+        this.store(object);
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#update(java.lang.Object)
+     */
+    public void update(Object object) throws ContentPersistenceException, CmsPermissionException
+    {
+        if (!cmsAccessController.hasPermission(object, CmsPermission.UPDATE))
+        {
+            throw new CmsPermissionException("Not sufficient permission to update the object");
+        }
+        this.store(object);
+    }
+
+    private void store(Object object) throws ContentPersistenceException
+    {
+        try
+        {
+            getBroker().store(object);
+
+        }
+        catch (Exception e)
+        {
+            throw new ContentPersistenceException(e);
+        }
+
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#isClosed()
+     */
+    public boolean isClosed()
+    {
+        return getBroker().isClosed();
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#close()
+     */
+    public void close()
+    {
+        getBroker().close();
+        ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
+        cr.removeDescriptor(pbKey);
+    }
+
+    /**
+     * @see org.apache.portals.graffito.store.ContentStore#getScope()
+     */
+    public String getScope()
+    {
+        return this.scope;
+    }
+    
+    private PersistenceBroker getBroker()
+    {
+
+        PersistenceBroker broker = ojbFactory.getPersistenceBroker(this.pbKey, true);
+        return broker;
+    }
+
+    private void mergeRepository()
+    {
+        URL descriptorUrl = null;
+        try
+        {
+            MetadataManager metaManager = MetadataManager.getInstance();
+            RepositoryPersistor persistor = new RepositoryPersistor();
+            Enumeration descriptors = getClass().getClassLoader()
+                    .getResources("META-INF/repository_graffito.xml");
+            while (descriptors.hasMoreElements())
+            {
+                descriptorUrl = (URL) descriptors.nextElement();
+                log.info("Merging OJB respository: " + descriptorUrl);
+                DescriptorRepository repo = persistor.readDescriptorRepository(descriptorUrl.openStream());
+                metaManager.mergeDescriptorRepository(repo);
+            }
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            log.warn("Impossible to merge descriptor : " + descriptorUrl);
+        }
+    }
+
+    /**
+     * Convert Graffito filter object into OJB query object
+     * 
+     * @param filter
+     *            The Graffito filter object to convert
+     * @param clazz
+     *            The class on which the query has to be executed
+     * @return The OJB query
+     */
+    private Query convert2Query(Class clazz, Filter filter)
+    {
+        Criteria criteria = ((FilterImpl) filter).getCriteria();
+        String filterScope = filter.getScope();
+        // if the class is a CmsObject, check the filter scope is defined in
+        // order to limit the search on this one
+        if (clazz.equals(CmsObject.class) && filterScope != null && !filterScope.equals(""))
+        {
+            criteria.addLike("uri", filterScope + "%");
+        }
+        Query query = QueryFactory.newQuery(clazz, criteria);
+        return query;
+
+    }
+
+    /**
+     * Initialise the Ojb factory to use with this PB content store.
+     * 
+     * @param ojbFactory
+     *            The ojbFactory to set.
+     */
+    public void setOjbFactory(OjbFactory ojbFactory)
+    {
+        this.ojbFactory = ojbFactory;
+    }
 }

Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/GraffitoOJBStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/OjbCmsPropertyCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/OjbFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/OjbSecureArrayList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/OjbSecureIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/SpringOjbFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/graffito/trunk/components/src/schema/graffitostore-schema.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/components/src/schema/graffitostore-schema.xml?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/components/src/schema/graffitostore-schema.xml (original)
+++ incubator/graffito/trunk/components/src/schema/graffitostore-schema.xml Wed Sep 20 12:37:05 2006
@@ -1,167 +1,167 @@
-<?xml version="1.0"?>
-<!--
-Copyright 2004 The Apache Software Foundation
-
-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.
--->
-<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_2.dtd">
-<!-- Autogenerated by JDBCToXMLSchema! -->
-<database name="graffito" >
-	<!--
-    	CREATING TABLES FOR GRAFFITO
-    	
-    -->
-	<table name="SERVER">
-		<column name="SERVER_ID" primaryKey="true" required="true" type="INTEGER"/>
-		<column name="SCOPE" required="true" size="254" type="VARCHAR"/>
-		<column name="ALIAS" required="true" size="254" type="VARCHAR"/>
-		<column name="DESCRIPTION" required="true" size="254" type="VARCHAR"/>
-		<column name="TITLE" required="true" size="254" type="VARCHAR"/>
-		<column name="PLUGIN_CLASS_NAME" required="true" size="254" type="VARCHAR"/>
-		<unique name="scope">
-			<unique-column name="SCOPE" />
-		</unique>
-		<unique name="alias">
-			<unique-column name="ALIAS" />
-		</unique>
-	</table>
-	<table name="WEBDAV_SERVER">
-		<column name="SERVER_ID" primaryKey="true" required="true" type="INTEGER"/>
-		<column name="URL" required="true" size="254" type="VARCHAR"/>
-		<column name="IS_SECURE_SERVER" required="true" size="1" type="VARCHAR"/>
-		<column name="USE_CURRENT_LOGIN" required="true" size="1" type="VARCHAR"/>
-		<column name="LOGIN" size="50" type="VARCHAR"/>
-		<column name="PASSWORD" size="50" type="VARCHAR"/>
-		<foreign-key foreignTable="SERVER" onDelete="cascade" >
-			<reference foreign="SERVER_ID" local="SERVER_ID"/>
-		</foreign-key>
-		<unique name="url">
-			<unique-column name="URL" />
-		</unique>
-	</table>
-	<table name="GRAFFITO_DB_SERVER">
-		<column name="SERVER_ID" primaryKey="true" required="true" type="INTEGER"/>
-		<column name="PLATEFORM" required="true" size="254" type="VARCHAR"/>
-		<column name="DB_ALIAS" required="true" size="254" type="VARCHAR"/>
-		<column name="JDBC_LEVEL" required="true" size="10" type="VARCHAR"/>
-		<column name="DRIVER" required="true" size="255" type="VARCHAR"/>
-		<column name="PROTOCOL" required="true" size="25" type="VARCHAR"/>
-		<column name="SUBPROTOCOL" required="true" size="25" type="VARCHAR"/>
-		<column name="LOGIN" size="50" type="VARCHAR"/>
-		<column name="PASSWORD" size="50" type="VARCHAR"/>
-		<column name="DATASOURCE" size="100" type="VARCHAR"/>
-		<foreign-key foreignTable="SERVER" onDelete="cascade">
-			<reference foreign="SERVER_ID" local="SERVER_ID"/>
-		</foreign-key>
-		<unique name="dbalias">
-			<unique-column name="DB_ALIAS" />
-		</unique>
-	</table>
-	<table name="GRAFFITO_FS_SERVER">
-		<column name="SERVER_ID" primaryKey="true" required="true" type="INTEGER"/>
-		<column name="ROOT" required="true" size="254" type="VARCHAR"/>
-		<foreign-key foreignTable="SERVER" onDelete="cascade">
-			<reference foreign="SERVER_ID" local="SERVER_ID"/>
-		</foreign-key>
-		<unique name="root">
-			<unique-column name="ROOT" />
-		</unique>
-	</table>
-	
-	
-	<table name="DOCUMENT_STREAM">
-		<column name="DOCUMENT_STREAM_ID" primaryKey="true" required="true" type="INTEGER"/>
-		<column name="CONTENT" type="BLOB"/>
-		<column name="ISO_CODE" size="5" type="VARCHAR"/>				
-		<column name="ENCODING" size="30" type="VARCHAR"/>
-	</table>
-	
-	<table name="CMS_OBJECT">
-		
-		<!-- The table contains all attributes used for CmsObject, Folder, Content, Link, VersionnedContent and Documents -->
-		
-		<!-- Commons attributes (defined in CmsObject) -->	
-		<column name="OBJECT_ID" primaryKey="true" required="true" type="INTEGER"/>
-		<column name="PARENT_ID" type="INTEGER"/>			
-		<column name="NAME" required="true" size="254" type="VARCHAR"/>
-		<column name="URI" required="true" size="254" type="VARCHAR"/>
-		<column name="CREATION_DATE" required="true" type="DATE"/>
-		<column name="DELTA" required="true" type="DATE"/>
-		
-		<!-- Link object -->
-		<column name="LINK_TARGET_ID" type="INTEGER"/>
-		
-		<!-- Versionned Content & its descendants -->
-		<column name="VERSION_NUM" size="10" type="VARCHAR"/>
-		<column name="IS_LAST_VERSION" type="INTEGER"/>
-
-        	<!-- Document object --> 
-		<column name="DOCUMENT_STREAM_ID" type="INTEGER"/>
-		<column name="CONTENT_SIZE" type="INTEGER"/>		
-		<column name="CONTENT_TYPE" size="254" type="VARCHAR"/>
-
-		<column name="CLASS_NAME" required="true" size="254" type="VARCHAR"/>		
-				
-		<foreign-key foreignTable="CMS_OBJECT" onDelete="cascade">
-			<reference foreign="OBJECT_ID" local="PARENT_ID"/>
-		</foreign-key>
-		<foreign-key foreignTable="DOCUMENT_STREAM" onDelete="cascade">
-			<reference foreign="DOCUMENT_STREAM_ID" local="DOCUMENT_STREAM_ID"/>
-		</foreign-key>
-		<index name="CMS_OBJECT_IDX1">
-			<index-column name="PARENT_ID" />
-		</index >
-		<index name="CMS_OBJECT_IDX2">
-			<index-column name="DOCUMENT_STREAM_ID" />
-		</index>
-		<unique name="URI_VERSION_NUM">
-			<unique-column name="URI" />
-			<unique-column name="VERSION_NUM" />
-		</unique>
-	</table>
-
-	<table name="PROPERTY">
-		<column name="PROPERTY_ID" primaryKey="true" required="true" type="INTEGER"/>
-		<column name="OBJECT_ID" type="INTEGER"/>			
-		<column name="NAME" required="true" size="254" type="VARCHAR"/>
-		<column name="VALUE" required="true" size="254" type="VARCHAR"/>
-		<foreign-key foreignTable="CMS_OBJECT" >
-			<reference foreign="OBJECT_ID" local="OBJECT_ID"/>
-		</foreign-key>
-		<index name="PROPERTY_IDX1">
-			<index-column name="OBJECT_ID" />
-		</index >
-	</table>
-	
-	<table name="VERSION_HISTORY">
-		<column name="HISTORY_ID" primaryKey="true" required="true" type="INTEGER"/>
-		<column name="OBJECT_ID" required="true" type="INTEGER"/>
-		<column name="PREVIOUS_ID" type="INTEGER"/>
-		<foreign-key foreignTable="CMS_OBJECT" onDelete="cascade">
-			<reference foreign="OBJECT_ID" local="OBJECT_ID"/>
-		</foreign-key>
-		<foreign-key foreignTable="VERSION_HISTORY" onDelete="cascade">
-			<reference foreign="HISTORY_ID" local="PREVIOUS_ID"/>
-		</foreign-key>
-		<index name="VERSION_HISTORY_IDX1">
-			<index-column name="OBJECT_ID" />
-		</index>
-		<index name="VERSION_HISTORY_IDX2">
-			<index-column name="PREVIOUS_ID" />
-		</index>
-	</table>
-	<table name="SYS_CMS_CLASSES">
-		<column name="CMS_CLASS_ID" primaryKey="true" required="true" size="100" type="VARCHAR"/>
-		<column name="CMS_CLASS" required="true" size="254" type="VARCHAR"/>
-	</table>
+<?xml version="1.0"?>
+<!--
+Copyright 2004 The Apache Software Foundation
+
+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.
+-->
+<!DOCTYPE database SYSTEM "http://db.apache.org/torque/dtd/database_3_2.dtd">
+<!-- Autogenerated by JDBCToXMLSchema! -->
+<database name="graffito" >
+	<!--
+    	CREATING TABLES FOR GRAFFITO
+    	
+    -->
+	<table name="SERVER">
+		<column name="SERVER_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="SCOPE" required="true" size="254" type="VARCHAR"/>
+		<column name="ALIAS" required="true" size="254" type="VARCHAR"/>
+		<column name="DESCRIPTION" required="true" size="254" type="VARCHAR"/>
+		<column name="TITLE" required="true" size="254" type="VARCHAR"/>
+		<column name="PLUGIN_CLASS_NAME" required="true" size="254" type="VARCHAR"/>
+		<unique name="scope">
+			<unique-column name="SCOPE" />
+		</unique>
+		<unique name="alias">
+			<unique-column name="ALIAS" />
+		</unique>
+	</table>
+	<table name="WEBDAV_SERVER">
+		<column name="SERVER_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="URL" required="true" size="254" type="VARCHAR"/>
+		<column name="IS_SECURE_SERVER" required="true" size="1" type="VARCHAR"/>
+		<column name="USE_CURRENT_LOGIN" required="true" size="1" type="VARCHAR"/>
+		<column name="LOGIN" size="50" type="VARCHAR"/>
+		<column name="PASSWORD" size="50" type="VARCHAR"/>
+		<foreign-key foreignTable="SERVER" onDelete="cascade" >
+			<reference foreign="SERVER_ID" local="SERVER_ID"/>
+		</foreign-key>
+		<unique name="url">
+			<unique-column name="URL" />
+		</unique>
+	</table>
+	<table name="GRAFFITO_DB_SERVER">
+		<column name="SERVER_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="PLATEFORM" required="true" size="254" type="VARCHAR"/>
+		<column name="DB_ALIAS" required="true" size="254" type="VARCHAR"/>
+		<column name="JDBC_LEVEL" required="true" size="10" type="VARCHAR"/>
+		<column name="DRIVER" required="true" size="255" type="VARCHAR"/>
+		<column name="PROTOCOL" required="true" size="25" type="VARCHAR"/>
+		<column name="SUBPROTOCOL" required="true" size="25" type="VARCHAR"/>
+		<column name="LOGIN" size="50" type="VARCHAR"/>
+		<column name="PASSWORD" size="50" type="VARCHAR"/>
+		<column name="DATASOURCE" size="100" type="VARCHAR"/>
+		<foreign-key foreignTable="SERVER" onDelete="cascade">
+			<reference foreign="SERVER_ID" local="SERVER_ID"/>
+		</foreign-key>
+		<unique name="dbalias">
+			<unique-column name="DB_ALIAS" />
+		</unique>
+	</table>
+	<table name="GRAFFITO_FS_SERVER">
+		<column name="SERVER_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="ROOT" required="true" size="254" type="VARCHAR"/>
+		<foreign-key foreignTable="SERVER" onDelete="cascade">
+			<reference foreign="SERVER_ID" local="SERVER_ID"/>
+		</foreign-key>
+		<unique name="root">
+			<unique-column name="ROOT" />
+		</unique>
+	</table>
+	
+	
+	<table name="DOCUMENT_STREAM">
+		<column name="DOCUMENT_STREAM_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="CONTENT" type="BLOB"/>
+		<column name="ISO_CODE" size="5" type="VARCHAR"/>				
+		<column name="ENCODING" size="30" type="VARCHAR"/>
+	</table>
+	
+	<table name="CMS_OBJECT">
+		
+		<!-- The table contains all attributes used for CmsObject, Folder, Content, Link, VersionnedContent and Documents -->
+		
+		<!-- Commons attributes (defined in CmsObject) -->	
+		<column name="OBJECT_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="PARENT_ID" type="INTEGER"/>			
+		<column name="NAME" required="true" size="254" type="VARCHAR"/>
+		<column name="URI" required="true" size="254" type="VARCHAR"/>
+		<column name="CREATION_DATE" required="true" type="DATE"/>
+		<column name="DELTA" required="true" type="DATE"/>
+		
+		<!-- Link object -->
+		<column name="LINK_TARGET_ID" type="INTEGER"/>
+		
+		<!-- Versionned Content & its descendants -->
+		<column name="VERSION_NUM" size="10" type="VARCHAR"/>
+		<column name="IS_LAST_VERSION" type="INTEGER"/>
+
+        	<!-- Document object --> 
+		<column name="DOCUMENT_STREAM_ID" type="INTEGER"/>
+		<column name="CONTENT_SIZE" type="INTEGER"/>		
+		<column name="CONTENT_TYPE" size="254" type="VARCHAR"/>
+
+		<column name="CLASS_NAME" required="true" size="254" type="VARCHAR"/>		
+				
+		<foreign-key foreignTable="CMS_OBJECT" onDelete="cascade">
+			<reference foreign="OBJECT_ID" local="PARENT_ID"/>
+		</foreign-key>
+		<foreign-key foreignTable="DOCUMENT_STREAM" onDelete="cascade">
+			<reference foreign="DOCUMENT_STREAM_ID" local="DOCUMENT_STREAM_ID"/>
+		</foreign-key>
+		<index name="CMS_OBJECT_IDX1">
+			<index-column name="PARENT_ID" />
+		</index >
+		<index name="CMS_OBJECT_IDX2">
+			<index-column name="DOCUMENT_STREAM_ID" />
+		</index>
+		<unique name="URI_VERSION_NUM">
+			<unique-column name="URI" />
+			<unique-column name="VERSION_NUM" />
+		</unique>
+	</table>
+
+	<table name="PROPERTY">
+		<column name="PROPERTY_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="OBJECT_ID" type="INTEGER"/>			
+		<column name="NAME" required="true" size="254" type="VARCHAR"/>
+		<column name="VALUE" required="true" size="254" type="VARCHAR"/>
+		<foreign-key foreignTable="CMS_OBJECT" >
+			<reference foreign="OBJECT_ID" local="OBJECT_ID"/>
+		</foreign-key>
+		<index name="PROPERTY_IDX1">
+			<index-column name="OBJECT_ID" />
+		</index >
+	</table>
+	
+	<table name="VERSION_HISTORY">
+		<column name="HISTORY_ID" primaryKey="true" required="true" type="INTEGER"/>
+		<column name="OBJECT_ID" required="true" type="INTEGER"/>
+		<column name="PREVIOUS_ID" type="INTEGER"/>
+		<foreign-key foreignTable="CMS_OBJECT" onDelete="cascade">
+			<reference foreign="OBJECT_ID" local="OBJECT_ID"/>
+		</foreign-key>
+		<foreign-key foreignTable="VERSION_HISTORY" onDelete="cascade">
+			<reference foreign="HISTORY_ID" local="PREVIOUS_ID"/>
+		</foreign-key>
+		<index name="VERSION_HISTORY_IDX1">
+			<index-column name="OBJECT_ID" />
+		</index>
+		<index name="VERSION_HISTORY_IDX2">
+			<index-column name="PREVIOUS_ID" />
+		</index>
+	</table>
+	<table name="SYS_CMS_CLASSES">
+		<column name="CMS_CLASS_ID" primaryKey="true" required="true" size="100" type="VARCHAR"/>
+		<column name="CMS_CLASS" required="true" size="254" type="VARCHAR"/>
+	</table>
 </database>

Propchange: incubator/graffito/trunk/components/src/schema/graffitostore-schema.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/schema/ojb-schema.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/schema/security-schema.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/Log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/OJB.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/persistence/impl/TestPersistenceService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/AllFilesTestRdbmsPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/AllPermissionTestRdbmsPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestPermissions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/security/impl/TestRdbmsPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/services/core/impl/TestContentModelService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/services/core/impl/TestContentSearchService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/services/core/impl/TestContentServerService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/services/core/impl/TestContentVersionService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/org/apache/portals/graffito/services/dm/impl/TestDocumentModelService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/repository.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/graffito/trunk/components/src/test/repository_internal.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message