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/05/09 06:29:42 UTC
svn commit: r773161 - in /incubator/chemistry/trunk/chemistry:
chemistry-api/src/main/java/org/apache/chemistry/
chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/
chemistry-commons/src/test/java/org/apache/chemistry/impl/simple/ chemist...
Author: fguillaume
Date: Sat May 9 04:29:41 2009
New Revision: 773161
URL: http://svn.apache.org/viewvc?rev=773161&view=rev
Log:
CMIS-17: Move most methods from Connection to object-related interfaces
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/Connection.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-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleDocument.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-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewFolder.java
incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
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=773161&r1=773160&r2=773161&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 May 9 04:29:41 2009
@@ -22,6 +22,8 @@
import java.math.BigDecimal;
import java.net.URI;
import java.util.Calendar;
+import java.util.Collection;
+import java.util.List;
import java.util.Map;
/**
@@ -42,16 +44,155 @@
*/
public interface CMISObject extends ObjectId {
+ /*
+ * ----- Object Services -----
+ */
+
/**
- * The object's type definition.
+ * Moves this filed object from one folder to another.
+ * <p>
+ * The target folder is that into which the object has to be moved. When the
+ * object is multi-filed, a source folder to be moved out of must be
+ * specified.
+ *
+ * @param targetFolder the target folder
+ * @param sourceFolder the source folder, or {@code null}
*/
- Type getType();
+ void move(Folder targetFolder, Folder sourceFolder);
+
+ /**
+ * Deletes this object.
+ * <p>
+ * When a filed object is deleted, it is removed from all folders it is
+ * filed in.
+ * <p>
+ * This deletes a specific version of a document object. To delete all
+ * versions, use {@link #deleteAllVersions}.
+ * <p>
+ * Deletion of a private working copy (checked out version) is the same as
+ * to cancel checkout.
+ */
+ void delete();
+
+ /**
+ * Unfiles this non-folder object.
+ * <p>
+ * This removes this object from all folders it is filed in, but never
+ * deletes the object, which means that if unfiling is not supported, an
+ * exception will be thrown.
+ * <p>
+ * If this object is a folder then an exception will be thrown.
+ *
+ * @see #delete
+ * @see Folder#remove
+ */
+ void unfile();
+
+ /*
+ * ----- Navigation Services -----
+ */
+
+ /**
+ * Gets the parent folder, or the single folder in which the object is
+ * filed.
+ * <p>
+ * For a folder, returns the parent folder, or {@code null} if there is no
+ * 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}.
+ *
+ * @return the parent folder, or {@code null}.
+ *
+ * @see #getParents
+ * @see Folder#getAncestors
+ */
+ 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
+ *
+ * @see #getParent
+ * @see Folder#getAncestors
+ */
+ Collection<Folder> getParents();
+
+ /*
+ * ----- Relationship Services -----
+ */
+
+ /**
+ * Gets the relationships having as source or target this object.
+ * <p>
+ * Returns a list of relationships associated with this object, optionally
+ * of a specified relationship type, and optionally in a specified
+ * direction.
+ * <p>
+ * If typeId is {@code null}, returns relationships of any type.
+ * <p>
+ * Ordering is repository specific but consistent across requests.
+ *
+ * @param direction the direction of relationships to include
+ * @param typeId the type ID, or {@code null}
+ * @param includeSubRelationshipTypes {@code true} if relationships of any
+ * sub-type of typeId are to be returned as well
+ * @return the list of relationships
+ */
+ List<Relationship> getRelationships(RelationshipDirection direction,
+ String typeId, boolean includeSubRelationshipTypes);
+
+ /*
+ * ----- Policy Services -----
+ */
+
+ /**
+ * Applies a policy to this object.
+ * <p>
+ * The object must be controllable.
+ *
+ * @param policy the policy
+ */
+ void applyPolicy(Policy policy);
+
+ /**
+ * Removes a policy from this object.
+ * <p>
+ * Removes a previously applied policy from the object. The policy is not
+ * deleted, and may still be applied to other objects.
+ * <p>
+ * The object must be controllable.
+ *
+ * @param policy the policy
+ */
+ void removePolicy(Policy policy);
+
+ /**
+ * Gets the policies applied to this object.
+ * <p>
+ * Returns the list of policy objects currently applied to the object. Only
+ * policies that are directly (explicitly) applied to the object are
+ * returned.
+ * <p>
+ * The object must be controllable.
+ */
+ Collection<Policy> getPolicies();
/*
* ----- data access -----
*/
/**
+ * The object's type definition.
+ */
+ Type getType();
+
+ /**
* Gets a property.
*
* @param name the property name
@@ -113,24 +254,6 @@
void save();
/*
- * ----- misc -----
- */
-
- /**
- * The parent folder, or the single folder in which the object is filed.
- * <p>
- * For a folder, returns the parent folder, or {@code null} if there is no
- * 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.
- *
- * @return the parent folder, or {@code null}.
- */
- Folder getParent();
-
- /*
* ----- convenience methods -----
*/
Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Connection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Connection.java?rev=773161&r1=773160&r2=773161&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Connection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Connection.java Sat May 9 04:29:41 2009
@@ -19,7 +19,6 @@
package org.apache.chemistry;
import java.util.Collection;
-import java.util.List;
/**
* A Connection to a CMIS Repository.
@@ -112,99 +111,6 @@
*/
CMISObject getObject(ObjectId object, ReturnVersion returnVersion);
- /**
- * Moves the specified filed object from one folder to another.
- * <p>
- * The target folder is that into which the object has to be moved. When the
- * object is multi-filed, a source folder to be moved out of must be
- * specified.
- *
- * @param object the object
- * @param targetFolder the target folder
- * @param sourceFolder the source folder, or {@code null}
- */
- void moveObject(CMISObject object, Folder targetFolder, Folder sourceFolder);
-
- /**
- * Deletes the specified object.
- * <p>
- * When a filed object is deleted, it is removed from all folders it is
- * filed in.
- * <p>
- * This service deletes a specific version of a document object. To delete
- * all versions, use {@link #deleteAllVersions}.
- * <p>
- * Deletion of a private working copy (checked out version) is the same as
- * to cancel checkout.
- *
- * @param object the object
- */
- void deleteObject(CMISObject object);
-
- /**
- * Deletes a tree of objects.
- * <p>
- * Deletes the tree rooted at the specified folder (including that folder).
- * <p>
- * If a non-folder object is removed from the last folder it is filed in, it
- * can continue to survive outside of the folder structure if the repository
- * supports unfiling; this is controlled based on the unfiling parameter.
- * <p>
- * For repositories that support version-specific filing, this may delete
- * some versions of a document but not necessarily all versions. For
- * repositories that do not support version-specific filing, if a document
- * is to be deleted, all versions are deleted.
- * <p>
- * This method is not transactional. However, if
- * {@link Unfiling#DELETE_SINGLE_FILED DELETE_SINGLE_FILED} and some objects
- * fail to delete, then single-filed objects are either deleted or kept,
- * never just unfiled. This is so that user can call this method again to
- * recover from the error by using the same tree.
- * <p>
- * The order in which deletion will happen is unspecified; however, any
- * objects that are not deleted (e.g., because a previous object failed to
- * delete) remain valid objects (including any applicable filing
- * constraint).
- * <p>
- * Returns the collection of IDs of objects that could not be deleted. If
- * all objects could be deleted, an empty collection is returned. If at
- * least one object could not be deleted, then if continueOnFailure is
- * {@code false} that single object ID is returned, otherwise all IDs of
- * objects that could not be deleted are returned.
- *
- * @param folder the folder
- * @param unfiling how to unfile non-folder objects, if {@code null} then
- * same as {@link Unfiling#DELETE}
- * @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
- */
- Collection<String> deleteTree(Folder folder, Unfiling unfiling,
- boolean continueOnFailure);
-
- /**
- * Adds an existing non-folder, fileable object to a folder.
- *
- * @param object the object
- * @param folder the folder
- */
- void addObjectToFolder(CMISObject object, Folder folder);
-
- /**
- * Removes a non-folder object from a folder or from all folders.
- * <p>
- * If folderId is {@code null}, then the the object is removed from all
- * folders.
- * <p>
- * This never deletes the object, which means that if unfiling is not
- * supported, and an object is to be removed from the last folder it exists
- * in, or is to be removed from all folders, an exception will be thrown.
- *
- * @param object the object
- * @param folder the folder, or {@code null} for all folders
- */
- void removeObjectFromFolder(CMISObject object, Folder folder);
-
/*
* ----- Discovery Services -----
*/
@@ -234,160 +140,4 @@
// TODO returns a result set actually, there may be computed values
Collection<CMISObject> query(String statement, boolean searchAllVersions);
- /*
- * ----- Versioning Services -----
- */
-
- /**
- * Checks out a document.
- * <p>
- * Creates a private working copy of the document, copies the metadata and
- * optionally content.
- * <p>
- * It is up to the repository to determine if updates to the current version
- * (not private working copy) and prior versions are allowed if checked out.
- * <p>
- * Some repositories may not support updating of private working copies and
- * the updates must then be supplied via {@link #checkIn}.
- * <p>
- * This method may remove update permission on prior versions.
- * <p>
- * The ID of the private working copy is returned.
- * <p>
- * The return value contentCopied[0] is set to {@code true} if the content
- * is copied, {@code false} if not. Whether the content is copied on
- * check-out or not is repository-specific.
- *
- * @param document the document
- * @return the private working copy
- */
- Document checkOut(Document document);
-
- /**
- * Cancels a check-out.
- * <p>
- * Reverses the effect of a check-out. Removes the private working copy of
- * the checked-out document, allowing other documents in the version series
- * to be checked out again.
- *
- * @param document the private working copy
- */
- void cancelCheckOut(Document document);
-
- /**
- * Checks in a private working copy.
- * <p>
- * Makes the private working copy the current version of the document.
- *
- * @param document the private working copy
- * @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
- */
- Document checkIn(Document document, boolean major, String comment);
-
- /**
- * Gets the latest version.
- * <p>
- * Returns the latest version, or the latest major version, of the specified
- * document.
- * <p>
- * If the latest major version is requested and the series has no major
- * version, an exception is thrown.
- *
- * @param document the document
- * @param major {@code true} if the last major version is requested
- * @return the latest version or latest major version
- */
- Document getLatestVersion(Document document, boolean major);
-
- /**
- * Gets all the versions of a document.
- * <p>
- * Returns the list of all document versions for the specified version
- * series, sorted by CREATION_DATE descending. All versions that the user
- * can access, including checked-out version and private working copy, are
- * returned.
- *
- * @param document the document
- * @param filter the properties filter, or {@code null} for all properties
- */
- Collection<Document> getAllVersions(Document document, String filter);
-
- /**
- * Deletes all the versions of a document.
- * <p>
- * Deletes all document versions in the version series of the specified
- * document.
- *
- * @param document the document
- */
- void deleteAllVersions(Document document);
-
- /*
- * ----- Relationship Services -----
- */
-
- /**
- * Gets the relationships having as source or target a given document.
- * <p>
- * Returns a list of relationships associated with the given object,
- * optionally of a specified relationship type, and optionally in a
- * specified direction.
- * <p>
- * If typeId is {@code null}, returns relationships of any type.
- * <p>
- * Ordering is repository specific but consistent across requests.
- *
- * @param object the object
- * @param direction the direction of relationships to include
- * @param typeId the type ID, or {@code null}
- * @param includeSubRelationshipTypes {@code true} if relationships of any
- * sub-type of typeId are to be returned as well
- * @return the list of relationships
- */
- List<Relationship> getRelationships(CMISObject object,
- RelationshipDirection direction, String typeId,
- boolean includeSubRelationshipTypes);
-
- /*
- * ----- Policy Services -----
- */
-
- /**
- * Applies a policy to an object.
- * <p>
- * The target object must be controllable.
- *
- * @param policy the policy
- * @param object the target object
- */
- void applyPolicy(Policy policy, CMISObject object);
-
- /**
- * Removes a policy from an object.
- * <p>
- * Removes a previously applied policy from a target object. The policy is
- * not deleted, and may still be applied to other objects.
- * <p>
- * The target object must be controllable.
- *
- * @param policy the policy
- * @param object the target object
- */
- void removePolicy(Policy policy, CMISObject object);
-
- /**
- * Gets the policies applied to an object.
- * <p>
- * Returns the list of policy objects currently applied to a target object.
- * Only policies that are directly (explicitly) applied to the target object
- * are returned.
- * <p>
- * The target object must be controllable.
- *
- * @param object the target object
- */
- Collection<Policy> getAppliedPolicies(CMISObject object);
-
}
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=773161&r1=773160&r2=773161&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 May 9 04:29:41 2009
@@ -20,24 +20,97 @@
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collection;
/**
* A CMIS Document.
*/
public interface Document extends CMISObject {
+ /*
+ * ----- Versioning Services -----
+ */
+
+ /**
+ * Checks out this document.
+ * <p>
+ * Creates a private working copy of the document, copies the metadata and
+ * optionally content.
+ * <p>
+ * It is up to the repository to determine if updates to the current version
+ * (not private working copy) and prior versions are allowed if checked out.
+ * <p>
+ * Some repositories may not support updating of private working copies and
+ * the updates must then be supplied via {@link #checkIn}.
+ * <p>
+ * This method may remove update permission on prior versions.
+ * <p>
+ * The ID of the private working copy is returned.
+ * <p>
+ * The return value contentCopied[0] is set to {@code true} if the content
+ * is copied, {@code false} if not. Whether the content is copied on
+ * check-out or not is repository-specific.
+ *
+ * @return the private working copy
+ */
+ Document checkOut();
+
+ /**
+ * Cancels a check-out of a private working copy.
+ * <p>
+ * 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.
+ */
+ void cancelCheckOut();
+
/**
- * The folder in which the document is filed.
+ * Checks in a private working copy.
* <p>
- * If the document is unfiled, {@code null} is returned. If the document is
- * filed in multiple folders, an exception is raised.
+ * Makes the private working copy the current version of the document.
+ *
+ * @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
+ */
+ Document checkIn(boolean major, String comment);
+
+ /**
+ * Gets the latest version of this document.
+ * <p>
+ * Returns the latest version, or the latest major version, of this
+ * document.
+ * <p>
+ * If the latest major version is requested and the version series of this
+ * document has no major version, an exception is thrown.
+ *
+ * @param major {@code true} if the last major version is requested
+ * @return the latest version or latest major version
+ */
+ Document getLatestVersion(boolean major);
+
+ /**
+ * Gets all the versions of this document.
* <p>
- * This is a convenience method for the common case where documents are not
- * multi-filed.
+ * Returns the list of all document versions for the specified version
+ * series of this document, sorted by CREATION_DATE descending. All versions
+ * that the user can access, including checked-out version and private
+ * working copy, are returned.
*
- * @return the parent folder, or {@code null}.
+ * @return the collection of all versions
+ */
+ Collection<Document> getAllVersions();
+
+ /**
+ * Deletes all the versions of this document.
+ * <p>
+ * Deletes all document versions in the version series of this document.
+ */
+ void deleteAllVersions();
+
+ /*
+ * ----- data access -----
*/
- Folder getParent();
/**
* Gets the byte stream for this document.
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=773161&r1=773160&r2=773161&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 May 9 04:29:41 2009
@@ -18,24 +18,111 @@
*/
package org.apache.chemistry;
+import java.util.Collection;
import java.util.List;
-
/**
* A CMIS Folder.
*/
public interface Folder extends CMISObject {
+ /*
+ * ----- Object Services -----
+ */
+
+ /**
+ * Adds an existing non-folder, fileable object to this folder.
+ *
+ * @param object the object
+ */
+ void add(CMISObject object);
+
/**
- * Gets the direct children of a folder.
+ * Removes a non-folder object from this folder.
+ * <p>
+ * This never deletes the object, which means that if unfiling is not
+ * supported, and an object is to be removed from the last folder it exists
+ * in, an exception will be thrown.
*
- * @param type the base type, or {@code null} for all types
- * @param orderBy an {@code ORDER BY} clause, or {@code null}
+ * @param object the object
+ *
+ * @see CMISObject#delete
+ * @see CMISObject#unfile
+ */
+ void remove(CMISObject object);
+
+ /**
+ * Deletes a tree of objects.
+ * <p>
+ * Deletes the tree rooted at this folder (including the folder itself).
+ * <p>
+ * If a non-folder object is removed from the last folder it is filed in, it
+ * can continue to survive outside of the folder structure if the repository
+ * supports unfiling; this is controlled based on the unfiling parameter.
+ * <p>
+ * For repositories that support version-specific filing, this may delete
+ * some versions of a document but not necessarily all versions. For
+ * repositories that do not support version-specific filing, if a document
+ * is to be deleted, all versions are deleted.
+ * <p>
+ * This method is not transactional. However, if
+ * {@link Unfiling#DELETE_SINGLE_FILED} and some objects fail to delete,
+ * then single-filed objects are either deleted or kept, never just unfiled.
+ * This is so that user can call this method again to recover from the error
+ * by using the same tree.
+ * <p>
+ * This method attempts to continue deleting objects on failure of deleting
+ * one object.
+ * <p>
+ * The order in which deletion will happen is unspecified.
+ * <p>
+ * Returns the collection of IDs of objects that could not be deleted. If
+ * all objects could be deleted, an empty collection is returned.
+ *
+ * @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
+ */
+ Collection<ObjectId> deleteTree(Unfiling unfiling);
+
+ /*
+ * ----- Navigation Services -----
+ */
+
+ /**
+ * Gets the ancestors of this folder.
+ * <p>
+ * Returns an ordered list of all ancestor folders from this specified
+ * folder to the root folder. The resulting list is ordered by ancestry,
+ * closest this folder first.
+ * <p>
+ * Returns an empty list if this folder is the root folder.
+ *
+ * @return the list of ancestors
+ *
+ * @see CMISObject#getParent
+ * @see CMISObject#getParents
+ */
+ List<Folder> getAncestors();
+
+ /**
+ * Gets the direct children of this folder.
+ * <p>
+ * Only children of the given type ({@link BaseType#FOLDER},
+ * {@link BaseType#DOCUMENT}, or {@code null} for all) are returned.
+ * <p>
+ * The order of returned children is implementation-dependant.
+ *
+ * @param type the base type of children, or {@code null} for all children
* @return the list of children
*/
- List<CMISObject> getChildren(BaseType type, String orderBy);
+ List<CMISObject> getChildren(BaseType type);
+
+ // getDescendants kept on the SPI
- // getDescendants and getParents kept on the Connection
+ /*
+ * ----- Factories -----
+ */
/**
* Creates a new, unsaved document as a child of this folder.
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=773161&r1=773160&r2=773161&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 May 9 04:29:41 2009
@@ -504,7 +504,7 @@
* should not stop deletion of other objects
* @return the collection of IDs of objects that could not be deleted
*/
- Collection<String> deleteTree(ObjectId folder, Unfiling unfiling,
+ Collection<ObjectId> deleteTree(ObjectId folder, Unfiling unfiling,
boolean continueOnFailure);
/**
Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java?rev=773161&r1=773160&r2=773161&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java Sat May 9 04:29:41 2009
@@ -405,12 +405,6 @@
throw new UnsupportedOperationException();
}
- public void moveObject(CMISObject object, Folder targetFolder,
- Folder sourceFolder) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
public void deleteObject(ObjectId object) {
String id = object.getId();
if (repository.rootId.equals(id)) {
@@ -442,11 +436,7 @@
repository.datas.remove(id);
}
- public void deleteObject(CMISObject object) {
- deleteObject((ObjectId) object);
- }
-
- public Collection<String> deleteTree(ObjectId folder, Unfiling unfiling,
+ public Collection<ObjectId> deleteTree(ObjectId folder, Unfiling unfiling,
boolean continueOnFailure) {
// TODO unfiling
// TODO continueOnFailure
@@ -462,48 +452,34 @@
if (repository.getType(typeId).getBaseType() != BaseType.FOLDER) {
throw new RuntimeException("Not a folder: " + folder); // TODO
}
- Set<String> deletedIds = new HashSet<String>();
+ Set<ObjectId> deletedIds = new HashSet<ObjectId>();
for (String childId : repository.children.get(id)) {
SimpleData childData = repository.datas.get(childId);
String childTypeId = (String) childData.get(Property.TYPE_ID);
+ ObjectId objectId = new SimpleObjectId(childId);
if (repository.getType(childTypeId).getBaseType() == BaseType.FOLDER) {
- deletedIds.addAll(deleteTree(new SimpleObjectId(childId),
- unfiling, continueOnFailure));
+ deletedIds.addAll(deleteTree(objectId, unfiling,
+ continueOnFailure));
} else {
- deleteObject(new SimpleObjectId(childId));
- deletedIds.add(childId);
+ deleteObject(objectId);
+ deletedIds.add(objectId);
}
}
deleteObject(folder);
- deletedIds.add(id);
+ deletedIds.add(new SimpleObjectId(id));
return deletedIds;
}
- public Collection<String> deleteTree(Folder folder, Unfiling unfiling,
- boolean continueOnFailure) {
- return deleteTree((ObjectId) folder, unfiling, continueOnFailure);
- }
-
public void addObjectToFolder(ObjectId object, ObjectId folder) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
- public void addObjectToFolder(CMISObject object, Folder folder) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
public void removeObjectFromFolder(ObjectId object, ObjectId folder) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
- public void removeObjectFromFolder(CMISObject object, Folder folder) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
/*
* ----- Discovery Services -----
*/
@@ -531,21 +507,11 @@
throw new UnsupportedOperationException();
}
- public Document checkOut(Document document) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
public void cancelCheckOut(ObjectId document) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
- public void cancelCheckOut(Document document) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
public ObjectId checkIn(ObjectId document, boolean major,
Map<String, Serializable> properties, ContentStream contentStream,
String comment) {
@@ -553,43 +519,23 @@
throw new UnsupportedOperationException();
}
- public Document checkIn(Document document, boolean major, String comment) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
public Map<String, Serializable> getPropertiesOfLatestVersion(
String versionSeriesId, boolean majorVersion, String filter) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
- public Document getLatestVersion(Document document, boolean major) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
public Collection<ObjectEntry> getAllVersions(String versionSeriesId,
String filter) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
- public Collection<Document> getAllVersions(Document document, String filter) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
public void deleteAllVersions(String versionSeriesId) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
- public void deleteAllVersions(Document document) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
/*
* ----- Relationship Services -----
*/
@@ -603,13 +549,6 @@
throw new UnsupportedOperationException();
}
- public List<Relationship> getRelationships(CMISObject object,
- RelationshipDirection direction, String typeId,
- boolean includeSubRelationshipTypes) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
/*
* ----- Policy Services -----
*/
@@ -619,30 +558,15 @@
throw new UnsupportedOperationException();
}
- public void applyPolicy(Policy policy, CMISObject object) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
public void removePolicy(ObjectId policy, ObjectId object) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
- public void removePolicy(Policy policy, CMISObject object) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
public Collection<ObjectEntry> getAppliedPolicies(ObjectId policy,
String filter) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
- public Collection<Policy> getAppliedPolicies(CMISObject object) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException();
- }
-
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleDocument.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleDocument.java?rev=773161&r1=773160&r2=773161&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleDocument.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleDocument.java Sat May 9 04:29:41 2009
@@ -22,6 +22,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
+import java.util.Collection;
import org.apache.chemistry.ContentStream;
import org.apache.chemistry.ContentStreamPresence;
@@ -38,6 +39,36 @@
return (byte[]) entry.data.get(SimpleProperty.CONTENT_BYTES_KEY);
}
+ public Document checkOut() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void cancelCheckOut() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Document checkIn(boolean major, String comment) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Document getLatestVersion(boolean major) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Collection<Document> getAllVersions() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void deleteAllVersions() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
public InputStream getStream() {
byte[] contentBytes = getContentBytes();
if (contentBytes == null) {
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=773161&r1=773160&r2=773161&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 May 9 04:29:41 2009
@@ -19,6 +19,7 @@
package org.apache.chemistry.impl.simple;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -26,6 +27,8 @@
import org.apache.chemistry.CMISObject;
import org.apache.chemistry.Document;
import org.apache.chemistry.Folder;
+import org.apache.chemistry.ObjectId;
+import org.apache.chemistry.Unfiling;
public class SimpleFolder extends SimpleObject implements Folder {
@@ -33,8 +36,27 @@
super(entry);
}
- public List<CMISObject> getChildren(BaseType type, String orderBy) {
- // TODO type and orderBy
+ public void add(CMISObject object) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void remove(CMISObject object) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Collection<ObjectId> deleteTree(Unfiling unfiling) {
+ return entry.connection.deleteTree(this, unfiling, true);
+ }
+
+ public List<Folder> getAncestors() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public List<CMISObject> getChildren(BaseType type) {
+ // TODO type
Set<String> ids = entry.connection.repository.children.get(getId());
List<CMISObject> children = new ArrayList<CMISObject>(ids.size());
for (String id : ids) {
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=773161&r1=773160&r2=773161&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 May 9 04:29:41 2009
@@ -19,13 +19,18 @@
package org.apache.chemistry.impl.simple;
import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
import java.util.Set;
import org.apache.chemistry.BaseType;
import org.apache.chemistry.CMISObject;
import org.apache.chemistry.Folder;
+import org.apache.chemistry.Policy;
import org.apache.chemistry.Property;
import org.apache.chemistry.PropertyDefinition;
+import org.apache.chemistry.Relationship;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Type;
import org.apache.chemistry.impl.base.BaseObject;
@@ -60,8 +65,18 @@
}
}
- public Type getType() {
- return type;
+ public void move(Folder targetFolder, Folder sourceFolder) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void delete() {
+ entry.connection.deleteObject(this);
+ }
+
+ public void unfile() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
}
public Folder getParent() {
@@ -77,6 +92,36 @@
return new SimpleFolder(new SimpleObjectEntry(data, entry.connection));
}
+ public Collection<Folder> getParents() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public List<Relationship> getRelationships(RelationshipDirection direction,
+ String typeId, boolean includeSubRelationshipTypes) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void applyPolicy(Policy policy) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void removePolicy(Policy policy) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Collection<Policy> getPolicies() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Type getType() {
+ return type;
+ }
+
public Serializable getValue(String name) {
PropertyDefinition propertyDefinition = getType().getPropertyDefinition(
name);
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=773161&r1=773160&r2=773161&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 May 9 04:29:41 2009
@@ -107,7 +107,7 @@
assertNotNull(root);
assertEquals(repo.getRootFolderId().getId(), root.getId());
assertEquals("CMIS_Root_Folder", root.getName());
- assertEquals(0, root.getChildren(null, null).size());
+ assertEquals(0, root.getChildren(null).size());
assertNull(root.getParent());
}
@@ -116,16 +116,16 @@
Folder root = conn.getRootFolder();
Folder f1 = root.newFolder("fold");
assertEquals(12 + 1, f1.getType().getPropertyDefinitions().size());
- List<CMISObject> children = root.getChildren(null, null);
+ List<CMISObject> children = root.getChildren(null);
assertEquals(0, children.size());
f1.save();
assertEquals(root.getId(), f1.getParent().getId());
- children = root.getChildren(null, null);
+ children = root.getChildren(null);
assertEquals(1, children.size());
assertTrue(children.get(0) instanceof Folder);
Document d1 = root.newDocument("doc");
d1.save();
- children = root.getChildren(null, null);
+ children = root.getChildren(null);
assertEquals(2, children.size());
assertTrue(children.get(0) instanceof Document
|| children.get(1) instanceof Document);
@@ -175,7 +175,7 @@
Folder root = conn.getRootFolder();
Document d1 = root.newDocument("doc");
d1.save();
- conn.deleteObject(d1);
+ d1.delete();
assertNull(conn.getObject(d1, ReturnVersion.THIS));
}
@@ -183,7 +183,7 @@
Connection conn = repo.getConnection(null);
Folder root = conn.getRootFolder();
try {
- conn.deleteObject(root);
+ root.delete();
fail();
} catch (Exception e) {
// ok
@@ -197,7 +197,7 @@
Document d1 = f2.newDocument("doc");
d1.setName("bar");
d1.save();
- conn.deleteTree(f2, Unfiling.UNFILE, true);
+ f2.deleteTree(Unfiling.UNFILE);
assertEquals(f1.getId(), conn.getObject(f1, ReturnVersion.THIS).getId());
assertNull(conn.getObject(f2, ReturnVersion.THIS));
assertNull(conn.getObject(d1, ReturnVersion.THIS));
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=773161&r1=773160&r2=773161&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 May 9 04:29:41 2009
@@ -66,57 +66,10 @@
this.repository = repository;
}
- public void addObjectToFolder(CMISObject object, Folder folder) {
- throw new UnsupportedOperationException();
- }
-
- public void applyPolicy(Policy policy, CMISObject object) {
- throw new UnsupportedOperationException();
- }
-
- public void cancelCheckOut(Document document) {
- throw new UnsupportedOperationException();
- }
-
- public Document checkIn(Document document, boolean major, String comment) {
- throw new UnsupportedOperationException();
- }
-
- public Document checkOut(Document document) {
- throw new UnsupportedOperationException();
- }
-
public void close() {
session.logout();
}
- public void deleteAllVersions(Document document) {
- throw new UnsupportedOperationException();
- }
-
- public void deleteObject(CMISObject object) {
- throw new UnsupportedOperationException();
- }
-
- public Collection<String> deleteTree(Folder folder, Unfiling unfiling,
- boolean continueOnFailure) {
- JcrFolder f = (JcrFolder) folder;
- f.delete();
- return Collections.emptySet();
- }
-
- public Collection<Document> getAllVersions(Document document, String filter) {
- throw new UnsupportedOperationException();
- }
-
- public Collection<Policy> getAppliedPolicies(CMISObject object) {
- throw new UnsupportedOperationException();
- }
-
- public Document getLatestVersion(Document document, boolean major) {
- throw new UnsupportedOperationException();
- }
-
public CMISObject getObject(ObjectId objectId, ReturnVersion returnVersion) {
try {
String relPath = JcrObjectEntry.getPath(objectId.getId()).substring(1);
@@ -137,12 +90,6 @@
return null;
}
- public List<Relationship> getRelationships(CMISObject object,
- RelationshipDirection direction, String typeId,
- boolean includeSubRelationshipTypes) {
- throw new UnsupportedOperationException();
- }
-
public Repository getRepository() {
return repository;
}
@@ -161,11 +108,6 @@
return this;
}
- public void moveObject(CMISObject object, Folder targetFolder,
- Folder sourceFolder) {
- throw new UnsupportedOperationException();
- }
-
public Document newDocument(String typeId, Folder folder) {
throw new UnsupportedOperationException();
}
@@ -205,14 +147,6 @@
throw new UnsupportedOperationException();
}
- public void removeObjectFromFolder(CMISObject object, Folder folder) {
- throw new UnsupportedOperationException();
- }
-
- public void removePolicy(Policy policy, CMISObject object) {
- throw new UnsupportedOperationException();
- }
-
//---------------------------------------------------------------------- SPI
public void addObjectToFolder(ObjectId objectId, ObjectId folderId) {
@@ -292,8 +226,8 @@
throw new UnsupportedOperationException();
}
- public Collection<String> deleteTree(ObjectId folderId, Unfiling unfiling,
- boolean continueOnFailure) {
+ public Collection<ObjectId> deleteTree(ObjectId folderId,
+ Unfiling unfiling, boolean continueOnFailure) {
throw new UnsupportedOperationException();
}
Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java?rev=773161&r1=773160&r2=773161&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java Sat May 9 04:29:41 2009
@@ -19,6 +19,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
+import java.util.Collection;
import java.util.Map;
import javax.jcr.Node;
@@ -122,6 +123,36 @@
return false;
}
+ public void cancelCheckOut() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Document checkIn(boolean major, String comment) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Document checkOut() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void deleteAllVersions() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Collection<Document> getAllVersions() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Document getLatestVersion(boolean major) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
@Override
protected BaseType getBaseType() {
return BaseType.DOCUMENT;
Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java?rev=773161&r1=773160&r2=773161&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java Sat May 9 04:29:41 2009
@@ -18,6 +18,8 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -29,6 +31,8 @@
import org.apache.chemistry.CMISObject;
import org.apache.chemistry.Document;
import org.apache.chemistry.Folder;
+import org.apache.chemistry.ObjectId;
+import org.apache.chemistry.Unfiling;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jackrabbit.JcrConstants;
@@ -41,9 +45,10 @@
super(node);
}
- protected JcrFolder() {}
+ protected JcrFolder() {
+ }
- public List<CMISObject> getChildren(BaseType type, String orderBy) {
+ public List<CMISObject> getChildren(BaseType type) {
try {
List<CMISObject> result = new ArrayList<CMISObject>();
@@ -111,15 +116,24 @@
return this;
}
- public void delete() {
- try {
- Node parent = node.getParent();
- node.remove();
- parent.save();
- } catch (RepositoryException e) {
- String msg = "Unable to delete folder.";
- log.error(msg, e);
- }
+ public void add(CMISObject object) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void remove(CMISObject object) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Collection<ObjectId> deleteTree(Unfiling unfiling) {
+ delete();
+ return Collections.emptySet();
+ }
+
+ public List<Folder> getAncestors() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
}
@Override
Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java?rev=773161&r1=773160&r2=773161&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java Sat May 9 04:29:41 2009
@@ -21,6 +21,7 @@
import java.io.InputStream;
import java.io.Serializable;
import java.util.Calendar;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -28,6 +29,7 @@
import javax.jcr.RepositoryException;
import org.apache.chemistry.ContentStream;
+import org.apache.chemistry.Document;
import org.apache.chemistry.Folder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -64,6 +66,64 @@
}
@Override
+ public void delete() {
+ // TODO delete of an unsaved object?
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ super.delete();
+ }
+
+
+ @Override
+ public void cancelCheckOut() {
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ super.cancelCheckOut();
+ }
+
+ @Override
+ public Document checkIn(boolean major, String comment) {
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ return super.checkIn(major, comment);
+ }
+
+ @Override
+ public Document checkOut() {
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ return super.checkOut();
+ }
+
+ @Override
+ public void deleteAllVersions() {
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ super.deleteAllVersions();
+ }
+
+ @Override
+ public Collection<Document> getAllVersions() {
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ return super.getAllVersions();
+ }
+
+ @Override
+ public Document getLatestVersion(boolean major) {
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ return super.getLatestVersion(major);
+ }
+
+ @Override
public InputStream getStream() throws IOException {
if (!saved) {
throw new UnsupportedOperationException();
Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewFolder.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewFolder.java?rev=773161&r1=773160&r2=773161&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewFolder.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewFolder.java Sat May 9 04:29:41 2009
@@ -17,6 +17,7 @@
package org.apache.chemistry.jcr;
import java.io.Serializable;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -28,6 +29,8 @@
import org.apache.chemistry.CMISObject;
import org.apache.chemistry.Document;
import org.apache.chemistry.Folder;
+import org.apache.chemistry.ObjectId;
+import org.apache.chemistry.Unfiling;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jackrabbit.JcrConstants;
@@ -46,11 +49,11 @@
}
@Override
- public List<CMISObject> getChildren(BaseType type, String orderBy) {
+ public List<CMISObject> getChildren(BaseType type) {
if (!saved) {
throw new UnsupportedOperationException();
}
- return super.getChildren(type, orderBy);
+ return super.getChildren(type);
}
@Override
@@ -78,6 +81,47 @@
}
@Override
+ public void add(CMISObject object) {
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ super.add(object);
+ }
+
+ @Override
+ public void remove(CMISObject object) {
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ super.remove(object);
+ }
+
+ @Override
+ public void delete() {
+ // TODO delete of an unsaved folder?
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ super.delete();
+ }
+
+ @Override
+ public Collection<ObjectId> deleteTree(Unfiling unfiling) {
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ return super.deleteTree(unfiling);
+ }
+
+ @Override
+ public List<Folder> getAncestors() {
+ if (!saved) {
+ throw new UnsupportedOperationException();
+ }
+ return super.getAncestors();
+ }
+
+ @Override
public void save() {
if (saved) {
throw new UnsupportedOperationException();
Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java?rev=773161&r1=773160&r2=773161&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrObjectEntry.java Sat May 9 04:29:41 2009
@@ -23,6 +23,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.jcr.Item;
@@ -40,6 +41,7 @@
import org.apache.chemistry.PropertyDefinition;
import org.apache.chemistry.PropertyType;
import org.apache.chemistry.Relationship;
+import org.apache.chemistry.RelationshipDirection;
import org.apache.chemistry.Type;
import org.apache.chemistry.Updatability;
import org.apache.chemistry.impl.simple.SimplePropertyDefinition;
@@ -448,6 +450,53 @@
return false;
}
+ public void applyPolicy(Policy policy) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void delete() {
+ try {
+ Node parent = node.getParent();
+ node.remove();
+ parent.save();
+ } catch (RepositoryException e) {
+ String msg = "Unable to delete object.";
+ log.error(msg, e);
+ }
+ }
+
+ public Collection<Folder> getParents() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Collection<Policy> getPolicies() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public List<Relationship> getRelationships(RelationshipDirection direction,
+ String typeId, boolean includeSubRelationshipTypes) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void move(Folder targetFolder, Folder sourceFolder) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void removePolicy(Policy policy) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public void unfile() {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
public static String getItemId(Item item) throws RepositoryException {
return escape(item.getPath());
}