portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r295121 - /portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
Date Wed, 05 Oct 2005 21:36:56 GMT
Author: taylor
Date: Wed Oct  5 14:36:55 2005
New Revision: 295121

URL: http://svn.apache.org/viewcvs?rev=295121&view=rev
Log:
the new version using Spring templates - just getting started here 

Added:
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java

Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java?rev=295121&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
(added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
Wed Oct  5 14:36:55 2005
@@ -0,0 +1,323 @@
+package org.apache.jetspeed.page.impl;
+
+import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport;
+import org.apache.jetspeed.exception.JetspeedException;
+import org.apache.jetspeed.idgenerator.IdGenerator;
+import org.apache.jetspeed.om.common.SecurityConstraint;
+import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.folder.Folder;
+import org.apache.jetspeed.om.folder.FolderNotFoundException;
+import org.apache.jetspeed.om.folder.InvalidFolderException;
+import org.apache.jetspeed.om.folder.MenuDefinition;
+import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
+import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
+import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
+import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
+import org.apache.jetspeed.om.page.ContentPage;
+import org.apache.jetspeed.om.page.Fragment;
+import org.apache.jetspeed.om.page.Link;
+import org.apache.jetspeed.om.page.Page;
+import org.apache.jetspeed.om.page.PageSecurity;
+import org.apache.jetspeed.om.page.Property;
+import org.apache.jetspeed.om.page.psml.PageImpl;
+import org.apache.jetspeed.page.FolderNotRemovedException;
+import org.apache.jetspeed.page.FolderNotUpdatedException;
+import org.apache.jetspeed.page.LinkNotRemovedException;
+import org.apache.jetspeed.page.LinkNotUpdatedException;
+import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.page.PageManagerEventListener;
+import org.apache.jetspeed.page.PageNotFoundException;
+import org.apache.jetspeed.page.PageNotRemovedException;
+import org.apache.jetspeed.page.PageNotUpdatedException;
+import org.apache.jetspeed.page.document.DocumentNotFoundException;
+import org.apache.jetspeed.page.document.NodeException;
+import org.apache.jetspeed.page.document.UnsupportedDocumentTypeException;
+import org.apache.ojb.broker.query.Criteria;
+import org.apache.ojb.broker.query.QueryByCriteria;
+import org.apache.ojb.broker.query.QueryFactory;
+
+
+/**
+ * DatabasePageManager
+ * 
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+
+public class DatabasePageManager extends InitablePersistenceBrokerDaoSupport
+        implements PageManager
+{
+    private DelegatingPageManager delegator;
+    
+    public DatabasePageManager(
+            String repositoryPath,
+            IdGenerator generator, 
+            boolean isPermissionsSecurity, 
+            boolean isConstraintsSecurity)
+
+    {
+        super(repositoryPath);
+        System.out.println("Page Manager repo = " + repositoryPath);
+        delegator = new DelegatingPageManager(generator, isPermissionsSecurity, isConstraintsSecurity);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#getConstraintsEnabled()
+     */
+    public boolean getConstraintsEnabled()
+    {
+        return delegator.getConstraintsEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#getPermissionsEnabled()
+     */
+    public boolean getPermissionsEnabled()
+    {
+        return delegator.getPermissionsEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newPage(java.lang.String)
+     */
+    public Page newPage(String path)
+    {
+        return delegator.newPage(path);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newFolder(java.lang.String)
+     */
+    public Folder newFolder(String path)
+    {
+        return delegator.newFolder(path);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newLink(java.lang.String)
+     */
+    public Link newLink(String path)
+    {
+        return delegator.newLink(path);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newFragment()
+     */
+    public Fragment newFragment()
+    {
+        return delegator.newFragment();    
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newProperty()
+     */
+    public Property newProperty()
+    {
+        return delegator.newProperty();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newMenuDefinition()
+     */
+    public MenuDefinition newMenuDefinition()
+    {
+        return delegator.newMenuDefinition();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newMenuExcludeDefinition()
+     */
+    public MenuExcludeDefinition newMenuExcludeDefinition()
+    {
+        return delegator.newMenuExcludeDefinition();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newMenuIncludeDefinition()
+     */
+    public MenuIncludeDefinition newMenuIncludeDefinition()
+    {
+        return delegator.newMenuIncludeDefinition();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newMenuOptionsDefinition()
+     */
+    public MenuOptionsDefinition newMenuOptionsDefinition()
+    {
+        return delegator.newMenuOptionsDefinition();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newMenuSeparatorDefinition()
+     */
+    public MenuSeparatorDefinition newMenuSeparatorDefinition()
+    {
+        return delegator.newMenuSeparatorDefinition();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newSecurityConstraints()
+     */
+    public SecurityConstraints newSecurityConstraints()
+    {
+        return delegator.newSecurityConstraints();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newSecurityConstraint()
+     */
+    public SecurityConstraint newSecurityConstraint()
+    {
+        return delegator.newSecurityConstraint();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#getPage(java.lang.String)
+     */
+    public Page getPage(String id) throws PageNotFoundException, NodeException
+    {
+        Criteria filter = new Criteria();        
+        filter.addEqualTo("id", id);
+        QueryByCriteria query = QueryFactory.newQuery(PageImpl.class, filter);
+        Page page = (Page) getPersistenceBrokerTemplate().getObjectByQuery(query);
+        if (page == null)
+        {
+            throw new PageNotFoundException("Page " + id + " not found.");
+        }
+        return page;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#getContentPage(java.lang.String)
+     */
+    public ContentPage getContentPage(String path)
+            throws PageNotFoundException, NodeException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#getLink(java.lang.String)
+     */
+    public Link getLink(String name) throws DocumentNotFoundException,
+            UnsupportedDocumentTypeException, FolderNotFoundException,
+            NodeException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#getPageSecurity()
+     */
+    public PageSecurity getPageSecurity() throws DocumentNotFoundException,
+            UnsupportedDocumentTypeException, FolderNotFoundException,
+            NodeException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#getFolder(java.lang.String)
+     */
+    public Folder getFolder(String folderPath) throws FolderNotFoundException,
+            InvalidFolderException, NodeException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#updatePage(org.apache.jetspeed.om.page.Page)
+     */
+    public void updatePage(Page page) throws JetspeedException,
+            PageNotUpdatedException
+    {
+        System.out.println("storing page " + page.getPath());
+        getPersistenceBrokerTemplate().store(page);
+        System.out.println("**** stored page " + page.getPath());        
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#removePage(org.apache.jetspeed.om.page.Page)
+     */
+    public void removePage(Page page) throws JetspeedException,
+            PageNotRemovedException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#updateFolder(org.apache.jetspeed.om.folder.Folder)
+     */
+    public void updateFolder(Folder folder) throws JetspeedException,
+            FolderNotUpdatedException
+    {
+        System.out.println("storing folder " + folder.getPath());
+        getPersistenceBrokerTemplate().store(folder);
+        System.out.println("**** stored folder " + folder.getPath());        
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#removeFolder(org.apache.jetspeed.om.folder.Folder)
+     */
+    public void removeFolder(Folder folder) throws JetspeedException,
+            FolderNotRemovedException
+    {
+        getPersistenceBrokerTemplate().delete(folder);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#updateLink(org.apache.jetspeed.om.page.Link)
+     */
+    public void updateLink(Link link) throws JetspeedException,
+            LinkNotUpdatedException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#removeLink(org.apache.jetspeed.om.page.Link)
+     */
+    public void removeLink(Link link) throws JetspeedException,
+            LinkNotRemovedException
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#addListener(org.apache.jetspeed.page.PageManagerEventListener)
+     */
+    public void addListener(PageManagerEventListener listener)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#removeListener(org.apache.jetspeed.page.PageManagerEventListener)
+     */
+    public void removeListener(PageManagerEventListener listener)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#clonePage(org.apache.jetspeed.om.page.Page,
java.lang.String)
+     */
+    public Page clonePage(Page source, String path) throws JetspeedException,
+            PageNotUpdatedException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message