org.apache.lenya.cms.repository
Class SourceNodeRCML

java.lang.Object
  extended by org.apache.lenya.cms.repository.SourceNodeRCML
All Implemented Interfaces:
org.apache.lenya.cms.rc.RCML

public class SourceNodeRCML
extends java.lang.Object
implements org.apache.lenya.cms.rc.RCML

Handle with the RCML file


Field Summary
protected static java.lang.String ATTR_BACKUP
           
protected static java.lang.String ATTR_IDENTITY
           
protected static java.lang.String ATTR_SESSION
           
protected static java.lang.String ATTR_TIME
           
protected static java.lang.String ATTR_VERSION
           
protected static java.lang.String ELEMENT_BACKUP
           
protected static java.lang.String ELEMENT_CHECKIN
           
protected static java.lang.String ELEMENT_CHECKOUT
           
protected static java.lang.String ELEMENT_IDENTITY
           
protected static java.lang.String ELEMENT_SESSION
           
protected static java.lang.String ELEMENT_TIME
           
protected static java.lang.String ELEMENT_VERSION
           
protected static java.lang.String ELEMENT_XPSREVISIONCONTROL
           
protected static java.lang.String NAMESPACE
           
protected static java.lang.String RCML_EXTENSION
           
 
Fields inherited from interface org.apache.lenya.cms.rc.RCML
ci, co
 
Constructor Summary
SourceNodeRCML(java.lang.String contentSourceUri, java.lang.String metaSourceUri, org.apache.avalon.framework.service.ServiceManager manager)
           
 
Method Summary
 void checkIn(org.apache.lenya.cms.repository.Node node, boolean backup, boolean newVersion)
           
 void checkOut(org.apache.lenya.cms.repository.Node node)
           
 void checkOut(org.apache.lenya.cms.repository.Node node, boolean restrictedToSession)
           
 void checkOutIn(org.apache.lenya.cms.repository.Node node, short type, long time, boolean backup, boolean newVersion, boolean restrictedToSession)
          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
 void copyFrom(org.apache.lenya.cms.repository.Node node, org.apache.lenya.cms.repository.Node otherNode)
           
 boolean delete()
          Delete the revisions, the RCML source and the collection if the latter is empty.
protected  void deleteBackup(java.lang.String sourceUri, long time)
           
 void deleteRevisions()
          delete the revisions
protected  void finalize()
          Call the method write, if the document is dirty
 java.util.Vector getBackupEntries()
          get all backup entries
protected  java.lang.String getBackupSourceUri(SourceWrapper wrapper, long time)
           
protected  java.lang.String getBackupSourceUri(java.lang.String uri, long time)
           
 java.lang.String[] getBackupsTime()
          get the time's value of the backups
protected  java.lang.String getChildValue(org.apache.lenya.xml.NamespaceHelper helper, org.w3c.dom.Element element, java.lang.String childName)
           
protected  java.lang.String getChildValue(org.apache.lenya.xml.NamespaceHelper helper, org.w3c.dom.Element element, java.lang.String childName, java.lang.String defaultValue)
           
 java.util.Vector getEntries()
          get all check in and check out
protected  org.apache.lenya.cms.rc.RCMLEntry getEntry(org.apache.lenya.xml.NamespaceHelper helper, org.w3c.dom.Element element)
           
 org.apache.lenya.cms.rc.CheckInEntry getLatestCheckInEntry()
          get the latest check in
 org.apache.lenya.cms.rc.CheckOutEntry getLatestCheckOutEntry()
          get the latest check out
protected  org.w3c.dom.Element getLatestElement(org.apache.lenya.xml.NamespaceHelper helper, java.lang.String type)
           
 org.apache.lenya.cms.rc.RCMLEntry getLatestEntry()
           
 org.apache.lenya.cms.rc.RCMLEntry getLatestEntry(short type)
          get the latest entry (a check out or check in)
protected  org.apache.lenya.cms.rc.RCMLEntry getLegacyEntry(org.apache.lenya.xml.NamespaceHelper helper, org.w3c.dom.Element element)
           
protected  java.lang.String getRcmlSourceUri()
           
 boolean isCheckedOut()
           
 boolean isCheckedOutBySession(org.apache.lenya.cms.repository.Session session)
           
 boolean isDirty()
          Check if the document is dirty
 void makeBackup(long time)
           
protected  void makeBackup(java.lang.String sourceUri, long time)
           
 void pruneEntries()
          Prune the list of entries and delete the corresponding backups.
 void restoreBackup(org.apache.lenya.cms.repository.Node node, long time)
           
protected  void restoreBackup(SourceWrapper wrapper, long time)
           
protected  org.apache.lenya.xml.NamespaceHelper saveToXml()
           
protected  org.w3c.dom.Element saveToXml(org.apache.lenya.xml.NamespaceHelper helper, org.apache.lenya.cms.rc.RCMLEntry entry)
           
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

NAMESPACE

protected static final java.lang.String NAMESPACE
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

ELEMENT_TIME

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

ELEMENT_VERSION

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

ELEMENT_IDENTITY

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

ELEMENT_XPSREVISIONCONTROL

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

ELEMENT_SESSION

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

ATTR_BACKUP

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

ATTR_TIME

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

ATTR_VERSION

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

ATTR_IDENTITY

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

ATTR_SESSION

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

RCML_EXTENSION

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

SourceNodeRCML

public SourceNodeRCML(java.lang.String contentSourceUri,
                      java.lang.String metaSourceUri,
                      org.apache.avalon.framework.service.ServiceManager manager)
Parameters:
contentSourceUri - The content source URI.
metaSourceUri - The meta source URI.
manager - The service manager.
Method Detail

getRcmlSourceUri

protected java.lang.String getRcmlSourceUri()

finalize

protected void finalize()
                 throws java.io.IOException,
                        java.lang.Exception
Call the method 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 org.apache.lenya.cms.rc.RevisionControlException
Write the XML RCML-document in the RCML-file.

Throws:
org.apache.lenya.cms.rc.RevisionControlException - if an error occurs

checkOutIn

public void checkOutIn(org.apache.lenya.cms.repository.Node node,
                       short type,
                       long time,
                       boolean backup,
                       boolean newVersion,
                       boolean restrictedToSession)
                throws org.apache.lenya.cms.rc.RevisionControlException
Write a new entry for a check out or a check in the RCML-File made by the user with identity at time

Parameters:
node - The node.
type - co for a check out, ci for a check in
time -
backup - Create backup element (only considered for check-in entries).
newVersion - If the revision number shall be increased (only considered for check-in entries).
restrictedToSession - If the check-out is restricted to the session (only considered for check-out entries).
Throws:
org.apache.lenya.cms.rc.RevisionControlException - if an error occurs

saveToXml

protected org.w3c.dom.Element saveToXml(org.apache.lenya.xml.NamespaceHelper helper,
                                        org.apache.lenya.cms.rc.RCMLEntry entry)
                                 throws org.apache.lenya.cms.rc.RevisionControlException
Throws:
org.apache.lenya.cms.rc.RevisionControlException

saveToXml

protected org.apache.lenya.xml.NamespaceHelper saveToXml()
                                                  throws org.apache.lenya.cms.rc.RevisionControlException
Throws:
org.apache.lenya.cms.rc.RevisionControlException

getLatestElement

protected org.w3c.dom.Element getLatestElement(org.apache.lenya.xml.NamespaceHelper helper,
                                               java.lang.String type)
                                        throws org.apache.lenya.cms.rc.RevisionControlException
Throws:
org.apache.lenya.cms.rc.RevisionControlException

getLatestCheckOutEntry

public org.apache.lenya.cms.rc.CheckOutEntry getLatestCheckOutEntry()
                                                             throws org.apache.lenya.cms.rc.RevisionControlException
get the latest check out

