chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r927770 - in /incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory: server/ storedobj/impl/ types/
Date Fri, 26 Mar 2010 11:14:54 GMT
Author: jens
Date: Fri Mar 26 11:14:53 2010
New Revision: 927770

URL: http://svn.apache.org/viewvc?rev=927770&view=rev
Log:
use CmisInvalidArgumentException for name syntax violations

Modified:
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/FolderImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryDocumentTypeDefinition.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryFolderTypeDefinition.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryPolicyTypeDefinition.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryRelationshipTypeDefinition.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/PropertyCreationHelper.java

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectServiceImpl.java?rev=927770&r1=927769&r2=927770&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
Fri Mar 26 11:14:53 2010
@@ -809,8 +809,7 @@ public class InMemoryObjectServiceImpl e
     }
 
     // check if the given type is a document type
-    if (!typeDef.getBaseId().equals(
-        InMemoryDocumentTypeDefinition.getRootDocumentType().getBaseId()))
+    if (!typeDef.getBaseId().equals(BaseObjectTypeIds.CMIS_DOCUMENT))
       throw new RuntimeException("Cannot create a document, with a non-document type: "
           + typeDef.getId());
 
@@ -880,7 +879,7 @@ public class InMemoryObjectServiceImpl e
     TypeDefinition typeDef = getTypeDefinition(repositoryId, properties);
 
     // check if the given type is a folder type
-    if (!typeDef.getBaseId().equals(InMemoryFolderTypeDefinition.getRootFolderType().getBaseId()))
+    if (!typeDef.getBaseId().equals(BaseObjectTypeIds.CMIS_FOLDER))
       throw new RuntimeException("Cannot create a folder, with a non-folder type: "
           + typeDef.getId());
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java?rev=927770&r1=927769&r2=927770&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/AbstractSingleFilingImpl.java
Fri Mar 26 11:14:53 2010
@@ -21,6 +21,8 @@ package org.apache.opencmis.inmemory.sto
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
+import org.apache.opencmis.commons.exceptions.CmisNameConstraintViolationException;
 import org.apache.opencmis.inmemory.NameValidator;
 import org.apache.opencmis.inmemory.storedobj.api.Document;
 import org.apache.opencmis.inmemory.storedobj.api.Folder;
