org.mycore.datamodel.metadata
Class MCRBase

java.lang.Object
  extended by org.mycore.datamodel.metadata.MCRBase
Direct Known Subclasses:
MCRDerivate, MCRObject

public abstract class MCRBase
extends Object

This class is a abstract basic class for objects in the MyCoRe Project. It is the frame to produce a full functionality object.

Version:
$Revision: 15270 $ $Date: 2009-05-25 17:27:57 +0200 (Mon, 25 May 2009) $
Author:
Jens Kupferschmidt

Field Summary
protected  boolean importMode
           
protected  Document jdom_document
           
(package private) static Logger LOGGER
           
static int MAX_LABEL_LENGTH
          constant value for the object id length
protected static MCRConfiguration mcr_conf
           
protected static String mcr_encoding
           
protected  MCRObjectID mcr_id
           
protected  String mcr_label
           
protected  String mcr_schema
           
protected  MCRObjectService mcr_service
           
protected  String mcr_version
           
protected static String NL
           
protected static String SLASH
           
 
Constructor Summary
MCRBase()
          This is the constructor of the MCRBase class.
 
Method Summary
abstract  void createInDatastore()
          The methode create the object in the data store.
abstract  Document createXML()
          This methode create a XML stream for all object data.
abstract  void deleteFromDatastore(String id)
          The methode delete the object in the data store.
 MCRObjectID getId()
          This methode return the object id.
 String getLabel()
          This methode return the object label.
 String getSchema()
          This methode return the object schema.
 MCRObjectService getService()
          This methode return the instance of the MCRObjectService class.
 String getVersion()
          This methode return the MyCoRe version of the data structure.
 boolean isImportMode()
           
 boolean isValid()
          This method check the validation of the content of this class.
abstract  void receiveFromDatastore(String id)
          The methode receive the object for the given MCRObjectID and stored it in this MCRObject.
abstract  void repairPersitenceDatastore(MCRObjectID id)
          The method repair search index.
abstract  void repairPersitenceDatastore(String id)
          The method repair search index.
abstract  void setFromURI(URI uri)
          This methode read the XML input stream from an URI into a temporary DOM and check it with XSchema file.
abstract  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 setId(MCRObjectID id)
          This methode set the object ID.
 void setImportMode(boolean importMode)
           
 void setLabel(String label)
          This methode set the object label.
 void setSchema(String schema)
          This methode set the object schema.
 void setService(MCRObjectService service)
          This methode set the object MCRObjectService.
 void setVersion()
          This methode set the MyCoRe version to the string 'Version 1.3'.
abstract  void updateInDatastore()
          The methode update the object in the data store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LABEL_LENGTH

public static final int MAX_LABEL_LENGTH
constant value for the object id length

See Also:
Constant Field Values

mcr_conf

protected static final MCRConfiguration mcr_conf

mcr_encoding

protected static final String mcr_encoding

jdom_document

protected Document jdom_document

mcr_id

protected MCRObjectID mcr_id

mcr_label

protected String mcr_label

mcr_version

protected String mcr_version

mcr_schema

protected String mcr_schema

mcr_service

protected MCRObjectService mcr_service

NL

protected static final String NL

SLASH

protected static final String SLASH

importMode

protected boolean importMode

LOGGER

static Logger LOGGER
Constructor Detail

MCRBase

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

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

getId

public final MCRObjectID getId()
This methode return the object id. If this is not set, null was returned.

Returns:
the id as MCRObjectID

getLabel

public final String getLabel()
This methode return the object label. If this is not set, null was returned.

Returns:
the lable as a string

getVersion

public final String getVersion()
This methode return the MyCoRe version of the data structure.

Returns:
the version as a string

getSchema

public final String getSchema()
This methode return the object schema. If this is not set, null was returned.

Returns:
the schema as a string

getService

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

Returns:
the instance of the MCRObjectService class

setFromURI

public abstract 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.

Parameters:
uri - an URI
Throws:
MCRException - general Exception of MyCoRe

setFromXML

public abstract 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.

Parameters:
xml - a XML string
Throws:
MCRException - general Exception of MyCoRe

setId

public final void setId(MCRObjectID id)
This methode set the object ID.

Parameters:
id - the object ID

setLabel

public final void setLabel(String label)
This methode set the object label.

Parameters:
label - the object label

setVersion

public final void setVersion()
This methode set the MyCoRe version to the string 'Version 1.3'.


setSchema

public final void setSchema(String schema)
This methode set the object schema.

Parameters:
schema - the object schema

setService

public final void setService(MCRObjectService service)
This methode set the object MCRObjectService.

Parameters:
service - the object MCRObjectService part

createXML

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

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 abstract void createInDatastore()
                                throws MCRPersistenceException,
                                       MCRActiveLinkException
The methode create the object in the data store.

Throws:
MCRPersistenceException - if a persistence problem is occured
MCRActiveLinkException

deleteFromDatastore

public abstract void deleteFromDatastore(String id)
                                  throws MCRPersistenceException,
                                         MCRActiveLinkException
The methode delete the object in the data store.

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

receiveFromDatastore

public abstract void receiveFromDatastore(String id)
                                   throws MCRPersistenceException
The methode receive the object for the given MCRObjectID and stored it in this MCRObject.

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

updateInDatastore

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

Throws:
MCRPersistenceException - if a persistence problem is occured
MCRActiveLinkException

repairPersitenceDatastore

public abstract void repairPersitenceDatastore(String id)
                                        throws MCRPersistenceException
The method repair search index.

Parameters:
id - the MCRObjectID as String
Throws:
MCRPersistenceException

repairPersitenceDatastore

public abstract void repairPersitenceDatastore(MCRObjectID id)
                                        throws MCRPersistenceException
The method repair search index.

Parameters:
id - the MCRObjectID
Throws:
MCRPersistenceException

isValid

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

Returns:
a boolean value

isImportMode

public boolean isImportMode()

setImportMode

public void setImportMode(boolean importMode)