chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1511617 [2/5] - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src: main/java/org/apache/chemistry/opencmis/inmemory/ main/java/org/apache/chemistry/opencmis/inmemory/query/ main/java/org/apache/c...
Date Thu, 08 Aug 2013 08:40:27 GMT
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Folder.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Folder.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Folder.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/Folder.java Thu Aug  8 08:40:26 2013
@@ -37,14 +37,13 @@ public interface Folder extends Fileable
      *      parent id of this folder
      */
     String getParentId();
-    
+      
     /**
-     * get the path of this folder (for folder in CMIS path is unique)
-     * 
-     * @return
-     *      path of this folder
+     * set the parent id of a folder
+     * @param parentId
+     *      parent id of this folder
      */
-    String getPath();
+    void setParentId(String parentId);
     
     /**
      * return a list of allowed types of children in this folder

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/MultiFiling.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/MultiFiling.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/MultiFiling.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/MultiFiling.java Thu Aug  8 08:40:26 2013
@@ -29,25 +29,18 @@ package org.apache.chemistry.opencmis.in
 public interface MultiFiling extends Filing {
 
     /**
-     * retrieve the path segment of this folder
+     * Add parent folder to this document
      * 
-     * @return
+     * @param parentId
+     *     id of parent folder to be added.
      */
-    String getPathSegment();
+    void addParentId(String parentId);
 
     /**
-     * Add this document to a new parent folder as child object
+     * Remove parent from this object
      * 
-     * @param parent
-     *            new parent folder of the document.
+     * @param parentId
+     *     id of parent folder to be removed.
      */
-    void addParent(Folder parent);
-
-    /**
-     * Remove this object from the children of parent
-     * 
-     * @param parent
-     *            parent folder of the document
-     */
-    void removeParent(Folder parent);
+    void removeParentId(String parentId);
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/ObjectStore.java Thu Aug  8 08:40:26 2013
@@ -197,6 +197,36 @@ public interface ObjectStore {
     public StoredObject createPolicy(String name, String policyText, Map<String, PropertyData<?>> propMap, String user);
 
     /**
+     * Persist a new version in the store (created from a check-out)
+     * @param version
+     */
+    public void storeVersion(DocumentVersion version);
+    
+    /**
+     * remove a version from the store (after a cancel check-out)
+     * @param version
+     *      version to be deleted
+     */
+    public void deleteVersion(DocumentVersion version);
+    
+    /**
+     * Persist an object after modifying the properties
+     * @param so
+     *      object to be updated
+     */
+    public void upateObject(StoredObject so);
+    
+    /**
+     * get the path of this folder (for folder in CMIS path is unique)
+     * 
+     * @param folderId
+     *      id of folder
+     * @return
+     *      path of this folder
+     */
+    String getFolderPath(String folderId);
+
+    /**
      * Clear repository and remove all data.
      */
     void clear();
@@ -301,4 +331,13 @@ public interface ObjectStore {
      */
     List<StoredObject> getRelationships(String objectId, List<String> typeIds,
             RelationshipDirection direction);
+    
+    /**
+     * get an ACL object from an ACL id
+     * @param aclId
+     *      id of ACL
+     * @return
+     *      ACL of this id
+     */
+    public Acl getAcl(int aclId);
 }
\ No newline at end of file

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java Thu Aug  8 08:40:26 2013
@@ -224,12 +224,6 @@ public interface StoredObject {
     String getChangeToken();
 
     /**
-     * Persist the object so that it can be later retrieved by its id. Assign an
-     * id to the object
-     */
-    void persist();
-
-    /**
      * Create all system base properties that need to be stored with every
      * object in the repository This method is called when a new object is
      * created to record all of the capturing data like the creation time,
@@ -273,32 +267,10 @@ public interface StoredObject {
     void setCustomProperties(Map<String, PropertyData<?>> properties);
     
     /**
-     * get the Acl of the stored object
+     * get the Acl id of the stored object
      */
-    Acl getAcl();
+    int getAclId();
     
-    /**
-     * get the relationships of the object
-     * 
-     * @param includeSubRelationshipTypes
-     *            if true, relationships of a sub type will be returned as well
-     * @param relationshipDirection
-     * 			whether relationships where the object is the source, or the target or all 
-     *          are returned
-     * @param typeId
-     * 			the type of the relationship, may be null
-     * @param filter
-     * 			a property filter, "*" means all properties
-     * @param includeAllowableActions
-     * 			whether allowable actions should be returned
-     * @param maxItems
-     * @param skipCount
-     * @param extension
-     * @param user
-     * 			the id of the user calling the method 
-     */
-    public List<StoredObject> getObjectRelationships(RelationshipDirection relationshipDirection, String user);
-	
 	/*
      * get the allowable actions  of the object
      */

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/TypeManagerCreatable.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/TypeManagerCreatable.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/TypeManagerCreatable.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/TypeManagerCreatable.java Thu Aug  8 08:40:26 2013
@@ -30,8 +30,10 @@ public interface TypeManagerCreatable ex
      * 
      * @param cmisType
      *            new type to add
+     * @param addInheritedProperties
+     *            add properties from supertype to type definition
      */
-    void addTypeDefinition(TypeDefinition typeDefinition);
+    void addTypeDefinition(TypeDefinition typeDefinition, boolean addInheritedProperties);
     
     /**
      * Modify an existing type definition

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/VersionedDocument.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/VersionedDocument.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/VersionedDocument.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/VersionedDocument.java Thu Aug  8 08:40:26 2013
@@ -33,7 +33,7 @@ import org.apache.chemistry.opencmis.com
  * @author Jens
  * 
  */
-public interface VersionedDocument extends Fileable {
+public interface VersionedDocument extends Filing, StoredObject {
 
     DocumentVersion addVersion(ContentStream content, VersioningState verState, String user);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java Thu Aug  8 08:40:26 2013
@@ -55,8 +55,8 @@ public class DocumentImpl extends Filing
 
     public static final int THUMBNAIL_SIZE = 100;
 
-    DocumentImpl(ObjectStoreImpl objStore) { // visibility should be package
-        super(objStore);
+    public DocumentImpl() { // visibility should be package
+        super();
     }
 
     @Override

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java Thu Aug  8 08:40:26 2013
@@ -34,6 +34,7 @@ import org.apache.chemistry.opencmis.inm
 import org.apache.chemistry.opencmis.inmemory.ConfigurationSettings;
 import org.apache.chemistry.opencmis.inmemory.FilterParser;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.MultiFiling;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument;
 
 /**
@@ -42,7 +43,7 @@ import org.apache.chemistry.opencmis.inm
  * @author Jens
  *
  */
-public class DocumentVersionImpl extends StoredObjectImpl implements DocumentVersion, FilingMutable {
+public class DocumentVersionImpl extends StoredObjectImpl implements DocumentVersion, MultiFiling {
 
     private final Long MAX_CONTENT_SIZE_KB = ConfigurationSettings.getConfigurationValueAsLong(ConfigConstants.MAX_CONTENT_SIZE_KB);
 
@@ -52,11 +53,10 @@ public class DocumentVersionImpl extends
     private String fComment; // checkin comment
     boolean fIsMajor;
     boolean fIsPwc; // true if this is the PWC
-    String label;
 
     public DocumentVersionImpl(String repositoryId, VersionedDocument container, ContentStream content,
-            VersioningState verState, ObjectStoreImpl objStore) {
-        super(objStore);
+            VersioningState verState) {
+        super();
         setRepositoryId(repositoryId);
         fContainer = (VersionedDocumentImpl) container;
         setContent(content, false);
@@ -70,8 +70,6 @@ public class DocumentVersionImpl extends
                 fProperties.put(prop.getKey(), prop.getValue());
             }
         }
-
-        label = createVersionLabel();
     }
 
     @Override
@@ -119,7 +117,7 @@ public class DocumentVersionImpl extends
     }
 
     private String createVersionLabel() {
-        int majorNo = 1;
+        int majorNo = 0;
         int minorNo = 0;
         List<DocumentVersion> allVersions = fContainer.getAllVersions();
         for (DocumentVersion ver : allVersions) {
@@ -133,7 +131,7 @@ public class DocumentVersionImpl extends
                 break;
             }
         }
-        String label = "V " + majorNo + "." + minorNo;
+        String label = majorNo + "." + minorNo;
         return label;
     }
 
@@ -177,6 +175,12 @@ public class DocumentVersionImpl extends
         } else {
             isLatestVersion = allVers.get(allVers.size() - 1).equals(this);        	
         }
+        if (hasPwc) {
+            // CMIS 1.1 forbids it for PWC
+            isLatestVersion = allVers.size() > 1 && allVers.get(allVers.size() - 2).equals(this);          
+        } else {
+            isLatestVersion = allVers.get(allVers.size() - 1).equals(this);            
+        }
         return isLatestVersion;
     }
 
@@ -302,8 +306,8 @@ public class DocumentVersionImpl extends
     }    
     
     @Override
