org.mycore.datamodel.metadata
Class MCRDerivate

java.lang.Object
  extended by org.mycore.datamodel.metadata.MCRBase
      extended by org.mycore.datamodel.metadata.MCRDerivate

public final class MCRDerivate
extends MCRBase

This class implements all methode for handling one derivate object. Methodes of this class can read the XML metadata by using a XML parser, manipulate the data in the abstract persistence data store and return the XML stream to the user application.

Version:
$Revision: 15588 $ $Date: 2009-07-23 11:34:50 +0200 (Thu, 23 Jul 2009) $
Author:
Jens Kupferschmidt

Field Summary
 
Fields inherited from class org.mycore.datamodel.metadata.MCRBase
importMode, jdom_document, LOGGER, MAX_LABEL_LENGTH, mcr_conf, mcr_encoding, mcr_id, mcr_label, mcr_schema, mcr_service, mcr_version, NL, SLASH
 
Constructor Summary
MCRDerivate()
          This is the constructor of the MCRDerivate class.
 
Method Summary
 void createInDatastore()
          The methode create the object in the data store.
 Document createXML()
          This methode create a XML stream for all object data.
 void debug()
          The method print all informations about this MCRObject.
 void deleteFromDatastore(String id)
          The methode delete the object in the data store.
static boolean existInDatastore(MCRObjectID id)
          The methode return true if the derivate is in the data store, else return false.
static boolean existInDatastore(String id)
          The methode return true if the derivate is in the data store, else return false.
 MCRObjectDerivate getDerivate()
          This methode return the instance of the MCRObjectDerivate class.
 boolean isValid()
          This method check the validation of the content of this class.
 MCRDirectory receiveDirectoryFromIFS(String id)
          The methode receive the multimedia object(s) for the given MCRObjectID and returned it as MCRDirectory.
 void receiveFromDatastore(MCRObjectID id)
          The methode receive the derivate for the given MCRObjectID and stored it in this MCRDerivate
 void receiveFromDatastore(String id)
          The methode receive the derivate for the given MCRObjectID and stored it in this MCRDerivate
static byte[] receiveXMLFromDatastore(MCRObjectID id)
          The methode receive the derivate for the given MCRObjectID and returned it as XML stream.
static byte[] receiveXMLFromDatastore(String id)
          The methode receive the derivate for the given MCRObjectID and returned it as XML stream.
 void repairPersitenceDatastore(MCRObjectID id)
          The method updates the indexer of content.
 void repairPersitenceDatastore(String id)
          The method updates the indexer of content.
 void setDerivate(MCRObjectDerivate derivate)
          This methode set the object MCRObjectDerivate.
 void setFromURI(URI uri)
          This methode read the XML input stream from an URI into a temporary DOM and check it with XSchema file.
 void setFromXML(byte[] xml, boolean valid)
          This methode read the XML input stream from a byte array into JDOM and check it with XSchema file.
 void updateInDatastore()
          The methode update the object in the data store.
 void updateXMLInDatastore()
          The methode update only the XML part of the object in the data store.
 
Methods inherited from class org.mycore.datamodel.metadata.MCRBase
getId, getLabel, getSchema, getService, getVersion, isImportMode, setId, setImportMode, setLabel, setSchema, setService, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MCRDerivate

public MCRDerivate()
            throws MCRException,
                   MCRConfigurationException
This is the constructor of the MCRDerivate class. It make an instance of the parser class and the metadata class.

Throws:
MCRException - general Exception of MyCoRe
MCRConfigurationException - a special exception for configuartion data
Method Detail

getDerivate

public final MCRObjectDerivate getDerivate()
This methode return the instance of the MCRObjectDerivate class. If this was not found, null was returned.

Returns:
the instance of the MCRObjectDerivate class

setFromURI

public final void setFromURI(URI uri)
                      throws MCRException
This methode read the XML input stream from an URI into a temporary DOM and check it with XSchema file.

Specified by:
setFromURI in class MCRBase
Parameters:
uri - an URI
Throws:
MCRException - general Exception of MyCoRe

setFromXML

public final void setFromXML(byte[] xml,
                             boolean valid)
                      throws MCRException
This methode read the XML input stream from a byte array into JDOM and check it with XSchema file.

Specified by:
setFromXML in class MCRBase
Parameters:
xml - a XML string
Throws:
MCRException - general Exception of MyCoRe

setDerivate

public final void setDerivate(MCRObjectDerivate derivate)
This methode set the object MCRObjectDerivate.

