Dave Ward 051508c21d Merged PATCHES/V3.2.r to HEAD
19546: (RECORD ONLY) Merged V3.2 to PATCHES/V3.2.r
      19432: Merged V3.1 to V3.2
         19427: Merged V3.0 to V3.1
            19423: Merged V2.2 to V3.0
               19391: Fix for ALF-2076: AUTO does not work if a document has been added and deleted since the index backup
               19419: V2.2 Build Fix
               19421: Fix for ALF-2076: AUTO does not work if a document has been added and deleted since the index backup
      19463: Merged V3.1 to V3.2
         19459: Merged V3.0 to V3.1
            19457: Merged V2.2 to V3.0
               19449: Addition Fix for ALF-2076: AUTO does not work if a document has been added and deleted since the index backup
      19493 Merged V3.1 to V3.2
         19471: Build fix after changes for ALF-2076 were merged forward. Index checker correctly understands INDETERMINATE state of indexed transactions
   19547: (RECORD ONLY) Incremented version label
   19555: (RECORD ONLY) Merged V3.2 to PATCHES/V3.2.r
      19552: Merged V3.1 to V3.2
         19551: Further fix after changes for ALF-2076 were merged forward. Final fix to check for InIndex.No
   19566: (RECORD ONLY) Merged V3.2 to PATCHES/V3.2.r
      19539: Merged HEAD to V3.2
         19538: ALF-2076: Build fix - fix build speed
   19802: (RECORD ONLY) ALF-2382, ALF-2383: Merged V3.2 to PATCHES/V3.2.r
      19647: ALF-2231: Merged DEV/BELARUS/V2.2-2009_12_01 to V3.2 
         17704: ENH-681: alfresco webdav does not respect webdav locks 
      19624: ALF-2231: Merged DEV/BELARUS/V2.2-2009_12_01 to V3.2
         17704: ENH-681: alfresco webdav does not respect webdav locks
      19623: ALF-1890: Correction to previous checkin to allow defaulting of request body charset
      19617: ALF-1890: Improvements to make ALL WebDAV methods retryable
         - Solution from PutMethod promoted to request wrapper that will handle ALL calls to getInputStream and getReader
      19614: ALF-1890: Merged V2.2 to V3.2
         17709: Merged DEV_TEMPORARY to V2.2
            17700: ETWOTWO-1393: concurrent writes to webdav lead to data loss (0kb resulting file)
         19613: Merged DEV/BELARUS/V2.2-2010_02_03 to V2.2
            19157: ALF-1890: concurrent writes to webdav lead to data loss (0kb resulting file)
   19803: ALF-558: File servers (CIFS / FTP / NFS) can now handle concurrent write operations on Alfresco repository
      - ContentDiskDriver / AVMDiskDriver now use retrying transactions for write operations
      - Disable EagerContentStoreCleaner on ContentDiskDriver / AVMDiskDriver closeFile() operations so that they may be retried after rollback (Sony zero byte problem)
      - Allow manual association of AVM ContentData with nodes so that closeFile() may be retried
      - Propagation of new argument through AVM interfaces
   19804: (RECORD ONLY) Merged PATCHES/V3.2.0 to PATCHES/V3.2.r
      Merged HEAD to V3.2.0
         19786: Refactor of previous test fix. I have pushed down the OOo-specific parts of the change from AbstractContentTransformerTest to OpenOfficeContentTransformerTest leaving an extension point in the base class should other transformations need to be excluded in the future.
         19785: Fix for failing test OpenOfficeContentTransformerTest.testAllConversions.
            Various OOo-related transformations are returned as available but fail on our test server with OOo on it.
            Pending further work on these failings, I am disabling those transformations in test code whilst leaving them available in the product code. This is because in the wild a different OOo version may succeed with these transformations.
            I had previously explicitly disabled 3 transformations in the product and I am moving that restriction from product to test code for the same reason.
         19707: Return value from isTransformationBlocked was inverted. Fixed now.
         19705: Refinement of previous check-in re OOo transformations.
            I have pulled up the code that handles blocked transformations into a superclass so that the JodConverter-based transformer worker can inherit the same list of blocked transformations. To reiterate, blocked transformations are those that the OOo integration code believes should work but which are broken in practice. These are blocked by the transformers and will always be unavailable regardless of the OOo connection state.
         19702: Fix for HEAD builds running on panda build server.
            OOo was recently installed on panda which has activated various OOo-related transformations/extractions in the test code.
            It appears that OOo does not support some transformations from Office 97 to Office 2007. Specifically doc to docx and xls to xlsx. These transformations have now been marked as unavailable.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20004 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2010-04-27 10:57:47 +00:00