-	public List<String> getParents() {
-        return fContainer.getParents();
+	public List<String> getParentIds() {
+        return fContainer.getParentIds();
     }
 
     @Override
@@ -323,7 +327,7 @@ public class DocumentVersionImpl extends
 
     @Override
 	public String getVersionLabel() {
-        return label;
+        return createVersionLabel();
     }
 
     @Override

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FilingImpl.java Thu Aug  8 08:40:26 2013
@@ -23,17 +23,18 @@ import java.util.List;
 
 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.MultiFiling;
 
-public class FilingImpl extends StoredObjectImpl implements Fileable, FilingMutable {
+public class FilingImpl extends StoredObjectImpl implements Fileable, MultiFiling {
     
     private List<String> parentIds = new ArrayList<String>(1);
     
-    FilingImpl(ObjectStoreImpl objStore) {
-        super(objStore);
+    FilingImpl() {
+        super();
     }
 
     @Override
-    public List<String> getParents() {
+    public List<String> getParentIds() {
         return parentIds;
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java Thu Aug  8 08:40:26 2013
@@ -39,6 +39,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.inmemory.FilterParser;
 import org.apache.chemistry.opencmis.inmemory.NameValidator;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Folder;
+import org.apache.chemistry.opencmis.inmemory.storedobj.api.ObjectStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,12 +47,12 @@ public class FolderImpl extends StoredOb
     private static final Logger LOG = LoggerFactory.getLogger(FilingImpl.class.getName());
     protected String parentId;
     
-    FolderImpl(ObjectStoreImpl objStore) {
-        super(objStore);
+    public FolderImpl() {
+        super();
     }
 
-    public FolderImpl(ObjectStoreImpl objStore, String name, String parentId) {
-        super(objStore);
+    public FolderImpl(String name, String parentId) {
+        super();
         init(name, parentId);
     }
 
@@ -75,10 +76,10 @@ public class FolderImpl extends StoredOb
                     PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS, allowedChildObjects));
         }
 
-        if (FilterParser.isContainedInFilter(PropertyIds.PATH, requestedIds)) {
-            String path = getPath();
-            properties.put(PropertyIds.PATH, objFactory.createPropertyStringData(PropertyIds.PATH, path));
-        }
+//        if (FilterParser.isContainedInFilter(PropertyIds.PATH, requestedIds)) {
+//            String path = getPath();
+//            properties.put(PropertyIds.PATH, objFactory.createPropertyStringData(PropertyIds.PATH, path));
+//        }
     }
 
     @Override
@@ -130,7 +131,7 @@ public class FolderImpl extends StoredOb
     }
 
     @Override
-    public List<String> getParents() {
+    public List<String> getParentIds() {
         if (parentId == null)
             return Collections.emptyList();
         else
@@ -148,34 +149,15 @@ public class FolderImpl extends StoredOb
     }
 
     @Override
-    public String getPath() {
-        StringBuffer sb = new StringBuffer();
-        insertPathSegment(sb, this);
-        return sb.toString();
-    }
-    
-    @Override
     public String getPathSegment() {
         return getName();
     }
 
+    @Override
     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)) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java Thu Aug  8 08:40:26 2013
@@ -832,7 +832,8 @@ public class InMemoryServiceValidatorImp
 
         StoredObject[] sos = super.removeObjectFromFolder(context, repositoryId, objectId, folderId, extension);
         checkWriteAccess(repositoryId, context.getUsername(), sos[0]);
-        checkWriteAccess(repositoryId, context.getUsername(), sos[1]);
+        if (null != folderId)
+            checkWriteAccess(repositoryId, context.getUsername(), sos[1]);
         return sos;
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ItemImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ItemImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ItemImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ItemImpl.java Thu Aug  8 08:40:26 2013
@@ -27,8 +27,8 @@ import org.apache.chemistry.opencmis.inm
  */
 public class ItemImpl extends FilingImpl implements Item, Filing {
 
-    ItemImpl(ObjectStoreImpl objStore) {
-        super(objStore);
+    public ItemImpl() {
+        super();
     }
 
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java Thu Aug  8 08:40:26 2013
@@ -46,6 +46,7 @@ import org.apache.chemistry.opencmis.inm
 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;
@@ -206,15 +207,6 @@ public class ObjectStoreImpl implements 
         }
     }
 
-    public void removeVersion(DocumentVersion vers) {
-        StoredObject found = fStoredObjectMap.remove(vers.getId());
-
-        if (null == found) {
-            throw new CmisInvalidArgumentException("Cannot delete object with id  " + vers.getId()
-                    + ". Object does not exist.");
-        }
-    }
-
     public String storeObject(StoredObject so) {
         String id = so.getId();
         // check if update or create
@@ -258,7 +250,7 @@ public class ObjectStoreImpl implements 
     // private helper methods
 
     private void createRootFolder() {
-        FolderImpl rootFolder = new FolderImpl(this);
+        FolderImpl rootFolder = new FolderImpl();
         rootFolder.setName("RootFolder");
         rootFolder.setParentId(null);
         rootFolder.setTypeId(BaseTypeId.CMIS_FOLDER.value());
@@ -267,14 +259,15 @@ public class ObjectStoreImpl implements 
         rootFolder.setModifiedAtNow();
         rootFolder.setRepositoryId(fRepositoryId);
         rootFolder.setAclId(addAcl(InMemoryAcl.getDefaultAcl()));
-        rootFolder.persist();
+        String id = storeObject(rootFolder);
+        rootFolder.setId(id);
         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);
+        DocumentImpl doc = new DocumentImpl();
         doc.createSystemBasePropertiesWhenCreated(propMap, user);
         doc.setCustomProperties(propMap);
         doc.setRepositoryId(fRepositoryId);
@@ -282,20 +275,22 @@ public class ObjectStoreImpl implements 
         if (null != folder) {
             if (hasChild(folder, name))
                 throw new CmisNameConstraintViolationException("Cannot create document an object with name " + name
-                        + " already exists in folder " + folder.getPath());
+                        + " already exists in folder " + getFolderPath(folder.getId()));
             doc.addParentId(folder.getId());
         }
         int aclId = getAclId(((FolderImpl) folder), addACEs, removeACEs);
         doc.setAclId(aclId);
         if (null != policies)
             doc.setAppliedPolicies(policies);
+        String id = storeObject(doc);
+        doc.setId(id);
         return doc;
     }
 
     @Override
     public StoredObject createItem(String name, Map<String, PropertyData<?>> propMap, String user, Folder folder,
             List<String> policies, Acl addACEs, Acl removeACEs) {
-        ItemImpl item = new ItemImpl(this);
+        ItemImpl item = new ItemImpl();
         item.createSystemBasePropertiesWhenCreated(propMap, user);
         item.setCustomProperties(propMap);
         item.setRepositoryId(fRepositoryId);
@@ -303,13 +298,15 @@ public class ObjectStoreImpl implements 
         if (null != folder) {
             if (hasChild(folder, name))
                 throw new CmisNameConstraintViolationException("Cannot create document an object with name " + name
-                        + " already exists in folder " + folder.getPath());
+                        + " already exists in folder " + getFolderPath(folder.getId()));
             item.addParentId(folder.getId());
         }
         if (null != policies)
             item.setAppliedPolicies(policies);
         int aclId = getAclId(((FolderImpl) folder), addACEs, removeACEs);
         item.setAclId(aclId);
+        String id = storeObject(item);
+        item.setId(id);
         return item;
     }
 