Parameters:
derivate - the object MCRObjectDerivate part

createXML

public final Document createXML()
                         throws MCRException
This methode create a XML stream for all object data.

Specified by:
createXML in class MCRBase
Returns:
a JDOM Document with the XML data of the object as byte array
Throws:
MCRException - if the content of this class is not valid

createInDatastore

public final void createInDatastore()
                             throws MCRPersistenceException
The methode create the object in the data store.

Specified by:
createInDatastore in class MCRBase
Throws:
MCRPersistenceException - if a persistence problem is occured

deleteFromDatastore

public final void deleteFromDatastore(String id)
                               throws MCRPersistenceException
The methode delete the object in the data store. The order of delete steps is:

Specified by:
deleteFromDatastore in class MCRBase
Parameters:
id - the object ID
Throws:
MCRPersistenceException - if a persistence problem is occured

existInDatastore

public static final boolean existInDatastore(String id)
                                      throws MCRPersistenceException
The methode return true if the derivate is in the data store, else return false.

Parameters:
id - the derivate ID
Throws:
MCRPersistenceException - if a persistence problem is occured

existInDatastore

public static final boolean existInDatastore(MCRObjectID id)
                                      throws MCRPersistenceException
The methode return true if the derivate is in the data store, else return false.

Parameters:
id - the derivate ID
Throws:
MCRPersistenceException - if a persistence problem is occured

receiveFromDatastore

public final void receiveFromDatastore(String id)
                                throws MCRPersistenceException
The methode receive the derivate for the given MCRObjectID and stored it in this MCRDerivate

Specified by:
receiveFromDatastore in class MCRBase
Parameters:
id - the derivate ID
Throws:
MCRPersistenceException - if a persistence problem is occured

receiveFromDatastore

public final void receiveFromDatastore(MCRObjectID id)
                                throws MCRPersistenceException
The methode receive the derivate for the given MCRObjectID and stored it in this MCRDerivate

Parameters:
id - the derivate ID
Throws:
MCRPersistenceException - if a persistence problem is occured

receiveXMLFromDatastore

public static final byte[] receiveXMLFromDatastore(String id)
                                            throws MCRPersistenceException
The methode receive the derivate for the given MCRObjectID and returned it as XML stream.

Parameters:
id - the derivate ID
Returns:
the XML stream of the object as string
Throws:
MCRPersistenceException - if a persistence problem is occured

receiveXMLFromDatastore

public static final byte[] receiveXMLFromDatastore(MCRObjectID id)
                                            throws MCRPersistenceException
The methode receive the derivate for the given MCRObjectID and returned it as XML stream.

Parameters:
id - the derivate ID
Returns:
the XML stream of the object as string
Throws:
MCRPersistenceException - if a persistence problem is occured

receiveDirectoryFromIFS

public final MCRDirectory receiveDirectoryFromIFS(String id)
                                           throws MCRPersistenceException
The methode receive the multimedia object(s) for the given MCRObjectID and returned it as MCRDirectory.

Parameters:
id - the object ID
Returns:
the MCRDirectory of the multimedia object
Throws:
MCRPersistenceException - if a persistence problem is occured

updateInDatastore

public final void updateInDatastore()
                             throws MCRPersistenceException
The methode update the object in the data store.

Specified by:
updateInDatastore in class MCRBase
Throws:
MCRPersistenceException - if a persistence problem is occured

updateXMLInDatastore

public final void updateXMLInDatastore()
                                throws MCRPersistenceException
The methode update only the XML part of the object in the data store.

Throws:
MCRPersistenceException - if a persistence problem is occured

repairPersitenceDatastore

public final void repairPersitenceDatastore(String id)
                                     throws MCRPersistenceException
The method updates the indexer of content.

Specified by:
repairPersitenceDatastore in class MCRBase
Parameters:
id - the MCRObjectID as string
Throws:
MCRPersistenceException

repairPersitenceDatastore

public final void repairPersitenceDatastore(MCRObjectID id)
                                     throws MCRPersistenceException
The method updates the indexer of content.

Specified by:
repairPersitenceDatastore in class MCRBase
Parameters:
id - the MCRObjectID
Throws:
MCRPersistenceException

debug

public final void debug()
The method print all informations about this MCRObject.


isValid

public boolean isValid()
Description copied from class: MCRBase
This method check the validation of the content of this class. The method returns true if otherwise the method return false

Overrides:
isValid in class MCRBase
Returns:
a boolean value