org.dspace.content
Class BitstreamFormat

java.lang.Object
  extended by org.dspace.content.BitstreamFormat

public class BitstreamFormat
extends Object

Class representing a particular bitstream format.

Changes to the bitstream format metadata are only written to the database when update is called.

Version:
$Revision: 3761 $
Author:
Robert Tansley

Field Summary
static int KNOWN
          The "known" support level - for bitstream formats that are known to the system, but not fully supported
static int SUPPORTED
          The "supported" support level - for bitstream formats known to the system and fully supported.
static int UNKNOWN
          The "unknown" support level - for bitstream formats that are unknown to the system
 
Method Summary
static BitstreamFormat create(Context context)
          Create a new bitstream format
 void delete()
          Delete this bitstream format.
static BitstreamFormat find(Context context, int id)
          Get a bitstream format from the database.
static BitstreamFormat[] findAll(Context context)
          Retrieve all bitstream formats from the registry, ordered by ID
static BitstreamFormat findByMIMEType(Context context, String mimeType)
          Find a bitstream format by its (unique) MIME type.
static BitstreamFormat findByShortDescription(Context context, String desc)
          Find a bitstream format by its (unique) short description
static BitstreamFormat[] findNonInternal(Context context)
          Retrieve all non-internal bitstream formats from the registry.
static BitstreamFormat findUnknown(Context context)
          Get the generic "unknown" bitstream format.
 String getDescription()
          Get a description of this bitstream format, including full application or format name
 String[] getExtensions()
          Get the filename extensions associated with this format
 int getID()
          Get the internal identifier of this bitstream format
 String getMIMEType()
          Get the MIME type of this bitstream format, for example text/plain
 String getShortDescription()
          Get a short (one or two word) description of this bitstream format
 int getSupportLevel()
          Get the support level for this bitstream format - one of UNKNOWN,KNOWN or SUPPORTED.
 boolean isInternal()
          Find out if the bitstream format is an internal format - that is, one that is used to store system information, rather than the content of items in the system
 void setDescription(String s)
          Set the description of the bitstream format
 void setExtensions(String[] exts)
          Set the filename extensions associated with this format
 void setInternal(boolean b)
          Set whether the bitstream format is an internal format
 void setMIMEType(String s)
          Set the MIME type of the bitstream format
 void setShortDescription(String s)
          Set the short description of the bitstream format
 void setSupportLevel(int sl)
          Set the support level for this bitstream format - one of UNKNOWN,KNOWN or SUPPORTED.
 void update()
          Update the bitstream format metadata
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
The "unknown" support level - for bitstream formats that are unknown to the system

See Also:
Constant Field Values

KNOWN

public static final int KNOWN
The "known" support level - for bitstream formats that are known to the system, but not fully supported

See Also:
Constant Field Values

SUPPORTED

public static final int SUPPORTED
The "supported" support level - for bitstream formats known to the system and fully supported.

See Also:
Constant Field Values
Method Detail

find

public static BitstreamFormat find(Context context,
                                   int id)
                            throws SQLException
Get a bitstream format from the database.

Parameters:
context - DSpace context object
id - ID of the bitstream format
Returns:
the bitstream format, or null if the ID is invalid.
Throws:
SQLException

findByMIMEType

public static BitstreamFormat findByMIMEType(Context context,
                                             String mimeType)
                                      throws SQLException
Find a bitstream format by its (unique) MIME type. If more than one bitstream format has the same MIME type, the one returned is unpredictable.

Parameters:
context - DSpace context object
mimeType - MIME type value
Returns:
the corresponding bitstream format, or null if there's no bitstream format with the given MIMEtype.
Throws:
SQLException

findByShortDescription

public static BitstreamFormat findByShortDescription(Context context,
                                                     String desc)
                                              throws SQLException
Find a bitstream format by its (unique) short description

Parameters:
context - DSpace context object
desc - the short description
Returns:
the corresponding bitstream format, or null if there's no bitstream format with the given short description
Throws:
SQLException

findUnknown

public static BitstreamFormat findUnknown(Context context)
                                   throws SQLException
Get the generic "unknown" bitstream format.

Parameters:
context - DSpace context object
Returns:
the "unknown" bitstream format.
Throws:
SQLException
IllegalStateException - if the "unknown" bitstream format couldn't be found

findAll

public static BitstreamFormat[] findAll(Context context)
                                 throws SQLException
Retrieve all bitstream formats from the registry, ordered by ID

Parameters:
context - DSpace context object
Returns:
the bitstream formats.
Throws:
SQLException

findNonInternal

public static BitstreamFormat[] findNonInternal(Context context)
                                         throws SQLException
Retrieve all non-internal bitstream formats from the registry. The "unknown" format is not included, and the formats are ordered by support level (highest first) first then short description.

Parameters:
context - DSpace context object
Returns:
the bitstream formats.
Throws:
SQLException

create

public static BitstreamFormat create(Context context)
                              throws SQLException,
                                     AuthorizeException
Create a new bitstream format

Parameters:
context - DSpace context object
Returns:
the newly created BitstreamFormat
Throws:
SQLException
AuthorizeException

getID

public int getID()
Get the internal identifier of this bitstream format

Returns:
the internal identifier

getShortDescription

public String getShortDescription()
Get a short (one or two word) description of this bitstream format

Returns:
the short description

setShortDescription

public void setShortDescription(String s)
                         throws SQLException
Set the short description of the bitstream format

Parameters:
s - the new short description
Throws:
SQLException

getDescription

public String getDescription()
Get a description of this bitstream format, including full application or format name

Returns:
the description

setDescription

public void setDescription(String s)
Set the description of the bitstream format

Parameters:
s - the new description

getMIMEType

public String getMIMEType()
Get the MIME type of this bitstream format, for example text/plain

Returns:
the MIME type

setMIMEType

public void setMIMEType(String s)
Set the MIME type of the bitstream format

Parameters:
s - the new MIME type

getSupportLevel

public int getSupportLevel()
Get the support level for this bitstream format - one of UNKNOWN,KNOWN or SUPPORTED.

Returns:
the support level

setSupportLevel

public void setSupportLevel(int sl)
Set the support level for this bitstream format - one of UNKNOWN,KNOWN or SUPPORTED.

Parameters:
sl - the new support level

isInternal

public boolean isInternal()
Find out if the bitstream format is an internal format - that is, one that is used to store system information, rather than the content of items in the system

Returns:
true if the bitstream format is an internal type

setInternal

public void setInternal(boolean b)
Set whether the bitstream format is an internal format

Parameters:
b - pass in true if the bitstream format is an internal type

update

public void update()
            throws SQLException,
                   AuthorizeException
Update the bitstream format metadata

Throws:
SQLException
AuthorizeException

delete

public void delete()
            throws SQLException,
                   AuthorizeException
Delete this bitstream format. This converts the types of any bitstreams that may have this type to "unknown". Use this with care!

Throws:
SQLException
AuthorizeException

getExtensions

public String[] getExtensions()
Get the filename extensions associated with this format

Returns:
the extensions

setExtensions

public void setExtensions(String[] exts)
Set the filename extensions associated with this format

Parameters:
exts - String [] array of extensions


Copyright © 2010 DuraSpace. All Rights Reserved.