mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Moved stuff around to be more Alfresco standard.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3658 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.service.cmr.avm;
|
||||
|
||||
|
||||
/**
|
||||
* This is thrown when bad or illegal arguments are passed.
|
||||
* @author britt
|
||||
*/
|
||||
public class AVMBadArgumentException extends AVMException
|
||||
{
|
||||
private static final long serialVersionUID = -3651428546518806565L;
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
*/
|
||||
public AVMBadArgumentException(String msgId)
|
||||
{
|
||||
super(msgId);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
*/
|
||||
public AVMBadArgumentException(String msgId, Object[] msgParams)
|
||||
{
|
||||
super(msgId, msgParams);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param cause
|
||||
*/
|
||||
public AVMBadArgumentException(String msgId, Throwable cause)
|
||||
{
|
||||
super(msgId, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
* @param cause
|
||||
*/
|
||||
public AVMBadArgumentException(String msgId, Object[] msgParams,
|
||||
Throwable cause)
|
||||
{
|
||||
super(msgId, msgParams, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.service.cmr.avm;
|
||||
|
||||
|
||||
/**
|
||||
* This is thrown when a cycle is detected during lookup.
|
||||
* @author britt
|
||||
*/
|
||||
public class AVMCycleException extends AVMException
|
||||
{
|
||||
private static final long serialVersionUID = -7390775107865356648L;
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
*/
|
||||
public AVMCycleException(String msgId)
|
||||
{
|
||||
super(msgId);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
*/
|
||||
public AVMCycleException(String msgId, Object[] msgParams)
|
||||
{
|
||||
super(msgId, msgParams);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param cause
|
||||
*/
|
||||
public AVMCycleException(String msgId, Throwable cause)
|
||||
{
|
||||
super(msgId, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
* @param cause
|
||||
*/
|
||||
public AVMCycleException(String msgId, Object[] msgParams, Throwable cause)
|
||||
{
|
||||
super(msgId, msgParams, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
}
|
65
source/java/org/alfresco/service/cmr/avm/AVMException.java
Normal file
65
source/java/org/alfresco/service/cmr/avm/AVMException.java
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.service.cmr.avm;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
|
||||
/**
|
||||
* Class for generic AVM Exceptions.
|
||||
* @author britt
|
||||
*/
|
||||
public class AVMException extends AlfrescoRuntimeException
|
||||
{
|
||||
private static final long serialVersionUID = -4894449240293309025L;
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
*/
|
||||
public AVMException(String msgId)
|
||||
{
|
||||
super(msgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
*/
|
||||
public AVMException(String msgId, Object[] msgParams)
|
||||
{
|
||||
super(msgId, msgParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param cause
|
||||
*/
|
||||
public AVMException(String msgId, Throwable cause)
|
||||
{
|
||||
super(msgId, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
* @param cause
|
||||
*/
|
||||
public AVMException(String msgId, Object[] msgParams, Throwable cause)
|
||||
{
|
||||
super(msgId, msgParams, cause);
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.service.cmr.avm;
|
||||
|
||||
|
||||
/**
|
||||
* This is thrown when a node exists and shouldn't.
|
||||
* @author britt
|
||||
*/
|
||||
public class AVMExistsException extends AVMException
|
||||
{
|
||||
private static final long serialVersionUID = -5079803858722700975L;
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
*/
|
||||
public AVMExistsException(String msgId)
|
||||
{
|
||||
super(msgId);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
*/
|
||||
public AVMExistsException(String msgId, Object[] msgParams)
|
||||
{
|
||||
super(msgId, msgParams);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param cause
|
||||
*/
|
||||
public AVMExistsException(String msgId, Throwable cause)
|
||||
{
|
||||
super(msgId, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
* @param cause
|
||||
*/
|
||||
public AVMExistsException(String msgId, Object[] msgParams, Throwable cause)
|
||||
{
|
||||
super(msgId, msgParams, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
}
|
435
source/java/org/alfresco/service/cmr/avm/AVMNodeDescriptor.java
Normal file
435
source/java/org/alfresco/service/cmr/avm/AVMNodeDescriptor.java
Normal file
@@ -0,0 +1,435 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.service.cmr.avm;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.repo.avm.AVMNodeType;
|
||||
|
||||
/**
|
||||
* This class describes an AVM node object.
|
||||
* It serves a similar purpose to the data structure
|
||||
* returned by the stat() system call in UNIX.
|
||||
*
|
||||
* @author britt
|
||||
*/
|
||||
public class AVMNodeDescriptor implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -7959606980486852184L;
|
||||
|
||||
/**
|
||||
* The path that this was looked up with.
|
||||
*/
|
||||
private String fPath;
|
||||
|
||||
/**
|
||||
* The base name of the path.
|
||||
*/
|
||||
private String fName;
|
||||
|
||||
/**
|
||||
* The type of this node. AVMNodeType constants.
|
||||
*/
|
||||
private int fType;
|
||||
|
||||
/**
|
||||
* The Owner.
|
||||
*/
|
||||
private String fOwner;
|
||||
|
||||
/**
|
||||
* The Creator.
|
||||
*/
|
||||
private String fCreator;
|
||||
|
||||
/**
|
||||
* The last modifier.
|
||||
*/
|
||||
private String fLastModifier;
|
||||
|
||||
/**
|
||||
* The Create date.
|
||||
*/
|
||||
private long fCreateDate;
|
||||
|
||||
/**
|
||||
* The Modification date.
|
||||
*/
|
||||
private long fModDate;
|
||||
|
||||
/**
|
||||
* The Access date.
|
||||
*/
|
||||
private long fAccessDate;
|
||||
|
||||
/**
|
||||
* The object id.
|
||||
*/
|
||||
private long fID;
|
||||
|
||||
/**
|
||||
* The version number.
|
||||
*/
|
||||
private int fVersionID;
|
||||
|
||||
/**
|
||||
* The indirection if this is a layer.
|
||||
*/
|
||||
private String fIndirection;
|
||||
|
||||
/**
|
||||
* Is this a primary indirection node.
|
||||
*/
|
||||
private boolean fIsPrimary;
|
||||
|
||||
/**
|
||||
* The layer id or -1 if this is not a layered node.
|
||||
*/
|
||||
private long fLayerID;
|
||||
|
||||
/**
|
||||
* The length, if this is a file or -1 otherwise.
|
||||
*/
|
||||
private long fLength;
|
||||
|
||||
/**
|
||||
* The opacity for layered directories.
|
||||
*/
|
||||
private boolean fOpacity;
|
||||
|
||||
/**
|
||||
* Make one up.
|
||||
* @param path The looked up path.
|
||||
* @param type The type of the node.
|
||||
* @param creator The creator of the node.
|
||||
* @param owner The owner of the node.
|
||||
* @param lastModifier The last modifier of the node.
|
||||
* @param createDate The creation date.
|
||||
* @param modDate The modification date.
|
||||
* @param accessDate The access date.
|
||||
* @param id The object id.
|
||||
* @param versionID The version id.
|
||||
* @param indirection The indirection.
|
||||
* @param isPrimary Whether this is a primary indirection.
|
||||
* @param layerID The layer id.
|
||||
* @param length The file length.
|
||||
*/
|
||||
public AVMNodeDescriptor(String path,
|
||||
String name,
|
||||
int type,
|
||||
String creator,
|
||||
String owner,
|
||||
String lastModifier,
|
||||
long createDate,
|
||||
long modDate,
|
||||
long accessDate,
|
||||
long id,
|
||||
int versionID,
|
||||
String indirection,
|
||||
boolean isPrimary,
|
||||
long layerID,
|
||||
boolean opacity,
|
||||
long length)
|
||||
{
|
||||
fPath = path;
|
||||
fName = name;
|
||||
fType = type;
|
||||
fCreator = creator;
|
||||
fOwner = owner;
|
||||
fLastModifier = lastModifier;
|
||||
fCreateDate = createDate;
|
||||
fModDate = modDate;
|
||||
fAccessDate = accessDate;
|
||||
fID = id;
|
||||
fVersionID = versionID;
|
||||
fIndirection = indirection;
|
||||
fIsPrimary = isPrimary;
|
||||
fLayerID = layerID;
|
||||
fLength = length;
|
||||
fOpacity = opacity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last access date in java milliseconds.
|
||||
* @return The last access date.
|
||||
*/
|
||||
public long getAccessDate()
|
||||
{
|
||||
return fAccessDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the creation date in java milliseconds.
|
||||
* @return The creation date.
|
||||
*/
|
||||
public long getCreateDate()
|
||||
{
|
||||
return fCreateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user who created this.
|
||||
* @return The creator.
|
||||
*/
|
||||
public String getCreator()
|
||||
{
|
||||
return fCreator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the indirection path if this is layered or null.
|
||||
* @return The indirection path or null.
|
||||
*/
|
||||
public String getIndirection()
|
||||
{
|
||||
return fIndirection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a primary indirection node. Will always
|
||||
* be false for non-layered nodes.
|
||||
* @return Whether this is a primary indirection node.
|
||||
*/
|
||||
public boolean isPrimary()
|
||||
{
|
||||
return fIsPrimary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this node corresponds to
|
||||
* either a plain or layered file.
|
||||
*
|
||||
* @return true if AVMNodeDescriptor is a plain or layered file,
|
||||
* otherwise false.
|
||||
*/
|
||||
public boolean isFile()
|
||||
{
|
||||
return ( fType == AVMNodeType.PLAIN_FILE ||
|
||||
fType == AVMNodeType.LAYERED_FILE
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this node corresponds to
|
||||
* a plain (non-layered) file.
|
||||
*
|
||||
* @return true if AVMNodeDescriptor is a plain file, otherwise false.
|
||||
*/
|
||||
public boolean isPlainFile()
|
||||
{
|
||||
return (fType == AVMNodeType.PLAIN_FILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this node corresponds to
|
||||
* a layered file.
|
||||
*
|
||||
* @return true if AVMNodeDescriptor is a layered file,
|
||||
* otherwise false.
|
||||
*/
|
||||
public boolean isLayeredFile()
|
||||
{
|
||||
return (fType == AVMNodeType.LAYERED_FILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this node corresponds to
|
||||
* either a plain or layered directory.
|
||||
*
|
||||
* @return true if AVMNodeDescriptor is a plain or layered directory,
|
||||
* otherwise false.
|
||||
*/
|
||||
public boolean isDirectory()
|
||||
{
|
||||
return ( fType == AVMNodeType.PLAIN_DIRECTORY ||
|
||||
fType == AVMNodeType.LAYERED_DIRECTORY
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this node corresponds to
|
||||
* a plain (non-layered) directory.
|
||||
*
|
||||
* @return true if AVMNodeDescriptor is a plain directory, otherwise false.
|
||||
*/
|
||||
public boolean isPlainDirectory()
|
||||
{
|
||||
return (fType == AVMNodeType.PLAIN_DIRECTORY );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this node corresponds to
|
||||
* a layered directory.
|
||||
*
|
||||
* @return true if AVMNodeDescriptor is a layered directory,
|
||||
* otherwise false.
|
||||
*/
|
||||
public boolean isLayeredDirectory()
|
||||
{
|
||||
return (fType == AVMNodeType.LAYERED_DIRECTORY );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the user who last modified this node.
|
||||
* @return Who last modified this node.
|
||||
*/
|
||||
public String getLastModifier()
|
||||
{
|
||||
return fLastModifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the layer id of this node.
|
||||
* @return The layer id if there is one or -1.
|
||||
*/
|
||||
public long getLayerID()
|
||||
{
|
||||
return fLayerID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the modification date of this node.
|
||||
* @return The modification date.
|
||||
*/
|
||||
public long getModDate()
|
||||
{
|
||||
return fModDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the owner of this node.
|
||||
* @return The owner of this node.
|
||||
*/
|
||||
public String getOwner()
|
||||
{
|
||||
return fOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path that this node was looked up by.
|
||||
* @return The path by which this was looked up.
|
||||
*/
|
||||
public String getPath()
|
||||
{
|
||||
return fPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of this node. AVMNodeType constants.
|
||||
* @return The type node.
|
||||
*/
|
||||
public int getType()
|
||||
{
|
||||
return fType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version id of this node.
|
||||
* @return The version id of this node.
|
||||
*/
|
||||
public int getVersionID()
|
||||
{
|
||||
return fVersionID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the object id.
|
||||
* @return The object id.
|
||||
*/
|
||||
public long getId()
|
||||
{
|
||||
return fID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file length if applicable.
|
||||
* @return The file length.
|
||||
*/
|
||||
public long getLength()
|
||||
{
|
||||
return fLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the node.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the opacity
|
||||
*/
|
||||
public boolean getOpacity()
|
||||
{
|
||||
return fOpacity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a debuggable string representation of this.
|
||||
* @return A string representation of this.
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
switch (fType)
|
||||
{
|
||||
case AVMNodeType.PLAIN_FILE :
|
||||
return "[PF:" + fID + "]";
|
||||
case AVMNodeType.PLAIN_DIRECTORY :
|
||||
return "[PD:" + fID + "]";
|
||||
case AVMNodeType.LAYERED_FILE :
|
||||
return "[LF:" + fID + ":" + fIndirection + "]";
|
||||
case AVMNodeType.LAYERED_DIRECTORY :
|
||||
return "[LD:" + fID + ":" + fIndirection + "]";
|
||||
default :
|
||||
throw new AVMException("Internal Error.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equals override.
|
||||
* @param obj
|
||||
* @return Equality.
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof AVMNodeDescriptor))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return fID == ((AVMNodeDescriptor)obj).fID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hashcode override.
|
||||
* @return The objid as hashcode.
|
||||
*/
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return (int)fID;
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.service.cmr.avm;
|
||||
|
||||
|
||||
/**
|
||||
* This is the exception thrown when a node is not found.
|
||||
* @author britt
|
||||
*/
|
||||
public class AVMNotFoundException extends AVMException
|
||||
{
|
||||
private static final long serialVersionUID = -8131080195448129281L;
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
* @param cause
|
||||
*/
|
||||
public AVMNotFoundException(String msgId, Object[] msgParams, Throwable cause)
|
||||
{
|
||||
super(msgId, msgParams, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
*/
|
||||
public AVMNotFoundException(String msgId, Object[] msgParams)
|
||||
{
|
||||
super(msgId, msgParams);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param cause
|
||||
*/
|
||||
public AVMNotFoundException(String msgId, Throwable cause)
|
||||
{
|
||||
super(msgId, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
*/
|
||||
public AVMNotFoundException(String msgId)
|
||||
{
|
||||
super(msgId);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
}
|
590
source/java/org/alfresco/service/cmr/avm/AVMService.java
Normal file
590
source/java/org/alfresco/service/cmr/avm/AVMService.java
Normal file
@@ -0,0 +1,590 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.service.cmr.avm;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* This is the service interface for the [Alfresco|Addled|Advanced|Aleatoric|Apotheosed|Awful]
|
||||
* Versioning Model. It specifies methods that are close in functionality to the underlying
|
||||
* implementation, and is intended as both a first class Alfresco service and an
|
||||
* aid in creating new implementations of existing services.
|
||||
* Paths are of the form storename:/foo/bar/baz.
|
||||
* @author britt
|
||||
*/
|
||||
public interface AVMService
|
||||
{
|
||||
/**
|
||||
* Get an InputStream for a file node.
|
||||
* @param version The version id to look in.
|
||||
* @param path The simple absolute path to the file node.
|
||||
* @return An InputStream for the designated file.
|
||||
* @throws AVMNotFoundException If <code>path</code> is not found.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* component that is not a Directory of if it does not point at a file.
|
||||
*/
|
||||
public InputStream getFileInputStream(int version, String path);
|
||||
|
||||
/**
|
||||
* Get an output stream to a file node. The file must already exist.
|
||||
* @param path The simple absolute path to the file node.
|
||||
* @throws AVMNotFoundException If <code>path</code> is not found.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* component that is not a directory, or if it is not pointing to a file.
|
||||
*/
|
||||
public OutputStream getFileOutputStream(String path);
|
||||
|
||||
/**
|
||||
* Get a listing of a Folder by name.
|
||||
* @param version The version id to look in.
|
||||
* @param path The simple absolute path to the file node.
|
||||
* @return A Map of names to descriptors.
|
||||
* @throws AVMNotFoundException If <code>path</code> is not found.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* component that is not a directory, or if <code>path</code> is not pointing
|
||||
* at a directory.
|
||||
*/
|
||||
public SortedMap<String, AVMNodeDescriptor> getDirectoryListing(int version, String path);
|
||||
|
||||
/**
|
||||
* Get the listing of nodes contained directly in a directory. This is the
|
||||
* same as getDirectoryListing for PlainDirectories, but returns only those that
|
||||
* are directly contained in a layered directory.
|
||||
* @param version The version to look up.
|
||||
* @param path The full path to get listing for.
|
||||
* @return A Map of names to descriptors.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains any non-directory
|
||||
* elements.
|
||||
*/
|
||||
public SortedMap<String, AVMNodeDescriptor>
|
||||
getDirectoryListingDirect(int version, String path);
|
||||
|
||||
/**
|
||||
* Get a directory listing from a node descriptor.
|
||||
* @param dir The directory node descriptor.
|
||||
* @return A Map of names to node descriptors.
|
||||
* @throws AVMNotFoundException If the descriptor is stale.
|
||||
* @throws AVMWrongTypeException If the descriptor does not point at
|
||||
* a directory.
|
||||
*/
|
||||
public SortedMap<String, AVMNodeDescriptor> getDirectoryListing(AVMNodeDescriptor dir);
|
||||
|
||||
/**
|
||||
* Get the names of nodes that have been deleted in a directory.
|
||||
* @param version The version to look under.
|
||||
* @param path The path of the directory.
|
||||
* @return A List of names.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains any elements
|
||||
* that are not directories.
|
||||
*/
|
||||
public List<String> getDeleted(int version, String path);
|
||||
|
||||
/**
|
||||
* Create a new File. Fails if the file already exists.
|
||||
* @param path The simple absolute path to the parent.
|
||||
* @param name The name to give the file.
|
||||
* @throws AVMNotFound If <code>path</code> is non existent.
|
||||
* @throws AVMExists If <code>name</code> already exists.
|
||||
* @throws AVMWrongType If some component of <code>path</code> is not
|
||||
* a directory.
|
||||
*/
|
||||
public OutputStream createFile(String path, String name);
|
||||
|
||||
/**
|
||||
* Create a new File. Guarantees that the entire contents of the
|
||||
* input stream will be loaded atomically.
|
||||
* @param path The path to the parent directory.
|
||||
* @param name The name for the new file.
|
||||
* @param in An input stream with data for the file.
|
||||
* @throws AVMNotFound If <code>path</code> is non existent.
|
||||
* @throws AVMExists If <code>name</code> already exists.
|
||||
* @throws AVMWrongType If some component of <code>path</code> is not
|
||||
* a directory.
|
||||
*/
|
||||
public void createFile(String path, String name, InputStream in);
|
||||
|
||||
/**
|
||||
* Create a new directory.
|
||||
* @param path The simple absolute path to the parent.
|
||||
* @param name The name to give the folder.
|
||||
* @throws AVMNotFound If <code>path</code> is non existent.
|
||||
* @throws AVMExists If <code>name</code> already exists.
|
||||
* @throws AVMWrongType If some component of <code>path</code> is not
|
||||
* a directory.
|
||||
*/
|
||||
public void createDirectory(String path, String name);
|
||||
|
||||
/**
|
||||
* Create a new layered file.
|
||||
* @param targetPath The simple absolute path that the new file will point at.
|
||||
* @param parent The simple absolute path to the parent.
|
||||
* @param name The name to give the new file.
|
||||
* @throws AVMNotFound If <code>parent</code> is non existent.
|
||||
* @throws AVMExists If <code>name</code> already exists.
|
||||
* @throws AVMWrongType If some component of <code>parent</code> is not
|
||||
* a directory.
|
||||
*/
|
||||
public void createLayeredFile(String targetPath, String parent, String name);
|
||||
|
||||
/**
|
||||
* Create a new layered directory.
|
||||
* @param targetPath The simple absolute path that the new folder will point at.
|
||||
* @param parent The simple absolute path to the parent.
|
||||
* @param name The name to give the new folder.
|
||||
* @throws AVMNotFound If <code>parent</code> is non existent.
|
||||
* @throws AVMExists If <code>name</code> already exists.
|
||||
* @throws AVMWrongType If some component of <code>parent</code> is not
|
||||
* a directory.
|
||||
*/
|
||||
public void createLayeredDirectory(String targetPath, String parent, String name);
|
||||
|
||||
/**
|
||||
* Retarget a layered directory.
|
||||
* @param path Path to the layered directory.
|
||||
* @param target The new target to aim at.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* component that is not a directory or if it does not point at a retargetable
|
||||
* directory.
|
||||
*/
|
||||
public void retargetLayeredDirectory(String path, String target);
|
||||
|
||||
/**
|
||||
* Create a new AVMStore. All AVMStores are top level in a hierarchical
|
||||
* sense.
|
||||
* @param name The name to give the AVMStore.
|
||||
* @throws AVMExistsException If <code>name</code> is an already existing store.
|
||||
*/
|
||||
public void createAVMStore(String name);
|
||||
|
||||
/**
|
||||
* Create a branch from a given version and path.
|
||||
* @param version The version number from which to make the branch.
|
||||
* @param srcPath The path to the node to branch from.
|
||||
* @param dstPath The path to the directory to contain the
|
||||
* new branch.
|
||||
* @param name The name to give the new branch.
|
||||
* @throws AVMNotFoundException If either <code>srcPath</code> or
|
||||
* <code>dstPath</code> does not exist.
|
||||
* @throws AVMExistsException If <code>name</code> already exists.
|
||||
* @throws AVMWrongTypeException If <code>srcPath</code> or <code>dstPath</code>
|
||||
* contains a non-terminal element that is not a directory.
|
||||
*/
|
||||
public void createBranch(int version, String srcPath, String dstPath, String name);
|
||||
|
||||
/**
|
||||
* Remove a child from its parent.
|
||||
* @param parent The simple absolute path to the parent directory.
|
||||
* @param name The name of the child to remove.
|
||||
* @throws AVMNotFoundException If <code>parent</code> or <code>name</code>
|
||||
* does not exist.
|
||||
* @throws AVMWrongTypeException If <code>parent</code> contains a non-terminal
|
||||
* element that is not a directory.
|
||||
*/
|
||||
public void removeNode(String parent, String name);
|
||||
|
||||
/**
|
||||
* Rename a node.
|
||||
* @param srcParent The simple absolute path to the parent folder.
|
||||
* @param srcName The name of the node in the src Folder.
|
||||
* @param dstParent The simple absolute path to the destination folder.
|
||||
* @param dstName The name that the node will have in the destination folder.
|
||||
* @throws AVMNotFoundException If <code>srcParent</code>,
|
||||
* <code>srcName</code>, or <code>dstParent</code> do not exist.
|
||||
* @throws AVMExistsException If <code>dstName</code> already exists.
|
||||
* @throws AVMWrongTypeException If <code>srcParent</code> or
|
||||
* <code>dstParent</code> contain non-terminal elements that are not directories
|
||||
* or if either do not point at directories.
|
||||
*/
|
||||
public void rename(String srcParent, String srcName, String dstParent, String dstName);
|
||||
|
||||
/**
|
||||
* Uncover a name in a layered directory. That is, if the layered
|
||||
* directory has a deleted entry of the given name remove that
|
||||
* name from the deleted list.
|
||||
* @param dirPath The path to the layered directory.
|
||||
* @param name The name to uncover.
|
||||
* @throws AVMNotFoundException If <code>dirPath</code> does not exist.
|
||||
* @throws AVMWrongTypeExceptiont If <code>dirPath</code> contains a non-terminal
|
||||
* element that is not a directory.
|
||||
*/
|
||||
public void uncover(String dirPath, String name);
|
||||
|
||||
/**
|
||||
* Get the latest version id of the AVMStore.
|
||||
* @param storeName The name of the AVMStore.
|
||||
* @return The latest version id of the AVMStore.
|
||||
* @throws AVMNotFoundException If <code>storeName</code> does not exist.
|
||||
*/
|
||||
public int getLatestVersionID(String storeName);
|
||||
|
||||
/**
|
||||
* Snapshot the given AVMStores. When this is called everything that has been added,
|
||||
* deleted, or modified since the last time this function was called, is marked
|
||||
* as needing to be copied, so that further modifications will trigger copy on write
|
||||
* semantics.
|
||||
* @param stores The names of the AVMStores to snapshot.
|
||||
* @return A List of the version ids of the newly created snapshots.
|
||||
* @throws AVMNotFoundException If any of the stores do not exist.
|
||||
*/
|
||||
public List<Integer> createSnapshot(List<String> stores);
|
||||
|
||||
/**
|
||||
* Snapshot the given AVMStore.
|
||||
* @param store The name of the AVMStore to snapshot.
|
||||
* @throws AVMNotFoundException If <code>store</code> does not exist.
|
||||
*/
|
||||
public int createSnapshot(String store);
|
||||
|
||||
/**
|
||||
* Get the set of versions in an AVMStore
|
||||
* @param name The name of the AVMStore.
|
||||
* @return A Set of version IDs
|
||||
* @throws AVMNotFoundException If <code>name</code> does not exist.
|
||||
*/
|
||||
public List<VersionDescriptor> getAVMStoreVersions(String name);
|
||||
|
||||
/**
|
||||
* Get AVMStore version descriptors by creation date. Either from or
|
||||
* to can be null but not both.
|
||||
* @param name The name of the AVMStore.
|
||||
* @param from Earliest date of version to include.
|
||||
* @param to Latest date of version to include.
|
||||
* @return The Set of version IDs that match.
|
||||
* @throws AVMNotFoundException If <code>name</code> does not exist.
|
||||
*/
|
||||
public List<VersionDescriptor> getAVMStoreVersions(String name, Date from, Date to);
|
||||
|
||||
/**
|
||||
* Get the descriptors of all AVMStores.
|
||||
* @return A List of all AVMStores.
|
||||
*/
|
||||
public List<AVMStoreDescriptor> getAVMStores();
|
||||
|
||||
/**
|
||||
* Get a descriptor for an AVMStore.
|
||||
* @param name The AVMStore's name.
|
||||
* @return A Descriptor.
|
||||
* @throws AVMNotFoundException If <code>name</code> does not exist.
|
||||
*/
|
||||
public AVMStoreDescriptor getAVMStore(String name);
|
||||
|
||||
/**
|
||||
* Get the specified root of an AVMStore.
|
||||
* @param version The version to look up.
|
||||
* @param name The name of the AVMStore.
|
||||
* @return A descriptor for the specified root.
|
||||
* @throws AVMNotFoundException If <code>name</code> does not exist or
|
||||
* if <code>version</code> does not exist.
|
||||
*/
|
||||
public AVMNodeDescriptor getAVMStoreRoot(int version, String name);
|
||||
|
||||
/**
|
||||
* Lookup a node by version ids and path.
|
||||
* @param version The version id to look under.
|
||||
* @param path The simple absolute path to the parent directory.
|
||||
* @return An AVMNodeDescriptor.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist or
|
||||
* if <code>version</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* element that is not a directory.
|
||||
*/
|
||||
public AVMNodeDescriptor lookup(int version, String path);
|
||||
|
||||
/**
|
||||
* Lookup a node from a directory node.
|
||||
* @param dir The descriptor for the directory node.
|
||||
* @param name The name to lookup.
|
||||
* @return The descriptor for the child.
|
||||
* @throws AVMNotFoundException If <code>name</code> does not exist or
|
||||
* if <code>dir</code> is dangling.
|
||||
* @throws AVMWrongTypeException If <code>dir</code> does not refer to a directory.
|
||||
*/
|
||||
public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name);
|
||||
|
||||
/**
|
||||
* Get the indirection path for a layered file or directory.
|
||||
* @param version The version number to get.
|
||||
* @param path The path to the node of interest.
|
||||
* @return The indirection path.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist or
|
||||
* if <code>version</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* element that is not a directory or if it does not refer to a layered
|
||||
* node.
|
||||
*/
|
||||
public String getIndirectionPath(int version, String path);
|
||||
|
||||
/**
|
||||
* Purge an AVMStore. This is a complete wipe of an AVMStore.
|
||||
* @param name The name of the AVMStore.
|
||||
* @throws AVMNotFoundException If <code>name</code> does not exist.
|
||||
*/
|
||||
public void purgeAVMStore(String name);
|
||||
|
||||
/**
|
||||
* Purge a version from an AVMStore. Deletes everything that lives in
|
||||
* the given version only.
|
||||
* @param version The version to purge.
|
||||
* @param name The name of the AVMStore from which to purge it.
|
||||
* @throws AVMNotFoundException If <code>name</code> or <code>version</code>
|
||||
* do not exist.
|
||||
*/
|
||||
public void purgeVersion(int version, String name);
|
||||
|
||||
/**
|
||||
* Make a directory into a primary indirection node.
|
||||
* @param path The full path.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* element that is not a directory or if it refers to a node that can't be made
|
||||
* primary.
|
||||
*/
|
||||
public void makePrimary(String path);
|
||||
|
||||
/**
|
||||
* Get a list of all the ancestor versions of a node.
|
||||
* @param desc The version of a node to find ancestors for.
|
||||
* @param count How many. -1 means all.
|
||||
* @return A List of ancestors starting with the most recent.
|
||||
* @throws AVMNotFoundException If <code>desc</code> is dangling.
|
||||
*/
|
||||
public List<AVMNodeDescriptor> getHistory(AVMNodeDescriptor desc, int count);
|
||||
|
||||
/**
|
||||
* Set the opacity of a layered directory. An opaque layered directory
|
||||
* hides the contents of its indirection.
|
||||
* @param path The path to the layered directory.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* element that is not a directory or if it refers to a node that cannot have
|
||||
* its opacity set.
|
||||
*/
|
||||
public void setOpacity(String path, boolean opacity);
|
||||
|
||||
/**
|
||||
* Get the common ancestor of two nodes if one exists.
|
||||
* @param left The first node.
|
||||
* @param right The second node.
|
||||
* @return The common ancestor. There are four possible results. Null means
|
||||
* that there is no common ancestor. Left returned means that left is strictly
|
||||
* an ancestor of right. Right returned means that right is strictly an
|
||||
* ancestor of left. Any other non null return is the common ancestor and
|
||||
* indicates that left and right are in conflict.
|
||||
* @throws AVMNotFoundException If <code>left</code> or <code>right</code>
|
||||
* do not exist.
|
||||
*/
|
||||
public AVMNodeDescriptor getCommonAncestor(AVMNodeDescriptor left,
|
||||
AVMNodeDescriptor right);
|
||||
|
||||
/**
|
||||
* Get layering information about a path.
|
||||
* @param version The version to look under.
|
||||
* @param path The full AVM path.
|
||||
* @return A LayeringDescriptor.
|
||||
* @throws AVMNotFoundException If <code>path</code> or <code>version</code>
|
||||
* do not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* element that is not a directory.
|
||||
*/
|
||||
public LayeringDescriptor getLayeringInfo(int version, String path);
|
||||
|
||||
/**
|
||||
* Set a property on a node.
|
||||
* @param path The path to the node to set the property on.
|
||||
* @param name The QName of the property.
|
||||
* @param value The property to set.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* element that is not a directory.
|
||||
*/
|
||||
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 properties to set.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* element that is not a directory.
|
||||
*/
|
||||
public void setNodeProperties(String path, Map<QName, PropertyValue> properties);
|
||||
|
||||
/**
|
||||
* Get a property of a node by QName.
|
||||
* @param version The version to look under.
|
||||
* @param path The path to the node.
|
||||
* @param name The QName.
|
||||
* @return The PropertyValue or null if it doesn't exist.
|
||||
* @throws AVMNotFoundException If <code>path</code> or <code>version</code>
|
||||
* do not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* element that is not a directory.
|
||||
*/
|
||||
public PropertyValue getNodeProperty(int version, String path, QName name);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @throws AVMNotFoundException If <code>path</code> or <code>version</code>
|
||||
* do not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* element that is not a directory.
|
||||
*/
|
||||
public Map<QName, PropertyValue> getNodeProperties(int version, String path);
|
||||
|
||||
/**
|
||||
* Delete a property.
|
||||
* @param path The path to the node.
|
||||
* @param name The QName of the property to delete.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> contains a non-terminal
|
||||
* element that is not a directory.
|
||||
*/
|
||||
public void deleteNodeProperty(String path, QName name);
|
||||
|
||||
/**
|
||||
* Delete all the properties attached to an AVM node.
|
||||
* @param path The path to the node.
|
||||
*/
|
||||
public void deleteNodeProperties(String path);
|
||||
|
||||
/**
|
||||
* Set a property on a store. If the property exists it will be overwritten.
|
||||
* @param store The store to set the property on.
|
||||
* @param name The name of the property.
|
||||
* @param value The value of the property.
|
||||
* @throws AVMNotFoundException If <code>store</code>
|
||||
* does not exist.
|
||||
*/
|
||||
public void setStoreProperty(String store, QName name, PropertyValue value);
|
||||
|
||||
/**
|
||||
* Set a group of properties on a store. Existing properties will be overwritten.
|
||||
* @param store The name of the store.
|
||||
* @param props A Map of the properties to set.
|
||||
* @throws AVMNotFoundException If <code>store</code>
|
||||
* does not exist.
|
||||
*/
|
||||
public void setStoreProperties(String store, Map<QName, PropertyValue> props);
|
||||
|
||||
/**
|
||||
* Get a property from a store.
|
||||
* @param store The name of the store.
|
||||
* @param name The name of the property.
|
||||
* @return A PropertyValue or null if non-existent.
|
||||
* @throws AVMNotFoundException If <code>store</code>
|
||||
* does not exist.
|
||||
*/
|
||||
public PropertyValue getStoreProperty(String store, QName name);
|
||||
|
||||
/**
|
||||
* Get all the properties associated with a store.
|
||||
* @param store The name of the store.
|
||||
* @return A Map of the stores properties.
|
||||
* @throws AVMNotFoundException If <code>store</code>
|
||||
* does not exist.
|
||||
*/
|
||||
public Map<QName, PropertyValue> getStoreProperties(String store);
|
||||
|
||||
/**
|
||||
* Delete a property on a store by name.
|
||||
* @param store The name of the store.
|
||||
* @param name The name of the property to delete.
|
||||
* @throws AVMNotFoundException If <code>store</code>
|
||||
* does not exist.
|
||||
*/
|
||||
public void deleteStoreProperty(String store, QName name);
|
||||
|
||||
/**
|
||||
* Get the ContentData for a node. Only applies to a file.
|
||||
* @param version The version to look under.
|
||||
* @param path The path to the node.
|
||||
* @return The ContentData object.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> does not
|
||||
* point to a file.
|
||||
*/
|
||||
public ContentData getContentDataForRead(int version, String path);
|
||||
|
||||
/**
|
||||
* Get the ContentData for a node.
|
||||
* @param path The path to the node.
|
||||
* @return The ContentData object.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> does not point
|
||||
* to a file.
|
||||
*/
|
||||
public ContentData getContentDataForWrite(String path);
|
||||
|
||||
/**
|
||||
* Set the content data on a file.
|
||||
* @param path The path to the file.
|
||||
* @param data The ContentData to set.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMWrongTypeException If <code>path</code> does not point
|
||||
* to a file.
|
||||
*/
|
||||
public void setContentData(String path, ContentData data);
|
||||
|
||||
/**
|
||||
* Add an aspect to an AVM node.
|
||||
* @param path The path to the node.
|
||||
* @param aspectName The QName of the aspect.
|
||||
* @throws AVMNotFoundException If <code>path</code> does not exist.
|
||||
* @throws AVMExistsException If the aspect already exists.
|
||||
*/
|
||||
public void addAspect(String path, QName aspectName);
|
||||
|
||||
/**
|
||||
* Get all the aspects on an AVM 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 List<QName> getAspects(int version, String path);
|
||||
|
||||
/**
|
||||
* Remove an aspect and 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 node have a particular aspect.
|
||||
* @param version The version to look under.
|
||||
* @param path The path to the node.
|
||||
* @param aspectName The aspect name to check.
|
||||
* @return Whether the given node has the given aspect.
|
||||
*/
|
||||
public boolean hasAspect(int version, String path, QName aspectName);
|
||||
}
|
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.service.cmr.avm;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* A value class for Data about an AVMStore.
|
||||
* @author britt
|
||||
*/
|
||||
public class AVMStoreDescriptor implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -4401863082685362175L;
|
||||
|
||||
/**
|
||||
* The name.
|
||||
*/
|
||||
private String fName;
|
||||
|
||||
/**
|
||||
* The creator.
|
||||
*/
|
||||
private String fCreator;
|
||||
|
||||
/**
|
||||
* The create date.
|
||||
*/
|
||||
private long fCreateDate;
|
||||
|
||||
public AVMStoreDescriptor(String name,
|
||||
String creator,
|
||||
long createDate)
|
||||
{
|
||||
fName = name;
|
||||
fCreator = creator;
|
||||
fCreateDate = createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fCreateDate
|
||||
*/
|
||||
public long getCreateDate()
|
||||
{
|
||||
return fCreateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fCreator
|
||||
*/
|
||||
public String getCreator()
|
||||
{
|
||||
return fCreator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fName
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "[" + fName + ":" + fCreator + ":" + new Date(fCreateDate) + "]";
|
||||
}
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.service.cmr.avm;
|
||||
|
||||
|
||||
/**
|
||||
* Thrown when an object of the wrong type is looked up.
|
||||
* @author britt
|
||||
*/
|
||||
public class AVMWrongTypeException extends AVMException
|
||||
{
|
||||
private static final long serialVersionUID = -8799318236851345536L;
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
*/
|
||||
public AVMWrongTypeException(String msgId)
|
||||
{
|
||||
super(msgId);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
*/
|
||||
public AVMWrongTypeException(String msgId, Object[] msgParams)
|
||||
{
|
||||
super(msgId, msgParams);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param cause
|
||||
*/
|
||||
public AVMWrongTypeException(String msgId, Throwable cause)
|
||||
{
|
||||
super(msgId, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msgId
|
||||
* @param msgParams
|
||||
* @param cause
|
||||
*/
|
||||
public AVMWrongTypeException(String msgId, Object[] msgParams,
|
||||
Throwable cause)
|
||||
{
|
||||
super(msgId, msgParams, cause);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.service.cmr.avm;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* A value class containing information about the layering state of a looked up
|
||||
* node.
|
||||
* @author britt
|
||||
*/
|
||||
public class LayeringDescriptor implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -6911813236493434123L;
|
||||
|
||||
/**
|
||||
* Whether the node is a background node.
|
||||
*/
|
||||
private boolean fIsBackground;
|
||||
|
||||
/**
|
||||
* The store descriptor for the top level lookup.
|
||||
*/
|
||||
private AVMStoreDescriptor fContainingStore;
|
||||
|
||||
/**
|
||||
* The store descriptor for the layer on which the node was finally found.
|
||||
*/
|
||||
private AVMStoreDescriptor fFinalStore;
|
||||
|
||||
/**
|
||||
* Make one up.
|
||||
* @param isBackground
|
||||
* @param containingStore
|
||||
* @param finalStore
|
||||
*/
|
||||
public LayeringDescriptor(boolean isBackground,
|
||||
AVMStoreDescriptor containingStore,
|
||||
AVMStoreDescriptor finalStore)
|
||||
{
|
||||
fIsBackground = isBackground;
|
||||
fContainingStore = containingStore;
|
||||
fFinalStore = finalStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the store that the original path is in.
|
||||
* @return An AVMStoreDescriptor.
|
||||
*/
|
||||
public AVMStoreDescriptor getPathAVMStore()
|
||||
{
|
||||
return fContainingStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the store that the final node was in.
|
||||
* @return An AVMStoreDescriptor.
|
||||
*/
|
||||
public AVMStoreDescriptor getNativeAVMStore()
|
||||
{
|
||||
return fFinalStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the node a background node.
|
||||
* @return Whether the node is a background node.
|
||||
*/
|
||||
public boolean isBackground()
|
||||
{
|
||||
return fIsBackground;
|
||||
}
|
||||
}
|
119
source/java/org/alfresco/service/cmr/avm/VersionDescriptor.java
Normal file
119
source/java/org/alfresco/service/cmr/avm/VersionDescriptor.java
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.alfresco.service.cmr.avm;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* All the information about a particular version.
|
||||
* @author britt
|
||||
*/
|
||||
public class VersionDescriptor implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 9045221398461856268L;
|
||||
|
||||
/**
|
||||
* The name of the store this version belongs to.
|
||||
*/
|
||||
private String fAVMStoreName;
|
||||
|
||||
/**
|
||||
* The version id.
|
||||
*/
|
||||
private int fVersionID;
|
||||
|
||||
/**
|
||||
* The creator of this version.
|
||||
*/
|
||||
private String fCreator;
|
||||
|
||||
/**
|
||||
* The date of this version's creation.
|
||||
*/
|
||||
private long fCreateDate;
|
||||
|
||||
/**
|
||||
* New one up.
|
||||
* @param storeName The store name.
|
||||
* @param versionID The version id.
|
||||
* @param creator The creator.
|
||||
* @param createDate The create date.
|
||||
*/
|
||||
public VersionDescriptor(String storeName,
|
||||
int versionID,
|
||||
String creator,
|
||||
long createDate)
|
||||
{
|
||||
fAVMStoreName = storeName;
|
||||
fVersionID = versionID;
|
||||
fCreator = creator;
|
||||
fCreateDate = createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the store name.
|
||||
* @return The store name.
|
||||
*/
|
||||
public String getAVMStoreName()
|
||||
{
|
||||
return fAVMStoreName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the version ID
|
||||
* @return The version ID
|
||||
*/
|
||||
public int getVersionID()
|
||||
{
|
||||
return fVersionID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the creator of this version.
|
||||
* @return The creator.
|
||||
*/
|
||||
public String getCreator()
|
||||
{
|
||||
return fCreator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the creation date.
|
||||
* @return The creation date.
|
||||
*/
|
||||
public long getCreateDate()
|
||||
{
|
||||
return fCreateDate;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("[");
|
||||
builder.append(fAVMStoreName);
|
||||
builder.append(":");
|
||||
builder.append("" + fVersionID);
|
||||
builder.append(":");
|
||||
builder.append(fCreator);
|
||||
builder.append(":");
|
||||
builder.append(new Date(fCreateDate).toString());
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user