Specified by:
getLatestCheckOutEntry in interface org.apache.lenya.cms.rc.RCML
Returns:
CheckOutEntry The entry of the check out
Throws:
org.apache.lenya.cms.rc.RevisionControlException - if an error occurs

getLatestCheckInEntry

public org.apache.lenya.cms.rc.CheckInEntry getLatestCheckInEntry()
                                                           throws org.apache.lenya.cms.rc.RevisionControlException
get the latest check in

Specified by:
getLatestCheckInEntry in interface org.apache.lenya.cms.rc.RCML
Returns:
CheckInEntry The entry of the check in
Throws:
org.apache.lenya.cms.rc.RevisionControlException - if an error occurs

getLatestEntry

public org.apache.lenya.cms.rc.RCMLEntry getLatestEntry(short type)
                                                 throws org.apache.lenya.cms.rc.RevisionControlException
get the latest entry (a check out or check in)

Parameters:
type - The type.
Returns:
RCMLEntry The entry of the check out/in
Throws:
org.apache.lenya.cms.rc.RevisionControlException - if an error occurs

getLatestEntry

public org.apache.lenya.cms.rc.RCMLEntry getLatestEntry()
                                                 throws org.apache.lenya.cms.rc.RevisionControlException
Specified by:
getLatestEntry in interface org.apache.lenya.cms.rc.RCML
Throws:
org.apache.lenya.cms.rc.RevisionControlException

getEntry

protected org.apache.lenya.cms.rc.RCMLEntry getEntry(org.apache.lenya.xml.NamespaceHelper helper,
                                                     org.w3c.dom.Element element)

getLegacyEntry

protected org.apache.lenya.cms.rc.RCMLEntry getLegacyEntry(org.apache.lenya.xml.NamespaceHelper helper,
                                                           org.w3c.dom.Element element)

getChildValue

protected java.lang.String getChildValue(org.apache.lenya.xml.NamespaceHelper helper,
                                         org.w3c.dom.Element element,
                                         java.lang.String childName,
                                         java.lang.String defaultValue)

getChildValue

protected java.lang.String getChildValue(org.apache.lenya.xml.NamespaceHelper helper,
                                         org.w3c.dom.Element element,
                                         java.lang.String childName)

getEntries

public java.util.Vector getEntries()
                            throws org.apache.lenya.cms.rc.RevisionControlException
get all check in and check out

Specified by:
getEntries in interface org.apache.lenya.cms.rc.RCML
Returns:
Vector of all check out and check in entries in this RCML-file
Throws:
org.apache.lenya.cms.rc.RevisionControlException - if an error occurs

getBackupEntries

public java.util.Vector getBackupEntries()
                                  throws java.lang.Exception
get all backup entries

Specified by:
getBackupEntries in interface org.apache.lenya.cms.rc.RCML
Returns:
Vector of all entries in this RCML-file with a backup
Throws:
java.lang.Exception - if an error occurs

makeBackup

public void makeBackup(long time)
                throws org.apache.lenya.cms.rc.RevisionControlException
Specified by:
makeBackup in interface org.apache.lenya.cms.rc.RCML
Throws:
org.apache.lenya.cms.rc.RevisionControlException

makeBackup

protected void makeBackup(java.lang.String sourceUri,
                          long time)
                   throws org.apache.lenya.cms.rc.RevisionControlException
Throws:
org.apache.lenya.cms.rc.RevisionControlException

restoreBackup

public void restoreBackup(org.apache.lenya.cms.repository.Node node,
                          long time)
                   throws org.apache.lenya.cms.rc.RevisionControlException
Specified by:
restoreBackup in interface org.apache.lenya.cms.rc.RCML
Throws:
org.apache.lenya.cms.rc.RevisionControlException

restoreBackup

protected void restoreBackup(SourceWrapper wrapper,
                             long time)
                      throws org.apache.lenya.cms.rc.RevisionControlException
Throws:
org.apache.lenya.cms.rc.RevisionControlException

getBackupSourceUri

