chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r921459 - in /incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider: cache/ cache/impl/ spi/atompub/
Date Wed, 10 Mar 2010 17:19:14 GMT
Author: fmui
Date: Wed Mar 10 17:19:13 2010
New Revision: 921459

URL: http://svn.apache.org/viewvc?rev=921459&view=rev
Log:
improved error messages on the provider level

Modified:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/cache/Cache.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/cache/impl/CacheImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AclServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/LinkCache.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/MultiFilingServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/NavigationServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/ObjectServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/PolicyServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RelationshipServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/cache/Cache.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/cache/Cache.java?rev=921459&r1=921458&r2=921459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/cache/Cache.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/cache/Cache.java
Wed Mar 10 17:19:13 2010
@@ -30,7 +30,8 @@ import java.io.Serializable;
  * <br/>
  * Level configuration string format: "
  * <code>&lt;class name&gt; [param1=value1,param2=value2,...]</code>".<br/>
- * For example: <code>org.apache.opencmis.client.provider.cache.impl.MapCacheLevelImpl
capacity=10</code><br/>
+ * For example:
+ * <code>org.apache.opencmis.client.provider.cache.impl.MapCacheLevelImpl capacity=10</code><br/>
  * </p>
  * 
  * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
@@ -58,7 +59,7 @@ public interface Cache extends Serializa
   void put(Object value, String... keys);
 
   /**
-   * Retrieves an object from the cache
+   * Retrieves an object from the cache.
    * 
    * @param keys
    *          the keys
@@ -73,4 +74,15 @@ public interface Cache extends Serializa
    *          the keys of the branch or leaf
    */
   void remove(String... keys);
+
+  /**
+   * Checks if a given key is in the cache.
+   * 
+   * @param keys
+   *          the keys of the branch or leaf
+   * 
+   * @return the index of the first key part that is not in the cache or <code>keys.length</code>
if
+   *         the object is in the cache
+   */
+  int check(String... keys);
 }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/cache/impl/CacheImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/cache/impl/CacheImpl.java?rev=921459&r1=921458&r2=921459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/cache/impl/CacheImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/cache/impl/CacheImpl.java
