org.mycore.backend.hibernate
Class MCRHIBXMLStore

java.lang.Object
  extended by org.mycore.backend.hibernate.MCRHIBXMLStore
All Implemented Interfaces:
MCRXMLTableInterface

public class MCRHIBXMLStore
extends Object
implements MCRXMLTableInterface

This class implements the MCRXMLInterface.


Field Summary
(package private) static Logger logger
           
 
Constructor Summary
MCRHIBXMLStore()
          The constructor for the class MCRHIBXMLStore.
 
Method Summary
 void create(String mcrid, byte[] xml, Date lastModified)
          The method create a new item in the datastore.
 void delete(String mcrid)
          The method remove a item for the MCRObjectID from the datastore.
 boolean exists(String mcrid)
          This method check that the MCRObjectID exist in this store.
 int getHighestStoredID()
          This method returns the highest stored ID number for a given MCRObjectID base, or 0 if no object is stored for this type and project.
 void init(String type)
          The initializer for the class MCRHIBXMLStore.
 List<MCRObjectIDDate> listObjectDates(String type)
          lists objects of the specified type and their last modified date.
 InputStream retrieve(String mcrid)
          The method retrieve a dataset for the given MCRObjectID and returns the corresponding XML file as byte array.
 List<String> retrieveAllIDs()
          The method return a Array list with all stored MCRObjectID's of the XML table.
static void test()
           
 void update(String mcrid, byte[] xml, Date lastModified)
          The method update an item in the datastore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static Logger logger
Constructor Detail

MCRHIBXMLStore

public MCRHIBXMLStore()
The constructor for the class MCRHIBXMLStore.

Method Detail

init

public final void init(String type)
                throws MCRPersistenceException
The initializer for the class MCRHIBXMLStore. It reads the configuration and checks the table names and create the table if they does'n exist..

Specified by:
init in interface MCRXMLTableInterface
Parameters:
type - the type String of the MCRObjectID
Throws:
MCRPersistenceException - if the type is not correct

create

public final void create(String mcrid,
                         byte[] xml,
                         Date lastModified)
                  throws MCRPersistenceException
The method create a new item in the datastore.

Specified by:
create in interface MCRXMLTableInterface
Parameters:
mcrid - a MCRObjectID
xml - a byte array with the XML file
version - the version of the XML Blob as integer
Throws:
MCRPersistenceException - the method arguments are not correct

delete

public final void delete(String mcrid)
                  throws MCRPersistenceException
The method remove a item for the MCRObjectID from the datastore.

Specified by:
delete in interface MCRXMLTableInterface
Parameters:
mcrid - a MCRObjectID
version - the version of the XML Blob as integer
Throws:
MCRPersistenceException - the method argument is not correct

update

public final void update(String mcrid,
                         byte[] xml,
                         Date lastModified)
                  throws MCRPersistenceException
The method update an item in the datastore.

Specified by:
update in interface MCRXMLTableInterface
Parameters:
mcrid - a MCRObjectID
xml - a byte array with the XML file
version - the version of the XML Blob as integer
Throws:
MCRPersistenceException - the method arguments are not correct

retrieve

public final InputStream retrieve(String mcrid)
                           throws MCRPersistenceException
The method retrieve a dataset for the given MCRObjectID and returns the corresponding XML file as byte array.

Specified by:
retrieve in interface MCRXMLTableInterface
Parameters:
mcrid - a MCRObjectID
version - the version of the XML Blob as integer
Returns:
the XML-File as byte array or null
Throws:
MCRPersistenceException - the method arguments are not correct

getHighestStoredID

public final int getHighestStoredID()
                             throws MCRPersistenceException
This method returns the highest stored ID number for a given MCRObjectID base, or 0 if no object is stored for this type and project.

Specified by:
getHighestStoredID in interface MCRXMLTableInterface
Returns:
the highest stored ID number as a String
Throws:
MCRPersistenceException - if a persistence problem is occured

exists

public final boolean exists(String mcrid)
This method check that the MCRObjectID exist in this store.

Specified by:
exists in interface MCRXMLTableInterface
Parameters:
mcrid - a MCRObjectID
version - the version of the XML Blob as integer
Returns:
true if the MCRObjectID exist, else return false

retrieveAllIDs

public List<String> retrieveAllIDs()
The method return a Array list with all stored MCRObjectID's of the XML table.

Specified by:
retrieveAllIDs in interface MCRXMLTableInterface
Parameters:
type - a MCRObjectID type string
Returns:
a ArrayList of MCRObjectID's

test

public static void test()

listObjectDates

public List<MCRObjectIDDate> listObjectDates(String type)
Description copied from interface: MCRXMLTableInterface
lists objects of the specified type and their last modified date.

Specified by:
listObjectDates in interface MCRXMLTableInterface
Parameters:
type - type of object
Returns: