incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r225696 - in /incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model: core/ core/impl/ dm/ dm/impl/ pemission/ pemission/impl/ server/ server/impl/
Date Thu, 28 Jul 2005 05:38:38 GMT
Author: clombart
Date: Wed Jul 27 22:38:29 2005
New Revision: 225696

URL: http://svn.apache.org/viewcvs?rev=225696&view=rev
Log:
Review object model (see GRFT-25)

Added:
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/CmsObjectImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/ContentImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/FolderImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/HistoryElementImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/LinkImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/PropertyImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/SysCmsClass.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/VersionnedContentImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentStreamImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/impl/
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/impl/CmsPermissionCollection.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/impl/CmsPermissionImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/FileSystemServerImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/GraffitoServerImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/ServerImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/WebdavServerImpl.java

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/CmsObjectImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/CmsObjectImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/CmsObjectImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/CmsObjectImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,294 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.core.impl;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.portals.graffito.model.core.CmsObject;
+import org.apache.portals.graffito.model.core.Folder;
+
+
+/**
+ * CmsObjectImpl
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * 
+ * 
+ */
+public class CmsObjectImpl implements CmsObject, Serializable
+{    
+    protected Long objectId;
+       
+    protected Long parentId;  //parent folder id
+    protected Folder parentFolder;
+    
+    protected String name;
+    protected String uri;
+    
+    protected Timestamp creationDate;
+    protected Timestamp lastModified;
+                      
+    protected Collection properties;
+    
+    /** 
+     * Special attribute telling OJB the object's concrete type.
+     *  
+     */    
+    protected String ojbConcreteClass; 
+       
+    /**
+     * Constructor
+     */
+    public CmsObjectImpl()
+    {
+        ojbConcreteClass = this.getClass().getName();       
+    }
+    
+    /**
+     * @return Returns the parentFolder.
+     */
+    public Folder getParentFolder()
+    {
+        return parentFolder;
+    }
+
+    /**
+     * @param parentFolder The parentFolder to set.
+     */
+    public void setParentFolder(Folder parentFolder)
+    {
+        this.parentFolder = parentFolder;
+    }
+
+    /**
+     * @param parentId The parentId to set.
+     */
+    public void setParentId(Long parentId)
+    {
+        this.parentId = parentId;
+    }
+
+    /**
+     * @return Returns the parentId.
+     */
+    public Long getParentId()
+    {
+        return parentId;
+    }
+       
+    
+    /**
+     * @return Returns the objectId.
+     */
+    public Long getObjectId()
+    {
+        return objectId;
+    }
+
+    /**
+     * @param objectId The objectId to set.
+     */
+    public void setObjectId(Long objectId)
+    {
+        this.objectId = objectId;
+    }
+    
+
+    /**
+     * @see org.apache.portals.graffito.model.core.CmsObject#getName()
+     */
+    public String getName()
+    {
+        return this.name;
+    }
+
+    /**
+     * @see org.apache.portals.graffito.model.core.CmsObject#setName(java.lang.String)
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    /** 
+     * @see org.apache.portals.graffito.model.core.CmsObject#getUri()
+     */
+    public String getUri()
+    {
+        return this.uri;
+    }
+
+    /** 
+     * @see org.apache.portals.graffito.model.core.CmsObject#setUri(java.lang.String)
+     */
+    public void setUri(String uri)
+    {
+        this.uri = uri;
+        
+    }
+    
+    /** 
+     * @see org.apache.portals.graffito.model.core.CmsObject#getCreationDate()
+     */
+    public Timestamp getCreationDate()
+    {
+        return this.creationDate;
+    }
+
+    /** 
+     * @see org.apache.portals.graffito.model.core.CmsObject#setCreationDate(java.sql.Timestamp)
+     */
+    public void setCreationDate(Timestamp creationDate)
+    {
+        this.creationDate = creationDate;
+    }
+
+    /** 
+     * @see org.apache.portals.graffito.model.core.CmsObject#getLastModified()
+     */
+    public Timestamp getLastModified()
+    {
+        return this.lastModified;
+    }
+
+    /**
+     * @see org.apache.portals.graffito.model.core.CmsObject#setLastModified(java.sql.Timestamp)
+     */
+    public void setLastModified(Timestamp lastModified)
+    {
+        this.lastModified = lastModified;
+    }
+
+    
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.core.CmsObject#getPath()
+     */
+    public String[] getPath()
+    {
+        return uri.substring(1).split(URI_SEPARATOR);
+    }
+    
+    /**
+     * 
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object cmsObject)
+    {
+        if (cmsObject == null)
+        {
+            return false;
+        }
+        
+        if ( ! (cmsObject instanceof CmsObject))
+        {
+            return false;
+        }
+        
+        return this.getUri().equals(((CmsObject) cmsObject).getUri());
+    }
+
+    
+    /** 
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return this.uri;
+    }
+    
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.core.CmsObject#getProperties()
+     */
+    public Collection getProperties()
+    {
+        return properties;
+    }
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.core.CmsObject#getProperty(java.lang.String)
+     */
+    public String getProperty(String propertyName)
+    {
+        PropertyImpl property = this.getPropertyImpl(propertyName);
+        if (property == null)
+        {
+            return null;
+        }
+        else
+        {
+            return property.getValue();
+        }
+    }
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.core.CmsObject#setProperty(java.lang.String, java.lang.String)
+     */
+    public void setProperty(String name, String value)
+    {
+        
+        PropertyImpl property = this.getPropertyImpl(name);
+        if (property == null)
+        {
+            property = new PropertyImpl();
+            property.setName(name);
+            property.setValue(value);
+            properties.add(property);            
+        }
+                
+        property.setValue(value);
+        
+    }
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.core.CmsObject#setProperties(java.util.Collection)
+     */   
+    public void setProperties(Collection properties)
+    {
+        properties.addAll(properties);       
+    }
+    
+    private PropertyImpl getPropertyImpl(String propertyName)
+    {
+        if (properties == null)
+        {
+           properties = new ArrayList();
+           return null;
+        }
+        
+        Iterator propertyIterator = properties.iterator();
+        while(propertyIterator.hasNext())
+        {
+            PropertyImpl property = (PropertyImpl) propertyIterator.next();
+            if (property.getName().equals(propertyName))
+            {
+                return property;
+            }
+        }
+        return null;
+        
+    }
+}

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/ContentImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/ContentImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/ContentImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/ContentImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.core.impl;
+
+import java.io.Serializable;
+
+import org.apache.portals.graffito.model.core.Content;
+
+
+/**
+ * Default implementation for {@link org.apache.portals.graffito.model.core.Content}
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ * 
+ * 
+ */
+public class ContentImpl extends CmsObjectImpl implements Content, Serializable
+{    
+
+    
+}

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/FolderImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/FolderImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/FolderImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/FolderImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.core.impl;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.portals.graffito.model.core.Folder;
+
+
+/**
+ * CMS FolderImpl implementation
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @version $Id: FolderImpl.java,v 1.1 2004/12/22 20:36:59 christophe Exp $
+ */
+public class FolderImpl extends CmsObjectImpl implements Folder, Serializable
+{
+
+    protected List folders;
+    protected List contents;
+    
+    /**
+     * @see org.apache.portals.graffito.model.core.Folder#getContents()
+     */
+    public List getContents()
+    {
+        return contents;
+    }
+
+    /**
+     * @see org.apache.portals.graffito.model.core.Folder#getFolders()
+     */
+    public List getFolders()
+    {
+        return folders;
+    }
+    
+}
+

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/HistoryElementImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/HistoryElementImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/HistoryElementImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/HistoryElementImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.core.impl;
+
+
+import java.io.Serializable;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.model.core.HistoryElement;
+import org.apache.portals.graffito.model.core.VersionnedContent;
+
+
+
+/**
+ * CMS History implementation.
+ * 
+ */
+public class HistoryElementImpl implements HistoryElement, Serializable
+{
+    protected final static Log log =  LogFactory.getLog(HistoryElementImpl.class);
+
+    protected Long historyElementId;
+    protected Long versionnedContentId;
+    protected Long previousId;
+    
+    
+    private VersionnedContent versionnedContent;
+    private HistoryElement previous;
+    
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.core.HistoryElement#getVersionnedContent()
+     */
+    public VersionnedContent getVersionnedContent()
+    {
+        return this.versionnedContent;
+    }
+    
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.core.HistoryElement#getPrevious()
+     */
+    public HistoryElement getPrevious()
+    {
+        return this.previous;
+    }
+    
+        
+    /**    
+     * @see org.apache.portals.graffito.model.core.HistoryElement#setVersionnedContent(org.apache.portals.graffito.model.core.VersionnedContent)
+     */
+    public void setVersionnedContent(VersionnedContent versionnedContent)
+    {
+        this.versionnedContent = versionnedContent;
+
+    }
+    
+    
+    /**
+     * @see org.apache.portals.graffito.model.core.HistoryElement#setPrevious(org.apache.portals.graffito.model.core.HistoryElement)
+     */
+    public void setPrevious(HistoryElement previous)
+    {
+       this.previous = previous;
+    }
+}
+

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/LinkImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/LinkImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/LinkImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/LinkImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.core.impl;
+
+import java.io.Serializable;
+
+import org.apache.portals.graffito.model.core.CmsObject;
+import org.apache.portals.graffito.model.core.Link;
+
+
+/**
+ * CMS LinkImpl implementation
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @version $Id: LinkImpl.java,v 1.1 2004/12/22 20:36:59 christophe Exp $
+ */
+public class LinkImpl extends CmsObjectImpl implements Link, Serializable
+{
+    private CmsObject targetCmsObject;
+    private Long targetCmsObjectId;
+    
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.core.Link#getTargetCmsObject()
+     */
+    public CmsObject getTargetCmsObject()
+    {
+        return targetCmsObject;
+    }
+    
+    /**
+     * @see org.apache.portals.graffito.model.core.Link#setTargetCmsObject(org.apache.portals.graffito.model.core.CmsObject)
+     */
+    public void setTargetCmsObject(CmsObject cmsObject)
+    {
+        this.targetCmsObject = cmsObject;
+    }
+    
+    /**
+     * Get the target cms object id 
+     * @return the id
+     */
+    public Long getTargetCmsObjectId()
+    {
+        return targetCmsObjectId;
+    }
+    
+    /**
+     * Set the target cms object id 
+     * @param targetCmsObjectId The id to set
+     */
+    public void setTargetCmsObjectId(Long targetCmsObjectId)
+    {
+        this.targetCmsObjectId = targetCmsObjectId;
+    }
+}
+

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/PropertyImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/PropertyImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/PropertyImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/PropertyImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,92 @@
+/*
+ * 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.model.core.impl;
+
+/**
+ *
+ * CmsObject property
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class PropertyImpl
+{
+    protected Long id; 
+    protected Long objectId;
+    protected String name;
+    protected String value;
+    
+    
+    
+    /**
+     * @return Returns the id.
+     */
+    public Long getId()
+    {
+        return id;
+    }
+    /**
+     * @param id The id to set.
+     */
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+    /**
+     * @return Returns the objectId.
+     */
+    public Long getObjectId()
+    {
+        return objectId;
+    }
+    
+    /**
+     * @param objectId The objectId to set.
+     */
+    public void setObjectId(Long objectId)
+    {
+        this.objectId = objectId;
+    }
+        
+    /**
+     * @return Returns the name.
+     */
+    public String getName()
+    {
+        return name;
+    }
+    /**
+     * @param name The name to set.
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+    /**
+     * @return Returns the value.
+     */
+    public String getValue()
+    {
+        return value;
+    }
+    /**
+     * @param value The value to set.
+     */
+    public void setValue(String value)
+    {
+        this.value = value;
+    }
+}

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/SysCmsClass.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/SysCmsClass.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/SysCmsClass.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/SysCmsClass.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.core.impl;
+
+import java.io.Serializable;
+
+/**
+ * CmsObjectImpl
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * 
+ * 
+ */
+public class SysCmsClass implements Serializable
+{
+    private String cmsClassId;
+    private String cmsClass;
+
+    /**
+     * @return Returns the cmsClass.
+     */
+    public String getCmsClass()
+    {
+        return cmsClass;
+    }
+
+    /**
+     * @param cmsClass The cmsClass to set.
+     */
+    public void setCmsClass(String cmsClass)
+    {
+        this.cmsClass = cmsClass;
+    }
+
+    /**
+     * @return Returns the cmsClassId.
+     */
+    public String getCmsClassId()
+    {
+        return cmsClassId;
+    }
+
+    /**
+     * @param cmsClassId The cmsClassId to set.
+     */
+    public void setCmsClassId(String cmsClassId)
+    {
+        this.cmsClassId = cmsClassId;
+    }
+
+}

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/VersionnedContentImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/VersionnedContentImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/VersionnedContentImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/core/impl/VersionnedContentImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.core.impl;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.StringTokenizer;
+
+import org.apache.portals.graffito.model.core.VersionnedContent;
+
+
+/**
+ * CmsObjectImpl
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * 
+ * 
+ */
+public class VersionnedContentImpl extends ContentImpl implements VersionnedContent, Serializable
+{
+    protected boolean isLastVersion = true;
+    protected String versionNumber;  
+        
+       
+    /**
+     * Constructor
+     */
+    public VersionnedContentImpl()
+    {
+        ojbConcreteClass = this.getClass().getName();       
+    }
+    
+    
+    /**
+     * @see org.apache.portals.graffito.model.core.VersionnedContent#isLastVersion()
+     */
+    public boolean isLastVersion()
+    {
+        return isLastVersion;
+    }
+    
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.core.VersionnedContent#setLastVersion(boolean)
+     */
+    public void setLastVersion(boolean isLastVersion)
+    {
+        this.isLastVersion = isLastVersion;
+
+    }
+    
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.core.VersionnedContent#setVersionNumber(java.lang.String)
+     */
+    public void setVersionNumber(String versionNumber)
+    {
+        this.versionNumber = versionNumber;
+    }
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.core.VersionnedContent#getVersionNumber()
+     */
+    public String getVersionNumber()
+    {
+        return versionNumber;
+    }    
+    
+    /**
+     * Compare 2 VersionContentImpl in function of their version number.
+     * The version number structure is a point separated digit.
+     * @param o The object to compare
+     * @return -1,0 or 1 for less than, equals, greater than
+     */    
+    public int compareTo(Object o)
+    {
+        if (!(o instanceof VersionnedContentImpl))
+        {
+            return -1;
+        }
+        StringTokenizer myVersionNum = new StringTokenizer(this.getVersionNumber(), ".");
+        StringTokenizer oCode = new StringTokenizer(((VersionnedContentImpl) o).getVersionNumber(), ".");
+
+        while (myVersionNum.hasMoreElements())
+        {
+            if (oCode.hasMoreElements())
+            {
+                int myInteger = 0;
+                try
+                {
+                    myInteger = Integer.parseInt(myVersionNum.nextToken());
+                }
+                catch (Exception e)
+                {
+                    /* suppose that everything is a int */
+                }
+                int oInteger = 0;
+                try
+                {
+                    oInteger = Integer.parseInt(oCode.nextToken());
+
+                }
+                catch (Exception e)
+                {
+                    /* suppose that everything is a int */
+                }
+                if (myInteger != oInteger)
+                {
+
+                    return myInteger - oInteger;
+                }
+
+            }
+            else
+            {
+                return 1;
+            }
+        }
+        if (oCode.hasMoreElements())
+            return -1;
+        else
+            return 0;
+    }     
+    
+    /**
+     * 
+     * @return The cloned object
+     * @throws CloneNotSupportedException when it is not possible to clone the document
+     */
+    public Object clone()  throws CloneNotSupportedException
+    {
+       VersionnedContent clone = new VersionnedContentImpl();       
+       clone.setCreationDate(new Timestamp(System.currentTimeMillis()));
+       clone.setLastModified(new Timestamp(System.currentTimeMillis()));
+       clone.setName(this.getName());
+       clone.setParentFolder(this.getParentFolder());            
+       clone.setUri(this.getUri());       
+       clone.setProperties(this.getProperties());
+       return clone;
+       
+    }
+
+}

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.dm.impl;
+
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.model.core.impl.VersionnedContentImpl;
+import org.apache.portals.graffito.model.dm.Document;
+import org.apache.portals.graffito.model.dm.DocumentStream;
+
+
+
+/**
+ * CMS VersionnedDocument implementation.
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * 
+ */
+public class DocumentImpl extends VersionnedContentImpl implements Document, Serializable
+{
+    protected final static Log log =  LogFactory.getLog(DocumentImpl.class);
+    
+    protected long size;
+    protected String contentType;
+    
+    protected Long documentStreamId;
+    protected DocumentStream documentStream;
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.dm.Document#getContentType()
+     */
+    public String getContentType()
+    {
+        return this.contentType;
+    }
+
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.dm.Document#setContentType(java.lang.String)
+     */
+    public void setContentType(String contentType)
+    {
+        this.contentType = contentType;
+    }
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.dm.Document#getSize()
+     */
+    public long getSize()
+    {
+        return size;
+    }
+
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.dm.Document#setSize(long)
+     */
+    public void setSize(long size)
+    {
+        this.size = size;
+    }
+
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.dm.Document#getDocumentStream()
+     */
+    public DocumentStream getDocumentStream()
+    {
+        if (this.documentStream == null)
+        {
+            this.documentStream = new DocumentStreamImpl();
+        }
+        return this.documentStream;
+    }
+
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.dm.Document#setDocumentStream(org.apache.portals.graffito.model.dm.DocumentStream)
+     */
+    public void setDocumentStream(DocumentStream documentStream)
+    {
+        this.documentStream = documentStream;
+    }
+    
+    
+    /**
+     * @return  the documentStreamId
+     */
+    public Long getDocumentStreamId()
+    {
+        return documentStreamId;
+    }
+    
+    /**
+     * @param documentStreamId the document stream id to set
+     */
+    public void setDocumentStreamId(Long documentStreamId)
+    {
+       this.documentStreamId = documentStreamId;
+    }
+    
+    /**
+     * This method can be used to duplicate a document in order to create a new document version.
+     * Attributes associated to the version are not clones (isLastVersion & versionNumber).
+     * Thoses attributes are initialised by the version service 
+     * 
+     * @return The cloned object
+     * @throws CloneNotSupportedException when it is not possible to clone the document
+     */
+    public Object clone()  throws CloneNotSupportedException
+    {
+       Document clone = new DocumentImpl();
+       clone.setDocumentStream( (DocumentStream) this.getDocumentStream().clone());
+       clone.setCreationDate(new Timestamp(System.currentTimeMillis()));
+       clone.setLastModified(new Timestamp(System.currentTimeMillis()));
+       clone.setName(this.getName());
+       clone.setParentFolder(this.getParentFolder());
+       clone.setSize(this.getSize());     
+       clone.setUri(this.getUri());
+       clone.setContentType(this.getContentType());
+       clone.setProperties(this.getProperties());
+       return clone;
+       
+    }
+}
+

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentStreamImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentStreamImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentStreamImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/dm/impl/DocumentStreamImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.dm.impl;
+
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.model.dm.DocumentStream;
+import org.apache.portals.graffito.util.StreamUtil;
+
+
+/**
+ * CMS Version implementation.
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * 
+ */
+public class DocumentStreamImpl  implements DocumentStream, Serializable
+{
+    protected final static Log log = LogFactory.getLog(DocumentStreamImpl.class);
+  
+    protected Long documentStreamId;    
+   
+    protected byte[] content;
+    
+    protected String encoding;
+    
+    protected String isoCode;
+
+    /**
+     * @return Returns the documentStreamId.
+     */
+    public Long getDocumentStreamId()
+    {
+        return documentStreamId;
+    }
+    
+    /**
+     * @param documentStreamId The documentStreamId to set.
+     */
+    public void setDocumentStreamId(Long documentStreamId)
+    {
+        this.documentStreamId = documentStreamId;
+    }
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.dm.DocumentStream#getContentStream()
+     */
+    public InputStream getContentStream()
+    {
+        return new ByteArrayInputStream(content);        
+    }
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.dm.DocumentStream#getContentByte()
+     */
+    public byte[] getContentByte()
+    {
+        
+        return content;
+    }
+
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.dm.DocumentStream#getContentAsString()
+     */
+    public String getContentAsString()
+    {        
+        if (encoding != null)
+        {
+            try
+            {
+                return new String(content, encoding);
+            }
+            catch (UnsupportedEncodingException e)
+            {
+            }
+        }
+        return new String(content);        
+    }
+    
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.dm.DocumentStream#setContent(java.io.InputStream)
+     */
+    public void setContent(InputStream stream)
+    {        
+
+        content = StreamUtil.getContentByte(stream);
+
+    }
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.dm.DocumentStream#setContent(byte[])
+     */
+    public void setContent(byte[] stream)
+    {
+        
+        content = stream;
+
+    }
+          
+    /**
+     * @return Returns the encoding.
+     */
+    public String getEncoding()
+    {
+        return encoding;
+    }
+    
+    /**
+     * @param encoding The encoding to set.
+     */
+    public void setEncoding(String encoding)
+    {
+        this.encoding = encoding;
+    }
+    
+    
+    /**
+     * @see org.apache.portals.graffito.model.dm.DocumentStream#getIsoCode()
+     */
+    public String getIsoCode()
+    {
+        return this.isoCode;
+    }
+    /**
+     * @see org.apache.portals.graffito.model.dm.DocumentStream#setIsoCode(java.lang.String)
+     */
+    public void setIsoCode(String isoCode)
+    {
+        this.isoCode = isoCode;
+
+    }
+    
+    /**
+     * 
+     * @see java.lang.Object#clone()
+     */
+    public Object clone()
+    {
+       DocumentStream clone = new DocumentStreamImpl();
+       clone.setContent(this.getContentByte());
+       clone.setEncoding(this.getEncoding());
+       clone.setIsoCode(this.getIsoCode());
+       
+       return clone;
+       
+    }      
+}
+
+

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/impl/CmsPermissionCollection.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/impl/CmsPermissionCollection.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/impl/CmsPermissionCollection.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/impl/CmsPermissionCollection.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.pemission.impl;
+
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ */
+public class CmsPermissionCollection extends PermissionCollection
+{
+
+    ArrayList perms = new ArrayList();
+
+    /**
+     * 
+     */
+    public CmsPermissionCollection()
+    {
+        super(); 
+    }
+
+    /**
+     * @see java.security.PermissionCollection#add(java.security.Permission)
+     */
+    public void add(Permission permission)
+    {
+        perms.add(permission);
+    }
+
+    /**
+     * @see java.security.PermissionCollection#implies(java.security.Permission)
+     */
+    public boolean implies(Permission permission)
+    {
+        for (Iterator i = perms.iterator(); i.hasNext(); ) 
+        {
+            if (((Permission)i.next()).implies(permission)) 
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @see java.security.PermissionCollection#elements()
+     */
+    public Enumeration elements()
+    {
+        return Collections.enumeration(perms);
+    }
+
+}

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/impl/CmsPermissionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/impl/CmsPermissionImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/impl/CmsPermissionImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/pemission/impl/CmsPermissionImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,344 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.pemission.impl;
+
+import java.security.Permission;
+import java.util.Collection;
+import java.util.StringTokenizer;
+
+import org.apache.portals.graffito.model.permission.CmsPermission;
+import org.apache.portals.graffito.security.impl.GraffitoAction;
+
+/**
+ *  CMS Permissions
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @version $Id: CmsPermissionImpl.java,v 1.1 2004/12/22 20:37:03 christophe Exp $
+ */
+public class CmsPermissionImpl extends Permission implements CmsPermission
+{
+
+    /** The full path associated to the principals */
+    protected Collection principalFullPaths;
+
+    /** Mask used for determining what action to perform */
+    protected int mask;
+
+    // does path indicate a folder? (wildcard or recursive)
+    private transient boolean folder;
+
+    // is it a recursive directory specification?
+    private transient boolean recursive;
+
+    private static final String RECURSIVE_CHAR = "-";
+
+    private static final String WILD_CHAR = "*";
+
+    private static final String FOLDER_SEPARATOR = "/";
+
+    private transient String cpath;
+
+    /**
+     * Constructor
+     * 
+     * @param name The uri name (eg. /mypath/mydoc.doc)
+     * @param actions The actions allowed for this name
+     */
+    public CmsPermissionImpl(String name, String actions)
+    {
+
+        this(name, actions, null);
+    }
+
+    /**
+     * Constructor
+     * 
+     * @param name The uri name (eg. /mypath/mydoc.doc)
+     * @param actions The actions allowed for this name
+     * @param principalFullPaths The principals full path associated to this permission
+     */
+    public CmsPermissionImpl(String name, String actions, Collection principalFullPaths)
+    {
+        super(name);
+        this.principalFullPaths = principalFullPaths;
+        parseActions(actions);
+
+    }
+
+    protected void parseActions(String actions)
+    {
+        mask = 0;
+        if (actions != null)
+        {
+            StringTokenizer tokenizer = new StringTokenizer(actions, ",");
+            while (tokenizer.hasMoreTokens())
+            {
+                String token = tokenizer.nextToken().trim();
+                if (token.equals(CmsPermission.VIEW))
+                    mask |= GraffitoAction.MASK_VIEW;
+                else if (token.equals(CmsPermission.EDIT))
+                    mask |= GraffitoAction.MASK_EDIT;
+                else if (token.equals(CmsPermission.LOCK))
+                    mask |= GraffitoAction.MASK_LOCK;
+                else if (token.equals(CmsPermission.UNLOCK))
+                    mask |= GraffitoAction.MASK_UNLOCK;
+                else if (token.equals(CmsPermission.DELETE))
+                    mask |= GraffitoAction.MASK_DELETE;
+                else if (token.equals(CmsPermission.INSERT))
+                    mask = mask | GraffitoAction.MASK_INSERT;
+                else if (token.equals(CmsPermission.UPDATE))
+                    mask |= GraffitoAction.MASK_UPDATE;
+                else if (token.equals(CmsPermission.ALL))
+                    mask |= GraffitoAction.MASK_ALL;
+                else
+                    throw new IllegalArgumentException("Unknown action: " + token);
+            }
+        }
+
+        if ((cpath = getName()) == null)
+            throw new NullPointerException("name can't be null");
+
+        if (cpath.equals("<<ALL FILES>>"))
+        {
+            folder = true;
+            recursive = true;
+            cpath = "";
+            return;
+        }
+        int len = cpath.length();
+
+        if (len == 0)
+        {
+            throw new IllegalArgumentException("invalid folder reference");
+        }
+
+        char last = cpath.charAt(len - 1);
+
+        if (last == RECURSIVE_CHAR.charAt(0) && (len == 1 || cpath.charAt(len - 2) == FOLDER_SEPARATOR.charAt(0)))
+        {
+            folder = true;
+            recursive = true;
+            cpath = cpath.substring(0, --len);
+        }
+        else if (last == WILD_CHAR.charAt(0) && (len == 1 || cpath.charAt(len - 2) == FOLDER_SEPARATOR.charAt(0)))
+        {
+            folder = true;
+            //recursive = false;
+            cpath = cpath.substring(0, --len);
+        }
+
+    }
+
+    /**
+     * Get the principal full paths associated to this permission
+     * @return a Collection of fullpath (String)
+     */
+    public Collection getPrincipalFullPaths()
+    {
+        return this.principalFullPaths;
+    }
+    
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.permission.CmsPermission#isApplyToChildren()
+     */
+    public boolean isApplyToChildren()
+    {
+        return this.getName().endsWith(WILD_CHAR);
+    }
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.permission.CmsPermission#isRecursive()
+     */
+    public boolean isRecursive()
+    {
+        return this.getName().endsWith(RECURSIVE_CHAR);
+    }
+
+    /**
+     * @see java.security.Permission#getActions()
+     */
+    public String getActions()
+    {
+        StringBuffer buf = new StringBuffer();
+
+        if ((mask & GraffitoAction.MASK_ALL) == GraffitoAction.MASK_ALL)
+        {
+            buf.append(CmsPermission.ALL);
+            return buf.toString();
+        }
+
+        if ((mask & GraffitoAction.MASK_VIEW) == GraffitoAction.MASK_VIEW)
+        {
+            buf.append(CmsPermission.VIEW);
+        }
+        if ((mask & GraffitoAction.MASK_EDIT) == GraffitoAction.MASK_EDIT)
+        {
+            if (buf.length() > 0)
+                buf.append(", ");
+            buf.append(CmsPermission.EDIT);
+        }
+
+        if ((mask & GraffitoAction.MASK_LOCK) == GraffitoAction.MASK_LOCK)
+        {
+            if (buf.length() > 0)
+                buf.append(", ");
+            buf.append(CmsPermission.LOCK);
+        }
+        if ((mask & GraffitoAction.MASK_UNLOCK) == GraffitoAction.MASK_UNLOCK)
+        {
+            if (buf.length() > 0)
+                buf.append(", ");
+            buf.append(CmsPermission.UNLOCK);
+        }
+        if ((mask & GraffitoAction.MASK_DELETE) == GraffitoAction.MASK_DELETE)
+        {
+            if (buf.length() > 0)
+                buf.append(", ");
+            buf.append(CmsPermission.DELETE);
+        }
+        if ((mask & GraffitoAction.MASK_INSERT) == GraffitoAction.MASK_INSERT)
+        {
+            if (buf.length() > 0)
+                buf.append(", ");
+            buf.append(CmsPermission.INSERT);
+        }
+        if ((mask & GraffitoAction.MASK_UPDATE) == GraffitoAction.MASK_UPDATE)
+        {
+            if (buf.length() > 0)
+                buf.append(", ");
+            buf.append(CmsPermission.UPDATE);
+        }
+
+        return buf.toString();
+    }
+
+    /**
+     * Checks if this FolderPermission object "implies" the specified permission.
+     * <P>
+     * More specifically, this method returns true if:<p>
+     * <ul>
+     * <li> <i>p</i> is an instanceof FolderPermission,<p>
+     * <li> <i>p</i>'s actions are a proper subset of this
+     * object's actions, and <p>
+     * <li> <i>p</i>'s pathname is implied by this object's
+     *      pathname. For example, "/tmp/*" implies "/tmp/foo", since
+     *      "/tmp/*" encompasses the "/tmp" folder and all subfolders or documents in that
+     *      directory, including the one named "foo".
+     * </ul>
+     * @param p the permission to check against.
+     *
+     * @return true if the specified permission is implied by this object,
+     * false if not.  
+     */
+    public boolean implies(Permission p)
+    {
+        if (!(p instanceof CmsPermissionImpl))
+        {
+            return false;
+        }
+
+        CmsPermissionImpl that = (CmsPermissionImpl) p;
+        return ((this.mask & that.mask) == that.mask) && impliesIgnoreMask(that);
+    }
+
+    /**
+     * Checks if the Permission's actions are a proper subset of the
+     * this object's actions. Returns the effective mask iff the
+     * this FolderPermission's path also implies that FolderPermission's path.
+     * 
+     * @param that the FolderPermission to check against.
+     * @return the effective mask
+     */
+    boolean impliesIgnoreMask(CmsPermissionImpl that)
+    {
+        if (this.folder)
+        {
+            if (this.recursive)
+            {
+                // make sure that.path is longer then path so
+                // something like /foo/- does not imply /foo
+                if (that.folder)
+                {
+                    return (that.cpath.length() >= this.cpath.length()) && that.cpath.startsWith(this.cpath);
+                }
+                else
+                {
+                    return ((that.cpath.length() > this.cpath.length()) && that.cpath.startsWith(this.cpath));
+                }
+            }
+            else
+            {
+                if (that.folder)
+                {
+                    // if the permission passed in is a folder
+                    // specification, make sure that a non-recursive
+                    // permission (i.e., this object) can't imply a recursive
+                    // permission.
+                    if (that.recursive)
+                        return false;
+                    else
+                        return (this.cpath.equals(that.cpath));
+                }
+                else
+                {
+                    int last = that.cpath.lastIndexOf(FOLDER_SEPARATOR);
+                    if (last == -1)
+                        return false;
+                    else
+                    {
+                        // this.cpath.equals(that.cpath.substring(0, last+1));
+                        // Use regionMatches to avoid creating new string
+
+                        return (this.cpath.length() == (last + 1)) && this.cpath.regionMatches(0, that.cpath, 0, last + 1);
+                    }
+                }
+            }
+        }
+        else
+        {
+            return (this.cpath.equals(that.cpath));
+        }
+    }
+
+    /**
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object obj)
+    {
+        if (obj == this)
+            return true;
+
+        if (!(obj instanceof CmsPermissionImpl))
+            return false;
+
+        CmsPermissionImpl that = (CmsPermissionImpl) obj;
+
+        return (this.mask == that.mask) && this.cpath.equals(that.cpath) && (this.folder == that.folder)
+                && (this.recursive == that.recursive);
+    }
+
+    /**
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode()
+    {
+        return this.cpath.hashCode();
+    }
+
+}
\ No newline at end of file

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/FileSystemServerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/FileSystemServerImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/FileSystemServerImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/FileSystemServerImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.server.impl;
+
+import org.apache.portals.graffito.model.server.FileSystemServer;
+
+
+/**
+ * File System Server
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class FileSystemServerImpl extends ServerImpl implements FileSystemServer
+{
+    private static final long serialVersionUID = 1;       
+    String root;
+    
+    /**
+     * @return Returns the root.
+     */
+    public String getRoot()
+    {
+        return root;
+    }
+    /**
+     * @param root The root to set.
+     */
+    public void setRoot(String root)
+    {
+        this.root = root;
+    }
+}

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/GraffitoServerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/GraffitoServerImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/GraffitoServerImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/GraffitoServerImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.server.impl;
+
+
+import java.io.Serializable;
+
+import org.apache.portals.graffito.model.server.GraffitoServer;
+
+
+/**
+ * 
+ * Implementation of {@link org.apache.portals.graffito.model.server.GraffitoServer}
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart </a>
+ *  
+ */
+public class GraffitoServerImpl extends ServerImpl implements GraffitoServer, Serializable
+{            
+	
+	private String login;
+	private String password;
+	private String plateform;
+	private String dbAlias;
+	private String jdbcLevel;
+	private String datasource;
+	private String driver;
+	private String protocol;
+	private String subProtocol;
+
+
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#getLogin()
+	 */
+	public String getLogin()
+	{
+		return login;
+	}
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#getPassword()
+	 */
+	public String getPassword()
+	{
+
+		return password;
+	}
+
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#getDatasource()
+	 */
+	public String getDatasource()
+	{
+         return datasource;
+	}
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#getDriver()
+	 */
+	public String getDriver()
+	{	
+		return driver;
+	}
+
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#getJdbcLevel()
+	 */
+	public String getJdbcLevel()
+	{
+	
+		return jdbcLevel;
+	}
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#getPlateform()
+	 */
+	public String getPlateform()
+	{		
+		return plateform;
+	}
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#getDbAlias()
+	 */
+	public String getDbAlias()
+	{		
+		return dbAlias;
+	}
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#getProtocol()
+	 */
+	public String getProtocol()
+	{
+		return protocol;
+	}
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#getSubProtocol()
+	 */
+	public String getSubProtocol()
+	{
+		return subProtocol;
+	}
+
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#setLogin(java.lang.String)
+	 */
+	public void setLogin(String login)
+	{
+		this.login = login;
+	}
+
+    /**
+     * 
+     * @see org.apache.portals.graffito.model.server.GraffitoServer#setPassword(java.lang.String)
+     */
+	public void setPassword(String password)
+	{
+		this.password = password;
+	}
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#setDatasource(java.lang.String)
+	 */
+	public void setDatasource(String datasource)
+	{
+		this.datasource = datasource;
+	}
+
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#setDriver(java.lang.String)
+	 */
+	public void setDriver(String driver)
+	{
+		this.driver = driver;
+	}
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#setJdbcLevel(java.lang.String)
+	 */
+	public void setJdbcLevel(String jdbcLevel)
+	{
+		this.jdbcLevel = jdbcLevel;
+	}
+	
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#setPlateform(java.lang.String)
+	 */
+	public void setPlateform(String plateform)
+	{
+		this.plateform = plateform;
+	}
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#setDbAlias(java.lang.String)
+	 */
+	public void setDbAlias(String dbAlias)
+	{
+		this.dbAlias = dbAlias;
+	}	
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#setProtocol(java.lang.String)
+	 */
+	public void setProtocol(String protocol)
+	{
+		this.protocol = protocol;
+	}
+	
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.GraffitoServer#setSubProtocol(java.lang.String)
+	 */
+	public void setSubProtocol(String subProtocol)
+	{
+		this.subProtocol = subProtocol;
+	}
+}
\ No newline at end of file

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/ServerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/ServerImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/ServerImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/ServerImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.server.impl;
+import java.io.Serializable;
+
+import org.apache.portals.graffito.model.server.Server;
+
+/**
+ * 
+ * Implementation of {@link org.apache.portals.graffito.model.server.Server}
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart </a>
+ *  
+ */
+public class ServerImpl implements Server, Serializable
+{
+	protected int serverId;
+	protected String alias;
+	protected String description;
+	protected String scope;
+	protected String title;
+	protected String storeClassName;
+	
+	/**
+	 * @return the server ID
+	 */
+	public int getServerId()
+	{
+		return serverId;
+	}
+	
+	/**
+	 * Set the server ID
+	 * @param serverId 
+	 */
+	public void setServerId(int serverId)
+	{
+		this.serverId = serverId;
+	}
+	
+	/**
+	 * @see org.apache.portals.graffito.model.server.Server#getAlias()
+	 */
+	public String getAlias()
+	{
+		return alias;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.Server#getDescription()
+	 */
+	public String getDescription()
+	{
+		return description;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.Server#getScope()
+	 */
+	public String getScope()
+	{
+		return scope;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.Server#getTitle()
+	 */
+	public String getTitle()
+	{
+		return title;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.Server#setAlias(java.lang.String)
+	 */
+	public void setAlias(String alias)
+	{
+		this.alias = alias;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.Server#setDescription(java.lang.String)
+	 */
+    public void setDescription(String description)
+	{
+		this.description = description;
+	}	/**
+	 * @see org.apache.portals.graffito.model.server.Server#setScope(java.lang.String)
+	 */
+	public void setScope(String scope)
+	{
+		this.scope = scope;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.Server#setTitle(java.lang.String)
+	 */
+	public void setTitle(String title)
+	{
+		this.title = title;
+	}
+	
+	
+    /**
+     * @see org.apache.portals.graffito.model.server.Server#getStoreClassName()
+     */
+    public String getStoreClassName()
+    {
+        return storeClassName;
+    }
+    
+    /**
+     * @see org.apache.portals.graffito.model.server.Server#setStoreClassName(java.lang.String)
+     */
+    public void setStoreClassName(String pluginClassName)
+    {
+        this.storeClassName = pluginClassName;
+    }
+    
+    /** 
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return this.storeClassName + "-" + this.alias;
+    }   
+    
+    /**
+     * 
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object object)
+    {
+      if ( ! (object instanceof Server))
+      {
+          return false;
+      }
+      
+      if (this.getAlias().equals(((Server)object).getAlias()))
+      {
+          return true;          
+      }
+      return false;
+      
+    }
+}
\ No newline at end of file

Added: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/WebdavServerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/WebdavServerImpl.java?rev=225696&view=auto
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/WebdavServerImpl.java (added)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/server/impl/WebdavServerImpl.java Wed Jul 27 22:38:29 2005
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.model.server.impl;
+
+
+import java.io.Serializable;
+
+import org.apache.portals.graffito.model.server.WebdavServer;
+
+/**
+ * 
+ * Implementation of {@link org.apache.portals.graffito.model.server.WebdavServer}
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart </a>
+ *  
+ */
+public class WebdavServerImpl extends ServerImpl implements WebdavServer, Serializable
+{
+
+	private String login;
+	private String password;
+	private String url;
+	private boolean isSecureServer;
+	private boolean useCurrentLogin;
+	
+
+	
+	/**
+	 * @see org.apache.portals.graffito.model.server.WebdavServer#getLogin()
+	 */
+	public String getLogin()
+	{
+		return login;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.WebdavServer#getPassword()
+	 */
+	public String getPassword()
+	{
+
+		return password;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.WebdavServer#getUrl()
+	 */
+	public String getUrl()
+	{
+		return url;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.WebdavServer#isSecureServer()
+	 */
+	public boolean isSecureServer()
+	{		
+		return isSecureServer;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.WebdavServer#isUsingCurrentLogin()
+	 */
+	public boolean isUsingCurrentLogin()
+	{
+
+		return useCurrentLogin;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.WebdavServer#setLogin(java.lang.String)
+	 */
+	public void setLogin(String login)
+	{
+		this.login = login;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.WebdavServer#setPassword(java.lang.String)
+	 */
+	public void setPassword(String password)
+	{
+		this.password = password;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.WebdavServer#setSecureServer(boolean)
+	 */
+	public void setSecureServer(boolean secureServer)
+	{
+		this.isSecureServer = secureServer;
+	}
+
+	/**
+	 * 
+	 * @see org.apache.portals.graffito.model.server.WebdavServer#setUrl(java.lang.String)
+	 */
+	public void setUrl(String url)
+	{
+		this.url = url;
+	}
+	/**
+	 * @see org.apache.portals.graffito.model.server.WebdavServer#setUseCurrentLogin(boolean)
+	 */
+	public void setUseCurrentLogin(boolean useCurrentLogin)
+	{
+		this.useCurrentLogin = useCurrentLogin;
+	}
+}
\ No newline at end of file



Mime
View raw message