Wed Mar 10 17:19:13 2010
@@ -237,6 +237,34 @@ public class CacheImpl implements Cache 
     }
   }
 
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.cache.Cache#check(java.lang.String[])
+   */
+  public int check(String... keys) {
+    if (keys == null) {
+      return -1;
+    }
+
+    CacheLevel cacheLevel = fRoot;
+
+    // follow the branch
+    for (int i = 0; i < keys.length - 1; i++) {
+      Object level = cacheLevel.get(keys[i]);
+
+      // does the branch exist?
+      if (level == null) {
+        return i;
+      }
+
+      // next level
+      cacheLevel = (CacheLevel) level;
+    }
+
+    return keys.length;
+  }
+
   // ---- internal ----
 
   /**

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java?rev=921459&r1=921458&r2=921459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AbstractAtomPubService.java
Wed Mar 10 17:19:13 2010
@@ -189,6 +189,29 @@ public class AbstractAtomPubService {
   }
 
   /**
+   * Checks a link throw an appropriate exception.
+   */
+  protected void throwLinkException(String repositoryId, String id, String rel, String type)
{
+    int index = getLinkCache().checkLink(repositoryId, id, rel, type);
+
+    switch (index) {
+    case 0:
+      throw new CmisObjectNotFoundException("Unknown repository!");
+    case 1:
+      throw new CmisObjectNotFoundException("Unknown object!");
+    case 2:
+      throw new CmisNotSupportedException(
+          "Operation not supported by the repository for this object!");
+    case 3:
+      throw new CmisNotSupportedException("No link with matching media type!");
+    case 4:
+      throw new CmisRuntimeException("Nothing wrong! Either this is a bug or threading issue.");
+    default:
+      throw new CmisRuntimeException("Unknown error!");
+    }
+  }
+
+  /**
    * Gets a type link from the cache.
    */
   protected String getTypeLink(String repositoryId, String typeId, String rel, String type)
{
@@ -721,8 +744,7 @@ public class AbstractAtomPubService {
     String link = loadLink(repositoryId, objectId, Constants.REL_ACL, Constants.MEDIATYPE_ACL);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException(
-          "Unknown repository or object or ACLs are not supported!");
+      throwLinkException(repositoryId, objectId, Constants.REL_ACL, Constants.MEDIATYPE_ACL);
     }
 
     UrlBuilder aclUrl = new UrlBuilder(link);

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AclServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AclServiceImpl.java?rev=921459&r1=921458&r2=921459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AclServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/AclServiceImpl.java
Wed Mar 10 17:19:13 2010
@@ -24,7 +24,6 @@ import org.apache.opencmis.client.provid
 import org.apache.opencmis.client.provider.spi.atompub.objects.Acl;
 import org.apache.opencmis.commons.api.ExtensionsData;
 import org.apache.opencmis.commons.enums.AclPropagation;
-import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.opencmis.commons.impl.Constants;
 import org.apache.opencmis.commons.impl.UrlBuilder;
 import org.apache.opencmis.commons.provider.AccessControlList;
@@ -90,7 +89,7 @@ public class AclServiceImpl extends Abst
     String link = loadLink(repositoryId, objectId, Constants.REL_ACL, Constants.MEDIATYPE_ACL);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object or ACLs are not
support!");
+      throwLinkException(repositoryId, objectId, Constants.REL_ACL, Constants.MEDIATYPE_ACL);
     }
 
     UrlBuilder url = new UrlBuilder(link);

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/LinkCache.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/LinkCache.java?rev=921459&r1=921458&r2=921459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/LinkCache.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/LinkCache.java
Wed Mar 10 17:19:13 2010
@@ -137,6 +137,13 @@ public class LinkCache implements Serial
   }
 
   /**
+   * Checks a link.
+   */
+  public int checkLink(String repositoryId, String id, String rel, String type) {
+    return fLinkCache.check(repositoryId, id, rel, type);
+  }
+
+  /**
    * Adds a type link.
    */
   public void addTypeLink(String repositoryId, String id, String rel, String type, String
link) {

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/MultiFilingServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/MultiFilingServiceImpl.java?rev=921459&r1=921458&r2=921459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/MultiFilingServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/MultiFilingServiceImpl.java
Wed Mar 10 17:19:13 2010
@@ -60,7 +60,7 @@ public class MultiFilingServiceImpl exte
     String link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
     }
 
     UrlBuilder url = new UrlBuilder(link);

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/NavigationServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/NavigationServiceImpl.java?rev=921459&r1=921458&r2=921459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/NavigationServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/NavigationServiceImpl.java
Wed Mar 10 17:19:13 2010
@@ -83,7 +83,7 @@ public class NavigationServiceImpl exten
     String link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or folder!");
+      throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -166,7 +166,8 @@ public class NavigationServiceImpl exten
         Constants.MEDIATYPE_DESCENDANTS);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or folder!");
+      throwLinkException(repositoryId, folderId, Constants.REL_DOWN,
+          Constants.MEDIATYPE_DESCENDANTS);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -201,7 +202,7 @@ public class NavigationServiceImpl exten
     String link = loadLink(repositoryId, folderId, Constants.REL_UP, Constants.MEDIATYPE_ENTRY);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or folder!");
+      throwLinkException(repositoryId, folderId, Constants.REL_UP, Constants.MEDIATYPE_ENTRY);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -263,7 +264,8 @@ public class NavigationServiceImpl exten
         Constants.MEDIATYPE_DESCENDANTS);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or folder!");
+      throwLinkException(repositoryId, folderId, Constants.REL_FOLDERTREE,
+          Constants.MEDIATYPE_DESCENDANTS);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -301,7 +303,7 @@ public class NavigationServiceImpl exten
     String link = loadLink(repositoryId, objectId, Constants.REL_UP, Constants.MEDIATYPE_FEED);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or folder or object has no
parents!");
+      throwLinkException(repositoryId, objectId, Constants.REL_UP, Constants.MEDIATYPE_FEED);
     }
 
     UrlBuilder url = new UrlBuilder(link);

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/ObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/ObjectServiceImpl.java?rev=921459&r1=921458&r2=921459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/ObjectServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/ObjectServiceImpl.java
Wed Mar 10 17:19:13 2010
@@ -40,7 +40,6 @@ import org.apache.opencmis.commons.enums
 import org.apache.opencmis.commons.exceptions.CmisConnectionException;
 import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.opencmis.commons.exceptions.CmisNotSupportedException;
