You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2006/11/09 09:55:45 UTC
svn commit: r472815 - in
/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version:
VersionHistoryImpl.java VersionImpl.java
Author: angela
Date: Thu Nov 9 00:55:44 2006
New Revision: 472815
URL: http://svn.apache.org/viewvc?view=rev&rev=472815
Log:
work in progress
- add 'checkStatus' calls
Modified:
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java?view=diff&rev=472815&r1=472814&r2=472815
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java Thu Nov 9 00:55:44 2006
@@ -65,7 +65,6 @@
NodeState state, NodeDefinition definition,
ItemLifeCycleListener[] listeners) throws VersionException {
super(itemMgr, session, state, definition, listeners);
-
this.vhState = state;
// retrieve nodestate of the jcr:versionLabels node
@@ -89,6 +88,7 @@
* @see VersionHistory#getVersionableUUID()
*/
public String getVersionableUUID() throws RepositoryException {
+ checkStatus();
return getProperty(QName.JCR_VERSIONABLEUUID).getString();
}
@@ -99,6 +99,7 @@
* @see VersionHistory#getRootVersion()
*/
public Version getRootVersion() throws RepositoryException {
+ checkStatus();
try {
if (vhState.hasChildNodeEntry(QName.JCR_ROOTVERSION)) {
NodeState vState = vhState.getChildNodeEntry(QName.JCR_ROOTVERSION, Path.INDEX_DEFAULT).getNodeState();
@@ -120,6 +121,7 @@
* @see VersionHistory#getAllVersions()
*/
public VersionIterator getAllVersions() throws RepositoryException {
+ checkStatus();
Iterator childIter = vhState.getChildNodeEntries().iterator();
List versionStates = new ArrayList();
// all child-nodes except from jcr:versionLabels point to Versions.
@@ -145,6 +147,7 @@
* @see VersionHistory#getVersion(String)
*/
public Version getVersion(String versionName) throws VersionException, RepositoryException {
+ checkStatus();
NodeState vState = getVersionState(versionName);
return (Version) itemMgr.getItem(vState);
}
@@ -157,6 +160,7 @@
* @see VersionHistory#getVersionByLabel(String)
*/
public Version getVersionByLabel(String label) throws RepositoryException {
+ checkStatus();
NodeState vState = getVersionStateByLabel(getQLabel(label));
return (Version) itemMgr.getItem(vState);
}
@@ -171,6 +175,7 @@
* @see VersionHistory#addVersionLabel(String, String, boolean)
*/
public void addVersionLabel(String versionName, String label, boolean moveLabel) throws VersionException, RepositoryException {
+ checkStatus();
QName qLabel = getQLabel(label);
NodeState vState = getVersionState(versionName);
// delegate to version manager that operates on workspace directely
@@ -185,6 +190,7 @@
* @see VersionHistory#removeVersionLabel(String)
*/
public void removeVersionLabel(String label) throws VersionException, RepositoryException {
+ checkStatus();
QName qLabel = getQLabel(label);
NodeState vState = getVersionStateByLabel(getQLabel(label));
// delegate to version manager that operates on workspace directely
@@ -199,6 +205,7 @@
* @see VersionHistory#hasVersionLabel(String)
*/
public boolean hasVersionLabel(String label) throws RepositoryException {
+ checkStatus();
QName l = getQLabel(label);
QName[] qLabels = getQLabels();
for (int i = 0; i < qLabels.length; i++) {
@@ -210,7 +217,6 @@
}
/**
- *
* @param version
* @param label
* @return
@@ -219,6 +225,7 @@
* @see VersionHistory#hasVersionLabel(Version, String)
*/
public boolean hasVersionLabel(Version version, String label) throws VersionException, RepositoryException {
+ // check-status performed within checkValidVersion
checkValidVersion(version);
String vUUID = version.getUUID();
QName l = getQLabel(label);
@@ -240,6 +247,7 @@
* @see VersionHistory#getVersionLabels()
*/
public String[] getVersionLabels() throws RepositoryException {
+ checkStatus();
QName[] qLabels = getQLabels();
String[] labels = new String[qLabels.length];
@@ -263,6 +271,7 @@
* @see VersionHistory#getVersionLabels(Version)
*/
public String[] getVersionLabels(Version version) throws VersionException, RepositoryException {
+ // check-status performed within checkValidVersion
checkValidVersion(version);
String vUUID = version.getUUID();
@@ -293,6 +302,7 @@
* @see VersionHistory#removeVersion(String)
*/
public void removeVersion(String versionName) throws RepositoryException {
+ checkStatus();
NodeState vState = getVersionState(versionName);
session.getVersionManager().removeVersion(vhState, vState);
}
@@ -304,7 +314,8 @@
* @return
* @see Item#isSame(Item)
*/
- public boolean isSame(Item otherItem) {
+ public boolean isSame(Item otherItem) throws RepositoryException {
+ checkStatus();
if (otherItem instanceof VersionHistoryImpl) {
// since all version histories are referenceable, protected and live
// in the same workspace, a simple comparison of the UUIDs is sufficient.
Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java?view=diff&rev=472815&r1=472814&r2=472815
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java (original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java Thu Nov 9 00:55:44 2006
@@ -96,7 +96,8 @@
* @return
* @see Item#isSame(Item)
*/
- public boolean isSame(Item otherItem) {
+ public boolean isSame(Item otherItem) throws RepositoryException {
+ checkStatus();
if (otherItem instanceof VersionImpl) {
// since all versions are referenceable, protected and live
// in the same workspace, a simple comparision of the UUIDs is sufficient