@@ -317,25 +314,28 @@ public class ObjectStoreImpl implements 
     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);
+        VersionedDocumentImpl doc = new VersionedDocumentImpl();
         doc.createSystemBasePropertiesWhenCreated(propMap, user);
         doc.setCustomProperties(propMap);
         doc.setRepositoryId(fRepositoryId);
         doc.setName(name);
+        String id = storeObject(doc);
+        doc.setId(id);
         DocumentVersion version = doc.addVersion(contentStream, versioningState, user);
         version.createSystemBasePropertiesWhenCreated(propMap, user);
         version.setCustomProperties(propMap);
         if (null != folder) {
             if (hasChild(folder, name))
                 throw new CmisNameConstraintViolationException("Cannot create document an object with name " + name
-                        + " already exists in folder " + folder.getPath());
+                        + " already exists in folder " + getFolderPath(folder.getId()));
             doc.addParentId(folder.getId());
         }
         int aclId = getAclId(((FolderImpl) folder), addACEs, removeACEs);
         doc.setAclId(aclId);
         if (null != policies)
             doc.setAppliedPolicies(policies);
-        doc.persist();
+        id = storeObject(version);
+        version.setId(id);
         return version;
     }
 
@@ -346,7 +346,7 @@ public class ObjectStoreImpl implements 
         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());
+        FolderImpl folder = new FolderImpl(name, parent.getId());
         if (null != propMap) {
             folder.createSystemBasePropertiesWhenCreated(propMap, user);
             folder.setCustomProperties(propMap);
@@ -358,49 +358,35 @@ public class ObjectStoreImpl implements 
         if (null != policies)
             folder.setAppliedPolicies(policies);
 
+        String id = storeObject(folder);
+        folder.setId(id);
         return folder;
     }
 
     public Folder createFolder(String name) {
-        Folder folder = new FolderImpl(this, name, null);
+        Folder folder = new FolderImpl(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);
+        PolicyImpl policy = new PolicyImpl();
         policy.createSystemBasePropertiesWhenCreated(propMap, user);
         policy.setCustomProperties(propMap);
         policy.setRepositoryId(fRepositoryId);
         policy.setName(name);
         policy.setPolicyText(policyText);
-        policy.persist();
+        String id = storeObject(policy);
+        policy.setId(id);
         return policy;
     }
 
     @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) {
-                VersionedDocument verDoc = (VersionedDocument) so;
-                if (verDoc.isCheckedOut() && hasReadAccess(user, verDoc)) {
-                    res.add(verDoc.getPwc());
-                }
-            }
-        }
-
-        return res;
-    }
-
-    @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);
+        RelationshipImpl rel = new RelationshipImpl();
         rel.createSystemBasePropertiesWhenCreated(propMap, user);
         rel.setCustomProperties(propMap);
         rel.setRepositoryId(fRepositoryId);
