Index: checkstyle.xml =================================================================== --- checkstyle.xml (revision 483406) +++ checkstyle.xml (working copy) @@ -32,7 +32,9 @@ - + + + Index: src/main/java/org/apache/jackrabbit/core/cluster/ClusterContext.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/ClusterContext.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/ClusterException.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/ClusterException.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/ClusterNode.java (revision 483406) +++ 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,11 @@ return s; } - //--------------------------------------------------< UpdateEventListener > + // --------------------------------------------------< UpdateEventListener > /** - * {@inheritDoc} - *

- * Invoked when an update has been created inside versioning. Delegate - * to common method with null workspace. + * {@inheritDoc}

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 +340,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 +407,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 +438,7 @@ namespaceListener = listener; } - //------------------------------------------------< NodeTypeEventListener > + // ------------------------------------------------< NodeTypeEventListener > /** * {@inheritDoc} @@ -442,7 +465,6 @@ nodeTypeListener = listener; } - /** * Workspace update channel. */ @@ -456,7 +478,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 +537,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 +614,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 +657,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 +687,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 +725,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 +743,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 +759,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 +791,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 +800,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: src/main/java/org/apache/jackrabbit/core/cluster/ClusterSession.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/ClusterSession.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/FileJournal.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/FileJournal.java (revision 483406) +++ 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: *

