Class RepositoryDocument
- java.lang.Object
-
- org.apache.manifoldcf.agents.interfaces.RepositoryDocument
-
public class RepositoryDocument extends java.lang.Object
This class contains the complete information for a document, as read from a repository. The generator of this document is one of the repository connectors; the user of the class is the incremental ingester. Data contained within is described in part by a binary stream (which is expected to be processed), and partly by already-extracted textual data. These streams MUST BE CLOSED BY THE CALLER when the repository document instance has been ingested. The streams also WILL NOT ever be reset; they are read to the end once only.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
RepositoryDocument.Security
This class describes allow and deny tokens for a specific security class.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
_rcsid
protected java.io.InputStream
binaryFieldData
protected long
binaryLength
protected java.lang.String
contentMimeType
protected java.util.Date
createdDate
protected java.util.Map<java.lang.String,java.util.Date[]>
dateFields
protected java.util.Map<java.lang.String,java.lang.Object>
fields
protected java.util.Set<java.lang.String>
fieldSet
protected java.lang.String
fileName
protected java.util.Date
indexingDate
protected java.util.Date
modifiedDate
protected java.lang.Long
originalSize
protected java.util.Map<java.lang.String,java.io.Reader[]>
readerFields
protected java.util.List<java.lang.String>
rootPath
static java.lang.String
SECURITY_TYPE_DIRECTORY_LEVEL
static java.lang.String
SECURITY_TYPE_DOCUMENT
static java.lang.String
SECURITY_TYPE_PARENT
static java.lang.String
SECURITY_TYPE_SHARE
protected java.util.Map<java.lang.String,RepositoryDocument.Security>
securityLevels
protected java.util.List<java.lang.String>
sourcePath
protected java.util.Map<java.lang.String,java.lang.String[]>
stringFields
-
Constructor Summary
Constructors Constructor Description RepositoryDocument()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addField(java.lang.String fieldName, java.io.Reader fieldData)
Add/remove a character field.void
addField(java.lang.String fieldName, java.io.Reader[] fieldData)
Add/remove a multivalue character field.void
addField(java.lang.String fieldName, java.lang.String fieldData)
Add a character field.void
addField(java.lang.String fieldName, java.lang.String[] fieldData)
Add/Remove a multivalue character field.void
addField(java.lang.String fieldName, java.util.Date fieldData)
Add/remove a date field.void
addField(java.lang.String fieldName, java.util.Date[] fieldData)
Add/remove a multivalue date field.void
clearFields()
Clear all fields.RepositoryDocument
duplicate()
Create an exact duplicate of this Repository Document.int
fieldCount()
Get the number of fields.long
getBinaryLength()
Get the binary length.java.io.InputStream
getBinaryStream()
Get the binary fields (if any).java.util.Date
getCreatedDate()
Get the document's created date.java.lang.Object[]
getField(java.lang.String fieldName)
Get a field.java.util.Date[]
getFieldAsDates(java.lang.String fieldName)
Get field as an array of Date objects.java.io.Reader[]
getFieldAsReaders(java.lang.String fieldName)
Get a field as an array of Readers.java.lang.String[]
getFieldAsStrings(java.lang.String fieldName)
Get a field as an array of strings.java.util.Iterator<java.lang.String>
getFields()
Iterate through the field name Strings.java.lang.String
getFileName()
Get the file Name.java.util.Date
getIndexingDate()
Get the document's indexing date.java.lang.String
getMimeType()
Get the document's mime type.java.util.Date
getModifiedDate()
Get the document's modified date.java.lang.Long
getOriginalSize()
Get the document's original size.java.util.List<java.lang.String>
getRootPath()
Get the root path for the document.java.lang.String[]
getSecurityACL(java.lang.String securityType)
Get security acl for a given security type.java.lang.String[]
getSecurityDenyACL(java.lang.String securityType)
Get security deny acl for a given security type.protected RepositoryDocument.Security
getSecurityLevel(java.lang.String securityType)
Locate or create a specified security level.java.util.List<java.lang.String>
getSourcePath()
Get the source path for the document.void
removeField(java.lang.String fieldName)
Remove a field.java.util.Iterator<java.lang.String>
securityTypesIterator()
Enumerate the active security types for this document.void
setBinary(java.io.InputStream binaryFieldData, long binaryLength)
Set the binary field.void
setCreatedDate(java.util.Date date)
Set the document's created date.void
setFileName(java.lang.String fileName)
Set the file name.void
setIndexingDate(java.util.Date date)
Set the document's indexing date.void
setMimeType(java.lang.String mimeType)
Set the document's mime type.void
setModifiedDate(java.util.Date date)
Set the document's last-modified date.void
setOriginalSize(java.lang.Long size)
Set the document's original (repository) size.void
setRootPath(java.util.List<java.lang.String> rootPath)
Set the root path for the document.void
setSecurity(java.lang.String securityType, java.lang.String[] acl, java.lang.String[] denyAcl)
Set security values for a given security type.void
setSecurityACL(java.lang.String securityType, java.lang.String[] acl)
Set security acl for a given security type.void
setSecurityDenyACL(java.lang.String securityType, java.lang.String[] denyAcl)
Set security deny acl for a given security type.void
setSourcePath(java.util.List<java.lang.String> sourcePath)
Set the source path for the document.
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
SECURITY_TYPE_DOCUMENT
public static final java.lang.String SECURITY_TYPE_DOCUMENT
- See Also:
- Constant Field Values
-
SECURITY_TYPE_SHARE
public static final java.lang.String SECURITY_TYPE_SHARE
- See Also:
- Constant Field Values
-
SECURITY_TYPE_PARENT
public static final java.lang.String SECURITY_TYPE_PARENT
- See Also:
- Constant Field Values
-
SECURITY_TYPE_DIRECTORY_LEVEL
public static final java.lang.String SECURITY_TYPE_DIRECTORY_LEVEL
- See Also:
- Constant Field Values
-
binaryFieldData
protected java.io.InputStream binaryFieldData
-
binaryLength
protected long binaryLength
-
fieldSet
protected final java.util.Set<java.lang.String> fieldSet
-
fields
protected final java.util.Map<java.lang.String,java.lang.Object> fields
-
stringFields
protected final java.util.Map<java.lang.String,java.lang.String[]> stringFields
-
readerFields
protected final java.util.Map<java.lang.String,java.io.Reader[]> readerFields
-
dateFields
protected final java.util.Map<java.lang.String,java.util.Date[]> dateFields
-
securityLevels
protected final java.util.Map<java.lang.String,RepositoryDocument.Security> securityLevels
-
sourcePath
protected final java.util.List<java.lang.String> sourcePath
-
rootPath
protected final java.util.List<java.lang.String> rootPath
-
fileName
protected java.lang.String fileName
-
contentMimeType
protected java.lang.String contentMimeType
-
createdDate
protected java.util.Date createdDate
-
modifiedDate
protected java.util.Date modifiedDate
-
indexingDate
protected java.util.Date indexingDate
-
originalSize
protected java.lang.Long originalSize
-
-
Method Detail
-
duplicate
public RepositoryDocument duplicate()
Create an exact duplicate of this Repository Document. This is how you are expected to write transformation connectors: you create a duplicate, and override the fields you want to change. For streams etc, only the overridden fields need to be explicitly managed by the transformation connector, since the original fields will be handled by the connector's caller.- Returns:
- the exact duplicate.
-
clearFields
public void clearFields()
Clear all fields.
-
setSourcePath
public void setSourcePath(java.util.List<java.lang.String> sourcePath)
Set the source path for the document.- Parameters:
sourcePath
- is the path.
-
getSourcePath
public java.util.List<java.lang.String> getSourcePath()
Get the source path for the document.- Returns:
- the source path.
-
setRootPath
public void setRootPath(java.util.List<java.lang.String> rootPath)
Set the root path for the document. Must be a subset of the source path.- Parameters:
rootPath
- is the path.
-
getRootPath
public java.util.List<java.lang.String> getRootPath()
Get the root path for the document.- Returns:
- the root path.
-
setOriginalSize
public void setOriginalSize(java.lang.Long size)
Set the document's original (repository) size. Use null to indicate that the size is unknown.- Parameters:
size
- is the size.
-
getOriginalSize
public java.lang.Long getOriginalSize()
Get the document's original size.- Returns:
- the original repository document size, or null if unknown.
-
setCreatedDate
public void setCreatedDate(java.util.Date date)
Set the document's created date. Use null to indicate that the date is unknown.- Parameters:
date
- is the date.
-
getCreatedDate
public java.util.Date getCreatedDate()
Get the document's created date. Returns null of the date is unknown.- Returns:
- the date.
-
setModifiedDate
public void setModifiedDate(java.util.Date date)
Set the document's last-modified date. Use null to indicate that the date is unknown.- Parameters:
date
- is the date.
-
getModifiedDate
public java.util.Date getModifiedDate()
Get the document's modified date. Returns null of the date is unknown.- Returns:
- the date.
-
setIndexingDate
public void setIndexingDate(java.util.Date date)
Set the document's indexing date. Use null to indicate that the date is unknown.- Parameters:
date
- is the date.
-
getIndexingDate
public java.util.Date getIndexingDate()
Get the document's indexing date. Returns null of the date is unknown.- Returns:
- the date.
-
setMimeType
public void setMimeType(java.lang.String mimeType)
Set the document's mime type.- Parameters:
mimeType
- is the mime type.
-
getMimeType
public java.lang.String getMimeType()
Get the document's mime type.- Returns:
- the mime type.
-
getSecurityLevel
protected RepositoryDocument.Security getSecurityLevel(java.lang.String securityType)
Locate or create a specified security level.- Parameters:
securityType
- is the security type.
-
securityTypesIterator
public java.util.Iterator<java.lang.String> securityTypesIterator()
Enumerate the active security types for this document.- Returns:
- an iterator over the security types.
-
setSecurity
public void setSecurity(java.lang.String securityType, java.lang.String[] acl, java.lang.String[] denyAcl)
Set security values for a given security type.- Parameters:
securityType
- is the security type.acl
- is the acl.denyAcl
- is the deny acl.
-
setSecurityACL
public void setSecurityACL(java.lang.String securityType, java.lang.String[] acl)
Set security acl for a given security type.- Parameters:
securityType
- is the security type.acl
- is the acl;
-
setSecurityDenyACL
public void setSecurityDenyACL(java.lang.String securityType, java.lang.String[] denyAcl)
Set security deny acl for a given security type.- Parameters:
securityType
- is the security type.denyAcl
- is the deny acl.
-
getSecurityACL
public java.lang.String[] getSecurityACL(java.lang.String securityType)
Get security acl for a given security type.- Parameters:
securityType
- is the security type.- Returns:
- the acl, which may be null.
-
getSecurityDenyACL
public java.lang.String[] getSecurityDenyACL(java.lang.String securityType)
Get security deny acl for a given security type.- Parameters:
securityType
- is the security type.- Returns:
- the acl, which may be null.
-
setBinary
public void setBinary(java.io.InputStream binaryFieldData, long binaryLength)
Set the binary field. Data is described by a binary stream (which is expected to be processed), This stream MUST BE CLOSED BY THE CALLER when the repository document instance has been ingested. The stream also WILL NOT ever be reset; it is read to the end once only.- Parameters:
binaryFieldData
- is the input stream containing binary data.binaryLength
- is the length of the stream, in bytes. This is a REQUIRED parameter.
-
getBinaryStream
public java.io.InputStream getBinaryStream()
Get the binary fields (if any).- Returns:
- the binary stream.
-
setFileName
public void setFileName(java.lang.String fileName)
Set the file name.- Parameters:
fileName
- is the file name.
-
getFileName
public java.lang.String getFileName()
Get the file Name.- Returns:
- the string of file name.
-
getBinaryLength
public long getBinaryLength()
Get the binary length.- Returns:
- the length in bytes.
-
removeField
public void removeField(java.lang.String fieldName)
Remove a field.- Parameters:
fieldName
- is the field name.
-
addField
public void addField(java.lang.String fieldName, java.util.Date[] fieldData) throws ManifoldCFException
Add/remove a multivalue date field.- Parameters:
fieldName
- is the field name.fieldData
- is the multi-valued data (an array of Dates). Null means to remove the entry.- Throws:
ManifoldCFException
-
addField
public void addField(java.lang.String fieldName, java.util.Date fieldData) throws ManifoldCFException
Add/remove a date field.- Parameters:
fieldName
- is the field name.fieldData
- is the single-valued data (a Date). Null means "no value".- Throws:
ManifoldCFException
-
addField
public void addField(java.lang.String fieldName, java.io.Reader[] fieldData) throws ManifoldCFException
Add/remove a multivalue character field. Data is described here by an array of Readers (which are expected to be processed), These Readers MUST BE CLOSED BY THE CALLER when the repository document instance has been ingested. The Readers also WILL NOT ever be reset; they are read to the end once only.- Parameters:
fieldName
- is the field name.fieldData
- is the multi-valued data (as an array of Readers). Null means to remove the entry from the document.- Throws:
ManifoldCFException
-
addField
public void addField(java.lang.String fieldName, java.io.Reader fieldData) throws ManifoldCFException
Add/remove a character field. Data is described here by a Reader (which is expected to be processed), This Reader MUST BE CLOSED BY THE CALLER when the repository document instance has been ingested. The Reader also WILL NOT ever be reset; it is read to the end once only.- Parameters:
fieldName
- is the field name.fieldData
- is the single-valued data (as a Reader). Null means "no value".- Throws:
ManifoldCFException
-
addField
public void addField(java.lang.String fieldName, java.lang.String[] fieldData) throws ManifoldCFException
Add/Remove a multivalue character field.- Parameters:
fieldName
- is the field name.fieldData
- is the multi-valued data (as a an array of Strings). Null means to remove the entry from the document.- Throws:
ManifoldCFException
-
addField
public void addField(java.lang.String fieldName, java.lang.String fieldData) throws ManifoldCFException
Add a character field.- Parameters:
fieldName
- is the field name.fieldData
- is the single-valued data (as a String). Null means "no value".- Throws:
ManifoldCFException
-
getField
public java.lang.Object[] getField(java.lang.String fieldName)
Get a field.- Parameters:
fieldName
- is the field name.- Returns:
- the field data (either a Reader array or a String array).
-
getFieldAsStrings
public java.lang.String[] getFieldAsStrings(java.lang.String fieldName) throws java.io.IOException
Get a field as an array of strings. If the data was originally in the form of Readers, a one-time conversion is made to the String form, so that the same field can be fetched multiple times. If the data was originally in the form of Dates, then the dates are converted to standard ISO8601 format.- Parameters:
fieldName
- is the field name.- Returns:
- the field data.
- Throws:
java.io.IOException
-
getFieldAsReaders
public java.io.Reader[] getFieldAsReaders(java.lang.String fieldName)
Get a field as an array of Readers. If the field was originally strings, a one-time creation of a Readers array is made.- Parameters:
fieldName
- is the field name.- Returns:
- the field data.
-
getFieldAsDates
public java.util.Date[] getFieldAsDates(java.lang.String fieldName)
Get field as an array of Date objects. If the field was originally not a Date field, null is returned.- Parameters:
fieldName
- is the field name.- Returns:
- the field data.
-
fieldCount
public int fieldCount()
Get the number of fields.
-
getFields
public java.util.Iterator<java.lang.String> getFields()
Iterate through the field name Strings.
-
-