chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1486037 [2/3] - in /chemistry/opencmis/branches/inmemory-refactoring/src: main/java/org/apache/chemistry/opencmis/inmemory/ main/java/org/apache/chemistry/opencmis/inmemory/query/ main/java/org/apache/chemistry/opencmis/inmemory/server/ ma...
Date Fri, 24 May 2013 12:48:22 GMT
Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java Fri May 24 12:48:21 2013
@@ -121,15 +121,18 @@ public class ContentStreamDataImpl imple
         LOG.debug("setting content stream, new size total " + (TOTAL_LENGTH / (1024 * 1024)) + "MB.");
     }
 
-    public long getLength() {
+    @Override
+	public long getLength() {
         return fLength;
     }
 
-    public BigInteger getBigLength() {
+    @Override
+	public BigInteger getBigLength() {
         return BigInteger.valueOf(fLength);
     }
 
-    public String getMimeType() {
+    @Override
+	public String getMimeType() {
         return fMimeType;
     }
 
@@ -137,7 +140,8 @@ public class ContentStreamDataImpl imple
         this.fMimeType = fMimeType;
     }
 
-    public String getFileName() {
+    @Override
+	public String getFileName() {
         return fFileName;
     }
 
@@ -149,7 +153,8 @@ public class ContentStreamDataImpl imple
         return fFileName;
     }
 
-    public InputStream getStream() {
+    @Override
+	public InputStream getStream() {
         if (null == fContent) {
             return null;
         } else if (fStreamLimitOffset <= 0 && fStreamLimitLength < 0) {
@@ -164,7 +169,8 @@ public class ContentStreamDataImpl imple
         this.fLastModified = lastModified;
     }
     
-    public GregorianCalendar getLastModified() {
+    @Override
+	public GregorianCalendar getLastModified() {
         return fLastModified;
     }
     
@@ -184,11 +190,13 @@ public class ContentStreamDataImpl imple
         return fContent;
     }
 
-    public List<CmisExtensionElement> getExtensions() {
+    @Override
+	public List<CmisExtensionElement> getExtensions() {
         return null;
     }
 
-    public void setExtensions(List<CmisExtensionElement> extensions) {
+    @Override
+	public void setExtensions(List<CmisExtensionElement> extensions) {
         // not implemented
     }
 }

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java Fri May 24 12:48:21 2013
@@ -28,7 +28,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.data.RenditionData;
-import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.RenditionDataImpl;
@@ -36,7 +35,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.inmemory.ConfigConstants;
 import org.apache.chemistry.opencmis.inmemory.ConfigurationSettings;
 import org.apache.chemistry.opencmis.inmemory.FilterParser;
-import org.apache.chemistry.opencmis.inmemory.server.InMemoryServiceContext;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Document;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -49,7 +47,7 @@ import org.slf4j.LoggerFactory;
  *
  */
 
-public class DocumentImpl extends AbstractMultiFilingImpl implements Document {
+public class DocumentImpl extends FilingImpl implements Document {
     private ContentStreamDataImpl fContent;
 
     private static final Logger LOG = LoggerFactory.getLogger(DocumentImpl.class.getName());
@@ -61,7 +59,8 @@ public class DocumentImpl extends Abstra
         super(objStore);
     }
 
-    public ContentStream getContent(long offset, long length) {
+    @Override
+	public ContentStream getContent(long offset, long length) {
         if (null == fContent) {
             return null;
         } else if (offset <= 0 && length < 0) {
@@ -71,7 +70,8 @@ public class DocumentImpl extends Abstra
         }
     }
 
-    public void setContent(ContentStream content, boolean mustPersist) {
+    @Override
+	public void setContent(ContentStream content, boolean mustPersist) {
         if (null == content) {
             fContent = null;
         } else {
@@ -96,7 +96,8 @@ public class DocumentImpl extends Abstra
         }
     }
     
-    public void appendContent(ContentStream content) {
+    @Override
+	public void appendContent(ContentStream content) {
         if (null == content) {
             return;
         } if (null == fContent) {
@@ -192,7 +193,8 @@ public class DocumentImpl extends Abstra
         
     }
 
-    public boolean hasContent() {
+    @Override
+	public boolean hasContent() {
         return null != fContent;
     }
 

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java Fri May 24 12:48:21 2013
@@ -27,16 +27,13 @@ import java.util.Map.Entry;
 import org.apache.chemistry.opencmis.commons.PropertyIds;
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
-import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException;
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
 import org.apache.chemistry.opencmis.inmemory.ConfigConstants;
 import org.apache.chemistry.opencmis.inmemory.ConfigurationSettings;
 import org.apache.chemistry.opencmis.inmemory.FilterParser;
-import org.apache.chemistry.opencmis.inmemory.server.InMemoryServiceContext;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.Folder;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument;
 
 /**
@@ -45,12 +42,12 @@ import org.apache.chemistry.opencmis.inm
  * @author Jens
  *
  */
-public class DocumentVersionImpl extends StoredObjectImpl implements DocumentVersion {
+public class DocumentVersionImpl extends StoredObjectImpl implements DocumentVersion, FilingMutable {
 
     private final Long MAX_CONTENT_SIZE_KB = ConfigurationSettings.getConfigurationValueAsLong(ConfigConstants.MAX_CONTENT_SIZE_KB);
 
     private ContentStreamDataImpl fContent;
-    private final VersionedDocument fContainer; // the document this version belongs
+    private final VersionedDocumentImpl fContainer; // the document this version belongs
     // to
     private String fComment; // checkin comment
     boolean fIsMajor;
@@ -61,7 +58,7 @@ public class DocumentVersionImpl extends
             VersioningState verState, ObjectStoreImpl objStore) {
         super(objStore);
         setRepositoryId(repositoryId);
-        fContainer = container;
+        fContainer = (VersionedDocumentImpl) container;
         setContent(content, false);
         fIsMajor = verState == VersioningState.MAJOR || verState == null;
         fIsPwc = verState == VersioningState.CHECKEDOUT;
@@ -77,7 +74,8 @@ public class DocumentVersionImpl extends
         label = createVersionLabel();
     }
 
-    public void setContent(ContentStream content, boolean mustPersist) {
+    @Override
+	public void setContent(ContentStream content, boolean mustPersist) {
         if (null == content) {
             fContent = null;
         } else {
@@ -94,7 +92,8 @@ public class DocumentVersionImpl extends
         }
     }
 
-    public void appendContent(ContentStream content) {
+    @Override
+	public void appendContent(ContentStream content) {
         if (null == content) {
             return;
         } if (null == fContent) {
@@ -109,11 +108,13 @@ public class DocumentVersionImpl extends
         }
     }
 
-    public void setCheckinComment(String comment) {
+    @Override
+	public void setCheckinComment(String comment) {
         fComment = comment;
     }
 
-    public String getCheckinComment() {
+    @Override
+	public String getCheckinComment() {
         return fComment;
     }
 
@@ -136,20 +137,24 @@ public class DocumentVersionImpl extends
         return label;
     }
 
-    public boolean isMajor() {
+    @Override
+	public boolean isMajor() {
         return fIsMajor && !isPwc();
     }
 
-    public boolean isPwc() {
+    @Override
+	public boolean isPwc() {
         return fIsPwc;
     }
 
-    public void commit(boolean isMajor) {
+    @Override
+	public void commit(boolean isMajor) {
         fIsPwc = false; // unset working copy flag
         fIsMajor = isMajor;
     }
 
-    public ContentStream getContent(long offset, long length) {
+    @Override
+	public ContentStream getContent(long offset, long length) {
         if (offset <= 0 && length < 0) {
             return fContent;
         } else {
@@ -157,7 +162,8 @@ public class DocumentVersionImpl extends
         }
     }
 
-    public VersionedDocument getParentDocument() {
+    @Override
+	public VersionedDocument getParentDocument() {
         return fContainer;
     }
 
@@ -289,41 +295,39 @@ public class DocumentVersionImpl extends
         ((StoredObjectImpl)fContainer).setAclId(id);
     }    
     
-    public List<Folder> getParents(String user) {
-        return fContainer.getParents(user);
+    @Override
+	public List<String> getParents() {
+        return fContainer.getParents();
     }
 
-    public String getPathSegment() {
+    @Override
+	public String getPathSegment() {
         return fContainer.getPathSegment();
     }
 
-    public void move(Folder oldParent, Folder newParent) {
-        fContainer.move(oldParent, newParent);
-    }
-
-    public void addParent(Folder parent) {
-        fContainer.addParent(parent);
-    }
-
-    public void removeParent(Folder parent) {
-        fContainer.removeParent(parent);
+    @Override
+	public boolean hasContent() {
+        return null != fContent;
     }
 
-    public boolean hasContent() {
-        return null != fContent;
+    @Override
+	public boolean hasParent() {
+      return fContainer.hasParent();
     }
 
-    public boolean hasParent() {
-      return true;
+    @Override
+	public String getVersionLabel() {
+        return label;
     }
 
-    public void rename(String newName) {
-    	super.rename(newName);
-    	fContainer.setName(newName);
+    @Override
+    public void addParentId(String parentId) {
+        fContainer.addParentId(parentId);
     }
 
-    public String getVersionLabel() {
-        return label;
+    @Override
+    public void removeParentId(String parentId) {
+        fContainer.removeParentId(parentId);
     }
 
 

Added: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingImpl.java?rev=1486037&view=auto
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingImpl.java (added)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingImpl.java Fri May 24 12:48:21 2013
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.chemistry.opencmis.inmemory.storedobj.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.Fileable;
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.Filing;
+
+public class FilingImpl extends StoredObjectImpl implements Fileable, FilingMutable {
+    
+    private List<String> parentIds = new ArrayList<String>(1);
+    
+    FilingImpl(ObjectStoreImpl objStore) {
+        super(objStore);
+    }
+
+    @Override
+    public List<String> getParents() {
+        return parentIds;
+    }
+
+    @Override
+    public boolean hasParent() {
+        return !(null == parentIds || parentIds.isEmpty());
+    }
+
+    @Override
+    public String getPathSegment() {
+        return super.getName();
+    }
+    
+    @Override
+    public void addParentId(String parentId) {
+        parentIds.add(parentId);
+    }
+
+    @Override
+    public void removeParentId(String parentId) {
+        parentIds.remove(parentId);
+    }
+}

Added: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingMutable.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingMutable.java?rev=1486037&view=auto
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingMutable.java (added)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingMutable.java Fri May 24 12:48:21 2013
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.chemistry.opencmis.inmemory.storedobj.impl;
+
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.Filing;
+
+public interface FilingMutable extends Filing {
+
+    public void addParentId(String parentId);
+
+    public void removeParentId(String parentId);
+}

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java Fri May 24 12:48:21 2013
@@ -25,7 +25,6 @@ import java.io.IOException;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 
@@ -34,161 +33,28 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.data.RenditionData;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisNameConstraintViolationException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.RenditionDataImpl;
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
 import org.apache.chemistry.opencmis.inmemory.FilterParser;
 import org.apache.chemistry.opencmis.inmemory.NameValidator;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.Document;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.Filing;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Folder;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.MultiFiling;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.SingleFiling;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoredObject;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class FolderImpl extends AbstractSingleFilingImpl implements Folder {
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractSingleFilingImpl.class.getName());
-
+public class FolderImpl extends StoredObjectImpl implements Folder {
+    private static final Logger LOG = LoggerFactory.getLogger(FilingImpl.class.getName());
+    protected String parentId;
+    
     FolderImpl(ObjectStoreImpl objStore) {
         super(objStore);
     }
 
-    public FolderImpl(ObjectStoreImpl objStore, String name, Folder parent) {
+    public FolderImpl(ObjectStoreImpl objStore, String name, String parentId) {
         super(objStore);
-        init(name, parent);
-    }
-
-    public void addChildFolder(Folder folder) {
-        try {
-            fObjStore.lock();
-            boolean hasChild;
-            String name = folder.getName();
-            hasChild = hasChild(name);
-            if (hasChild) {
-                throw new CmisNameConstraintViolationException("Cannot create folder " + name + ". Name already exists in parent folder");
-            }
-            folder.setParent(this);
-        } finally {
-            fObjStore.unlock();
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opencmis.client.provider.spi.inmemory.IFolder#addChildDocument(org
-     * .opencmis.client.provider .spi.inmemory.storedobj.impl.DocumentImpl)
-     */
-    public void addChildDocument(Document doc) {
-        addChildObject(doc);
-    }
-
-    public void addChildDocument(VersionedDocument doc) {
-        addChildObject(doc);
-    }
-
-    public void addChildItem(StoredObject item) {
-        addChildObject(item);
+        init(name, parentId);
     }
 
-    private void addChildObject(StoredObject so) {
-        try {
-            fObjStore.lock();
-            String name = so.getName();
-
-            boolean hasChild;
-            hasChild = hasChild(name);
-            if (hasChild) {
-                throw new CmisNameConstraintViolationException(
-                        "Cannot create object: " + name + ". Name already exists in parent folder");
-            }
-
-            if (so instanceof SingleFiling) {
-                ((SingleFiling) so).setParent(this);
-            } else if (so instanceof MultiFiling) {
-                ((MultiFiling) so).addParent(this);
-            } else {
-                throw new CmisInvalidArgumentException("Cannot create document, object is not fileable.");
-            }
-
-        } finally {
-            fObjStore.unlock();
-        }
-    }
-
-    public ChildrenResult getChildren(int maxItems, int skipCount, String user) {
-        List<StoredObject> result = new ArrayList<StoredObject>();
-        for (String id : fObjStore.getIds()) {
-            StoredObject obj = fObjStore.getObject(id);
-            if (obj instanceof Filing) {
-                Filing pathObj = (Filing) obj;
-                if (fObjStore.hasReadAccess(user, obj) && pathObj.getParents(user).contains(this)) {
-                    if (pathObj instanceof VersionedDocument) {
-                        DocumentVersion ver = ((VersionedDocument) pathObj).getLatestVersion(false);
-                        result.add(ver);
-                    } else if (pathObj instanceof DocumentVersion) {
-                        // ignore
-                    } else {
-                        result.add(obj);
-                    }
-                }                
-            }
-        }
-        sortFolderList(result);
-
-        if (maxItems < 0) {
-            maxItems = result.size();
-        }
-        if (skipCount < 0) {
-            skipCount = 0;
-        }
-        
-        int from = Math.min(skipCount, result.size());
-        int to = Math.min(maxItems + from, result.size());
-        int noItems = result.size();
-        
-        result = result.subList(from, to);
-        return new ChildrenResult(result, noItems);
-    }
-
-    public ChildrenResult getFolderChildren(int maxItems, int skipCount, String user) {
-        List<Folder> result = new ArrayList<Folder>();
-        for (String id : fObjStore.getIds()) {
-            StoredObject obj = fObjStore.getObject(id);
-            if (fObjStore.hasReadAccess(user, obj) && obj instanceof SingleFiling) {
-                SingleFiling pathObj = (SingleFiling) obj;
-                if (pathObj.getParent() == this && pathObj instanceof Folder) {
-                    result.add((Folder) obj);
-                }
-            }
-        }
-        sortFolderList(result);
-        int from = Math.min(skipCount, result.size());
-        int to = Math.min(maxItems + from, result.size());
-        int noItems = result.size();
-
-        result = result.subList(from, to);
-        return new ChildrenResult(result, noItems);
-    }
-
-    public boolean hasChild(String name) {
-        for (String id : fObjStore.getIds()) {
-            StoredObject obj = fObjStore.getObject(id);
-            if (obj instanceof Filing) {
-                Filing pathObj = (Filing) obj;
-                if (pathObj.getParents(null).contains(this) && obj.getName().equals(name)) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
 
     @Override
     public void fillProperties(Map<String, PropertyData<?>> properties, BindingsObjectFactory objFactory,
@@ -199,7 +65,6 @@ public class FolderImpl extends Abstract
         // add folder specific properties
 
         if (FilterParser.isContainedInFilter(PropertyIds.PARENT_ID, requestedIds)) {
-            String parentId = getParent() == null ? null : getParent().getId();
             properties.put(PropertyIds.PARENT_ID, objFactory.createPropertyIdData(PropertyIds.PARENT_ID,
                     parentId));
         }
@@ -216,59 +81,14 @@ public class FolderImpl extends Abstract
         }
     }
 
-    // Helper functions
-    private void init(String name, Folder parent) {
-        if (!NameValidator.isValidName(name)) {
-            throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
-        }
-        setName(name);
-        setParent(parent);
-    }
-
-    private static void sortFolderList(List<? extends StoredObject> list) {
-        // TODO evaluate orderBy, for now sort by path segment
-        class FolderComparator implements Comparator<StoredObject> {
-
-            public int compare(StoredObject f1, StoredObject f2) {
-                String segment1 = f1.getName();
-                String segment2 = f2.getName();
-
-                return segment1.compareTo(segment2);
-            }
-        }
-
-        Collections.sort(list, new FolderComparator());
-    }
-
-    public void moveChildDocument(StoredObject so, Folder oldParent, Folder newParent) {
-        try {
-            fObjStore.lock();
-            if (newParent.hasChild(so.getName())) {
-                throw new IllegalArgumentException("Cannot move object, this name already exists in target.");
-            }
-            if (!(so instanceof Filing)) {
-                throw new IllegalArgumentException("Cannot move object, object does not have a path.");
-            }
-
-            if (so instanceof SingleFiling) {
-                SingleFiling pathObj = (SingleFiling) so;
-                pathObj.setParent(newParent);
-            } else if (so instanceof MultiFiling) {
-                MultiFiling pathObj = (MultiFiling) so;
-                pathObj.addParent(newParent);
-                pathObj.removeParent(oldParent);
-            }
-        } finally {
-            fObjStore.unlock();
-        }
-    }
-
-    public List<String> getAllowedChildObjectTypeIds() {
+    @Override
+	public List<String> getAllowedChildObjectTypeIds() {
         // TODO implement this.
         return null;
     }
 
-    public List<RenditionData> getRenditions(String renditionFilter, long maxItems, long skipCount) {
+    @Override
+	public List<RenditionData> getRenditions(String renditionFilter, long maxItems, long skipCount) {
         if (null==renditionFilter)
             return null;
         String tokenizer = "[\\s;]";
@@ -294,7 +114,8 @@ public class FolderImpl extends Abstract
         }
     }
 
-    public ContentStream getRenditionContent(String streamId, long offset, long length) {
+    @Override
+	public ContentStream getRenditionContent(String streamId, long offset, long length) {
         try {
             return getIconFromResourceDir("/folder.png");
         } catch (IOException e) {
@@ -303,7 +124,65 @@ public class FolderImpl extends Abstract
         }
     }
 
-    public boolean hasRendition(String user) {
+    @Override
+	public boolean hasRendition(String user) {
         return true;
     }
+
+    @Override
+    public List<String> getParents() {
+        if (parentId == null)
+            return Collections.emptyList();
+        else
+            return Collections.singletonList(parentId);
+    }
+
+    @Override
+    public boolean hasParent() {
+        return null != parentId;
+    }
+
+    @Override
+    public String getParentId() {
+        return parentId;
+    }
+
+    @Override
+    public String getPath() {
+        StringBuffer sb = new StringBuffer();
+        insertPathSegment(sb, this);
+        return sb.toString();
+    }
+    
+    @Override
+    public String getPathSegment() {
+        return getName();
+    }
+
+    public void setParentId (String parentId) {
+        this.parentId = parentId;
+    }
+    
+    private void insertPathSegment(StringBuffer sb, Folder f) {
+        if (null == f.getParentId()) {
+            if (sb.length() == 0) {
+                sb.insert(0, Folder.PATH_SEPARATOR);
+            }
+        } else {
+            sb.insert(0, f.getName());
+            sb.insert(0, Folder.PATH_SEPARATOR);
+            Folder parent = (Folder) fObjStore.getObjectById(f.getParentId());
+            insertPathSegment(sb, parent);
+        }
+    }
+
+    // Helper functions
+    private void init(String name, String parentId) {
+        if (!NameValidator.isValidName(name)) {
+            throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+        }
+        setName(name);
+        this.parentId = parentId;;
+    }
+
 }

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java Fri May 24 12:48:21 2013
@@ -35,7 +35,8 @@ public class InMemoryAcl implements Clon
     private static InMemoryAcl DEFAULT_ACL = new InMemoryAcl(new ArrayList<InMemoryAce>() {{ add(InMemoryAce.getDefaultAce()); }} );
     private static class AceComparator<T extends InMemoryAce> implements Comparator<T> {
 
-        public int compare(T o1, T o2) {
+        @Override
+		public int compare(T o1, T o2) {
             if (null == o1 || null == o2) {
                 if (o1 == o2)
                     return 0;
@@ -222,7 +223,8 @@ public class InMemoryAcl implements Clon
         return new AccessControlListImpl(commonsAcl); 
     }
 
-    public InMemoryAcl clone() {
+    @Override
+	public InMemoryAcl clone() {
         InMemoryAcl newAcl = new InMemoryAcl(acl);
         return newAcl; 
     }

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ItemImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ItemImpl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ItemImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ItemImpl.java Fri May 24 12:48:21 2013
@@ -18,13 +18,14 @@
  */
 package org.apache.chemistry.opencmis.inmemory.storedobj.impl;
 
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.Filing;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Item;
 
 /**
  * itemImpl is used for CMIS:item objects. Items are fileable  but do not have content
  *
  */
-public class ItemImpl extends AbstractMultiFilingImpl implements Item {
+public class ItemImpl extends FilingImpl implements Item, Filing {
 
     ItemImpl(ObjectStoreImpl objStore) {
         super(objStore);

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java Fri May 24 12:48:21 2013
@@ -19,6 +19,8 @@
 package org.apache.chemistry.opencmis.inmemory.storedobj.impl;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -37,30 +39,38 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisNameConstraintViolationException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisPermissionDeniedException;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Document;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.Fileable;
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.Filing;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Folder;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.MultiFiling;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.ObjectStore;
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.ObjectStoreMultiFiling;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Relationship;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.SingleFiling;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoredObject;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
- * The object store is the central core of the in-memory repository. It is based on huge HashMap
- * map mapping ids to objects in memory. To allow access from multiple threads a Java concurrent
- * HashMap is used that allows parallel access methods.
+ * The object store is the central core of the in-memory repository. It is based
+ * on huge HashMap map mapping ids to objects in memory. To allow access from
+ * multiple threads a Java concurrent HashMap is used that allows parallel
+ * access methods.
  * <p>
- * Certain methods in the in-memory repository must guarantee constraints. For example a folder
- * enforces that each child has a unique name. Therefore certain operations must occur in an
- * atomic manner. In the example it must be guaranteed that no write access occurs to the
- * map between acquiring the iterator to find the children and finishing the add operation when
- * no name conflicts can occur. For this purpose this class has methods to lock an unlock the
- * state of the repository. It is very important that the caller acquiring the lock enforces an
- * unlock under all circumstances. Typical code is:
+ * Certain methods in the in-memory repository must guarantee constraints. For
+ * example a folder enforces that each child has a unique name. Therefore
+ * certain operations must occur in an atomic manner. In the example it must be
+ * guaranteed that no write access occurs to the map between acquiring the
+ * iterator to find the children and finishing the add operation when no name
+ * conflicts can occur. For this purpose this class has methods to lock an
+ * unlock the state of the repository. It is very important that the caller
+ * acquiring the lock enforces an unlock under all circumstances. Typical code
+ * is:
  * <p>
+ * 
  * <pre>
  * ObjectStoreImpl os = ... ;
  * try {
@@ -69,25 +79,28 @@ import org.apache.chemistry.opencmis.inm
  *     os.unlock();
  * }
  * </pre>
- *
- * The locking is very coarse-grained. Productive implementations would probably implement finer
- * grained locks on a folder or document rather than the complete repository.
+ * 
+ * The locking is very coarse-grained. Productive implementations would probably
+ * implement finer grained locks on a folder or document rather than the
+ * complete repository.
  */
-public class ObjectStoreImpl implements ObjectStore {
+public class ObjectStoreImpl implements ObjectStore, ObjectStoreMultiFiling {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ObjectStoreImpl.class);
 
-    
     /**
      * user id for administrator always having all rights
      */
     public static final String ADMIN_PRINCIPAL_ID = "Admin";
-    
+
     /**
      * Simple id generator that uses just an integer
      */
     private static int NEXT_UNUSED_ID = 100;
 
     /**
-     * a concurrent HashMap as core element to hold all objects in the repository
+     * a concurrent HashMap as core element to hold all objects in the
+     * repository
      */
     private final Map<String, StoredObject> fStoredObjectMap = new ConcurrentHashMap<String, StoredObject>();
 
@@ -95,7 +108,7 @@ public class ObjectStoreImpl implements 
      * a concurrent HashMap to hold all Acls in the repository
      */
     private int nextUnusedAclId = 0;
-    
+
     private final List<InMemoryAcl> fAcls = new ArrayList<InMemoryAcl>();
 
     private final Lock fLock = new ReentrantLock();
@@ -115,48 +128,52 @@ public class ObjectStoreImpl implements 
     private synchronized Integer getNextAclId() {
         return nextUnusedAclId++;
     }
-    
-   public void lock() {
-      fLock.lock();
+
+    private void lock() {
+        fLock.lock();
     }
 
-    public void unlock() {
-      fLock.unlock();
+    private void unlock() {
+        fLock.unlock();
     }
 
+    @Override
     public Folder getRootFolder() {
         return fRootFolder;
     }
 
+    @Override
     public StoredObject getObjectByPath(String path, String user) {
-        for (StoredObject so : fStoredObjectMap.values()) {
-            if (so instanceof SingleFiling) {
-                String soPath = ((SingleFiling) so).getPath();
-                if (soPath.equals(path)) {
-                    return so;
-                }
-            } else if (so instanceof MultiFiling) {
-                MultiFiling mfo = (MultiFiling) so;
-                List<Folder> parents = mfo.getParents(user);
-                for (Folder parent : parents) {
-                    String parentPath = parent.getPath();
-                    String mfPath = parentPath.equals(Folder.PATH_SEPARATOR) ? parentPath + mfo.getPathSegment()
-                            : parentPath + Folder.PATH_SEPARATOR + mfo.getPathSegment();
-                    if (mfPath.equals(path)) {
-                        return so;
-                    }
+        StoredObject so = findObjectWithPathInDescendents(path, user, Folder.PATH_SEPARATOR, fRootFolder);
+        return so;
+    }
+
+    private Fileable findObjectWithPathInDescendents(String path, String user, String prefix, Fileable fo) {
+        if (path.equals(prefix)) {
+            return fo;
+        } else if (fo instanceof Folder) {
+            List<Fileable> children = getChildren((Folder) fo);
+            for (Fileable child : children) {
+                String foundPath = prefix.length() == 1 ? prefix + child.getName() : prefix + Folder.PATH_SEPARATOR
+                        + child.getName();
+                if (path.startsWith(foundPath)) {
+                    Fileable found = findObjectWithPathInDescendents(path, user, foundPath, child);
+                    if (null != found)
+                        return found;   // note that there can be multiple folders with the same prefix like folder1, folder10
                 }
             }
         }
         return null;
     }
 
+    @Override
     public StoredObject getObjectById(String objectId) {
         // we use path as id so we just can look it up in the map
         StoredObject so = fStoredObjectMap.get(objectId);
         return so;
     }
 
+    @Override
     public void deleteObject(String objectId, Boolean allVersions, String user) {
         StoredObject obj = fStoredObjectMap.get(objectId);
 
@@ -165,7 +182,7 @@ public class ObjectStoreImpl implements 
         }
 
         if (obj instanceof FolderImpl) {
-        	deleteFolder(objectId, user);
+            deleteFolder(objectId, user);
         } else if (obj instanceof DocumentVersion) {
             DocumentVersion vers = (DocumentVersion) obj;
             VersionedDocument parentDoc = vers.getParentDocument();
@@ -180,7 +197,7 @@ public class ObjectStoreImpl implements 
                 fStoredObjectMap.remove(objectId);
                 otherVersionsExists = parentDoc.deleteVersion(vers);
             }
-            
+
             if (!otherVersionsExists) {
                 fStoredObjectMap.remove(parentDoc.getId());
             }
@@ -193,7 +210,8 @@ public class ObjectStoreImpl implements 
         StoredObject found = fStoredObjectMap.remove(vers.getId());
 
         if (null == found) {
-            throw new CmisInvalidArgumentException("Cannot delete object with id  " + vers.getId() + ". Object does not exist.");
+            throw new CmisInvalidArgumentException("Cannot delete object with id  " + vers.getId()
+                    + ". Object does not exist.");
         }
     }
 
@@ -223,6 +241,7 @@ public class ObjectStoreImpl implements 
     /**
      * Clear repository and remove all data.
      */
+    @Override
     public void clear() {
         lock();
         fStoredObjectMap.clear();
@@ -230,6 +249,7 @@ public class ObjectStoreImpl implements 
         unlock();
     }
 
+    @Override
     public long getObjectCount() {
         return fStoredObjectMap.size();
     }
@@ -240,7 +260,7 @@ public class ObjectStoreImpl implements 
     private void createRootFolder() {
         FolderImpl rootFolder = new FolderImpl(this);
         rootFolder.setName("RootFolder");
-        rootFolder.setParent(null);
+        rootFolder.setParentId(null);
         rootFolder.setTypeId(BaseTypeId.CMIS_FOLDER.value());
         rootFolder.setCreatedBy("Admin");
         rootFolder.setModifiedBy("Admin");
@@ -251,6 +271,7 @@ public class ObjectStoreImpl implements 
         fRootFolder = rootFolder;
     }
 
+    @Override
     public Document createDocument(String name, Map<String, PropertyData<?>> propMap, String user, Folder folder,
             List<String> policies, Acl addACEs, Acl removeACEs) {
         DocumentImpl doc = new DocumentImpl(this);
@@ -259,8 +280,10 @@ public class ObjectStoreImpl implements 
         doc.setRepositoryId(fRepositoryId);
         doc.setName(name);
         if (null != folder) {
-            ((FolderImpl) folder).addChildDocument(doc); // add document to
-                                                         // folder and
+            if (hasChild(folder, name))
+                throw new CmisNameConstraintViolationException("Cannot create document an object with name " + name
+                        + " already exists in folder " + folder.getPath());
+            doc.addParentId(folder.getId());
         }
         int aclId = getAclId(((FolderImpl) folder), addACEs, removeACEs);
         doc.setAclId(aclId);
@@ -269,38 +292,46 @@ public class ObjectStoreImpl implements 
         return doc;
     }
 
+    @Override
     public StoredObject createItem(String name, Map<String, PropertyData<?>> propMap, String user, Folder folder,
             List<String> policies, Acl addACEs, Acl removeACEs) {
-        StoredObjectImpl item = new ItemImpl(this);
+        ItemImpl item = new ItemImpl(this);
         item.createSystemBasePropertiesWhenCreated(propMap, user);
         item.setCustomProperties(propMap);
         item.setRepositoryId(fRepositoryId);
         item.setName(name);
         if (null != folder) {
-            ((FolderImpl)folder).addChildItem(item); // add document to folder and
+            if (hasChild(folder, name))
+                throw new CmisNameConstraintViolationException("Cannot create document an object with name " + name
+                        + " already exists in folder " + folder.getPath());
+            item.addParentId(folder.getId());
         }
         if (null != policies)
             item.setAppliedPolicies(policies);
-        int aclId = getAclId(((FolderImpl)folder), addACEs, removeACEs);
+        int aclId = getAclId(((FolderImpl) folder), addACEs, removeACEs);
         item.setAclId(aclId);
         return item;
     }
-    
-    public DocumentVersion createVersionedDocument(String name,
-    		Map<String, PropertyData<?>> propMap, String user, Folder folder,
-    		List<String> policies, Acl addACEs, Acl removeACEs, ContentStream contentStream, VersioningState versioningState) {
-    	VersionedDocumentImpl doc = new VersionedDocumentImpl(this);
+
+    @Override
+    public DocumentVersion createVersionedDocument(String name, Map<String, PropertyData<?>> propMap, String user,
+            Folder folder, List<String> policies, Acl addACEs, Acl removeACEs, ContentStream contentStream,
+            VersioningState versioningState) {
+        VersionedDocumentImpl doc = new VersionedDocumentImpl(this);
         doc.createSystemBasePropertiesWhenCreated(propMap, user);
         doc.setCustomProperties(propMap);
         doc.setRepositoryId(fRepositoryId);
         doc.setName(name);
         DocumentVersion version = doc.addVersion(contentStream, versioningState, user);
-        if (null != folder) {
-        	((FolderImpl)folder).addChildDocument(doc); // add document to folder and set
-        }
         version.createSystemBasePropertiesWhenCreated(propMap, user);
         version.setCustomProperties(propMap);
-        int aclId = getAclId(((FolderImpl)folder), addACEs, removeACEs);
+        if (null != folder) {
+            if (hasChild(folder, name))
+                throw new CmisNameConstraintViolationException("Cannot create document an object with name " + name
+                        + " already exists in folder " + folder.getPath());
+            doc.addParentId(folder.getId());
+        }
+        int aclId = getAclId(((FolderImpl) folder), addACEs, removeACEs);
         doc.setAclId(aclId);
         if (null != policies)
             doc.setAppliedPolicies(policies);
@@ -308,21 +339,21 @@ public class ObjectStoreImpl implements 
         return version;
     }
 
-    public Folder createFolder(String name,
-			Map<String, PropertyData<?>> propMap, String user, Folder parent,
-			List<String> policies, Acl addACEs, Acl removeACEs) {
-    	
-    	FolderImpl folder = new FolderImpl(this, name, null);
+    @Override
+    public Folder createFolder(String name, Map<String, PropertyData<?>> propMap, String user, Folder parent,
+            List<String> policies, Acl addACEs, Acl removeACEs) {
+
+        if (null != parent && hasChild(parent, name)) {
+            throw new CmisNameConstraintViolationException("Cannot create folder, this name already exists in parent folder.");
+        }
+        FolderImpl folder = new FolderImpl(this, name, parent.getId());
         if (null != propMap) {
-        	folder.createSystemBasePropertiesWhenCreated(propMap, user);
-        	folder.setCustomProperties(propMap);
+            folder.createSystemBasePropertiesWhenCreated(propMap, user);
+            folder.setCustomProperties(propMap);
         }
         folder.setRepositoryId(fRepositoryId);
-        if (null != parent) {
-        	((FolderImpl)parent).addChildFolder(folder); // add document to folder and set
-        }
 
-        int aclId = getAclId(((FolderImpl)parent), addACEs, removeACEs);
+        int aclId = getAclId(((FolderImpl) parent), addACEs, removeACEs);
         folder.setAclId(aclId);
         if (null != policies)
             folder.setAppliedPolicies(policies);
@@ -334,8 +365,9 @@ public class ObjectStoreImpl implements 
         Folder folder = new FolderImpl(this, name, null);
         folder.setRepositoryId(fRepositoryId);
         return folder;
-	}
-    
+    }
+
+    @Override
     public StoredObject createPolicy(String name, String policyText, Map<String, PropertyData<?>> propMap, String user) {
         PolicyImpl policy = new PolicyImpl(this);
         policy.createSystemBasePropertiesWhenCreated(propMap, user);
@@ -346,10 +378,11 @@ public class ObjectStoreImpl implements 
         policy.persist();
         return policy;
     }
-    
-	public List<StoredObject> getCheckedOutDocuments(String orderBy,
-			String user, IncludeRelationships includeRelationships) {
-	    List<StoredObject> res = new ArrayList<StoredObject>();
+
+    @Override
+    public List<StoredObject> getCheckedOutDocuments(String orderBy, String user,
+            IncludeRelationships includeRelationships) {
+        List<StoredObject> res = new ArrayList<StoredObject>();
 
         for (StoredObject so : fStoredObjectMap.values()) {
             if (so instanceof VersionedDocument) {
@@ -363,9 +396,9 @@ public class ObjectStoreImpl implements 
         return res;
     }
 
-	public StoredObject createRelationship(String name, StoredObject sourceObject,
-			StoredObject targetObject, Map<String, PropertyData<?>> propMap,
-			String user, Acl addACEs, Acl removeACEs) {
+    @Override
+    public StoredObject createRelationship(String name, StoredObject sourceObject, StoredObject targetObject,
+            Map<String, PropertyData<?>> propMap, String user, Acl addACEs, Acl removeACEs) {
 
         RelationshipImpl rel = new RelationshipImpl(this);
         rel.createSystemBasePropertiesWhenCreated(propMap, user);
@@ -380,66 +413,70 @@ public class ObjectStoreImpl implements 
         rel.setAclId(aclId);
         rel.persist();
         return rel;
-	}
+    }
 
+    @Override
     public List<StoredObject> getRelationships(String objectId, List<String> typeIds, RelationshipDirection direction) {
-    
+
         List<StoredObject> res = new ArrayList<StoredObject>();
-        
+
         if (typeIds != null && typeIds.size() > 0) {
             for (String typeId : typeIds) {
                 for (StoredObject so : fStoredObjectMap.values()) {
                     if (so instanceof Relationship && so.getTypeId().equals(typeId)) {
                         Relationship ro = (Relationship) so;
-                        if (ro.getSourceObjectId().equals(objectId) && (RelationshipDirection.EITHER == direction || RelationshipDirection.SOURCE == direction)) {
-                                res.add(so);
-                        } else if (ro.getTargetObjectId().equals(objectId) && (RelationshipDirection.EITHER == direction
-                                || RelationshipDirection.TARGET == direction)) {
+                        if (ro.getSourceObjectId().equals(objectId)
+                                && (RelationshipDirection.EITHER == direction || RelationshipDirection.SOURCE == direction)) {
+                            res.add(so);
+                        } else if (ro.getTargetObjectId().equals(objectId)
+                                && (RelationshipDirection.EITHER == direction || RelationshipDirection.TARGET == direction)) {
                             res.add(so);
                         }
                     }
                 }
-           }
+            }
         } else
             res = getAllRelationships(objectId, direction);
         return res;
     }
 
+    @Override
     public Acl applyAcl(StoredObject so, Acl addAces, Acl removeAces, AclPropagation aclPropagation, String principalId) {
-        if (aclPropagation==AclPropagation.OBJECTONLY || !(so instanceof Folder)) {
+        if (aclPropagation == AclPropagation.OBJECTONLY || !(so instanceof Folder)) {
             return applyAcl(so, addAces, removeAces);
         } else {
-            return applyAclRecursive(((Folder)so), addAces, removeAces, principalId);            
+            return applyAclRecursive(((Folder) so), addAces, removeAces, principalId);
         }
     }
-    
+
+    @Override
     public Acl applyAcl(StoredObject so, Acl acl, AclPropagation aclPropagation, String principalId) {
-        if (aclPropagation==AclPropagation.OBJECTONLY || !(so instanceof Folder)) {
+        if (aclPropagation == AclPropagation.OBJECTONLY || !(so instanceof Folder)) {
             return applyAcl(so, acl);
         } else {
-            return applyAclRecursive(((Folder)so), acl, principalId);
+            return applyAclRecursive(((Folder) so), acl, principalId);
         }
     }
 
     public List<Integer> getAllAclsForUser(String principalId, Permission permission) {
         List<Integer> acls = new ArrayList<Integer>();
-        for (InMemoryAcl acl: fAcls) {
+        for (InMemoryAcl acl : fAcls) {
             if (acl.hasPermission(principalId, permission))
                 acls.add(acl.getId());
         }
         return acls;
     }
-    
+
     public Acl getAcl(int aclId) {
         InMemoryAcl acl = getInMemoryAcl(aclId);
-        return acl==null ? InMemoryAcl.getDefaultAcl().toCommonsAcl() : acl.toCommonsAcl();
+        return acl == null ? InMemoryAcl.getDefaultAcl().toCommonsAcl() : acl.toCommonsAcl();
     }
-    
+
     public int getAclId(StoredObjectImpl so, Acl addACEs, Acl removeACEs) {
         InMemoryAcl newAcl;
         boolean removeDefaultAcl = false;
         int aclId = 0;
-        
+
         if (so == null) {
             newAcl = new InMemoryAcl();
         } else {
@@ -448,35 +485,38 @@ public class ObjectStoreImpl implements 
             if (null == newAcl)
                 newAcl = new InMemoryAcl();
             else
-                // copy list so that we can safely change it without effecting the original
-                newAcl = new InMemoryAcl(newAcl.getAces()); 
+                // copy list so that we can safely change it without effecting
+                // the original
+                newAcl = new InMemoryAcl(newAcl.getAces());
         }
 
         if (newAcl.size() == 0 && addACEs == null && removeACEs == null)
             return 0;
 
         if (null != removeACEs)
-            for (Ace ace: removeACEs.getAces()) {
-            InMemoryAce inMemAce = new InMemoryAce(ace);
-            if (inMemAce.equals(InMemoryAce.getDefaultAce()))
-                removeDefaultAcl = true;
-            }
-        
-        if ( so!= null && 0 == aclId  && !removeDefaultAcl)
-            return 0; // if object grants full access to everyone and it will not be removed we do nothing
+            for (Ace ace : removeACEs.getAces()) {
+                InMemoryAce inMemAce = new InMemoryAce(ace);
+                if (inMemAce.equals(InMemoryAce.getDefaultAce()))
+                    removeDefaultAcl = true;
+            }
+
+        if (so != null && 0 == aclId && !removeDefaultAcl)
+            return 0; // if object grants full access to everyone and it will
+                      // not be removed we do nothing
 
         // add ACEs
         if (null != addACEs)
-            for (Ace ace: addACEs.getAces()) {
+            for (Ace ace : addACEs.getAces()) {
                 InMemoryAce inMemAce = new InMemoryAce(ace);
                 if (inMemAce.equals(InMemoryAce.getDefaultAce()))
-                    return 0; // if everyone has full access there is no need to add additional ACLs.
+                    return 0; // if everyone has full access there is no need to
+                              // add additional ACLs.
                 newAcl.addAce(inMemAce);
             }
-        
+
         // remove ACEs
         if (null != removeACEs)
-            for (Ace ace: removeACEs.getAces()) {
+            for (Ace ace : removeACEs.getAces()) {
                 InMemoryAce inMemAce = new InMemoryAce(ace);
                 newAcl.removeAce(inMemAce);
             }
@@ -486,7 +526,7 @@ public class ObjectStoreImpl implements 
         else
             return 0;
     }
-    
+
     private void deleteFolder(String folderId, String user) {
         StoredObject folder = fStoredObjectMap.get(folderId);
         if (folder == null) {
@@ -499,7 +539,7 @@ public class ObjectStoreImpl implements 
         }
 
         // check if children exist
-        List<? extends StoredObject> children = ((Folder) folder).getChildren(-1, -1, user).getChildren();
+        List<Fileable> children = getChildren((Folder) folder, -1, -1, user).getChildren();
         if (children != null && !children.isEmpty()) {
             throw new CmisConstraintException("Cannot delete folder with id:  " + folderId + ". Folder is not empty.");
         }
@@ -507,33 +547,157 @@ public class ObjectStoreImpl implements 
         fStoredObjectMap.remove(folderId);
     }
 
-    public boolean hasReadAccess(String principalId, StoredObject so) {       
+    @Override
+    public ChildrenResult getChildren(Folder folder, int maxItems, int skipCount, String user) {
+        List<Fileable> children = getChildren(folder, user);
+        sortFolderList(children);
+
+        if (maxItems < 0) {
+            maxItems = children.size();
+        }
+        if (skipCount < 0) {
+            skipCount = 0;
+        }
+
+        int from = Math.min(skipCount, children.size());
+        int to = Math.min(maxItems + from, children.size());
+        int noItems = children.size();
+
+        children = children.subList(from, to);
+        return new ChildrenResult(children, noItems);
+    }
+
+    private List<Fileable> getChildren(Folder folder) {
+        return getChildren(folder, null);
+    }
+
+    private List<Fileable> getChildren(Folder folder, String user) {
+        List<Fileable> children = new ArrayList<Fileable>();
+        for (String id : getIds()) {
+            StoredObject obj = getObject(id);
+            if (obj instanceof Fileable) {
+                Fileable pathObj = (Fileable) obj;
+                if ((null == user || hasReadAccess(user, obj)) && pathObj.getParents().contains(folder.getId())) {
+                    if (pathObj instanceof VersionedDocument) {
+                        DocumentVersion ver = ((VersionedDocument) pathObj).getLatestVersion(false);
+                        children.add(ver);
+                    } else if (!(pathObj instanceof DocumentVersion)) { // ignore
+                                                                        // DocumentVersion
+                        children.add(pathObj);
+                    }
+                }
+            }
+        }
+        return children;
+    }
+
+    @Override
+    public ChildrenResult getFolderChildren(Folder folder, int maxItems, int skipCount, String user) {
+        List<Fileable> folderChildren = new ArrayList<Fileable>();
+        for (String id : getIds()) {
+            StoredObject obj = getObject(id);
+            if (hasReadAccess(user, obj) && obj instanceof Folder) {
+                Folder childFolder = (Folder) obj;
+                if (childFolder.getParents().contains(folder.getId()) ) {
+                    folderChildren.add(childFolder);
+                }
+            }
+        }
+        sortFolderList(folderChildren);
+        int from = Math.min(skipCount, folderChildren.size());
+        int to = Math.min(maxItems + from, folderChildren.size());
+        int noItems = folderChildren.size();
+
+        folderChildren = folderChildren.subList(from, to);
+
+        return new ChildrenResult(folderChildren, noItems);
+    }
+
+    @Override
+    public void move(StoredObject so, Folder oldParent, Folder newParent) {
+        try {
+            if (hasChild(newParent, so.getName())) {
+                throw new CmisInvalidArgumentException("Cannot move object " + so.getName() + " to folder "
+                        + newParent.getPath() + ". A child with this name already exists.");
+            }
+            lock();
+            if (so instanceof FilingMutable) {
+                FilingMutable fi = (FilingMutable) so;
+                addParentIntern(fi, newParent);
+                removeParentIntern(fi, oldParent);
+            } else if (so instanceof FolderImpl) {
+                ((FolderImpl) so).setParentId(newParent.getId());
+            }
+        } finally {
+            unlock();
+        }
+    }
+
+    @Override
+    public void rename(Fileable so, String newName) {
+        try {
+            lock();
+            if (so.getId().equals(fRootFolder.getId())) {
+                throw new CmisInvalidArgumentException("Root folder cannot be renamed.");
+            }
+            for (String folderId : so.getParents()) {
+                Folder folder = (Folder) getObjectById(folderId);
+                if (hasChild(folder, newName))
+                    throw new CmisNameConstraintViolationException("Cannot rename object to " + newName
+                            + ". This path already exists in parent " + folder.getPath() + ".");
+            }
+            so.setName(newName);
+        } finally {
+            unlock();
+        }
+    }
+
+    private boolean hasChild(Folder folder, String name) {
+        List<Fileable> children = getChildren(folder);
+        for (Fileable child : children)
+            if (child.getName().equals(name)) {
+                return true;
+            }
+        return false;
+    }
+
+    @Override
+    public List<String> getParentIds(Filing fileable, String user) {
+        List<String> visibleParents = new ArrayList<String>(); 
+        List<String> parents = fileable.getParents();
+        for (String id: parents) {
+            StoredObject so = getObjectById(id);
+            if (hasReadAccess(user, so)) {
+                visibleParents.add(id);
+            }
+        }
+        return visibleParents;
+    }
+
+    public boolean hasReadAccess(String principalId, StoredObject so) {
         return hasAccess(principalId, so, Permission.READ);
     }
 
-    
-    public boolean hasWriteAccess(String principalId, StoredObject so) {       
+    public boolean hasWriteAccess(String principalId, StoredObject so) {
         return hasAccess(principalId, so, Permission.WRITE);
     }
 
-    
-    public boolean hasAllAccess(String principalId, StoredObject so) {       
+    public boolean hasAllAccess(String principalId, StoredObject so) {
         return hasAccess(principalId, so, Permission.ALL);
     }
-    
 
     public void checkReadAccess(String principalId, StoredObject so) {
         checkAccess(principalId, so, Permission.READ);
     }
-    
+
     public void checkWriteAccess(String principalId, StoredObject so) {
         checkAccess(principalId, so, Permission.WRITE);
     }
-    
+
     public void checkAllAccess(String principalId, StoredObject so) {
         checkAccess(principalId, so, Permission.ALL);
     }
- 
+
     private void checkAccess(String principalId, StoredObject so, Permission permission) {
         if (!hasAccess(principalId, so, permission))
             throw new CmisPermissionDeniedException("Object with id " + so.getId() + " and name " + so.getName()
@@ -543,12 +707,12 @@ public class ObjectStoreImpl implements 
     private boolean hasAccess(String principalId, StoredObject so, Permission permission) {
         if (null != principalId && principalId.equals(ADMIN_PRINCIPAL_ID))
             return true;
-        List<Integer> aclIds = getAllAclsForUser(principalId, permission);        
-        return aclIds.contains(((StoredObjectImpl)so).getAclId());
+        List<Integer> aclIds = getAllAclsForUser(principalId, permission);
+        return aclIds.contains(((StoredObjectImpl) so).getAclId());
     }
 
     private InMemoryAcl getInMemoryAcl(int aclId) {
-        
+
         for (InMemoryAcl acl : fAcls) {
             if (aclId == acl.getId())
                 return acl;
@@ -566,28 +730,28 @@ public class ObjectStoreImpl implements 
         so.setAclId(aclId);
         return aclId;
     }
-    
-	/**
-	 * check if an Acl is already known
-	 * @param acl
-	 *     acl to be checked
-	 * @return
-	 *     0 if Acl is not known, id of Acl otherwise
-	 */
-	private int hasAcl(InMemoryAcl acl) {
-	    for (InMemoryAcl acl2: fAcls) {
-	        if (acl2.equals(acl))
-	            return acl2.getId();
-	    }
-	    return -1;
-	}
+
+    /**
+     * check if an Acl is already known
+     * 
+     * @param acl
+     *            acl to be checked
+     * @return 0 if Acl is not known, id of Acl otherwise
+     */
+    private int hasAcl(InMemoryAcl acl) {
+        for (InMemoryAcl acl2 : fAcls) {
+            if (acl2.equals(acl))
+                return acl2.getId();
+        }
+        return -1;
+    }
 
     private int addAcl(InMemoryAcl acl) {
         int aclId = -1;
-        
+
         if (null == acl)
             return 0;
-        
+
         lock();
         try {
             aclId = hasAcl(acl);
@@ -601,7 +765,7 @@ public class ObjectStoreImpl implements 
         }
         return aclId;
     }
-    
+
     private Acl applyAcl(StoredObject so, Acl acl) {
         int aclId = setAcl((StoredObjectImpl) so, acl);
         return getAcl(aclId);
@@ -614,60 +778,60 @@ public class ObjectStoreImpl implements 
     }
 
     private Acl applyAclRecursive(Folder folder, Acl addAces, Acl removeAces, String principalId) {
-        List<? extends StoredObject> children = folder.getChildren(-1, -1, ADMIN_PRINCIPAL_ID).getChildren();
-        
-        Acl result = applyAcl(folder, addAces, removeAces);  
+        List<Fileable> children = getChildren(folder, -1, -1, ADMIN_PRINCIPAL_ID).getChildren();
+        Acl result = applyAcl(folder, addAces, removeAces);
 
         if (null == children) {
             return result;
         }
-        
-        for (StoredObject child : children) {
+
+        for (Fileable child : children) {
             if (hasAllAccess(principalId, child)) {
                 if (child instanceof Folder) {
-                    applyAclRecursive((Folder) child, addAces, removeAces, principalId);                
+                    applyAclRecursive((Folder) child, addAces, removeAces, principalId);
                 } else {
-                    applyAcl(child, addAces, removeAces);               
+                    applyAcl(child, addAces, removeAces);
                 }
             }
         }
-        
+
         return result;
     }
-    
+
     private Acl applyAclRecursive(Folder folder, Acl acl, String principalId) {
-        List<? extends StoredObject> children = folder.getChildren(-1, -1, ADMIN_PRINCIPAL_ID).getChildren();
+        List<Fileable> children = getChildren(folder, -1, -1, ADMIN_PRINCIPAL_ID).getChildren();
 
-        Acl result = applyAcl(folder, acl);  
+        Acl result = applyAcl(folder, acl);
 
         if (null == children) {
             return result;
         }
 
-        for (StoredObject child : children) {
+        for (Fileable child : children) {
             if (hasAllAccess(principalId, child)) {
                 if (child instanceof Folder) {
-                    applyAclRecursive((Folder) child, acl, principalId);                
+                    applyAclRecursive((Folder) child, acl, principalId);
                 } else {
-                    applyAcl(child, acl);               
+                    applyAcl(child, acl);
                 }
             }
         }
-        
+
         return result;
     }
 
     private List<StoredObject> getAllRelationships(String objectId, RelationshipDirection direction) {
-        
+
         List<StoredObject> res = new ArrayList<StoredObject>();
-        
+
         for (StoredObject so : fStoredObjectMap.values()) {
             if (so instanceof Relationship) {
                 Relationship ro = (Relationship) so;
-                if (ro.getSourceObjectId().equals(objectId) && (RelationshipDirection.EITHER == direction || RelationshipDirection.SOURCE == direction)) {
+                if (ro.getSourceObjectId().equals(objectId)
+                        && (RelationshipDirection.EITHER == direction || RelationshipDirection.SOURCE == direction)) {
                     res.add(so);
-                } else if (ro.getTargetObjectId().equals(objectId) && (RelationshipDirection.EITHER == direction
-                        || RelationshipDirection.TARGET == direction)) {
+                } else if (ro.getTargetObjectId().equals(objectId)
+                        && (RelationshipDirection.EITHER == direction || RelationshipDirection.TARGET == direction)) {
                     res.add(so);
                 }
             }
@@ -675,6 +839,7 @@ public class ObjectStoreImpl implements 
         return res;
     }
 
+    @Override
     public boolean isTypeInUse(String typeId) {
         // iterate over all the objects and check for each if the type matches
         for (String objectId : getIds()) {
@@ -685,5 +850,64 @@ public class ObjectStoreImpl implements 
         return false;
     }
 
+    @Override
+    public void addParent(StoredObject so, Folder parent) {
+        try {
+            lock();
+            if (hasChild(parent, so.getName())) {
+                throw new IllegalArgumentException(
+                        "Cannot assign new parent folder, this name already exists in target folder.");
+            }
+            FilingMutable fi;
+            if (so instanceof FilingMutable) 
+                fi = (FilingMutable) so;
+            else
+                throw new IllegalArgumentException("Object " + so.getId() + "is not fileable");
+                
+            addParentIntern(fi, parent);
+        } finally {
+            unlock();
+        }
+    }
+
+    @Override
+    public void removeParent(StoredObject so, Folder parent) {
+        try {
+            lock();
+            FilingMutable fi;
+            if (so instanceof FilingMutable) 
+                fi = (FilingMutable) so;
+            else
+                throw new IllegalArgumentException("Object " + so.getId() + "is not fileable");
+
+            removeParentIntern(fi, parent);
+        } finally {
+            unlock();
+        }
+    }
+
+    private void addParentIntern(FilingMutable so, Folder parent) {
+        so.addParentId(parent.getId());
+    }
+
+    private void removeParentIntern(FilingMutable so, Folder parent) {
+        so.removeParentId(parent.getId());
+    }
+
+    private static void sortFolderList(List<? extends StoredObject> list) {
+        // TODO evaluate orderBy, for now sort by path segment
+        class FolderComparator implements Comparator<StoredObject> {
+
+            @Override
+            public int compare(StoredObject f1, StoredObject f2) {
+                String segment1 = f1.getName();
+                String segment2 = f2.getName();
+
+                return segment1.compareTo(segment2);
+            }
+        }
+
+        Collections.sort(list, new FolderComparator());
+    }
 
 }

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/PolicyImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/PolicyImpl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/PolicyImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/PolicyImpl.java Fri May 24 12:48:21 2013
@@ -40,7 +40,8 @@ public class PolicyImpl extends StoredOb
         policyText = text;
     }
     
-    public String getPolicyText() {
+    @Override
+	public String getPolicyText() {
         return policyText;
     }
     

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/RelationshipImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/RelationshipImpl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/RelationshipImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/RelationshipImpl.java Fri May 24 12:48:21 2013
@@ -36,7 +36,8 @@ public class RelationshipImpl extends St
         super(objStore);
     }
 
-    public String getSourceObjectId() {
+    @Override
+	public String getSourceObjectId() {
         return sourceObjId;
     }
 
@@ -44,7 +45,8 @@ public class RelationshipImpl extends St
         this.sourceObjId = id;
     }
 
-    public String getTargetObjectId() {
+    @Override
+	public String getTargetObjectId() {
         return targetObjId;
     }
 

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java Fri May 24 12:48:21 2013
@@ -120,19 +120,22 @@ public class StoreManagerImpl implements
         fObjectFactory = new BindingsObjectFactoryImpl();
     }
 
-    public List<String> getAllRepositoryIds() {
+    @Override
+	public List<String> getAllRepositoryIds() {
         Set<String> repIds = fMapRepositoryToObjectStore.keySet();
         List<String> result = new ArrayList<String>();
         result.addAll(repIds);
         return result;
     }
 
-    public void initRepository(String repositoryId) {
+    @Override
+	public void initRepository(String repositoryId) {
         fMapRepositoryToObjectStore.put(repositoryId, new ObjectStoreImpl(repositoryId));
         fMapRepositoryToTypeManager.put(repositoryId, new TypeManagerImpl());
     }
 
-    public void createAndInitRepository(String repositoryId, String typeCreatorClassName) {
+    @Override
+	public void createAndInitRepository(String repositoryId, String typeCreatorClassName) {
         if (fMapRepositoryToObjectStore.containsKey(repositoryId)
                 || fMapRepositoryToTypeManager.containsKey(repositoryId)) {
             throw new RuntimeException("Cannot add repository, repository " + repositoryId + " already exists.");
@@ -145,19 +148,23 @@ public class StoreManagerImpl implements
         initTypeSystem(repositoryId, typeCreatorClassName);
     }
 
-    public ObjectStore getObjectStore(String repositoryId) {
+    @Override
+	public ObjectStore getObjectStore(String repositoryId) {
         return fMapRepositoryToObjectStore.get(repositoryId);
     }
 
-    public CmisServiceValidator getServiceValidator() {
+    @Override
+	public CmisServiceValidator getServiceValidator() {
         return new InMemoryServiceValidatorImpl(this);
     }
 
-    public BindingsObjectFactory getObjectFactory() {
+    @Override
+	public BindingsObjectFactory getObjectFactory() {
         return fObjectFactory;
     }
 
-    public TypeDefinitionContainer getTypeById(String repositoryId, String typeId) {
+    @Override
+	public TypeDefinitionContainer getTypeById(String repositoryId, String typeId) {
         TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
         if (null == typeManager) {
             throw new RuntimeException("Unknown repository " + repositoryId);
@@ -176,7 +183,8 @@ public class StoreManagerImpl implements
         return tdc;
     }
 
-    public TypeDefinitionContainer getTypeById(String repositoryId, String typeId, boolean includePropertyDefinitions,
+    @Override
+	public TypeDefinitionContainer getTypeById(String repositoryId, String typeId, boolean includePropertyDefinitions,
             int depth) {
         TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
         if (null == typeManager) {
@@ -199,7 +207,8 @@ public class StoreManagerImpl implements
             return null;
     }
 
-    public Collection<TypeDefinitionContainer> getTypeDefinitionList(String repositoryId,
+    @Override
+	public Collection<TypeDefinitionContainer> getTypeDefinitionList(String repositoryId,
             boolean includePropertyDefinitions) {
 //        Collection<TypeDefinitionContainer> result;
         TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
@@ -224,7 +233,8 @@ public class StoreManagerImpl implements
         return typeColl;
     }
 
-    public List<TypeDefinitionContainer> getRootTypes(String repositoryId, boolean includePropertyDefinitions) {
+    @Override
+	public List<TypeDefinitionContainer> getRootTypes(String repositoryId, boolean includePropertyDefinitions) {
         List<TypeDefinitionContainer> result;
         TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
         if (null == typeManager) {
@@ -265,7 +275,8 @@ public class StoreManagerImpl implements
         return result;
     }
 
-    public RepositoryInfo getRepositoryInfo(String repositoryId) {
+    @Override
+	public RepositoryInfo getRepositoryInfo(String repositoryId) {
         ObjectStore sm = fMapRepositoryToObjectStore.get(repositoryId);
         if (null == sm) {
             return null;
@@ -575,12 +586,26 @@ public class StoreManagerImpl implements
         return tdcClone;
     }
 
-    public TypeManagerCreatable getTypeManager(String repositoryId) {
+    @Override
+	public TypeManagerCreatable getTypeManager(String repositoryId) {
         TypeManagerCreatable typeManager = fMapRepositoryToTypeManager.get(repositoryId);
         return typeManager;
     }
 
-    public ObjectList query(String user, String repositoryId, String statement, Boolean searchAllVersions,
+    @Override
+    public
+	boolean supportsSingleFiling(String repositoryId) {
+    	return false;
+    }
+    
+    @Override
+    public
+	boolean supportsMultiFilings(String repositoryId) {
+    	return true;
+    }
+    
+    @Override
+	public ObjectList query(String user, String repositoryId, String statement, Boolean searchAllVersions,
             Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
             BigInteger maxItems, BigInteger skipCount) {
         TypeManager tm = getTypeManager(repositoryId);

Modified: chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java?rev=1486037&r1=1486036&r2=1486037&view=diff
==============================================================================
--- chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java (original)
+++ chemistry/opencmis/branches/inmemory-refactoring/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java Fri May 24 12:48:21 2013
@@ -88,67 +88,83 @@ public class StoredObjectImpl implements
         policyIds = null;
     }
 
-    public String getId() {
+    @Override
+	public String getId() {
         return fId;
     }
 
-    public String getName() {
+    @Override
+	public String getName() {
         return fName;
     }
 
-    public void setName(String name) {
+    @Override
+	public void setName(String name) {
         fName = name;
     }
 
-    public String getTypeId() {
+    @Override
+	public String getTypeId() {
         return fTypeId;
     }
 
-    public void setTypeId(String type) {
+    @Override
+	public void setTypeId(String type) {
         fTypeId = type;
     }
 
-    public String getCreatedBy() {
+    @Override
+	public String getCreatedBy() {
         return fCreatedBy;
     }
 
-    public void setCreatedBy(String createdBy) {
+    @Override
+	public void setCreatedBy(String createdBy) {
         this.fCreatedBy = createdBy;
     }
 
-    public String getModifiedBy() {
+    @Override
+	public String getModifiedBy() {
         return fModifiedBy;
     }
 
-    public void setModifiedBy(String modifiedBy) {
+    @Override
+	public void setModifiedBy(String modifiedBy) {
         this.fModifiedBy = modifiedBy;
     }
 
-    public GregorianCalendar getCreatedAt() {
+    @Override
+	public GregorianCalendar getCreatedAt() {
         return fCreatedAt;
     }
 
-    public void setCreatedAt(GregorianCalendar createdAt) {
+    @Override
+	public void setCreatedAt(GregorianCalendar createdAt) {
         this.fCreatedAt = createdAt;
     }
 
-    public GregorianCalendar getModifiedAt() {
+    @Override
+	public GregorianCalendar getModifiedAt() {
         return fModifiedAt;
     }
 
-    public void setModifiedAtNow() {
+    @Override
+	public void setModifiedAtNow() {
         this.fModifiedAt = getNow();
     }
 
-    public void setRepositoryId(String repositoryId) {
+    @Override
+	public void setRepositoryId(String repositoryId) {
         fRepositoryId = repositoryId;
     }
 
-    public String getRepositoryId() {
+    @Override
+	public String getRepositoryId() {
         return fRepositoryId;
     }
     
-    public List<String> getAppliedPolicies() {
+    @Override
+	public List<String> getAppliedPolicies() {
         if (null == policyIds)
             return null;
         else
@@ -166,7 +182,8 @@ public class StoredObjectImpl implements
         }
     }
     
-    public void addAppliedPolicy(String policyId) {
+    @Override
+	public void addAppliedPolicy(String policyId) {
         if (null == policyIds) {
             policyIds = new ArrayList<String>();
         }
@@ -175,7 +192,8 @@ public class StoredObjectImpl implements
         }
     }
 
-    public void removePolicy(String policyId) {
+    @Override
+	public void removePolicy(String policyId) {
         if (null != policyIds && policyIds.contains(policyId)) {
             policyIds.remove(policyId);
             if (policyIds.isEmpty()) {
@@ -185,46 +203,51 @@ public class StoredObjectImpl implements
     }
     
     // CMIS 1.1:
-    public void setDescription(String descr) {
+    @Override
+	public void setDescription(String descr) {
         description = descr;
     }
     
     // CMIS 1.1:
-    public String getDescription() {
+    @Override
+	public String getDescription() {
         return description;
     }
 
-    public List<String> getSecondaryTypeIds() {
+    @Override
+	public List<String> getSecondaryTypeIds() {
         return Collections.unmodifiableList(secondaryTypeIds);
     }
 
-    public void setProperties(Map<String, PropertyData<?>> props) {
+    @Override
+	public void setProperties(Map<String, PropertyData<?>> props) {
         fProperties = props;
     }
 
-    public Map<String, PropertyData<?>> getProperties() {
+    @Override
+	public Map<String, PropertyData<?>> getProperties() {
         return fProperties;
     }
 
-    public String getChangeToken() {
+    @Override
+	public String getChangeToken() {
         GregorianCalendar lastModified = getModifiedAt();
         String token = Long.valueOf(lastModified.getTimeInMillis()).toString();
         return token;
     }
 
-    public void rename(String newName) {
-        setName(newName);
-    }
-
-    public void createSystemBasePropertiesWhenCreated(Map<String, PropertyData<?>> properties, String user) {
+    @Override
+	public void createSystemBasePropertiesWhenCreated(Map<String, PropertyData<?>> properties, String user) {
         addSystemBaseProperties(properties, user, true);
     }
 
-    public void updateSystemBasePropertiesWhenModified(Map<String, PropertyData<?>> properties, String user) {
+    @Override
+	public void updateSystemBasePropertiesWhenModified(Map<String, PropertyData<?>> properties, String user) {
         addSystemBaseProperties(properties, user, false);
     }
 
-    public void fillProperties(Map<String, PropertyData<?>> properties, BindingsObjectFactory objFactory,
+    @Override
+	public void fillProperties(Map<String, PropertyData<?>> properties, BindingsObjectFactory objFactory,
             List<String> requestedIds) {
         
         if (FilterParser.isContainedInFilter(PropertyIds.NAME, requestedIds)) {
@@ -289,7 +312,8 @@ public class StoredObjectImpl implements
     // ///////////////////////////////////////////
     // private helper methods
 
-    public void setCustomProperties(Map<String, PropertyData<?>> properties) {
+    @Override
+	public void setCustomProperties(Map<String, PropertyData<?>> properties) {
         properties = new HashMap<String, PropertyData<?>>(properties); // get a
         // writable
         // collection
@@ -463,12 +487,14 @@ public class StoredObjectImpl implements
         }
     }
 
-    public void persist() {
+    @Override
+	public void persist() {
         // in-memory implementation does not need to to anything to persist,
         // but after this call the id should be set.
         fId = fObjStore.storeObject(this);
     }
 
+	@Override
 	public Acl getAcl() {
 	    return fObjStore.getAcl(fAclId);
 	}
@@ -481,26 +507,31 @@ public class StoredObjectImpl implements
 	    fAclId = aclId;
 	}
 	
-    public List<StoredObject> getObjectRelationships(RelationshipDirection relationshipDirection, String user) {
+    @Override
+	public List<StoredObject> getObjectRelationships(RelationshipDirection relationshipDirection, String user) {
 	    
         List<StoredObject> rels = fObjStore.getRelationships(getId(), null, relationshipDirection);
 		return rels;
 	}
 
+	@Override
 	public AllowableActions getAllowableActions(String user) {
 		AllowableActions actions = DataObjectCreator.fillAllowableActions(this, user);
 		return actions;
 	}
 
-    public List<RenditionData> getRenditions(String renditionFilter, long maxItems, long skipCount) {
+    @Override
+	public List<RenditionData> getRenditions(String renditionFilter, long maxItems, long skipCount) {
         return null;
     }
 
-    public ContentStream getRenditionContent(String streamId, long offset, long length) {
+    @Override
+	public ContentStream getRenditionContent(String streamId, long offset, long length) {
         return null;
     }
 
-    public boolean hasRendition(String user) {
+    @Override
+	public boolean hasRendition(String user) {
         return false;
     }
     



Mime
View raw message