Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterContext.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterContext.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterContext.java (working copy)
@@ -16,11 +16,11 @@
*/
package org.apache.jackrabbit.core.cluster;
+import javax.jcr.RepositoryException;
+
import org.apache.jackrabbit.core.config.ClusterConfig;
import org.apache.jackrabbit.name.NamespaceResolver;
-import javax.jcr.RepositoryException;
-
/**
* Initial interface passed to a ClusterNode.
*/
@@ -31,30 +31,34 @@
*
* @return cluster configuration
*/
- public ClusterConfig getClusterConfig();
+ ClusterConfig getClusterConfig();
/**
* Return a namespace resolver to map prefixes to URIs and vice-versa
*
* @return namespace resolver
*/
- public NamespaceResolver getNamespaceResovler();
+ NamespaceResolver getNamespaceResovler();
/**
- * Notifies the cluster context that some workspace update events are available
- * and that it should start up a listener to receive them.
+ * Notifies the cluster context that some workspace update events are
+ * available and that it should start up a listener to receive them.
*
- * @param workspace workspace name
- * @throws RepositoryException if the context is unable to provide the listener
+ * @param workspace
+ * workspace name
+ * @throws RepositoryException
+ * if the context is unable to provide the listener
*/
- public void updateEventsReady(String workspace) throws RepositoryException;
+ void updateEventsReady(String workspace) throws RepositoryException;
/**
- * Notifies the cluster context that some workspace lock events are available
- * and that it should start up a listener to receive them.
+ * Notifies the cluster context that some workspace lock events are
+ * available and that it should start up a listener to receive them.
*
- * @param workspace workspace name
- * @throws RepositoryException if the context is unable to provide the listener
+ * @param workspace
+ * workspace name
+ * @throws RepositoryException
+ * if the context is unable to provide the listener
*/
- public void lockEventsReady(String workspace) throws RepositoryException;
+ void lockEventsReady(String workspace) throws RepositoryException;
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterException.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterException.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterException.java (working copy)
@@ -19,7 +19,8 @@
import org.apache.jackrabbit.BaseException;
/**
- * The ClusterException signals an error within a cluster operation.
+ * The ClusterException signals an error within a cluster
+ * operation.
*/
public class ClusterException extends BaseException {
@@ -27,20 +28,23 @@
* Constructs a new instance of this class with the specified detail
* message.
*
- * @param message the detail message. The detail message is saved for
- * later retrieval by the {@link #getMessage()} method.
+ * @param message
+ * the detail message. The detail message is saved for later
+ * retrieval by the {@link #getMessage()} method.
*/
public ClusterException(String message) {
super(message);
}
/**
- * Constructs a new instance of this class with the specified detail
- * message and root cause.
+ * Constructs a new instance of this class with the specified detail message
+ * and root cause.
*
- * @param message the detail message. The detail message is saved for
- * later retrieval by the {@link #getMessage()} method.
- * @param rootCause root failure cause
+ * @param message
+ * the detail message. The detail message is saved for later
+ * retrieval by the {@link #getMessage()} method.
+ * @param rootCause
+ * root failure cause
*/
public ClusterException(String message, Throwable rootCause) {
super(message, rootCause);
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java (working copy)
@@ -16,40 +16,42 @@
*/
package org.apache.jackrabbit.core.cluster;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.observation.Event;
+
+import org.apache.jackrabbit.core.NodeId;
import org.apache.jackrabbit.core.config.ClusterConfig;
import org.apache.jackrabbit.core.config.ConfigurationException;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
import org.apache.jackrabbit.core.observation.EventState;
import org.apache.jackrabbit.core.observation.EventStateCollection;
import org.apache.jackrabbit.core.state.ChangeLog;
import org.apache.jackrabbit.name.Path;
import org.apache.jackrabbit.name.QName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import EDU.oswego.cs.dl.util.concurrent.Mutex;
-import javax.jcr.observation.Event;
-import javax.jcr.Session;
-import javax.jcr.RepositoryException;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Collection;
-
/**
* Default clustered node implementation.
*/
public class ClusterNode implements Runnable, UpdateEventChannel,
- NamespaceEventChannel, NodeTypeEventChannel {
+ NamespaceEventChannel, NodeTypeEventChannel {
/**
* System property specifying a node id to use.
*/
- public static final String SYSTEM_PROPERTY_NODE_ID = "org.apache.jackrabbit.core.cluster.node_id";
+ public static final String SYSTEM_PROPERTY_NODE_ID = "org.apache"
+ + ".jackrabbit.core.cluster.node_id";
/**
* Used for padding short string representations.
@@ -119,7 +121,8 @@
/**
* Initialize this cluster node.
*
- * @throws ClusterException if an error occurs
+ * @throws ClusterException
+ * if an error occurs
*/
public void init(ClusterContext clusterContext) throws ClusterException {
this.clusterContext = clusterContext;
@@ -130,7 +133,8 @@
/**
* Initialize this cluster node (overridable).
*
- * @throws ClusterException if an error occurs
+ * @throws ClusterException
+ * if an error occurs
*/
protected void init() throws ClusterException {
ClusterConfig cc = clusterContext.getClusterConfig();
@@ -139,7 +143,8 @@
try {
journal = (Journal) cc.getJournalConfig().newInstance();
- journal.init(clusterNodeId, new SyncListener(), clusterContext.getNamespaceResovler());
+ journal.init(clusterNodeId, new SyncListener(), clusterContext
+ .getNamespaceResovler());
} catch (ConfigurationException e) {
throw new ClusterException(e.getMessage(), e.getCause());
}
@@ -148,7 +153,8 @@
/**
* Starts this cluster node.
*
- * @throws ClusterException if an error occurs
+ * @throws ClusterException
+ * if an error occurs
*/
public synchronized void start() throws ClusterException {
sync();
@@ -166,7 +172,8 @@
synchronized (this) {
try {
wait(syncDelay * 1000);
- } catch (InterruptedException e) {}
+ } catch (InterruptedException e) {
+ }
if (stopped) {
return;
@@ -175,7 +182,8 @@
try {
sync();
} catch (ClusterException e) {
- String msg = "Periodic sync of journal failed: " + e.getMessage();
+ String msg = "Periodic sync of journal failed: "
+ + e.getMessage();
log.error(msg);
}
}
@@ -184,7 +192,8 @@
/**
* Synchronize contents from journal.
*
- * @throws ClusterException if an error occurs
+ * @throws ClusterException
+ * if an error occurs
*/
public void sync() throws ClusterException {
try {
@@ -212,12 +221,17 @@
/**
* Called when a node has been locked.
*
- * @param workspace workspace name
- * @param nodeId node id
- * @param deep flag indicating whether lock is deep
- * @param owner lock owner
+ * @param workspace
+ * workspace name
+ * @param nodeId
+ * node id
+ * @param deep
+ * flag indicating whether lock is deep
+ * @param owner
+ * lock owner
*/
- private void locked(String workspace, NodeId nodeId, boolean deep, String owner) {
+ private void locked(String workspace, NodeId nodeId, boolean deep,
+ String owner) {
try {
journal.begin(workspace);
journal.log(nodeId, deep, owner);
@@ -235,8 +249,10 @@
/**
* Called when a node has been unlocked.
*
- * @param workspace workspace name
- * @param nodeId node id
+ * @param workspace
+ * workspace name
+ * @param nodeId
+ * node id
*/
private void unlocked(String workspace, NodeId nodeId) {
try {
@@ -256,7 +272,8 @@
/**
* Create an {@link UpdateEventChannel} for some workspace.
*
- * @param workspace workspace name
+ * @param workspace
+ * workspace name
* @return lock event channel
*/
public UpdateEventChannel createUpdateChannel(String workspace) {
@@ -266,7 +283,8 @@
/**
* Create a {@link LockEventChannel} for some workspace.
*
- * @param workspace workspace name
+ * @param workspace
+ * workspace name
* @return lock event channel
*/
public LockEventChannel createLockChannel(String workspace) {
@@ -276,13 +294,16 @@
/**
* Return the instance id to be used for this node in the cluster.
*
- * @param id configured id, null to take random id
+ * @param id
+ * configured id, null to take random id
*/
private String getClusterNodeId(String id) {
if (id == null) {
id = System.getProperty(SYSTEM_PROPERTY_NODE_ID);
if (id == null) {
- id = toHexString((short) (Math.random() * (Short.MAX_VALUE - Short.MIN_VALUE)));
+ double random = Math.random();
+ random *= (Short.MAX_VALUE - Short.MIN_VALUE);
+ id = toHexString((short) (random));
}
}
return id;
@@ -291,7 +312,8 @@
/**
* Return a zero-padded short string representation.
*
- * @param n short
+ * @param n
+ * short
* @return string representation
*/
private static String toHexString(short n) {
@@ -305,13 +327,13 @@
return s;
}
- //--------------------------------------------------< UpdateEventListener >
+ // --------------------------------------------------< UpdateEventListener >
/**
* {@inheritDoc}
*
null workspace.
+ * Invoked when an update has been created inside versioning. Delegate to
+ * common method with null workspace.
*/
public void updateCreated(ChangeLog changes, EventStateCollection esc) {
updateCreated(null, changes, esc);
@@ -320,11 +342,15 @@
/**
* Called when an a update operation has been created.
*
- * @param workspace workspace to use when writing journal entry
- * @param changes changes
- * @param esc events as they will be delivered on success
+ * @param workspace
+ * workspace to use when writing journal entry
+ * @param changes
+ * changes
+ * @param esc
+ * events as they will be delivered on success
*/
- private void updateCreated(String workspace, ChangeLog changes, EventStateCollection esc) {
+ private void updateCreated(String workspace, ChangeLog changes,
+ EventStateCollection esc) {
try {
journal.begin(workspace);
journal.log(changes, esc);
@@ -383,15 +409,14 @@
}
/**
- * {@inheritDoc}
- *
- * Invoked to set the update event listener responsible for delivering versioning events.
+ * {@inheritDoc} Invoked to set the update event listener responsible
+ * for delivering versioning events.
*/
public void setListener(UpdateEventListener listener) {
versionUpdateListener = listener;
}
- //-----------------------------------------------< NamespaceEventListener >
+ // -----------------------------------------------< NamespaceEventListener >
/**
* {@inheritDoc}
@@ -415,7 +440,7 @@
namespaceListener = listener;
}
- //------------------------------------------------< NodeTypeEventListener >
+ // ------------------------------------------------< NodeTypeEventListener >
/**
* {@inheritDoc}
@@ -442,7 +467,6 @@
nodeTypeListener = listener;
}
-
/**
* Workspace update channel.
*/
@@ -456,7 +480,8 @@
/**
* Create a new instance of this class.
*
- * @param workspace workspace name
+ * @param workspace
+ * workspace name
*/
public WorkspaceUpdateChannel(String workspace) {
this.workspace = workspace;
@@ -514,7 +539,8 @@
/**
* Create a new instance of this class.
*
- * @param workspace workspace name
+ * @param workspace
+ * workspace name
*/
public WorkspaceLockChannel(String workspace) {
this.workspace = workspace;
@@ -590,35 +616,41 @@
/**
* {@inheritDoc}
*/
- public void process(int type, NodeId parentId, Path parentPath, NodeId childId,
- Path.PathElement childRelPath, QName ntName, Set mixins, String userId) {
+ public void process(int type, NodeId parentId, Path parentPath,
+ NodeId childId, Path.PathElement childRelPath, QName ntName,
+ Set mixins, String userId) {
EventState event = null;
switch (type) {
- case Event.NODE_ADDED:
- event = EventState.childNodeAdded(parentId, parentPath, childId, childRelPath,
- ntName, mixins, getOrCreateSession(userId));
- break;
- case Event.NODE_REMOVED:
- event = EventState.childNodeRemoved(parentId, parentPath, childId, childRelPath,
- ntName, mixins, getOrCreateSession(userId));
- break;
- case Event.PROPERTY_ADDED:
- event = EventState.propertyAdded(parentId, parentPath, childRelPath,
- ntName, mixins, getOrCreateSession(userId));
- break;
- case Event.PROPERTY_CHANGED:
- event = EventState.propertyChanged(parentId, parentPath, childRelPath,
- ntName, mixins, getOrCreateSession(userId));
- break;
- case Event.PROPERTY_REMOVED:
- event = EventState.propertyRemoved(parentId, parentPath, childRelPath,
- ntName, mixins, getOrCreateSession(userId));
- break;
- default:
- String msg = "Unexpected event type: " + type;
- log.warn(msg);
+ case Event.NODE_ADDED:
+ event = EventState.childNodeAdded(parentId, parentPath,
+ childId, childRelPath, ntName, mixins,
+ getOrCreateSession(userId));
+ break;
+ case Event.NODE_REMOVED:
+ event = EventState.childNodeRemoved(parentId, parentPath,
+ childId, childRelPath, ntName, mixins,
+ getOrCreateSession(userId));
+ break;
+ case Event.PROPERTY_ADDED:
+ event = EventState.propertyAdded(parentId, parentPath,
+ childRelPath, ntName, mixins,
+ getOrCreateSession(userId));
+ break;
+ case Event.PROPERTY_CHANGED:
+ event = EventState.propertyChanged(parentId, parentPath,
+ childRelPath, ntName, mixins,
+ getOrCreateSession(userId));
+ break;
+ case Event.PROPERTY_REMOVED:
+ event = EventState.propertyRemoved(parentId, parentPath,
+ childRelPath, ntName, mixins,
+ getOrCreateSession(userId));
+ break;
+ default:
+ String msg = "Unexpected event type: " + type;
+ log.warn(msg);
}
events.add(event);
}
@@ -627,18 +659,20 @@
* {@inheritDoc}
*/
public void process(NodeId nodeId, boolean isDeep, String owner) {
- LockEventListener listener = (LockEventListener) wspLockListeners.get(workspace);
+ LockEventListener listener = (LockEventListener) wspLockListeners
+ .get(workspace);
if (listener == null) {
try {
clusterContext.lockEventsReady(workspace);
} catch (RepositoryException e) {
- String msg = "Unable to make lock listener for workspace " +
- workspace + " online: " + e.getMessage();
+ String msg = "Unable to make lock listener for workspace "
+ + workspace + " online: " + e.getMessage();
log.warn(msg);
}
listener = (LockEventListener) wspLockListeners.get(workspace);
- if (listener == null) {
- String msg = "Lock channel unavailable for workspace: " + workspace;
+ if (listener == null) {
+ String msg = "Lock channel unavailable for workspace: "
+ + workspace;
log.error(msg);
return;
}
@@ -655,18 +689,20 @@
* {@inheritDoc}
*/
public void process(NodeId nodeId) {
- LockEventListener listener = (LockEventListener) wspLockListeners.get(workspace);
+ LockEventListener listener = (LockEventListener) wspLockListeners
+ .get(workspace);
if (listener == null) {
try {
clusterContext.lockEventsReady(workspace);
} catch (RepositoryException e) {
- String msg = "Unable to make lock listener for workspace " +
- workspace + " online: " + e.getMessage();
+ String msg = "Unable to make lock listener for workspace "
+ + workspace + " online: " + e.getMessage();
log.warn(msg);
}
listener = (LockEventListener) wspLockListeners.get(workspace);
- if (listener == null) {
- String msg = "Lock channel unavailable for workspace: " + workspace;
+ if (listener == null) {
+ String msg = "Lock channel unavailable for workspace: "
+ + workspace;
log.error(msg);
return;
}
@@ -691,7 +727,8 @@
try {
namespaceListener.externalRemap(oldPrefix, newPrefix, uri);
} catch (RepositoryException e) {
- String msg = "Unable to deliver namespace operation: " + e.getMessage();
+ String msg = "Unable to deliver namespace operation: "
+ + e.getMessage();
log.error(msg);
}
}
@@ -708,10 +745,12 @@
try {
nodeTypeListener.externalRegistered(ntDefs);
} catch (InvalidNodeTypeDefException e) {
- String msg = "Unable to deliver node type operation: " + e.getMessage();
+ String msg = "Unable to deliver node type operation: "
+ + e.getMessage();
log.error(msg);
} catch (RepositoryException e) {
- String msg = "Unable to deliver node type operation: " + e.getMessage();
+ String msg = "Unable to deliver node type operation: "
+ + e.getMessage();
log.error(msg);
}
}
@@ -722,18 +761,22 @@
public void end() {
UpdateEventListener listener = null;
if (workspace != null) {
- listener = (UpdateEventListener) wspUpdateListeners.get(workspace);
+ listener = (UpdateEventListener) wspUpdateListeners
+ .get(workspace);
if (listener == null) {
try {
clusterContext.updateEventsReady(workspace);
} catch (RepositoryException e) {
- String msg = "Error making update listener for workspace " +
- workspace + " online: " + e.getMessage();
+ String msg = "Error making update listener for "
+ + "workspace " + workspace + " online: "
+ + e.getMessage();
log.warn(msg);
}
- listener = (UpdateEventListener) wspUpdateListeners.get(workspace);
- if (listener == null) {
- String msg = "Update listener unavailable for workspace: " + workspace;
+ listener = (UpdateEventListener) wspUpdateListeners
+ .get(workspace);
+ if (listener == null) {
+ String msg = "Update listener unavailable for "
+ + "workspace: " + workspace;
log.error(msg);
return;
}
@@ -750,7 +793,8 @@
try {
listener.externalUpdate(changeLog, events);
} catch (RepositoryException e) {
- String msg = "Unable to deliver update events: " + e.getMessage();
+ String msg = "Unable to deliver update events: "
+ + e.getMessage();
log.error(msg);
}
}
@@ -758,11 +802,13 @@
/**
* Return a session matching a certain user id.
*
- * @param userId user id
+ * @param userId
+ * user id
* @return session
*/
private Session getOrCreateSession(String userId) {
- if (lastSession == null || !lastSession.getUserID().equals(userId)) {
+ if (lastSession == null
+ || !lastSession.getUserID().equals(userId)) {
lastSession = new ClusterSession(userId);
}
return lastSession;
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterSession.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterSession.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ClusterSession.java (working copy)
@@ -16,22 +16,23 @@
*/
package org.apache.jackrabbit.core.cluster;
-import org.xml.sax.ContentHandler;
+import java.io.InputStream;
+import java.io.OutputStream;
-import javax.jcr.Session;
-import javax.jcr.Repository;
-import javax.jcr.Workspace;
import javax.jcr.Credentials;
+import javax.jcr.Item;
import javax.jcr.Node;
-import javax.jcr.Item;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.UnsupportedRepositoryOperationException;
import javax.jcr.ValueFactory;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import javax.jcr.Workspace;
+import org.xml.sax.ContentHandler;
+
/**
- * Represents the session that has made some changes on another node in the cluster. The only method currently
- * implemented is {@link #getUserID()}.
+ * Represents the session that has made some changes on another node in the
+ * cluster. The only method currently implemented is {@link #getUserID()}.
*/
class ClusterSession implements Session {
@@ -43,7 +44,8 @@
/**
* Create a new instance of this class.
*
- * @param userId user id
+ * @param userId
+ * user id
*/
public ClusterSession(String userId) {
this.userId = userId;
@@ -87,7 +89,8 @@
/**
* {@inheritDoc}
*/
- public Session impersonate(Credentials credentials) throws UnsupportedRepositoryOperationException {
+ public Session impersonate(Credentials credentials)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
@@ -101,28 +104,32 @@
/**
* {@inheritDoc}
*/
- public Node getNodeByUUID(String s) throws UnsupportedRepositoryOperationException {
+ public Node getNodeByUUID(String s)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public Item getItem(String s) throws UnsupportedRepositoryOperationException {
+ public Item getItem(String s)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public boolean itemExists(String s) throws UnsupportedRepositoryOperationException {
+ public boolean itemExists(String s)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public void move(String s, String s1) throws UnsupportedRepositoryOperationException {
+ public void move(String s, String s1)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
@@ -137,49 +144,56 @@
/**
* {@inheritDoc}
*/
- public void refresh(boolean b) throws UnsupportedRepositoryOperationException {
+ public void refresh(boolean b)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public boolean hasPendingChanges() throws UnsupportedRepositoryOperationException {
+ public boolean hasPendingChanges()
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public ValueFactory getValueFactory() throws UnsupportedRepositoryOperationException {
+ public ValueFactory getValueFactory()
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public void checkPermission(String s, String s1) throws UnsupportedRepositoryOperationException {
+ public void checkPermission(String s, String s1)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public ContentHandler getImportContentHandler(String s, int i) throws UnsupportedRepositoryOperationException {
+ public ContentHandler getImportContentHandler(String s, int i)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public void importXML(String s, InputStream inputStream, int i) throws UnsupportedRepositoryOperationException {
+ public void importXML(String s, InputStream inputStream, int i)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public void exportSystemView(String s, ContentHandler contentHandler, boolean b, boolean b1)
+ public void exportSystemView(String s, ContentHandler contentHandler,
+ boolean b, boolean b1)
throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
@@ -188,7 +202,8 @@
/**
* {@inheritDoc}
*/
- public void exportSystemView(String s, OutputStream outputStream, boolean b, boolean b1)
+ public void exportSystemView(String s, OutputStream outputStream,
+ boolean b, boolean b1)
throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
@@ -197,7 +212,8 @@
/**
* {@inheritDoc}
*/
- public void exportDocumentView(String s, ContentHandler contentHandler, boolean b, boolean b1)
+ public void exportDocumentView(String s, ContentHandler contentHandler,
+ boolean b, boolean b1)
throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
@@ -206,7 +222,8 @@
/**
* {@inheritDoc}
*/
- public void exportDocumentView(String s, OutputStream outputStream, boolean b, boolean b1)
+ public void exportDocumentView(String s, OutputStream outputStream,
+ boolean b, boolean b1)
throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
@@ -215,28 +232,32 @@
/**
* {@inheritDoc}
*/
- public void setNamespacePrefix(String s, String s1) throws UnsupportedRepositoryOperationException {
+ public void setNamespacePrefix(String s, String s1)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public String[] getNamespacePrefixes() throws UnsupportedRepositoryOperationException {
+ public String[] getNamespacePrefixes()
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public String getNamespaceURI(String s) throws UnsupportedRepositoryOperationException {
+ public String getNamespaceURI(String s)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
/**
* {@inheritDoc}
*/
- public String getNamespacePrefix(String s) throws UnsupportedRepositoryOperationException {
+ public String getNamespacePrefix(String s)
+ throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileJournal.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileJournal.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileJournal.java (working copy)
@@ -16,55 +16,59 @@
*/
package org.apache.jackrabbit.core.cluster;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
import org.apache.jackrabbit.core.NodeId;
import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
import org.apache.jackrabbit.core.nodetype.compact.ParseException;
+import org.apache.jackrabbit.core.observation.EventState;
+import org.apache.jackrabbit.core.observation.EventStateCollection;
import org.apache.jackrabbit.core.state.ChangeLog;
import org.apache.jackrabbit.core.state.ItemState;
import org.apache.jackrabbit.core.state.NodeState;
import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.observation.EventState;
-import org.apache.jackrabbit.core.observation.EventStateCollection;
+import org.apache.jackrabbit.name.NameException;
+import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.name.NoPrefixDeclaredException;
import org.apache.jackrabbit.name.Path;
import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
-import org.apache.jackrabbit.name.NameException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Collection;
-
import EDU.oswego.cs.dl.util.concurrent.Mutex;
/**
- * File-based journal implementation. A directory specified as directory
- * bean property will contain log files and a global revision file, containing the
- * latest revision file. When the current log file's size exceeds maxSize
- * bytes, it gets renamed to its name appended by '1'. At the same time, all log files
- * already having a version counter, get their version counter incremented by 1.
- *
- * It is configured through the following properties:
+ * File-based journal implementation. A directory specified as
+ * directory bean property will contain log files and a global
+ * revision file, containing the latest revision file. When the current log
+ * file's size exceeds maxSize bytes, it gets renamed to its name
+ * appended by '1'. At the same time, all log files already having a version
+ * counter, get their version counter incremented by 1. It
+ * is configured through the following properties:
* directory: the shared directory where journal logs and read from
- * and written to; this is a required property with no default valuerevision: the filename where the parent cluster node's revision
- * file should be written to; this is a required property with no default valuebasename: this is the basename of the journal logs created in
- * the shared directory; its default value is journalmaximumSize: this is the maximum size in bytes of a journal log
- * before a new log will be created; its default value is 1048576 (1MB)directory: the shared directory where journal logs and
+ * read from and written to; this is a required property with no default value
+ * revision: the filename where the parent cluster node's
+ * revision file should be written to; this is a required property with no
+ * default valuebasename: this is the basename of the journal logs
+ * created in the shared directory; its default value is journal
+ * maximumSize: this is the maximum size in bytes of a
+ * journal log before a new log will be created; its default value is
+ * 1048576 (1MB)true if this is a lock;
- * false if this is an unlock
- * @param isDeep flag indicating whether lock is deep
- * @param owner lock owner
+ * @param nodeId
+ * node id
+ * @param isLock
+ * true if this is a lock; false if
+ * this is an unlock
+ * @param isDeep
+ * flag indicating whether lock is deep
+ * @param owner
+ * lock owner
*/
- protected void log(NodeId nodeId, boolean isLock, boolean isDeep, String owner)
- throws JournalException {
+ protected void log(NodeId nodeId, boolean isLock, boolean isDeep,
+ String owner) throws JournalException {
try {
out.writeChar('L');
@@ -610,7 +656,8 @@
out.writeString(owner);
}
} catch (IOException e) {
- String msg = "Unable to write to journal log " + tempLog + ": " + e.getMessage();
+ String msg = "Unable to write to journal log " + tempLog + ": "
+ + e.getMessage();
throw new JournalException(msg);
}
}
@@ -662,7 +709,8 @@
instanceRevision.set(nextRevision);
} catch (IOException e) {
- String msg = "Unable to close journal log " + tempLog + ": " + e.getMessage();
+ String msg = "Unable to close journal log " + tempLog + ": "
+ + e.getMessage();
throw new JournalException(msg);
} finally {
globalRevision.unlock();
@@ -678,7 +726,8 @@
out.close();
tempLog.delete();
} catch (IOException e) {
- String msg = "Unable to close journal log " + tempLog + ": " + e.getMessage();
+ String msg = "Unable to close journal log " + tempLog + ": "
+ + e.getMessage();
log.warn(msg);
} finally {
globalRevision.unlock();
@@ -688,9 +737,9 @@
/**
* Move away current journal file (and all other files), incrementing their
- * version counter. A file named journal.N.log gets renamed to
- * journal.(N+1).log, whereas the main journal file gets renamed
- * to journal.1.log.
+ * version counter. A file named journal.N.log gets renamed
+ * to journal.(N+1).log, whereas the main journal file gets
+ * renamed to journal.1.log.
*/
private void switchLogs() {
FilenameFilter filter = new FilenameFilter() {
@@ -717,11 +766,13 @@
} else {
try {
int version = Integer.parseInt(ext);
- String newName = name.substring(0, sep + 1) +
- String.valueOf(version + 1);
+ String newName = name.substring(0, sep + 1)
+ + String.valueOf(version + 1);
file.renameTo(new File(newName));
} catch (NumberFormatException e) {
- log.warn("Bogusly named journal file, skipped: " + file);
+ log
+ .warn("Bogusly named journal file, skipped: "
+ + file);
}
}
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecord.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecord.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecord.java (working copy)
@@ -16,22 +16,22 @@
*/
package org.apache.jackrabbit.core.cluster;
-import org.apache.jackrabbit.name.NamespaceResolver;
-
+import java.io.BufferedInputStream;
+import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.DataInput;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
+import org.apache.jackrabbit.name.NamespaceResolver;
+
/**
- * Represents a file-based record. Physically, a file record contains its length in the
- * first 4 bytes, immediately followed by its creator in a length-prefixed, UTF-encoded
- * string. All further fields are record-specific.
+ * Represents a file-based record. Physically, a file record contains its length
+ * in the first 4 bytes, immediately followed by its creator in a
+ * length-prefixed, UTF-encoded string. All further fields are record-specific.
*/
class FileRecord {
@@ -88,12 +88,14 @@
/**
* Creates a new file record. Used when opening an existing record.
*
- * @param revision revision this record represents
- * @param in underlying input stream
- * @throws IOException if reading the creator fails
+ * @param revision
+ * revision this record represents
+ * @param in
+ * underlying input stream
+ * @throws IOException
+ * if reading the creator fails
*/
- public FileRecord(long revision, InputStream in)
- throws IOException {
+ public FileRecord(long revision, InputStream in) throws IOException {
this.revision = revision;
if (in instanceof DataInputStream) {
@@ -109,9 +111,12 @@
/**
* Creates a new file record. Used when creating a new record.
*
- * @param creator creator of this record
- * @param file underlying (temporary) file
- * @throws IOException if writing the creator fails
+ * @param creator
+ * creator of this record
+ * @param file
+ * underlying (temporary) file
+ * @throws IOException
+ * if writing the creator fails
*/
public FileRecord(String creator, File file) throws IOException {
@@ -135,7 +140,8 @@
/**
* Set the journal revision associated with this record.
*
- * @param revision journal revision
+ * @param revision
+ * journal revision
*/
public void setRevision(long revision) {
this.revision = revision;
@@ -162,7 +168,8 @@
/**
* Return an input on this record.
*
- * @param resolver resolver to use when mapping prefixes to full names
+ * @param resolver
+ * resolver to use when mapping prefixes to full names
* @return record input
*/
public FileRecordInput getInput(NamespaceResolver resolver) {
@@ -173,7 +180,8 @@
/**
* Return an output on this record.
*
- * @param resolver resolver to use when mapping full names to prefixes
+ * @param resolver
+ * resolver to use when mapping full names to prefixes
* @return record output
*/
public FileRecordOutput getOutput(NamespaceResolver resolver) {
@@ -183,7 +191,8 @@
/**
* Append this record to some output stream.
*
- * @param out outputstream to append to
+ * @param out
+ * outputstream to append to
*/
void append(DataOutputStream out) throws IOException {
out.writeInt(length);
@@ -203,10 +212,11 @@
}
/**
- * Skip over this record, positioning the underlying input stream
- * on the next available record.
+ * Skip over this record, positioning the underlying input stream on the
+ * next available record.
*
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
void skip() throws IOException {
if (!consumed) {
@@ -235,7 +245,8 @@
/**
* Read creator from the underlying data input stream.
*
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
private void readCreator() throws IOException {
UTFByteCounter counter = new UTFByteCounter(in);
@@ -246,7 +257,8 @@
/**
* Write creator to the underlying data output stream.
*
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
private void writeCreator() throws IOException {
out.writeUTF(creator);
@@ -271,7 +283,8 @@
/**
* Create a new instance of this class.
*
- * @param in underlying data input stream
+ * @param in
+ * underlying data input stream
*/
public UTFByteCounter(DataInputStream in) {
this.in = in;
@@ -287,9 +300,8 @@
}
/**
- * @see java.io.DataInputStream#readUnsignedShort()
- *
- * Remember number of bytes read.
+ * @see java.io.DataInputStream#readUnsignedShort() Remember number of
+ * bytes read.
*/
public int readUnsignedShort() throws IOException {
try {
@@ -300,11 +312,10 @@
}
/**
- * @see java.io.DataInputStream#readUnsignedShort()
- *
- * Remember number of bytes read.
+ * @see java.io.DataInputStream#readUnsignedShort() Remember number of
+ * bytes read.
*/
- public void readFully(byte b[]) throws IOException {
+ public void readFully(byte[] b) throws IOException {
try {
in.readFully(b);
} finally {
@@ -313,11 +324,10 @@
}
/**
- * @see java.io.DataInputStream#readUnsignedShort()
- *
- * Remember number of bytes read.
+ * @see java.io.DataInputStream#readUnsignedShort() Remember number of
+ * bytes read.
*/
- public void readFully(byte b[], int off, int len) throws IOException {
+ public void readFully(byte[] b, int off, int len) throws IOException {
try {
in.readFully(b, off, len);
} finally {
@@ -329,51 +339,63 @@
* Methods not implemented.
*/
public byte readByte() throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
}
public char readChar() throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
}
public double readDouble() throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
}
public float readFloat() throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
}
public int readInt() throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
- }
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
+ }
public int readUnsignedByte() throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
}
public long readLong() throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
}
public short readShort() throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
}
public boolean readBoolean() throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
}
public int skipBytes(int n) throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
}
public String readLine() throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
}
public String readUTF() throws IOException {
- throw new IllegalStateException("Unexpected call, deliberately not implemented.");
+ throw new IllegalStateException(
+ "Unexpected call, deliberately not implemented.");
}
}
-}
\ No newline at end of file
+}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordCursor.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordCursor.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordCursor.java (working copy)
@@ -21,9 +21,9 @@
/**
* Record cursor that returns unseen revisions in ascending order on every
- * iteration. When iterating, a record must either be completely processed
- * or its {@link FileRecord#skip()} method must be invoked to guarantee
- * that this cursor is pointing at the next record.
+ * iteration. When iterating, a record must either be completely processed or
+ * its {@link FileRecord#skip()} method must be invoked to guarantee that this
+ * cursor is pointing at the next record.
*/
class FileRecordCursor {
@@ -55,17 +55,20 @@
/**
* Creates a new instance of this class.
*
- * @param logFiles available log files, sorted ascending by age
- * @param firstRevision first revision to return
- * @param lastRevision last revision to return
+ * @param logFiles
+ * available log files, sorted ascending by age
+ * @param firstRevision
+ * first revision to return
+ * @param lastRevision
+ * last revision to return
*/
- public FileRecordCursor(File[] logFiles, long firstRevision, long lastRevision) {
+ public FileRecordCursor(File[] logFiles, long firstRevision,
+ long lastRevision) {
this.logFiles = logFiles;
this.nextRevision = firstRevision;
this.lastRevision = lastRevision;
}
-
/**
* Return a flag indicating whether there are next records.
*/
@@ -76,8 +79,10 @@
/**
* Returns the next record.
*
- * @throws IllegalStateException if no next revision exists
- * @throws IOException if an I/O error occurs
+ * @throws IllegalStateException
+ * if no next revision exists
+ * @throws IOException
+ * if an I/O error occurs
*/
public FileRecord next() throws IOException {
if (!hasNext()) {
@@ -106,9 +111,11 @@
/**
* Return record log containing a given revision.
*
- * @param revision revision to locate
+ * @param revision
+ * revision to locate
* @return record log containing that revision
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
private FileRecordLog getRecordLog(long revision) throws IOException {
for (int i = 0; i < logFiles.length; i++) {
@@ -124,11 +131,12 @@
/**
* Close this cursor, releasing its resources.
*
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
public void close() throws IOException {
if (recordLog != null) {
recordLog.close();
}
}
-}
\ No newline at end of file
+}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordInput.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordInput.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordInput.java (working copy)
@@ -16,28 +16,28 @@
*/
package org.apache.jackrabbit.core.cluster;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.jackrabbit.core.NodeId;
import org.apache.jackrabbit.core.PropertyId;
import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefReader;
import org.apache.jackrabbit.core.nodetype.compact.ParseException;
+import org.apache.jackrabbit.name.IllegalNameException;
+import org.apache.jackrabbit.name.MalformedPathException;
+import org.apache.jackrabbit.name.NameFormat;
import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.PathFormat;
import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
-import org.apache.jackrabbit.name.IllegalNameException;
import org.apache.jackrabbit.name.UnknownPrefixException;
-import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.PathFormat;
-import org.apache.jackrabbit.name.MalformedPathException;
import org.apache.jackrabbit.uuid.Constants;
import org.apache.jackrabbit.uuid.UUID;
-import java.io.IOException;
-import java.io.DataInputStream;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Allows reading data from a FileRecord.
*/
@@ -66,8 +66,10 @@
/**
* Open an existing file record.
*
- * @param in underlying input stream
- * @param resolver namespace resolver
+ * @param in
+ * underlying input stream
+ * @param resolver
+ * namespace resolver
*/
public FileRecordInput(DataInputStream in, NamespaceResolver resolver) {
this.in = in;
@@ -78,7 +80,8 @@
* Read a byte from the underlying stream.
*
* @return byte
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
public byte readByte() throws IOException {
checkOpen();
@@ -90,7 +93,8 @@
* Read a character from the underlying stream.
*
* @return character
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
public char readChar() throws IOException {
checkOpen();
@@ -102,7 +106,8 @@
* Read a boolean from the underlying stream.
*
* @return boolean
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
public boolean readBoolean() throws IOException {
checkOpen();
@@ -114,7 +119,8 @@
* Read an integer from the underlying stream.
*
* @return integer
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
public int readInt() throws IOException {
checkOpen();
@@ -126,7 +132,8 @@
* Read a string from the underlying stream.
*
* @return string or null
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
public String readString() throws IOException {
checkOpen();
@@ -143,11 +150,15 @@
* Read a QName.
*
* @return name
- * @throws IOException if an I/O error occurs
- * @throws IllegalNameException if the name retrieved is illegal
- * @throws UnknownPrefixException if the prefix is unknown
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws IllegalNameException
+ * if the name retrieved is illegal
+ * @throws UnknownPrefixException
+ * if the prefix is unknown
*/
- public QName readQName() throws IOException, IllegalNameException, UnknownPrefixException {
+ public QName readQName() throws IOException, IllegalNameException,
+ UnknownPrefixException {
checkOpen();
return NameFormat.parse(readString(), resolver);
@@ -157,11 +168,15 @@
* Read a PathElement.
*
* @return path element
- * @throws IOException if an I/O error occurs
- * @throws IllegalNameException if the name retrieved is illegal
- * @throws UnknownPrefixException if the prefix is unknown
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws IllegalNameException
+ * if the name retrieved is illegal
+ * @throws UnknownPrefixException
+ * if the prefix is unknown
*/
- public Path.PathElement readPathElement() throws IOException, IllegalNameException, UnknownPrefixException {
+ public Path.PathElement readPathElement() throws IOException,
+ IllegalNameException, UnknownPrefixException {
checkOpen();
QName name = NameFormat.parse(readString(), resolver);
@@ -177,8 +192,10 @@
* Read a Path.
*
* @return path
- * @throws IOException if an I/O error occurs
- * @throws MalformedPathException if the path is malformed
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws MalformedPathException
+ * if the path is malformed
*/
public Path readPath() throws IOException, MalformedPathException {
checkOpen();
@@ -190,7 +207,8 @@
* Read a NodeId
*
* @return node id
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
public NodeId readNodeId() throws IOException {
checkOpen();
@@ -219,11 +237,15 @@
* Read a PropertyId
*
* @return property id
- * @throws IOException if an I/O error occurs
- * @throws IllegalNameException if the name retrieved is illegal
- * @throws UnknownPrefixException if the prefix is unknown
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws IllegalNameException
+ * if the name retrieved is illegal
+ * @throws UnknownPrefixException
+ * if the prefix is unknown
*/
- public PropertyId readPropertyId() throws IOException, IllegalNameException, UnknownPrefixException {
+ public PropertyId readPropertyId() throws IOException,
+ IllegalNameException, UnknownPrefixException {
checkOpen();
return new PropertyId(readNodeId(), readQName());
@@ -237,18 +259,19 @@
StringReader sr = new StringReader(readString());
- CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(sr, "(internal)");
+ CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(sr,
+ "(internal)");
List ntds = reader.getNodeTypeDefs();
if (ntds.size() != 1) {
- throw new IOException("Expected one node type definition: got " + ntds.size());
+ throw new IOException("Expected one node type definition: got "
+ + ntds.size());
}
return (NodeTypeDef) ntds.get(0);
}
-
-
/**
- * Close this input. Does not close underlying stream as this is a shared resource.
+ * Close this input. Does not close underlying stream as this is a shared
+ * resource.
*/
public void close() {
checkOpen();
@@ -259,7 +282,8 @@
/**
* Check that this input is open, throw otherwise.
*
- * @throws IllegalStateException if input is closed.
+ * @throws IllegalStateException
+ * if input is closed.
*/
private void checkOpen() throws IllegalStateException {
if (closed) {
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordLog.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordLog.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordLog.java (working copy)
@@ -16,17 +16,17 @@
*/
package org.apache.jackrabbit.core.cluster;
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
import java.io.File;
-import java.io.DataInputStream;
-import java.io.IOException;
import java.io.FileInputStream;
-import java.io.BufferedInputStream;
-import java.io.DataOutputStream;
import java.io.FileOutputStream;
+import java.io.IOException;
/**
- * A file record log is a file containing {@link FileRecord}s. Internally,
- * the first 8 bytes contain the revision this log starts with.
+ * A file record log is a file containing {@link FileRecord}s. Internally, the
+ * first 8 bytes contain the revision this log starts with.
*/
class FileRecordLog {
@@ -58,8 +58,10 @@
/**
* Create a new instance of this class.
*
- * @param file file containing record log
- * @throws IOException if an I/O error occurs
+ * @param file
+ * file containing record log
+ * @throws IOException
+ * if an I/O error occurs
*/
public FileRecordLog(File file) throws IOException {
this.file = file;
@@ -88,11 +90,13 @@
}
/**
- * Return a flag indicating whether this record log contains a certain revision.
+ * Return a flag indicating whether this record log contains a certain
+ * revision.
*
- * @param revision revision to look for
- * @return true if this record log contain a certain revision;
- * false otherwise
+ * @param revision
+ * revision to look for
+ * @return true if this record log contain a certain
+ * revision; false otherwise
*/
public boolean contains(long revision) {
return (revision >= minRevision && revision < maxRevision);
@@ -101,19 +105,21 @@
/**
* Return a flag indicating whether this record log is new.
*
- * @return true if this record log is new;
- * false otherwise
+ * @return true if this record log is new; false
+ * otherwise
*/
public boolean isNew() {
return isNew;
}
/**
- * Seek an entry. This is an operation that allows the unterlying input stream
- * to be sequentially scanned and must therefore not be called twice.
+ * Seek an entry. This is an operation that allows the unterlying input
+ * stream to be sequentially scanned and must therefore not be called twice.
*
- * @param revision revision to seek
- * @throws IOException if an I/O error occurs
+ * @param revision
+ * revision to seek
+ * @throws IOException
+ * if an I/O error occurs
*/
public void seek(long revision) throws IOException {
if (in != null) {
@@ -139,11 +145,14 @@
/**
* Append a record to this log.
*
- * @param record record to add
- * @throws IOException if an I/O error occurs
+ * @param record
+ * record to add
+ * @throws IOException
+ * if an I/O error occurs
*/
public void append(FileRecord record) throws IOException {
- DataOutputStream out = new DataOutputStream(new FileOutputStream(file, true));
+ DataOutputStream out = new DataOutputStream(new FileOutputStream(file,
+ true));
try {
if (isNew) {
out.writeLong(record.getRevision());
@@ -157,11 +166,12 @@
/**
* Open this log.
*
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
private void open() throws IOException {
- in = new DataInputStream(new BufferedInputStream(
- new FileInputStream(file)));
+ in = new DataInputStream(new BufferedInputStream(new FileInputStream(
+ file)));
}
/**
@@ -180,11 +190,12 @@
/**
* Close this log.
*
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
public void close() throws IOException {
if (in != null) {
in.close();
}
}
-}
\ No newline at end of file
+}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordOutput.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordOutput.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRecordOutput.java (working copy)
@@ -16,22 +16,22 @@
*/
package org.apache.jackrabbit.core.cluster;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+
import org.apache.jackrabbit.core.NodeId;
import org.apache.jackrabbit.core.PropertyId;
import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefWriter;
+import org.apache.jackrabbit.name.NameFormat;
import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.name.NoPrefixDeclaredException;
import org.apache.jackrabbit.name.Path;
import org.apache.jackrabbit.name.PathFormat;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
+import org.apache.jackrabbit.name.QName;
-import java.io.IOException;
-import java.io.DataOutputStream;
-import java.io.StringWriter;
-import java.util.ArrayList;
-
/**
* Allows writing data to a FileRecord.
*/
@@ -65,11 +65,15 @@
/**
* Create a new file record.
*
- * @param record file record
- * @param out outputstream to write to
- * @param resolver namespace resolver
+ * @param record
+ * file record
+ * @param out
+ * outputstream to write to
+ * @param resolver
+ * namespace resolver
*/
- public FileRecordOutput(FileRecord record, DataOutputStream out, NamespaceResolver resolver) {
+ public FileRecordOutput(FileRecord record, DataOutputStream out,
+ NamespaceResolver resolver) {
this.record = record;
this.out = out;
this.resolver = resolver;
@@ -78,8 +82,10 @@
/**
* Write a byte to the underlying stream.
*
- * @param n byte
- * @throws IOException if an I/O error occurs
+ * @param n
+ * byte
+ * @throws IOException
+ * if an I/O error occurs
*/
public void writeByte(int n) throws IOException {
checkOpen();
@@ -90,8 +96,10 @@
/**
* Write a character to the underlying stream.
*
- * @param c character
- * @throws IOException if an I/O error occurs
+ * @param c
+ * character
+ * @throws IOException
+ * if an I/O error occurs
*/
public void writeChar(char c) throws IOException {
checkOpen();
@@ -102,8 +110,10 @@
/**
* Write a boolean from the underlying stream.
*
- * @param b boolean
- * @throws IOException if an I/O error occurs
+ * @param b
+ * boolean
+ * @throws IOException
+ * if an I/O error occurs
*/
public void writeBoolean(boolean b) throws IOException {
checkOpen();
@@ -114,8 +124,10 @@
/**
* Write an integer to the underlying stream.
*
- * @param n integer
- * @throws IOException if an I/O error occurs
+ * @param n
+ * integer
+ * @throws IOException
+ * if an I/O error occurs
*/
public void writeInt(int n) throws IOException {
checkOpen();
@@ -126,8 +138,10 @@
/**
* Write a string from the underlying stream.
*
- * @param s string, may be null
- * @throws IOException if an I/O error occurs
+ * @param s
+ * string, may be null
+ * @throws IOException
+ * if an I/O error occurs
*/
public void writeString(String s) throws IOException {
checkOpen();
@@ -143,11 +157,15 @@
/**
* Write a QName.
*
- * @param name name
- * @throws IOException if an I/O error occurs
- * @throws NoPrefixDeclaredException if the prefix is not declared
+ * @param name
+ * name
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws NoPrefixDeclaredException
+ * if the prefix is not declared
*/
- public void writeQName(QName name) throws IOException, NoPrefixDeclaredException {
+ public void writeQName(QName name) throws IOException,
+ NoPrefixDeclaredException {
checkOpen();
writeString(NameFormat.format(name, resolver));
@@ -156,11 +174,15 @@
/**
* Write a PathElement.
*
- * @param element path element
- * @throws IOException if an I/O error occurs
- * @throws NoPrefixDeclaredException if the prefix is not declared
+ * @param element
+ * path element
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws NoPrefixDeclaredException
+ * if the prefix is not declared
*/
- public void writePathElement(Path.PathElement element) throws IOException, NoPrefixDeclaredException {
+ public void writePathElement(Path.PathElement element) throws IOException,
+ NoPrefixDeclaredException {
checkOpen();
writeQName(element.getName());
@@ -170,23 +192,29 @@
/**
* Write a Path.
*
- * @param path path
- * @throws IOException if an I/O error occurs
- * @throws NoPrefixDeclaredException if the prefix is not declared
+ * @param path
+ * path
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws NoPrefixDeclaredException
+ * if the prefix is not declared
*/
- public void writePath(Path path) throws IOException, NoPrefixDeclaredException {
+ public void writePath(Path path) throws IOException,
+ NoPrefixDeclaredException {
checkOpen();
writeString(PathFormat.format(path, resolver));
}
/**
- * Write a NodeId. Since the same node ids are likely to appear multiple times,
- * only the first one will actually be literally appended, while all other reference the
- * previous entry's index.
+ * Write a NodeId. Since the same node ids are likely to
+ * appear multiple times, only the first one will actually be literally
+ * appended, while all other reference the previous entry's index.
*
- * @param nodeId node id
- * @throws IOException if an I/O error occurs
+ * @param nodeId
+ * node id
+ * @throws IOException
+ * if an I/O error occurs
*/
public void writeNodeId(NodeId nodeId) throws IOException {
checkOpen();
@@ -209,11 +237,15 @@
/**
* Write a PropertyId
*
- * @param propertyId property id
- * @throws IOException if an I/O error occurs
- * @throws NoPrefixDeclaredException if the prefix is not declared
+ * @param propertyId
+ * property id
+ * @throws IOException
+ * if an I/O error occurs
+ * @throws NoPrefixDeclaredException
+ * if the prefix is not declared
*/
- public void writePropertyId(PropertyId propertyId) throws IOException, NoPrefixDeclaredException {
+ public void writePropertyId(PropertyId propertyId) throws IOException,
+ NoPrefixDeclaredException {
checkOpen();
writeNodeId(propertyId.getParentId());
@@ -227,7 +259,8 @@
checkOpen();
StringWriter sw = new StringWriter();
- CompactNodeTypeDefWriter writer = new CompactNodeTypeDefWriter(sw, resolver, true);
+ CompactNodeTypeDefWriter writer = new CompactNodeTypeDefWriter(sw,
+ resolver, true);
writer.write(ntd);
writer.close();
@@ -237,7 +270,8 @@
/**
* Close this output.
*
- * @throws IOException if an I/O error occurs
+ * @throws IOException
+ * if an I/O error occurs
*/
public void close() throws IOException {
checkOpen();
@@ -251,10 +285,13 @@
}
/**
- * Get a NodeId's existing cache index, creating a new entry if necesary.
+ * Get a NodeId's existing cache index, creating a new entry
+ * if necesary.
*
- * @param nodeId nodeId to lookup
- * @return cache index of existing entry or -1 to indicate the entry was added
+ * @param nodeId
+ * nodeId to lookup
+ * @return cache index of existing entry or -1 to indicate
+ * the entry was added
*/
private int getOrCreateIndex(NodeId nodeId) {
int index = uuidIndex.indexOf(nodeId);
@@ -267,7 +304,8 @@
/**
* Check that this output is open, throw otherwise.
*
- * @throws IllegalStateException if output is closed.
+ * @throws IllegalStateException
+ * if output is closed.
*/
private void checkOpen() throws IllegalStateException {
if (closed) {
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRevision.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRevision.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/FileRevision.java (working copy)
@@ -16,14 +16,14 @@
*/
package org.apache.jackrabbit.core.cluster;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
-
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileLock;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Maintains a file-based revision counter with locking, assuring uniqueness.
*/
@@ -32,7 +32,8 @@
/**
* Logger.
*/
- private static final Logger log = LoggerFactory.getLogger(FileRevision.class);
+ private static final Logger log = LoggerFactory
+ .getLogger(FileRevision.class);
/**
* Underlying file.
@@ -57,7 +58,8 @@
/**
* Creates a new file based revision counter.
*
- * @param file holding global counter
+ * @param file
+ * holding global counter
*/
public FileRevision(File file) {
this.file = file;
@@ -67,7 +69,8 @@
file.createNewFile();
}
} catch (IOException e) {
- String msg = "I/O error while attempting to create new file '" + file + "': " + e.getMessage();
+ String msg = "I/O error while attempting to create new file '"
+ + file + "': " + e.getMessage();
log.warn(msg);
}
}
@@ -75,7 +78,8 @@
/**
* Lock underlying file.
*
- * @param shared whether to allow other readers or not
+ * @param shared
+ * whether to allow other readers or not
*/
public void lock(boolean shared) throws JournalException {
if (lock == null) {
@@ -90,7 +94,8 @@
try {
raf.close();
} catch (IOException e) {
- String msg = "I/O error while closing file " + file.getPath() + ": " + e.getMessage();
+ String msg = "I/O error while closing file "
+ + file.getPath() + ": " + e.getMessage();
log.warn(msg);
}
}
@@ -107,7 +112,8 @@
try {
lock.release();
} catch (IOException e) {
- String msg = "I/O error while releasing lock: " + e.getMessage();
+ String msg = "I/O error while releasing lock: "
+ + e.getMessage();
log.warn(msg);
} finally {
lock = null;
@@ -127,7 +133,8 @@
* Return current counter value.
*
* @return counter value
- * @throws JournalException if some error occurs
+ * @throws JournalException
+ * if some error occurs
*/
public long get() throws JournalException {
try {
@@ -150,8 +157,10 @@
/**
* Set current counter value.
*
- * @param value new counter value
- * @throws JournalException if some error occurs
+ * @param value
+ * new counter value
+ * @throws JournalException
+ * if some error occurs
*/
public void set(long value) throws JournalException {
try {
@@ -165,4 +174,4 @@
unlock();
}
}
-}
\ No newline at end of file
+}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ItemOperation.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ItemOperation.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ItemOperation.java (working copy)
@@ -44,7 +44,8 @@
private final int operationType;
/**
- * Creates a new instance of this class. Takes an operation type as parameter.
+ * Creates a new instance of this class. Takes an operation type as
+ * parameter.
*/
protected ItemOperation(int operationType) {
this.operationType = operationType;
@@ -62,7 +63,8 @@
/**
* Apply an operation to a change log. Subclass responsibility.
*
- * @param changeLog change log
+ * @param changeLog
+ * change log
*/
public abstract void apply(ChangeLog changeLog);
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/Journal.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/Journal.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/Journal.java (working copy)
@@ -16,109 +16,137 @@
*/
package org.apache.jackrabbit.core.cluster;
+import java.util.Collection;
+
+import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.observation.EventStateCollection;
import org.apache.jackrabbit.core.state.ChangeLog;
-import org.apache.jackrabbit.core.observation.EventStateCollection;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.QName;
-import java.util.Collection;
-
/**
- * Journal interface. Defines operations on a journal that are used to synchronize clustered repository nodes.
+ * Journal interface. Defines operations on a journal that are used to
+ * synchronize clustered repository nodes.
*/
public interface Journal {
/**
* Initialize journal.
*
- * @param id id this journal should use to write its own records
- * @param resolver namespace resolver used to map prefixes to URIs and vice-versa.
- * @param processor to invoke when new records are processed
- * @throws JournalException if an error occurs
+ * @param id
+ * id this journal should use to write its own records
+ * @param resolver
+ * namespace resolver used to map prefixes to URIs and
+ * vice-versa.
+ * @param processor
+ * to invoke when new records are processed
+ * @throws JournalException
+ * if an error occurs
*/
- public void init(String id, RecordProcessor processor, NamespaceResolver resolver) throws JournalException;
+ void init(String id, RecordProcessor processor,
+ NamespaceResolver resolver) throws JournalException;
/**
* Synchronize contents from journal.
*
- * @throws JournalException if an error occurs
+ * @throws JournalException
+ * if an error occurs
*/
- public void sync() throws JournalException;
+ void sync() throws JournalException;
/**
* Start an update operation on the journal.
- * @param workspace workspace name, may be null
*
- * @throws JournalException if an error occurs
+ * @param workspace
+ * workspace name, may be null
+ * @throws JournalException
+ * if an error occurs
*/
- public void begin(String workspace) throws JournalException;
+ void begin(String workspace) throws JournalException;
/**
* Add item state operations to the journal.
*
- * @param changes changes to transfer
- * @throws JournalException if an error occurs
+ * @param changes
+ * changes to transfer
+ * @throws JournalException
+ * if an error occurs
*/
- public void log(ChangeLog changes, EventStateCollection esc) throws JournalException;
+ void log(ChangeLog changes, EventStateCollection esc)
+ throws JournalException;
/**
* Log a lock operation.
*
- * @param nodeId node id
- * @param isDeep flag indicating whether lock is deep
- * @param owner lock owner
- * @throws JournalException if an error occurs
+ * @param nodeId
+ * node id
+ * @param isDeep
+ * flag indicating whether lock is deep
+ * @param owner
+ * lock owner
+ * @throws JournalException
+ * if an error occurs
*/
- public void log(NodeId nodeId, boolean isDeep, String owner)
+ void log(NodeId nodeId, boolean isDeep, String owner)
throws JournalException;
/**
* Log an unlock operation.
*
- * @param nodeId node id
- * @throws JournalException if an error occurs
+ * @param nodeId
+ * node id
+ * @throws JournalException
+ * if an error occurs
*/
- public void log(NodeId nodeId) throws JournalException;
+ void log(NodeId nodeId) throws JournalException;
/**
* Log a namespace registry operation.
*
- * @param oldPrefix old prefix
- * @param newPrefix new prefix
- * @param uri URI
- * @throws JournalException if an error occurs
+ * @param oldPrefix
+ * old prefix
+ * @param newPrefix
+ * new prefix
+ * @param uri
+ * URI
+ * @throws JournalException
+ * if an error occurs
*/
- public void log(String oldPrefix, String newPrefix, String uri) throws JournalException;
+ void log(String oldPrefix, String newPrefix, String uri)
+ throws JournalException;
/**
* Log on or more node type registrations or reregistration.
*
- * @param ntDefs node type definitions
+ * @param ntDefs
+ * node type definitions
*/
- public void log(Collection ntDefs) throws JournalException;
+ void log(Collection ntDefs) throws JournalException;
/**
- * Prepare an update operation on the journal. This locks the journal exclusively for updates until this client
- * either invokes {@link #cancel} or {@link #commit}. If a conflicting intermittent change is detected, this
- * method should throw an exception, signaling that the whole update operation should be undone.
+ * Prepare an update operation on the journal. This locks the journal
+ * exclusively for updates until this client either invokes {@link #cancel}
+ * or {@link #commit}. If a conflicting intermittent change is detected,
+ * this method should throw an exception, signaling that the whole update
+ * operation should be undone.
*
- * @throws JournalException if an error occurs
+ * @throws JournalException
+ * if an error occurs
*/
- public void prepare() throws JournalException;
+ void prepare() throws JournalException;
/**
* End this update operation and definitely write changes to the journal.
*
- * @throws JournalException if an error occurs
+ * @throws JournalException
+ * if an error occurs
*/
- public void commit() throws JournalException;
+ void commit() throws JournalException;
/**
* End this update operation and discards changes made to the journal.
*
- * @throws JournalException if an error occurs
+ * @throws JournalException
+ * if an error occurs
*/
- public void cancel() throws JournalException;
+ void cancel() throws JournalException;
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/JournalException.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/JournalException.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/JournalException.java (working copy)
@@ -17,7 +17,8 @@
package org.apache.jackrabbit.core.cluster;
/**
- * The JournalException signals an error within a journal operation.
+ * The JournalException signals an error within a journal
+ * operation.
*/
public class JournalException extends ClusterException {
@@ -25,20 +26,23 @@
* Constructs a new instance of this class with the specified detail
* message.
*
- * @param message the detail message. The detail message is saved for
- * later retrieval by the {@link #getMessage()} method.
+ * @param message
+ * the detail message. The detail message is saved for later
+ * retrieval by the {@link #getMessage()} method.
*/
public JournalException(String message) {
super(message);
}
/**
- * Constructs a new instance of this class with the specified detail
- * message and root cause.
+ * Constructs a new instance of this class with the specified detail message
+ * and root cause.
*
- * @param message the detail message. The detail message is saved for
- * later retrieval by the {@link #getMessage()} method.
- * @param rootCause root failure cause
+ * @param message
+ * the detail message. The detail message is saved for later
+ * retrieval by the {@link #getMessage()} method.
+ * @param rootCause
+ * root failure cause
*/
public JournalException(String message, Throwable rootCause) {
super(message, rootCause);
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockEventChannel.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockEventChannel.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockEventChannel.java (working copy)
@@ -26,23 +26,29 @@
/**
* Called when a node has been locked.
*
- * @param nodeId node id
- * @param deep flag indicating whether lock is deep
- * @param owner lock owner
+ * @param nodeId
+ * node id
+ * @param deep
+ * flag indicating whether lock is deep
+ * @param owner
+ * lock owner
*/
- public void locked(NodeId nodeId, boolean deep, String owner);
+ void locked(NodeId nodeId, boolean deep, String owner);
/**
* Called when a node has been unlocked.
*
- * @param nodeId node id
+ * @param nodeId
+ * node id
*/
- public void unlocked(NodeId nodeId);
+ void unlocked(NodeId nodeId);
/**
- * Set listener that will receive information about incoming, external lock events.
+ * Set listener that will receive information about incoming, external lock
+ * events.
*
- * @param listener lock event listener
+ * @param listener
+ * lock event listener
*/
- public void setListener(LockEventListener listener);
+ void setListener(LockEventListener listener);
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockEventListener.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockEventListener.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/LockEventListener.java (working copy)
@@ -16,10 +16,10 @@
*/
package org.apache.jackrabbit.core.cluster;
+import javax.jcr.RepositoryException;
+
import org.apache.jackrabbit.core.NodeId;
-import javax.jcr.RepositoryException;
-
/**
* Interface used to receive information about incoming, external lock events.
*/
@@ -28,19 +28,26 @@
/**
* Handle an external lock operation.
*
- * @param nodeId node id
- * @param isDeep true if the lock is deep;
- * false otherwise
- * @param userId user id
- * @throws RepositoryException if the lock cannot be processed
+ * @param nodeId
+ * node id
+ * @param isDeep
+ * true if the lock is deep; false
+ * otherwise
+ * @param userId
+ * user id
+ * @throws RepositoryException
+ * if the lock cannot be processed
*/
- public void externalLock(NodeId nodeId, boolean isDeep, String userId) throws RepositoryException;
+ void externalLock(NodeId nodeId, boolean isDeep, String userId)
+ throws RepositoryException;
/**
* Handle an external unlock operation.
*
- * @param nodeId node id
- * @throws RepositoryException if the unlock cannot be processed
+ * @param nodeId
+ * node id
+ * @throws RepositoryException
+ * if the unlock cannot be processed
*/
- public void externalUnlock(NodeId nodeId) throws RepositoryException;
+ void externalUnlock(NodeId nodeId) throws RepositoryException;
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventChannel.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventChannel.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventChannel.java (working copy)
@@ -24,16 +24,21 @@
/**
* Called when a namespace has been remapped.
*
- * @param oldPrefix old prefix. if null this is a fresh mapping
- * @param newPrefix new prefix. if null this is an unmap operation
- * @param uri uri to map prefix to
+ * @param oldPrefix
+ * old prefix. if null this is a fresh mapping
+ * @param newPrefix
+ * new prefix. if null this is an unmap operation
+ * @param uri
+ * uri to map prefix to
*/
- public void remapped(String oldPrefix, String newPrefix, String uri);
+ void remapped(String oldPrefix, String newPrefix, String uri);
/**
- * Set listener that will receive information about incoming, external namespace events.
+ * Set listener that will receive information about incoming, external
+ * namespace events.
*
- * @param listener namespace event listener
+ * @param listener
+ * namespace event listener
*/
- public void setListener(NamespaceEventListener listener);
+ void setListener(NamespaceEventListener listener);
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventListener.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventListener.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventListener.java (working copy)
@@ -16,23 +16,26 @@
*/
package org.apache.jackrabbit.core.cluster;
-import org.apache.jackrabbit.core.NodeId;
-
import javax.jcr.RepositoryException;
/**
- * Interface used to receive information about incoming, external namespace registry events.
+ * Interface used to receive information about incoming, external namespace
+ * registry events.
*/
public interface NamespaceEventListener {
/**
* Called when a namespace has been externally remapped.
*
- * @param oldPrefix old prefix. if null this is a fresh mapping
- * @param newPrefix new prefix. if null this is an unmap operation
- * @param uri uri to map prefix to
- * @throws RepositoryException if an error occurs
+ * @param oldPrefix
+ * old prefix. if null this is a fresh mapping
+ * @param newPrefix
+ * new prefix. if null this is an unmap operation
+ * @param uri
+ * uri to map prefix to
+ * @throws RepositoryException
+ * if an error occurs
*/
- public void externalRemap(String oldPrefix, String newPrefix, String uri)
+ void externalRemap(String oldPrefix, String newPrefix, String uri)
throws RepositoryException;
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeAddedOperation.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeAddedOperation.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeAddedOperation.java (working copy)
@@ -16,8 +16,8 @@
*/
package org.apache.jackrabbit.core.cluster;
+import org.apache.jackrabbit.core.state.ChangeLog;
import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.ChangeLog;
/**
* Describes a journal operation for a node addition.
@@ -32,15 +32,17 @@
}
/**
- * Create a node operation for an added node. All members must be remembered.
+ * Create a node operation for an added node. All members must be
+ * remembered.
*
- * @param state node state
+ * @param state
+ * node state
* @return node operation
*/
public static NodeOperation create(NodeState state) {
NodeOperation operation = new NodeAddedOperation();
operation.setId(state.getNodeId());
- //todo set other members
+ // todo set other members
return operation;
}
@@ -48,8 +50,9 @@
* {@inheritDoc}
*/
public void apply(ChangeLog changeLog) {
- NodeState state = new NodeState(getId(), null, null, NodeState.STATUS_NEW, false);
+ NodeState state = new NodeState(getId(), null, null,
+ NodeState.STATUS_NEW, false);
state.setStatus(NodeState.STATUS_EXISTING);
changeLog.added(state);
}
-}
\ No newline at end of file
+}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeDeletedOperation.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeDeletedOperation.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeDeletedOperation.java (working copy)
@@ -16,8 +16,8 @@
*/
package org.apache.jackrabbit.core.cluster;
+import org.apache.jackrabbit.core.state.ChangeLog;
import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.ChangeLog;
/**
* Describes a journal operation for a node deletion.
@@ -32,9 +32,11 @@
}
/**
- * Create a node operation for a deleted node. The only member that must be transmitted is the node id.
+ * Create a node operation for a deleted node. The only member that must be
+ * transmitted is the node id.
*
- * @param state node state
+ * @param state
+ * node state
* @return node operation
*/
public static NodeOperation create(NodeState state) {
@@ -47,8 +49,9 @@
* {@inheritDoc}
*/
public void apply(ChangeLog changeLog) {
- NodeState state = new NodeState(getId(), null, null, NodeState.STATUS_NEW, false);
+ NodeState state = new NodeState(getId(), null, null,
+ NodeState.STATUS_NEW, false);
state.setStatus(NodeState.STATUS_EXISTING_REMOVED);
changeLog.deleted(state);
}
-}
\ No newline at end of file
+}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeModifiedOperation.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeModifiedOperation.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeModifiedOperation.java (working copy)
@@ -16,8 +16,8 @@
*/
package org.apache.jackrabbit.core.cluster;
+import org.apache.jackrabbit.core.state.ChangeLog;
import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.ChangeLog;
/**
* Describes a journal operation for a node modification.
@@ -32,15 +32,17 @@
}
/**
- * Create a node operation for a modified node. Only modified/modifiable members must be remembered.
+ * Create a node operation for a modified node. Only modified/modifiable
+ * members must be remembered.
*
- * @param state node state
+ * @param state
+ * node state
* @return node operation
*/
public static NodeOperation create(NodeState state) {
NodeOperation operation = new NodeModifiedOperation();
operation.setId(state.getNodeId());
- //todo set other members
+ // todo set other members
return operation;
}
@@ -48,8 +50,9 @@
* {@inheritDoc}
*/
public void apply(ChangeLog changeLog) {
- NodeState state = new NodeState(getId(), null, null, NodeState.STATUS_NEW, false);
+ NodeState state = new NodeState(getId(), null, null,
+ NodeState.STATUS_NEW, false);
state.setStatus(NodeState.STATUS_EXISTING_MODIFIED);
changeLog.modified(state);
}
-}
\ No newline at end of file
+}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeOperation.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeOperation.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeOperation.java (working copy)
@@ -16,8 +16,8 @@
*/
package org.apache.jackrabbit.core.cluster;
+import org.apache.jackrabbit.core.NodeId;
import org.apache.jackrabbit.core.nodetype.NodeDefId;
-import org.apache.jackrabbit.core.NodeId;
/**
* Describes a journal record for a node change.
@@ -35,9 +35,11 @@
private NodeDefId definitionId;
/**
- * Creates a new instance of this class. Takes an operation type as paramter.
+ * Creates a new instance of this class. Takes an operation type as
+ * paramter.
*
- * @param operationType operation type
+ * @param operationType
+ * operation type
*/
protected NodeOperation(int operationType) {
super(operationType);
@@ -46,19 +48,21 @@
/**
* Creates a new instance of a known subclass.
*
- * @param operationType operation type
+ * @param operationType
+ * operation type
* @return instance of this class
*/
public static NodeOperation create(int operationType) {
switch (operationType) {
- case ADDED:
- return new NodeAddedOperation();
- case MODIFIED:
- return new NodeModifiedOperation();
- case DELETED:
- return new NodeDeletedOperation();
- default:
- throw new IllegalArgumentException("Unknown operation type: " + operationType);
+ case ADDED:
+ return new NodeAddedOperation();
+ case MODIFIED:
+ return new NodeModifiedOperation();
+ case DELETED:
+ return new NodeDeletedOperation();
+ default:
+ throw new IllegalArgumentException("Unknown operation type: "
+ + operationType);
}
}
@@ -84,7 +88,8 @@
/**
* Set the node id.
*
- * @param id node id
+ * @param id
+ * node id
*/
public void setId(NodeId id) {
this.id = id;
@@ -100,7 +105,8 @@
}
/**
- * Return a flag indicating whether the definition id is contained in this record.
+ * Return a flag indicating whether the definition id is contained in this
+ * record.
*
* @return true if the definition id is contained;
* false otherwise.
@@ -112,7 +118,8 @@
/**
* Set the definition id.
*
- * @param defintionId definition id
+ * @param defintionId
+ * definition id
*/
public void setDefintionId(NodeDefId defintionId) {
this.definitionId = defintionId;
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventChannel.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventChannel.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventChannel.java (working copy)
@@ -26,14 +26,17 @@
/**
* Called when one or more node types have been registered.
*
- * @param ntDefs collection of node type definitions
+ * @param ntDefs
+ * collection of node type definitions
*/
- public void registered(Collection ntDefs);
+ void registered(Collection ntDefs);
/**
- * Set listener that will receive information about incoming, external node type events.
+ * Set listener that will receive information about incoming, external node
+ * type events.
*
- * @param listener node type event listener
+ * @param listener
+ * node type event listener
*/
- public void setListener(NodeTypeEventListener listener);
+ void setListener(NodeTypeEventListener listener);
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventListener.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventListener.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventListener.java (working copy)
@@ -16,23 +16,28 @@
*/
package org.apache.jackrabbit.core.cluster;
-import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
+import java.util.Collection;
import javax.jcr.RepositoryException;
-import java.util.Collection;
+import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
+
/**
- * Interface used to receive information about incoming, external node type registry events.
+ * Interface used to receive information about incoming, external node type
+ * registry events.
*/
public interface NodeTypeEventListener {
/**
* Called when one or more node types have been externally registered.
*
- * @param ntDefs node type definitions
- * @throws RepositoryException if an error occurs
- * @throws InvalidNodeTypeDefException if the node type definition is invalid
+ * @param ntDefs
+ * node type definitions
+ * @throws RepositoryException
+ * if an error occurs
+ * @throws InvalidNodeTypeDefException
+ * if the node type definition is invalid
*/
- public void externalRegistered(Collection ntDefs)
+ void externalRegistered(Collection ntDefs)
throws RepositoryException, InvalidNodeTypeDefException;
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyAddedOperation.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyAddedOperation.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyAddedOperation.java (working copy)
@@ -16,8 +16,8 @@
*/
package org.apache.jackrabbit.core.cluster;
+import org.apache.jackrabbit.core.state.ChangeLog;
import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.ChangeLog;
/**
* Describes a journal operation for a property addition.
@@ -32,15 +32,17 @@
}
/**
- * Create a property record for an added property. All members must be remembered.
+ * Create a property record for an added property. All members must be
+ * remembered.
*
- * @param state property state
+ * @param state
+ * property state
* @return property operation
*/
public static PropertyOperation create(PropertyState state) {
PropertyOperation operation = new PropertyAddedOperation();
operation.setId(state.getPropertyId());
- //todo set other members
+ // todo set other members
return operation;
}
@@ -48,8 +50,9 @@
* {@inheritDoc}
*/
public void apply(ChangeLog changeLog) {
- PropertyState state = new PropertyState(getId(), PropertyState.STATUS_NEW, false);
+ PropertyState state = new PropertyState(getId(),
+ PropertyState.STATUS_NEW, false);
state.setStatus(PropertyState.STATUS_EXISTING);
changeLog.added(state);
}
-}
\ No newline at end of file
+}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyDeletedOperation.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyDeletedOperation.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyDeletedOperation.java (working copy)
@@ -16,8 +16,8 @@
*/
package org.apache.jackrabbit.core.cluster;
+import org.apache.jackrabbit.core.state.ChangeLog;
import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.ChangeLog;
/**
* Describes a journal operation for a property deletion.
@@ -32,9 +32,11 @@
}
/**
- * Create a property record for a deleted property. The only member that must be transmitted is the property id.
+ * Create a property record for a deleted property. The only member that
+ * must be transmitted is the property id.
*
- * @param state property state
+ * @param state
+ * property state
* @return property operation
*/
public static PropertyOperation create(PropertyState state) {
@@ -47,8 +49,9 @@
* {@inheritDoc}
*/
public void apply(ChangeLog changeLog) {
- PropertyState state = new PropertyState(getId(), PropertyState.STATUS_NEW, false);
+ PropertyState state = new PropertyState(getId(),
+ PropertyState.STATUS_NEW, false);
state.setStatus(PropertyState.STATUS_EXISTING_REMOVED);
changeLog.deleted(state);
}
-}
\ No newline at end of file
+}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyModifiedOperation.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyModifiedOperation.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyModifiedOperation.java (working copy)
@@ -16,8 +16,8 @@
*/
package org.apache.jackrabbit.core.cluster;
+import org.apache.jackrabbit.core.state.ChangeLog;
import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.ChangeLog;
/**
* Describes a journal operation for a property modification.
@@ -32,15 +32,17 @@
}
/**
- * Create a property record for a modified property. Only modified/modifiable members must be transmitted.
+ * Create a property record for a modified property. Only
+ * modified/modifiable members must be transmitted.
*
- * @param state property state
+ * @param state
+ * property state
* @return property operation
*/
public static PropertyOperation create(PropertyState state) {
PropertyOperation operation = new PropertyModifiedOperation();
operation.setId(state.getPropertyId());
- //todo set other members
+ // todo set other members
return operation;
}
@@ -48,8 +50,9 @@
* {@inheritDoc}
*/
public void apply(ChangeLog changeLog) {
- PropertyState state = new PropertyState(getId(), PropertyState.STATUS_NEW, false);
+ PropertyState state = new PropertyState(getId(),
+ PropertyState.STATUS_NEW, false);
state.setStatus(PropertyState.STATUS_EXISTING_MODIFIED);
changeLog.modified(state);
}
-}
\ No newline at end of file
+}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyOperation.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyOperation.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/PropertyOperation.java (working copy)
@@ -16,8 +16,8 @@
*/
package org.apache.jackrabbit.core.cluster;
+import org.apache.jackrabbit.core.PropertyId;
import org.apache.jackrabbit.core.nodetype.PropDefId;
-import org.apache.jackrabbit.core.PropertyId;
import org.apache.jackrabbit.core.value.InternalValue;
/**
@@ -51,8 +51,11 @@
private InternalValue[] values;
/**
- * Creates a new instance of this class. Takes an operation type as paramter.
- * @param operationType operation type
+ * Creates a new instance of this class. Takes an operation type as
+ * paramter.
+ *
+ * @param operationType
+ * operation type
*/
protected PropertyOperation(int operationType) {
super(operationType);
@@ -61,24 +64,28 @@
/**
* Creates a new instance of a known subclass.
*
- * @param operationType operation type
+ * @param operationType
+ * operation type
* @return instance of this class
*/
public static PropertyOperation create(int operationType) {
switch (operationType) {
- case ADDED:
- return new PropertyAddedOperation();
- case MODIFIED:
- return new PropertyModifiedOperation();
- case DELETED:
- return new PropertyDeletedOperation();
- default:
- throw new IllegalArgumentException("Unknown operation type: " + operationType);
+ case ADDED:
+ return new PropertyAddedOperation();
+ case MODIFIED:
+ return new PropertyModifiedOperation();
+ case DELETED:
+ return new PropertyDeletedOperation();
+ default:
+ throw new IllegalArgumentException("Unknown operation type: "
+ + operationType);
}
}
/**
- * Return a flag indicating whether the definiton id is contained in this record.
+ * Return a flag indicating whether the definiton id is contained in this
+ * record.
+ *
* @return true if the definition id is contained;
* false otherwise.
*/
@@ -88,6 +95,7 @@
/**
* Return the definition id.
+ *
* @return definition id
*/
public PropDefId getDefinitionId() {
@@ -96,14 +104,18 @@
/**
* Set the definition id.
- * @param definitionId definition id
+ *
+ * @param definitionId
+ * definition id
*/
public void setDefinitionId(PropDefId definitionId) {
this.definitionId = definitionId;
}
/**
- * Return a flag indicating whether the property id is contained in this record.
+ * Return a flag indicating whether the property id is contained in this
+ * record.
+ *
* @return true if the property id is contained;
* false otherwise.
*/
@@ -113,6 +125,7 @@
/**
* Return the property id.
+ *
* @return property id
*/
public PropertyId getId() {
@@ -121,14 +134,18 @@
/**
* Set the property id.
- * @param id property id
+ *
+ * @param id
+ * property id
*/
public void setId(PropertyId id) {
this.id = id;
}
/**
- * Return a flag indicating whether the multivalued flag is contained in this record.
+ * Return a flag indicating whether the multivalued flag is contained in
+ * this record.
+ *
* @return true if the multivalued flag is contained;
* false otherwise.
*/
@@ -138,6 +155,7 @@
/**
* Return the multivalued flag.
+ *
* @return multivalued flag
*/
public boolean isMultiValued() {
@@ -146,7 +164,9 @@
/**
* Set the multivalued flag.
- * @param multiValued multivalued flag
+ *
+ * @param multiValued
+ * multivalued flag
*/
public void setMultiValued(boolean multiValued) {
this.multiValued = new Boolean(multiValued);
@@ -154,8 +174,9 @@
/**
* Return a flag indicating whether the type is contained.
- * @return true if the type is contained;
- * false otherwise.
+ *
+ * @return true if the type is contained; false
+ * otherwise.
*/
public boolean hasType() {
return type != null;
@@ -163,6 +184,7 @@
/**
* Return the type.
+ *
* @return type
*/
public int getType() {
@@ -171,7 +193,9 @@
/**
* Set the type.
- * @param type type
+ *
+ * @param type
+ * type
*/
public void setType(int type) {
this.type = new Integer(type);
@@ -179,6 +203,7 @@
/**
* Return a flag indicating whether the values contained in this record.
+ *
* @return true if the values contained contained;
* false otherwise.
*/
@@ -188,6 +213,7 @@
/**
* Return the values.
+ *
* @return value
*/
public InternalValue[] getValues() {
@@ -196,9 +222,11 @@
/**
* Set the values.
- * @param values values
+ *
+ * @param values
+ * values
*/
public void setValues(InternalValue[] values) {
this.values = values;
}
-}
\ No newline at end of file
+}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/RecordProcessor.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/RecordProcessor.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/RecordProcessor.java (working copy)
@@ -16,80 +16,100 @@
*/
package org.apache.jackrabbit.core.cluster;
+import java.util.Collection;
+import java.util.Set;
+
import org.apache.jackrabbit.core.NodeId;
import org.apache.jackrabbit.name.Path;
import org.apache.jackrabbit.name.QName;
-import java.util.Set;
-import java.util.Collection;
-
/**
- * Listener interface on a journal that gets called back for records that should be processed.
+ * Listener interface on a journal that gets called back for records that should
+ * be processed.
*/
public interface RecordProcessor {
/**
* Invoked when a record starts.
*
- * @param workspace workspace, may be null
+ * @param workspace
+ * workspace, may be null
*/
- public void start(String workspace);
+ void start(String workspace);
/**
* Process an update operation.
*
- * @param operation operation to process
+ * @param operation
+ * operation to process
*/
- public void process(ItemOperation operation);
+ void process(ItemOperation operation);
/**
* Process an event.
*
- * @param type event type
- * @param parentId parent id
- * @param parentPath parent path
- * @param childId child id
- * @param childRelPath child relative path
- * @param ntName ndoe type name
- * @param userId user id
+ * @param type
+ * event type
+ * @param parentId
+ * parent id
+ * @param parentPath
+ * parent path
+ * @param childId
+ * child id
+ * @param childRelPath
+ * child relative path
+ * @param ntName
+ * ndoe type name
+ * @param userId
+ * user id
*/
- public void process(int type, NodeId parentId, Path parentPath, NodeId childId,
- Path.PathElement childRelPath, QName ntName, Set mixins, String userId);
+ // TODO: refactor - too many parameters
+ void process(int type, NodeId parentId, Path parentPath, NodeId childId,
+ Path.PathElement childRelPath, QName ntName, Set mixins,
+ String userId);
/**
* Process a lock operation.
*
- * @param nodeId node id
- * @param isDeep flag indicating whether lock is deep
- * @param owner lock owner
+ * @param nodeId
+ * node id
+ * @param isDeep
+ * flag indicating whether lock is deep
+ * @param owner
+ * lock owner
*/
- public void process(NodeId nodeId, boolean isDeep, String owner);
+ void process(NodeId nodeId, boolean isDeep, String owner);
/**
* Process an unlock operation.
*
- * @param nodeId node id
+ * @param nodeId
+ * node id
*/
- public void process(NodeId nodeId);
+ void process(NodeId nodeId);
/**
* Process a namespace operation.
*
- * @param oldPrefix old prefix. if null this is a fresh mapping
- * @param newPrefix new prefix. if null this is an unmap operation
- * @param uri uri to map prefix to
+ * @param oldPrefix
+ * old prefix. if null this is a fresh mapping
+ * @param newPrefix
+ * new prefix. if null this is an unmap operation
+ * @param uri
+ * uri to map prefix to
*/
- public void process(String oldPrefix, String newPrefix, String uri);
+ void process(String oldPrefix, String newPrefix, String uri);
/**
* Process one or more node type registrations.
*
- * @param ntDefs node type definition
+ * @param ntDefs
+ * node type definition
*/
- public void process(Collection ntDefs);
+ void process(Collection ntDefs);
/**
* Invoked when a record ends.
*/
- public void end();
+ void end();
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java (working copy)
@@ -16,8 +16,8 @@
*/
package org.apache.jackrabbit.core.cluster;
+import org.apache.jackrabbit.core.observation.EventStateCollection;
import org.apache.jackrabbit.core.state.ChangeLog;
-import org.apache.jackrabbit.core.observation.EventStateCollection;
/**
* Event channel used to transmit update operations.
@@ -27,30 +27,34 @@
/**
* Called when an a update operation has been created.
*
- * @param changes changes
- * @param esc events as they will be delivered on success
+ * @param changes
+ * changes
+ * @param esc
+ * events as they will be delivered on success
*/
- public void updateCreated(ChangeLog changes, EventStateCollection esc);
+ void updateCreated(ChangeLog changes, EventStateCollection esc);
/**
* Called when an a update operation has been prepared.
*/
- public void updatePrepared();
+ void updatePrepared();
/**
* Called when an a update operation has been committed.
*/
- public void updateCommitted();
+ void updateCommitted();
/**
* Called when an a update operation has been cancelled.
*/
- public void updateCancelled();
+ void updateCancelled();
/**
- * Set listener that will receive information about incoming, external update events.
+ * Set listener that will receive information about incoming, external
+ * update events.
*
- * @param listener update event listener
+ * @param listener
+ * update event listener
*/
- public void setListener(UpdateEventListener listener);
+ void setListener(UpdateEventListener listener);
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventListener.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventListener.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventListener.java (working copy)
@@ -17,9 +17,11 @@
package org.apache.jackrabbit.core.cluster;
import java.util.List;
-import org.apache.jackrabbit.core.state.ChangeLog;
+
import javax.jcr.RepositoryException;
+import org.apache.jackrabbit.core.state.ChangeLog;
+
/**
* Interface used to receive information about incoming, external update events.
*/
@@ -28,9 +30,13 @@
/**
* Handle an external update.
*
- * @param changes external changes containing only node and property ids.
- * @param events events to deliver
- * @throws RepositoryException if the update cannot be processed
+ * @param changes
+ * external changes containing only node and property ids.
+ * @param events
+ * events to deliver
+ * @throws RepositoryException
+ * if the update cannot be processed
*/
- public void externalUpdate(ChangeLog changes, List events) throws RepositoryException;
+ void externalUpdate(ChangeLog changes, List events)
+ throws RepositoryException;
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/AccessManagerConfig.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/AccessManagerConfig.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/AccessManagerConfig.java (working copy)
@@ -17,24 +17,24 @@
package org.apache.jackrabbit.core.config;
/**
- * Access manager configuration. This bean configuration class
- * is used to create configured access manager objects.
+ * Access manager configuration. This bean configuration class is used to create
+ * configured access manager objects.
*
- * This class is currently only used to assign a static type to
- * more generic bean configuration information.
+ * This class is currently only used to assign a static type to more generic
+ * bean configuration information.
*
* @see RepositoryConfig#getAccessManagerConfig()
*/
public class AccessManagerConfig extends BeanConfig {
/**
- * Creates an access manager configuration object from the
- * given bean configuration.
+ * Creates an access manager configuration object from the given bean
+ * configuration.
*
- * @param config bean configuration
+ * @param config
+ * bean configuration
*/
public AccessManagerConfig(BeanConfig config) {
super(config);
}
-
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java (working copy)
@@ -16,28 +16,28 @@
*/
package org.apache.jackrabbit.core.config;
-import org.apache.commons.collections.BeanMap;
-
import java.util.Iterator;
import java.util.Properties;
+import org.apache.commons.collections.BeanMap;
+
/**
- * Bean configuration class. BeanConfig instances contain the class name
- * and property information required to instantiate a class that conforms
- * with the JavaBean conventions.
+ * Bean configuration class. BeanConfig instances contain the class name and
+ * property information required to instantiate a class that conforms with the
+ * JavaBean conventions.
*/
public class BeanConfig {
/** The default class loader used by all instances of this class */
- private static ClassLoader DEFAULT_CLASS_LOADER =
- BeanConfig.class.getClassLoader();
-
+ private static ClassLoader defaultClassLoader = BeanConfig.class
+ .getClassLoader();
+
/**
* The current class loader used by this instance to create instances of
* configured classes.
*/
private ClassLoader classLoader = getDefaultClassLoader();
-
+
/**
* The class name of the configured bean.
*/
@@ -49,13 +49,15 @@
private final Properties properties;
/**
- * Creates a bean configuration. Note that a copy of the given
- * bean properties is stored as a part of the created configuration
- * object. Thus the caller is free to modify the given properties
- * once the configuration object has been created.
+ * Creates a bean configuration. Note that a copy of the given bean
+ * properties is stored as a part of the created configuration object. Thus
+ * the caller is free to modify the given properties once the configuration
+ * object has been created.
*
- * @param className class name of the bean
- * @param properties initial properties of the bean
+ * @param className
+ * class name of the bean
+ * @param properties
+ * initial properties of the bean
*/
public BeanConfig(String className, Properties properties) {
this.className = className;
@@ -65,7 +67,8 @@
/**
* Copies a bean configuration.
*
- * @param config the configuration to be copied
+ * @param config
+ * the configuration to be copied
*/
public BeanConfig(BeanConfig config) {
this(config.getClassName(), config.getParameters());
@@ -93,12 +96,13 @@
* Creates a new instance of the configured bean class.
*
* @return new bean instance
- * @throws ConfigurationException on bean configuration errors
+ * @throws ConfigurationException
+ * on bean configuration errors
*/
public Object newInstance() throws ConfigurationException {
try {
- Class objectClass =
- Class.forName(getClassName(), true, getClassLoader());
+ Class objectClass = Class.forName(getClassName(), true,
+ getClassLoader());
Object object = objectClass.newInstance();
BeanMap map = new BeanMap(object);
Iterator iterator = map.keyIterator();
@@ -113,24 +117,24 @@
} catch (ClassNotFoundException e) {
throw new ConfigurationException(
"Configured bean implementation class " + getClassName()
- + " was not found.", e);
+ + " was not found.", e);
} catch (InstantiationException e) {
throw new ConfigurationException(
"Configured bean implementation class " + getClassName()
- + " can not be instantiated.", e);
+ + " can not be instantiated.", e);
} catch (IllegalAccessException e) {
throw new ConfigurationException(
"Configured bean implementation class " + getClassName()
- + " is protected.", e);
+ + " is protected.", e);
}
}
- //---------- Configurable class loader support ----------------------------
-
+ // ---------- Configurable class loader support ----------------------------
+
/**
- * Returns the current ClassLoader used to instantiate objects
- * in the {@link #newInstance()} method.
- *
+ * Returns the current ClassLoader used to instantiate
+ * objects in the {@link #newInstance()} method.
+ *
* @see #newInstance()
* @see #setClassLoader(ClassLoader)
* @see #getDefaultClassLoader()
@@ -139,15 +143,15 @@
public ClassLoader getClassLoader() {
return classLoader;
}
-
+
/**
* Sets the ClassLoader used to instantiate objects in the
* {@link #newInstance()} method.
- *
- * @param classLoader The class loader to set on this instance. If this is
- * null the system class loader will be used, which may
- * lead to unexpected class loading failures.
- *
+ *
+ * @param classLoader
+ * The class loader to set on this instance. If this is
+ * null the system class loader will be used,
+ * which may lead to unexpected class loading failures.
* @see #newInstance()
* @see #getClassLoader()
* @see #getDefaultClassLoader()
@@ -156,35 +160,36 @@
public void setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
-
+
/**
* Returns the current ClassLoader used for new instances of
* this class as the loader used to instantiate objects in the
* {@link #newInstance()} method.
- *
+ *
* @see #newInstance()
* @see #getClassLoader()
* @see #setClassLoader(ClassLoader)
* @see #setDefaultClassLoader(ClassLoader)
*/
public static ClassLoader getDefaultClassLoader() {
- return DEFAULT_CLASS_LOADER;
+ return defaultClassLoader;
}
-
+
/**
- * Sets the ClassLoader used for new instances of this class as
- * the loader to instantiate objects in the {@link #newInstance()} method.
- *
- * @param classLoader The class loader to set as the default class loader.
- * If this is null the system class loader will be used,
- * which may lead to unexpected class loading failures.
- *
+ * Sets the ClassLoader used for new instances of this class
+ * as the loader to instantiate objects in the {@link #newInstance()}
+ * method.
+ *
+ * @param classLoader
+ * The class loader to set as the default class loader. If this
+ * is null the system class loader will be used,
+ * which may lead to unexpected class loading failures.
* @see #newInstance()
* @see #getClassLoader()
* @see #setClassLoader(ClassLoader)
* @see #getDefaultClassLoader()
*/
public static void setDefaultClassLoader(ClassLoader classLoader) {
- DEFAULT_CLASS_LOADER = classLoader;
+ defaultClassLoader = classLoader;
}
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java (working copy)
@@ -40,8 +40,10 @@
/**
* Creates a new cluster configuration.
*
- * @param id custom cluster node id
- * @param jc journal configuration
+ * @param id
+ * custom cluster node id
+ * @param jc
+ * journal configuration
*/
public ClusterConfig(String id, int syncDelay, JournalConfig jc) {
this.id = id;
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java (working copy)
@@ -16,64 +16,66 @@
*/
package org.apache.jackrabbit.core.config;
+import java.io.IOException;
+import java.io.InputStream;
+
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-import java.io.IOException;
-import java.io.InputStream;
-
/**
- * Entity resolver for Jackrabbit configuration files.
- * This simple resolver contains mappings for the following
- * public identifiers used for the Jackrabbit configuration files.
+ * Entity resolver for Jackrabbit configuration files. This simple resolver
+ * contains mappings for the following public identifiers used for the
+ * Jackrabbit configuration files.
*
-//The Apache Software Foundation//DTD Workspace//EN-//The Apache Software Foundation//DTD Repository//EN
- * The public identifiers are mapped to a document type definition
- * file included in the Jackrabbit jar archive.
+ * The public identifiers are mapped to a document type definition file included
+ * in the Jackrabbit jar archive.
*/
class ConfigurationEntityResolver implements EntityResolver {
/**
* Public identifier of the repository configuration DTD.
*/
- public static final String REPOSITORY_ID =
- "-//The Apache Software Foundation//DTD Repository//EN";
+ public static final String REPOSITORY_ID = "-//The Apache Software "
+ + "Foundation//DTD Repository//EN";
/**
* Public identifier of the workspace configuration DTD.
*/
- public static final String WORKSPACE_ID =
- "-//The Apache Software Foundation//DTD Workspace//EN";
+ public static final String WORKSPACE_ID = "-//The Apache Software "
+ + "Foundation//DTD Workspace//EN";
/**
* Resource path of the internal configuration DTD file.
*/
- private static final String CONFIG_DTD =
- "org/apache/jackrabbit/core/config/config.dtd";
+ private static final String CONFIG_DTD = "org/apache/jackrabbit/core/"
+ + "config/config.dtd";
/**
- * Resolves an entity to the corresponding input source.
- * {@inheritDoc}
+ * Resolves an entity to the corresponding input source. {@inheritDoc}
*
- * @param publicId public identifier
- * @param systemId system identifier
+ * @param publicId
+ * public identifier
+ * @param systemId
+ * system identifier
* @return resolved entity source
- * @throws SAXException on SAX errors
- * @throws IOException on IO errors
+ * @throws SAXException
+ * on SAX errors
+ * @throws IOException
+ * on IO errors
*/
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
if (REPOSITORY_ID.equals(publicId) || WORKSPACE_ID.equals(publicId)) {
- InputStream dtd =
- getClass().getClassLoader().getResourceAsStream(CONFIG_DTD);
+ InputStream dtd = getClass().getClassLoader().getResourceAsStream(
+ CONFIG_DTD);
return new InputSource(dtd);
} else {
return null;
}
}
-
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationException.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationException.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationException.java (working copy)
@@ -26,7 +26,8 @@
/**
* Creates a configuration exception.
*
- * @param message configuration message
+ * @param message
+ * configuration message
*/
ConfigurationException(String message) {
super(message);
@@ -35,11 +36,12 @@
/**
* Creates a configuration exception that is caused by another exception.
*
- * @param message configuration error message
- * @param cause root cause of the configuration error
+ * @param message
+ * configuration error message
+ * @param cause
+ * root cause of the configuration error
*/
ConfigurationException(String message, Exception cause) {
super(message, cause);
}
-
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java (working copy)
@@ -16,6 +16,14 @@
*/
package org.apache.jackrabbit.core.config;
+import java.io.IOException;
+import java.util.Properties;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.jackrabbit.util.Text;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -23,21 +31,14 @@
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-import org.apache.jackrabbit.util.Text;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.IOException;
-import java.util.Properties;
-
/**
- * Configuration parser base class. This class provides the basic
- * functionality for parsing Jackrabbit configuration files. Subclasses
- * extend this functionality with knowledge of the exact structure of the
- * different configuration files. Each configuration parser instance
- * contains a set of parser variables that are used for variable replacement
- * in the configuration file.
+ * Configuration parser base class. This class provides the basic functionality
+ * for parsing Jackrabbit configuration files. Subclasses extend this
+ * functionality with knowledge of the exact structure of the different
+ * configuration files. Each configuration parser instance contains a set of
+ * parser variables that are used for variable replacement in the configuration
+ * file.
*/
public class ConfigurationParser {
@@ -54,9 +55,9 @@
public static final String VALUE_ATTRIBUTE = "value";
/**
- * The configuration parser variables. These name-value pairs
- * are used to substitute ${...} variable references
- * with context-dependent values in the configuration.
+ * The configuration parser variables. These name-value pairs are used to
+ * substitute ${...} variable references with
+ * context-dependent values in the configuration.
*
* @see #replaceVariables(String)
*/
@@ -65,7 +66,8 @@
/**
* Creates a new configuration parser with the given parser variables.
*
- * @param variables parser variables
+ * @param variables
+ * parser variables
*/
public ConfigurationParser(Properties variables) {
this.variables = variables;
@@ -73,6 +75,7 @@
/**
* Returns the variables.
+ *
* @return the variables.
*/
public Properties getVariables() {
@@ -80,24 +83,28 @@
}
/**
- * Parses a named bean configuration from the given element.
- * Bean configuration uses the following format:
+ * Parses a named bean configuration from the given element. Bean
+ * configuration uses the following format:
+ *
*
- * <BeanName class="...">
- * <param name="..." value="..."/>
- * ...
- * </BeanName>
+ * <BeanName class="...">
+ * <param name="..." value="..."/>
+ * ...
+ * </BeanName>
*
+ *
*
- * The returned bean configuration object contains the configured
- * class name and configuration parameters. Variable replacement
- * is performed on the parameter values.
+ * The returned bean configuration object contains the configured class name
+ * and configuration parameters. Variable replacement is performed on the
+ * parameter values.
*
- * @param parent parent element
- * @param name name of the bean configuration element
+ * @param parent
+ * parent element
+ * @param name
+ * name of the bean configuration element
* @return bean configuration,
- * @throws ConfigurationException if the configuration element does not
- * exist or is broken
+ * @throws ConfigurationException
+ * if the configuration element does not exist or is broken
*/
protected BeanConfig parseBeanConfig(Element parent, String name)
throws ConfigurationException {
@@ -114,18 +121,18 @@
}
/**
- * Parses the configuration parameters of the given element.
- * Parameters are stored as
- * <param name="..." value="..."/>
- * child elements. This method parses all param elements,
- * performs {@link #replaceVariables(String) variable replacement}
- * on parameter values, and returns the resulting name-value pairs.
+ * Parses the configuration parameters of the given element. Parameters are
+ * stored as <param name="..." value="..."/> child
+ * elements. This method parses all param elements, performs
+ * {@link #replaceVariables(String) variable replacement} on parameter
+ * values, and returns the resulting name-value pairs.
*
- * @param element configuration element
+ * @param element
+ * configuration element
* @return configuration parameters
- * @throws ConfigurationException if a param element does
- * not contain the name and
- * value attributes
+ * @throws ConfigurationException
+ * if a param element does not contain the
+ * name and value attributes
*/
protected Properties parseParameters(Element element)
throws ConfigurationException {
@@ -145,8 +152,8 @@
if (value == null) {
throw new ConfigurationException("Parameter value not set");
}
- parameters.put(
- name.getValue(), replaceVariables(value.getValue()));
+ parameters.put(name.getValue(), replaceVariables(value
+ .getValue()));
}
}
@@ -154,15 +161,16 @@
}
/**
- * Performs variable replacement on the given string value.
- * Each ${...} sequence within the given value is replaced
- * with the value of the named parser variable. The replacement is not
- * done if the named variable does not exist.
+ * Performs variable replacement on the given string value. Each
+ * ${...} sequence within the given value is replaced with
+ * the value of the named parser variable. The replacement is not done if
+ * the named variable does not exist.
*
- * @param value original value
+ * @param value
+ * original value
* @return value after variable replacements
- * @throws ConfigurationException if the replacement of a referenced
- * variable is not found
+ * @throws ConfigurationException
+ * if the replacement of a referenced variable is not found
*/
protected String replaceVariables(String value)
throws ConfigurationException {
@@ -174,20 +182,21 @@
}
/**
- * Parses the given XML document and returns the DOM root element.
- * A custom entity resolver is used to make the included configuration
- * file DTD available using the specified public identifiers.
+ * Parses the given XML document and returns the DOM root element. A custom
+ * entity resolver is used to make the included configuration file DTD
+ * available using the specified public identifiers.
*
* @see ConfigurationEntityResolver
- * @param xml xml document
+ * @param xml
+ * xml document
* @return root element
- * @throws ConfigurationException if the configuration document could
- * not be read or parsed
+ * @throws ConfigurationException
+ * if the configuration document could not be read or parsed
*/
protected Element parseXML(InputSource xml) throws ConfigurationException {
try {
- DocumentBuilderFactory factory =
- DocumentBuilderFactory.newInstance();
+ DocumentBuilderFactory factory = DocumentBuilderFactory
+ .newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setEntityResolver(new ConfigurationEntityResolver());
Document document = builder.parse(xml);
@@ -207,11 +216,14 @@
/**
* Returns the named child of the given parent element.
*
- * @param parent parent element
- * @param name name of the child element
+ * @param parent
+ * parent element
+ * @param name
+ * name of the child element
* @return named child element
* @throws ConfigurationException
- * @throws ConfigurationException if the child element is not found
+ * @throws ConfigurationException
+ * if the child element is not found
*/
protected Element getElement(Element parent, String name)
throws ConfigurationException {
@@ -221,13 +233,17 @@
/**
* Returns the named child of the given parent element.
*
- * @param parent parent element
- * @param name name of the child element
- * @param required indicates if the child element is required
+ * @param parent
+ * parent element
+ * @param name
+ * name of the child element
+ * @param required
+ * indicates if the child element is required
* @return named child element, or null if not found and
* required is false.
- * @throws ConfigurationException if the child element is not found and
- * required is true.
+ * @throws ConfigurationException
+ * if the child element is not found and required
+ * is true.
*/
protected Element getElement(Element parent, String name, boolean required)
throws ConfigurationException {
@@ -240,9 +256,8 @@
}
}
if (required) {
- throw new ConfigurationException(
- "Configuration element " + name + " not found in "
- + parent.getNodeName() + ".");
+ throw new ConfigurationException("Configuration element " + name
+ + " not found in " + parent.getNodeName() + ".");
} else {
return null;
}
@@ -251,10 +266,13 @@
/**
* Returns the value of the named attribute of the given element.
*
- * @param element element
- * @param name attribute name
+ * @param element
+ * element
+ * @param name
+ * attribute name
* @return attribute value
- * @throws ConfigurationException if the attribute is not found
+ * @throws ConfigurationException
+ * if the attribute is not found
*/
protected String getAttribute(Element element, String name)
throws ConfigurationException {
@@ -262,19 +280,21 @@
if (attribute != null) {
return attribute.getValue();
} else {
- throw new ConfigurationException(
- "Configuration attribute " + name + " not found in "
- + element.getNodeName() + ".");
+ throw new ConfigurationException("Configuration attribute " + name
+ + " not found in " + element.getNodeName() + ".");
}
}
/**
- * Returns the value of the named attribute of the given element.
- * If the attribute is not found, then the given default value is returned.
+ * Returns the value of the named attribute of the given element. If the
+ * attribute is not found, then the given default value is returned.
*
- * @param element element
- * @param name attribute name
- * @param def default value
+ * @param element
+ * element
+ * @param name
+ * attribute name
+ * @param def
+ * default value
* @return attribute value, or the default value
*/
protected String getAttribute(Element element, String name, String def) {
@@ -285,5 +305,4 @@
return def;
}
}
-
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/FileSystemConfig.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/FileSystemConfig.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/FileSystemConfig.java (working copy)
@@ -20,26 +20,28 @@
import org.apache.jackrabbit.core.fs.FileSystemException;
/**
- * File system configuration. This bean configuration class
- * is used to create a configured file system object.
+ * File system configuration. This bean configuration class is used to create a
+ * configured file system object.
*/
public class FileSystemConfig extends BeanConfig {
/**
* Creates a file system configuration object.
*
- * @param config file system implementation class configuration
+ * @param config
+ * file system implementation class configuration
*/
public FileSystemConfig(BeanConfig config) {
super(config);
}
/**
- * Instantiates and initializes the configured file system
- * implementation class.
+ * Instantiates and initializes the configured file system implementation
+ * class.
*
* @return new initialized file system instance.
- * @throws ConfigurationException on file system initialization errors
+ * @throws ConfigurationException
+ * on file system initialization errors
*/
public FileSystem createFileSystem() throws ConfigurationException {
try {
@@ -49,7 +51,7 @@
} catch (ClassCastException e) {
throw new ConfigurationException(
"Invalid file system implementation class "
- + getClassName() + ".", e);
+ + getClassName() + ".", e);
} catch (FileSystemException e) {
throw new ConfigurationException(
"File system initialization failure.", e);
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/JournalConfig.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/JournalConfig.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/JournalConfig.java (working copy)
@@ -17,21 +17,21 @@
package org.apache.jackrabbit.core.config;
/**
- * Journal configuration. This bean configuration class
- * is used to create configured journal.
+ * Journal configuration. This bean configuration class is used to create
+ * configured journal.
*
- * This class is currently only used to assign a static type to - * more generic bean configuration information. + * This class is currently only used to assign a static type to more generic + * bean configuration information. */ public class JournalConfig extends BeanConfig { /** * Creates a journal configuration object from the given bean configuration. * - * @param config bean configuration + * @param config + * bean configuration */ public JournalConfig(BeanConfig config) { super(config); } - } Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java (revision 483957) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java (working copy) @@ -19,21 +19,22 @@ import javax.security.auth.spi.LoginModule; /** - * LoginModule configuration. This bean configuration class is used to - * create login module objects. + * LoginModule configuration. This bean configuration class is used to create + * login module objects. *
- * Login module is an optional configuration that allows to use JackRabbit - * in a non-JAAS environment. + * Login module is an optional configuration that allows to use JackRabbit in a + * non-JAAS environment. * * @see RepositoryConfig#getLoginModuleConfig() */ public class LoginModuleConfig extends BeanConfig { /** - * Creates an access manager configuration object from the - * given bean configuration. + * Creates an access manager configuration object from the given bean + * configuration. * - * @param config bean configuration + * @param config + * bean configuration */ public LoginModuleConfig(BeanConfig config) { super(config); @@ -44,8 +45,9 @@ if (result instanceof LoginModule) { return (LoginModule) result; } else { - throw new ConfigurationException("Invalid login module implementation class " - + getClassName() + "."); + throw new ConfigurationException( + "Invalid login module implementation class " + + getClassName() + "."); } } } Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/PersistenceManagerConfig.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/PersistenceManagerConfig.java (revision 483957) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/PersistenceManagerConfig.java (working copy) @@ -17,24 +17,24 @@ package org.apache.jackrabbit.core.config; /** - * Persistence manager configuration. This bean configuration class - * is used to create configured persistence manager objects. + * Persistence manager configuration. This bean configuration class is used to + * create configured persistence manager objects. *
- * This class is currently only used to assign a static type to - * more generic bean configuration information. + * This class is currently only used to assign a static type to more generic + * bean configuration information. * * @see WorkspaceConfig#getPersistenceManagerConfig() */ public class PersistenceManagerConfig extends BeanConfig { /** - * Creates a persistence manager configuration object from the - * given bean configuration. + * Creates a persistence manager configuration object from the given bean + * configuration. * - * @param config bean configuration + * @param config + * bean configuration */ public PersistenceManagerConfig(BeanConfig config) { super(config); } - } Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java (revision 483957) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java (working copy) @@ -16,21 +16,6 @@ */ package org.apache.jackrabbit.core.config; -import org.apache.jackrabbit.core.fs.FileSystem; -import org.apache.jackrabbit.core.fs.FileSystemException; -import org.apache.jackrabbit.core.fs.FileSystemPathUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Element; -import org.xml.sax.InputSource; - -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; @@ -47,16 +32,31 @@ import java.util.Map; import java.util.Properties; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.jackrabbit.core.fs.FileSystem; +import org.apache.jackrabbit.core.fs.FileSystemException; +import org.apache.jackrabbit.core.fs.FileSystemPathUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; + /** - * Repository configuration. This configuration class is used to - * create configured repository objects. + * Repository configuration. This configuration class is used to create + * configured repository objects. *
- * The contained configuration information are: the home directory and name - * of the repository, the access manager, file system and versioning - * configuration, repository index configuration, the workspace directory, - * the default workspace name, and the workspace configuration template. In - * addition the workspace configuration object keeps track of all configured - * workspaces. + * The contained configuration information are: the home directory and name of + * the repository, the access manager, file system and versioning configuration, + * repository index configuration, the workspace directory, the default + * workspace name, and the workspace configuration template. In addition the + * workspace configuration object keeps track of all configured workspaces. */ public class RepositoryConfig { @@ -68,13 +68,16 @@ /** * Convenience method that wraps the configuration file name into an - * {@link InputSource} and invokes the - * {@link #create(InputSource, String)} method. + * {@link InputSource} and invokes the {@link #create(InputSource, String)} + * method. * - * @param file repository configuration file name - * @param home repository home directory + * @param file + * repository configuration file name + * @param home + * repository home directory * @return repository configuration - * @throws ConfigurationException on configuration errors + * @throws ConfigurationException + * on configuration errors * @see #create(InputSource, String) */ public static RepositoryConfig create(String file, String home) @@ -85,13 +88,16 @@ /** * Convenience method that wraps the configuration URI into an - * {@link InputSource} and invokes the - * {@link #create(InputSource, String)} method. + * {@link InputSource} and invokes the {@link #create(InputSource, String)} + * method. * - * @param uri repository configuration URI - * @param home repository home directory + * @param uri + * repository configuration URI + * @param home + * repository home directory * @return repository configuration - * @throws ConfigurationException on configuration errors + * @throws ConfigurationException + * on configuration errors * @see #create(InputSource, String) */ public static RepositoryConfig create(URI uri, String home) @@ -101,13 +107,16 @@ /** * Convenience method that wraps the configuration input stream into an - * {@link InputSource} and invokes the - * {@link #create(InputSource, String)} method. + * {@link InputSource} and invokes the {@link #create(InputSource, String)} + * method. * - * @param input repository configuration input stream - * @param home repository home directory + * @param input + * repository configuration input stream + * @param home + * repository home directory * @return repository configuration - * @throws ConfigurationException on configuration errors + * @throws ConfigurationException + * on configuration errors * @see #create(InputSource, String) */ public static RepositoryConfig create(InputStream input, String home) @@ -116,27 +125,30 @@ } /** - * Parses the given repository configuration document and returns the - * parsed and initialized repository configuration. The given repository - * home directory path will be used as the ${rep.home} parser variable. + * Parses the given repository configuration document and returns the parsed + * and initialized repository configuration. The given repository home + * directory path will be used as the ${rep.home} parser variable. *
* Note that in addition to parsing the repository configuration, this * method also initializes the configuration (creates the configured - * directories, etc.). The {@link ConfigurationParser} class should be - * used directly to just parse the configuration. + * directories, etc.). The {@link ConfigurationParser} class should be used + * directly to just parse the configuration. * - * @param xml repository configuration document - * @param home repository home directory + * @param xml + * repository configuration document + * @param home + * repository home directory * @return repository configuration - * @throws ConfigurationException on configuration errors + * @throws ConfigurationException + * on configuration errors */ public static RepositoryConfig create(InputSource xml, String home) throws ConfigurationException { Properties variables = new Properties(); variables.setProperty( RepositoryConfigurationParser.REPOSITORY_HOME_VARIABLE, home); - RepositoryConfigurationParser parser = - new RepositoryConfigurationParser(variables); + RepositoryConfigurationParser parser = new RepositoryConfigurationParser( + variables); RepositoryConfig config = parser.parseRepositoryConfig(xml); config.init(); @@ -185,8 +197,8 @@ private final String workspaceDirectory; /** - * Path to workspace configuration root directory within the - * repository file system or null if none was specified. + * Path to workspace configuration root directory within the repository file + * system or null if none was specified. */ private final String workspaceConfigDirectory; @@ -220,24 +232,38 @@ /** * Creates a repository configuration object. * - * @param template workspace configuration template - * @param home repository home directory - * @param sec the security configuration - * @param fsc file system configuration - * @param workspaceDirectory workspace root directory - * @param workspaceConfigDirectory optional workspace configuration directory - * @param workspaceMaxIdleTime maximum workspace idle time in seconds - * @param defaultWorkspace name of the default workspace - * @param vc versioning configuration - * @param sc search configuration for system search manager. - * @param cc optional cluster configuration - * @param parser configuration parser + * @param template + * workspace configuration template + * @param home + * repository home directory + * @param sec + * the security configuration + * @param fsc + * file system configuration + * @param workspaceDirectory + * workspace root directory + * @param workspaceConfigDirectory + * optional workspace configuration directory + * @param workspaceMaxIdleTime + * maximum workspace idle time in seconds + * @param defaultWorkspace + * name of the default workspace + * @param vc + * versioning configuration + * @param sc + * search configuration for system search manager. + * @param cc + * optional cluster configuration + * @param parser + * configuration parser */ - public RepositoryConfig(String home, SecurityConfig sec, FileSystemConfig fsc, - String workspaceDirectory, String workspaceConfigDirectory, - String defaultWorkspace, int workspaceMaxIdleTime, - Element template, VersioningConfig vc, SearchConfig sc, - ClusterConfig cc, RepositoryConfigurationParser parser) { + // TODO: refactor - more than 7 parameters + public RepositoryConfig(String home, SecurityConfig sec, + FileSystemConfig fsc, String workspaceDirectory, + String workspaceConfigDirectory, String defaultWorkspace, + int workspaceMaxIdleTime, Element template, VersioningConfig vc, + SearchConfig sc, ClusterConfig cc, + RepositoryConfigurationParser parser) { workspaces = new HashMap(); this.home = home; this.sec = sec; @@ -257,9 +283,10 @@ * Initializes the repository configuration. This method loads the * configurations for all available workspaces. * - * @throws ConfigurationException on initialization errors - * @throws IllegalStateException if the repository configuration has already - * been initialized + * @throws ConfigurationException + * on initialization errors + * @throws IllegalStateException + * if the repository configuration has already been initialized */ public void init() throws ConfigurationException, IllegalStateException { if (!workspaces.isEmpty()) { @@ -283,7 +310,8 @@ if (!fs.exists(workspaceConfigDirectory)) { fs.createFolder(workspaceConfigDirectory); } else { - String[] dirNames = fs.listFolders(workspaceConfigDirectory); + String[] dirNames = fs + .listFolders(workspaceConfigDirectory); for (int i = 0; i < dirNames.length; i++) { String configDir = workspaceConfigDirectory + FileSystem.SEPARATOR + dirNames[i]; @@ -296,8 +324,8 @@ } } catch (FileSystemException e) { throw new ConfigurationException( - "error while loading workspace configurations from path " - + workspaceConfigDirectory, e); + "error while loading workspace configurations from " + + "path " + workspaceConfigDirectory, e); } finally { try { fs.close(); @@ -310,7 +338,8 @@ File[] files = directory.listFiles(); if (files == null) { throw new ConfigurationException( - "Invalid workspace root directory: " + workspaceDirectory); + "Invalid workspace root directory: " + + workspaceDirectory); } for (int i = 0; i < files.length; i++) { @@ -337,14 +366,16 @@ * workspace configuration object. The returned configuration object has not * been initialized. *
- * This method returns null, if the given directory does
- * not exist or does not contain a workspace configuration file. If an
- * invalid configuration file is found, then a
+ * This method returns null, if the given directory does not
+ * exist or does not contain a workspace configuration file. If an invalid
+ * configuration file is found, then a
* {@link ConfigurationException ConfigurationException} is thrown.
*
- * @param directory physical workspace configuration directory on disk
+ * @param directory
+ * physical workspace configuration directory on disk
* @return workspace configuration
- * @throws ConfigurationException if the workspace configuration is invalid
+ * @throws ConfigurationException
+ * if the workspace configuration is invalid
*/
private WorkspaceConfig loadWorkspaceConfig(File directory)
throws ConfigurationException {
@@ -357,8 +388,8 @@
variables.setProperty(
RepositoryConfigurationParser.WORKSPACE_HOME_VARIABLE,
directory.getPath());
- RepositoryConfigurationParser localParser =
- parser.createSubParser(variables);
+ RepositoryConfigurationParser localParser = parser
+ .createSubParser(variables);
return localParser.parseWorkspaceConfig(xml);
} catch (FileNotFoundException e) {
return null;
@@ -372,21 +403,25 @@
* and returned as a workspace configuration object. The returned
* configuration object has not been initialized.
*
- * This method returns null, if the given directory does
- * not exist or does not contain a workspace configuration file. If an
- * invalid configuration file is found, then a
+ * This method returns null, if the given directory does not
+ * exist or does not contain a workspace configuration file. If an invalid
+ * configuration file is found, then a
* {@link ConfigurationException ConfigurationException} is thrown.
*
- * @param fs virtual file system where to look for the configuration file
- * @param configDir workspace configuration directory in virtual file system
+ * @param fs
+ * virtual file system where to look for the configuration file
+ * @param configDir
+ * workspace configuration directory in virtual file system
* @return workspace configuration
- * @throws ConfigurationException if the workspace configuration is invalid
+ * @throws ConfigurationException
+ * if the workspace configuration is invalid
*/
private WorkspaceConfig loadWorkspaceConfig(FileSystem fs, String configDir)
throws ConfigurationException {
Reader configReader = null;
try {
- String configPath = configDir + FileSystem.SEPARATOR + WORKSPACE_XML;
+ String configPath = configDir + FileSystem.SEPARATOR
+ + WORKSPACE_XML;
if (!fs.exists(configPath)) {
// no configuration file in this directory
return null;
@@ -397,8 +432,8 @@
xml.setSystemId(configPath);
// the physical workspace home directory (TODO encode name?)
- File homeDir = new File(
- workspaceDirectory, FileSystemPathUtil.getName(configDir));
+ File homeDir = new File(workspaceDirectory, FileSystemPathUtil
+ .getName(configDir));
if (!homeDir.exists()) {
homeDir.mkdir();
}
@@ -406,11 +441,12 @@
variables.setProperty(
RepositoryConfigurationParser.WORKSPACE_HOME_VARIABLE,
homeDir.getPath());
- RepositoryConfigurationParser localParser =
- parser.createSubParser(variables);
+ RepositoryConfigurationParser localParser = parser
+ .createSubParser(variables);
return localParser.parseWorkspaceConfig(xml);
} catch (FileSystemException e) {
- throw new ConfigurationException("Failed to load workspace configuration", e);
+ throw new ConfigurationException(
+ "Failed to load workspace configuration", e);
} finally {
if (configReader != null) {
try {
@@ -424,9 +460,10 @@
/**
* Adds the given workspace configuration to the repository.
*
- * @param wc workspace configuration
- * @throws ConfigurationException if a workspace with the same name
- * already exists
+ * @param wc
+ * workspace configuration
+ * @throws ConfigurationException
+ * if a workspace with the same name already exists
*/
private void addWorkspaceConfig(WorkspaceConfig wc)
throws ConfigurationException {
@@ -455,9 +492,8 @@
* @throws ConfigurationException if creating the workspace configuration
* failed
*/
- private synchronized WorkspaceConfig internalCreateWorkspaceConfig(String name,
- Element template)
- throws ConfigurationException {
+ private synchronized WorkspaceConfig internalCreateWorkspaceConfig(
+ String name, Element template) throws ConfigurationException {
// The physical workspace home directory on disk (TODO encode name?)
File directory = new File(workspaceDirectory, name);
@@ -494,16 +530,17 @@
// on disk
String configDir = workspaceConfigDirectory
+ FileSystem.SEPARATOR + name;
- String configFile = configDir + FileSystem.SEPARATOR + WORKSPACE_XML;
+ String configFile = configDir + FileSystem.SEPARATOR
+ + WORKSPACE_XML;
try {
// Create the directory
virtualFS.createFolder(configDir);
- configWriter = new OutputStreamWriter(
- virtualFS.getOutputStream(configFile));
+ configWriter = new OutputStreamWriter(virtualFS
+ .getOutputStream(configFile));
} catch (FileSystemException e) {
throw new ConfigurationException(
"failed to create workspace configuration at path "
- + configFile, e);
+ + configFile, e);
}
} else {
File file = new File(directory, WORKSPACE_XML);
@@ -512,11 +549,12 @@
} catch (IOException e) {
throw new ConfigurationException(
"failed to create workspace configuration at path "
- + file.getPath(), e);
+ + file.getPath(), e);
}
}
- // Create the workspace.xml file using the configuration template and
+ // Create the workspace.xml file using the configuration template
+ // and
// the configuration writer.
try {
template.setAttribute("name", name);
@@ -524,8 +562,8 @@
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.transform(
- new DOMSource(template), new StreamResult(configWriter));
+ transformer.transform(new DOMSource(template),
+ new StreamResult(configWriter));
} catch (TransformerConfigurationException e) {
throw new ConfigurationException(
"Cannot create a workspace configuration writer", e);
@@ -553,8 +591,8 @@
return wc;
} else {
throw new ConfigurationException(
- "Failed to load the created configuration for workspace "
- + name + ".");
+ "Failed to load the created configuration for "
+ + "workspace " + name + ".");
}
} finally {
try {
@@ -567,17 +605,17 @@
}
/**
- * Creates a new workspace configuration with the specified name.
- * This method creates a workspace configuration subdirectory,
- * copies the workspace configuration template into it, and finally
- * adds the created workspace configuration to the repository.
- * The initialized workspace configuration object is returned to
- * the caller.
+ * Creates a new workspace configuration with the specified name. This
+ * method creates a workspace configuration subdirectory, copies the
+ * workspace configuration template into it, and finally adds the created
+ * workspace configuration to the repository. The initialized workspace
+ * configuration object is returned to the caller.
*
- * @param name workspace name
+ * @param name
+ * workspace name
* @return created workspace configuration
- * @throws ConfigurationException if creating the workspace configuration
- * failed
+ * @throws ConfigurationException
+ * if creating the workspace configuration failed
*/
public WorkspaceConfig createWorkspaceConfig(String name)
throws ConfigurationException {
@@ -589,23 +627,22 @@
* Creates a new workspace configuration with the specified name. This
* method uses the provided workspace template to create the
* repository config instead of the template that is present in the
- * repository configuration.
- *
null if the named
* workspace does not exist
*/
@@ -726,8 +764,8 @@
}
/**
- * Returns the system search index configuration. Returns
- * null if no search index has been configured.
+ * Returns the system search index configuration. Returns null
+ * if no search index has been configured.
*
* @return search index configuration, or null
*/
@@ -736,8 +774,8 @@
}
/**
- * Returns the cluster configuration. Returns null if clustering
- * has not been configured.
+ * Returns the cluster configuration. Returns null if
+ * clustering has not been configured.
*/
public ClusterConfig getClusterConfig() {
return cc;
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java (working copy)
@@ -29,17 +29,19 @@
* workspace configuration files.
* * The following code sample outlines the usage of this class: + * *
- * Properties variables = ...; // parser variables - * RepositoryConfigurationParser parser = - * new RepositoryConfigurationParser(variables); - * RepositoryConfig rc = parser.parseRepositoryConfig(...); - * WorkspaceConfig wc = parser.parseWorkspaceConfig(...); + * Properties variables = ...; // parser variables + * RepositoryConfigurationParser parser = + * new RepositoryConfigurationParser(variables); + * RepositoryConfig rc = parser.parseRepositoryConfig(...); + * WorkspaceConfig wc = parser.parseWorkspaceConfig(...); *+ * *
* Note that the configuration objects returned by this parser are not - * initialized. The caller needs to initialize the configuration objects - * before using them. + * initialized. The caller needs to initialize the configuration objects before + * using them. */ public class RepositoryConfigurationParser extends ConfigurationParser { @@ -80,8 +82,8 @@ public static final String JOURNAL_ELEMENT = "Journal"; /** Name of the persistence manager configuration element. */ - public static final String PERSISTENCE_MANAGER_ELEMENT = - "PersistenceManager"; + public static final String PERSISTENCE_MANAGER_ELEMENT = "Persistence" + + "Manager"; /** Name of the search index configuration element. */ public static final String SEARCH_INDEX_ELEMENT = "SearchIndex"; @@ -99,8 +101,7 @@ public static final String MAX_IDLE_TIME_ATTRIBUTE = "maxIdleTime"; /** Name of the default workspace configuration attribute. */ - public static final String DEFAULT_WORKSPACE_ATTRIBUTE = - "defaultWorkspace"; + public static final String DEFAULT_WORKSPACE_ATTRIBUTE = "defaultWorkspace"; /** Name of the id configuration attribute. */ public static final String ID_ATTRIBUTE = "id"; @@ -109,13 +110,14 @@ public static final String SYNC_DELAY_ATTRIBUTE = "syncDelay"; /** Name of the default search index implementation class. */ - public static final String DEFAULT_QUERY_HANDLER = - "org.apache.jackrabbit.core.query.lucene.SearchIndex"; + public static final String DEFAULT_QUERY_HANDLER = "org.apache.jackrabbit" + + ".core.query.lucene.SearchIndex"; /** * Creates a new configuration parser with the given parser variables. * - * @param variables parser variables + * @param variables + * parser variables */ public RepositoryConfigurationParser(Properties variables) { super(variables); @@ -124,49 +126,53 @@ /** * Parses repository configuration. Repository configuration uses the * following format: + * *
- * <Repository>
- * <FileSystem ...>
- * <Security appName="...">
- * <AccessManager ...>
- * <LoginModule ... (optional)>
- * </Security>
- * <Workspaces rootPath="..." defaultWorkspace="..."/>
- * <Workspace ...>
- * <Versioning ...>
- * </Repository>
+ * <Repository>
+ * <FileSystem ...>
+ * <Security appName="...">
+ * <AccessManager ...>
+ * <LoginModule ... (optional)>
+ * </Security>
+ * <Workspaces rootPath="..."
+ * defaultWorkspace="..."/>
+ * <Workspace ...>
+ * <Versioning ...>
+ * </Repository>
*
+ *
*
* The FileSystem element is a
- * {@link #parseBeanConfig(Element,String) bean configuration} element,
- * that specifies the file system implementation for storing global
- * repository information. The Security element contains
- * an AccessManager bean configuration element and the
- * JAAS name of the repository application. The Workspaces
- * element contains general workspace parameters, and the
- * Workspace element is a template for the individual
- * workspace configuration files. The Versioning element
- * contains
- * {@link #parseVersioningConfig(Element) versioning configuration} for
- * the repository.
+ * {@link #parseBeanConfig(Element,String) bean configuration} element, that
+ * specifies the file system implementation for storing global repository
+ * information. The Security element contains an
+ * AccessManager bean configuration element and the JAAS name
+ * of the repository application. The Workspaces element
+ * contains general workspace parameters, and the Workspace
+ * element is a template for the individual workspace configuration files.
+ * The Versioning element contains
+ * {@link #parseVersioningConfig(Element) versioning configuration} for the
+ * repository.
*
* In addition to the configured information, the returned repository * configuration object also contains the repository home directory path - * that is given as the ${rep.home} parser variable. Note that the - * variable must be available for the configuration document to - * be correctly parsed. + * that is given as the ${rep.home} parser variable. Note that the variable + * must be available for the configuration document to be + * correctly parsed. *
- * {@link #replaceVariables(String) Variable replacement} is performed - * on the security application name attribute, the general workspace - * configuration attributes, and on the file system, access manager, - * and versioning configuration information. + * {@link #replaceVariables(String) Variable replacement} is performed on + * the security application name attribute, the general workspace + * configuration attributes, and on the file system, access manager, and + * versioning configuration information. *
* Note that the returned repository configuration object has not been * initialized. * - * @param xml repository configuration document + * @param xml + * repository configuration document * @return repository configuration - * @throws ConfigurationException if the configuration is broken + * @throws ConfigurationException + * if the configuration is broken * @see #parseBeanConfig(Element, String) * @see #parseVersioningConfig(Element) */ @@ -178,8 +184,8 @@ String home = getVariables().getProperty(REPOSITORY_HOME_VARIABLE); // File system implementation - FileSystemConfig fsc = - new FileSystemConfig(parseBeanConfig(root, FILE_SYSTEM_ELEMENT)); + FileSystemConfig fsc = new FileSystemConfig(parseBeanConfig(root, + FILE_SYSTEM_ELEMENT)); // Security configuration and access manager implementation Element security = getElement(root, SECURITY_ELEMENT); @@ -187,17 +193,17 @@ // General workspace configuration Element workspaces = getElement(root, WORKSPACES_ELEMENT); - String workspaceDirectory = replaceVariables( - getAttribute(workspaces, ROOT_PATH_ATTRIBUTE)); + String workspaceDirectory = replaceVariables(getAttribute(workspaces, + ROOT_PATH_ATTRIBUTE)); - String workspaceConfigDirectory = - getAttribute(workspaces, CONFIG_ROOT_PATH_ATTRIBUTE, null); + String workspaceConfigDirectory = getAttribute(workspaces, + CONFIG_ROOT_PATH_ATTRIBUTE, null); - String defaultWorkspace = replaceVariables( - getAttribute(workspaces, DEFAULT_WORKSPACE_ATTRIBUTE)); + String defaultWorkspace = replaceVariables(getAttribute(workspaces, + DEFAULT_WORKSPACE_ATTRIBUTE)); - int maxIdleTime = Integer.parseInt( - getAttribute(workspaces, MAX_IDLE_TIME_ATTRIBUTE, "0")); + int maxIdleTime = Integer.parseInt(getAttribute(workspaces, + MAX_IDLE_TIME_ATTRIBUTE, "0")); // Workspace configuration template Element template = getElement(root, WORKSPACE_ELEMENT); @@ -217,24 +223,26 @@ } /** - * Parses security configuration. Security configuration - * uses the following format: + * Parses security configuration. Security configuration uses the following + * format: + * *
- * <Security appName="...">
- * <AccessManager ...>
- * <LoginModule ... (optional)>
- * </Security>
+ * <Security appName="...">
+ * <AccessManager ...>
+ * <LoginModule ... (optional)>
+ * </Security>
*
- *
- * Both the AccessManager and LoginModule
+ *
+ * Both the AccessManager and LoginModule
* elements are {@link #parseBeanConfig(Element,String) bean configuration}
- * elements.
- *
- * The login module is an optional feature of repository configuration.
+ * elements. The login module is an optional feature of repository
+ * configuration.
*
- * @param security the <security> element.
+ * @param security
+ * the <security> element.
* @return the security configuration.
- * @throws ConfigurationException if the configuration is broken
+ * @throws ConfigurationException
+ * if the configuration is broken
*/
public SecurityConfig parseSecurityConfig(Element security)
throws ConfigurationException {
@@ -247,22 +255,26 @@
/**
* Parses the access manager configuration.
*
- * @param security the <security> element.
+ * @param security
+ * the <security> element.
* @return the access manager configuration.
- * @throws ConfigurationException if the configuration is broken
+ * @throws ConfigurationException
+ * if the configuration is broken
*/
public AccessManagerConfig parseAccessManagerConfig(Element security)
throws ConfigurationException {
- return new AccessManagerConfig(
- parseBeanConfig(security, ACCESS_MANAGER_ELEMENT));
+ return new AccessManagerConfig(parseBeanConfig(security,
+ ACCESS_MANAGER_ELEMENT));
}
/**
* Parses the login module configuration.
*
- * @param security the <security> element.
+ * @param security
+ * the <security> element.
* @return the login module configuration.
- * @throws ConfigurationException if the configuration is broken
+ * @throws ConfigurationException
+ * if the configuration is broken
*/
public LoginModuleConfig parseLoginModuleConfig(Element security)
throws ConfigurationException {
@@ -270,7 +282,8 @@
Element loginModule = getElement(security, LOGIN_MODULE_ELEMENT, false);
if (loginModule != null) {
- return new LoginModuleConfig(parseBeanConfig(security, LOGIN_MODULE_ELEMENT));
+ return new LoginModuleConfig(parseBeanConfig(security,
+ LOGIN_MODULE_ELEMENT));
} else {
return null;
}
@@ -279,30 +292,32 @@
/**
* Parses workspace configuration. Workspace configuration uses the
* following format:
+ *
*
- * <Workspace name="...">
- * <FileSystem ...>
- * <PersistenceManager ...>
- * <SearchIndex ...>
- * </Workspace>
+ * <Workspace name="...">
+ * <FileSystem ...>
+ * <PersistenceManager ...>
+ * <SearchIndex ...>
+ * </Workspace>
*
+ *
*
* All the child elements (FileSystem,
* PersistenceManager, and SearchIndex) are
- * {@link #parseBeanConfig(Element,String) bean configuration} elements.
- * In addition to bean configuration, the
+ * {@link #parseBeanConfig(Element,String) bean configuration} elements. In
+ * addition to bean configuration, the
* {@link #parseSearchConfig(Element) search element} also contains
* configuration for the search file system.
*
* In addition to the configured information, the returned workspace - * configuration object also contains the workspace home directory path - * that is given as the ${wsp.home} parser variable. Note that the - * variable must be available for the configuration document to - * be correctly parsed. + * configuration object also contains the workspace home directory path that + * is given as the ${wsp.home} parser variable. Note that the variable + * must be available for the configuration document to be + * correctly parsed. *
* Variable replacement is performed on the optional workspace name - * attribute. If the name is not given, then the name of the workspace - * home directory is used as the workspace name. Once the name has been + * attribute. If the name is not given, then the name of the workspace home + * directory is used as the workspace name. Once the name has been * determined, it will be added as the ${wsp.name} variable in a temporary * configuration parser that is used to parse the contained configuration * elements. @@ -313,9 +328,11 @@ * Note that the returned workspace configuration object has not been * initialized. * - * @param xml workspace configuration document + * @param xml + * workspace configuration document * @return workspace configuration - * @throws ConfigurationException if the configuration is broken + * @throws ConfigurationException + * if the configuration is broken * @see #parseBeanConfig(Element, String) * @see #parseSearchConfig(Element) */ @@ -327,8 +344,8 @@ String home = getVariables().getProperty(WORKSPACE_HOME_VARIABLE); // Workspace name - String name = - getAttribute(root, NAME_ATTRIBUTE, new File(home).getName()); + String name = getAttribute(root, NAME_ATTRIBUTE, new File(home) + .getName()); // Create a temporary parser that contains the ${wsp.name} variable Properties tmpVariables = (Properties) getVariables().clone(); @@ -336,11 +353,12 @@ RepositoryConfigurationParser tmpParser = createSubParser(tmpVariables); // File system implementation - FileSystemConfig fsc = new FileSystemConfig( - tmpParser.parseBeanConfig(root, FILE_SYSTEM_ELEMENT)); + FileSystemConfig fsc = new FileSystemConfig(tmpParser.parseBeanConfig( + root, FILE_SYSTEM_ELEMENT)); // Persistence manager implementation - PersistenceManagerConfig pmc = tmpParser.parsePersistenceManagerConfig(root); + PersistenceManagerConfig pmc = tmpParser + .parsePersistenceManagerConfig(root); // Search implementation (optional) SearchConfig sc = tmpParser.parseSearchConfig(root); @@ -349,31 +367,31 @@ } /** - * Parses search index configuration. Search index configuration - * uses the following format: + * Parses search index configuration. Search index configuration uses the + * following format: + * *
- * <SearchIndex class="...">
- * <param name="..." value="...">
- * ...
- * <FileSystem ...>
- * </Search>
+ * <SearchIndex class="...">
+ * <param name="..." value="...">
+ * ...
+ * <FileSystem ...>
+ * </Search>
*
- *
- * Both the SearchIndex and FileSystem
+ *
+ * Both the SearchIndex and FileSystem
* elements are {@link #parseBeanConfig(Element,String) bean configuration}
- * elements. If the search implementation class is not given, then
- * a default implementation is used.
- *
- * The search index is an optional feature of workspace configuration.
- * If the search configuration element is not found, then this method
- * returns null.
- *
- * The FileSystem element in a search index configuration is optional.
- * However some implementations may require a FileSystem.
+ * elements. If the search implementation class is not given, then a default
+ * implementation is used. The search index is an optional feature of
+ * workspace configuration. If the search configuration element is not
+ * found, then this method returns null. The FileSystem
+ * element in a search index configuration is optional. However some
+ * implementations may require a FileSystem.
*
- * @param parent parent of the SearchIndex element
+ * @param parent
+ * parent of the SearchIndex element
* @return search configuration, or null
- * @throws ConfigurationException if the configuration is broken
+ * @throws ConfigurationException
+ * if the configuration is broken
*/
protected SearchConfig parseSearchConfig(Element parent)
throws ConfigurationException {
@@ -385,8 +403,8 @@
Element element = (Element) child;
// Search implementation class
- String className = getAttribute(
- element, CLASS_ATTRIBUTE, DEFAULT_QUERY_HANDLER);
+ String className = getAttribute(element, CLASS_ATTRIBUTE,
+ DEFAULT_QUERY_HANDLER);
// Search parameters
Properties parameters = parseParameters(element);
@@ -394,8 +412,8 @@
// Optional file system implementation
FileSystemConfig fsc = null;
if (getElement(element, FILE_SYSTEM_ELEMENT, false) != null) {
- fsc = new FileSystemConfig(
- parseBeanConfig(element, FILE_SYSTEM_ELEMENT));
+ fsc = new FileSystemConfig(parseBeanConfig(element,
+ FILE_SYSTEM_ELEMENT));
}
return new SearchConfig(className, parameters, fsc);
@@ -407,34 +425,38 @@
/**
* Parses versioning configuration. Versioning configuration uses the
* following format:
+ *
*
- * <Versioning rootPath="...">
- * <FileSystem ...>
- * <PersistenceManager ...>
- * </Versioning>
+ * <Versioning rootPath="...">
+ * <FileSystem ...>
+ * <PersistenceManager ...>
+ * </Versioning>
*
+ *
*
* Both the FileSystem and PersistenceManager
* elements are {@link #parseBeanConfig(Element,String) bean configuration}
* elements. In addition to the bean parameter values,
- * {@link #replaceVariables(String) variable replacement} is performed
- * also on the versioning root path attribute.
+ * {@link #replaceVariables(String) variable replacement} is performed also
+ * on the versioning root path attribute.
*
- * @param parent parent of the Versioning element
+ * @param parent
+ * parent of the Versioning element
* @return versioning configuration
- * @throws ConfigurationException if the configuration is broken
+ * @throws ConfigurationException
+ * if the configuration is broken
*/
protected VersioningConfig parseVersioningConfig(Element parent)
throws ConfigurationException {
Element element = getElement(parent, VERSIONING_ELEMENT);
// Versioning home directory
- String home =
- replaceVariables(getAttribute(element, ROOT_PATH_ATTRIBUTE));
+ String home = replaceVariables(getAttribute(element,
+ ROOT_PATH_ATTRIBUTE));
// File system implementation
- FileSystemConfig fsc = new FileSystemConfig(
- parseBeanConfig(element, FILE_SYSTEM_ELEMENT));
+ FileSystemConfig fsc = new FileSystemConfig(parseBeanConfig(element,
+ FILE_SYSTEM_ELEMENT));
// Persistence manager implementation
PersistenceManagerConfig pmc = parsePersistenceManagerConfig(element);
@@ -443,22 +465,25 @@
}
/**
- * Parses cluster configuration. Cluster configuration uses the following format:
+ * Parses cluster configuration. Cluster configuration uses the following
+ * format:
+ *
*
- * <Cluster>
- * <Journal ...>
- * </Journal>
+ * <Cluster>
+ * <Journal ...>
+ * </Journal>
*
- *
- * Cluster is a {@link #parseBeanConfig(Element,String) bean configuration}
- * element.
- *
- * Clustering is an optional feature. If the cluster element is not found, then this
- * method returns null.
*
- * @param parent parent of the Journal element
+ * Cluster is a
+ * {@link #parseBeanConfig(Element,String) bean configuration} element.
+ * Clustering is an optional feature. If the cluster element is not found,
+ * then this method returns null.
+ *
+ * @param parent
+ * parent of the Journal element
* @return journal configuration, or null
- * @throws ConfigurationException if the configuration is broken
+ * @throws ConfigurationException
+ * if the configuration is broken
*/
protected ClusterConfig parseClusterConfig(Element parent)
throws ConfigurationException {
@@ -471,8 +496,8 @@
Element element = (Element) child;
String id = getAttribute(element, ID_ATTRIBUTE, null);
- int syncDelay = Integer.parseInt(
- getAttribute(element, SYNC_DELAY_ATTRIBUTE, "5"));
+ int syncDelay = Integer.parseInt(getAttribute(element,
+ SYNC_DELAY_ATTRIBUTE, "5"));
JournalConfig jc = parseJournalConfig(element);
return new ClusterConfig(id, syncDelay, jc);
@@ -482,53 +507,59 @@
}
/**
- * Parses journal configuration. Journal configuration uses the following format:
+ * Parses journal configuration. Journal configuration uses the following
+ * format:
+ *
*
- * <Journal class="...">
- * <param name="..." value="...">
- * ...
- * </Journal>
+ * <Journal class="...">
+ * <param name="..." value="...">
+ * ...
+ * </Journal>
*
- *
- * Journal is a {@link #parseBeanConfig(Element,String) bean configuration}
- * element.
*
- * @param cluster parent cluster element
+ * Journal is a
+ * {@link #parseBeanConfig(Element,String) bean configuration} element.
+ *
+ * @param cluster
+ * parent cluster element
* @return journal configuration, or null
- * @throws ConfigurationException if the configuration is broken
+ * @throws ConfigurationException
+ * if the configuration is broken
*/
protected JournalConfig parseJournalConfig(Element cluster)
throws ConfigurationException {
- return new JournalConfig(
- parseBeanConfig(cluster, JOURNAL_ELEMENT));
+ return new JournalConfig(parseBeanConfig(cluster, JOURNAL_ELEMENT));
}
/**
* Parses the PersistenceManager config.
*
- * @param parent parent of the PersistenceManager element
+ * @param parent
+ * parent of the PersistenceManager element
* @return persistence manager configuration
- * @throws ConfigurationException if the configuration is broken
+ * @throws ConfigurationException
+ * if the configuration is broken
*/
protected PersistenceManagerConfig parsePersistenceManagerConfig(
Element parent) throws ConfigurationException {
- return new PersistenceManagerConfig(
- parseBeanConfig(parent, PERSISTENCE_MANAGER_ELEMENT));
+ return new PersistenceManagerConfig(parseBeanConfig(parent,
+ PERSISTENCE_MANAGER_ELEMENT));
}
/**
* Creates a new instance of a configuration parser but with overlayed
* variables.
*
- * @param variables the variables overlay
+ * @param variables
+ * the variables overlay
* @return a new configuration parser instance
*/
- protected RepositoryConfigurationParser createSubParser(Properties variables) {
+ protected RepositoryConfigurationParser createSubParser(
+ Properties variables) {
// overlay the properties
Properties props = new Properties(getVariables());
props.putAll(variables);
return new RepositoryConfigurationParser(props);
}
-
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java (working copy)
@@ -19,12 +19,11 @@
import java.util.Properties;
/**
- * Search index configuration. This bean configuration class
- * is used to create configured search index objects.
+ * Search index configuration. This bean configuration class is used to create
+ * configured search index objects.
*
- * In addition to generic bean configuration information, this
- * class also contains an optional file system configuration
- * used by the search index.
+ * In addition to generic bean configuration information, this class also
+ * contains an optional file system configuration used by the search index.
*
* @see WorkspaceConfig#getSearchConfig()
*/
@@ -39,13 +38,16 @@
/**
* Creates a search index configuration object.
*
- * @param className search index implementation class
- * @param properties search index properties
- * @param fsc search index file system configuration, or null
- * if none is configured.
+ * @param className
+ * search index implementation class
+ * @param properties
+ * search index properties
+ * @param fsc
+ * search index file system configuration, or null
+ * if none is configured.
*/
- public SearchConfig(
- String className, Properties properties, FileSystemConfig fsc) {
+ public SearchConfig(String className, Properties properties,
+ FileSystemConfig fsc) {
super(className, properties);
this.fsc = fsc;
}
@@ -61,9 +63,11 @@
/**
* Returns the configuration for the FileSystem or
- * null if none is configured in this SearchConfig.
+ * null if none is configured in this
+ * SearchConfig.
*
- * @return the FileSystemConfig for this SearchConfig.
+ * @return the FileSystemConfig for this
+ * SearchConfig.
*/
public FileSystemConfig getFileSystemConfig() {
return fsc;
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java (working copy)
@@ -40,20 +40,23 @@
/**
* Creates a new security configuration.
*
- * @param name repository name for a JAAS app-entry configuration
- * @param amc access manager configuration
- * @param lmc login module configuration (can be null)
+ * @param name
+ * repository name for a JAAS app-entry configuration
+ * @param amc
+ * access manager configuration
+ * @param lmc
+ * login module configuration (can be null)
*/
- public SecurityConfig(
- String name, AccessManagerConfig amc, LoginModuleConfig lmc) {
+ public SecurityConfig(String name, AccessManagerConfig amc,
+ LoginModuleConfig lmc) {
this.name = name;
this.amc = amc;
this.lmc = lmc;
}
/**
- * Returns the repository name. The repository name can be used for
- * JAAS app-entry configuration.
+ * Returns the repository name. The repository name can be used for JAAS
+ * app-entry configuration.
*
* @return repository name
*/
@@ -79,5 +82,4 @@
public LoginModuleConfig getLoginModuleConfig() {
return lmc;
}
-
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/VersioningConfig.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/VersioningConfig.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/VersioningConfig.java (working copy)
@@ -19,12 +19,11 @@
import java.io.File;
/**
- * Versioning configuration. This configuration class is used to
- * create configured versioning objects.
+ * Versioning configuration. This configuration class is used to create
+ * configured versioning objects.
*
- * The contained configuration information are: the home directory,
- * the file system implementation, and the persistence manager
- * implementation.
+ * The contained configuration information are: the home directory, the file
+ * system implementation, and the persistence manager implementation.
*
* @see RepositoryConfig#getVersioningConfig()
*/
@@ -48,12 +47,15 @@
/**
* Creates a versioning configuration object.
*
- * @param home home directory
- * @param fsc file system configuration
- * @param pmc persistence manager configuration
+ * @param home
+ * home directory
+ * @param fsc
+ * file system configuration
+ * @param pmc
+ * persistence manager configuration
*/
- public VersioningConfig(
- String home, FileSystemConfig fsc, PersistenceManagerConfig pmc) {
+ public VersioningConfig(String home, FileSystemConfig fsc,
+ PersistenceManagerConfig pmc) {
this.home = home;
this.fsc = fsc;
this.pmc = pmc;
@@ -71,7 +73,8 @@
/**
* Returns the configuration for the FileSystem.
*
- * @return the FileSystemConfig for this VersionConfig.
+ * @return the FileSystemConfig for this
+ * VersionConfig.
*/
public FileSystemConfig getFileSystemConfig() {
return fsc;
@@ -85,5 +88,4 @@
public PersistenceManagerConfig getPersistenceManagerConfig() {
return pmc;
}
-
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java (working copy)
@@ -17,12 +17,12 @@
package org.apache.jackrabbit.core.config;
/**
- * Workspace configuration. This configuration class is used to
- * create configured workspace objects.
+ * Workspace configuration. This configuration class is used to create
+ * configured workspace objects.
*
- * The contained configuration information are: the home directory and name
- * of the workspace, and the file system, the persistence manager, and the
- * search index configuration. The search index is an optional part of the
+ * The contained configuration information are: the home directory and name of
+ * the workspace, and the file system, the persistence manager, and the search
+ * index configuration. The search index is an optional part of the
* configuration.
*/
public class WorkspaceConfig {
@@ -55,11 +55,16 @@
/**
* Creates a workspace configuration object.
*
- * @param home home directory
- * @param name workspace name
- * @param fsc file system configuration
- * @param pmc persistence manager configuration
- * @param sc search index configuration
+ * @param home
+ * home directory
+ * @param name
+ * workspace name
+ * @param fsc
+ * file system configuration
+ * @param pmc
+ * persistence manager configuration
+ * @param sc
+ * search index configuration
*/
public WorkspaceConfig(String home, String name, FileSystemConfig fsc,
PersistenceManagerConfig pmc, SearchConfig sc) {
@@ -115,5 +120,4 @@
public SearchConfig getSearchConfig() {
return sc;
}
-
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/BasedFileSystem.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/BasedFileSystem.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/BasedFileSystem.java (working copy)
@@ -31,8 +31,11 @@
/**
* Creates a new BasedFileSystem
*
- * @param fsBase the FileSystem the new file system should be based on
- * @param relRootPath the root path relative to fsBase's root
+ * @param fsBase
+ * the FileSystem the new file system should be
+ * based on
+ * @param relRootPath
+ * the root path relative to fsBase's root
*/
public BasedFileSystem(FileSystem fsBase, String relRootPath) {
if (fsBase == null) {
@@ -68,7 +71,7 @@
}
}
- //-----------------------------------------------------------< FileSystem >
+ // -----------------------------------------------------------< FileSystem >
/**
* {@inheritDoc}
*/
@@ -89,7 +92,8 @@
/**
* {@inheritDoc}
*/
- public void copy(String srcPath, String destPath) throws FileSystemException {
+ public void copy(String srcPath, String destPath)
+ throws FileSystemException {
fsBase.copy(buildBasePath(srcPath), buildBasePath(destPath));
}
@@ -124,14 +128,16 @@
/**
* {@inheritDoc}
*/
- public InputStream getInputStream(String filePath) throws FileSystemException {
+ public InputStream getInputStream(String filePath)
+ throws FileSystemException {
return fsBase.getInputStream(buildBasePath(filePath));
}
/**
* {@inheritDoc}
*/
- public OutputStream getOutputStream(String filePath) throws FileSystemException {
+ public OutputStream getOutputStream(String filePath)
+ throws FileSystemException {
return fsBase.getOutputStream(buildBasePath(filePath));
}
@@ -209,7 +215,8 @@
/**
* {@inheritDoc}
*/
- public void move(String srcPath, String destPath) throws FileSystemException {
+ public void move(String srcPath, String destPath)
+ throws FileSystemException {
fsBase.move(buildBasePath(srcPath), buildBasePath(destPath));
}
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java (working copy)
@@ -16,18 +16,9 @@
*/
package org.apache.jackrabbit.core.fs.db;
-import org.apache.jackrabbit.core.fs.FileSystem;
-import org.apache.jackrabbit.core.fs.FileSystemException;
-import org.apache.jackrabbit.core.fs.FileSystemPathUtil;
-import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
-import org.apache.jackrabbit.util.Text;
-import org.apache.jackrabbit.util.TransientFileFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.jcr.RepositoryException;
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilterInputStream;
import java.io.FilterOutputStream;
@@ -35,7 +26,6 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
-import java.io.FileInputStream;
import java.io.RandomAccessFile;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
@@ -44,9 +34,20 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
-import java.util.HashMap;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.core.fs.FileSystem;
+import org.apache.jackrabbit.core.fs.FileSystemException;
+import org.apache.jackrabbit.core.fs.FileSystemPathUtil;
+import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
+import org.apache.jackrabbit.util.Text;
+import org.apache.jackrabbit.util.TransientFileFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Base class for database file systems. This class contains common
* functionality for database file system subclasses that normally differ only
@@ -70,6 +71,7 @@
protected boolean initialized;
protected String schema;
+
protected String schemaObjectPrefix;
// initial size of buffer used to serialize objects
@@ -86,22 +88,39 @@
// SQL statements
protected String selectExistSQL;
+
protected String selectFileExistSQL;
+
protected String selectFolderExistSQL;
+
protected String selectChildCountSQL;
+
protected String selectDataSQL;
+
protected String selectLastModifiedSQL;
+
protected String selectLengthSQL;
+
protected String selectFileNamesSQL;
+
protected String selectFolderNamesSQL;
+
protected String selectFileAndFolderNamesSQL;
+
protected String deleteFileSQL;
+
protected String deleteFolderSQL;
+
protected String insertFileSQL;
+
protected String insertFolderSQL;
+
protected String updateDataSQL;
+
protected String updateLastModifiedSQL;
+
protected String copyFileSQL;
+
protected String copyFilesSQL;
/**
@@ -113,7 +132,7 @@
initialized = false;
}
- //----------------------------------------------------< setters & getters >
+ // ----------------------------------------------------< setters & getters >
public String getSchemaObjectPrefix() {
return schemaObjectPrefix;
}
@@ -131,7 +150,7 @@
this.schema = schema;
}
- //-------------------------------------------< java.lang.Object overrides >
+ // -------------------------------------------< java.lang.Object overrides >
/**
* {@inheritDoc}
*/
@@ -141,8 +160,11 @@
}
if (obj instanceof DatabaseFileSystem) {
DatabaseFileSystem other = (DatabaseFileSystem) obj;
- if (((schema != null) ? schema.equals(other.schema) : other.schema == null)
- && ((schemaObjectPrefix != null) ? schemaObjectPrefix.equals(other.schemaObjectPrefix) : other.schemaObjectPrefix == null)) {
+ if (((schema != null) ? schema.equals(other.schema)
+ : other.schema == null)
+ && ((schemaObjectPrefix != null) ? schemaObjectPrefix
+ .equals(other.schemaObjectPrefix)
+ : other.schemaObjectPrefix == null)) {
return true;
}
}
@@ -150,8 +172,8 @@
}
/**
- * Returns zero to satisfy the Object equals/hashCode contract.
- * This class is mutable and not meant to be used as a hash key.
+ * Returns zero to satisfy the Object equals/hashCode contract. This class
+ * is mutable and not meant to be used as a hash key.
*
* @return always zero
* @see Object#hashCode()
@@ -160,7 +182,7 @@
return 0;
}
- //-----------------------------------------------------------< FileSystem >
+ // -----------------------------------------------------------< FileSystem >
/**
* {@inheritDoc}
@@ -174,7 +196,8 @@
// setup jdbc connection
initConnection();
- // make sure schemaObjectPrefix consists of legal name characters only
+ // make sure schemaObjectPrefix consists of legal name characters
+ // only
prepareSchemaObjectPrefix();
// check if schema objects exist and create them if necessary
@@ -207,7 +230,8 @@
try {
// close shared prepared statements
- for (Iterator it = preparedStatements.values().iterator(); it.hasNext(); ) {
+ for (Iterator it = preparedStatements.values().iterator(); it
+ .hasNext();) {
closeStatement((PreparedStatement) it.next());
}
preparedStatements.clear();
@@ -236,7 +260,8 @@
if (!exists(folderPath)) {
createDeepFolder(folderPath);
} else {
- throw new FileSystemException("file system entry already exists: " + folderPath);
+ throw new FileSystemException("file system entry already exists: "
+ + folderPath);
}
}
@@ -256,8 +281,8 @@
int count = 0;
synchronized (deleteFileSQL) {
try {
- Statement stmt = executeStmt(
- deleteFileSQL, new Object[]{parentDir, name});
+ Statement stmt = executeStmt(deleteFileSQL, new Object[] {
+ parentDir, name});
count = stmt.getUpdateCount();
} catch (SQLException e) {
String msg = "failed to delete file: " + filePath;
@@ -291,10 +316,8 @@
int count = 0;
synchronized (deleteFolderSQL) {
try {
- Statement stmt = executeStmt(deleteFolderSQL, new Object[]{
- parentDir,
- name,
- folderPath,
+ Statement stmt = executeStmt(deleteFolderSQL, new Object[] {
+ parentDir, name, folderPath,
folderPath + FileSystem.SEPARATOR + "%"});
count = stmt.getUpdateCount();
} catch (SQLException e) {
@@ -325,15 +348,16 @@
synchronized (selectExistSQL) {
ResultSet rs = null;
try {
- Statement stmt = executeStmt(
- selectExistSQL, new Object[]{parentDir, name});
+ Statement stmt = executeStmt(selectExistSQL, new Object[] {
+ parentDir, name});
rs = stmt.getResultSet();
// a file system entry exists if the result set
// has at least one entry
return rs.next();
} catch (SQLException e) {
- String msg = "failed to check existence of file system entry: " + path;
+ String msg = "failed to check existence of file system entry: "
+ + path;
log.error(msg, e);
throw new FileSystemException(msg, e);
} finally {
@@ -358,8 +382,8 @@
synchronized (selectFileExistSQL) {
ResultSet rs = null;
try {
- Statement stmt = executeStmt(
- selectFileExistSQL, new Object[]{parentDir, name});
+ Statement stmt = executeStmt(selectFileExistSQL, new Object[] {
+ parentDir, name});
rs = stmt.getResultSet();
// a file exists if the result set has at least one entry
@@ -390,8 +414,8 @@
synchronized (selectFolderExistSQL) {
ResultSet rs = null;
try {
- Statement stmt = executeStmt(
- selectFolderExistSQL, new Object[]{parentDir, name});
+ Statement stmt = executeStmt(selectFolderExistSQL,
+ new Object[] {parentDir, name});
rs = stmt.getResultSet();
// a folder exists if the result set has at least one entry
@@ -422,15 +446,17 @@
synchronized (selectLastModifiedSQL) {
ResultSet rs = null;
try {
- Statement stmt = executeStmt(
- selectLastModifiedSQL, new Object[]{parentDir, name});
+ Statement stmt = executeStmt(selectLastModifiedSQL,
+ new Object[] {parentDir, name});
rs = stmt.getResultSet();
if (!rs.next()) {
- throw new FileSystemException("no such file system entry: " + path);
+ throw new FileSystemException("no such file system entry: "
+ + path);
}
return rs.getLong(1);
} catch (SQLException e) {
- String msg = "failed to determine lastModified of file system entry: " + path;
+ String msg = "failed to determine lastModified of file system "
+ + "entry: " + path;
log.error(msg, e);
throw new FileSystemException(msg, e);
} finally {
@@ -455,8 +481,8 @@
synchronized (selectLengthSQL) {
ResultSet rs = null;
try {
- Statement stmt = executeStmt(
- selectLengthSQL, new Object[]{parentDir, name});
+ Statement stmt = executeStmt(selectLengthSQL, new Object[] {
+ parentDir, name});
rs = stmt.getResultSet();
if (!rs.next()) {
throw new FileSystemException("no such file: " + filePath);
@@ -489,7 +515,8 @@
synchronized (selectChildCountSQL) {
ResultSet rs = null;
try {
- Statement stmt = executeStmt(selectChildCountSQL, new Object[]{path});
+ Statement stmt = executeStmt(selectChildCountSQL,
+ new Object[] {path});
rs = stmt.getResultSet();
if (!rs.next()) {
return false;
@@ -501,7 +528,8 @@
}
return (count > 0);
} catch (SQLException e) {
- String msg = "failed to determine child count of file system entry: " + path;
+ String msg = "failed to determine child count of file system "
+ + "entry: " + path;
log.error(msg, e);
throw new FileSystemException(msg, e);
} finally {
@@ -527,8 +555,8 @@
synchronized (selectFileAndFolderNamesSQL) {
ResultSet rs = null;
try {
- Statement stmt = executeStmt(
- selectFileAndFolderNamesSQL, new Object[]{folderPath});
+ Statement stmt = executeStmt(selectFileAndFolderNamesSQL,
+ new Object[] {folderPath});
rs = stmt.getResultSet();
ArrayList names = new ArrayList();
while (rs.next()) {
@@ -542,7 +570,8 @@
}
return (String[]) names.toArray(new String[names.size()]);
} catch (SQLException e) {
- String msg = "failed to list child entries of folder: " + folderPath;
+ String msg = "failed to list child entries of folder: "
+ + folderPath;
log.error(msg, e);
throw new FileSystemException(msg, e);
} finally {
@@ -568,8 +597,8 @@
synchronized (selectFileNamesSQL) {
ResultSet rs = null;
try {
- Statement stmt = executeStmt(
- selectFileNamesSQL, new Object[]{folderPath});
+ Statement stmt = executeStmt(selectFileNamesSQL,
+ new Object[] {folderPath});
rs = stmt.getResultSet();
ArrayList names = new ArrayList();
while (rs.next()) {
@@ -577,7 +606,8 @@
}
return (String[]) names.toArray(new String[names.size()]);
} catch (SQLException e) {
- String msg = "failed to list file entries of folder: " + folderPath;
+ String msg = "failed to list file entries of folder: "
+ + folderPath;
log.error(msg, e);
throw new FileSystemException(msg, e);
} finally {
@@ -603,8 +633,8 @@
synchronized (selectFolderNamesSQL) {
ResultSet rs = null;
try {
- Statement stmt = executeStmt(
- selectFolderNamesSQL, new Object[]{folderPath});
+ Statement stmt = executeStmt(selectFolderNamesSQL,
+ new Object[] {folderPath});
rs = stmt.getResultSet();
ArrayList names = new ArrayList();
while (rs.next()) {
@@ -618,7 +648,8 @@
}
return (String[]) names.toArray(new String[names.size()]);
} catch (SQLException e) {
- String msg = "failed to list folder entries of folder: " + folderPath;
+ String msg = "failed to list folder entries of folder: "
+ + folderPath;
log.error(msg, e);
throw new FileSystemException(msg, e);
} finally {
@@ -643,10 +674,9 @@
int count = 0;
synchronized (updateLastModifiedSQL) {
try {
- Statement stmt = executeStmt(updateLastModifiedSQL, new Object[]{
- new Long(System.currentTimeMillis()),
- parentDir,
- name});
+ Statement stmt = executeStmt(updateLastModifiedSQL,
+ new Object[] {new Long(System.currentTimeMillis()),
+ parentDir, name});
count = stmt.getUpdateCount();
} catch (SQLException e) {
String msg = "failed to touch file: " + filePath;
@@ -663,7 +693,8 @@
/**
* {@inheritDoc}
*/
- public InputStream getInputStream(String filePath) throws FileSystemException {
+ public InputStream getInputStream(String filePath)
+ throws FileSystemException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
@@ -675,8 +706,8 @@
synchronized (selectDataSQL) {
try {
- Statement stmt = executeStmt(
- selectDataSQL, new Object[]{parentDir, name});
+ Statement stmt = executeStmt(selectDataSQL, new Object[] {
+ parentDir, name});
final ResultSet rs = stmt.getResultSet();
if (!rs.next()) {
@@ -684,8 +715,8 @@
}
InputStream in = rs.getBinaryStream(1);
/**
- * return an InputStream wrapper in order to
- * close the ResultSet when the stream is closed
+ * return an InputStream wrapper in order to close the ResultSet
+ * when the stream is closed
*/
return new FilterInputStream(in) {
public void close() throws IOException {
@@ -725,8 +756,10 @@
}
try {
- TransientFileFactory fileFactory = TransientFileFactory.getInstance();
- final File tmpFile = fileFactory.createTransientFile("bin", null, null);
+ TransientFileFactory fileFactory = TransientFileFactory
+ .getInstance();
+ final File tmpFile = fileFactory.createTransientFile("bin", null,
+ null);
return new FilterOutputStream(new FileOutputStream(tmpFile)) {
@@ -739,27 +772,20 @@
synchronized (updateDataSQL) {
long length = tmpFile.length();
in = new FileInputStream(tmpFile);
- executeStmt(updateDataSQL,
- new Object[]{
- new SizedInputStream(in, length),
- new Long(System.currentTimeMillis()),
- new Long(length),
- parentDir,
- name
- });
+ executeStmt(updateDataSQL, new Object[] {
+ new SizedInputStream(in, length),
+ new Long(System.currentTimeMillis()),
+ new Long(length), parentDir, name});
}
} else {
synchronized (insertFileSQL) {
long length = tmpFile.length();
in = new FileInputStream(tmpFile);
- executeStmt(insertFileSQL,
- new Object[]{
- parentDir,
- name,
- new SizedInputStream(in, length),
- new Long(System.currentTimeMillis()),
- new Long(length)
- });
+ executeStmt(insertFileSQL, new Object[] {
+ parentDir, name,
+ new SizedInputStream(in, length),
+ new Long(System.currentTimeMillis()),
+ new Long(length)});
}
}
@@ -784,8 +810,9 @@
/**
* {@inheritDoc}
*/
- public RandomAccessOutputStream getRandomAccessOutputStream(final String filePath)
- throws FileSystemException, UnsupportedOperationException {
+ public RandomAccessOutputStream getRandomAccessOutputStream(
+ final String filePath) throws FileSystemException,
+ UnsupportedOperationException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
@@ -804,8 +831,10 @@
}
try {
- TransientFileFactory fileFactory = TransientFileFactory.getInstance();
- final File tmpFile = fileFactory.createTransientFile("bin", null, null);
+ TransientFileFactory fileFactory = TransientFileFactory
+ .getInstance();
+ final File tmpFile = fileFactory.createTransientFile("bin", null,
+ null);
// @todo FIXME use java.sql.Blob
@@ -826,8 +855,8 @@
}
return new RandomAccessOutputStream() {
- private final RandomAccessFile raf =
- new RandomAccessFile(tmpFile, "rw");
+ private final RandomAccessFile raf = new RandomAccessFile(
+ tmpFile, "rw");
public void close() throws IOException {
raf.close();
@@ -838,27 +867,20 @@
synchronized (updateDataSQL) {
long length = tmpFile.length();
in = new FileInputStream(tmpFile);
- executeStmt(updateDataSQL,
- new Object[]{
- new SizedInputStream(in, length),
- new Long(System.currentTimeMillis()),
- new Long(length),
- parentDir,
- name
- });
+ executeStmt(updateDataSQL, new Object[] {
+ new SizedInputStream(in, length),
+ new Long(System.currentTimeMillis()),
+ new Long(length), parentDir, name});
}
} else {
synchronized (insertFileSQL) {
long length = tmpFile.length();
in = new FileInputStream(tmpFile);
- executeStmt(insertFileSQL,
- new Object[]{
- parentDir,
- name,
- new SizedInputStream(in, length),
- new Long(System.currentTimeMillis()),
- new Long(length)
- });
+ executeStmt(insertFileSQL, new Object[] {
+ parentDir, name,
+ new SizedInputStream(in, length),
+ new Long(System.currentTimeMillis()),
+ new Long(length)});
}
}
@@ -881,7 +903,7 @@
raf.write(b);
}
- public void flush() /*throws IOException*/ {
+ public void flush() /* throws IOException */ {
// nop
}
@@ -889,7 +911,8 @@
raf.write(b);
}
- public void write(byte[] b, int off, int len) throws IOException {
+ public void write(byte[] b, int off, int len)
+ throws IOException {
raf.write(b, off, len);
}
};
@@ -903,7 +926,8 @@
/**
* {@inheritDoc}
*/
- public void copy(String srcPath, String destPath) throws FileSystemException {
+ public void copy(String srcPath, String destPath)
+ throws FileSystemException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
@@ -923,7 +947,8 @@
/**
* {@inheritDoc}
*/
- public void move(String srcPath, String destPath) throws FileSystemException {
+ public void move(String srcPath, String destPath)
+ throws FileSystemException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
@@ -940,17 +965,18 @@
}
}
- //----------------------------------< misc. helper methods & overridables >
+ // ----------------------------------< misc. helper methods & overridables >
/**
* Initializes the database connection used by this file system.
*
- * Subclasses should normally override the {@link #getConnection()}
- * method instead of this one. The default implementation calls
- * {@link #getConnection()} to get the database connection and disables
- * the autocommit feature.
+ * Subclasses should normally override the {@link #getConnection()} method
+ * instead of this one. The default implementation calls
+ * {@link #getConnection()} to get the database connection and disables the
+ * autocommit feature.
*
- * @throws Exception if an error occurs
+ * @throws Exception
+ * if an error occurs
*/
protected void initConnection() throws Exception {
con = getConnection();
@@ -961,15 +987,16 @@
* Abstract factory method for creating a new database connection. This
* method is called by {@link #initConnection()} when the file system is
* started. The returned connection should come with the default JDBC
- * settings, as the {@link #initConnection()} method will explicitly set
- * the autoCommit and other properties as needed.
+ * settings, as the {@link #initConnection()} method will explicitly set the
+ * autoCommit and other properties as needed.
*
* Note that the returned database connection is kept during the entire - * lifetime of the file system, after which it is closed by - * {@link #close()} using the {@link #closeConnection(Connection)} method. + * lifetime of the file system, after which it is closed by {@link #close()} + * using the {@link #closeConnection(Connection)} method. * * @return new connection - * @throws Exception if an error occurs + * @throws Exception + * if an error occurs */ protected Connection getConnection() throws Exception { throw new UnsupportedOperationException("Override in a subclass!"); @@ -981,11 +1008,13 @@ * {@link #getConnection()} when the file system was started. *
* The default implementation just calls the {@link Connection#close()}
- * method of the given connection, but subclasses can override this
- * method to provide more extensive database and connection cleanup.
+ * method of the given connection, but subclasses can override this method
+ * to provide more extensive database and connection cleanup.
*
- * @param connection database connection
- * @throws SQLException if an error occurs
+ * @param connection
+ * database connection
+ * @throws SQLException
+ * if an error occurs
*/
protected void closeConnection(Connection connection) throws SQLException {
connection.close();
@@ -1004,7 +1033,8 @@
// gracefully in order to avoid potential memory leaks
// close shared prepared statements
- for (Iterator it = preparedStatements.values().iterator(); it.hasNext(); ) {
+ for (Iterator it = preparedStatements.values().iterator();
+ it.hasNext();) {
closeStatement((PreparedStatement) it.next());
}
preparedStatements.clear();
@@ -1035,20 +1065,24 @@
}
/**
- * Executes the given SQL statement with the specified parameters.
- * If a SQLException is encountered one attempt is made
- * to re-establish the database connection and re-execute the statement.
+ * Executes the given SQL statement with the specified parameters. If a
+ * SQLException is encountered one attempt is made to
+ * re-establish the database connection and re-execute the statement.
*
- * @param sql statement to execute
- * @param params parameters to set
+ * @param sql
+ * statement to execute
+ * @param params
+ * parameters to set
* @return the Statement object that had been executed
- * @throws SQLException if an error occurs
+ * @throws SQLException
+ * if an error occurs
*/
protected Statement executeStmt(String sql, Object[] params)
throws SQLException {
int trials = 2;
while (true) {
- PreparedStatement stmt = (PreparedStatement) preparedStatements.get(sql);
+ PreparedStatement stmt = (PreparedStatement) preparedStatements
+ .get(sql);
try {
for (int i = 0; i < params.length; i++) {
if (params[i] instanceof SizedInputStream) {
@@ -1066,7 +1100,8 @@
// no more trials, re-throw
throw se;
}
- log.warn("execute failed, about to reconnect...", se.getMessage());
+ log.warn("execute failed, about to reconnect...", se
+ .getMessage());
// try to reconnect
if (reestablishConnection()) {
@@ -1100,7 +1135,8 @@
* characters that are allowed in names on the target database. Illegal
* characters will be escaped as necessary.
*
- * @throws Exception if an error occurs
+ * @throws Exception
+ * if an error occurs
*/
protected void prepareSchemaObjectPrefix() throws Exception {
DatabaseMetaData metaData = con.getMetaData();
@@ -1128,7 +1164,8 @@
* Checks if the required schema objects exist and creates them if they
* don't exist yet.
*
- * @throws Exception if an error occurs
+ * @throws Exception
+ * if an error occurs
*/
protected void checkSchema() throws Exception {
DatabaseMetaData metaData = con.getMetaData();
@@ -1150,11 +1187,13 @@
// read ddl from resources
InputStream in = getClass().getResourceAsStream(schema + ".ddl");
if (in == null) {
- String msg = "Configuration error: unknown schema '" + schema + "'";
+ String msg = "Configuration error: unknown schema '" + schema
+ + "'";
log.debug(msg);
throw new RepositoryException(msg);
}
- BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(in));
Statement stmt = con.createStatement();
try {
String sql = reader.readLine();
@@ -1162,7 +1201,8 @@
// Skip comments and empty lines
if (!sql.startsWith("#") && sql.length() > 0) {
// replace prefix variable
- sql = Text.replace(sql, SCHEMA_OBJECT_PREFIX_VARIABLE, schemaObjectPrefix);
+ sql = Text.replace(sql, SCHEMA_OBJECT_PREFIX_VARIABLE,
+ schemaObjectPrefix);
// execute sql stmt
stmt.executeUpdate(sql);
}
@@ -1180,46 +1220,47 @@
* Builds the SQL statements
*/
protected void buildSQLStatements() {
- insertFileSQL = "insert into "
- + schemaObjectPrefix + "FSENTRY "
+ insertFileSQL = "insert into " + schemaObjectPrefix + "FSENTRY "
+ "(FSENTRY_PATH, FSENTRY_NAME, FSENTRY_DATA, "
+ "FSENTRY_LASTMOD, FSENTRY_LENGTH) "
+ "values (?, ?, ?, ?, ?)";
insertFolderSQL = "insert into "
- + schemaObjectPrefix + "FSENTRY "
- + "(FSENTRY_PATH, FSENTRY_NAME, FSENTRY_LASTMOD, FSENTRY_LENGTH) "
- + "values (?, ?, ?, 0)";
+ + schemaObjectPrefix
+ + "FSENTRY "
+ + "(FSENTRY_PATH, FSENTRY_NAME, FSENTRY_LASTMOD, FSENTRY_LENGTH"
+ + ") values (?, ?, ?, 0)";
updateDataSQL = "update "
- + schemaObjectPrefix + "FSENTRY "
- + "set FSENTRY_DATA = ?, FSENTRY_LASTMOD = ?, FSENTRY_LENGTH = ? "
+ + schemaObjectPrefix
+ + "FSENTRY "
+ + "set FSENTRY_DATA = ?, FSENTRY_LASTMOD = ?, "
+ + "FSENTRY_LENGTH = ? "
+ "where FSENTRY_PATH = ? and FSENTRY_NAME = ? "
+ "and FSENTRY_DATA is not null";
- updateLastModifiedSQL = "update "
- + schemaObjectPrefix + "FSENTRY set FSENTRY_LASTMOD = ? "
+ updateLastModifiedSQL = "update " + schemaObjectPrefix
+ + "FSENTRY set FSENTRY_LASTMOD = ? "
+ "where FSENTRY_PATH = ? and FSENTRY_NAME = ? "
+ "and FSENTRY_DATA is not null";
- selectExistSQL = "select 1 from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
- + "and FSENTRY_NAME = ?";
+ selectExistSQL = "select 1 from " + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? " + "and FSENTRY_NAME = ?";
- selectFileExistSQL = "select 1 from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ selectFileExistSQL = "select 1 from " + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_NAME = ? and FSENTRY_DATA is not null";
- selectFolderExistSQL = "select 1 from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ selectFolderExistSQL = "select 1 from " + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_NAME = ? and FSENTRY_DATA is null";
- selectFileNamesSQL = "select FSENTRY_NAME from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ selectFileNamesSQL = "select FSENTRY_NAME from " + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_DATA is not null";
- selectFolderNamesSQL = "select FSENTRY_NAME from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ selectFolderNamesSQL = "select FSENTRY_NAME from " + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_DATA is null";
selectFileAndFolderNamesSQL = "select FSENTRY_NAME from "
@@ -1228,89 +1269,88 @@
selectChildCountSQL = "select count(FSENTRY_NAME) from "
+ schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? ";
- selectDataSQL = "select FSENTRY_DATA from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ selectDataSQL = "select FSENTRY_DATA from " + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_NAME = ? and FSENTRY_DATA is not null";
selectLastModifiedSQL = "select FSENTRY_LASTMOD from "
+ schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_NAME = ?";
- selectLengthSQL = "select FSENTRY_LENGTH from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ selectLengthSQL = "select FSENTRY_LENGTH from " + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_NAME = ? and FSENTRY_DATA is not null";
- deleteFileSQL = "delete from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ deleteFileSQL = "delete from " + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_NAME = ? and FSENTRY_DATA is not null";
deleteFolderSQL = "delete from "
- + schemaObjectPrefix + "FSENTRY where "
- + "(FSENTRY_PATH = ? and FSENTRY_NAME = ? and FSENTRY_DATA is null) "
- + "or (FSENTRY_PATH = ?) "
- + "or (FSENTRY_PATH like ?) ";
+ + schemaObjectPrefix
+ + "FSENTRY where "
+ + "(FSENTRY_PATH = ? and FSENTRY_NAME = ? "
+ + "and FSENTRY_DATA is null) "
+ + "or (FSENTRY_PATH = ?) " + "or (FSENTRY_PATH like ?) ";
- copyFileSQL = "insert into "
- + schemaObjectPrefix + "FSENTRY "
+ copyFileSQL = "insert into " + schemaObjectPrefix + "FSENTRY "
+ "(FSENTRY_PATH, FSENTRY_NAME, FSENTRY_DATA, "
+ "FSENTRY_LASTMOD, FSENTRY_LENGTH) "
+ "select ?, ?, FSENTRY_DATA, "
- + "FSENTRY_LASTMOD, FSENTRY_LENGTH from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ + "FSENTRY_LASTMOD, FSENTRY_LENGTH from " + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_NAME = ? and FSENTRY_DATA is not null";
- copyFilesSQL = "insert into "
- + schemaObjectPrefix + "FSENTRY "
+ copyFilesSQL = "insert into " + schemaObjectPrefix + "FSENTRY "
+ "(FSENTRY_PATH, FSENTRY_NAME, FSENTRY_DATA, "
+ "FSENTRY_LASTMOD, FSENTRY_LENGTH) "
+ "select ?, FSENTRY_NAME, FSENTRY_DATA, "
- + "FSENTRY_LASTMOD, FSENTRY_LENGTH from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ + "FSENTRY_LASTMOD, FSENTRY_LENGTH from " + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_DATA is not null";
}
/**
* Initializes the map of prepared statements.
*
- * @throws SQLException if an error occurs
+ * @throws SQLException
+ * if an error occurs
*/
protected void initPreparedStatements() throws SQLException {
- preparedStatements.put(
- selectExistSQL, con.prepareStatement(selectExistSQL));
- preparedStatements.put(
- selectFileExistSQL, con.prepareStatement(selectFileExistSQL));
- preparedStatements.put(
- selectFolderExistSQL, con.prepareStatement(selectFolderExistSQL));
- preparedStatements.put(
- selectChildCountSQL, con.prepareStatement(selectChildCountSQL));
- preparedStatements.put(
- selectDataSQL, con.prepareStatement(selectDataSQL));
- preparedStatements.put(
- selectLastModifiedSQL, con.prepareStatement(selectLastModifiedSQL));
- preparedStatements.put(
- selectLengthSQL, con.prepareStatement(selectLengthSQL));
- preparedStatements.put(
- selectFileNamesSQL, con.prepareStatement(selectFileNamesSQL));
- preparedStatements.put(
- selectFolderNamesSQL, con.prepareStatement(selectFolderNamesSQL));
- preparedStatements.put(
- selectFileAndFolderNamesSQL, con.prepareStatement(selectFileAndFolderNamesSQL));
- preparedStatements.put(
- deleteFileSQL, con.prepareStatement(deleteFileSQL));
- preparedStatements.put(
- deleteFolderSQL, con.prepareStatement(deleteFolderSQL));
- preparedStatements.put(
- insertFileSQL, con.prepareStatement(insertFileSQL));
- preparedStatements.put(
- insertFolderSQL, con.prepareStatement(insertFolderSQL));
- preparedStatements.put(
- updateDataSQL, con.prepareStatement(updateDataSQL));
- preparedStatements.put(
- updateLastModifiedSQL, con.prepareStatement(updateLastModifiedSQL));
- preparedStatements.put(
- copyFileSQL, con.prepareStatement(copyFileSQL));
- preparedStatements.put(
- copyFilesSQL, con.prepareStatement(copyFilesSQL));
+ preparedStatements.put(selectExistSQL, con
+ .prepareStatement(selectExistSQL));
+ preparedStatements.put(selectFileExistSQL, con
+ .prepareStatement(selectFileExistSQL));
+ preparedStatements.put(selectFolderExistSQL, con
+ .prepareStatement(selectFolderExistSQL));
+ preparedStatements.put(selectChildCountSQL, con
+ .prepareStatement(selectChildCountSQL));
+ preparedStatements.put(selectDataSQL, con
+ .prepareStatement(selectDataSQL));
+ preparedStatements.put(selectLastModifiedSQL, con
+ .prepareStatement(selectLastModifiedSQL));
+ preparedStatements.put(selectLengthSQL, con
+ .prepareStatement(selectLengthSQL));
+ preparedStatements.put(selectFileNamesSQL, con
+ .prepareStatement(selectFileNamesSQL));
+ preparedStatements.put(selectFolderNamesSQL, con
+ .prepareStatement(selectFolderNamesSQL));
+ preparedStatements.put(selectFileAndFolderNamesSQL, con
+ .prepareStatement(selectFileAndFolderNamesSQL));
+ preparedStatements.put(deleteFileSQL, con
+ .prepareStatement(deleteFileSQL));
+ preparedStatements.put(deleteFolderSQL, con
+ .prepareStatement(deleteFolderSQL));
+ preparedStatements.put(insertFileSQL, con
+ .prepareStatement(insertFileSQL));
+ preparedStatements.put(insertFolderSQL, con
+ .prepareStatement(insertFolderSQL));
+ preparedStatements.put(updateDataSQL, con
+ .prepareStatement(updateDataSQL));
+ preparedStatements.put(updateLastModifiedSQL, con
+ .prepareStatement(updateLastModifiedSQL));
+ preparedStatements.put(copyFileSQL, con.prepareStatement(copyFileSQL));
+ preparedStatements
+ .put(copyFilesSQL, con.prepareStatement(copyFilesSQL));
}
@@ -1318,16 +1358,16 @@
* Verifies that the root file system entry exists. If it doesn't exist yet
* it will be automatically created.
*
- * @throws Exception if an error occurs
+ * @throws Exception
+ * if an error occurs
*/
protected void verifyRootExists() throws Exception {
// check if root file system entry exists
synchronized (selectFolderExistSQL) {
ResultSet rs = null;
try {
- Statement stmt = executeStmt(
- selectFolderExistSQL,
- new Object[]{FileSystem.SEPARATOR, ""});
+ Statement stmt = executeStmt(selectFolderExistSQL,
+ new Object[] {FileSystem.SEPARATOR, ""});
rs = stmt.getResultSet();
if (rs.next()) {
@@ -1335,7 +1375,8 @@
return;
}
} catch (SQLException e) {
- String msg = "failed to check existence of file system root entry";
+ String msg = "failed to check existence of file system root "
+ + "entry";
log.error(msg, e);
throw new FileSystemException(msg, e);
} finally {
@@ -1348,11 +1389,13 @@
}
/**
- * Creates the specified files system folder entry, recursively creating
- * any non-existing intermediate folder entries.
+ * Creates the specified files system folder entry, recursively creating any
+ * non-existing intermediate folder entries.
*
- * @param folderPath folder entry to create
- * @throws FileSystemException if an error occurs
+ * @param folderPath
+ * folder entry to create
+ * @throws FileSystemException
+ * if an error occurs
*/
protected void createDeepFolder(String folderPath)
throws FileSystemException {
@@ -1367,12 +1410,8 @@
synchronized (insertFolderSQL) {
try {
- executeStmt(
- insertFolderSQL,
- new Object[]{
- parentDir,
- name,
- new Long(System.currentTimeMillis())});
+ executeStmt(insertFolderSQL, new Object[] {parentDir, name,
+ new Long(System.currentTimeMillis())});
} catch (SQLException e) {
String msg = "failed to create folder entry: " + folderPath;
log.error(msg, e);
@@ -1384,9 +1423,12 @@
/**
* Recursively copies the given folder to the given destination.
*
- * @param srcPath folder to be copied
- * @param destPath destination path to which the folder is to be copied
- * @throws FileSystemException if an error occurs
+ * @param srcPath
+ * folder to be copied
+ * @param destPath
+ * destination path to which the folder is to be copied
+ * @throws FileSystemException
+ * if an error occurs
*/
protected void copyDeepFolder(String srcPath, String destPath)
throws FileSystemException {
@@ -1398,18 +1440,19 @@
String[] names = listFolders(srcPath);
for (int i = 0; i < names.length; i++) {
- String src = (FileSystemPathUtil.denotesRoot(srcPath)
- ? srcPath + names[i] : srcPath + FileSystem.SEPARATOR + names[i]);
- String dest = (FileSystemPathUtil.denotesRoot(destPath)
- ? destPath + names[i] : destPath + FileSystem.SEPARATOR + names[i]);
+ String src = (FileSystemPathUtil.denotesRoot(srcPath) ? srcPath
+ + names[i] : srcPath + FileSystem.SEPARATOR + names[i]);
+ String dest = (FileSystemPathUtil.denotesRoot(destPath) ? destPath
+ + names[i] : destPath + FileSystem.SEPARATOR + names[i]);
copyDeepFolder(src, dest);
}
synchronized (copyFilesSQL) {
try {
- executeStmt(copyFilesSQL, new Object[]{destPath, srcPath});
+ executeStmt(copyFilesSQL, new Object[] {destPath, srcPath});
} catch (SQLException e) {
- String msg = "failed to copy file entries from " + srcPath + " to " + destPath;
+ String msg = "failed to copy file entries from " + srcPath
+ + " to " + destPath;
log.error(msg, e);
throw new FileSystemException(msg, e);
}
@@ -1422,9 +1465,12 @@
* already. If the destination path refers to an existing file, the file
* will be overwritten.
*
- * @param srcPath file to be copied
- * @param destPath destination path to which the file is to be copied
- * @throws FileSystemException if an error occurs
+ * @param srcPath
+ * file to be copied
+ * @param destPath
+ * destination path to which the file is to be copied
+ * @throws FileSystemException
+ * if an error occurs
*/
protected void copyFile(String srcPath, String destPath)
throws FileSystemException {
@@ -1445,16 +1491,12 @@
int count = 0;
synchronized (copyFileSQL) {
try {
- Statement stmt = executeStmt(
- copyFileSQL,
- new Object[]{
- destParentDir,
- destName,
- srcParentDir,
- srcName});
+ Statement stmt = executeStmt(copyFileSQL, new Object[] {
+ destParentDir, destName, srcParentDir, srcName});
count = stmt.getUpdateCount();
} catch (SQLException e) {
- String msg = "failed to copy file from " + srcPath + " to " + destPath;
+ String msg = "failed to copy file from " + srcPath + " to "
+ + destPath;
log.error(msg, e);
throw new FileSystemException(msg, e);
}
@@ -1466,15 +1508,15 @@
}
/**
- * Resets the given PreparedStatement by clearing the parameters
- * and warnings contained.
- *
PreparedStatement instance on which it
- * operates are thread safe.
+ * Resets the given PreparedStatement by clearing the
+ * parameters and warnings contained. NOTE: This method MUST be called
+ * in a synchronized context as neither this method nor the
+ * PreparedStatement instance on which it operates are thread
+ * safe.
*
- * @param stmt The PreparedStatement to reset. If
- * null this method does nothing.
+ * @param stmt
+ * The PreparedStatement to reset. If
+ * null this method does nothing.
*/
protected void resetStatement(PreparedStatement stmt) {
if (stmt != null) {
@@ -1517,10 +1559,11 @@
}
}
- //--------------------------------------------------------< inner classes >
+ // --------------------------------------------------------< inner classes >
class SizedInputStream extends FilterInputStream {
private final long size;
+
private boolean consumed = false;
SizedInputStream(InputStream in, long size) {
@@ -1546,12 +1589,12 @@
return super.skip(n);
}
- public int read(byte b[]) throws IOException {
+ public int read(byte[] b) throws IOException {
consumed = true;
return super.read(b);
}
- public int read(byte b[], int off, int len) throws IOException {
+ public int read(byte[] b, int off, int len) throws IOException {
consumed = true;
return super.read(b, off, len);
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DB2FileSystem.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DB2FileSystem.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DB2FileSystem.java (working copy)
@@ -18,29 +18,30 @@
/**
* DB2FileSystem is a JDBC-based FileSystem
- * implementation for Jackrabbit that persists file system entries in a
- * DB2 database.
- *
- * It is configured through the following properties:
+ * implementation for Jackrabbit that persists file system entries in a DB2
+ * database. It is configured through the following properties:
* driver: the FQN name of the JDBC driver class
- * (default: "com.ibm.db2.jcc.DB2Driver")schema: type of schema to be used
- * (default: "db2")driver: the FQN name of the JDBC driver class (default:
+ * "com.ibm.db2.jcc.DB2Driver")schema: type of schema to be used (default:
+ * "db2")url: the database url (e.g.
* "jdbc:db2:[database]")user: the database userpassword: the user's passwordschemaObjectPrefix: prefix to be prepended to schema objectsschemaObjectPrefix: prefix to be prepended to schema
+ * objects- * <FileSystem class="org.apache.jackrabbit.core.fs.db.DB2FileSystem"> - * <param name="url" value="jdbc:db2:test"/> - * <param name="schemaObjectPrefix" value="rep_"/> - * </FileSystem> + * <FileSystem + * class="org.apache.jackrabbit.core.fs.db.DB2FileSystem"> + * <param name="url" value="jdbc:db2:test"/> + * <param name="schemaObjectPrefix" + * value="rep_"/> + * </FileSystem> **/ public class DB2FileSystem extends DbFileSystem { @@ -58,33 +59,34 @@ initialized = false; } - //-----------------------------------------< DatabaseFileSystem overrides > + // -----------------------------------------< DatabaseFileSystem overrides > /** - * {@inheritDoc} - * - * Since DB2 requires parameter markers within the select clause to be - * explicitly typed using
cast(? as type_name) some statements
- * had to be changed accordingly.
+ * {@inheritDoc} Since DB2 requires parameter markers within the select
+ * clause to be explicitly typed using cast(? as type_name)
+ * some statements had to be changed accordingly.
*/
protected void buildSQLStatements() {
super.buildSQLStatements();
copyFileSQL = "insert into "
- + schemaObjectPrefix + "FSENTRY "
+ + schemaObjectPrefix
+ + "FSENTRY "
+ "(FSENTRY_PATH, FSENTRY_NAME, FSENTRY_DATA, "
+ "FSENTRY_LASTMOD, FSENTRY_LENGTH) "
- + "select cast(? as varchar(745)), cast(? as varchar(255)), FSENTRY_DATA, "
- + "FSENTRY_LASTMOD, FSENTRY_LENGTH from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ + "select cast(? as varchar(745)), cast(? as varchar(255)), "
+ + "FSENTRY_DATA, FSENTRY_LASTMOD, FSENTRY_LENGTH from "
+ + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_NAME = ? and FSENTRY_DATA is not null";
copyFilesSQL = "insert into "
- + schemaObjectPrefix + "FSENTRY "
+ + schemaObjectPrefix
+ + "FSENTRY "
+ "(FSENTRY_PATH, FSENTRY_NAME, FSENTRY_DATA, "
+ "FSENTRY_LASTMOD, FSENTRY_LENGTH) "
+ "select cast(? as varchar(745)), FSENTRY_NAME, FSENTRY_DATA, "
- + "FSENTRY_LASTMOD, FSENTRY_LENGTH from "
- + schemaObjectPrefix + "FSENTRY where FSENTRY_PATH = ? "
+ + "FSENTRY_LASTMOD, FSENTRY_LENGTH from " + schemaObjectPrefix
+ + "FSENTRY where FSENTRY_PATH = ? "
+ "and FSENTRY_DATA is not null";
}
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java (working copy)
@@ -22,70 +22,96 @@
/**
* DbFileSystem is a generic JDBC-based FileSystem
- * implementation for Jackrabbit that persists file system entries in a
- * database table.
- *
- * It is configured through the following properties:
+ * implementation for Jackrabbit that persists file system entries in a database
+ * table. It is configured through the following properties:
* driver: the FQN name of the JDBC driver classurl: the database url of the form jdbc:subprotocol:subnameurl: the database url of the form
+ * jdbc:subprotocol:subnameuser: the database userpassword: the user's passwordschema: type of schema to be used
- * (e.g. mysql, mssql, etc.); schemaObjectPrefix: prefix to be prepended to schema objectsschema: type of schema to be used (e.g.
+ * mysql, mssql, etc.); schemaObjectPrefix: prefix to be prepended to schema
+ * objectsgetClass().getResourceAsStream(schema + ".ddl").
- * Every line in the specified .ddl file is executed separatly by calling
- * java.sql.Statement.execute(String) where every occurence of the
- * the string "${schemaObjectPrefix}" has been replaced with the
- * value of the property schemaObjectPrefix.
- *
- * The following is a fragment from a sample configuration using MySQL:
+ * resources by calling
+ * getClass().getResourceAsStream(schema + ".ddl"). Every line
+ * in the specified .ddl file is executed separatly by calling
+ * java.sql.Statement.execute(String) where every occurence of
+ * the the string "${schemaObjectPrefix}" has been replaced with
+ * the value of the property schemaObjectPrefix. The
+ * following is a fragment from a sample configuration using MySQL:
+ *
* - * <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> - * <param name="driver" value="com.mysql.jdbc.Driver"/> - * <param name="url" value="jdbc:mysql:///test?autoReconnect=true"/> - * <param name="schema" value="mysql"/> - * <param name="schemaObjectPrefix" value="rep_"/> - * </FileSystem> + * <FileSystem + * class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> + * <param name="driver" + * value="com.mysql.jdbc.Driver"/> + * <param name="url" + * value="jdbc:mysql:///test?autoReconnect=true"/> + * <param name="schema" value="mysql"/> + * <param name="schemaObjectPrefix" + * value="rep_"/> + * </FileSystem> *- * The following is a fragment from a sample configuration using Daffodil One$DB Embedded: + * + * The following is a fragment from a sample configuration using Daffodil One$DB + * Embedded: + * *
- * <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
- * <param name="driver" value="in.co.daffodil.db.jdbc.DaffodilDBDriver"/>
- * <param name="url" value="jdbc:daffodilDB_embedded:rep;path=${rep.home}/databases;create=true"/>
- * <param name="user" value="daffodil"/>
- * <param name="password" value="daffodil"/>
- * <param name="schema" value="daffodil"/>
- * <param name="schemaObjectPrefix" value="rep_"/>
- * </FileSystem>
+ * <FileSystem
+ * class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
+ * <param name="driver"
+ * value="in.co.daffodil.db.jdbc.DaffodilDBDriver"/>
+ * <param name="url"
+ * value="jdbc:daffodilDB_embedded:rep;path=${rep.home}/databases;create=true"/>
+ * <param name="user" value="daffodil"/>
+ * <param name="password" value="daffodil"/>
+ * <param name="schema" value="daffodil"/>
+ * <param name="schemaObjectPrefix"
+ * value="rep_"/>
+ * </FileSystem>
*
+ *
* The following is a fragment from a sample configuration using MSSQL:
+ *
* - * <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> - * <param name="driver" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/> - * <param name="url" value="jdbc:microsoft:sqlserver://localhost:1433;;DatabaseName=test;SelectMethod=Cursor;"/> - * <param name="schema" value="mssql"/> - * <param name="user" value="sa"/> - * <param name="password" value=""/> - * <param name="schemaObjectPrefix" value="rep_"/> - * </FileSystem> + * <FileSystem + * class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> + * <param name="driver" + * value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/> + * <param name="url" + * value="jdbc:microsoft:sqlserver://localhost:1433;;DatabaseName=test;SelectMethod=Cursor;"/> + * <param name="schema" value="mssql"/> + * <param name="user" value="sa"/> + * <param name="password" value=""/> + * <param name="schemaObjectPrefix" + * value="rep_"/> + * </FileSystem> *+ * * The following is a fragment from a sample configuration using PostgreSQL: + * *
- * <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> - * <param name="driver" value="org.postgresql.Driver"/> - * <param name="url" value="jdbc:postgresql://localhost/test"/> - * <param name="schema" value="postgresql"/> - * <param name="user" value="postgres"/> - * <param name="password" value="postgres"/> - * <param name="schemaObjectPrefix" value="rep_"/> - * </FileSystem> + * <FileSystem + * class="org.apache.jackrabbit.core.fs.db.DbFileSystem"> + * <param name="driver" + * value="org.postgresql.Driver"/> + * <param name="url" + * value="jdbc:postgresql://localhost/test"/> + * <param name="schema" value="postgresql"/> + * <param name="user" value="postgres"/> + * <param name="password" value="postgres"/> + * <param name="schemaObjectPrefix" + * value="rep_"/> + * </FileSystem> *- * See also {@link DerbyFileSystem}, {@link DB2FileSystem}, {@link OracleFileSystem}. + * + * See also {@link DerbyFileSystem}, {@link DB2FileSystem}, + * {@link OracleFileSystem}. */ public class DbFileSystem extends DatabaseFileSystem { @@ -109,7 +135,7 @@ */ protected String password; - //----------------------------------------------------< setters & getters > + // ----------------------------------------------------< setters & getters > public String getUrl() { return url; } @@ -142,8 +168,7 @@ this.driver = driver; } - - //-------------------------------------------< java.lang.Object overrides > + // -------------------------------------------< java.lang.Object overrides > /** * {@inheritDoc} */ @@ -153,11 +178,14 @@ } if (obj instanceof DbFileSystem) { DbFileSystem other = (DbFileSystem) obj; - if (((driver != null) ? driver.equals(other.driver) : other.driver == null) - && ((url != null) ? url.equals(other.url) : other.url == null) - && ((user != null) ? user.equals(other.user) : other.user == null) - && ((password != null) ? password.equals(other.password) : other.password == null) - && super.equals(other)) { + if (((driver != null) ? driver.equals(other.driver) + : other.driver == null) + && ((url != null) ? url.equals(other.url) + : other.url == null) + && ((user != null) ? user.equals(other.user) + : other.user == null) + && ((password != null) ? password.equals(other.password) + : other.password == null) && super.equals(other)) { return true; } } @@ -165,8 +193,8 @@ } /** - * Returns zero to satisfy the Object equals/hashCode contract. - * This class is mutable and not meant to be used as a hash key. + * Returns zero to satisfy the Object equals/hashCode contract. This class + * is mutable and not meant to be used as a hash key. * * @return always zero * @see Object#hashCode() @@ -175,14 +203,16 @@ return 0; } - //--------------------------------------------------< DatabaseFileSystem > + // --------------------------------------------------< DatabaseFileSystem > /** * Initialize the JDBC connection. * - * @throws SQLException if an error occurs + * @throws SQLException + * if an error occurs */ - protected Connection getConnection() throws ClassNotFoundException, SQLException { + protected Connection getConnection() throws ClassNotFoundException, + SQLException { Class.forName(driver); return DriverManager.getConnection(url, user, password); } Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystem.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystem.java (revision 483957) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DerbyFileSystem.java (working copy) @@ -16,41 +16,45 @@ */ package org.apache.jackrabbit.core.fs.db; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Connection; - /** *
DerbyFileSystem is a JDBC-based FileSystem
* implementation for Jackrabbit that persists file system entries in an
- * embedded Derby database.
- *
- * It is configured through the following properties:
+ * embedded Derby database. It is configured through the following
+ * properties:
* url: the database url of the form
* "jdbc:derby:[db];[attributes]"schemaObjectPrefix: prefix to be prepended to schema objectsdriver: the FQN name of the JDBC driver class
- * (default: "org.apache.derby.jdbc.EmbeddedDriver")schema: type of schema to be used
- * (default: "derby")schemaObjectPrefix: prefix to be prepended to schema
+ * objectsdriver: the FQN name of the JDBC driver class (default:
+ * "org.apache.derby.jdbc.EmbeddedDriver")schema: type of schema to be used (default:
+ * "derby")user: the database user (default: null)password: the user's password (default: null)shutdownOnClose: if true (the default) the
- * database is shutdown when the last connection is closed;
- * set this to false when using a standalone databasepassword: the user's password (default:
+ * null)shutdownOnClose: if true (the default)
+ * the database is shutdown when the last connection is closed; set this to
+ * false when using a standalone database
- * <FileSystem class="org.apache.jackrabbit.core.fs.db.DerbyFileSystem">
- * <param name="url" value="jdbc:derby:${rep.home}/db;create=true"/>
- * <param name="schemaObjectPrefix" value="rep_"/>
- * </FileSystem>
+ * <FileSystem
+ * class="org.apache.jackrabbit.core.fs.db.DerbyFileSystem">
+ * <param name="url"
+ * value="jdbc:derby:${rep.home}/db;create=true"/>
+ * <param name="schemaObjectPrefix"
+ * value="rep_"/>
+ * </FileSystem>
*
*/
public class DerbyFileSystem extends DbFileSystem {
@@ -76,7 +80,7 @@
initialized = false;
}
- //----------------------------------------------------< setters & getters >
+ // ----------------------------------------------------< setters & getters >
public boolean getShutdownOnClose() {
return shutdownOnClose;
@@ -86,14 +90,16 @@
this.shutdownOnClose = shutdownOnClose;
}
- //-----------------------------------------------< DbFileSystem overrides >
+ // -----------------------------------------------< DbFileSystem overrides >
/**
- * Closes the given connection and shuts down the embedded Derby
- * database if shutdownOnClose is set to true.
+ * Closes the given connection and shuts down the embedded Derby database if
+ * shutdownOnClose is set to true.
*
- * @param connection database connection
- * @throws SQLException if an error occurs
+ * @param connection
+ * database connection
+ * @throws SQLException
+ * if an error occurs
* @see DatabaseFileSystem#closeConnection(Connection)
*/
protected void closeConnection(Connection connection) throws SQLException {
@@ -106,8 +112,10 @@
}
url += ";shutdown=true";
- // we have to reset the connection to 'autoCommit=true' before closing it;
- // otherwise Derby would mysteriously complain about some pending uncommitted
+ // we have to reset the connection to 'autoCommit=true' before closing
+ // it;
+ // otherwise Derby would mysteriously complain about some pending
+ // uncommitted
// changes which can't possibly be true.
// @todo further investigate
connection.setAutoCommit(true);
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/JNDIDatabaseFileSystem.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/JNDIDatabaseFileSystem.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/JNDIDatabaseFileSystem.java (working copy)
@@ -16,21 +16,22 @@
*/
package org.apache.jackrabbit.core.fs.db;
+import java.sql.Connection;
+import java.sql.SQLException;
+
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.SQLException;
/**
- * Database file system that uses JNDI to acquire the database connection.
- * The JNDI location of the {@link DataSource} to be used in given as
- * the dataSourceLocation configuration property. See the
+ * Database file system that uses JNDI to acquire the database connection. The
+ * JNDI location of the {@link DataSource} to be used in given as the
+ * dataSourceLocation configuration property. See the
* {@link DbFileSystem} for more configuration details.
*
- * WARNING: The acquired database connection is kept
- * for the entire lifetime of the file system instance. The configured data
- * source should be prepared for this.
+ * WARNING: The acquired database connection is kept for the
+ * entire lifetime of the file system instance. The configured data source
+ * should be prepared for this.
*/
public class JNDIDatabaseFileSystem extends DatabaseFileSystem {
@@ -39,7 +40,7 @@
*/
private String dataSourceLocation;
- //----------------------------------------------------< setters & getters >
+ // ----------------------------------------------------< setters & getters >
/**
* Returns the JNDI location of the data source.
@@ -53,26 +54,28 @@
/**
* Sets the JNDI location of the data source.
*
- * @param dataSourceLocation data source location
+ * @param dataSourceLocation
+ * data source location
*/
public void setDataSourceLocation(String dataSourceLocation) {
this.dataSourceLocation = dataSourceLocation;
}
- //--------------------------------------------------< DatabaseFileSystem >
+ // --------------------------------------------------< DatabaseFileSystem >
/**
* Returns a JDBC connection from a {@link DataSource} acquired from JNDI
* with the configured data source location.
*
* @return new database connection
- * @throws NamingException if the given data source location does not exist
- * @throws SQLException if a database access error occurs
+ * @throws NamingException
+ * if the given data source location does not exist
+ * @throws SQLException
+ * if a database access error occurs
*/
protected Connection getConnection() throws NamingException, SQLException {
InitialContext ic = new InitialContext();
DataSource dataSource = (DataSource) ic.lookup(dataSourceLocation);
return dataSource.getConnection();
}
-
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/OracleFileSystem.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/OracleFileSystem.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/OracleFileSystem.java (working copy)
@@ -16,59 +16,64 @@
*/
package org.apache.jackrabbit.core.fs.db;
-import org.apache.jackrabbit.util.Text;
-import org.apache.jackrabbit.util.TransientFileFactory;
-import org.apache.jackrabbit.core.fs.FileSystemException;
-import org.apache.jackrabbit.core.fs.FileSystemPathUtil;
-import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.jcr.RepositoryException;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.sql.Blob;
-import java.sql.Connection;
-import java.io.InputStream;
import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.IOException;
import java.io.File;
-import java.io.FilterOutputStream;
-import java.io.FileOutputStream;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.lang.reflect.Method;
+import java.sql.Blob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.core.fs.FileSystemException;
+import org.apache.jackrabbit.core.fs.FileSystemPathUtil;
+import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
+import org.apache.jackrabbit.util.Text;
+import org.apache.jackrabbit.util.TransientFileFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* OracleFileSystem is a JDBC-based FileSystem
- * implementation for Jackrabbit that persists file system entries in an
- * Oracle database.
- *
driver: the FQN name of the JDBC driver class
- * (default: "oracle.jdbc.OracleDriver")schema: type of schema to be used
- * (default: "oracle")driver: the FQN name of the JDBC driver class (default:
+ * "oracle.jdbc.OracleDriver")schema: type of schema to be used (default:
+ * "oracle")url: the database url (e.g.
* "jdbc:oracle:thin:@[host]:[port]:[sid]")user: the database userpassword: the user's passwordschemaObjectPrefix: prefix to be prepended to schema objectsschemaObjectPrefix: prefix to be prepended to schema
+ * objects- * <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem"> - * <param name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl"/> - * <param name="user" value="scott"/> - * <param name="password" value="tiger"/> - * <param name="schemaObjectPrefix" value="rep_"/> - * </FileSystem> + * <FileSystem + * class="org.apache.jackrabbit.core.fs.db.OracleFileSystem"> + * <param name="url" + * value="jdbc:oracle:thin:@127.0.0.1:1521:orcl"/> + * <param name="user" + * value="scott"/> + * <param name="password" + * value="tiger"/> + * <param name="schemaObjectPrefix" + * value="rep_"/> + * </FileSystem> **/ public class OracleFileSystem extends DbFileSystem { @@ -79,9 +84,11 @@ private static Logger log = LoggerFactory.getLogger(OracleFileSystem.class); private Class blobClass; - private Integer DURATION_SESSION_CONSTANT; - private Integer MODE_READWRITE_CONSTANT; + private Integer durationSessionConstant; + + private Integer modeReadwriteConstant; + /** * Creates a new
OracleFileSystem instance.
*/
@@ -95,13 +102,13 @@
initialized = false;
}
- //-----------------------------------------< DatabaseFileSystem overrides >
+ // -----------------------------------------< DatabaseFileSystem overrides >
/**
- * {@inheritDoc}
- *
- * Retrieve the oracle.sql.BLOB class via reflection, and
- * initialize the values for the DURATION_SESSION and
- * MODE_READWRITE constants defined there.
+ * {@inheritDoc} Retrieve the oracle.sql.BLOB class via
+ * reflection, and initialize the values for the
+ * DURATION_SESSION and MODE_READWRITE
+ * constants defined there.
+ *
* @see oracle.sql.BLOB#DURATION_SESSION
* @see oracle.sql.BLOB#MODE_READWRITE
*/
@@ -113,11 +120,12 @@
// use the Connection object for using the exact same
// class loader that the Oracle driver was loaded with
try {
- blobClass = con.getClass().getClassLoader().loadClass("oracle.sql.BLOB");
- DURATION_SESSION_CONSTANT =
- new Integer(blobClass.getField("DURATION_SESSION").getInt(null));
- MODE_READWRITE_CONSTANT =
- new Integer(blobClass.getField("MODE_READWRITE").getInt(null));
+ blobClass = con.getClass().getClassLoader().loadClass(
+ "oracle.sql.BLOB");
+ durationSessionConstant = new Integer(blobClass.getField(
+ "DURATION_SESSION").getInt(null));
+ modeReadwriteConstant = new Integer(blobClass.getField(
+ "MODE_READWRITE").getInt(null));
} catch (Exception e) {
String msg = "failed to load/introspect oracle.sql.BLOB";
log.error(msg, e);
@@ -126,13 +134,12 @@
}
/**
- * {@inheritDoc}
- *
- * Overridden in order to support multiple oracle schemas. Note that
- * schema names in Oracle correspond to the username of the connection.
- * See http://issues.apache.org/jira/browse/JCR-582
+ * {@inheritDoc} Overridden in order to support multiple oracle
+ * schemas. Note that schema names in Oracle correspond to the username of
+ * the connection. See http://issues.apache.org/jira/browse/JCR-582
*
- * @throws Exception if an error occurs
+ * @throws Exception
+ * if an error occurs
*/
protected void checkSchema() throws Exception {
DatabaseMetaData metaData = con.getMetaData();
@@ -156,11 +163,13 @@
// read ddl from resources
InputStream in = getClass().getResourceAsStream(schema + ".ddl");
if (in == null) {
- String msg = "Configuration error: unknown schema '" + schema + "'";
+ String msg = "Configuration error: unknown schema '" + schema
+ + "'";
log.debug(msg);
throw new RepositoryException(msg);
}
- BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(in));
Statement stmt = con.createStatement();
try {
String sql = reader.readLine();
@@ -168,7 +177,8 @@
// Skip comments and empty lines
if (!sql.startsWith("#") && sql.length() > 0) {
// replace prefix variable
- sql = Text.replace(sql, SCHEMA_OBJECT_PREFIX_VARIABLE, schemaObjectPrefix);
+ sql = Text.replace(sql, SCHEMA_OBJECT_PREFIX_VARIABLE,
+ schemaObjectPrefix);
// execute sql stmt
stmt.executeUpdate(sql);
}
@@ -183,11 +193,9 @@
}
/**
- * Builds the SQL statements
- *
- * Since Oracle treats emtpy strings and BLOBs as null values the SQL
- * statements had to be adapated accordingly. The following changes were
- * necessary:
+ * Builds the SQL statements Since Oracle treats emtpy strings and
+ * BLOBs as null values the SQL statements had to be adapated accordingly.
+ * The following changes were necessary:
* oracle.sql.BLOB
- * and PreparedStatement#setBlob instead of just
- * PreparedStatement#setBinaryStream.
+ * {@inheritDoc} Overridden because we need to use
+ * oracle.sql.BLOB and PreparedStatement#setBlob
+ * instead of just PreparedStatement#setBinaryStream.
*/
- public OutputStream getOutputStream(final String filePath) throws FileSystemException {
+ public OutputStream getOutputStream(final String filePath)
+ throws FileSystemException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
@@ -318,8 +325,10 @@
}
try {
- TransientFileFactory fileFactory = TransientFileFactory.getInstance();
- final File tmpFile = fileFactory.createTransientFile("bin", null, null);
+ TransientFileFactory fileFactory = TransientFileFactory
+ .getInstance();
+ final File tmpFile = fileFactory.createTransientFile("bin", null,
+ null);
return new FilterOutputStream(new FileOutputStream(tmpFile)) {
@@ -334,28 +343,19 @@
long length = tmpFile.length();
in = new FileInputStream(tmpFile);
blob = createTemporaryBlob(in);
- executeStmt(updateDataSQL,
- new Object[]{
- blob,
- new Long(System.currentTimeMillis()),
- new Long(length),
- parentDir,
- name
- });
+ executeStmt(updateDataSQL, new Object[] {blob,
+ new Long(System.currentTimeMillis()),
+ new Long(length), parentDir, name});
}
} else {
synchronized (insertFileSQL) {
long length = tmpFile.length();
in = new FileInputStream(tmpFile);
blob = createTemporaryBlob(in);
- executeStmt(insertFileSQL,
- new Object[]{
- parentDir,
- name,
- blob,
- new Long(System.currentTimeMillis()),
- new Long(length)
- });
+ executeStmt(insertFileSQL, new Object[] {
+ parentDir, name, blob,
+ new Long(System.currentTimeMillis()),
+ new Long(length)});
}
}
} catch (Exception e) {
@@ -388,7 +388,9 @@
/**
* {@inheritDoc}
*/
- public RandomAccessOutputStream getRandomAccessOutputStream(final String filePath) throws FileSystemException, UnsupportedOperationException {
+ public RandomAccessOutputStream getRandomAccessOutputStream(
+ final String filePath) throws FileSystemException,
+ UnsupportedOperationException {
if (!initialized) {
throw new IllegalStateException("not initialized");
}
@@ -407,8 +409,10 @@
}
try {
- TransientFileFactory fileFactory = TransientFileFactory.getInstance();
- final File tmpFile = fileFactory.createTransientFile("bin", null, null);
+ TransientFileFactory fileFactory = TransientFileFactory
+ .getInstance();
+ final File tmpFile = fileFactory.createTransientFile("bin", null,
+ null);
// @todo FIXME use java.sql.Blob
@@ -429,8 +433,8 @@
}
return new RandomAccessOutputStream() {
- private final RandomAccessFile raf =
- new RandomAccessFile(tmpFile, "rw");
+ private final RandomAccessFile raf = new RandomAccessFile(
+ tmpFile, "rw");
public void close() throws IOException {
raf.close();
@@ -443,28 +447,19 @@
long length = tmpFile.length();
in = new FileInputStream(tmpFile);
blob = createTemporaryBlob(in);
- executeStmt(updateDataSQL,
- new Object[]{
- blob,
- new Long(System.currentTimeMillis()),
- new Long(length),
- parentDir,
- name
- });
+ executeStmt(updateDataSQL, new Object[] {blob,
+ new Long(System.currentTimeMillis()),
+ new Long(length), parentDir, name});
}
} else {
synchronized (insertFileSQL) {
long length = tmpFile.length();
in = new FileInputStream(tmpFile);
blob = createTemporaryBlob(in);
- executeStmt(insertFileSQL,
- new Object[]{
- parentDir,
- name,
- blob,
- new Long(System.currentTimeMillis()),
- new Long(length)
- });
+ executeStmt(insertFileSQL, new Object[] {
+ parentDir, name, blob,
+ new Long(System.currentTimeMillis()),
+ new Long(length)});
}
}
} catch (Exception e) {
@@ -495,7 +490,7 @@
raf.write(b);
}
- public void flush() /*throws IOException*/ {
+ public void flush() /* throws IOException */ {
// nop
}
@@ -503,7 +498,8 @@
raf.write(b);
}
- public void write(byte[] b, int off, int len) throws IOException {
+ public void write(byte[] b, int off, int len)
+ throws IOException {
raf.write(b, off, len);
}
};
@@ -514,31 +510,28 @@
}
}
- //----------------------------------------< oracle-specific blob handling >
+ // ----------------------------------------< oracle-specific blob handling >
/**
* Creates a temporary oracle.sql.BLOB instance via reflection and spools
* the contents of the specified stream.
*/
protected Blob createTemporaryBlob(InputStream in) throws Exception {
/*
- BLOB blob = BLOB.createTemporary(con, false, BLOB.DURATION_SESSION);
- blob.open(BLOB.MODE_READWRITE);
- OutputStream out = blob.getBinaryOutputStream();
- ...
- out.flush();
- out.close();
- blob.close();
- return blob;
- */
+ * BLOB blob = BLOB.createTemporary(con, false, BLOB.DURATION_SESSION);
+ * blob.open(BLOB.MODE_READWRITE); OutputStream out =
+ * blob.getBinaryOutputStream(); ... out.flush(); out.close();
+ * blob.close(); return blob;
+ */
Method createTemporary = blobClass.getMethod("createTemporary",
- new Class[]{Connection.class, Boolean.TYPE, Integer.TYPE});
- Object blob = createTemporary.invoke(null,
- new Object[]{con, Boolean.FALSE, DURATION_SESSION_CONSTANT});
- Method open = blobClass.getMethod("open", new Class[]{Integer.TYPE});
- open.invoke(blob, new Object[]{MODE_READWRITE_CONSTANT});
- Method getBinaryOutputStream =
- blobClass.getMethod("getBinaryOutputStream", new Class[0]);
- OutputStream out = (OutputStream) getBinaryOutputStream.invoke(blob, null);
+ new Class[] {Connection.class, Boolean.TYPE, Integer.TYPE});
+ Object blob = createTemporary.invoke(null, new Object[] {con,
+ Boolean.FALSE, durationSessionConstant});
+ Method open = blobClass.getMethod("open", new Class[] {Integer.TYPE});
+ open.invoke(blob, new Object[] {modeReadwriteConstant});
+ Method getBinaryOutputStream = blobClass.getMethod(
+ "getBinaryOutputStream", new Class[0]);
+ OutputStream out = (OutputStream) getBinaryOutputStream.invoke(blob,
+ null);
try {
int read;
byte[] buf = new byte[8192];
@@ -562,7 +555,8 @@
*/
protected void freeTemporaryBlob(Object blob) throws Exception {
// blob.freeTemporary();
- Method freeTemporary = blobClass.getMethod("freeTemporary", new Class[0]);
+ Method freeTemporary = blobClass.getMethod("freeTemporary",
+ new Class[0]);
freeTemporary.invoke(blob, null);
}
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystem.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystem.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystem.java (working copy)
@@ -20,13 +20,12 @@
import java.io.OutputStream;
/**
- * The FileSystem interface is an abstraction of a virtual
- * file system. The similarities of its method names with with the methods
- * of the java.io.File class are intentional.
- * FileSystem interface is an abstraction of a virtual file
+ * system. The similarities of its method names with with the methods of the
+ * java.io.File class are intentional. 0. See also
+ * Returns an output stream for writing bytes to the file denoted by this
+ * path. The file will be created if it doesn't exist. The current position
+ * of the file pointer is set to 0. See also
* {@link RandomAccessOutputStream#seek(long)};
*
- * @param filePath the path of the file.
+ * @param filePath
+ * the path of the file.
* @return an random access output stream for writing bytes to the file.
- * @throws FileSystemException if the file could not be created or
- * if the output stream cannot be obtained.
- * @throws UnsupportedOperationException if the implementation does
- * not support file access through a
- * {@link RandomAccessOutputStream}.
+ * @throws FileSystemException
+ * if the file could not be created or if the output stream
+ * cannot be obtained.
+ * @throws UnsupportedOperationException
+ * if the implementation does not support file access through a
+ * {@link RandomAccessOutputStream}.
*/
RandomAccessOutputStream getRandomAccessOutputStream(String filePath)
throws FileSystemException, UnsupportedOperationException;
/**
* Creates the folder named by this path, including any necessary but
- * nonexistent parent folders. Note that if this operation fails it
- * may have succeeded in creating some of the necessary parent folders.
+ * nonexistent parent folders. Note that if this operation fails it may have
+ * succeeded in creating some of the necessary parent folders.
*
- * @param folderPath the path of the folder to be created.
- * @throws FileSystemException if a file system entry denoted by path
- * already exists or if another error occurs.
+ * @param folderPath
+ * the path of the folder to be created.
+ * @throws FileSystemException
+ * if a file system entry denoted by path already exists or if
+ * another error occurs.
*/
void createFolder(String folderPath) throws FileSystemException;
/**
* Tests whether the file system entry denoted by this path exists.
*
- * @param path the path of a file system entry.
+ * @param path
+ * the path of a file system entry.
* @return true if the file system entry at path is a file; false otherwise.
* @throws FileSystemException
*/
@@ -116,7 +124,8 @@
/**
* Tests whether the file system entry denoted by this path is a file.
*
- * @param path the path of a file system entry.
+ * @param path
+ * the path of a file system entry.
* @return true if the file system entry at path is a file; false otherwise.
* @throws FileSystemException
*/
@@ -125,17 +134,22 @@
/**
* Tests whether the file system entry denoted by this path is a folder.
*
- * @param path the path of a file system entry.
- * @return true if the file system entry at path is a folder; false otherwise.
+ * @param path
+ * the path of a file system entry.
+ * @return true if the file system entry at path is a folder; false
+ * otherwise.
* @throws FileSystemException
*/
boolean isFolder(String path) throws FileSystemException;
/**
- * Tests whether the file system entry denoted by this path has child entries.
+ * Tests whether the file system entry denoted by this path has child
+ * entries.
*
- * @param path the path of a file system entry.
- * @return true if the file system entry at path has child entries; false otherwise.
+ * @param path
+ * the path of a file system entry.
+ * @return true if the file system entry at path has child entries; false
+ * otherwise.
* @throws FileSystemException
*/
boolean hasChildren(String path) throws FileSystemException;
@@ -143,76 +157,90 @@
/**
* Returns the length of the file denoted by this path.
*
- * @param filePath the path of the file.
- * @return The length, in bytes, of the file denoted by this path,
- * or -1L if the length can't be determined.
- * @throws FileSystemException if the path does not denote an existing file.
+ * @param filePath
+ * the path of the file.
+ * @return The length, in bytes, of the file denoted by this path, or -1L if
+ * the length can't be determined.
+ * @throws FileSystemException
+ * if the path does not denote an existing file.
*/
long length(String filePath) throws FileSystemException;
/**
- * Returns the time that the file system entry denoted by this path
- * was last modified.
+ * Returns the time that the file system entry denoted by this path was last
+ * modified.
*
- * @param path the path of a file system entry.
- * @return A long value representing the time the file system entry was
- * last modified, measured in milliseconds since the epoch
- * (00:00:00 GMT, January 1, 1970), or 0L if the modification
- * time can't be determined.
- * @throws FileSystemException if the file system entry does not exist.
+ * @param path
+ * the path of a file system entry.
+ * @return A long value representing the time the file system entry was last
+ * modified, measured in milliseconds since the epoch (00:00:00 GMT,
+ * January 1, 1970), or 0L if the modification time can't be
+ * determined.
+ * @throws FileSystemException
+ * if the file system entry does not exist.
*/
long lastModified(String path) throws FileSystemException;
/**
* Set the modified time of an existing file to now.
*
- * @param filePath the path of the file.
- * @throws FileSystemException if the path does not denote an existing file.
+ * @param filePath
+ * the path of the file.
+ * @throws FileSystemException
+ * if the path does not denote an existing file.
*/
void touch(String filePath) throws FileSystemException;
/**
- * Returns an array of strings naming the files and folders
- * in the folder denoted by this path.
+ * Returns an array of strings naming the files and folders in the folder
+ * denoted by this path.
*
- * @param folderPath the path of the folder whose contents is to be listed.
- * @return an array of strings naming the files and folders
- * in the folder denoted by this path.
- * @throws FileSystemException if this path does not denote a folder or if
- * another error occurs.
+ * @param folderPath
+ * the path of the folder whose contents is to be listed.
+ * @return an array of strings naming the files and folders in the folder
+ * denoted by this path.
+ * @throws FileSystemException
+ * if this path does not denote a folder or if another error
+ * occurs.
*/
String[] list(String folderPath) throws FileSystemException;
/**
- * Returns an array of strings naming the files in the folder
- * denoted by this path.
+ * Returns an array of strings naming the files in the folder denoted by
+ * this path.
*
- * @param folderPath the path of the folder whose contents is to be listed.
- * @return an array of strings naming the files in the folder
- * denoted by this path.
- * @throws FileSystemException if this path does not denote a folder or if
- * another error occurs.
+ * @param folderPath
+ * the path of the folder whose contents is to be listed.
+ * @return an array of strings naming the files in the folder denoted by
+ * this path.
+ * @throws FileSystemException
+ * if this path does not denote a folder or if another error
+ * occurs.
*/
String[] listFiles(String folderPath) throws FileSystemException;
/**
- * Returns an array of strings naming the folders in the folder
- * denoted by this path.
+ * Returns an array of strings naming the folders in the folder denoted by
+ * this path.
*
- * @param folderPath the path of the folder whose contents is to be listed.
- * @return an array of strings naming the folders in the folder
- * denoted by this path.
- * @throws FileSystemException if this path does not denote a folder or if
- * another error occurs.
+ * @param folderPath
+ * the path of the folder whose contents is to be listed.
+ * @return an array of strings naming the folders in the folder denoted by
+ * this path.
+ * @throws FileSystemException
+ * if this path does not denote a folder or if another error
+ * occurs.
*/
String[] listFolders(String folderPath) throws FileSystemException;
/**
* Deletes the file denoted by this path.
*
- * @param filePath the path of the file to be deleted.
- * @throws FileSystemException if this path does not denote a file or if
- * another error occurs.
+ * @param filePath
+ * the path of the file to be deleted.
+ * @throws FileSystemException
+ * if this path does not denote a file or if another error
+ * occurs.
*/
void deleteFile(String filePath) throws FileSystemException;
@@ -220,27 +248,37 @@
* Deletes the folder denoted by this path. Any contents of this folder
* (folders and files) will be deleted recursively.
*
- * @param folderPath the path of the folder to be deleted.
- * @throws FileSystemException if this path does not denote a folder or if
- * another error occurs.
+ * @param folderPath
+ * the path of the folder to be deleted.
+ * @throws FileSystemException
+ * if this path does not denote a folder or if another error
+ * occurs.
*/
void deleteFolder(String folderPath) throws FileSystemException;
/**
* Moves a file or folder to a new location.
*
- * @param srcPath the path of the file or folder to be moved.
- * @param destPath the destination path to which the file or folder is to be moved.
- * @throws FileSystemException if the move fails
+ * @param srcPath
+ * the path of the file or folder to be moved.
+ * @param destPath
+ * the destination path to which the file or folder is to be
+ * moved.
+ * @throws FileSystemException
+ * if the move fails
*/
void move(String srcPath, String destPath) throws FileSystemException;
/**
* Copies a file or folder to a new location.
*
- * @param srcPath the path of the file or folder to be copied.
- * @param destPath the destination path to which the file or folder is to be copied.
- * @throws FileSystemException if the copy fails
+ * @param srcPath
+ * the path of the file or folder to be copied.
+ * @param destPath
+ * the destination path to which the file or folder is to be
+ * copied.
+ * @throws FileSystemException
+ * if the copy fails
*/
void copy(String srcPath, String destPath) throws FileSystemException;
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemException.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemException.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemException.java (working copy)
@@ -29,20 +29,23 @@
* Constructs a new instance of this class with the specified detail
* message.
*
- * @param message the detail message. The detail message is saved for
- * later retrieval by the {@link #getMessage()} method.
+ * @param message
+ * the detail message. The detail message is saved for later
+ * retrieval by the {@link #getMessage()} method.
*/
public FileSystemException(String message) {
super(message);
}
/**
- * Constructs a new instance of this class with the specified detail
- * message and root cause.
+ * Constructs a new instance of this class with the specified detail message
+ * and root cause.
*
- * @param message the detail message. The detail message is saved for
- * later retrieval by the {@link #getMessage()} method.
- * @param rootCause root failure cause
+ * @param message
+ * the detail message. The detail message is saved for later
+ * retrieval by the {@link #getMessage()} method.
+ * @param rootCause
+ * root failure cause
*/
public FileSystemException(String message, Throwable rootCause) {
super(message, rootCause);
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemPathUtil.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemPathUtil.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemPathUtil.java (working copy)
@@ -35,16 +35,18 @@
private static final char ESCAPE_CHAR = '%';
/**
- * The list of characters that are not encoded by the escapeName(String)
- * and unescape(String) methods. They contains the characters
- * which can safely be used in file names:
+ * The list of characters that are not encoded by the
+ * escapeName(String) and unescape(String)
+ * methods. They contains the characters which can safely be used in file
+ * names:
*/
public static final BitSet SAFE_NAMECHARS;
/**
- * The list of characters that are not encoded by the escapePath(String)
- * and unescape(String) methods. They contains the characters
- * which can safely be used in file paths:
+ * The list of characters that are not encoded by the
+ * escapePath(String) and unescape(String)
+ * methods. They contains the characters which can safely be used in file
+ * paths:
*/
public static final BitSet SAFE_PATHCHARS;
@@ -77,11 +79,13 @@
}
/**
- * Escapes the given string using URL encoding for all bytes not included
- * in the given set of safe characters.
+ * Escapes the given string using URL encoding for all bytes not included in
+ * the given set of safe characters.
*
- * @param s the string to escape
- * @param safeChars set of safe characters (bytes)
+ * @param s
+ * the string to escape
+ * @param safeChars
+ * set of safe characters (bytes)
* @return escaped string
*/
private static String escape(String s, BitSet safeChars) {
@@ -106,7 +110,8 @@
* character / is regarded as a legal path character
* that needs no escaping.
*
- * @param path the path to encode.
+ * @param path
+ * the path to encode.
* @return the escaped path
*/
public static String escapePath(String path) {
@@ -115,11 +120,12 @@
/**
* Encodes the specified name. Same as
- * {@link #escapePath(String)} except that the separator character
- * / is regarded as an illegal character that needs
- * escaping.
+ * {@link #escapePath(String)} except that the separator
+ * character / is regarded as an illegal character
+ * that needs escaping.
*
- * @param name the name to encode.
+ * @param name
+ * the name to encode.
* @return the escaped name
*/
public static String escapeName(String name) {
@@ -129,16 +135,19 @@
/**
* Decodes the specified path/name.
*
- * @param pathOrName the escaped path/name
+ * @param pathOrName
+ * the escaped path/name
* @return the unescaped path/name
*/
public static String unescape(String pathOrName) {
- ByteArrayOutputStream out = new ByteArrayOutputStream(pathOrName.length());
+ ByteArrayOutputStream out = new ByteArrayOutputStream(pathOrName
+ .length());
for (int i = 0; i < pathOrName.length(); i++) {
char c = pathOrName.charAt(i);
if (c == ESCAPE_CHAR) {
try {
- out.write(Integer.parseInt(pathOrName.substring(i + 1, i + 3), 16));
+ out.write(Integer.parseInt(pathOrName.substring(i + 1,
+ i + 3), 16));
} catch (NumberFormatException e) {
throw new IllegalArgumentException();
}
@@ -153,8 +162,10 @@
/**
* Tests whether the specified path represents the root path, i.e. "/".
*
- * @param path path to test
- * @return true if the specified path represents the root path; false otherwise.
+ * @param path
+ * path to test
+ * @return true if the specified path represents the root path; false
+ * otherwise.
*/
public static boolean denotesRoot(String path) {
return path.equals(FileSystem.SEPARATOR);
@@ -163,8 +174,10 @@
/**
* Checks if path is a valid path.
*
- * @param path the path to be checked
- * @throws FileSystemException If path is not a valid path
+ * @param path
+ * the path to be checked
+ * @throws FileSystemException
+ * If path is not a valid path
*/
public static void checkFormat(String path) throws FileSystemException {
if (path == null) {
@@ -190,7 +203,9 @@
// leading/trailing whitespace is not allowed
String trimmed = names[i].trim();
if (!trimmed.equals(names[i])) {
- throw new FileSystemException("illegal leading or trailing whitespace in name: " + path);
+ throw new FileSystemException(
+ "illegal leading or trailing whitespace in name: "
+ + path);
}
}
}
@@ -198,7 +213,8 @@
/**
* Returns the parent directory of the specified path.
*
- * @param path a file system path denoting a directory or a file.
+ * @param path
+ * a file system path denoting a directory or a file.
* @return the parent directory.
*/
public static String getParentDir(String path) {
@@ -212,7 +228,8 @@
/**
* Returns the name of the specified path.
*
- * @param path a file system path denoting a directory or a file.
+ * @param path
+ * a file system path denoting a directory or a file.
* @return the name.
*/
public static String getName(String path) {
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemResource.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemResource.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemResource.java (working copy)
@@ -31,15 +31,18 @@
protected final String path;
static {
- // preload FileSystemPathUtil to prevent classloader issues during shutdown
+ // preload FileSystemPathUtil to prevent classloader issues during
+ // shutdown
FileSystemPathUtil.class.hashCode();
}
/**
* Creates a new FileSystemResource
*
- * @param fs the FileSystem where the resource is located
- * @param path the path of the resource in the FileSystem
+ * @param fs
+ * the FileSystem where the resource is located
+ * @param path
+ * the path of the resource in the FileSystem
*/
public FileSystemResource(FileSystem fs, String path) {
if (fs == null) {
@@ -103,8 +106,7 @@
}
/**
- * Deletes this resource.
- * Same as {@link #delete(false)}.
+ * Deletes this resource. Same as {@link #delete(false)}.
*
* @see FileSystem#deleteFile
*/
@@ -115,18 +117,19 @@
/**
* Deletes this resource.
*
- * @param pruneEmptyParentDirs if true, empty parent folders will
- * automatically be deleted
+ * @param pruneEmptyParentDirs
+ * if true, empty parent folders will
+ * automatically be deleted
* @see FileSystem#deleteFile
*/
- public synchronized void delete(boolean pruneEmptyParentDirs) throws FileSystemException {
+ public synchronized void delete(boolean pruneEmptyParentDirs)
+ throws FileSystemException {
fs.deleteFile(path);
if (pruneEmptyParentDirs) {
// prune empty parent folders
String parentDir = FileSystemPathUtil.getParentDir(path);
while (!parentDir.equals(FileSystem.SEPARATOR)
- && fs.exists(parentDir)
- && !fs.hasChildren(parentDir)) {
+ && fs.exists(parentDir) && !fs.hasChildren(parentDir)) {
fs.deleteFolder(parentDir);
parentDir = FileSystemPathUtil.getParentDir(parentDir);
}
@@ -150,13 +153,16 @@
/**
* Spools this resource to the given output stream.
*
- * @param out output stream where to spool the resource
- * @throws FileSystemException if the input stream for this resource could
- * not be obtained
- * @throws IOException if an error occurs while while spooling
+ * @param out
+ * output stream where to spool the resource
+ * @throws FileSystemException
+ * if the input stream for this resource could not be obtained
+ * @throws IOException
+ * if an error occurs while while spooling
* @see FileSystem#getInputStream
*/
- public void spool(OutputStream out) throws FileSystemException, IOException {
+ public void spool(OutputStream out) throws FileSystemException,
+ IOException {
InputStream in = fs.getInputStream(path);
try {
byte[] buffer = new byte[8192];
@@ -215,10 +221,10 @@
fs.move(path, destPath);
}
- //-------------------------------------------< java.lang.Object overrides >
+ // -------------------------------------------< java.lang.Object overrides >
/**
- * Returns the path string of this resource. This is just the
- * string returned by the {@link #getPath} method.
+ * Returns the path string of this resource. This is just the string
+ * returned by the {@link #getPath} method.
*
* @return The path string of this resource
*/
@@ -239,8 +245,8 @@
}
/**
- * Returns zero to satisfy the Object equals/hashCode contract.
- * This class is mutable and not meant to be used as a hash key.
+ * Returns zero to satisfy the Object equals/hashCode contract. This class
+ * is mutable and not meant to be used as a hash key.
*
* @return always zero
* @see Object#hashCode()
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/FileUtil.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/FileUtil.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/FileUtil.java (working copy)
@@ -34,12 +34,14 @@
}
/**
- * Recursively copies the given file or directory to the
- * given destination.
+ * Recursively copies the given file or directory to the given destination.
*
- * @param src source file or directory
- * @param dest destination file or directory
- * @throws IOException if the file or directory cannot be copied
+ * @param src
+ * source file or directory
+ * @param dest
+ * destination file or directory
+ * @throws IOException
+ * if the file or directory cannot be copied
*/
public static void copy(File src, File dest) throws IOException {
if (!src.canRead()) {
@@ -91,8 +93,10 @@
/**
* Recursively deletes the given file or directory.
*
- * @param f file or directory
- * @throws IOException if the file or directory cannot be deleted
+ * @param f
+ * file or directory
+ * @throws IOException
+ * if the file or directory cannot be deleted
*/
public static void delete(File f) throws IOException {
if (f.isDirectory()) {
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/HandleMonitor.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/HandleMonitor.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/HandleMonitor.java (working copy)
@@ -16,10 +16,6 @@
*/
package org.apache.jackrabbit.core.fs.local;
-import org.apache.jackrabbit.util.LazyFileInputStream;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -28,11 +24,15 @@
import java.util.HashSet;
import java.util.Iterator;
+import org.apache.jackrabbit.util.LazyFileInputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
- * This Class implements a very simple open handle monitor for the local
- * file system. This is usefull, if the list of open handles, referenced by
- * an open FileInputStream() should be tracked. This can cause problems on
- * windows filesystems where open files cannot be deleted.
+ * This Class implements a very simple open handle monitor for the local file
+ * system. This is usefull, if the list of open handles, referenced by an open
+ * FileInputStream() should be tracked. This can cause problems on windows
+ * filesystems where open files cannot be deleted.
*/
public class HandleMonitor {
@@ -61,6 +61,7 @@
/**
* Checks, if the file is open
+ *
* @param file
* @return
*/
@@ -70,6 +71,7 @@
/**
* Closes a file
+ *
* @param file
*/
private void close(File file) {
@@ -78,6 +80,7 @@
/**
* Returns the handle for a file.
+ *
* @param file
* @return
*/
@@ -105,6 +108,7 @@
/**
* Dumps the information for a file
+ *
* @param file
*/
public void dump(File file) {
@@ -131,6 +135,7 @@
/**
* Creates a new handle for a file
+ *
* @param file
*/
private Handle(File file) {
@@ -139,17 +144,20 @@
/**
* opens a stream for this handle
+ *
* @return
* @throws FileNotFoundException
*/
private InputStream open() throws FileNotFoundException {
- Handle.MonitoredInputStream in = new Handle.MonitoredInputStream(file);
+ Handle.MonitoredInputStream in = new Handle.MonitoredInputStream(
+ file);
streams.add(in);
return in;
}
/**
* Closes a stream
+ *
* @param in
*/
private void close(MonitoredInputStream in) {
@@ -174,7 +182,8 @@
log.info("- " + file.getPath() + ", " + streams.size());
Iterator iter = streams.iterator();
while (iter.hasNext()) {
- Handle.MonitoredInputStream in = (Handle.MonitoredInputStream) iter.next();
+ Handle.MonitoredInputStream in =
+ (Handle.MonitoredInputStream) iter.next();
in.dump();
}
} else {
@@ -193,10 +202,8 @@
*/
private final Throwable throwable = new Exception();
- /**
- * {@inheritDoc}
- */
- private MonitoredInputStream(File file) throws FileNotFoundException {
+ private MonitoredInputStream(File file)
+ throws FileNotFoundException {
super(file);
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/LocalFileSystem.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/LocalFileSystem.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/LocalFileSystem.java (working copy)
@@ -16,13 +16,6 @@
*/
package org.apache.jackrabbit.core.fs.local;
-import org.apache.jackrabbit.core.fs.FileSystem;
-import org.apache.jackrabbit.core.fs.FileSystemException;
-import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
-import org.apache.jackrabbit.util.LazyFileInputStream;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.io.File;
import java.io.FileFilter;
import java.io.FileNotFoundException;
@@ -32,6 +25,13 @@
import java.io.OutputStream;
import java.io.RandomAccessFile;
+import org.apache.jackrabbit.core.fs.FileSystem;
+import org.apache.jackrabbit.core.fs.FileSystemException;
+import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
+import org.apache.jackrabbit.util.LazyFileInputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* A LocalFileSystem ...
*/
@@ -62,7 +62,8 @@
* that this method can be called via reflection during initialization and
* must not be altered.
*
- * @param rootPath the path to the root directory
+ * @param rootPath
+ * the path to the root directory
*/
public void setPath(String rootPath) {
setRoot(new File(osPath(rootPath)));
@@ -84,7 +85,8 @@
/**
* Enables/Disables the use of the handle monitor.
*
- * @param enable flag
+ * @param enable
+ * flag
*/
public void setEnableHandleMonitor(boolean enable) {
if (enable && monitor == null) {
@@ -112,7 +114,7 @@
return genericPath.replace(SEPARATOR_CHAR, File.separatorChar);
}
- //-------------------------------------------< java.lang.Object overrides >
+ // -------------------------------------------< java.lang.Object overrides >
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -129,8 +131,8 @@
}
/**
- * Returns zero to satisfy the Object equals/hashCode contract.
- * This class is mutable and not meant to be used as a hash key.
+ * Returns zero to satisfy the Object equals/hashCode contract. This class
+ * is mutable and not meant to be used as a hash key.
*
* @return always zero
* @see Object#hashCode()
@@ -139,7 +141,7 @@
return 0;
}
- //-----------------------------------------------------------< FileSystem >
+ // -----------------------------------------------------------< FileSystem >
/**
* {@inheritDoc}
*/
@@ -186,8 +188,8 @@
try {
FileUtil.copy(src, dest);
} catch (IOException ioe) {
- String msg = "copying " + src.getPath() + " to "
- + dest.getPath() + " failed";
+ String msg = "copying " + src.getPath() + " to " + dest.getPath()
+ + " failed";
log.debug(msg);
throw new FileSystemException(msg, ioe);
}
@@ -457,8 +459,8 @@
// now we're ready to move/rename the file/folder
if (!src.renameTo(dest)) {
- String msg = "moving " + src.getPath() + " to "
- + dest.getPath() + " failed";
+ String msg = "moving " + src.getPath() + " to " + dest.getPath()
+ + " failed";
log.debug(msg);
throw new FileSystemException(msg);
}
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/RAFOutputStream.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/RAFOutputStream.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/local/RAFOutputStream.java (working copy)
@@ -16,11 +16,11 @@
*/
package org.apache.jackrabbit.core.fs.local;
-import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
-
import java.io.IOException;
import java.io.RandomAccessFile;
+import org.apache.jackrabbit.core.fs.RandomAccessOutputStream;
+
/**
* Implements a buffered output stream on a random access file.
*/
@@ -59,8 +59,10 @@
/**
* Contructs a new output stream with the given buffer size.
*
- * @param raf the underlying RandomAccessFile.
- * @param size the size of the buffer.
+ * @param raf
+ * the underlying RandomAccessFile.
+ * @param size
+ * the size of the buffer.
*/
public RAFOutputStream(RandomAccessFile raf, int size) throws IOException {
this.raf = raf;
@@ -72,7 +74,8 @@
* Contructs a new output stream with the default buffer size:
* {@link #DEFAULT_BUFFER_SIZE}.
*
- * @param raf the underlying RandomAccessFile.
+ * @param raf
+ * the underlying RandomAccessFile.
*/
public RAFOutputStream(RandomAccessFile raf) throws IOException {
this(raf, DEFAULT_BUFFER_SIZE);
@@ -96,7 +99,7 @@
bufferStart = position;
}
- //---------------------------------------------------------< OutputStream >
+ // ---------------------------------------------------------< OutputStream >
/**
* {@inheritDoc}
*/
@@ -136,8 +139,7 @@
/**
* This method also closes the underlying RandomAccessFile.
- *
- * {@inheritDoc}
+ * {@inheritDoc}
*/
public void close() throws IOException {
flush();
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/mem/MemoryFileSystem.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/mem/MemoryFileSystem.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/mem/MemoryFileSystem.java (working copy)
@@ -171,8 +171,9 @@
}
private void assertExistence(String path) throws FileSystemException {
- if (!exists(path))
+ if (!exists(path)) {
throw new FileSystemException("no such file " + path);
+ }
}
public boolean isFolder(String path) throws FileSystemException {
Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java
===================================================================
--- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java (revision 483957)
+++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/RandomAccessOutputStream.java (working copy)
@@ -20,18 +20,20 @@
import java.io.OutputStream;
/**
- * Extends the regular java.io.OutputStream with a random
- * access facility. Multiple write() operations can be
- * positioned off sequence with the {@link #seek} method.
+ * Extends the regular java.io.OutputStream with a random access
+ * facility. Multiple write() operations can be positioned off
+ * sequence with the {@link #seek} method.
*/
public abstract class RandomAccessOutputStream extends OutputStream {
/**
- * Sets the current position in the resource where the next write
- * will occur.
+ * Sets the current position in the resource where the next write will
+ * occur.
*
- * @param position the new position in the resource.
- * @throws IOException if an error occurs while seeking to the position.
+ * @param position
+ * the new position in the resource.
+ * @throws IOException
+ * if an error occurs while seeking to the position.
*/
public abstract void seek(long position) throws IOException;
}