@@ -411,11 +397,50 @@ public class ObjectStoreImpl implements 
             rel.setTarget(targetObject.getId());
         int aclId = getAclId(null, addACEs, removeACEs);
         rel.setAclId(aclId);
-        rel.persist();
+        String id = storeObject(rel);
+        rel.setId(id);
         return rel;
     }
 
     @Override
+    public void storeVersion(DocumentVersion version) {
+        String id = storeObject(version);
+        version.setId(id);
+    }
+    
+    @Override
+    public void deleteVersion(DocumentVersion version) {
+        StoredObject found = fStoredObjectMap.remove(version.getId());
+
+        if (null == found) {
+            throw new CmisInvalidArgumentException("Cannot delete object with id  " + version.getId()
+                    + ". Object does not exist.");
+        }
+    }
+
+    @Override
+    public void upateObject(StoredObject so) {
+        // nothing to do
+    }
+
+    @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) {
+                VersionedDocument verDoc = (VersionedDocument) so;
+                if (verDoc.isCheckedOut() && hasReadAccess(user, verDoc)) {
+                    res.add(verDoc.getPwc());
+                }
+            }
+        }
+
+        return res;
+    }
+
+    @Override
     public List<StoredObject> getRelationships(String objectId, List<String> typeIds, RelationshipDirection direction) {
 
         List<StoredObject> res = new ArrayList<StoredObject>();
@@ -441,6 +466,27 @@ public class ObjectStoreImpl implements 
     }
 
     @Override