-import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.opencmis.commons.impl.Constants;
 import org.apache.opencmis.commons.impl.ReturnVersion;
 import org.apache.opencmis.commons.impl.UrlBuilder;
@@ -96,7 +95,7 @@ public class ObjectServiceImpl extends A
     String link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -170,7 +169,7 @@ public class ObjectServiceImpl extends A
     String link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -216,7 +215,7 @@ public class ObjectServiceImpl extends A
     String link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -274,7 +273,8 @@ public class ObjectServiceImpl extends A
         Constants.MEDIATYPE_FEED);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or source object!");
+      throwLinkException(repositoryId, sourceId, Constants.REL_RELATIONSHIPS,
+          Constants.MEDIATYPE_FEED);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -322,7 +322,8 @@ public class ObjectServiceImpl extends A
         Constants.MEDIATYPE_ENTRY);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, objectId.getValue(), Constants.REL_SELF,
+          Constants.MEDIATYPE_ENTRY);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -403,7 +404,7 @@ public class ObjectServiceImpl extends A
     String link = loadLink(repositoryId, objectId, Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, objectId, Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -427,7 +428,8 @@ public class ObjectServiceImpl extends A
         Constants.MEDIATYPE_DESCENDANTS);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or folder!");
+      throwLinkException(repositoryId, folderId, Constants.REL_DOWN,
+          Constants.MEDIATYPE_DESCENDANTS);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -461,7 +463,8 @@ public class ObjectServiceImpl extends A
         Constants.MEDIATYPE_ALLOWABLEACTION);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, objectId, Constants.REL_ALLOWABLEACTIONS,
+          Constants.MEDIATYPE_ALLOWABLEACTION);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -488,7 +491,7 @@ public class ObjectServiceImpl extends A
     String link = loadLink(repositoryId, objectId, AtomPubParser.LINK_REL_CONTENT, null);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, objectId, AtomPubParser.LINK_REL_CONTENT, null);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -604,7 +607,8 @@ public class ObjectServiceImpl extends A
         Constants.MEDIATYPE_CHILDREN);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, targetFolderId, Constants.REL_DOWN,
+          Constants.MEDIATYPE_CHILDREN);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -652,7 +656,7 @@ public class ObjectServiceImpl extends A
     String link = loadLink(repositoryId, objectId.getValue(), Constants.REL_EDITMEDIA, null);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, objectId.getValue(), Constants.REL_EDITMEDIA, null);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -709,7 +713,7 @@ public class ObjectServiceImpl extends A
     String link = loadLink(repositoryId, objectId.getValue(), Constants.REL_EDITMEDIA, null);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, objectId.getValue(), Constants.REL_EDITMEDIA, null);
     }
 
     UrlBuilder url = new UrlBuilder(link);

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/PolicyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/PolicyServiceImpl.java?rev=921459&r1=921458&r2=921459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/PolicyServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/PolicyServiceImpl.java
Wed Mar 10 17:19:13 2010
@@ -68,7 +68,7 @@ public class PolicyServiceImpl extends A
     String link = loadLink(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -98,7 +98,7 @@ public class PolicyServiceImpl extends A
     String link = loadLink(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -146,7 +146,7 @@ public class PolicyServiceImpl extends A
     String link = loadLink(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, objectId, Constants.REL_POLICIES, Constants.MEDIATYPE_FEED);
     }
 
     UrlBuilder url = new UrlBuilder(link);

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RelationshipServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RelationshipServiceImpl.java?rev=921459&r1=921458&r2=921459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RelationshipServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/RelationshipServiceImpl.java
Wed Mar 10 17:19:13 2010
@@ -30,7 +30,6 @@ import org.apache.opencmis.client.provid
 import org.apache.opencmis.client.provider.spi.atompub.objects.AtomLink;
 import org.apache.opencmis.commons.api.ExtensionsData;
 import org.apache.opencmis.commons.enums.RelationshipDirection;
-import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.opencmis.commons.impl.Constants;
 import org.apache.opencmis.commons.impl.UrlBuilder;
 import org.apache.opencmis.commons.impl.dataobjects.ObjectListImpl;
@@ -57,8 +56,9 @@ public class RelationshipServiceImpl ext
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.provider.RelationshipService#getObjectRelationships(java.lang.String,
-   * java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.RelationshipDirection,
+   * @see
+   * org.apache.opencmis.client.provider.RelationshipService#getObjectRelationships(java.lang.String
+   * , java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.RelationshipDirection,
    * java.lang.String, java.lang.String, java.lang.Boolean, java.math.BigInteger,
    * java.math.BigInteger, org.apache.opencmis.client.provider.ExtensionsData)
    */
