You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fg...@apache.org on 2009/11/22 00:06:20 UTC
svn commit: r883013 - in /incubator/chemistry/trunk/chemistry:
chemistry-api/src/main/java/org/apache/chemistry/
chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/
chemistry-atompub-server/src/test/java/org/apache/chemistry/ato...
Author: fguillaume
Date: Sat Nov 21 23:06:15 2009
New Revision: 883013
URL: http://svn.apache.org/viewvc?rev=883013&view=rev
Log:
CMIS-42: added exception management
Added:
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISException.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISRuntimeException.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ConstraintViolationException.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ContentAlreadyExistsException.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/FilterNotValidException.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/NameConstraintViolationException.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ObjectNotFoundException.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/PermissionDeniedException.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StorageException.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StreamNotSupportedException.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/UpdateConflictException.java (with props)
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/VersioningException.java (with props)
Modified:
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISObject.java
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Document.java
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Folder.java
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/TypeManager.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleFolder.java
incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java
incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/impl/simple/TestSimpleRepository.java
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java
incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The base class for CMIS checked exceptions.
+ */
+public class CMISException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public CMISException() {
+ super();
+ }
+
+ public CMISException(String message) {
+ super(message);
+ }
+
+ public CMISException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CMISException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISException.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISObject.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISObject.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISObject.java Sat Nov 21 23:06:15 2009
@@ -56,8 +56,19 @@
*
* @param targetFolder the target folder
* @param sourceFolder the source folder, or {@code null}
+ *
+ * @throws IllegalArgumentException if sourceFolder is not a parent of the
+ * object
+ * @throws ConstraintViolationException if the object's type isn't allowed
+ * as a child object type in targetFolder
+ * @throws NameConstraintViolationException if the object name is not legal
+ * in its new parent folder
+ * @throws UpdateConflictException if the object is no longer current
+ * @throws VersioningException if the move cannot be done to a non-latest
+ * version
*/
- void move(Folder targetFolder, Folder sourceFolder);
+ void move(Folder targetFolder, Folder sourceFolder)
+ throws NameConstraintViolationException, UpdateConflictException;
/**
* Deletes this object.
@@ -70,8 +81,11 @@
* <p>
* Deletion of a private working copy (checked out version) is the same as
* to cancel checkout.
+ *
+ * @throws ConstraintViolationException if the object is a non-empty folder
+ * @throws UpdateConflictException if the object is no longer current
*/
- void delete();
+ void delete() throws UpdateConflictException;
/**
* Unfiles this non-folder object.
@@ -99,20 +113,20 @@
* parent (for the root folder).
* <p>
* For a non-folder, if the object is single-filed then the folder in which
- * it is filed is returned, otherwise if the folder is unfiled then {@code
- * null} is returned. An exception is raised if the object is multi-filed,
- * so in doubt use {@link #getParents}.
+ * it is filed is returned, otherwise if the object is unfiled or not
+ * fileable then {@code null} is returned. An exception is raised if the
+ * object is multi-filed, so in doubt use {@link #getParents}.
*
* @return the parent folder, or {@code null}.
*
+ * @throws ConstraintViolationException if the object is multi-filed
+ *
* @see #getParents
*/
Folder getParent();
/**
* Gets the direct parents of this object.
- * <p>
- * The object must be a non-folder, fileable object.
*
* @return the collection of parent folders
*
@@ -154,6 +168,8 @@
* The object must be controllable.
*
* @param policy the policy
+ *
+ * @throws ConstraintViolationException if the object is not controllable
*/
void applyPolicy(Policy policy);
@@ -166,6 +182,8 @@
* The object must be controllable.
*
* @param policy the policy
+ *
+ * @throws ConstraintViolationException if the object is not controllable
*/
void removePolicy(Policy policy);
@@ -227,8 +245,17 @@
*
* @param id the property ID
* @param value the property value, or {@code null}
+ *
+ * @throws ConstraintViolationException if the value is not legal, for
+ * instance if a min/max/required/length constraint is violated
+ * @throws NameConstraintViolationException if the name is set and is not
+ * legal
+ * @throws UpdateConflictException if the object is no longer current
+ * @throws VersioningException if the update cannot be applied to a
+ * non-latest version
*/
- void setValue(String id, Serializable value);
+ void setValue(String id, Serializable value)
+ throws NameConstraintViolationException, UpdateConflictException;
/**
* Sets several property values.
@@ -239,15 +266,27 @@
* see {@link #save()}.
*
* @param values the property values
+ *
+ * @throws ConstraintViolationException if the values are not legal, for
+ * instance if any of the value violates the
+ * min/max/required/length constraints specified in the relevant
+ * property definition
+ * @throws NameConstraintViolationException if the name is set and is not
+ * legal
+ * @throws UpdateConflictException if the object is no longer current
+ * @throws VersioningException if the update cannot be applied to a
+ * non-latest version
*/
- void setValues(Map<String, Serializable> values);
+ void setValues(Map<String, Serializable> values)
+ throws NameConstraintViolationException, UpdateConflictException;
/**
* Gets a content stream for this document.
*
* @param contentStreamId the content stream ID, or {@code null} for the
* primary content stream
- * @return the content stream
+ * @return the content stream, or {@code null} if the object does not have a
+ * content stream or rendition stream
*
* @throws IOException
*/
@@ -263,8 +302,19 @@
* <p>
* Calling {#link #save} is needed for objects newly created through
* {@link Connection#newDocument} and similar methods.
+ *
+ * @throws ConstraintViolationException if the saved values are not legal,
+ * for instance if any of the value violates the
+ * min/max/required/length constraints specified in the relevant
+ * property definition
+ * @throws NameConstraintViolationException if the name is set and is not
+ * legal
+ * @throws UpdateConflictException if the object is no longer current
+ * @throws VersioningException if the update cannot be applied to a
+ * non-latest version
*/
- void save();
+ void save() throws NameConstraintViolationException,
+ UpdateConflictException;
/*
* ----- convenience methods -----
@@ -350,6 +400,11 @@
* ----- convenience methods for specific properties (setter) -----
*/
- void setName(String value);
+ /**
+ * Sets the name.
+ *
+ * @throws NameConstraintViolationException if the name is not legal
+ */
+ void setName(String value) throws NameConstraintViolationException;
}
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISRuntimeException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISRuntimeException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISRuntimeException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISRuntimeException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The base class for CMIS unchecked exceptions.
+ */
+public class CMISRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public CMISRuntimeException() {
+ super();
+ }
+
+ public CMISRuntimeException(String message) {
+ super(message);
+ }
+
+ public CMISRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CMISRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISRuntimeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISRuntimeException.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ConstraintViolationException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ConstraintViolationException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ConstraintViolationException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ConstraintViolationException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The operation violates a repository- or object-level constraint defined in
+ * the CMIS domain model.
+ */
+public class ConstraintViolationException extends CMISRuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public ConstraintViolationException() {
+ super();
+ }
+
+ public ConstraintViolationException(String message) {
+ super(message);
+ }
+
+ public ConstraintViolationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ConstraintViolationException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ConstraintViolationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ConstraintViolationException.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ContentAlreadyExistsException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ContentAlreadyExistsException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ContentAlreadyExistsException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ContentAlreadyExistsException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The operation attempts to set the content stream for a {@link Document} that
+ * already has a content stream without explicitly specifying the {@code
+ * overwrite} parameter.
+ */
+public class ContentAlreadyExistsException extends CMISException {
+
+ private static final long serialVersionUID = 1L;
+
+ public ContentAlreadyExistsException() {
+ super();
+ }
+
+ public ContentAlreadyExistsException(String message) {
+ super(message);
+ }
+
+ public ContentAlreadyExistsException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContentAlreadyExistsException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ContentAlreadyExistsException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ContentAlreadyExistsException.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Document.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Document.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Document.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Document.java Sat Nov 21 23:06:15 2009
@@ -49,8 +49,13 @@
* check-out or not is repository-specific.
*
* @return the private working copy
+ *
+ * @throws ConstraintViolationException if the document is not versionable
+ * @throws UpdateConflictException if the document is no longer current
+ * @throws VersioningException if the checkout cannot be applied to a
+ * non-latest version
*/
- Document checkOut();
+ Document checkOut() throws UpdateConflictException;
/**
* Cancels a check-out of a private working copy.
@@ -58,8 +63,13 @@
* Reverses the effect of a check-out. Removes the private working copy of
* the checked-out document, allowing other documents in the version series
* of this document to be checked out again.
+ *
+ * @throws ConstraintViolationException if the document is not versionable
+ * @throws UpdateConflictException if the document is no longer current
+ * @throws VersioningException if the checkout cannot be applied to a
+ * non-latest version
*/
- void cancelCheckOut();
+ void cancelCheckOut() throws UpdateConflictException;
/**
* Checks in a private working copy.
@@ -69,8 +79,14 @@
* @param major {@code true} if the version is a major version
* @param comment a check-in comment, or {@code null}
* @return the the new version of the document
+ *
+ * @throws ConstraintViolationException if the document is not versionable
+ * @throws StreamNotSupportedException if a content stream is being set but
+ * is not supported on the document
+ * @throws UpdateConflictException if the document is no longer current
*/
- Document checkIn(boolean major, String comment);
+ Document checkIn(boolean major, String comment)
+ throws UpdateConflictException;
/**
* Gets the latest version of this document.
@@ -81,6 +97,9 @@
* @param major {@code true} if the latest major version is requested
* @return the latest version or latest major version, or {@code null} if
* not found
+ *
+ * @throws ObjectNotFoundException if <em>major</em> is {@code true} and the
+ * version series contains no major version
*/
Document getLatestVersion(boolean major);
@@ -99,9 +118,12 @@
/**
* Deletes all the versions of this document.
* <p>
- * Deletes all document versions in the version series of this document.
+ * Deletes all document versions in the version series of this document,
+ * including the private working copy if it exists.
+ *
+ * @throws UpdateConflictException if the object is no longer current
*/
- void deleteAllVersions();
+ void deleteAllVersions() throws UpdateConflictException;
/*
* ----- data access -----
@@ -110,7 +132,10 @@
/**
* Gets the primary content stream for this document.
*
- * @return the content stream
+ * @return the content stream, or {@code null} if the document does not have
+ * a content stream
+ *
+ * @throws IOException if the stream could not be read
*/
ContentStream getContentStream() throws IOException;
@@ -118,8 +143,15 @@
* Sets the primary content stream for this document.
*
* @param contentStream
- * @throws IOException if the stream could not be read
+ *
+ * @throws IOException if the stream could not be written
+ * @throws StreamNotSupportedException if a content stream is not allowed on
+ * the document
+ * @throws UpdateConflictException if the document is no longer current
+ * @throws VersioningException if the update cannot be applied to a
+ * non-latest version
*/
- void setContentStream(ContentStream contentStream) throws IOException;
+ void setContentStream(ContentStream contentStream) throws IOException,
+ UpdateConflictException;
}
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/FilterNotValidException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/FilterNotValidException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/FilterNotValidException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/FilterNotValidException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The property filter or rendition filter is not valid.
+ */
+public class FilterNotValidException extends IllegalArgumentException {
+
+ private static final long serialVersionUID = 1L;
+
+ public FilterNotValidException() {
+ super();
+ }
+
+ public FilterNotValidException(String message) {
+ super(message);
+ }
+
+ public FilterNotValidException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public FilterNotValidException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/FilterNotValidException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/FilterNotValidException.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Folder.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Folder.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Folder.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Folder.java Sat Nov 21 23:06:15 2009
@@ -32,6 +32,9 @@
* Adds an existing non-folder, fileable object to this folder.
*
* @param object the object
+ *
+ * @throws ConstraintViolationException if the object's type isn't allowed
+ * as a child object type in the folder
*/
void add(CMISObject object);
@@ -46,6 +49,9 @@
*
* @see CMISObject#delete
* @see CMISObject#unfile
+ *
+ * @throws ConstraintViolationException if removing the object would delete
+ * it
*/
void remove(CMISObject object);
@@ -80,8 +86,11 @@
* @param unfiling how to unfile non-folder objects, if {@code null} then
* same as {@link Unfiling#DELETE}
* @return the collection of IDs of objects that could not be deleted
+ *
+ * @throws UpdateConflictException if the folder is no longer current
*/
- Collection<ObjectId> deleteTree(Unfiling unfiling);
+ Collection<ObjectId> deleteTree(Unfiling unfiling)
+ throws UpdateConflictException;
/*
* ----- Navigation Services -----
@@ -90,7 +99,7 @@
/**
* Gets the direct children of this folder.
* <p>
- * The order of returned children is implementation-dependant.
+ * The order of returned children is implementation-dependent.
*
* @return the list of children
*/
@@ -104,11 +113,17 @@
/**
* Creates a new, unsaved document as a child of this folder.
+ *
+ * @throws ConstraintViolationException if the type isn't allowed as a child
+ * object type in the folder
*/
Document newDocument(String typeId);
/**
* Creates a new, unsaved folder as a child of this folder.
+ *
+ * @throws ConstraintViolationException if the type isn't allowed as a child
+ * object type in the folder
*/
Folder newFolder(String typeId);
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/NameConstraintViolationException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/NameConstraintViolationException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/NameConstraintViolationException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/NameConstraintViolationException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The repository is not able to store the object that the user is
+ * creating/updating due to a name constraint violation.
+ */
+public class NameConstraintViolationException extends CMISException {
+
+ private static final long serialVersionUID = 1L;
+
+ public NameConstraintViolationException() {
+ super();
+ }
+
+ public NameConstraintViolationException(String message) {
+ super(message);
+ }
+
+ public NameConstraintViolationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NameConstraintViolationException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/NameConstraintViolationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/NameConstraintViolationException.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ObjectNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ObjectNotFoundException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ObjectNotFoundException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ObjectNotFoundException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The call has specified an object that does not exist in the repository.
+ */
+public class ObjectNotFoundException extends CMISRuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public ObjectNotFoundException() {
+ super();
+ }
+
+ public ObjectNotFoundException(String message) {
+ super(message);
+ }
+
+ public ObjectNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ObjectNotFoundException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ObjectNotFoundException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/ObjectNotFoundException.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/PermissionDeniedException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/PermissionDeniedException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/PermissionDeniedException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/PermissionDeniedException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The caller does not have sufficient permissions to perform the operation.
+ */
+public class PermissionDeniedException extends CMISRuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public PermissionDeniedException() {
+ super();
+ }
+
+ public PermissionDeniedException(String message) {
+ super(message);
+ }
+
+ public PermissionDeniedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public PermissionDeniedException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/PermissionDeniedException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/PermissionDeniedException.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java Sat Nov 21 23:06:15 2009
@@ -74,6 +74,10 @@
* @param depth the depth, or {@code -1} for all levels
* @param filter the properties filter, or {@code null} for all properties
* @param includeAllowableActions {@code true} to include allowable actions
+ *
+ * @throws FilterNotValidException if the filter is not valid
+ * @throws IllegalArgumentException if the object is not a folder or the
+ * depth is invalid
*/
List<ObjectEntry> getFolderTree(ObjectId folder, int depth, String filter,
boolean includeAllowableActions);
@@ -114,6 +118,10 @@
* @param includeRenditions {@code true} if renditions should be included as
* well
* @param orderBy an {@code ORDER BY} clause, or {@code null}
+ *
+ * @throws FilterNotValidException if the filter is not valid
+ * @throws IllegalArgumentException if the object is not a folder or the
+ * depth is invalid
*/
// TODO return type for a tree
List<ObjectEntry> getDescendants(ObjectId folder, int depth, String filter,
@@ -151,6 +159,9 @@
* @param orderBy an {@code ORDER BY} clause, or {@code null}
* @param paging paging information, or {@code null} for a
* repository-specific default
+ *
+ * @throws FilterNotValidException if the filter is not valid
+ * @throws IllegalArgumentException if the object is not a folder
*/
ListPage<ObjectEntry> getChildren(ObjectId folder, String filter,
boolean includeAllowableActions, boolean includeRelationships,
@@ -166,6 +177,10 @@
* @param folder the folder
* @param filter the properties filter, or {@code null} for all properties
* @return the parents and optionally relationships
+ *
+ * @throws FilterNotValidException if the filter is not valid
+ * @throws IllegalArgumentException if the folder is not a folder or is the
+ * root
*/
ObjectEntry getFolderParent(ObjectId folder, String filter);
@@ -179,6 +194,10 @@
* @param object the object
* @param filter the properties filter, or {@code null} for all properties
* @return the collection of parent folders
+ *
+ * @throws ConstraintViolationException if the object is not fileable
+ * @throws FilterNotValidException if the filter is not valid
+ * @throws IllegalArgumentException if the object is a folder
*/
Collection<ObjectEntry> getObjectParents(ObjectId object, String filter);
@@ -200,6 +219,9 @@
* included as well
* @param paging paging information, or {@code null} for a
* repository-specific default
+ *
+ * @throws FilterNotValidException if the filter is not valid
+ * @throws IllegalArgumentException if the object is not a folder
*/
ListPage<ObjectEntry> getCheckedOutDocuments(ObjectId folder,
String filter, boolean includeAllowableActions,
@@ -225,29 +247,41 @@
* @param folder the containing folder, or {@code null}
* @param contentStream the content stream, or {@code null}
* @param versioningState the versioning state
- *
* @return the ID of the created document
+ *
+ * @throws ConstraintViolationException if the properties are not legal
+ * @throws StreamNotSupportedException if <em>contentStream</em> is not
+ * {@code null} and a content stream is not supported on the
+ * document
+ * @throws NameConstraintViolationException if the name is not legal
*/
ObjectId createDocument(Map<String, Serializable> properties,
ObjectId folder, ContentStream contentStream,
- VersioningState versioningState);
+ VersioningState versioningState)
+ throws NameConstraintViolationException;
+
+ // TODO 1.0 createDocumentFromSource
/**
* Creates a folder.
*
* @param properties the properties
* @param folder the containing folder
- *
* @return the ID of the created folder
+ *
+ * @throws ConstraintViolationException if the properties are not legal
+ * @throws NameConstraintViolationException if the name is not legal
*/
- ObjectId createFolder(Map<String, Serializable> properties, ObjectId folder);
+ ObjectId createFolder(Map<String, Serializable> properties, ObjectId folder)
+ throws NameConstraintViolationException;
/**
* Creates a relationship.
*
* @param properties the properties
- *
* @return the ID of the created relationship
+ *
+ * @throws ConstraintViolationException if the properties are not legal
*/
ObjectId createRelationship(Map<String, Serializable> properties);
@@ -259,8 +293,9 @@
*
* @param properties the properties
* @param folder the containing folder, or {@code null}
- *
* @return the ID of the created policy
+ *
+ * @throws ConstraintViolationException if the properties are not legal
*/
ObjectId createPolicy(Map<String, Serializable> properties, ObjectId folder);
@@ -276,6 +311,8 @@
*/
Collection<QName> getAllowableActions(ObjectId object);
+ // TODO 1.0 getObject
+
/**
* Gets the properties of an object.
* <p>
@@ -296,6 +333,8 @@
* included as well
* @return the properties of the object, or {@code null} if the object is
* not found
+ *
+ * @throws FilterNotValidException if the filter is not valid
*/
ObjectEntry getProperties(ObjectId object, String filter,
boolean includeAllowableActions, boolean includeRelationships);
@@ -310,6 +349,8 @@
* included as well
* @return the properties of the object, or {@code null} if the object is
* not found
+ *
+ * @throws FilterNotValidException if the filter is not valid
*/
ObjectEntry getObjectByPath(String path, String filter,
boolean includeAllowableActions, boolean includeRelationships);
@@ -355,11 +396,15 @@
* @param contentStreamId the content stream ID, or {@code null}
* @return the content stream
*
+ * @throws ConstraintViolationException if the object does not have a
+ * content stream or rendition stream
* @throws IOException
*/
ContentStream getContentStream(ObjectId object, String contentStreamId)
throws IOException;
+ // TODO 1.0 getRenditions
+
/**
* Sets the content stream for a document.
* <p>
@@ -379,10 +424,20 @@
* @param contentStream the content stream to set
* @return the resulting document, which may differ from the one passed as
* input
+ *
+ * @throws StreamNotSupportedException if a content stream is not allowed on
+ * the document
+ * @throws ContentAlreadyExistsException if the document already has a
+ * content stream and {@code overwrite} is {@code false}
+ * @throws UpdateConflictException if the document is no longer current
+ * @throws VersioningException if the update cannot be applied to a
+ * non-latest version
+ * @throws IOException
*/
// TODO return ObjectId or ObjectEntry?
ObjectId setContentStream(ObjectId document, boolean overwrite,
- ContentStream contentStream);
+ ContentStream contentStream) throws IOException,
+ ContentAlreadyExistsException, UpdateConflictException;
/**
* Deletes the content stream for a document.
@@ -399,8 +454,15 @@
* @param document the document
* @return the resulting document, which may differ from the one passed as
* input
+ *
+ * @throws ConstraintViolationException if a content stream is required on
+ * the document
+ * @throws UpdateConflictException if the document is no longer current
+ * @throws VersioningException if the update cannot be applied to a
+ * non-latest version
*/
- ObjectId deleteContentStream(ObjectId document);
+ ObjectId deleteContentStream(ObjectId document)
+ throws UpdateConflictException;
/**
* Updates the properties of an object.
@@ -424,10 +486,20 @@
* @param properties the properties to change
* @return the resulting object, which may differ from the one passed as
* input
+ *
+ * @throws ConstraintViolationException if the properties are not legal, for
+ * instance if any of the property violates the
+ * min/max/required/length constraints specified in the relevant
+ * property definition
+ * @throws NameConstraintViolationException if the name is not legal
+ * @throws UpdateConflictException if the object is no longer current
+ * @throws VersioningException if the update cannot be applied to a
+ * non-latest version
*/
// TODO return ObjectId or ObjectEntry?
ObjectId updateProperties(ObjectId object, String changeToken,
- Map<String, Serializable> properties);
+ Map<String, Serializable> properties)
+ throws NameConstraintViolationException, UpdateConflictException;
/**
* Moves the specified filed object from one folder to another.
@@ -441,9 +513,20 @@
* @param sourceFolder the source folder, or {@code null}
* @return the resulting object, which may differ from the one passed as
* input
+ *
+ * @throws IllegalArgumentException if sourceFolder is not a parent of the
+ * object
+ * @throws ConstraintViolationException if the object's type isn't allowed
+ * as a child object type in the targetFolder
+ * @throws NameConstraintViolationException if the object name is not legal
+ * in its new parent folder
+ * @throws UpdateConflictException if the object is no longer current
+ * @throws VersioningException if the move cannot be done to a non-latest
+ * version
*/
ObjectId moveObject(ObjectId object, ObjectId targetFolder,
- ObjectId sourceFolder);
+ ObjectId sourceFolder) throws NameConstraintViolationException,
+ UpdateConflictException;
/**
* Deletes the specified object.
@@ -456,12 +539,16 @@
* series is deleted.
* <p>
* Deletion of a private working copy (checked out version) is the same as
- * the cancelling of a checkout.
+ * the canceling of a checkout.
*
* @param object the object to delete
* @param allVersions if {@code true}, then delete all versions as well
+ *
+ * @throws ConstraintViolationException if the object is a non-empty folder
+ * @throws UpdateConflictException if the object is no longer current
*/
- void deleteObject(ObjectId object, boolean allVersions);
+ void deleteObject(ObjectId object, boolean allVersions)
+ throws UpdateConflictException;
/**
* Deletes a tree of objects.
@@ -500,15 +587,25 @@
* @param continueOnFailure {@code true} if failure to delete one object
* should not stop deletion of other objects
* @return the collection of IDs of objects that could not be deleted
+ *
+ * @throws UpdateConflictException if the object is no longer current
*/
Collection<ObjectId> deleteTree(ObjectId folder, Unfiling unfiling,
- boolean continueOnFailure);
+ boolean continueOnFailure) throws UpdateConflictException;
+
+ /*
+ * ----- Multi-Filing Services -----
+ */
/**
* Adds an existing non-folder, fileable object to a folder.
*
* @param object the object
* @param folder the folder
+ * @param allVersions TODO
+ *
+ * @throws ConstraintViolationException if the object's type isn't allowed
+ * as a child object type in the folder
*/
void addObjectToFolder(ObjectId object, ObjectId folder);
@@ -524,6 +621,9 @@
*
* @param object the object
* @param folder the folder, or {@code null} for all folders
+ *
+ * @throws ConstraintViolationException if removing the object would delete
+ * it
*/
void removeObjectFromFolder(ObjectId object, ObjectId folder);
@@ -568,6 +668,8 @@
* @param paging paging information, or {@code null} for a
* repository-specific default
* @return the matching objects
+ *
+ * @throws IllegalArgumentException if the statement is invalid
*/
// TODO returns a result set actually, there may be computed values
ListPage<ObjectEntry> query(String statement, boolean searchAllVersions,
@@ -598,9 +700,14 @@
* repository-specific default
* @return a paged list of change events
*
+ * @throws ConstraintViolationException if the event corresponding to
+ * {@code changeLogToken} is no longer available in the change
+ * log
+ *
* @see Repository#getInfo
* @see RepositoryInfo#getLatestChangeLogToken
*/
+ // TODO 1.0 rename to getContentChanges
ListPage<ObjectEntry> getChangeLog(String changeLogToken,
boolean includeProperties, Paging paging,
String[] latestChangeLogToken);
@@ -632,8 +739,14 @@
* @param document the document
* @param contentCopied a return array of size 1
* @return a reference to the private working copy
+ *
+ * @throws ConstraintViolationException if the document is not versionable
+ * @throws UpdateConflictException if the object is no longer current
+ * @throws VersioningException if the checkout cannot be applied to a
+ * non-latest version
*/
- ObjectId checkOut(ObjectId document, boolean[] contentCopied);
+ ObjectId checkOut(ObjectId document, boolean[] contentCopied)
+ throws UpdateConflictException;
/**
* Cancels a check-out.
@@ -643,8 +756,13 @@
* to be checked out again.
*
* @param document the private working copy
+ *
+ * @throws ConstraintViolationException if the document is not versionable
+ * @throws UpdateConflictException if the object is no longer current
+ * @throws VersioningException if the checkout cannot be applied to a
+ * non-latest version
*/
- void cancelCheckOut(ObjectId document);
+ void cancelCheckOut(ObjectId document) throws UpdateConflictException;
/**
* Checks in a private working copy.
@@ -658,10 +776,18 @@
* {@code null}
* @param comment a check-in comment, or {@code null}
* @return a reference to the new version of the document
+ *
+ * @throws ConstraintViolationException if the document is not versionable
+ * @throws StreamNotSupportedException if <em>contentStream</em> is not
+ * {@code null} and a content stream is not supported on the
+ * document
+ * @throws UpdateConflictException if the object is no longer current
*/
ObjectId checkIn(ObjectId document, boolean major,
Map<String, Serializable> properties, ContentStream contentStream,
- String comment);
+ String comment) throws UpdateConflictException;
+
+ // TODO 1.0 getObjectOfLatestVersion
/**
* Gets the properties of the latest version.
@@ -676,6 +802,10 @@
* @param major {@code true} if the last major version is requested
* @param filter the properties filter, or {@code null} for all properties
* @return a collection of properties
+ *
+ * @throws FilterNotValidException if the filter is not valid
+ * @throws ObjectNotFoundException if <em>major</em> is {@code true} and the
+ * version series contains no major version
*/
Map<String, Serializable> getPropertiesOfLatestVersion(
String versionSeriesId, boolean major, String filter);
@@ -690,6 +820,8 @@
*
* @param versionSeriesId the version series ID
* @param filter the properties filter, or {@code null} for all properties
+ *
+ * @throws FilterNotValidException if the filter is not valid
*/
Collection<ObjectEntry> getAllVersions(String versionSeriesId, String filter);
@@ -698,7 +830,7 @@
*/
/**
- * Gets the relationships having as source or target a given document.
+ * Gets the relationships having as source or target a given object.
* <p>
* Returns a list of relationships associated with the given object,
* optionally of a specified relationship type, and optionally in a
@@ -718,7 +850,10 @@
* @param paging paging information, or {@code null} for a
* repository-specific default
* @return the list of relationships
+ *
+ * @throws FilterNotValidException if the filter is not valid
*/
+ // TODO rename to getObjectRelationships
ListPage<ObjectEntry> getRelationships(ObjectId object,
RelationshipDirection direction, String typeId,
boolean includeSubRelationshipTypes, String filter,
@@ -735,6 +870,8 @@
*
* @param object the target object
* @param policy the policy
+ *
+ * @throws ConstraintViolationException if the object is not controllable
*/
void applyPolicy(ObjectId object, ObjectId policy);
@@ -748,6 +885,8 @@
*
* @param object the target object
* @param policy the policy
+ *
+ * @throws ConstraintViolationException if the object is not controllable
*/
void removePolicy(ObjectId object, ObjectId policy);
@@ -762,6 +901,8 @@
*
* @param object the target object
* @param filter the properties filter, or {@code null} for all properties
+ *
+ * @throws FilterNotValidException if the filter is not valid
*/
Collection<ObjectEntry> getAppliedPolicies(ObjectId object, String filter);
@@ -799,6 +940,10 @@
* @param removeACEs the ACEs to remove
* @param propagation the ACL propagation to use
* @return the new ACL
+ *
+ * @throws ConstraintViolationException if the object is not controllable,
+ * the propagation value is not legal, or an ACE's permission is
+ * not legal
*/
List<ACE> applyACL(ObjectId object, List<ACE> addACEs,
List<ACE> removeACEs, ACLPropagation propagation, boolean[] exact,
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StorageException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StorageException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StorageException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StorageException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The repository is not able to store the object that the user is
+ * creating/updating due to an internal storage problem.
+ */
+public class StorageException extends CMISRuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public StorageException() {
+ super();
+ }
+
+ public StorageException(String message) {
+ super(message);
+ }
+
+ public StorageException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StorageException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StorageException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StorageException.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StreamNotSupportedException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StreamNotSupportedException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StreamNotSupportedException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StreamNotSupportedException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The operation is attempting to get or set a content stream for a
+ * {@link Document} whose {@link Type} specifies that a content stream is not
+ * allowed.
+ */
+public class StreamNotSupportedException extends ConstraintViolationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public StreamNotSupportedException() {
+ super();
+ }
+
+ public StreamNotSupportedException(String message) {
+ super(message);
+ }
+
+ public StreamNotSupportedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StreamNotSupportedException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StreamNotSupportedException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/StreamNotSupportedException.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/TypeManager.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/TypeManager.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/TypeManager.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/TypeManager.java Sat Nov 21 23:06:15 2009
@@ -74,6 +74,8 @@
* @param returnPropertyDefinitions {@code false} to skip property
* definitions
* @return the types, or a subset of them
+ *
+ * @throws IllegalArgumentException if the depth is invalid
*/
Collection<Type> getTypes(String typeId, int depth,
boolean returnPropertyDefinitions);
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/UpdateConflictException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/UpdateConflictException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/UpdateConflictException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/UpdateConflictException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The operation is attempting to update an object that is no longer current (as
+ * determined by the repository).
+ */
+public class UpdateConflictException extends CMISException {
+
+ private static final long serialVersionUID = 1L;
+
+ public UpdateConflictException() {
+ super();
+ }
+
+ public UpdateConflictException(String message) {
+ super(message);
+ }
+
+ public UpdateConflictException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public UpdateConflictException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/UpdateConflictException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/UpdateConflictException.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/VersioningException.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/VersioningException.java?rev=883013&view=auto
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/VersioningException.java (added)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/VersioningException.java Sat Nov 21 23:06:15 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authors:
+ * Florent Guillaume, Nuxeo
+ */
+package org.apache.chemistry;
+
+/**
+ * The operation is attempting to perform an action on a non-latest version of a
+ * {@link Document} but this is not possible.
+ */
+public class VersioningException extends CMISRuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public VersioningException() {
+ super();
+ }
+
+ public VersioningException(String message) {
+ super(message);
+ }
+
+ public VersioningException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public VersioningException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/VersioningException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/VersioningException.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISObjectsCollection.java Sat Nov 21 23:06:15 2009
@@ -48,6 +48,7 @@
import org.apache.abdera.util.EntityTag;
import org.apache.chemistry.BaseType;
import org.apache.chemistry.CMIS;
+import org.apache.chemistry.CMISRuntimeException;
import org.apache.chemistry.ContentStream;
import org.apache.chemistry.ObjectEntry;
import org.apache.chemistry.ObjectId;
@@ -340,13 +341,8 @@
switch (baseType) {
case DOCUMENT:
String filename = (String) posted.properties.get(Property.CONTENT_STREAM_FILE_NAME);
- ContentStream contentStream;
- try {
- contentStream = new SimpleContentStream(posted.stream,
- posted.mimeType, filename);
- } catch (IOException e) {
- throw new ResponseContextException(500, e);
- }
+ ContentStream contentStream = new SimpleContentStream(
+ posted.stream, posted.mimeType, filename);
VersioningState versioningState = null; // TODO
objectId = spi.createDocument(posted.properties, folderId,
contentStream, versioningState);
@@ -374,6 +370,10 @@
return buildCreateEntryResponse(link, entry);
} catch (ResponseContextException e) {
return createErrorResponse(e);
+ } catch (CMISRuntimeException e) {
+ return createErrorResponse(new ResponseContextException(500, e));
+ } catch (Exception e) {
+ return createErrorResponse(new ResponseContextException(500, e));
}
}
@@ -408,13 +408,8 @@
if (filename == null) {
filename = (String) object.getValue(Property.CONTENT_STREAM_FILE_NAME);
}
- ContentStream contentStream;
- try {
- contentStream = new SimpleContentStream(put.stream,
- put.mimeType, filename);
- } catch (IOException e) {
- throw new ResponseContextException(500, e);
- }
+ ContentStream contentStream = new SimpleContentStream(
+ put.stream, put.mimeType, filename);
spi.setContentStream(object, true, contentStream);
}
@@ -432,6 +427,10 @@
} catch (ResponseContextException e) {
return createErrorResponse(e);
+ } catch (CMISRuntimeException e) {
+ return createErrorResponse(new ResponseContextException(500, e));
+ } catch (Exception e) {
+ return createErrorResponse(new ResponseContextException(500, e));
}
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java Sat Nov 21 23:06:15 2009
@@ -16,7 +16,6 @@
*/
package org.apache.chemistry.atompub.server;
-import java.io.IOException;
import java.util.Arrays;
import junit.framework.TestCase;
@@ -92,7 +91,7 @@
server.stop();
}
- public static Repository makeRepository(String rootId) throws IOException {
+ public static Repository makeRepository(String rootId) throws Exception {
PropertyDefinition p1 = new SimplePropertyDefinition("title",
"def:title", null, "title", "Title", "", false,
PropertyType.STRING, false, null, false, false, "",
@@ -229,8 +228,8 @@
sw.startElement("query", CMIS.CMIS_NS, CMIS.CMIS_PREFIX);
sw.startElement("statement", CMIS.CMIS_NS, CMIS.CMIS_PREFIX).writeElementText(
statement).endElement();
- sw.startElement("searchAllVersions", CMIS.CMIS_NS,
- CMIS.CMIS_PREFIX).writeElementText("false").endElement();
+ sw.startElement("searchAllVersions", CMIS.CMIS_NS, CMIS.CMIS_PREFIX).writeElementText(
+ "false").endElement();
sw.startElement("pageSize", CMIS.CMIS_NS, CMIS.CMIS_PREFIX).writeElementText(
0).endElement();
sw.startElement("skipCount", CMIS.CMIS_NS, CMIS.CMIS_PREFIX).writeElementText(
Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleFolder.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleFolder.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleFolder.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleFolder.java Sat Nov 21 23:06:15 2009
@@ -26,6 +26,7 @@
import org.apache.chemistry.Folder;
import org.apache.chemistry.ObjectId;
import org.apache.chemistry.Unfiling;
+import org.apache.chemistry.UpdateConflictException;
public class SimpleFolder extends SimpleObject implements Folder {
@@ -43,7 +44,8 @@
throw new UnsupportedOperationException();
}
- public Collection<ObjectId> deleteTree(Unfiling unfiling) {
+ public Collection<ObjectId> deleteTree(Unfiling unfiling)
+ throws UpdateConflictException {
return entry.connection.getSPI().deleteTree(this, unfiling, true);
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java Sat Nov 21 23:06:15 2009
@@ -31,6 +31,7 @@
import org.apache.chemistry.Relationship;
import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Type;
+import org.apache.chemistry.UpdateConflictException;
import org.apache.chemistry.impl.base.BaseObject;
/**
@@ -69,7 +70,7 @@
throw new UnsupportedOperationException();
}
- public void delete() {
+ public void delete() throws UpdateConflictException {
entry.connection.getSPI().deleteObject(this, false);
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/impl/simple/TestSimpleRepository.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/impl/simple/TestSimpleRepository.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/impl/simple/TestSimpleRepository.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/test/java/org/apache/chemistry/impl/simple/TestSimpleRepository.java Sat Nov 21 23:06:15 2009
@@ -24,16 +24,16 @@
import org.apache.chemistry.BaseType;
import org.apache.chemistry.CMISObject;
+import org.apache.chemistry.CapabilityJoin;
+import org.apache.chemistry.CapabilityQuery;
import org.apache.chemistry.Connection;
import org.apache.chemistry.ContentStream;
import org.apache.chemistry.ContentStreamPresence;
import org.apache.chemistry.Document;
import org.apache.chemistry.Folder;
-import org.apache.chemistry.CapabilityJoin;
import org.apache.chemistry.Property;
import org.apache.chemistry.PropertyDefinition;
import org.apache.chemistry.PropertyType;
-import org.apache.chemistry.CapabilityQuery;
import org.apache.chemistry.RepositoryCapabilities;
import org.apache.chemistry.RepositoryInfo;
import org.apache.chemistry.Type;
@@ -203,7 +203,7 @@
assertEquals(string, new String(bytes, "UTF-8"));
}
- public void testRemoveDocument() {
+ public void testRemoveDocument() throws Exception {
Connection conn = repo.getConnection(null);
Folder root = conn.getRootFolder();
Document d1 = root.newDocument("doc");
@@ -212,7 +212,7 @@
assertNull(conn.getObject(d1));
}
- public void testRemoveFolder() {
+ public void testRemoveFolder() throws Exception {
Connection conn = repo.getConnection(null);
Folder root = conn.getRootFolder();
try {
@@ -236,7 +236,7 @@
assertNull(conn.getObject(d1));
}
- public void testBasicQuery() {
+ public void testBasicQuery() throws Exception {
Connection conn = repo.getConnection(null);
Folder root = conn.getRootFolder();
Document d1 = root.newDocument("doc");
@@ -249,8 +249,7 @@
assertEquals(0, res.size());
res = conn.query("SELECT * FROM doc", false);
assertEquals(1, res.size());
- res = conn.query(
- "SELECT * FROM cmis:folder WHERE cmis:name = ''",
+ res = conn.query("SELECT * FROM cmis:folder WHERE cmis:name = ''",
false);
assertEquals(1, res.size());
res = conn.query("SELECT * FROM doc WHERE cmis:objectId = 'nosuchid'",
Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java Sat Nov 21 23:06:15 2009
@@ -41,6 +41,7 @@
import org.apache.chemistry.Document;
import org.apache.chemistry.Folder;
import org.apache.chemistry.ListPage;
+import org.apache.chemistry.NameConstraintViolationException;
import org.apache.chemistry.ObjectEntry;
import org.apache.chemistry.ObjectId;
import org.apache.chemistry.Paging;
@@ -188,7 +189,8 @@
// TODO add IOException to throws clause
public ObjectId createDocument(Map<String, Serializable> properties,
ObjectId folderId, ContentStream contentStream,
- VersioningState versioningState) {
+ VersioningState versioningState)
+ throws NameConstraintViolationException {
try {
JcrFolder folder = (JcrFolder) getObject(folderId);
@@ -201,7 +203,7 @@
}
doc.save();
return new SimpleObjectId(doc.getId());
- } catch (IOException e) {
+ } catch (Exception e) {
String msg = "Unable to create document.";
log.error(msg, e);
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicHelper.java Sat Nov 21 23:06:15 2009
@@ -16,7 +16,6 @@
*/
package org.apache.chemistry.test;
-import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
@@ -46,7 +45,7 @@
public static final String TEST_FILE_CONTENT = "This is a test file.\nTesting, testing...\n";
- public static Repository makeRepository(String rootId) throws IOException {
+ public static Repository makeRepository(String rootId) throws Exception {
PropertyDefinition p1 = new SimplePropertyDefinition("title",
"def:title", null, "title", "Title", "", false,
PropertyType.STRING, false, null, false, false, "(no title)",
Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java?rev=883013&r1=883012&r2=883013&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java Sat Nov 21 23:06:15 2009
@@ -373,7 +373,7 @@
assertEquals(blobBytes.length, cs.getLength());
}
- public void testNewFolder() {
+ public void testNewFolder() throws Exception {
Folder root = conn.getRootFolder();
assertNull(getDocumentChild(root));
Folder fold = root.newFolder("fold");
@@ -401,7 +401,7 @@
assertEquals("mytitle", fold.getString("title"));
}
- public void testUpdateSPI() {
+ public void testUpdateSPI() throws Exception {
ObjectEntry ob = spi.getObjectByPath("/folder 1/doc 1", null, false,
false);
assertEquals("doc 1 title", ob.getValue("title"));