Class StreamDescriptor
- java.lang.Object
-
- com.levigo.jadice.server.shared.types.StreamDescriptor
-
- All Implemented Interfaces:
Serializable
,Comparable<StreamDescriptor>
public final class StreamDescriptor extends Object implements Comparable<StreamDescriptor>, Serializable
TheStreamDescriptor
describes the properties of a stream within jadice server.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StreamDescriptor.ContextMap
static class
StreamDescriptor.PropertyMap
Simple extension ofHashMap
to accommodate for a more readable toString() output.
-
Field Summary
Fields Modifier and Type Field Description static String
UNKNOWN_MIME_TYPE
Constant used to indicate unknown MIME types.
-
Constructor Summary
Constructors Constructor Description StreamDescriptor()
Default constructor leaving everything uninitialized.StreamDescriptor(StreamDescriptor parent)
Create a new StreamDescriptor with the given parent.StreamDescriptor(String mimeType)
StreamDescriptor(String mimeType, StreamDescriptor parent)
Create a new StreamDescriptor with the given MIME-type and parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(StreamDescriptor sdx)
boolean
equals(Object obj)
String
getBaseType()
Get the base MIME-type consisting of primary- and sub-type in the form "primary/sub".Map<String,Serializable>
getContext()
String
getDescription()
Get the user-friendly description of the stream.String
getFileName()
Get the original file name of the stream.String
getId()
Get the ID of the stream.String
getMimeType()
Get the Multipurpose Internet Mail Extension (MIME) type.StreamDescriptor
getParent()
Map<String,Serializable>
getProperties()
Get theStream
's extended properties.String
getSemanticType()
MimeType
getType()
String
getUUID()
int
hashCode()
String
lookupFileName()
Recursively lookup the FileName for this StreamDescriptor.String
lookupFileName(int maxRecursion)
Recursively lookup the FileName for this StreamDescriptor.void
setDescription(String description)
Set the stream's (hopefully) user-friendly description.void
setFileName(String fileName)
Set the original file name of the stream.void
setId(String id)
Get the ID of the stream.void
setMimeType(String mimeType)
Set the Multipurpose Internet Mail Extension (MIME) type.void
setParent(StreamDescriptor parent)
void
setSemanticType(String semanticType)
Set the semantic type of the stream.String
toString()
-
-
-
Field Detail
-
UNKNOWN_MIME_TYPE
public static final String UNKNOWN_MIME_TYPE
Constant used to indicate unknown MIME types.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StreamDescriptor
public StreamDescriptor(String mimeType)
-
StreamDescriptor
public StreamDescriptor()
Default constructor leaving everything uninitialized. The MIME-type will be set to "unknown/*".
-
StreamDescriptor
public StreamDescriptor(StreamDescriptor parent)
Create a new StreamDescriptor with the given parent. The MIME-type will be set to "unknown/*".- Parameters:
parent
- aStreamDescriptor
that shall be associated as a parent
-
StreamDescriptor
public StreamDescriptor(String mimeType, StreamDescriptor parent)
Create a new StreamDescriptor with the given MIME-type and parent.- Parameters:
mimeType
- a MIME-typeparent
- aStreamDescriptor
that shall be associated as a parent
-
-
Method Detail
-
setMimeType
public void setMimeType(String mimeType)
Set the Multipurpose Internet Mail Extension (MIME) type. The MIME-type is encoded as a String according to RFC 2045 and 2046. It may therefore be a simple type of the form "primary-type/sub-type" or contain parameters.- Parameters:
mimeType
- a MIME-type
-
getMimeType
public String getMimeType()
Get the Multipurpose Internet Mail Extension (MIME) type. The MIME-type is encoded as a String according to RFC 2045 and 2046. It is therefore not guaranteed to be a simple type of the form "primary-type/sub-type".
In order to obtain the type without any details, usegetBaseType()
.- Returns:
- the MIME type as
String
-
getBaseType
public String getBaseType()
Get the base MIME-type consisting of primary- and sub-type in the form "primary/sub". This is a convenience method and equivalent to callinggetType().getBaseType()
.- Returns:
- the base MIME type
-
getType
public MimeType getType()
- Returns:
- the pre-parsed MIME type.
-
compareTo
public int compareTo(StreamDescriptor sdx)
- Specified by:
compareTo
in interfaceComparable<StreamDescriptor>
-
getFileName
public String getFileName()
Get the original file name of the stream. May benull
if no file name was provided.- Returns:
- the filename associated with the stream
-
lookupFileName
public String lookupFileName()
Recursively lookup the FileName for this StreamDescriptor. If this instance doesn't have a FileName, try its parent until a FileName is found or the head of the descriptor hierarchy is encountered.- Returns:
- filename of this stream or its ancestors
- See Also:
getFileName()
-
lookupFileName
public String lookupFileName(int maxRecursion)
Recursively lookup the FileName for this StreamDescriptor. If this instance doesn't have a FileName, try its parent until a FileName is found or the head of the descriptor hierarchy is encountered until the maximum level of recursion is reached.- Parameters:
maxRecursion
- maximum level of recursion (i.e. number of ancestors). Value must be ≥ 0- Returns:
- filename of this stream or its ancestors
- Since:
- jadice server 4.3.1.20
- See Also:
getFileName()
-
setFileName
public void setFileName(String fileName)
Set the original file name of the stream.- Parameters:
fileName
- the file name to set
-
getId
public String getId()
Get the ID of the stream. This might be an archive ID, a MIME part ID etc.- Returns:
- a logical ID
-
setId
public void setId(String id)
Get the ID of the stream. This might be an archive ID, a MIME part ID etc.- Parameters:
id
- a logical ID
-
getProperties
public Map<String,Serializable> getProperties()
Get theStream
's extended properties. The stream properties may be derived from whatever meta-data is available about the stream. Most nodes will just shunt through this data.- Returns:
- the
Stream
's properties
-
getParent
public StreamDescriptor getParent()
-
setParent
public void setParent(StreamDescriptor parent)
-
getUUID
public String getUUID()
-
getDescription
public String getDescription()
Get the user-friendly description of the stream. If a non-null
description was set, this is what is returned from this call. Otherwise an attempt will be made to return a reasonable description by using the fist non-null property from this list:- Returns:
- a user-friendly description
-
setDescription
public void setDescription(String description)
Set the stream's (hopefully) user-friendly description.- Parameters:
description
- a user-friendly description
-
getSemanticType
public String getSemanticType()
- Returns:
- the
semantic type
of the stream.
-
setSemanticType
public void setSemanticType(String semanticType)
Set the semantic type of the stream. The semantic type of a stream hints about the meaning of a stream. The content of this type is not defined. However, within a domain there should be an agreed-upon set of types.Examples:
- email-message
- email-attachment
- archive
- archive-content
- Parameters:
semanticType
- the semantic type to set
-
getContext
public Map<String,Serializable> getContext()
-
-