org.apache.lenya.cms.rc
Class RCML

java.lang.Object
  extended by org.apache.lenya.cms.rc.RCML

public class RCML
extends java.lang.Object

Handle with the RCML file


Field Summary
static short ci
           
static short co
           
protected static java.lang.String ELEMENT_BACKUP
           
protected static java.lang.String ELEMENT_CHECKIN
           
protected static java.lang.String ELEMENT_CHECKOUT
           
 
Constructor Summary
RCML()
          Creates a new RCML object.
RCML(java.lang.String rcmlDirectory, java.lang.String filename, java.lang.String rootDirectory)
          create a RCML-File if no one exists already
 
Method Summary
 void checkOutIn(short type, java.lang.String identity, long time, boolean backup)
          Write a new entry for a check out or a check in the RCML-File made by the user with identity at time
protected  void clearDirty()
          Set the value dirty to false
 boolean delete()
          delete the rcml file and the directory if this one is empty
 void deleteFirstCheckIn()
          Delete the latest check in
protected  void finalize()
          Call the methode write, if the document is dirty
 java.lang.String[] getBackupsTime()
          get the time's value of the backups
 org.w3c.dom.Document getDOMDocumentClone()
          Get a clone document
 java.util.Vector getEntries()
          get all check in and check out
 CheckInEntry getLatestCheckInEntry()
          get the latest check in
 CheckOutEntry getLatestCheckOutEntry()
          get the latest check out
 RCMLEntry getLatestEntry()
          get the latest entry (a check out or check in)
 void initDocument()
          initialise the RCML-document.
 boolean isDirty()
          Check if the document is dirty
 void pruneEntries(java.lang.String backupDir)
          Prune the list of entries and delete the corresponding backups.
protected  void setDirty()
          Set the value dirty to true
 void write()
          Write the xml RCML-document in the RCML-file.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

co

public static final short co
See Also:
Constant Field Values

ci

public static final short ci
See Also:
Constant Field Values

ELEMENT_CHECKIN

protected static final java.lang.String ELEMENT_CHECKIN
See Also:
Constant Field Values

ELEMENT_CHECKOUT

protected static final java.lang.String ELEMENT_CHECKOUT
See Also:
Constant Field Values

ELEMENT_BACKUP

protected static final java.lang.String ELEMENT_BACKUP
See Also:
Constant Field Values
Constructor Detail

RCML

public RCML()
Creates a new RCML object.


RCML

public RCML(java.lang.String rcmlDirectory,
            java.lang.String filename,
            java.lang.String rootDirectory)
     throws java.lang.Exception
create a RCML-File if no one exists already

Parameters:
rcmlDirectory - The rcml directory.
filename - The path of the file from the publication (e.g. for file with absolute path home/.../jakarta-tomcat-4.1.24/webapps/lenya/lenya/pubs/{publication id}/content/authoring/foo/bar.xml the filename is content/authoring/foo/bar.xml)
rootDirectory - The publication directory
Throws:
java.lang.Exception - if an error occurs
Method Detail

initDocument

public void initDocument()
                  throws javax.xml.parsers.ParserConfigurationException
initialise the RCML-document. Delete all entries

Throws:
javax.xml.parsers.ParserConfigurationException

finalize

protected void finalize()
                 throws java.io.IOException,
                        java.lang.Exception
Call the methode write, if the document is dirty

Overrides:
finalize in class java.lang.Object
Throws:
java.io.IOException - if an error occurs
java.lang.Exception - if an error occurs

write

public void write()
           throws java.io.IOException,
                  java.lang.Exception
Write the xml RCML-document in the RCML-file.

Throws:
java.io.IOException - if an error occurs
java.lang.Exception - if an error occurs

checkOutIn

public void checkOutIn(short type,
                       java.lang.String identity,
                       long time,
                       boolean backup)
                throws java.io.IOException,
                       java.lang.Exception
Write a new entry for a check out or a check in the RCML-File made by the user with identity at time

Parameters:
type - co for a check out, ci for a check in
identity - The identity of the user
time - Time at which the check in/out is made
Throws:
java.io.IOException - if an error occurs
java.lang.Exception - if an error occurs

getLatestCheckOutEntry

public CheckOutEntry getLatestCheckOutEntry()
                                     throws java.lang.Exception
get the latest check out

Returns:
CheckOutEntry The entry of the check out
Throws:
java.lang.Exception - if an error occurs

getLatestCheckInEntry

public CheckInEntry getLatestCheckInEntry()
                                   throws java.lang.Exception
get the latest check in

Returns:
CheckInEntry The entry of the check in
Throws:
java.lang.Exception - if an error occurs

getLatestEntry

public RCMLEntry getLatestEntry()
                         throws java.lang.Exception
get the latest entry (a check out or check in)

Returns:
RCMLEntry The entry of the check out/in
Throws:
java.lang.Exception - if an error occurs

getEntries

public java.util.Vector getEntries()
                            throws java.lang.Exception
get all check in and check out

Returns:
Vector of all check out and check in entries in this RCML-file
Throws:
java.lang.Exception - if an error occurs

pruneEntries

public void pruneEntries(java.lang.String backupDir)
                  throws java.lang.Exception
Prune the list of entries and delete the corresponding backups. Limit the number of entries to the value maximalNumberOfEntries (2maxNumberOfRollbacks(configured)+1)

Parameters:
backupDir - The backup directory
Throws:
java.lang.Exception - if an error occurs

getDOMDocumentClone

public org.w3c.dom.Document getDOMDocumentClone()
                                         throws java.lang.Exception
Get a clone document

Returns:
org.w3c.dom.Document The clone document
Throws:
java.lang.Exception - if an error occurs

isDirty

public boolean isDirty()
Check if the document is dirty

Returns:
boolean dirty

setDirty

protected void setDirty()
Set the value dirty to true


clearDirty

protected void clearDirty()
Set the value dirty to false


deleteFirstCheckIn

public void deleteFirstCheckIn()
                        throws java.lang.Exception
Delete the latest check in

Throws:
java.lang.Exception - if an error occurs

getBackupsTime

public java.lang.String[] getBackupsTime()
                                  throws java.lang.Exception
get the time's value of the backups

Returns:
String[] the times
Throws:
java.lang.Exception - if an error occurs

delete

public boolean delete()
delete the rcml file and the directory if this one is empty

Returns:
boolean true, if the file was deleted


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.