- * - * todo after some iterations, old files should be automatically compressed to save space + * todo after some iterations, old files should be automatically compressed to + * save space */ public class FileJournal implements Journal { @@ -124,7 +128,8 @@ private String basename; /** - * Maximum size of a journal file before a rotation takes place, bean property. + * Maximum size of a journal file before a rotation takes place, bean + * property. */ private int maximumSize; @@ -165,6 +170,7 @@ /** * Bean getter for journal directory. + * * @return directory */ public String getDirectory() { @@ -173,7 +179,9 @@ /** * Bean setter for journal directory. - * @param directory directory used for journaling + * + * @param directory + * directory used for journaling */ public void setDirectory(String directory) { this.directory = directory; @@ -181,6 +189,7 @@ /** * Bean getter for revision file. + * * @return revision file */ public String getRevision() { @@ -189,7 +198,9 @@ /** * Bean setter for journal directory. - * @param revision directory used for journaling + * + * @param revision + * directory used for journaling */ public void setRevision(String revision) { this.revision = revision; @@ -197,6 +208,7 @@ /** * Bean getter for base name. + * * @return base name */ public String getBasename() { @@ -205,7 +217,9 @@ /** * Bean setter for basename. - * @param basename base name + * + * @param basename + * base name */ public void setBasename(String basename) { this.basename = basename; @@ -213,6 +227,7 @@ /** * Bean getter for maximum size. + * * @return maximum size */ public int getMaximumSize() { @@ -221,7 +236,9 @@ /** * Bean setter for maximum size. - * @param maximumSize maximum size + * + * @param maximumSize + * maximum size */ public void setMaximumSize(int maximumSize) { this.maximumSize = maximumSize; @@ -230,7 +247,8 @@ /** * {@inheritDoc} */ - public void init(String id, RecordProcessor processor, NamespaceResolver resolver) throws JournalException { + public void init(String id, RecordProcessor processor, + NamespaceResolver resolver) throws JournalException { this.id = id; this.resolver = resolver; this.processor = processor; @@ -251,7 +269,8 @@ } root = new File(directory); if (!root.exists() || !root.isDirectory()) { - String msg = "Directory specified does either not exist or is not a directory: " + directory; + String msg = "Directory specified does either not exist or is not " + + "a directory: " + directory; throw new JournalException(msg); } instanceRevision = new FileRevision(new File(revision)); @@ -289,31 +308,37 @@ if (!record.getCreator().equals(id)) { process(record); } else { - log.info("Log entry matches journal id, skipped: " + record.getRevision()); + log.info("Log entry matches journal id, skipped: " + + record.getRevision()); } instanceRevision.set(record.getNextRevision()); } } catch (IOException e) { - String msg = "Unable to iterate over modified records: " + e.getMessage(); + String msg = "Unable to iterate over modified records: " + + e.getMessage(); throw new JournalException(msg); } finally { try { cursor.close(); } catch (IOException e) { - String msg = "I/O error while closing record cursor: " + e.getMessage(); + String msg = "I/O error while closing record cursor: " + + e.getMessage(); log.warn(msg); } } - log.info("Sync finished, instance revision is: " + instanceRevision.get()); + log.info("Sync finished, instance revision is: " + + instanceRevision.get()); } } /** * Process a record. * - * @param record record to process - * @throws JournalException if an error occurs + * @param record + * record to process + * @throws JournalException + * if an error occurs */ void process(FileRecord record) throws JournalException { log.info("Processing revision: " + record.getRevision()); @@ -331,11 +356,13 @@ break; } if (c == 'N') { - NodeOperation operation = NodeOperation.create(in.readByte()); + NodeOperation operation = NodeOperation.create(in + .readByte()); operation.setId(in.readNodeId()); processor.process(operation); } else if (c == 'P') { - PropertyOperation operation = PropertyOperation.create(in.readByte()); + PropertyOperation operation = PropertyOperation.create(in + .readByte()); operation.setId(in.readPropertyId()); processor.process(operation); } else if (c == 'E') { @@ -377,26 +404,27 @@ } processor.process(ntDefs); } else { - throw new IllegalArgumentException("Unknown entry type: " + c); + throw new IllegalArgumentException("Unknown entry type: " + + c); } } processor.end(); } catch (NameException e) { - String msg = "Unable to read revision " + record.getRevision() + - ": " + e.getMessage(); + String msg = "Unable to read revision " + record.getRevision() + + ": " + e.getMessage(); throw new JournalException(msg); } catch (ParseException e) { - String msg = "Unable to read revision " + record.getRevision() + - ": " + e.getMessage(); + String msg = "Unable to read revision " + record.getRevision() + + ": " + e.getMessage(); throw new JournalException(msg); } catch (IOException e) { - String msg = "Unable to read revision " + record.getRevision() + - ": " + e.getMessage(); + String msg = "Unable to read revision " + record.getRevision() + + ": " + e.getMessage(); throw new JournalException(msg); } catch (IllegalArgumentException e) { - String msg = "Error while processing revision " + - record.getRevision() + ": " + e.getMessage(); + String msg = "Error while processing revision " + + record.getRevision() + ": " + e.getMessage(); throw new JournalException(msg); } finally { in.close(); @@ -427,7 +455,8 @@ succeeded = true; } catch (IOException e) { - String msg = "Unable to create journal log " + tempLog + ": " + e.getMessage(); + String msg = "Unable to create journal log " + tempLog + ": " + + e.getMessage(); throw new JournalException(msg); } finally { if (!succeeded) { @@ -439,7 +468,8 @@ /** * {@inheritDoc} */ - public void log(ChangeLog changeLog, EventStateCollection esc) throws JournalException { + public void log(ChangeLog changeLog, EventStateCollection esc) + throws JournalException { Iterator addedStates = changeLog.addedStates(); while (addedStates.hasNext()) { ItemState state = (ItemState) addedStates.next(); @@ -478,14 +508,16 @@ /** * {@inheritDoc} */ - public void log(String oldPrefix, String newPrefix, String uri) throws JournalException { + public void log(String oldPrefix, String newPrefix, String uri) + throws JournalException { try { out.writeChar('S'); out.writeString(oldPrefix); out.writeString(newPrefix); out.writeString(uri); } 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); } } @@ -493,7 +525,8 @@ /** * {@inheritDoc} */ - public void log(NodeId nodeId, boolean isDeep, String owner) throws JournalException { + public void log(NodeId nodeId, boolean isDeep, String owner) + throws JournalException { log(nodeId, true, isDeep, owner); } @@ -517,7 +550,8 @@ out.writeNodeTypeDef((NodeTypeDef) iter.next()); } } 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); } @@ -526,7 +560,8 @@ /** * Log a property operation. * - * @param operation property operation + * @param operation + * property operation */ protected void log(PropertyOperation operation) throws JournalException { try { @@ -534,10 +569,12 @@ out.writeByte(operation.getOperationType()); out.writePropertyId(operation.getId()); } catch (NoPrefixDeclaredException 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); } 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); } } @@ -545,7 +582,8 @@ /** * Log a node operation. * - * @param operation node operation + * @param operation + * node operation */ protected void log(NodeOperation operation) throws JournalException { try { @@ -553,7 +591,8 @@ out.writeByte(operation.getOperationType()); out.writeNodeId(operation.getId()); } 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); } } @@ -561,7 +600,8 @@ /** * Log an event. Subclass responsibility. * - * @param event event to log + * @param event + * event to log */ protected void log(EventState event) throws JournalException { try { @@ -581,10 +621,12 @@ } out.writeString(event.getUserId()); } catch (NoPrefixDeclaredException 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); } 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); } } @@ -592,14 +634,18 @@ /** * Log either a lock or an unlock operation. * - * @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 + * @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: src/main/java/org/apache/jackrabbit/core/cluster/FileRecord.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/FileRecord.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/FileRecordCursor.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/FileRecordCursor.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/FileRecordInput.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/FileRecordInput.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/FileRecordLog.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/FileRecordLog.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/FileRecordOutput.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/FileRecordOutput.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/FileRevision.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/FileRevision.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/ItemOperation.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/ItemOperation.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/Journal.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/Journal.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/JournalException.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/JournalException.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/LockEventChannel.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/LockEventChannel.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/LockEventListener.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/LockEventListener.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventChannel.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventChannel.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventListener.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/NamespaceEventListener.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/NodeAddedOperation.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/NodeAddedOperation.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/NodeDeletedOperation.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/NodeDeletedOperation.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/NodeModifiedOperation.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/NodeModifiedOperation.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/NodeOperation.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/NodeOperation.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventChannel.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventChannel.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventListener.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/NodeTypeEventListener.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/package.html =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/package.html (revision 0) +++ src/main/java/org/apache/jackrabbit/core/cluster/package.html (revision 0) @@ -0,0 +1,21 @@ + + + Clustering for Jackrabbit - makes two or more repositories available at the + same time, allowing them to stay in sync with changes applied to only one of + them. + Index: src/main/java/org/apache/jackrabbit/core/cluster/PropertyAddedOperation.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/PropertyAddedOperation.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/PropertyDeletedOperation.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/PropertyDeletedOperation.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/PropertyModifiedOperation.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/PropertyModifiedOperation.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/PropertyOperation.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/PropertyOperation.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/RecordProcessor.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/RecordProcessor.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventChannel.java (revision 483406) +++ 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: src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventListener.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/cluster/UpdateEventListener.java (revision 483406) +++ 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; }