+    public String getFolderPath(String folderId) {
+        StringBuffer sb = new StringBuffer();
+        insertPathSegment(sb, folderId);
+        return sb.toString();     
+    }
+    
+    private void insertPathSegment(StringBuffer sb, String folderId) {
+        Folder folder = (Folder) getObjectById(folderId);
+        if (null == folder.getParentId()) {
+            if (sb.length() == 0) {
+                sb.insert(0, Folder.PATH_SEPARATOR);
+            }
+        } else {
+            sb.insert(0, folder.getName());
+            sb.insert(0, Folder.PATH_SEPARATOR);
+            insertPathSegment(sb, folder.getParentId());
+        }
+    }
+
+   
+    @Override
     public Acl applyAcl(StoredObject so, Acl addAces, Acl removeAces, AclPropagation aclPropagation, String principalId) {
         if (aclPropagation == AclPropagation.OBJECTONLY || !(so instanceof Folder)) {
             return applyAcl(so, addAces, removeAces);
@@ -467,6 +513,8 @@ public class ObjectStoreImpl implements 
         return acls;
     }
 
+   
+    @Override
     public Acl getAcl(int aclId) {
         InMemoryAcl acl = getInMemoryAcl(aclId);
         return acl == null ? InMemoryAcl.getDefaultAcl().toCommonsAcl() : acl.toCommonsAcl();
@@ -568,7 +616,7 @@ public class ObjectStoreImpl implements 
     }
 
     private List<Fileable> getChildren(Folder folder) {
-        return getChildren(folder, null, true);
+        return getChildren(folder, null, false);
     }
 
     private List<Fileable> getChildren(Folder folder, String user, boolean usePwc) {
@@ -577,21 +625,20 @@ public class ObjectStoreImpl implements 
             StoredObject obj = getObject(id);
             if (obj instanceof Fileable) {
                 Fileable pathObj = (Fileable) obj;
-                if ((null == user || hasReadAccess(user, obj)) && pathObj.getParents().contains(folder.getId())) {
+                if ((null == user || hasReadAccess(user, obj)) && pathObj.getParentIds().contains(folder.getId())) {
                     if (pathObj instanceof VersionedDocument) {
-                    	DocumentVersion ver;
-                    	if (usePwc) {
-                    		ver = ((VersionedDocument) pathObj).getPwc();
-                    		if (null == ver)
-                    			ver = ((VersionedDocument) pathObj).getLatestVersion(false);
-                    	} else {
-                    		ver = ((VersionedDocument) pathObj).getLatestVersion(false);
-                    	}
-                    	children.add(ver);
-                    } else if (pathObj instanceof DocumentVersion) {
-                        // ignore
-                    } else {
-                    	children.add(pathObj);
+                         DocumentVersion ver;
+                        if (usePwc) {
+                            ver = ((VersionedDocument) pathObj).getPwc();
+                            if (null == ver)
+                                ver = ((VersionedDocument) pathObj).getLatestVersion(false);
+                        } else {
+                            ver = ((VersionedDocument) pathObj).getLatestVersion(false);
+                        }
+                        children.add(ver);                        
+                    } else if (!(pathObj instanceof DocumentVersion)) { // ignore
+                                                                        // DocumentVersion
+                        children.add(pathObj);
                     }
                     
                 }
@@ -607,7 +654,7 @@ public class ObjectStoreImpl implements 
             StoredObject obj = getObject(id);
             if (hasReadAccess(user, obj) && obj instanceof Folder) {
                 Folder childFolder = (Folder) obj;
-                if (childFolder.getParents().contains(folder.getId()) ) {
+                if (childFolder.getParentIds().contains(folder.getId()) ) {
                     folderChildren.add(childFolder);
                 }
             }
@@ -627,11 +674,11 @@ public class ObjectStoreImpl implements 
         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.");
+                        + getFolderPath(newParent.getId()) + ". A child with this name already exists.");
             }
             lock();
-            if (so instanceof FilingMutable) {
-                FilingMutable fi = (FilingMutable) so;
+            if (so instanceof MultiFiling) {
+                MultiFiling fi = (MultiFiling) so;
                 addParentIntern(fi, newParent);
                 removeParentIntern(fi, oldParent);
             } else if (so instanceof FolderImpl) {
@@ -649,11 +696,11 @@ public class ObjectStoreImpl implements 
             if (so.getId().equals(fRootFolder.getId())) {
                 throw new CmisInvalidArgumentException("Root folder cannot be renamed.");
             }
-            for (String folderId : so.getParents()) {
+            for (String folderId : so.getParentIds()) {
                 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() + ".");
+                            + ". This path already exists in parent " + getFolderPath(folder.getId()) + ".");
             }
             so.setName(newName);
         } finally {
@@ -673,7 +720,7 @@ public class ObjectStoreImpl implements 
     @Override
     public List<String> getParentIds(Filing fileable, String user) {
         List<String> visibleParents = new ArrayList<String>(); 
-        List<String> parents = fileable.getParents();
+        List<String> parents = fileable.getParentIds();
         for (String id: parents) {
             StoredObject so = getObjectById(id);
             if (hasReadAccess(user, so)) {
@@ -787,7 +834,7 @@ public class ObjectStoreImpl implements 
     }
 
     private Acl applyAclRecursive(Folder folder, Acl addAces, Acl removeAces, String principalId) {
-        List<Fileable> children = getChildren(folder, -1, -1, ADMIN_PRINCIPAL_ID, true).getChildren();
+        List<Fileable> children = getChildren(folder, -1, -1, ADMIN_PRINCIPAL_ID, false).getChildren();
         Acl result = applyAcl(folder, addAces, removeAces);
 
         if (null == children) {
@@ -808,8 +855,7 @@ public class ObjectStoreImpl implements 
     }
 
     private Acl applyAclRecursive(Folder folder, Acl acl, String principalId) {
-        List<Fileable> children = getChildren(folder, -1, -1, ADMIN_PRINCIPAL_ID, true).getChildren();
-
+        List<Fileable> children = getChildren(folder, -1, -1, ADMIN_PRINCIPAL_ID, false).getChildren();
         Acl result = applyAcl(folder, acl);
 
         if (null == children) {
@@ -867,13 +913,13 @@ public class ObjectStoreImpl implements 
                 throw new IllegalArgumentException(
                         "Cannot assign new parent folder, this name already exists in target folder.");
             }
-            FilingMutable fi;
-            if (so instanceof FilingMutable) 
-                fi = (FilingMutable) so;
+            MultiFiling mfi;
+            if (so instanceof MultiFiling) 
+                mfi = (MultiFiling) so;
             else
                 throw new IllegalArgumentException("Object " + so.getId() + "is not fileable");
                 
-            addParentIntern(fi, parent);
+            addParentIntern(mfi, parent);
         } finally {
             unlock();
         }
@@ -883,23 +929,23 @@ public class ObjectStoreImpl implements 
     public void removeParent(StoredObject so, Folder parent) {
         try {
             lock();
-            FilingMutable fi;
-            if (so instanceof FilingMutable) 
-                fi = (FilingMutable) so;
+            MultiFiling mfi;
+            if (so instanceof MultiFiling) 
+                mfi = (MultiFiling) so;
             else
                 throw new IllegalArgumentException("Object " + so.getId() + "is not fileable");
 
-            removeParentIntern(fi, parent);
+            removeParentIntern(mfi, parent);
         } finally {
             unlock();
         }
     }
 
-    private void addParentIntern(FilingMutable so, Folder parent) {
+    private void addParentIntern(MultiFiling so, Folder parent) {
         so.addParentId(parent.getId());
     }
 
-    private void removeParentIntern(FilingMutable so, Folder parent) {
+    private void removeParentIntern(MultiFiling so, Folder parent) {
         so.removeParentId(parent.getId());
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/PolicyImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/PolicyImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/PolicyImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/PolicyImpl.java Thu Aug  8 08:40:26 2013
@@ -29,8 +29,8 @@ import org.apache.chemistry.opencmis.inm
 
 public class PolicyImpl extends StoredObjectImpl implements Policy {
 
-    PolicyImpl(ObjectStoreImpl objStore) {
-        super(objStore);
+    public PolicyImpl() {
+        super();
     }
 
     private String policyText;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/RelationshipImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/RelationshipImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/RelationshipImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/RelationshipImpl.java Thu Aug  8 08:40:26 2013
@@ -32,8 +32,8 @@ public class RelationshipImpl extends St
     private String sourceObjId;
     private String targetObjId;
 
-    RelationshipImpl(ObjectStoreImpl objStore) {
-        super(objStore);
+    public RelationshipImpl() {
+        super();
     }
 
     @Override

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java Thu Aug  8 08:40:26 2013
@@ -210,26 +210,11 @@ public class StoreManagerImpl implements
     @Override
 	public Collection<TypeDefinitionContainer> getTypeDefinitionList(String repositoryId,
             boolean includePropertyDefinitions) {
-//        Collection<TypeDefinitionContainer> result;
         TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
         if (null == typeManager) {
             throw new CmisInvalidArgumentException("Unknown repository " + repositoryId);
         }
         Collection<TypeDefinitionContainer> typeColl = getRootTypes(repositoryId, includePropertyDefinitions);
-//        if (includePropertyDefinitions) {
-//            result = typeColl;
-//        } else {
-//            result = new ArrayList<TypeDefinitionContainer>(typeColl.size());
-//            // copy list and omit properties
-//            for (TypeDefinitionContainer c : typeColl) {
-//                AbstractTypeDefinition td = ((AbstractTypeDefinition) c.getTypeDefinition()).clone();
-//                TypeDefinitionContainerImpl tdc = new TypeDefinitionContainerImpl(td);
-//                tdc.setChildren(c.getChildren());
-//                td.setPropertyDefinitions(null);
-//                result.add(tdc);
-//            }
-//        }
-//        return result;
         return typeColl;
     }
 
@@ -327,7 +312,7 @@ public class StoreManagerImpl implements
         }
     }
 
-    public List<TypeDefinition> initTypeSystem(String typeCreatorClassName) {
+    public static List<TypeDefinition> initTypeSystem(String typeCreatorClassName) {
 
         List<TypeDefinition> typesList = null;
 
@@ -374,7 +359,7 @@ public class StoreManagerImpl implements
             typeDefs = initTypeSystem(typeCreatorClassName);
         }
 
-        typeManager.initTypeSystem(typeDefs);
+        typeManager.initTypeSystem(typeDefs, true);
     }
 
     @SuppressWarnings("serial")
@@ -565,7 +550,7 @@ public class StoreManagerImpl implements
      *            parent container where to add clone as child
      * @return cloned type definition
      */
-    private static TypeDefinitionContainer cloneTypeList(int depth, boolean includePropertyDefinitions,
+    public static TypeDefinitionContainer cloneTypeList(int depth, boolean includePropertyDefinitions,
             TypeDefinitionContainer tdc, TypeDefinitionContainer parent) {
 
         AbstractTypeDefinition tdClone = ((AbstractTypeDefinition) tdc.getTypeDefinition()).clone();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java Thu Aug  8 08:40:26 2013
@@ -22,7 +22,6 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
@@ -34,26 +33,19 @@ import java.util.Map.Entry;
 import java.util.TimeZone;
 
 import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.chemistry.opencmis.commons.data.Acl;
 import org.apache.chemistry.opencmis.commons.data.AllowableActions;
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.ObjectList;
 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.enums.RelationshipDirection;
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
 import org.apache.chemistry.opencmis.inmemory.DataObjectCreator;
 import org.apache.chemistry.opencmis.inmemory.FilterParser;
-import org.apache.chemistry.opencmis.inmemory.server.InMemoryServiceContext;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoredObject;
-import org.apache.chemistry.opencmis.inmemory.types.PropertyCreationHelper;
 
 /**
  * StoredObject is the common superclass of all objects hold in the repository
  * Documents, Folders, Relationships and Policies
- *
+ * 
  * @author Jens
  */
 public class StoredObjectImpl implements StoredObject {
@@ -72,24 +64,22 @@ public class StoredObjectImpl implements
     protected GregorianCalendar fModifiedAt;
     protected String fRepositoryId;
     protected Map<String, PropertyData<?>> fProperties;
-    protected final ObjectStoreImpl fObjStore;
     protected int fAclId;
     protected String description; // CMIS 1.1
     protected List<String> secondaryTypeIds; // CMIS 1.1
     protected List<String> policyIds;
 
-    StoredObjectImpl(ObjectStoreImpl objStore) { // visibility should be package
+    StoredObjectImpl() { // visibility should be package
         GregorianCalendar now = getNow();
         now.setTime(new Date());
         fCreatedAt = now;
         fModifiedAt = now;
-        fObjStore = objStore;
         secondaryTypeIds = new ArrayList<String>();
         policyIds = null;
     }
 
     @Override
-	public String getId() {
+    public String getId() {
         return fId;
     }
 
@@ -97,64 +87,64 @@ public class StoredObjectImpl implements
     public void setId(String id) {
         fId = id;
     }
-    
+
     @Override
-	public String getName() {
+    public String getName() {
         return fName;
     }
 
     @Override
-	public void setName(String name) {
+    public void setName(String name) {
         fName = name;
     }
 
     @Override
-	public String getTypeId() {
+    public String getTypeId() {
         return fTypeId;
     }
 
     @Override
-	public void setTypeId(String type) {
+    public void setTypeId(String type) {
         fTypeId = type;
     }
 
     @Override
-	public String getCreatedBy() {
+    public String getCreatedBy() {
         return fCreatedBy;
     }
 
     @Override
-	public void setCreatedBy(String createdBy) {
+    public void setCreatedBy(String createdBy) {
         this.fCreatedBy = createdBy;
     }
 
     @Override
-	public String getModifiedBy() {
+    public String getModifiedBy() {
         return fModifiedBy;
     }
 
     @Override
-	public void setModifiedBy(String modifiedBy) {
+    public void setModifiedBy(String modifiedBy) {
         this.fModifiedBy = modifiedBy;
     }
 
     @Override
-	public GregorianCalendar getCreatedAt() {
+    public GregorianCalendar getCreatedAt() {
         return fCreatedAt;
     }
 
     @Override
-	public void setCreatedAt(GregorianCalendar createdAt) {
+    public void setCreatedAt(GregorianCalendar createdAt) {
         this.fCreatedAt = createdAt;
     }
 
     @Override
-	public GregorianCalendar getModifiedAt() {
+    public GregorianCalendar getModifiedAt() {
         return fModifiedAt;
     }
 
     @Override
-	public void setModifiedAtNow() {
+    public void setModifiedAtNow() {
         this.fModifiedAt = getNow();
     }
 
@@ -164,23 +154,23 @@ public class StoredObjectImpl implements
     }
 
     @Override
-	public void setRepositoryId(String repositoryId) {
+    public void setRepositoryId(String repositoryId) {
         fRepositoryId = repositoryId;
     }
 
     @Override
-	public String getRepositoryId() {
+    public String getRepositoryId() {
         return fRepositoryId;
     }
-    
+
     @Override
-	public List<String> getAppliedPolicies() {
+    public List<String> getAppliedPolicies() {
         if (null == policyIds)
             return null;
         else
             return Collections.unmodifiableList(policyIds);
     }
-    
+
     public void setAppliedPolicies(List<String> newPolicies) {
         if (null == newPolicies) {
             policyIds = null;
@@ -191,9 +181,9 @@ public class StoredObjectImpl implements
             policyIds.addAll(newPolicies);
         }
     }
-    
+
     @Override
-	public void addAppliedPolicy(String policyId) {
+    public void addAppliedPolicy(String policyId) {
         if (null == policyIds) {
             policyIds = new ArrayList<String>();
         }
@@ -203,7 +193,7 @@ public class StoredObjectImpl implements
     }
 
     @Override
-	public void removePolicy(String policyId) {
+    public void removePolicy(String policyId) {
         if (null != policyIds && policyIds.contains(policyId)) {
             policyIds.remove(policyId);
             if (policyIds.isEmpty()) {
@@ -211,55 +201,55 @@ public class StoredObjectImpl implements
             }
         }
     }
-    
+
     // CMIS 1.1:
     @Override
-	public void setDescription(String descr) {
+    public void setDescription(String descr) {
         description = descr;
     }
-    
+
     // CMIS 1.1:
     @Override
-	public String getDescription() {
+    public String getDescription() {
         return description;
     }
 
     @Override
-	public List<String> getSecondaryTypeIds() {
+    public List<String> getSecondaryTypeIds() {
         return Collections.unmodifiableList(secondaryTypeIds);
     }
 
     @Override
-	public void setProperties(Map<String, PropertyData<?>> props) {
+    public void setProperties(Map<String, PropertyData<?>> props) {
         fProperties = props;
     }
 
     @Override
-	public Map<String, PropertyData<?>> getProperties() {
+    public Map<String, PropertyData<?>> getProperties() {
         return fProperties;
     }
 
     @Override
-	public String getChangeToken() {
+    public String getChangeToken() {
         GregorianCalendar lastModified = getModifiedAt();
         String token = Long.valueOf(lastModified.getTimeInMillis()).toString();
         return token;
     }
 
     @Override
-	public void createSystemBasePropertiesWhenCreated(Map<String, PropertyData<?>> properties, String user) {
+    public void createSystemBasePropertiesWhenCreated(Map<String, PropertyData<?>> properties, String user) {
         addSystemBaseProperties(properties, user, true);
     }
 
     @Override
-	public void updateSystemBasePropertiesWhenModified(Map<String, PropertyData<?>> properties, String user) {
+    public void updateSystemBasePropertiesWhenModified(Map<String, PropertyData<?>> properties, String user) {
         addSystemBaseProperties(properties, user, false);
     }
 
     @Override
-	public void fillProperties(Map<String, PropertyData<?>> properties, BindingsObjectFactory objFactory,
+    public void fillProperties(Map<String, PropertyData<?>> properties, BindingsObjectFactory objFactory,
             List<String> requestedIds) {
-        
+
         if (FilterParser.isContainedInFilter(PropertyIds.NAME, requestedIds)) {
             properties.put(PropertyIds.NAME, objFactory.createPropertyStringData(PropertyIds.NAME, getName()));
         }
@@ -267,8 +257,8 @@ public class StoredObjectImpl implements
             properties.put(PropertyIds.OBJECT_ID, objFactory.createPropertyIdData(PropertyIds.OBJECT_ID, getId()));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.OBJECT_TYPE_ID, requestedIds)) {
-            properties.put(PropertyIds.OBJECT_TYPE_ID, objFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID,
-                    getTypeId()));
+            properties.put(PropertyIds.OBJECT_TYPE_ID,
+                    objFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, getTypeId()));
         }
         // set the base type id outside becaus it requires the type definition
         // if (FilterParser.isContainedInFilter(PropertyIds.CMIS_BASE_TYPE_ID,
@@ -277,36 +267,36 @@ public class StoredObjectImpl implements
         // CMIS_BASE_TYPE_ID, getBaseTypeId()));
         // }
         if (FilterParser.isContainedInFilter(PropertyIds.CREATED_BY, requestedIds)) {
-            properties.put(PropertyIds.CREATED_BY, objFactory.createPropertyStringData(PropertyIds.CREATED_BY,
-                    getCreatedBy()));
+            properties.put(PropertyIds.CREATED_BY,
+                    objFactory.createPropertyStringData(PropertyIds.CREATED_BY, getCreatedBy()));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.CREATION_DATE, requestedIds)) {
-            properties.put(PropertyIds.CREATION_DATE, objFactory.createPropertyDateTimeData(PropertyIds.CREATION_DATE,
-                    getCreatedAt()));
+            properties.put(PropertyIds.CREATION_DATE,
+                    objFactory.createPropertyDateTimeData(PropertyIds.CREATION_DATE, getCreatedAt()));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.LAST_MODIFIED_BY, requestedIds)) {
-            properties.put(PropertyIds.LAST_MODIFIED_BY, objFactory.createPropertyStringData(
-                    PropertyIds.LAST_MODIFIED_BY, getModifiedBy()));
+            properties.put(PropertyIds.LAST_MODIFIED_BY,
+                    objFactory.createPropertyStringData(PropertyIds.LAST_MODIFIED_BY, getModifiedBy()));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.LAST_MODIFICATION_DATE, requestedIds)) {
-            properties.put(PropertyIds.LAST_MODIFICATION_DATE, objFactory.createPropertyDateTimeData(
-                    PropertyIds.LAST_MODIFICATION_DATE, getModifiedAt()));
+            properties.put(PropertyIds.LAST_MODIFICATION_DATE,
+                    objFactory.createPropertyDateTimeData(PropertyIds.LAST_MODIFICATION_DATE, getModifiedAt()));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.CHANGE_TOKEN, requestedIds)) {
             String token = getChangeToken();
-            properties.put(PropertyIds.CHANGE_TOKEN, objFactory.createPropertyStringData(PropertyIds.CHANGE_TOKEN,
-                    token));
+            properties.put(PropertyIds.CHANGE_TOKEN,
+                    objFactory.createPropertyStringData(PropertyIds.CHANGE_TOKEN, token));
         }
-        
+
         // CMIS 1.1 properties:
         if (FilterParser.isContainedInFilter(PropertyIds.DESCRIPTION, requestedIds)) {
-            properties.put(PropertyIds.DESCRIPTION, objFactory.createPropertyStringData(PropertyIds.DESCRIPTION,
-                    description));
+            properties.put(PropertyIds.DESCRIPTION,
+                    objFactory.createPropertyStringData(PropertyIds.DESCRIPTION, description));
         }
         if (FilterParser.isContainedInFilter(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, requestedIds)) {
-            properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, objFactory.createPropertyIdData(PropertyIds.SECONDARY_OBJECT_TYPE_IDS,
-                    secondaryTypeIds));
-        }            
+            properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS,
+                    objFactory.createPropertyIdData(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypeIds));
+        }
 
         // add custom properties of type definition to the collection
         if (null != fProperties) {
@@ -316,14 +306,14 @@ public class StoredObjectImpl implements
                 }
             }
         }
-        
+
     }
 
     // ///////////////////////////////////////////
     // private helper methods
 
     @Override
-	public void setCustomProperties(Map<String, PropertyData<?>> properties) {
+    public void setCustomProperties(Map<String, PropertyData<?>> properties) {
         properties = new HashMap<String, PropertyData<?>>(properties); // get a
         // writable
         // collection
@@ -350,17 +340,17 @@ public class StoredObjectImpl implements
         // Note that initial creation and modification date is set in
         // constructor.
         setModifiedBy(user);
-		if (null != properties) {
-			if (null != properties.get(PropertyIds.DESCRIPTION))
-				setDescription((String) properties.get(PropertyIds.DESCRIPTION)
-						.getFirstValue());
-
-			if (null != properties.get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS)) {
-				secondaryTypeIds.clear();
-				secondaryTypeIds.addAll((List<String>) properties.get(
-						PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues());
-			}
-		}
+        if (null != properties) {
+           if (null != properties.get(PropertyIds.DESCRIPTION))
+               setDescription((String) properties.get(PropertyIds.DESCRIPTION)
+                       .getFirstValue());
+
+           if (null != properties.get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS)) {
+               secondaryTypeIds.clear();
+               secondaryTypeIds.addAll((List<String>) properties.get(
+                       PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues());
+           }
+       }
         if (isCreated) {
             setCreatedBy(user);
             setName((String) properties.get(PropertyIds.NAME).getFirstValue());
@@ -388,7 +378,7 @@ public class StoredObjectImpl implements
      * CMIS_NAME CMIS_OBJECT_ID CMIS_OBJECT_TYPE_ID CMIS_BASE_TYPE_ID
      * CMIS_CREATED_BY CMIS_CREATION_DATE CMIS_LAST_MODIFIED_BY
      * CMIS_LAST_MODIFICATION_DATE CMIS_CHANGE_TOKEN
-     *
+     * 
      * // ---- document ---- CMIS_IS_IMMUTABLE CMIS_IS_LATEST_VERSION
      * CMIS_IS_MAJOR_VERSION CMIS_IS_LATEST_MAJOR_VERSION CMIS_VERSION_LABEL
      * CMIS_VERSION_SERIES_ID CMIS_IS_VERSION_SERIES_CHECKED_OUT
@@ -396,12 +386,12 @@ public class StoredObjectImpl implements
      * CMIS_CHECKIN_COMMENT CMIS_CONTENT_STREAM_LENGTH
      * CMIS_CONTENT_STREAM_MIME_TYPE CMIS_CONTENT_STREAM_FILE_NAME
      * CMIS_CONTENT_STREAM_ID
-     *
+     * 
      * // ---- folder ---- CMIS_PARENT_ID CMIS_ALLOWED_CHILD_OBJECT_TYPE_IDS
      * CMIS_PATH
-     *
+     * 
      * // ---- relationship ---- CMIS_SOURCE_ID CMIS_TARGET_ID
-     *
+     * 
      * // ---- policy ---- CMIS_POLICY_TEXT
      */
     private static void removeAllSystemProperties(Map<String, PropertyData<?>> properties) {
@@ -500,89 +490,68 @@ public class StoredObjectImpl implements
     }
 
     @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);
-	}
-
-	public int getAclId() {
-	    return fAclId;
-	}
-	
-	public void setAclId(int aclId) {
-	    fAclId = aclId;
-	}
-	
-    @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 int getAclId() {
+        return fAclId;
+    }
+
+    public void setAclId(int aclId) {
+        fAclId = aclId;
+    }
+
+    @Override
+    public AllowableActions getAllowableActions(String user) {
+        AllowableActions actions = DataObjectCreator.fillAllowableActions(this, user);
+        return actions;
+    }
 
     @Override
-	public List<RenditionData> getRenditions(String renditionFilter, long maxItems, long skipCount) {
+    public List<RenditionData> getRenditions(String renditionFilter, long maxItems, long skipCount) {
         return null;
     }
 
     @Override
-	public ContentStream getRenditionContent(String streamId, long offset, long length) {
+    public ContentStream getRenditionContent(String streamId, long offset, long length) {
         return null;
     }
 
     @Override
-	public boolean hasRendition(String user) {
+    public boolean hasRendition(String user) {
         return false;
     }
-    
-    protected  ContentStream getIconFromResourceDir(String name) throws IOException {
-        
+
+    protected ContentStream getIconFromResourceDir(String name) throws IOException {
+
         InputStream imageStream = this.getClass().getResourceAsStream(name);
         ContentStreamDataImpl content = new ContentStreamDataImpl(0);
         content.setFileName(name);
         content.setMimeType("image/png");
 
         ByteArrayOutputStream ba = new ByteArrayOutputStream();
-        byte[] buffer = new byte [65536];
+        byte[] buffer = new byte[65536];
         int noBytesRead = 0;
 
-        while ((noBytesRead = imageStream.read(buffer)) >=0 ) {
+        while ((noBytesRead = imageStream.read(buffer)) >= 0) {
             ba.write(buffer, 0, noBytesRead);
         }
-        
+
         content.setContent(new ByteArrayInputStream(ba.toByteArray()));
         return content;
     }
-    
+
     protected boolean testRenditionFilterForImage(String[] formats) {
         if (formats.length == 1 && null != formats[0] && formats[0].equals("cmis:none"))
             return false;
         else
-            return arrayContainsString(formats, "*")  || arrayContainsString(formats, "image/*") 
-                || arrayContainsString(formats, "image/jpeg") ;
+            return arrayContainsString(formats, "*") || arrayContainsString(formats, "image/*")
+                    || arrayContainsString(formats, "image/jpeg");
     }
-    
+
     private boolean arrayContainsString(String[] formats, String val) {
         for (String s : formats) {
             if (val.equals(s))
-                return true;            
+                return true;
         }
         return false;
     }
 
-
-
-
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java?rev=1511617&r1=1511616&r2=1511617&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java Thu Aug  8 08:40:26 2013
@@ -40,8 +40,8 @@ public class VersionedDocumentImpl exten
     private String fCheckedOutUser;
     private final List<DocumentVersion> fVersions;
 
-    public VersionedDocumentImpl(ObjectStoreImpl objStore) {
-        super(objStore);
+    public VersionedDocumentImpl() {
+        super();
         fVersions = new ArrayList<DocumentVersion>();
         fIsCheckedOut = false;
     }
@@ -53,10 +53,9 @@ public class VersionedDocumentImpl exten
             throw new CmisConstraintException("Cannot add a version to document, document is checked out.");
         }
 
-        DocumentVersionImpl ver = new DocumentVersionImpl(fRepositoryId, this, content, verState, fObjStore);
+        DocumentVersionImpl ver = new DocumentVersionImpl(fRepositoryId, this, content, verState);
         ver.setSystemBasePropertiesWhenCreatedDirect(getName(), getTypeId(), user); // copy
         // name and type id from version series.
-        ver.persist();
         fVersions.add(ver);
         if (verState == VersioningState.CHECKEDOUT) {
             fCheckedOutUser = user;
@@ -161,6 +160,13 @@ public class VersionedDocumentImpl exten
         	} else {
         		latest = null;
         	}
+            if (null == getPwc()) {
+                latest = fVersions.get(fVersions.size() - 1);
+            } else if (fVersions.size() > 1) {
+                latest = fVersions.get(fVersions.size() - 2);
+            } else {
+                latest = null;
+            }
         }
         return latest;
     }
@@ -221,7 +227,6 @@ public class VersionedDocumentImpl exten
     }
 
     private void cancelCheckOut(boolean deleteInObjectStore) {
-
         DocumentVersion pwc = getPwc();
         fIsCheckedOut = false;
         fCheckedOutUser = null;
@@ -233,8 +238,6 @@ public class VersionedDocumentImpl exten
             }
         }
 
-        if (deleteInObjectStore)
-            fObjStore.removeVersion(pwc);
     }
 
 }



Mime
View raw message