Return-Path: X-Original-To: apmail-jackrabbit-commits-archive@www.apache.org Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AF8C57578 for ; Wed, 28 Sep 2011 15:39:40 +0000 (UTC) Received: (qmail 26932 invoked by uid 500); 28 Sep 2011 15:39:40 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 26895 invoked by uid 500); 28 Sep 2011 15:39:40 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 26888 invoked by uid 99); 28 Sep 2011 15:39:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2011 15:39:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2011 15:39:37 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 971C52388847; Wed, 28 Sep 2011 15:39:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1176922 - /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java Date: Wed, 28 Sep 2011 15:39:15 -0000 To: commits@jackrabbit.apache.org From: mduerig@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20110928153915.971C52388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mduerig Date: Wed Sep 28 15:39:15 2011 New Revision: 1176922 URL: http://svn.apache.org/viewvc?rev=1176922&view=rev Log: Microkernel based Jackrabbit prototype (WIP) refactor: remove obsolete refresh method Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java?rev=1176922&r1=1176921&r2=1176922&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java Wed Sep 28 15:39:15 2011 @@ -31,9 +31,7 @@ import org.apache.jackrabbit.jcr2spi.sta import org.apache.jackrabbit.jcr2spi.state.PropertyState; import org.apache.jackrabbit.jcr2spi.state.Status; import org.apache.jackrabbit.spi.ChildInfo; -import org.apache.jackrabbit.spi.Event; import org.apache.jackrabbit.spi.IdFactory; -import org.apache.jackrabbit.spi.ItemId; import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.NodeId; import org.apache.jackrabbit.spi.Path; @@ -155,11 +153,7 @@ public class NodeEntry extends Hierarchy * Upon transient 'move' ('rename') or 'reorder' of SNSs this * {@code NodeEntry} remembers the original parent, name and index * for later revert as well as for the creation of the - * {@link #getWorkspaceId() workspace id}. Finally the revertInfo is - * used to find the target of an {@code Event} indicating external - * modification. - * - * @see #refresh(Event) + * {@link #getWorkspaceId() workspace id}. */ private RevertInfo revertInfo; @@ -1016,109 +1010,6 @@ public class NodeEntry extends Hierarchy return revertInfo != null && revertInfo.isMoved(); } - /** - * The parent entry of a external event gets informed about the modification. - * Note, that {@link Event#getParentId()} of the given childEvent must point - * to this {@code NodeEntry}. - * - * @param childEvent - */ - public void refresh(Event childEvent) { - ItemId eventId = childEvent.getItemId(); - Path eventPath = childEvent.getPath(); - Name eventName = eventPath.getName(); - HierarchyEntry child = eventId == null ? null : lookupEntry(eventId, eventPath); - - switch (childEvent.getType()) { - case Event.NODE_ADDED: - case Event.PROPERTY_ADDED: - if (child == null || child.getStatus() == Status.REMOVED) { - // no such child or a colliding new child existed but got - // removed already -> add the new entry. - if (childEvent.getType() == Event.NODE_ADDED) { - String uniqueChildID = eventId.getPath() == null ? eventId.getUniqueID() : null; - int index = eventPath.getNormalizedIndex(); - internalAddNodeEntry(eventName, uniqueChildID, index); - } else { - internalAddPropertyEntry(eventName, true); - } - } else { - // item already present - Status status = child.getStatus(); - if (Status.NEW == status) { - // event conflicts with a transiently added item on this - // node entry -> mark the parent node (this) stale. - internalGetItemState().setStatus(Status.MODIFIED); - } // else: child already added -> ignore - } - break; - - case Event.NODE_REMOVED: - case Event.PROPERTY_REMOVED: - if (child != null) { - Status status = child.getStatus(); - if (Status.EXISTING_REMOVED == status) { - // colliding item removal -> mark parent stale - internalGetItemState().setStatus(Status.MODIFIED); - } - child.remove(); - } // else: child-Entry has not been loaded yet -> ignore - break; - - case Event.PROPERTY_CHANGED: - if (child == null) { - // prop-Entry has not been loaded yet -> add propEntry - internalAddPropertyEntry(eventName, true); - } else if (child.isAvailable()) { - Status status = child.getStatus(); - // if the child has pending changes -> stale. - // Reload data from server and try to merge them with the - // current session-state. if the latter is transiently - // modified and merge fails it must be marked STALE afterwards. - if (Status.isStale(status)) { - // ignore. nothing to do. - } else if (Status.isTransient(child.getStatus())) { - // pending changes -> don't reload entry but rather - // mark it stale - child.internalGetItemState().setStatus(Status.MODIFIED); - } else { - // no pending changes -> invalidate and force reload - // upon next access. - child.invalidate(false); - // special cases: jcr:uuid and jcr:mixinTypes affect the - // parent (i.e. this NodeEntry) - if (isUuidOrMixin(eventName)) { - if (!(child instanceof PropertyEntry)) { - IllegalArgumentException e = new IllegalArgumentException("Invalid event: " + childEvent); - log.error(e.getMessage(), e); - throw e; - } - - notifyUUIDorMIXINModified(Unchecked.cast(child)); - } - } - } // else: existing entry but state not yet built -> ignore event - break; - case Event.NODE_MOVED: - // TODO: implementation missing - UnsupportedOperationException e = new UnsupportedOperationException("Not implemented"); - log.error(e.getMessage(), e); - throw e; - //break; - case Event.PERSIST: - // TODO: implementation missing - UnsupportedOperationException e0 = new UnsupportedOperationException("Not implemented"); - log.error(e0.getMessage(), e0); - throw e0; - default: - // ILLEGAL - IllegalArgumentException e1 = new IllegalArgumentException("Illegal event type " + - childEvent.getType() + " for NodeState."); - log.error(e1.getMessage(), e1); - throw e1; - } - } - //-------------------------------------------------< HierarchyEntry >--- @Override @@ -1322,30 +1213,6 @@ public class NodeEntry extends Hierarchy } } - /** - * Searches the child-entries of this NodeEntry for a matching child. - * Since {@link #refresh(Event)} must always be called on the parent - * NodeEntry, there is no need to check if a given event id would point - * to this NodeEntry itself. - * - * @param eventId - * @param eventPath - * @return the entry or {@code null} if the matching entry has a status - * {@code Status#NEW}. - */ - private HierarchyEntry lookupEntry(ItemId eventId, Path eventPath) { - Name childName = eventPath.getName(); - HierarchyEntry child; - if (eventId.denotesNode()) { - String uniqueChildID = eventId.getPath() == null ? eventId.getUniqueID() : null; - int index = eventPath.getNormalizedIndex(); - child = lookupNodeEntry(uniqueChildID, childName, index); - } else { - child = lookupPropertyEntry(childName); - } - return child; - } - private NodeEntry lookupNodeEntry(String uniqueChildId, Name childName, int index) { NodeEntry child = null; if (uniqueChildId != null) {