You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by md...@apache.org on 2011/09/01 13:52:13 UTC
svn commit: r1164026 [11/11] - in
/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi:
./ config/ hierarchy/ lock/ nodetype/ observation/ operation/ query/
security/ state/ util/ version/ xml/
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java Thu Sep 1 11:52:08 2011
@@ -55,16 +55,16 @@ import org.slf4j.LoggerFactory;
* <code>VersionHistoryImpl</code>...
*/
public class VersionHistoryImpl extends NodeImpl implements VersionHistory {
-
- private static Logger log = LoggerFactory.getLogger(VersionHistoryImpl.class);
+ private static final Logger log = LoggerFactory.getLogger(VersionHistoryImpl.class);
private final NodeEntry vhEntry;
private final NodeEntry labelNodeEntry;
public VersionHistoryImpl(SessionImpl session, NodeState state, ItemLifeCycleListener[] listeners)
- throws VersionException, RepositoryException {
+ throws RepositoryException {
+
super(session, state, listeners);
- this.vhEntry = (NodeEntry) state.getHierarchyEntry();
+ vhEntry = (NodeEntry) state.getHierarchyEntry();
// retrieve hierarchy entry of the jcr:versionLabels node
labelNodeEntry = vhEntry.getNodeEntry(NameConstants.JCR_VERSIONLABELS, Path.INDEX_DEFAULT, true);
@@ -76,16 +76,13 @@ public class VersionHistoryImpl extends
}
//-----------------------------------------------------< VersionHistory >---
- /**
- * @see VersionHistory#getVersionableUUID()
- */
+
+ @Override
public String getVersionableUUID() throws RepositoryException {
return getVersionableIdentifier();
}
- /**
- * @see VersionHistory#getRootVersion()
- */
+ @Override
public Version getRootVersion() throws RepositoryException {
checkStatus();
NodeEntry vEntry = vhEntry.getNodeEntry(NameConstants.JCR_ROOTVERSION, Path.INDEX_DEFAULT, true);
@@ -97,9 +94,7 @@ public class VersionHistoryImpl extends
return (Version) getItemManager().getItem(vEntry);
}
- /**
- * @see VersionHistory#getAllVersions()
- */
+ @Override
public VersionIterator getAllVersions() throws RepositoryException {
checkStatus();
refreshEntry(vhEntry);
@@ -115,9 +110,7 @@ public class VersionHistoryImpl extends
return new LazyItemIterator(getItemManager(), new RangeIteratorAdapter(versionEntries));
}
- /**
- * @see VersionHistory#getAllLinearVersions()
- */
+ @Override
public VersionIterator getAllLinearVersions() throws RepositoryException {
checkStatus();
@@ -137,41 +130,31 @@ public class VersionHistoryImpl extends
return new VersionIteratorAdapter(versions);
}
- /**
- * @see VersionHistory#getAllFrozenNodes()
- */
+ @Override
public NodeIterator getAllFrozenNodes() throws RepositoryException {
return new FrozenNodeIteratorAdapter(getAllVersions());
}
- /**
- * @see VersionHistory#getAllLinearFrozenNodes()
- */
+ @Override
public NodeIterator getAllLinearFrozenNodes() throws RepositoryException {
return new FrozenNodeIteratorAdapter(getAllLinearVersions());
}
- /**
- * @see VersionHistory#getVersion(String)
- */
- public Version getVersion(String versionName) throws VersionException, RepositoryException {
+ @Override
+ public Version getVersion(String versionName) throws RepositoryException {
checkStatus();
NodeState vState = getVersionState(versionName);
return (Version) getItemManager().getItem(vState.getHierarchyEntry());
}
- /**
- * @see VersionHistory#getVersionByLabel(String)
- */
+ @Override
public Version getVersionByLabel(String label) throws RepositoryException {
checkStatus();
return getVersionByLabel(getQLabel(label));
}
- /**
- * @see VersionHistory#addVersionLabel(String, String, boolean)
- */
- public void addVersionLabel(String versionName, String label, boolean moveLabel) throws VersionException, RepositoryException {
+ @Override
+ public void addVersionLabel(String versionName, String label, boolean moveLabel) throws RepositoryException {
checkStatus();
Name qLabel = getQLabel(label);
NodeState vState = getVersionState(versionName);
@@ -179,10 +162,8 @@ public class VersionHistoryImpl extends
session.getVersionStateManager().addVersionLabel((NodeState) getItemState(), vState, qLabel, moveLabel);
}
- /**
- * @see VersionHistory#removeVersionLabel(String)
- */
- public void removeVersionLabel(String label) throws VersionException, RepositoryException {
+ @Override
+ public void removeVersionLabel(String label) throws RepositoryException {
checkStatus();
Name qLabel = getQLabel(label);
Version version = getVersionByLabel(qLabel);
@@ -191,43 +172,37 @@ public class VersionHistoryImpl extends
session.getVersionStateManager().removeVersionLabel((NodeState) getItemState(), vState, qLabel);
}
- /**
- * @see VersionHistory#hasVersionLabel(String)
- */
+ @Override
public boolean hasVersionLabel(String label) throws RepositoryException {
checkStatus();
Name l = getQLabel(label);
Name[] qLabels = getQLabels();
- for (int i = 0; i < qLabels.length; i++) {
- if (qLabels[i].equals(l)) {
+ for (Name qLabel : qLabels) {
+ if (qLabel.equals(l)) {
return true;
}
}
return false;
}
- /**
- * @see VersionHistory#hasVersionLabel(Version, String)
- */
- public boolean hasVersionLabel(Version version, String label) throws VersionException, RepositoryException {
+ @Override
+ public boolean hasVersionLabel(Version version, String label) throws RepositoryException {
// check-status performed within checkValidVersion
checkValidVersion(version);
String vUUID = version.getUUID();
Name l = getQLabel(label);
Name[] qLabels = getQLabels();
- for (int i = 0; i < qLabels.length; i++) {
- if (qLabels[i].equals(l)) {
- String uuid = getVersionByLabel(qLabels[i]).getUUID();
+ for (Name qLabel : qLabels) {
+ if (qLabel.equals(l)) {
+ String uuid = getVersionByLabel(qLabel).getUUID();
return vUUID.equals(uuid);
}
}
return false;
}
- /**
- * @see VersionHistory#getVersionLabels()
- */
+ @Override
public String[] getVersionLabels() throws RepositoryException {
checkStatus();
Name[] qLabels = getQLabels();
@@ -239,45 +214,38 @@ public class VersionHistoryImpl extends
return labels;
}
- /**
- * @see VersionHistory#getVersionLabels(Version)
- */
- public String[] getVersionLabels(Version version) throws VersionException, RepositoryException {
+ @Override
+ public String[] getVersionLabels(Version version) throws RepositoryException {
// check-status performed within checkValidVersion
checkValidVersion(version);
String vUUID = version.getUUID();
List<String> vlabels = new ArrayList<String>();
Name[] qLabels = getQLabels();
- for (int i = 0; i < qLabels.length; i++) {
- String uuid = getVersionByLabel(qLabels[i]).getUUID();
+ for (Name qLabel : qLabels) {
+ String uuid = getVersionByLabel(qLabel).getUUID();
if (vUUID.equals(uuid)) {
- vlabels.add(session.getNameResolver().getJCRName(qLabels[i]));
+ vlabels.add(session.getNameResolver().getJCRName(qLabel));
}
}
return vlabels.toArray(new String[vlabels.size()]);
}
- /**
- * @see VersionHistory#removeVersion(String)
- */
- public void removeVersion(String versionName) throws ReferentialIntegrityException,
- AccessDeniedException, UnsupportedRepositoryOperationException,
- VersionException, RepositoryException {
+ @Override
+ public void removeVersion(String versionName) throws RepositoryException {
checkStatus();
NodeState vState = getVersionState(versionName);
session.getVersionStateManager().removeVersion((NodeState) getItemState(), vState);
}
- /**
- * @see VersionHistory#getVersionableIdentifier()
- */
+ @Override
public String getVersionableIdentifier() throws RepositoryException {
checkStatus();
return getProperty(NameConstants.JCR_VERSIONABLEUUID).getString();
}
//---------------------------------------------------------------< Item >---
+
/**
*
* @param otherItem
@@ -290,13 +258,14 @@ public class VersionHistoryImpl extends
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.
- VersionHistoryImpl other = ((VersionHistoryImpl) otherItem);
+ VersionHistoryImpl other = (VersionHistoryImpl) otherItem;
return vhEntry.getUniqueID().equals(other.vhEntry.getUniqueID());
}
return false;
}
//-----------------------------------------------------------< ItemImpl >---
+
/**
*
* @throws UnsupportedRepositoryOperationException
@@ -304,7 +273,7 @@ public class VersionHistoryImpl extends
* @throws RepositoryException
*/
@Override
- protected void checkIsWritable() throws UnsupportedRepositoryOperationException, ConstraintViolationException, RepositoryException {
+ protected void checkIsWritable() throws RepositoryException {
super.checkIsWritable();
throw new ConstraintViolationException("VersionHistory is protected");
}
@@ -320,7 +289,9 @@ public class VersionHistoryImpl extends
super.isWritable();
return false;
}
+
//------------------------------------------------------------< private >---
+
/**
*
* @return
@@ -345,7 +316,7 @@ public class VersionHistoryImpl extends
* @throws VersionException
* @throws RepositoryException
*/
- private NodeState getVersionState(String versionName) throws VersionException, RepositoryException {
+ private NodeState getVersionState(String versionName) throws RepositoryException {
try {
Name vName = session.getNameResolver().getQName(versionName);
refreshEntry(vhEntry);
@@ -367,7 +338,7 @@ public class VersionHistoryImpl extends
* @throws VersionException
* @throws RepositoryException
*/
- private Version getVersionByLabel(Name qLabel) throws VersionException, RepositoryException {
+ private Version getVersionByLabel(Name qLabel) throws RepositoryException {
refreshEntry(labelNodeEntry);
// retrieve reference property value -> and retrieve referenced node
PropertyEntry pEntry = labelNodeEntry.getPropertyEntry(qLabel, true);
@@ -403,7 +374,7 @@ public class VersionHistoryImpl extends
* @throws javax.jcr.version.VersionException
* @throws javax.jcr.RepositoryException
*/
- private void checkValidVersion(Version version) throws VersionException, RepositoryException {
+ private void checkValidVersion(Version version) throws RepositoryException {
if (!version.getContainingHistory().isSame(this)) {
throw new VersionException("Specified version '" + version.getName() + "' is not part of this history.");
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java Thu Sep 1 11:52:08 2011
@@ -41,8 +41,7 @@ import org.slf4j.LoggerFactory;
* <code>VersionImpl</code>...
*/
public class VersionImpl extends NodeImpl implements Version {
-
- private static Logger log = LoggerFactory.getLogger(VersionImpl.class);
+ private static final Logger log = LoggerFactory.getLogger(VersionImpl.class);
public VersionImpl(SessionImpl session, NodeState state,
ItemLifeCycleListener[] listeners) {
@@ -50,30 +49,23 @@ public class VersionImpl extends NodeImp
}
//------------------------------------------------------------< Version >---
- /**
- * @see Version#getContainingHistory()
- */
+
+ @Override
public VersionHistory getContainingHistory() throws RepositoryException {
return (VersionHistory) getParent();
}
- /**
- * @see Version#getCreated()
- */
+ @Override
public Calendar getCreated() throws RepositoryException {
return getProperty(NameConstants.JCR_CREATED).getDate();
}
- /**
- * @see Version#getSuccessors()
- */
+ @Override
public Version[] getSuccessors() throws RepositoryException {
return getVersions(NameConstants.JCR_SUCCESSORS);
}
- /**
- * @see Version#getLinearSuccessor()
- */
+ @Override
public Version getLinearSuccessor() throws RepositoryException {
// TODO: improve.
VersionHistory vh = getContainingHistory();
@@ -88,16 +80,12 @@ public class VersionImpl extends NodeImp
return null;
}
- /**
- * @see Version#getPredecessors()
- */
+ @Override
public Version[] getPredecessors() throws RepositoryException {
return getVersions(NameConstants.JCR_PREDECESSORS);
}
- /**
- * @see Version#getLinearPredecessor()
- */
+ @Override
public Version getLinearPredecessor() throws RepositoryException {
Value[] values = getProperty(NameConstants.JCR_PREDECESSORS).getValues();
if (values != null && values.length > 0) {
@@ -112,15 +100,14 @@ public class VersionImpl extends NodeImp
}
}
- /**
- * @see Version#getFrozenNode()
- */
+ @Override
public Node getFrozenNode() throws RepositoryException {
return getNode(NameConstants.JCR_FROZENNODE, 1);
}
//---------------------------------------------------------------< Item >---
+
/**
*
* @param otherItem
@@ -133,7 +120,7 @@ public class VersionImpl extends NodeImp
if (otherItem instanceof VersionImpl) {
// since all versions are referenceable, protected and live
// in the same workspace, a simple comparison of the UUIDs is sufficient
- VersionImpl other = ((VersionImpl) otherItem);
+ VersionImpl other = (VersionImpl) otherItem;
try {
return getUUID().equals(other.getUUID());
} catch (RepositoryException e) {
@@ -145,6 +132,7 @@ public class VersionImpl extends NodeImp
}
//-----------------------------------------------------------< ItemImpl >---
+
/**
* Always throws ConstraintViolationException since the version storage is
* protected.
@@ -154,7 +142,7 @@ public class VersionImpl extends NodeImp
* @throws RepositoryException
*/
@Override
- protected void checkIsWritable() throws UnsupportedRepositoryOperationException, ConstraintViolationException, RepositoryException {
+ protected void checkIsWritable() throws RepositoryException {
super.checkIsWritable();
throw new ConstraintViolationException("Version is protected");
}
@@ -171,6 +159,7 @@ public class VersionImpl extends NodeImp
return false;
}
//------------------------------------------------------------< private >---
+
/**
*
* @param propertyName
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java Thu Sep 1 11:52:08 2011
@@ -50,7 +50,8 @@ public interface VersionManager {
* @throws RepositoryException
* @see javax.jcr.Node#checkin()
*/
- public NodeEntry checkin(NodeState nodeState) throws VersionException, UnsupportedRepositoryOperationException, InvalidItemStateException, LockException, RepositoryException;
+ NodeEntry checkin(NodeState nodeState) throws VersionException, UnsupportedRepositoryOperationException,
+ InvalidItemStateException, LockException, RepositoryException;
/**
* @param nodeState
@@ -59,7 +60,8 @@ public interface VersionManager {
* @throws RepositoryException
* @see javax.jcr.Node#checkout()
*/
- public void checkout(NodeState nodeState) throws UnsupportedRepositoryOperationException, LockException, RepositoryException;
+ void checkout(NodeState nodeState) throws UnsupportedRepositoryOperationException, LockException,
+ RepositoryException;
/**
*
@@ -67,28 +69,28 @@ public interface VersionManager {
* @param activityId
* @throws RepositoryException
*/
- public void checkout(NodeState nodeState, NodeId activityId) throws RepositoryException;
+ void checkout(NodeState nodeState, NodeId activityId) throws RepositoryException;
/**
* @param nodeState
* @throws RepositoryException
* @see javax.jcr.version.VersionManager#checkpoint(String)
*/
- public NodeEntry checkpoint(NodeState nodeState) throws RepositoryException;
+ NodeEntry checkpoint(NodeState nodeState) throws RepositoryException;
/**
* @param nodeState
* @throws RepositoryException
* @see javax.jcr.version.VersionManager#checkpoint(String)
*/
- public NodeEntry checkpoint(NodeState nodeState, NodeId activityId) throws RepositoryException;
+ NodeEntry checkpoint(NodeState nodeState, NodeId activityId) throws RepositoryException;
/**
* @param nodeState
* @return
* @throws RepositoryException
* @see javax.jcr.Node#isCheckedOut()
*/
- public boolean isCheckedOut(NodeState nodeState) throws RepositoryException;
+ boolean isCheckedOut(NodeState nodeState) throws RepositoryException;
/**
* @param nodeState
@@ -97,7 +99,7 @@ public interface VersionManager {
* @throws RepositoryException If another error occurs.
* @see javax.jcr.Node#isCheckedOut()
*/
- public void checkIsCheckedOut(NodeState nodeState) throws VersionException, RepositoryException;
+ void checkIsCheckedOut(NodeState nodeState) throws VersionException, RepositoryException;
/**
* @param versionHistoryState
@@ -109,7 +111,8 @@ public interface VersionManager {
* @throws RepositoryException
* @see javax.jcr.version.VersionHistory#removeVersion(String)
*/
- public void removeVersion(NodeState versionHistoryState, NodeState versionState) throws ReferentialIntegrityException, AccessDeniedException, UnsupportedRepositoryOperationException, VersionException, RepositoryException;
+ void removeVersion(NodeState versionHistoryState, NodeState versionState) throws ReferentialIntegrityException,
+ AccessDeniedException, UnsupportedRepositoryOperationException, VersionException, RepositoryException;
/**
* @param versionHistoryState
@@ -120,7 +123,8 @@ public interface VersionManager {
* @throws RepositoryException
* @see javax.jcr.version.VersionHistory#addVersionLabel(String, String, boolean)
*/
- public void addVersionLabel(NodeState versionHistoryState, NodeState versionState, Name qLabel, boolean moveLabel) throws VersionException, RepositoryException;
+ void addVersionLabel(NodeState versionHistoryState, NodeState versionState, Name qLabel, boolean moveLabel)
+ throws VersionException, RepositoryException;
/**
* @param versionHistoryState
@@ -130,7 +134,8 @@ public interface VersionManager {
* @throws RepositoryException
* @see javax.jcr.version.VersionHistory#removeVersionLabel(String)
*/
- public void removeVersionLabel(NodeState versionHistoryState, NodeState versionState, Name qLabel) throws VersionException, RepositoryException;
+ void removeVersionLabel(NodeState versionHistoryState, NodeState versionState, Name qLabel) throws VersionException,
+ RepositoryException;
/**
* @param nodeState
@@ -148,7 +153,9 @@ public interface VersionManager {
* @see javax.jcr.Node#restore(Version, String, boolean)
* @see javax.jcr.Node#restoreByLabel(String, boolean)
*/
- public void restore(NodeState nodeState, Path relativePath, NodeState versionState, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException;
+ void restore(NodeState nodeState, Path relativePath, NodeState versionState, boolean removeExisting)
+ throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException,
+ InvalidItemStateException, RepositoryException;
/**
* @param versionStates
@@ -161,7 +168,9 @@ public interface VersionManager {
* @throws RepositoryException
* @see javax.jcr.Workspace#restore(Version[], boolean)
*/
- public void restore(NodeState[] versionStates, boolean removeExisting) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException;
+ void restore(NodeState[] versionStates, boolean removeExisting) throws ItemExistsException,
+ UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException,
+ RepositoryException;
/**
* @param nodeState
@@ -178,7 +187,9 @@ public interface VersionManager {
* @see #resolveMergeConflict(NodeState,NodeState,boolean)
* @see javax.jcr.Node#merge(String, boolean)
*/
- public Iterator<NodeId> merge(NodeState nodeState, String workspaceName, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException;
+ Iterator<NodeId> merge(NodeState nodeState, String workspaceName, boolean bestEffort)
+ throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException,
+ InvalidItemStateException, RepositoryException;
/**
* @param nodeState
@@ -196,7 +207,9 @@ public interface VersionManager {
* @see #resolveMergeConflict(NodeState,NodeState,boolean)
* @see javax.jcr.Node#merge(String, boolean)
*/
- public Iterator<NodeId> merge(NodeState nodeState, String workspaceName, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException;
+ Iterator<NodeId> merge(NodeState nodeState, String workspaceName, boolean bestEffort, boolean isShallow)
+ throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException,
+ InvalidItemStateException, RepositoryException;
/**
@@ -210,7 +223,8 @@ public interface VersionManager {
* @see javax.jcr.Node#cancelMerge(Version)
* @see javax.jcr.Node#doneMerge(Version)
*/
- public void resolveMergeConflict(NodeState nodeState, NodeState versionState, boolean done) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException;
+ void resolveMergeConflict(NodeState nodeState, NodeState versionState, boolean done) throws VersionException,
+ InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException;
/**
*
@@ -219,7 +233,7 @@ public interface VersionManager {
* @throws UnsupportedRepositoryOperationException
* @throws RepositoryException
*/
- public NodeEntry createConfiguration(NodeState nodeState) throws UnsupportedRepositoryOperationException, RepositoryException;
+ NodeEntry createConfiguration(NodeState nodeState) throws UnsupportedRepositoryOperationException, RepositoryException;
/**
*
@@ -228,7 +242,7 @@ public interface VersionManager {
* @throws UnsupportedRepositoryOperationException
* @throws RepositoryException
*/
- public NodeEntry createActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException;
+ NodeEntry createActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException;
/**
*
@@ -236,7 +250,7 @@ public interface VersionManager {
* @throws UnsupportedRepositoryOperationException
* @throws RepositoryException
*/
- public void removeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException;
+ void removeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException;
/**
*
@@ -245,19 +259,20 @@ public interface VersionManager {
* @throws UnsupportedRepositoryOperationException
* @throws RepositoryException
*/
- public Iterator<NodeId> mergeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException;
+ Iterator<NodeId> mergeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException,
+ RepositoryException;
/**
*
* @param versionState
* @return
*/
- public NodeEntry getVersionableNodeEntry(NodeState versionState) throws RepositoryException;
+ NodeEntry getVersionableNodeEntry(NodeState versionState) throws RepositoryException;
/**
*
* @param versionableState
* @return
*/
- public NodeEntry getVersionHistoryEntry(NodeState versionableState) throws RepositoryException;
+ NodeEntry getVersionHistoryEntry(NodeState versionableState) throws RepositoryException;
}
\ No newline at end of file
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java Thu Sep 1 11:52:08 2011
@@ -56,35 +56,39 @@ import org.apache.jackrabbit.spi.commons
* <code>VersionManagerImpl</code>...
*/
public class VersionManagerImpl implements VersionManager {
-
private final WorkspaceManager workspaceManager;
public VersionManagerImpl(WorkspaceManager workspaceManager) {
this.workspaceManager = workspaceManager;
}
+ @Override
public NodeEntry checkin(NodeState nodeState) throws RepositoryException {
Checkin ci = Checkin.create(nodeState, this);
workspaceManager.execute(ci);
return workspaceManager.getHierarchyManager().getNodeEntry(ci.getNewVersionId());
}
+ @Override
public void checkout(NodeState nodeState) throws RepositoryException {
Operation co = Checkout.create(nodeState, this);
workspaceManager.execute(co);
}
+ @Override
public void checkout(NodeState nodeState, NodeId activityId) throws RepositoryException {
Operation co = Checkout.create(nodeState, activityId, this);
workspaceManager.execute(co);
}
+ @Override
public NodeEntry checkpoint(NodeState nodeState) throws RepositoryException {
Checkpoint cp = Checkpoint.create(nodeState, this);
workspaceManager.execute(cp);
return workspaceManager.getHierarchyManager().getNodeEntry(cp.getNewVersionId());
}
+ @Override
public NodeEntry checkpoint(NodeState nodeState, NodeId activityId) throws RepositoryException {
Checkpoint cp = Checkpoint.create(nodeState, activityId, this);
workspaceManager.execute(cp);
@@ -99,6 +103,7 @@ public class VersionManagerImpl implemen
* @return
* @throws RepositoryException
*/
+ @Override
public boolean isCheckedOut(NodeState nodeState) throws RepositoryException {
// shortcut: if state is new, its ancestor must be checkout
if (nodeState.getStatus() == Status.NEW) {
@@ -120,8 +125,7 @@ public class VersionManagerImpl implemen
nodeEntry = parent;
}
PropertyState propState = nodeEntry.getPropertyEntry(NameConstants.JCR_ISCHECKEDOUT).getPropertyState();
- Boolean b = Boolean.valueOf(propState.getValue().getString());
- return b.booleanValue();
+ return Boolean.valueOf(propState.getValue().getString());
} catch (ItemNotFoundException e) {
// error while accessing jcr:isCheckedOut property state.
// -> assume that checkedOut status is ok. see above for general
@@ -130,49 +134,65 @@ public class VersionManagerImpl implemen
return true;
}
- public void checkIsCheckedOut(NodeState nodeState) throws VersionException, RepositoryException {
+ @Override
+ public void checkIsCheckedOut(NodeState nodeState) throws RepositoryException {
if (!isCheckedOut(nodeState)) {
throw new VersionException(nodeState + " is checked-in");
}
}
+ @Override
public void removeVersion(NodeState versionHistoryState, NodeState versionState) throws RepositoryException {
Operation op = RemoveVersion.create(versionState, versionHistoryState, this);
workspaceManager.execute(op);
}
- public void addVersionLabel(NodeState versionHistoryState, NodeState versionState, Name qLabel, boolean moveLabel) throws RepositoryException {
+ @Override
+ public void addVersionLabel(NodeState versionHistoryState, NodeState versionState, Name qLabel, boolean moveLabel)
+ throws RepositoryException {
+
Operation op = AddLabel.create(versionHistoryState, versionState, qLabel, moveLabel);
workspaceManager.execute(op);
}
- public void removeVersionLabel(NodeState versionHistoryState, NodeState versionState, Name qLabel) throws RepositoryException {
+ @Override
+ public void removeVersionLabel(NodeState versionHistoryState, NodeState versionState, Name qLabel)
+ throws RepositoryException {
+
Operation op = RemoveLabel.create(versionHistoryState, versionState, qLabel);
workspaceManager.execute(op);
}
- public void restore(NodeState nodeState, Path relativePath, NodeState versionState, boolean removeExisting) throws RepositoryException {
+ @Override
+ public void restore(NodeState nodeState, Path relativePath, NodeState versionState, boolean removeExisting)
+ throws RepositoryException {
+
Operation op = Restore.create(nodeState, relativePath, versionState, removeExisting);
workspaceManager.execute(op);
}
+ @Override
public void restore(NodeState[] versionStates, boolean removeExisting) throws RepositoryException {
Operation op = Restore.create(versionStates, removeExisting);
workspaceManager.execute(op);
}
+ @Override
public Iterator<NodeId> merge(NodeState nodeState, String workspaceName, boolean bestEffort) throws RepositoryException {
return merge(nodeState, workspaceName, bestEffort, false);
}
- public Iterator<NodeId> merge(NodeState nodeState, String workspaceName, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+ @Override
+ public Iterator<NodeId> merge(NodeState nodeState, String workspaceName, boolean bestEffort, boolean isShallow)
+ throws RepositoryException {
+
Merge op = Merge.create(nodeState, workspaceName, bestEffort, isShallow, this);
workspaceManager.execute(op);
return op.getFailedIds();
}
- public void resolveMergeConflict(NodeState nodeState, NodeState versionState,
- boolean done) throws RepositoryException {
+ @Override
+ public void resolveMergeConflict(NodeState nodeState, NodeState versionState, boolean done) throws RepositoryException {
NodeId vId = versionState.getNodeId();
PropertyState mergeFailedState = nodeState.getPropertyState(NameConstants.JCR_MERGEFAILED);
@@ -186,13 +206,13 @@ public class VersionManagerImpl implemen
j++;
}
// else: the version id is being solved by this call and not
- // part of 'jcr:mergefailed' any more
+ // part of 'jcr:mergeFailed' any more
}
PropertyState predecessorState = nodeState.getPropertyState(NameConstants.JCR_PREDECESSORS);
vs = predecessorState.getValues();
- int noOfPredecessors = (done) ? vs.length + 1 : vs.length;
+ int noOfPredecessors = done ? vs.length + 1 : vs.length;
NodeId[] predecessorIds = new NodeId[noOfPredecessors];
int i = 0;
@@ -207,29 +227,34 @@ public class VersionManagerImpl implemen
workspaceManager.execute(op);
}
- public NodeEntry createConfiguration(NodeState nodeState) throws UnsupportedRepositoryOperationException, RepositoryException {
+ @Override
+ public NodeEntry createConfiguration(NodeState nodeState) throws RepositoryException {
CreateConfiguration op = CreateConfiguration.create(nodeState, this);
workspaceManager.execute(op);
return workspaceManager.getHierarchyManager().getNodeEntry(op.getNewConfigurationId());
}
- public NodeEntry createActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException {
+ @Override
+ public NodeEntry createActivity(String title) throws RepositoryException {
CreateActivity op = CreateActivity.create(title, this);
workspaceManager.execute(op);
return workspaceManager.getHierarchyManager().getNodeEntry(op.getNewActivityId());
}
- public void removeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException {
+ @Override
+ public void removeActivity(NodeState activityState) throws RepositoryException {
Operation op = RemoveActivity.create(activityState, workspaceManager.getHierarchyManager());
workspaceManager.execute(op);
}
- public Iterator<NodeId> mergeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException {
+ @Override
+ public Iterator<NodeId> mergeActivity(NodeState activityState) throws RepositoryException {
Merge op = Merge.create(activityState, null, false, false, this);
workspaceManager.execute(op);
return op.getFailedIds();
}
+ @Override
public NodeEntry getVersionableNodeEntry(NodeState versionState) throws RepositoryException {
NodeState ns = versionState.getChildNodeState(NameConstants.JCR_FROZENNODE, Path.INDEX_DEFAULT);
PropertyState ps = ns.getPropertyState(NameConstants.JCR_FROZENUUID);
@@ -239,6 +264,7 @@ public class VersionManagerImpl implemen
return workspaceManager.getHierarchyManager().getNodeEntry(versionableId);
}
+ @Override
public NodeEntry getVersionHistoryEntry(NodeState versionableState) throws RepositoryException {
PropertyState ps = versionableState.getPropertyState(NameConstants.JCR_VERSIONHISTORY);
String uniqueID = ps.getValue().getString();
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/DocViewImportHandler.java Thu Sep 1 11:52:08 2011
@@ -42,8 +42,7 @@ import org.xml.sax.SAXException;
* and 'translates' them into <code>{@link Importer}</code> method calls.
*/
class DocViewImportHandler extends TargetImportHandler {
-
- private static Logger log = LoggerFactory.getLogger(DocViewImportHandler.class);
+ private static final Logger log = LoggerFactory.getLogger(DocViewImportHandler.class);
private final NameFactory nameFactory;
/**
@@ -52,7 +51,8 @@ class DocViewImportHandler extends Targe
* endElement method.
*/
private final Stack<Importer.NodeInfo> stack = new Stack<Importer.NodeInfo>();
- // buffer used to merge adjacent character data
+
+ /** buffer used to merge adjacent character data */
private BufferedStringValue textHandler = new BufferedStringValue();
/**
@@ -62,8 +62,7 @@ class DocViewImportHandler extends Targe
* @param resolver
* @param nameFactory
*/
- DocViewImportHandler(Importer importer, NamePathResolver resolver,
- NameFactory nameFactory) {
+ DocViewImportHandler(Importer importer, NamePathResolver resolver, NameFactory nameFactory) {
super(importer, resolver);
this.nameFactory = nameFactory;
}
@@ -79,8 +78,7 @@ class DocViewImportHandler extends Targe
* @see #ignorableWhitespace(char[], int, int)
* @see #processCharacters()
*/
- private void appendCharacters(char[] ch, int start, int length)
- throws SAXException {
+ private void appendCharacters(char[] ch, int start, int length) throws SAXException {
if (textHandler == null) {
textHandler = new BufferedStringValue();
}
@@ -103,8 +101,7 @@ class DocViewImportHandler extends Targe
* @throws SAXException if an error occurs
* @see #appendCharacters(char[], int, int)
*/
- private void processCharacters()
- throws SAXException {
+ private void processCharacters() throws SAXException {
try {
if (textHandler != null && textHandler.length() > 0) {
// there is character data that needs to be added to
@@ -165,9 +162,9 @@ class DocViewImportHandler extends Targe
* regarding special handling of multi-valued properties on export.
*/
@Override
- public void startElement(String namespaceURI, String localName,
- String qName, Attributes atts)
+ public void startElement(String namespaceURI, String localName, String qName, Attributes attributes)
throws SAXException {
+
// process buffered character data
processCharacters();
@@ -180,19 +177,19 @@ class DocViewImportHandler extends Targe
Name nodeTypeName = null;
Name[] mixinTypes = null;
- List<Importer.PropInfo> props = new ArrayList<Importer.PropInfo>(atts.getLength());
- for (int i = 0; i < atts.getLength(); i++) {
- if (atts.getURI(i).equals(Name.NS_XMLNS_URI)) {
+ List<Importer.PropInfo> props = new ArrayList<Importer.PropInfo>(attributes.getLength());
+ for (int i = 0; i < attributes.getLength(); i++) {
+ if (attributes.getURI(i).equals(Name.NS_XMLNS_URI)) {
// skip namespace declarations reported as attributes
// see http://issues.apache.org/jira/browse/JCR-620#action_12448164
continue;
}
- dcdLocalName = ISO9075.decode(atts.getLocalName(i));
- Name propName = nameFactory.create(atts.getURI(i), dcdLocalName);
+ dcdLocalName = ISO9075.decode(attributes.getLocalName(i));
+ Name propName = nameFactory.create(attributes.getURI(i), dcdLocalName);
// attribute value
- String attrValue = atts.getValue(i);
+ String attrValue = attributes.getValue(i);
if (propName.equals(NameConstants.JCR_PRIMARYTYPE)) {
// jcr:primaryType
if (attrValue.length() > 0) {
@@ -258,38 +255,22 @@ class DocViewImportHandler extends Targe
return qnames;
}
- /**
- * {@inheritDoc}
- */
@Override
- public void characters(char[] ch, int start, int length)
- throws SAXException {
- /**
- * buffer data reported by the characters event;
- * will be processed on the next endElement or startElement event.
- */
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ // buffer data reported by the characters event;
+ // will be processed on the next endElement or startElement event.
appendCharacters(ch, start, length);
}
- /**
- * {@inheritDoc}
- */
@Override
- public void ignorableWhitespace(char[] ch, int start, int length)
- throws SAXException {
- /**
- * buffer data reported by the ignorableWhitespace event;
- * will be processed on the next endElement or startElement event.
- */
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+ // buffer data reported by the ignorableWhitespace event;
+ // will be processed on the next endElement or startElement event.
appendCharacters(ch, start, length);
}
- /**
- * {@inheritDoc}
- */
@Override
- public void endElement(String namespaceURI, String localName, String qName)
- throws SAXException {
+ public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
// process buffered character data
processCharacters();
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/ImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/ImportHandler.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/ImportHandler.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/ImportHandler.java Thu Sep 1 11:52:08 2011
@@ -55,8 +55,7 @@ import org.xml.sax.helpers.NamespaceSupp
* (i.e. default SAX2 Namespace processing).
*/
public class ImportHandler extends DefaultHandler {
-
- private static Logger log = LoggerFactory.getLogger(ImportHandler.class);
+ private static final Logger log = LoggerFactory.getLogger(ImportHandler.class);
private final Importer importer;
private final NamespaceRegistry nsReg;
@@ -79,9 +78,9 @@ public class ImportHandler extends Defau
*/
protected boolean nsContextStarted;
- public ImportHandler(Importer importer, NamespaceResolver nsResolver,
- NamespaceRegistry nsReg, NameFactory nameFactory,
- PathFactory pathFactory) {
+ public ImportHandler(Importer importer, NamespaceResolver nsResolver, NamespaceRegistry nsReg,
+ NameFactory nameFactory, PathFactory pathFactory) {
+
this.importer = importer;
this.nsResolver = nsResolver;
this.nsReg = nsReg;
@@ -93,9 +92,7 @@ public class ImportHandler extends Defau
}
//---------------------------------------------------------< ErrorHandler >
- /**
- * {@inheritDoc}
- */
+
@Override
public void warning(SAXParseException e) throws SAXException {
// log exception and carry on...
@@ -104,9 +101,6 @@ public class ImportHandler extends Defau
+ " while parsing XML stream", e);
}
- /**
- * {@inheritDoc}
- */
@Override
public void error(SAXParseException e) throws SAXException {
// log exception and carry on...
@@ -115,9 +109,6 @@ public class ImportHandler extends Defau
+ " while parsing XML stream: " + e.toString());
}
- /**
- * {@inheritDoc}
- */
@Override
public void fatalError(SAXParseException e) throws SAXException {
// log and re-throw exception
@@ -128,25 +119,19 @@ public class ImportHandler extends Defau
}
//-------------------------------------------------------< ContentHandler >
- /**
- * {@inheritDoc}
- */
@Override
public void startDocument() throws SAXException {
systemViewXML = false;
initialized = false;
targetHandler = null;
- /**
- * start initial context containing existing mappings reflected
- * by nsResolver
- */
+ // start initial context containing existing mappings reflected by nsResolver
nsContext.reset();
nsContext.pushContext();
try {
String[] uris = nsReg.getURIs();
- for (int i = 0; i < uris.length; i++) {
- nsContext.declarePrefix(nsResolver.getPrefix(uris[i]), uris[i]);
+ for (String uri : uris) {
+ nsContext.declarePrefix(nsResolver.getPrefix(uri), uri);
}
} catch (RepositoryException re) {
throw new SAXException(re);
@@ -156,9 +141,6 @@ public class ImportHandler extends Defau
nsContextStarted = false;
}
- /**
- * {@inheritDoc}
- */
@Override
public void endDocument() throws SAXException {
// delegate to target handler
@@ -167,12 +149,8 @@ public class ImportHandler extends Defau
nsContext.reset();
}
- /**
- * {@inheritDoc}
- */
@Override
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
+ public void startPrefixMapping(String prefix, String uri) throws SAXException {
// check if new context needs to be started
if (!nsContextStarted) {
// entering new namespace context
@@ -188,51 +166,41 @@ public class ImportHandler extends Defau
try {
String newPrefix;
if ("".equals(prefix)) {
- /**
- * the xml document specifies a default namespace
- * (i.e. an empty prefix); we need to create a random
- * prefix as the empty prefix is reserved according
- * to the JCR spec.
- */
+
+ // the xml document specifies a default namespace (i.e. an empty prefix);
+ // we need to create a random prefix as the empty prefix is reserved according
+ // to the JCR spec.
newPrefix = getUniquePrefix(uri);
} else {
newPrefix = prefix;
}
+
// register new namespace
nsReg.registerNamespace(newPrefix, uri);
} catch (RepositoryException re) {
throw new SAXException(re);
}
}
+
// map namespace in this context to given prefix
nsContext.declarePrefix(prefix, uri);
}
- /**
- * {@inheritDoc}
- */
@Override
public void endPrefixMapping(String prefix) throws SAXException {
- /**
- * nothing to do here as namespace context has already been popped
- * in endElement event
- */
+ // nothing to do here as namespace context has already been popped in endElement event
}
- /**
- * {@inheritDoc}
- */
@Override
- public void startElement(String namespaceURI, String localName, String qName,
- Attributes atts) throws SAXException {
+ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
// check if new context needs to be started
- if (!nsContextStarted) {
+ if (nsContextStarted) {
+ // reset flag
+ nsContextStarted = false;
+ } else {
// there hasn't been a proceeding startPrefixMapping event
// so enter new namespace context
nsContext.pushContext();
- } else {
- // reset flag
- nsContextStarted = false;
}
if (!initialized) {
@@ -253,21 +221,14 @@ public class ImportHandler extends Defau
targetHandler.startElement(namespaceURI, localName, qName, atts);
}
- /**
- * {@inheritDoc}
- */
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
// delegate to target handler
targetHandler.characters(ch, start, length);
}
- /**
- * {@inheritDoc}
- */
@Override
- public void endElement(String namespaceURI, String localName, String qName)
- throws SAXException {
+ public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
// leaving element, pop namespace context
nsContext.popContext();
@@ -276,10 +237,11 @@ public class ImportHandler extends Defau
}
//--------------------------------------------------------< inner classes >
+
/**
* <code>NamespaceContext</code> supports scoped namespace declarations.
*/
- class NamespaceContext implements NamespaceResolver {
+ static class NamespaceContext implements NamespaceResolver {
private final NamespaceSupport nsContext;
@@ -313,9 +275,8 @@ public class ImportHandler extends Defau
}
//------------------------------------------------< NamespaceResolver >
- /**
- * {@inheritDoc}
- */
+
+ @Override
public String getURI(String prefix) throws NamespaceException {
String uri = nsContext.getURI(prefix);
if (uri == null) {
@@ -327,20 +288,16 @@ public class ImportHandler extends Defau
}
}
- /**
- * {@inheritDoc}
- */
+ @Override
public String getPrefix(String uri) throws NamespaceException {
if (Name.NS_DEFAULT_URI.equals(uri)) {
uri = DUMMY_DEFAULT_URI;
}
String prefix = nsContext.getPrefix(uri);
if (prefix == null) {
- /**
- * NamespaceSupport#getPrefix will never return the empty
- * (default) prefix; we have to do a reverse-lookup to check
- * whether it's the current default namespace
- */
+ // NamespaceSupport#getPrefix will never return the empty
+ // (default) prefix; we have to do a reverse-lookup to check
+ // whether it's the current default namespace
if (uri.equals(nsContext.getURI(Name.NS_EMPTY_PREFIX))) {
return Name.NS_EMPTY_PREFIX;
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/Importer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/Importer.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/Importer.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/Importer.java Thu Sep 1 11:52:08 2011
@@ -56,7 +56,8 @@ public interface Importer {
void end() throws RepositoryException;
//--------------------------------------------------------< inner classes >
- static class NodeInfo {
+
+ class NodeInfo {
private final Name name;
private final Name nodeTypeName;
private final Name[] mixinNames;
@@ -90,7 +91,7 @@ public interface Importer {
}
}
- static class PropInfo {
+ class PropInfo {
private final Name name;
private final int type;
private final TextValue[] values;
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java Thu Sep 1 11:52:08 2011
@@ -76,8 +76,7 @@ import java.util.UUID;
* <code>SessionImporter</code>...
*/
public class SessionImporter implements Importer, SessionListener {
-
- private static Logger log = LoggerFactory.getLogger(SessionImporter.class);
+ private static final Logger log = LoggerFactory.getLogger(SessionImporter.class);
private final NodeState importTarget;
private final int uuidBehavior;
@@ -91,7 +90,7 @@ public class SessionImporter implements
private boolean sessionClosed;
/**
- * helper object that keeps track of remapped uuid's and imported reference
+ * helper object that keeps track of remapped uuid and imported reference
* properties that might need correcting depending on the uuid mappings
*/
private final ReferenceChangeTracker refTracker;
@@ -100,7 +99,7 @@ public class SessionImporter implements
* Creates a new <code>WorkspaceImporter</code> instance.
*
* @param parentPath Path of target node where to add the imported
- * subtree.
+ * sub-tree.
* @param session
* @param uuidBehavior Flag that governs how incoming UUIDs are handled.
* @throws PathNotFoundException If no node exists at <code>parentPath</code>
@@ -109,16 +108,14 @@ public class SessionImporter implements
* is protected.
* @throws VersionException If the node at <code>parentPath</code> is not
* checked-out.
- * @throws LockException If a lock prevents the addition of the subtree.
+ * @throws LockException If a lock prevents the addition of the sub-tree.
* @throws RepositoryException If another error occurs.
*/
- public SessionImporter(Path parentPath, SessionImpl session,
- SessionItemStateManager stateManager, int uuidBehavior)
- throws PathNotFoundException, ConstraintViolationException,
- VersionException, LockException, RepositoryException {
+ public SessionImporter(Path parentPath, SessionImpl session, SessionItemStateManager stateManager, int uuidBehavior)
+ throws RepositoryException {
this.session = session;
- this.stateMgr = stateManager;
+ stateMgr = stateManager;
this.uuidBehavior = uuidBehavior;
// perform preliminary checks
@@ -138,19 +135,17 @@ public class SessionImporter implements
}
//-----------------------------------------------------------< Importer >---
- /**
- * {@inheritDoc}
- */
+
+ @Override
public void start() throws RepositoryException {
// explicitly set status of importer and start listening on session
setClosed(false);
}
- /**
- * {@inheritDoc}
- */
- public void startNode(NodeInfo nodeInfo, List<PropInfo> propInfos, NamePathResolver resolver)
+ @Override
+ public void startNode(NodeInfo nodeInfo, List<PropInfo> propInfos, NamePathResolver resolver)
throws RepositoryException {
+
if (isClosed()) {
// workspace-importer only: ignore if import has been aborted before.
return;
@@ -234,9 +229,7 @@ public class SessionImporter implements
parents.push(nodeState);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void endNode(NodeInfo nodeInfo) throws RepositoryException {
if(isClosed()) {
// workspace-importer only: ignore if import has been aborted before.
@@ -245,9 +238,7 @@ public class SessionImporter implements
parents.pop();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void end() throws RepositoryException {
if(isClosed()) {
// workspace-importer only: ignore if import has been aborted before.
@@ -264,22 +255,15 @@ public class SessionImporter implements
}
}
//----------------------------------------------------< SessionListener >---
- /**
- *
- * @param session
- * @see SessionListener#loggingOut(Session)
- */
+
+ @Override
public void loggingOut(Session session) {
// the session will be be valid any more, thus any further calls on
// the importer must fail
sessionClosed = true;
}
- /**
- *
- * @param session
- * @see SessionListener#loggedOut(Session)
- */
+ @Override
public void loggedOut(Session session) {
// ignore
}
@@ -305,6 +289,7 @@ public class SessionImporter implements
}
//----------------------------------------------------< Private methods >---
+
/**
* @param parent
* @param conflicting
@@ -312,8 +297,7 @@ public class SessionImporter implements
* @return
* @throws RepositoryException
*/
- NodeState resolveUUIDConflict(NodeState parent, NodeEntry conflicting,
- NodeInfo nodeInfo) throws ItemExistsException, RepositoryException {
+ NodeState resolveUUIDConflict(NodeState parent, NodeEntry conflicting, NodeInfo nodeInfo) throws RepositoryException {
NodeState nodeState;
switch (uuidBehavior) {
case ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW:
@@ -387,25 +371,24 @@ public class SessionImporter implements
* @throws ItemNotFoundException
* @throws RepositoryException
*/
- private NodeState importNode(NodeInfo nodeInfo, NodeState parent) throws ConstraintViolationException, ItemNotFoundException, RepositoryException {
+ private NodeState importNode(NodeInfo nodeInfo, NodeState parent) throws RepositoryException {
Name[] parentNtNames = parent.getAllNodeTypeNames();
if (parent.hasPropertyName(nodeInfo.getName())) {
- /**
- * a property with the same name already exists; if this property
- * has been imported as well (e.g. through document view import
- * where an element can have the same name as one of the attributes
- * of its parent element) we have to rename the conflicting property;
- *
- * see http://issues.apache.org/jira/browse/JCR-61
- */
+
+ // a property with the same name already exists; if this property has been imported as well
+ // (e.g. through document view import where an element can have the same name as one of the
+ // attributes of its parent element) we have to rename the conflicting property;
+ // see http://issues.apache.org/jira/browse/JCR-61
PropertyState conflicting = parent.getPropertyState(nodeInfo.getName());
if (conflicting.getStatus() == Status.NEW) {
// assume this property has been imported as well;
// rename conflicting property
// TODO: use better reversible escaping scheme to create unique name
- Name newName = session.getNameFactory().create(nodeInfo.getName().getNamespaceURI(), nodeInfo.getName().getLocalName() + "_");
+ Name newName = session.getNameFactory().create(nodeInfo.getName().getNamespaceURI(),
+ nodeInfo.getName().getLocalName() + '_');
+
if (parent.hasPropertyName(newName)) {
- newName = session.getNameFactory().create(newName.getNamespaceURI(), newName.getLocalName() + "_");
+ newName = session.getNameFactory().create(newName.getNamespaceURI(), newName.getLocalName() + '_');
}
// since name changes, need to find new applicable definition
QPropertyDefinition propDef;
@@ -413,14 +396,17 @@ public class SessionImporter implements
// could be single- or multi-valued (n == 1)
try {
// try single-valued
- propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames, newName, conflicting.getType(), false);
+ propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames, newName,
+ conflicting.getType(), false);
} catch (ConstraintViolationException cve) {
// try multi-valued
- propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames, newName, conflicting.getType(), true);
+ propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames, newName,
+ conflicting.getType(), true);
}
} else {
// can only be multi-valued (n == 0 || n > 1)
- propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames, newName, conflicting.getType(), true);
+ propDef = session.getItemDefinitionProvider().getQPropertyDefinition(parentNtNames, newName,
+ conflicting.getType(), true);
}
Operation ap = AddProperty.create(parent, newName, conflicting.getType(), propDef, conflicting.getValues());
@@ -431,9 +417,11 @@ public class SessionImporter implements
}
// do create new nodeState
- QNodeDefinition def = session.getItemDefinitionProvider().getQNodeDefinition(parentNtNames, nodeInfo.getName(), nodeInfo.getNodeTypeName());
+ QNodeDefinition def = session.getItemDefinitionProvider().getQNodeDefinition(parentNtNames, nodeInfo.getName(),
+ nodeInfo.getNodeTypeName());
+
if (def.isProtected()) {
- log.debug("Skipping protected nodeState (" + nodeInfo.getName() + ")");
+ log.debug("Skipping protected nodeState (" + nodeInfo.getName() + ')');
return null;
} else {
Name ntName = nodeInfo.getNodeTypeName();
@@ -464,7 +452,7 @@ public class SessionImporter implements
* @throws RepositoryException
* @throws ConstraintViolationException
*/
- private void importProperty(PropInfo pi, NodeState parentState, NamePathResolver resolver) throws RepositoryException, ConstraintViolationException {
+ private void importProperty(PropInfo pi, NodeState parentState, NamePathResolver resolver) throws RepositoryException {
Name propName = pi.getName();
TextValue[] tva = pi.getValues();
int infoType = pi.getType();
@@ -585,14 +573,14 @@ public class SessionImporter implements
case PropertyType.BINARY:
// base64 encoded BINARY type
if (tv.length() < 0x10000) {
- // < 65kb: deserialize BINARY type in memory
+ // < 65kb: de-serialize BINARY type in memory
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Base64.decode(tv.retrieve(), baos);
// no need to close ByteArrayOutputStream
//baos.close();
iv = session.getQValueFactory().create(baos.toByteArray());
} else {
- // >= 65kb: deserialize BINARY type
+ // >= 65kb: de-serialize BINARY type
// using Reader and temporary file
TransientFileFactory fileFactory = TransientFileFactory.getInstance();
File tmpFile = fileFactory.createTransientFile("bin", null, null);
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SysViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SysViewImportHandler.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SysViewImportHandler.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SysViewImportHandler.java Thu Sep 1 11:52:08 2011
@@ -26,6 +26,7 @@ import javax.jcr.NamespaceException;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
+import org.apache.jackrabbit.jcr2spi.xml.Importer.TextValue;
import org.apache.jackrabbit.spi.Name;
import org.apache.jackrabbit.spi.commons.conversion.NameException;
import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
@@ -66,7 +67,8 @@ class SysViewImportHandler extends Targe
*/
private Name currentPropName;
private int currentPropType = PropertyType.UNDEFINED;
- // list of AppendableValue objects
+
+ /** list of AppendableValue objects */
private final List<Importer.TextValue> currentPropValues = new ArrayList<Importer.TextValue>();
private AppendableValue currentPropValue;
@@ -80,8 +82,7 @@ class SysViewImportHandler extends Targe
super(importer, resolver);
}
- private void processNode(ImportState state, boolean start, boolean end)
- throws SAXException {
+ private void processNode(ImportState state, boolean start, boolean end) throws SAXException {
if (!start && !end) {
return;
}
@@ -112,13 +113,11 @@ class SysViewImportHandler extends Targe
}
//-------------------------------------------------------< ContentHandler >
- /**
- * {@inheritDoc}
- */
+
@Override
- public void startElement(String namespaceURI, String localName,
- String qName, Attributes atts)
+ public void startElement(String namespaceURI, String localName, String qName, Attributes attributes)
throws SAXException {
+
// check namespace
if (!Name.NS_SV_URI.equals(namespaceURI)) {
throw new SAXException(new InvalidSerializedDataException("invalid namespace for element in system view xml document: "
@@ -129,7 +128,7 @@ class SysViewImportHandler extends Targe
// sv:node element
// node name (value of sv:name attribute)
- String name = atts.getValue(Name.NS_SV_URI, NAME);
+ String name = attributes.getValue(Name.NS_SV_URI, NAME);
if (name == null) {
throw new SAXException(new InvalidSerializedDataException(
"missing mandatory sv:name attribute of element sv:node"));
@@ -162,7 +161,7 @@ class SysViewImportHandler extends Targe
currentPropValues.clear();
// property name (value of sv:name attribute)
- String name = atts.getValue(Name.NS_SV_URI, NAME);
+ String name = attributes.getValue(Name.NS_SV_URI, NAME);
if (name == null) {
throw new SAXException(new InvalidSerializedDataException(
"missing mandatory sv:name attribute of element sv:property"));
@@ -175,7 +174,7 @@ class SysViewImportHandler extends Targe
throw new SAXException(new InvalidSerializedDataException("illegal property name: " + name, e));
}
// property type (sv:type attribute)
- String type = atts.getValue(Name.NS_SV_URI, TYPE);
+ String type = attributes.getValue(Name.NS_SV_URI, TYPE);
if (type == null) {
throw new SAXException(new InvalidSerializedDataException(
"missing mandatory sv:type attribute of element sv:property"));
@@ -192,12 +191,8 @@ class SysViewImportHandler extends Targe
}
}
- /**
- * {@inheritDoc}
- */
@Override
- public void characters(char[] ch, int start, int length)
- throws SAXException {
+ public void characters(char[] ch, int start, int length) throws SAXException {
if (currentPropValue != null) {
// property value (character data of sv:value element)
try {
@@ -209,12 +204,8 @@ class SysViewImportHandler extends Targe
}
}
- /**
- * {@inheritDoc}
- */
@Override
- public void ignorableWhitespace(char[] ch, int start, int length)
- throws SAXException {
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
if (currentPropValue != null) {
// property value
@@ -229,23 +220,19 @@ class SysViewImportHandler extends Targe
}
}
- /**
- * {@inheritDoc}
- */
@Override
- public void endElement(String namespaceURI, String localName, String qName)
- throws SAXException {
+ public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
// check element name
ImportState state = stack.peek();
if (NODE.equals(localName)) {
// sv:node element
- if (!state.started) {
+ if (state.started) {
+ // need to end current node
+ processNode(state, false, true);
+ } else {
// need to start & end current node
processNode(state, true, true);
state.started = true;
- } else {
- // need to end current node
- processNode(state, false, true);
}
// pop current state from stack
stack.pop();
@@ -271,19 +258,21 @@ class SysViewImportHandler extends Targe
if (state.mixinNames == null) {
state.mixinNames = new ArrayList<Name>(currentPropValues.size());
}
- for (int i = 0; i < currentPropValues.size(); i++) {
- AppendableValue val =
- (AppendableValue) currentPropValues.get(i);
+ for (TextValue currentPropValue1 : currentPropValues) {
+ AppendableValue val = (AppendableValue) currentPropValue1;
String s = null;
try {
s = val.retrieve();
Name mixin = resolver.getQName(s);
state.mixinNames.add(mixin);
- } catch (IOException ioe) {
+ }
+ catch (IOException ioe) {
throw new SAXException("error while retrieving value", ioe);
- } catch (NameException e) {
+ }
+ catch (NameException e) {
throw new SAXException(new InvalidSerializedDataException("illegal mixin type name: " + s, e));
- } catch (NamespaceException e) {
+ }
+ catch (NamespaceException e) {
throw new SAXException(new InvalidSerializedDataException("illegal mixin type name: " + s, e));
}
}
@@ -312,7 +301,7 @@ class SysViewImportHandler extends Targe
}
//--------------------------------------------------------< inner classes >
- class ImportState {
+ static class ImportState {
/**
* name of current node
*/
@@ -338,6 +327,6 @@ class SysViewImportHandler extends Targe
/**
* flag indicating whether startNode() has been called for current node
*/
- boolean started = false;
+ boolean started;
}
}
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/TargetImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/TargetImportHandler.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/TargetImportHandler.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/TargetImportHandler.java Thu Sep 1 11:52:08 2011
@@ -27,6 +27,7 @@ import java.io.Writer;
import javax.jcr.RepositoryException;
+import org.apache.jackrabbit.jcr2spi.xml.Importer.TextValue;
import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
import org.apache.jackrabbit.util.TransientFileFactory;
import org.slf4j.Logger;
@@ -40,8 +41,7 @@ import org.xml.sax.helpers.DefaultHandle
* <code>{@link SysViewImportHandler}</code>.
*/
abstract class TargetImportHandler extends DefaultHandler {
-
- private static Logger log = LoggerFactory.getLogger(TargetImportHandler.class);
+ private static final Logger log = LoggerFactory.getLogger(TargetImportHandler.class);
protected final Importer importer;
protected final NamePathResolver resolver;
@@ -57,13 +57,14 @@ abstract class TargetImportHandler exten
*
* @param prop property info
*/
- protected void disposePropertyValues(Importer.PropInfo prop) {
+ protected static void disposePropertyValues(Importer.PropInfo prop) {
Importer.TextValue[] vals = prop.getValues();
- for (int i = 0; i < vals.length; i++) {
- if (vals[i] instanceof AppendableValue) {
+ for (TextValue val : vals) {
+ if (val instanceof AppendableValue) {
try {
- ((AppendableValue) vals[i]).dispose();
- } catch (IOException ioe) {
+ ((AppendableValue) val).dispose();
+ }
+ catch (IOException ioe) {
log.warn("error while disposing temporary value", ioe);
// fall through...
}
@@ -78,7 +79,6 @@ abstract class TargetImportHandler exten
* is called by the XML parser when the XML document starts.
*
* @throws SAXException if the importer can not be initialized
- * @see DefaultHandler#startDocument()
*/
@Override
public void startDocument() throws SAXException {
@@ -94,7 +94,6 @@ abstract class TargetImportHandler exten
* is called by the XML parser when the XML document ends.
*
* @throws SAXException if the importer can not be closed
- * @see DefaultHandler#endDocument()
*/
@Override
public void endDocument() throws SAXException {
@@ -106,6 +105,7 @@ abstract class TargetImportHandler exten
}
//--------------------------------------------------------< inner classes >
+
/**
* <code>AppendableValue</code> represents a serialized value that is
* appendable.
@@ -123,8 +123,7 @@ abstract class TargetImportHandler exten
* @param length the number of characters to append
* @throws IOException if an I/O error occurs
*/
- void append(char[] chars, int start, int length)
- throws IOException;
+ void append(char[] chars, int start, int length) throws IOException;
/**
* Close this value. Once a value has been closed,
@@ -147,7 +146,7 @@ abstract class TargetImportHandler exten
/**
* <code>StringValue</code> represents an immutable serialized value.
*/
- protected class StringValue implements Importer.TextValue {
+ protected static class StringValue implements Importer.TextValue {
private final String value;
@@ -162,23 +161,18 @@ abstract class TargetImportHandler exten
}
//--------------------------------------------------------< TextValue >
- /**
- * {@inheritDoc}
- */
+
+ @Override
public long length() {
return value.length();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public String retrieve() {
return value;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public Reader reader() {
return new StringReader(value);
}
@@ -199,14 +193,17 @@ abstract class TargetImportHandler exten
* max size for buffering data in memory
*/
private static final int MAX_BUFFER_SIZE = 0x10000;
+
/**
* size of increment if capacity buffer needs to be enlarged
*/
private static final int BUFFER_INCREMENT = 0x2000;
+
/**
* in-memory buffer
*/
private char[] buffer;
+
/**
* current position within buffer (size of actual data in buffer)
*/
@@ -217,6 +214,7 @@ abstract class TargetImportHandler exten
* MAX_BUFFER_SIZE
*/
private File tmpFile;
+
/**
* writer used to write to tmpFile; writer & tmpFile are always
* instantiated together, i.e. they are either both null or both not null.
@@ -234,9 +232,8 @@ abstract class TargetImportHandler exten
}
//--------------------------------------------------------< TextValue >
- /**
- * {@inheritDoc}
- */
+
+ @Override
public long length() throws IOException {
if (buffer != null) {
return bufferPos;
@@ -249,9 +246,7 @@ abstract class TargetImportHandler exten
}
}
- /**
- * {@inheritDoc}
- */
+ @Override
public String retrieve() throws IOException {
if (buffer != null) {
return new String(buffer, 0, bufferPos);
@@ -261,7 +256,7 @@ abstract class TargetImportHandler exten
if (tmpFile.length() > Integer.MAX_VALUE) {
throw new IOException("size of value is too big, use reader()");
}
- StringBuffer sb = new StringBuffer((int) tmpFile.length());
+ StringBuilder sb = new StringBuilder((int) tmpFile.length());
char[] chunk = new char[0x2000];
int read;
Reader reader = new FileReader(tmpFile);
@@ -278,9 +273,7 @@ abstract class TargetImportHandler exten
}
}
- /**
- * {@inheritDoc}
- */
+ @Override
public Reader reader() throws IOException {
if (buffer != null) {
return new StringReader(new String(buffer, 0, bufferPos));
@@ -294,11 +287,9 @@ abstract class TargetImportHandler exten
}
//--------------------------------------------------< AppendableValue >
- /**
- * {@inheritDoc}
- */
- public void append(char[] chars, int start, int length)
- throws IOException {
+
+ @Override
+ public void append(char[] chars, int start, int length) throws IOException {
if (buffer != null) {
if (bufferPos + length > MAX_BUFFER_SIZE) {
// threshold for keeping data in memory exceeded;
@@ -337,9 +328,7 @@ abstract class TargetImportHandler exten
}
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void close() throws IOException {
if (buffer != null) {
// nop
@@ -350,9 +339,7 @@ abstract class TargetImportHandler exten
}
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void dispose() throws IOException {
if (buffer != null) {
buffer = null;
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/WorkspaceContentHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/WorkspaceContentHandler.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/WorkspaceContentHandler.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/WorkspaceContentHandler.java Thu Sep 1 11:52:08 2011
@@ -38,9 +38,6 @@ import org.xml.sax.helpers.DefaultHandle
* <code>WorkspaceContentHandler</code>...
*/
public class WorkspaceContentHandler extends DefaultHandler {
-
- private static Logger log = LoggerFactory.getLogger(WorkspaceContentHandler.class);
-
private final String parentAbsPath;
private final int uuidBehavior;
private final Workspace workspace;
@@ -55,8 +52,8 @@ public class WorkspaceContentHandler ext
try {
String tmpName = Text.md5(parentAbsPath);
- this.tmpFile = File.createTempFile("___" + tmpName, ".xml");
- this.delegatee = SerializingContentHandler.getSerializer(
+ tmpFile = File.createTempFile("___" + tmpName, ".xml");
+ delegatee = SerializingContentHandler.getSerializer(
new FileOutputStream(tmpFile));
} catch (FileNotFoundException e) {
throw new RepositoryException(e);
@@ -87,12 +84,12 @@ public class WorkspaceContentHandler ext
}
@Override
- public void characters(char ch[], int start, int length) throws SAXException {
+ public void characters(char[] ch, int start, int length) throws SAXException {
delegatee.characters(ch, start, length);
}
@Override
- public void ignorableWhitespace(char ch[], int start, int length) throws SAXException {
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
delegatee.ignorableWhitespace(ch, start, length);
}