@@ -93,11 +95,11 @@ public abstract class AbstractSingleFili
   
   public void rename(String newName) {
     if (!NameValidator.isValidId(newName))
-      throw new IllegalArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+      throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
     if (getParent() == null)
-      throw new IllegalArgumentException("Root folder cannot be renamed.");
+      throw new CmisInvalidArgumentException("Root folder cannot be renamed.");
     if (getParent().hasChild(newName))
-      throw new IllegalArgumentException("Cannot rename object to " + newName
+      throw new CmisNameConstraintViolationException("Cannot rename object to " + newName
           + ". This path already exists.");
 
     setName(newName);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/FolderImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/FolderImpl.java?rev=927770&r1=927769&r2=927770&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/FolderImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/FolderImpl.java
Fri Mar 26 11:14:53 2010
@@ -9,15 +9,16 @@ import java.util.Map;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.opencmis.commons.PropertyIds;
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.opencmis.commons.provider.PropertyData;
 import org.apache.opencmis.commons.provider.ProviderObjectFactory;
 import org.apache.opencmis.inmemory.FilterParser;
 import org.apache.opencmis.inmemory.NameValidator;
 import org.apache.opencmis.inmemory.storedobj.api.Document;
 import org.apache.opencmis.inmemory.storedobj.api.DocumentVersion;
+import org.apache.opencmis.inmemory.storedobj.api.Filing;
 import org.apache.opencmis.inmemory.storedobj.api.Folder;
 import org.apache.opencmis.inmemory.storedobj.api.MultiFiling;
-import org.apache.opencmis.inmemory.storedobj.api.Filing;
 import org.apache.opencmis.inmemory.storedobj.api.SingleFiling;
 import org.apache.opencmis.inmemory.storedobj.api.StoredObject;
 import org.apache.opencmis.inmemory.storedobj.api.VersionedDocument;
@@ -63,7 +64,7 @@ public class FolderImpl extends Abstract
   private void addChildObject(StoredObject so) {
     String name = so.getName();
     if (!NameValidator.isValidId(name))
-      throw new IllegalArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+      throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
 
     boolean hasChild;
     hasChild = hasChild(name);
@@ -182,7 +183,7 @@ public class FolderImpl extends Abstract
   // Helper functions
   private void init(String name, Folder parent) {
     if (!NameValidator.isValidId(name))
-      throw new IllegalArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+      throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
     setName(name);
     setParent(parent);
   }

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryDocumentTypeDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryDocumentTypeDefinition.java?rev=927770&r1=927769&r2=927770&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryDocumentTypeDefinition.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryDocumentTypeDefinition.java
Fri Mar 26 11:14:53 2010
@@ -25,6 +25,7 @@ import java.util.Map;
 import org.apache.opencmis.commons.api.PropertyDefinition;
 import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
 import org.apache.opencmis.commons.enums.ContentStreamAllowed;
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.opencmis.commons.impl.dataobjects.DocumentTypeDefinitionImpl;
 import org.apache.opencmis.inmemory.NameValidator;
 
@@ -84,7 +85,7 @@ public class InMemoryDocumentTypeDefinit
   
   private void init(String id, String displayName) {
     if (!NameValidator.isValidId(id))
-      throw new IllegalArgumentException(NameValidator.ERROR_ILLEGAL_ID);
+      throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_ID);
 
     setBaseId(BaseObjectTypeIds.CMIS_DOCUMENT);
     setId(id);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryFolderTypeDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryFolderTypeDefinition.java?rev=927770&r1=927769&r2=927770&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryFolderTypeDefinition.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryFolderTypeDefinition.java
Fri Mar 26 11:14:53 2010
@@ -24,6 +24,7 @@ import java.util.Map;
 
 import org.apache.opencmis.commons.api.PropertyDefinition;
 import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.opencmis.commons.impl.dataobjects.FolderTypeDefinitionImpl;
 import org.apache.opencmis.inmemory.NameValidator;
 
@@ -73,7 +74,7 @@ public class InMemoryFolderTypeDefinitio
 
   private void init(String id, String displayName) {
     if (!NameValidator.isValidId(id))
-        throw new IllegalArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+        throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
 
     setBaseId(BaseObjectTypeIds.CMIS_FOLDER);
     setId(id);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryPolicyTypeDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryPolicyTypeDefinition.java?rev=927770&r1=927769&r2=927770&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryPolicyTypeDefinition.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryPolicyTypeDefinition.java
Fri Mar 26 11:14:53 2010
@@ -24,6 +24,7 @@ import java.util.Map;
 
 import org.apache.opencmis.commons.api.PropertyDefinition;
 import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.opencmis.commons.impl.dataobjects.PolicyTypeDefinitionImpl;
 import org.apache.opencmis.inmemory.NameValidator;
 
@@ -73,7 +74,7 @@ public class InMemoryPolicyTypeDefinitio
 
   private void init(String id, String displayName) {
     if (!NameValidator.isValidId(id))
-      throw new IllegalArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+      throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
 
     setBaseId(BaseObjectTypeIds.CMIS_POLICY);
     setId(id);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryRelationshipTypeDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryRelationshipTypeDefinition.java?rev=927770&r1=927769&r2=927770&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryRelationshipTypeDefinition.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/InMemoryRelationshipTypeDefinition.java
Fri Mar 26 11:14:53 2010
@@ -24,6 +24,7 @@ import java.util.Map;
 
 import org.apache.opencmis.commons.api.PropertyDefinition;
 import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.opencmis.commons.impl.dataobjects.RelationshipTypeDefinitionImpl;
 import org.apache.opencmis.inmemory.NameValidator;
 
@@ -74,7 +75,7 @@ public class InMemoryRelationshipTypeDef
 
   private void init(String id, String displayName) {
     if (!NameValidator.isValidId(id))
-      throw new IllegalArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+      throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
 
     setBaseId(BaseObjectTypeIds.CMIS_RELATIONSHIP);
     setId(id);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/PropertyCreationHelper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/PropertyCreationHelper.java?rev=927770&r1=927769&r2=927770&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/PropertyCreationHelper.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/PropertyCreationHelper.java
Fri Mar 26 11:14:53 2010
@@ -35,6 +35,7 @@ import org.apache.opencmis.commons.enums
 import org.apache.opencmis.commons.enums.IncludeRelationships;
 import org.apache.opencmis.commons.enums.PropertyType;
 import org.apache.opencmis.commons.enums.Updatability;
+import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.opencmis.commons.impl.dataobjects.AbstractPropertyDefinition;
 import org.apache.opencmis.commons.impl.dataobjects.ChoiceImpl;
@@ -185,7 +186,7 @@ public class PropertyCreationHelper {
 
     if (!NameValidator.isValidId(id))
       if (!NameValidator.isValidId(id))
-        throw new IllegalArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
+        throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
 
     prop.setId(id);
     if (displayName == null)



Mime
View raw message