001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: */
018:
019: /* $Id: RCML.java 567462 2007-08-19 20:31:38Z andreas $ */
020:
021: package org.apache.lenya.cms.rc;
022:
023: import java.util.Vector;
024:
025: import org.apache.lenya.cms.repository.Node;
026: import org.apache.lenya.cms.repository.Session;
027:
028: /**
029: * An object of this class handles the revisions of a node. The node is passed as a parameter so an
030: * RCML object can be shared between sessions for synchronization purposes.
031: */
032: public interface RCML {
033:
034: /**
035: * <code>co</code> Checkout
036: */
037: short co = 0;
038: /**
039: * <code>ci</code> Checkin
040: */
041: short ci = 1;
042:
043: /**
044: * Check the RCML in.
045: * @param node The node.
046: * @param backup If a backup shall be created.
047: * @param newVersion If the revision number should be increased.
048: * @throws RevisionControlException if an error occurs.
049: */
050: void checkIn(Node node, boolean backup, boolean newVersion)
051: throws RevisionControlException;
052:
053: /**
054: * Check the RCML out with restriction to the current session.
055: * @param node The node.
056: * @throws RevisionControlException if an error occurs.
057: */
058: void checkOut(Node node) throws RevisionControlException;
059:
060: /**
061: * Check the RCML out.
062: * @param node The node.
063: * @param restrictedToSession If only the current session may check the node in, or all sessions
064: * belonging to this user.
065: * @throws RevisionControlException if an error occurs.
066: */
067: void checkOut(Node node, boolean restrictedToSession)
068: throws RevisionControlException;
069:
070: /**
071: * get the latest check out
072: * @return CheckOutEntry The entry of the check out
073: * @throws RevisionControlException if an error occurs
074: */
075: CheckOutEntry getLatestCheckOutEntry()
076: throws RevisionControlException;
077:
078: /**
079: * get the latest check in
080: * @return CheckInEntry The entry of the check in
081: * @throws RevisionControlException if an error occurs
082: */
083: CheckInEntry getLatestCheckInEntry()
084: throws RevisionControlException;
085:
086: /**
087: * get the latest entry (a check out or check in)
088: * @return RCMLEntry The entry of the check out/in
089: * @throws RevisionControlException if an error occurs
090: */
091: RCMLEntry getLatestEntry() throws RevisionControlException;
092:
093: /**
094: * get all check in and check out
095: * @return Vector of all check out and check in entries in this RCML-file
096: * @throws RevisionControlException if an error occurs
097: */
098: Vector getEntries() throws RevisionControlException;
099:
100: /**
101: * get all backup entries
102: * @return Vector of all entries in this RCML-file with a backup
103: * @throws Exception if an error occurs
104: */
105: Vector getBackupEntries() throws Exception;
106:
107: /**
108: * Creates a backup.
109: * @param time The time.
110: * @throws RevisionControlException
111: */
112: void makeBackup(long time) throws RevisionControlException;
113:
114: /**
115: * Restores a backup.
116: * @param node The node to restore the backup to.
117: * @param time The time.
118: * @throws RevisionControlException
119: */
120: void restoreBackup(Node node, long time)
121: throws RevisionControlException;
122:
123: /**
124: * Prune the list of entries and delete the corresponding backups. Limit the number of entries
125: * to the value maximalNumberOfEntries (2maxNumberOfRollbacks(configured)+1)
126: * @throws Exception if an error occurs
127: */
128: void pruneEntries() throws Exception;
129:
130: /**
131: * Check if the document is dirty
132: * @return boolean dirty
133: */
134: boolean isDirty();
135:
136: /**
137: * get the time's value of the backups
138: * @return String[] the times
139: * @throws Exception if an error occurs
140: */
141: String[] getBackupsTime() throws Exception;
142:
143: /**
144: * delete the RCML file and the directory if this one is empty
145: * @return boolean true, if the file was deleted
146: */
147: boolean delete();
148:
149: /**
150: * Delete all revisions.
151: * @throws RevisionControlException if an error occurs.
152: */
153: void deleteRevisions() throws RevisionControlException;
154:
155: /**
156: * @param node The target node.
157: * @param otherNode The source node.
158: * @throws RevisionControlException if an error occurs.
159: */
160: void copyFrom(Node node, Node otherNode)
161: throws RevisionControlException;
162:
163: /**
164: * @return if the RCML is checked out.
165: * @throws RevisionControlException if an error occurs.
166: */
167: boolean isCheckedOut() throws RevisionControlException;
168:
169: /**
170: * @param session The session.
171: * @return if the RCML is checked out by this session.
172: * @throws RevisionControlException if an error occurs.
173: */
174: boolean isCheckedOutBySession(Session session)
175: throws RevisionControlException;
176:
177: }
|