538 lines
17 KiB
Java

/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. */
package org.alfresco.repo.avm;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import org.alfresco.repo.domain.DbAccessControlList;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
import org.alfresco.service.cmr.avm.VersionDescriptor;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.namespace.QName;
/**
* The store interface. Methods for filesystem like, versioning,
* and layering operations.
* @author britt
*/
public interface AVMStore
{
/**
* Get the primary key.
*/
public long getId();
/**
* This returns the next version in this store that will be snapshotted.
* @return The next version to be snapshotted.
*/
public int getNextVersionID();
/**
* This gets the last extant version id.
*/
public int getLastVersionID();
/**
* Set a new root for this store.
* @param root The root to set.
*/
public void setNewRoot(DirectoryNode root);
/**
* Get the Acl associated with this store.
* @return
*/
public DbAccessControlList getStoreAcl();
/**
* Set the acl on this store.
* @param acl
*/
public void setStoreAcl(DbAccessControlList acl);
/**
* Snapshots this store. This sets all nodes in the
* the store to the should be copied state, and creates
* a new version root.
* @param tag The short description.
* @param description The long description.
* @param snapShotMap Keeps track of snapshot ids for all stores that
* end up snapshotted, possibly recursively.
* @return The map of all implicitely and explicitely snapshotted stores.
*/
public Map<String, Integer> createSnapshot(String tag, String Description, Map<String, Integer> snapShotMap);
/**
* Create a new directory.
* @param path The path to the parent directory.
* @param name The name to give the new directory.
*/
public void createDirectory(String path, String name, List<QName> aspects, Map<QName, PropertyValue> properties);
/**
* Create a new layered directory.
* @param srcPath The path that the new layered directory will point at.
* @param dstPath The path to the directory to create the new layered directory in.
* @param name The name of the new layered directory.
*/
public void createLayeredDirectory(String srcPath, String dstPath,
String name);
/**
* Create a new file. The designated file cannot already exist.
* @param path The path to the directory to contain the new file.
* @param name The name to give the new file.
* @return An OutputStream.
*/
public OutputStream createFile(String path, String name);
/**
* Create a file with the given contents.
* @param path The path to the containing directory.
* @param name The name to give the file.
* @param data The contents of the file.
*/
public void createFile(String path, String name, File data, List<QName> aspects, Map<QName, PropertyValue> properties);
/**
* Create a new layered file.
* @param srcPath The target path for the new file.
* @param dstPath The path to the directory to make the new file in.
* @param name The name of the new file.
*/
public void createLayeredFile(String srcPath, String dstPath, String name);
/**
* Get an InputStream from a file.
* @param version The version to look under.
* @param path The path to the file.
* @return An InputStream
*/
public InputStream getInputStream(int version, String path);
/**
* Get a ContentReader from a file.
* @param version The version to look under.
* @param path The path to the file.
* @return A ContentReader
*/
public ContentReader getContentReader(int version, String path);
/**
* Get a listing of the designated directory.
* @param version The version to look under.
* @param path The path to the directory.
* @param includeDeleted Whether to see Deleted nodes.
* @return A listing.
*/
public SortedMap<String, AVMNodeDescriptor> getListing(int version, String path,
boolean includeDeleted);
/**
* Get the list of nodes directly contained in a directory.
* @param version The version to look under.
* @param path The path to the directory.
* @param includeDeleted Whether to see Deleted nodes.
* @return A Map of names to descriptors.
*/
public SortedMap<String, AVMNodeDescriptor> getListingDirect(int version, String path,
boolean includeDeleted);
/**
* Get the names of the deleted nodes in a directory.
* @param version The version to look under.
* @param path The path to the directory.
* @return A List of names.
*/
public List<String> getDeleted(int version, String path);
/**
* Get an output stream to a file.
* @param path The path to the file.
* @return An OutputStream
*/
public OutputStream getOutputStream(String path);
/**
* Get a ContentWriter to a file.
* @param path The path to the file.
* @param update true if the property must be updated atomically when the content write
* stream is closed (attaches a listener to the stream); false if the client code
* will perform the updates itself.
* @return A ContentWriter.
*/
public ContentWriter createContentWriter(String path, boolean update);
/**
* Remove a node and all of its contents.
* @param path The path to the node's parent directory.
* @param name The name of the node to remove.
*/
public void removeNode(String path, String name);
/**
* Uncover a whited out node.
* @param dirPath The path to the directory.
* @param name The name to uncover.
*/
public void uncover(String dirPath, String name);
// TODO This is problematic. As time goes on this returns
// larger and larger data sets. Perhaps what we should do is
// provide methods for getting versions by date range, n most
// recent etc.
/**
* Get all the version for this AVMStore.
* @return A Set of all versions.
*/
public List<VersionDescriptor> getVersions();
/**
* Get all the versions starting from the last until the version specified
* @param version - the version which which to end
* @return - the versions in descending order
*/
public List<VersionDescriptor> getVersionsFrom(int version);
/**
* Get all the versions after and including the one specified
* @param version - the version to start from
* @return - the versions in ascending order
*/
public List<VersionDescriptor> getVersionsTo(int version);
/**
* Get all versions from an including startVersion up to but NOT including endVersion
* @param startVersion
* @param endVersion
* @return - the versions in ascending order
*/
public List<VersionDescriptor> getVersionsBetween(int startVersion, int endVersion);
/**
* Get the versions from between the given dates. From or to
* may be null but not both.
* @param from The earliest date.
* @param to The latest date.
* @return The Set of matching version IDs.
*/
public List<VersionDescriptor> getVersions(Date from, Date to);
/**
* Get the AVMRepository.
* @return The AVMRepository.
*/
public AVMRepository getAVMRepository();
/**
* Lookup a node.
* @param version The version to look under.
* @param path The path to the node.
* @param write Whether this is in a write context.
* @param includeDeleted Whether to see Deleted nodes.
* @return A Lookup object.
*/
public Lookup lookup(int version, String path, boolean write, boolean includeDeleted);
/**
* Lookup a directory.
* @param version The version to look under.
* @param path The path to the directory.
* @param write Whether this is in a write context.
* @return A Lookup object.
*/
public Lookup lookupDirectory(int version, String path, boolean write);
/**
* For a layered node, get its indirection.
* @param version The version to look under.
* @param path The path to the node.
* @return The indirection.
*/
public String getIndirectionPath(int version, String path);
/**
* Make the indicated directory a primary indirection.
* @param path The AVMRepository relative path.
*/
public void makePrimary(String path);
/**
* Change the target of a layered directory.
* @param path The path to the layered directory.
* @param target The new target path.
*/
public void retargetLayeredDirectory(String path, String target);
/**
* Get the root directory of this AVMStore.
* @return The root directory.
*/
public DirectoryNode getRoot();
/**
* Get the specified root as a descriptor.
* @param version The version to get (-1 for head).
* @return The specified root or null.
*/
public AVMNodeDescriptor getRoot(int version);
/**
* Get the name of this store.
* @return The name.
*/
public String getName();
/**
* Set the name of the store.
* @param name To Set.
*/
public void setName(String name);
/**
* Purge all the nodes reachable only by the given version.
* @param version
*/
public void purgeVersion(int version);
/**
* Get the descriptor for this.
* @return The descriptor.
*/
public AVMStoreDescriptor getDescriptor();
/**
* Set the opacity of a layered directory. An opaque directory hides
* what is pointed at by its indirection.
* @param path The path to the layered directory.
* @param opacity True is opaque; false is not.
*/
public void setOpacity(String path, boolean opacity);
/**
* Set a property on a node.
* @param path The path to the node.
* @param name The name of the property.
* @param value The value to set.
*/
public void setNodeProperty(String path, QName name, PropertyValue value);
/**
* Set a collection of properties on a node.
* @param path The path to the node.
* @param properties The Map of QNames to PropertyValues.
*/
public void setNodeProperties(String path, Map<QName, PropertyValue> properties);
/**
* Get a property by name.
* @param version The version to look under.
* @param path The path to the node.
* @param name The name of the property.
* @return A PropertyValue or null if not found.
*/
public PropertyValue getNodeProperty(int version, String path, QName name);
/**
* Delete a single property from a node.
* @param path The path to the node.
* @param name The name of the property.
*/
public void deleteNodeProperty(String path, QName name);
/**
* Delete all properties from a node.
* @param path The path to the node.
*/
public void deleteNodeProperties(String path);
/**
* Get all the properties associated with a node.
* @param version The version to look under.
* @param path The path to the node.
* @return A Map of QNames to PropertyValues.
*/
public Map<QName, PropertyValue> getNodeProperties(int version, String path);
/**
* Set a property on this store. Replaces if property already exists.
* @param name The QName of the property.
* @param value The actual PropertyValue.
*/
public void setProperty(QName name, PropertyValue value);
/**
* Set a group of properties on this store. Replaces any property that exists.
* @param properties A Map of QNames to PropertyValues to set.
*/
public void setProperties(Map<QName, PropertyValue> properties);
/**
* Get a property by name.
* @param name The QName of the property to fetch.
* @return The PropertyValue or null if non-existent.
*/
public PropertyValue getProperty(QName name);
/**
* Get all the properties associated with this node.
* @return A Map of the properties.
*/
public Map<QName, PropertyValue> getProperties();
/**
* Delete a property.
* @param name The name of the property to delete.
*/
public void deleteProperty(QName name);
/**
* Get the ContentData on a file.
* @param version The version to look under.
* @param path The path to the file.
* @return The ContentData corresponding to the file.
*/
public ContentData getContentDataForRead(int version, String path);
/**
* Get the ContentData for writing.
* @param path The path to the file.
* @return The ContentData object.
*/
public ContentData getContentDataForWrite(String path);
/**
* Set the ContentData for a file.
* @param path The path to the file.
* @param data The ContentData to set.
*/
public void setContentData(String path, ContentData data);
/**
* Set meta data, aspects, properties, acls, from another node.
* @param path The path to the node to set metadata on.
* @param from The node to get the metadata from.
*/
public void setMetaDataFrom(String path, AVMNode from);
/**
* Add an aspect to a node.
* @param path The path to the node.
* @param aspectName The name of the aspect.
*/
public void addAspect(String path, QName aspectName);
/**
* Get all aspects on a given node.
* @param version The version to look under.
* @param path The path to the node.
* @return A List of the QNames of the aspects.
*/
public Set<QName> getAspects(int version, String path);
/**
* Remove an aspect and all its properties from a node.
* @param path The path to the node.
* @param aspectName The name of the aspect.
*/
public void removeAspect(String path, QName aspectName);
/**
* Does a given node have a given aspect.
* @param version The version to look under.
* @param path The path to the node.
* @param aspectName The name of the aspect.
* @return Whether the node has the aspect.
*/
public boolean hasAspect(int version, String path, QName aspectName);
/**
* Set the ACL on a node.
* @param path The path to the node.
* @param acl The ACL to set.
*/
public void setACL(String path, DbAccessControlList acl);
/**
* Get the ACL on a node.
* @param version The version to look under.
* @param path The path to the node.
* @return The ACL.
*/
public DbAccessControlList getACL(int version, String path);
/**
* Link a node into a directory, directly.
* @param parentPath The path to the directory.
* @param name The name to give the node.
* @param toLink The node to link.
*/
public void link(String parentPath, String name, AVMNodeDescriptor toLink);
/**
* Update a link to a node in a directory, directly.
* @param parentPath The path to the directory.
* @param name The name to give the node.
* @param toLink The node to link.
*/
public void updateLink(String parentPath, String name, AVMNodeDescriptor toLink);
/**
* Revert a head path to a given version. This works by cloning
* the version to revert to, and then linking that new version into head.
* The reverted version will have the previous head version as ancestor.
* @param path The path to the parent directory.
* @param name The name of the node to revert.
* @param toRevertTo The descriptor of the version to revert to.
*/
public void revert(String path, String name, AVMNodeDescriptor toRevertTo);
/**
* Set the GUID on a node.
* @param path
* @param guid
*/
public void setGuid(String path, String guid);
/**
* Set the encoding of a file.
* @param path
* @param encoding
*/
public void setEncoding(String path, String encoding);
/**
* Set the mime type of a file.
* @param path
* @param mimeType
*/
public void setMimeType(String path, String mimeType);
}