@@ -73,7 +73,8 @@ public class RelationshipServiceImpl ext
         Constants.MEDIATYPE_FEED);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or source object!");
+      throwLinkException(repositoryId, objectId, Constants.REL_RELATIONSHIPS,
+          Constants.MEDIATYPE_FEED);
     }
 
     UrlBuilder url = new UrlBuilder(link);

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java?rev=921459&r1=921458&r2=921459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java
Wed Mar 10 17:19:13 2010
@@ -127,7 +127,7 @@ public class VersioningServiceImpl exten
     String link = loadLink(repositoryId, objectId, Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, objectId, Constants.REL_SELF, Constants.MEDIATYPE_ENTRY);
     }
 
     delete(new UrlBuilder(link));
@@ -138,9 +138,11 @@ public class VersioningServiceImpl exten
    * 
    * @see org.apache.opencmis.client.provider.VersioningService#checkIn(java.lang.String,
    * org.apache.opencmis.client.provider.Holder, java.lang.Boolean,
-   * org.apache.opencmis.client.provider.PropertiesData, org.apache.opencmis.client.provider.ContentStreamData,
-   * java.lang.String, java.util.List, org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.AccessControlList, org.apache.opencmis.client.provider.ExtensionsData)
+   * org.apache.opencmis.client.provider.PropertiesData,
+   * org.apache.opencmis.client.provider.ContentStreamData, java.lang.String, java.util.List,
+   * org.apache.opencmis.client.provider.AccessControlList,
+   * org.apache.opencmis.client.provider.AccessControlList,
+   * org.apache.opencmis.client.provider.ExtensionsData)
    */
   public void checkIn(String repositoryId, Holder<String> objectId, Boolean major,
       PropertiesData properties, ContentStreamData contentStream, String checkinComment,
@@ -156,7 +158,8 @@ public class VersioningServiceImpl exten
         Constants.MEDIATYPE_ENTRY);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or object!");
+      throwLinkException(repositoryId, objectId.getValue(), Constants.REL_SELF,
+          Constants.MEDIATYPE_ENTRY);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -169,10 +172,10 @@ public class VersioningServiceImpl exten
     object.setProperties(convert(properties));
     object.setPolicyIds(convertPolicyIds(policies));
 
-    if(object.getProperties() == null) {
+    if (object.getProperties() == null) {
       object.setProperties(new CmisPropertiesType());
     }
-    
+
     String mediaType = null;
     InputStream stream = null;
 
@@ -243,7 +246,8 @@ public class VersioningServiceImpl exten
         Constants.MEDIATYPE_FEED);
 
     if (link == null) {
-      throw new CmisObjectNotFoundException("Unknown repository or folder!");
+      throwLinkException(repositoryId, versionSeriesId, Constants.REL_VERSIONHISTORY,
+          Constants.MEDIATYPE_FEED);
     }
 
     UrlBuilder url = new UrlBuilder(link);
@@ -284,8 +288,9 @@ public class VersioningServiceImpl exten
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.provider.VersioningService#getObjectOfLatestVersion(java.lang.String,
-   * java.lang.String, java.lang.Boolean, java.lang.String, java.lang.Boolean,
+   * @see
+   * org.apache.opencmis.client.provider.VersioningService#getObjectOfLatestVersion(java.lang.String
+   * , java.lang.String, java.lang.Boolean, java.lang.String, java.lang.Boolean,
    * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
    * java.lang.Boolean, org.apache.opencmis.client.provider.ExtensionsData)
    */
@@ -308,8 +313,8 @@ public class VersioningServiceImpl exten
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.VersioningService#getPropertiesOfLatestVersion(java.lang.String,
-   * java.lang.String, java.lang.Boolean, java.lang.String,
+   * org.apache.opencmis.client.provider.VersioningService#getPropertiesOfLatestVersion(java.lang
+   * .String, java.lang.String, java.lang.Boolean, java.lang.String,
    * org.apache.opencmis.client.provider.ExtensionsData)
    */
   public PropertiesData getPropertiesOfLatestVersion(String repositoryId, String versionSeriesId,



Mime
View raw message