protected java.lang.String getBackupSourceUri(SourceWrapper wrapper,
                                              long time)

getBackupSourceUri

protected java.lang.String getBackupSourceUri(java.lang.String uri,
                                              long time)

pruneEntries

public void pruneEntries()
                  throws org.apache.lenya.cms.rc.RevisionControlException
Prune the list of entries and delete the corresponding backups. Limit the number of entries to the value maximalNumberOfEntries (2maxNumberOfRollbacks(configured)+1)

Specified by:
pruneEntries in interface org.apache.lenya.cms.rc.RCML
Throws:
org.apache.lenya.cms.rc.RevisionControlException - if an error occurs

deleteBackup

protected void deleteBackup(java.lang.String sourceUri,
                            long time)
                     throws org.apache.lenya.cms.rc.RevisionControlException
Throws:
org.apache.lenya.cms.rc.RevisionControlException

isDirty

public boolean isDirty()
Check if the document is dirty

Specified by:
isDirty in interface org.apache.lenya.cms.rc.RCML
Returns:
boolean dirty

setDirty

protected void setDirty()
Set the value dirty to true


clearDirty

protected void clearDirty()
Set the value dirty to false


getBackupsTime

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

Specified by:
getBackupsTime in interface org.apache.lenya.cms.rc.RCML
Returns:
String[] the times
Throws:
java.lang.Exception - if an error occurs

delete

public boolean delete()
Delete the revisions, the RCML source and the collection if the latter is empty.

Specified by:
delete in interface org.apache.lenya.cms.rc.RCML
Returns:
boolean true, if the file was deleted

deleteRevisions

public void deleteRevisions()
                     throws org.apache.lenya.cms.rc.RevisionControlException
delete the revisions

Specified by:
deleteRevisions in interface org.apache.lenya.cms.rc.RCML
Throws:
org.apache.lenya.cms.rc.RevisionControlException - when somthing went wrong

copyFrom

public void copyFrom(org.apache.lenya.cms.repository.Node node,
                     org.apache.lenya.cms.repository.Node otherNode)
              throws org.apache.lenya.cms.rc.RevisionControlException
Specified by:
copyFrom in interface org.apache.lenya.cms.rc.RCML
Throws:
org.apache.lenya.cms.rc.RevisionControlException

isCheckedOut

public boolean isCheckedOut()
                     throws org.apache.lenya.cms.rc.RevisionControlException
Specified by:
isCheckedOut in interface org.apache.lenya.cms.rc.RCML
Throws:
org.apache.lenya.cms.rc.RevisionControlException

checkIn

public void checkIn(org.apache.lenya.cms.repository.Node node,
                    boolean backup,
                    boolean newVersion)
             throws org.apache.lenya.cms.rc.RevisionControlException
Specified by:
checkIn in interface org.apache.lenya.cms.rc.RCML
Throws:
org.apache.lenya.cms.rc.RevisionControlException

checkOut

public void checkOut(org.apache.lenya.cms.repository.Node node)
              throws org.apache.lenya.cms.rc.RevisionControlException
Specified by:
checkOut in interface org.apache.lenya.cms.rc.RCML
Throws:
org.apache.lenya.cms.rc.RevisionControlException

checkOut

public void checkOut(org.apache.lenya.cms.repository.Node node,
                     boolean restrictedToSession)
              throws org.apache.lenya.cms.rc.RevisionControlException
Specified by:
checkOut in interface org.apache.lenya.cms.rc.RCML
Throws:
org.apache.lenya.cms.rc.RevisionControlException

isCheckedOutBySession

public boolean isCheckedOutBySession(org.apache.lenya.cms.repository.Session session)
                              throws org.apache.lenya.cms.rc.RevisionControlException
Specified by:
isCheckedOutBySession in interface org.apache.lenya.cms.rc.RCML
Throws:
org.apache.lenya.cms.rc.RevisionControlException


Copyright © $ Apache Software Foundation. All Rights Reserved.