Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 34558 invoked from network); 21 Oct 2009 11:39:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Oct 2009 11:39:53 -0000 Received: (qmail 52724 invoked by uid 500); 21 Oct 2009 11:39:53 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 52661 invoked by uid 500); 21 Oct 2009 11:39:53 -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 52652 invoked by uid 99); 21 Oct 2009 11:39:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Oct 2009 11:39:53 +0000 X-ASF-Spam-Status: No, hits=-1998.9 required=10.0 tests=ALL_TRUSTED,FB_GET_MEDS 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, 21 Oct 2009 11:39:46 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3729B23889E8; Wed, 21 Oct 2009 11:38:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r827966 [12/15] - in /jackrabbit/sandbox/JCR-1456: ./ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security... Date: Wed, 21 Oct 2009 11:38:44 -0000 To: commits@jackrabbit.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091021113852.3729B23889E8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java?rev=827966&r1=827965&r2=827966&view=diff ============================================================================== --- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java (original) +++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java Wed Oct 21 11:38:31 2009 @@ -101,7 +101,7 @@ * Map of properties which are deleted and have been re-created as transient * property with the same name. */ - private final Map propertiesInAttic; + private final Map propertiesInAttic; /** * Upon transient 'move' ('rename') or 'reorder' of SNSs this @@ -137,7 +137,7 @@ properties = new ChildPropertyEntriesImpl(this, factory); childNodeEntries = new ChildNodeEntriesImpl(this, factory, null); - propertiesInAttic = new HashMap(); + propertiesInAttic = new HashMap(); childNodeAttic = new ChildNodeAttic(); factory.notifyEntryCreated(this); @@ -195,8 +195,8 @@ // did not cause this entry to be removed -> therefore check status. if (recursive && !Status.isTerminal(getStatus())) { // recursively reload all entries including props that are in the attic. - for (Iterator it = getAllChildEntries(true); it.hasNext();) { - HierarchyEntry ce = (HierarchyEntry) it.next(); + for (Iterator it = getAllChildEntries(true); it.hasNext();) { + HierarchyEntry ce = it.next(); ce.reload(recursive); } } @@ -228,8 +228,8 @@ * @see HierarchyEntry#transientRemove() */ public void transientRemove() throws RepositoryException { - for (Iterator it = getAllChildEntries(false); it.hasNext();) { - HierarchyEntry ce = (HierarchyEntry) it.next(); + for (Iterator it = getAllChildEntries(false); it.hasNext();) { + HierarchyEntry ce = it.next(); ce.transientRemove(); } @@ -251,7 +251,7 @@ super.internalRemove(false); boolean staleParent = (getStatus() == Status.STALE_DESTROYED); // now remove all child-entries (or mark them accordingly) - for (Iterator it = getAllChildEntries(true); it.hasNext();) { + for (Iterator it = getAllChildEntries(true); it.hasNext();) { HierarchyEntryImpl ce = (HierarchyEntryImpl) it.next(); ce.internalRemove(staleParent); } @@ -263,7 +263,7 @@ staleParent = (staleParent || (getStatus() == Status.STALE_DESTROYED)); // now remove all child-entries (or mark them accordingly) - for (Iterator it = getAllChildEntries(true); it.hasNext();) { + for (Iterator it = getAllChildEntries(true); it.hasNext();) { HierarchyEntryImpl ce = (HierarchyEntryImpl) it.next(); ce.internalRemove(staleParent); } @@ -413,7 +413,7 @@ } // -> check for moved child entry in node-attic // -> check if child points to a removed/moved sns - List siblings = entry.childNodeEntries.get(name); + List siblings = entry.childNodeEntries.get(name); if (entry.containsAtticChild(siblings, name, index)) { throw new PathNotFoundException(factory.saveGetJCRPath(path)); } @@ -487,7 +487,7 @@ } // -> check for moved child entry in node-attic // -> check if child points to a removed/moved sns - List siblings = entry.childNodeEntries.get(name); + List siblings = entry.childNodeEntries.get(name); if (entry.containsAtticChild(siblings, name, index)) { throw new PathNotFoundException(factory.saveGetJCRPath(path)); } @@ -567,7 +567,7 @@ * @see NodeEntry#hasNodeEntry(Name) */ public synchronized boolean hasNodeEntry(Name nodeName) { - List namedEntries = childNodeEntries.get(nodeName); + List namedEntries = childNodeEntries.get(nodeName); if (namedEntries.isEmpty()) { return false; } else { @@ -598,14 +598,14 @@ * @see NodeEntry#getNodeEntry(Name, int, boolean) */ public NodeEntry getNodeEntry(Name nodeName, int index, boolean loadIfNotFound) throws RepositoryException { - List entries = childNodeEntries.get(nodeName); + List entries = childNodeEntries.get(nodeName); NodeEntry cne = null; if (entries.size() >= index) { // position of entry might differ from index-1 if a SNS with lower // index has been transiently removed. int eIndex = 1; for (int i = 0; i < entries.size() && cne == null; i++) { - NodeEntry ne = (NodeEntry) entries.get(i); + NodeEntry ne = entries.get(i); if (EntryValidation.isValidNodeEntry(ne)) { if (eIndex == index) { cne = ne; @@ -629,10 +629,10 @@ /** * @see NodeEntry#getNodeEntries() */ - public synchronized Iterator getNodeEntries() throws RepositoryException { - Collection entries = new ArrayList(); - for (Iterator it = getCompleteChildNodeEntries().iterator(); it.hasNext();) { - NodeEntry entry = (NodeEntry) it.next(); + public synchronized Iterator getNodeEntries() throws RepositoryException { + Collection entries = new ArrayList(); + for (Iterator it = getCompleteChildNodeEntries().iterator(); it.hasNext();) { + NodeEntry entry = it.next(); if (EntryValidation.isValidNodeEntry(entry)) { entries.add(entry); } @@ -643,17 +643,17 @@ /** * @see NodeEntry#getNodeEntries(Name) */ - public synchronized List getNodeEntries(Name nodeName) throws RepositoryException { - List namedEntries = getCompleteChildNodeEntries().get(nodeName); + public synchronized List getNodeEntries(Name nodeName) throws RepositoryException { + List namedEntries = getCompleteChildNodeEntries().get(nodeName); if (namedEntries.isEmpty()) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } else { - List entries = new ArrayList(); + List entries = new ArrayList(); // get array of the list, since during validation the childNodeEntries // may be modified if upon NodeEntry.getItemState the entry gets removed. - Object[] arr = namedEntries.toArray(); + NodeEntry[] arr = namedEntries.toArray(new NodeEntry[namedEntries.size()]); for (int i = 0; i < arr.length; i++) { - NodeEntry cne = (NodeEntry) arr[i]; + NodeEntry cne = arr[i]; if (EntryValidation.isValidNodeEntry(cne)) { entries.add(cne); } @@ -665,14 +665,14 @@ /** * @see NodeEntry#setNodeEntries(Iterator) */ - public void setNodeEntries(Iterator childInfos) throws RepositoryException { + public void setNodeEntries(Iterator childInfos) throws RepositoryException { if (childNodeAttic.isEmpty()) { ((ChildNodeEntriesImpl) childNodeEntries).update(childInfos); } else { // filter those entries that have been moved to the attic. - List remaining = new ArrayList(); + List remaining = new ArrayList(); while (childInfos.hasNext()) { - ChildInfo ci = (ChildInfo) childInfos.next(); + ChildInfo ci = childInfos.next(); if (!childNodeAttic.contains(ci.getName(), ci.getIndex(), ci.getUniqueID())) { remaining.add(ci); } @@ -739,11 +739,11 @@ * @inheritDoc * @see NodeEntry#getPropertyEntries() */ - public synchronized Iterator getPropertyEntries() { - Collection props; + public synchronized Iterator getPropertyEntries() { + Collection props; if (getStatus() == Status.EXISTING_MODIFIED) { // filter out removed properties - props = new ArrayList(); + props = new ArrayList(); // use array since upon validation the entry might be removed. Object[] arr = properties.getPropertyEntries().toArray(); for (int i = 0; i < arr.length; i++) { @@ -775,19 +775,19 @@ /** * @see NodeEntry#setPropertyEntries(Collection) */ - public void setPropertyEntries(Collection propNames) throws ItemExistsException, RepositoryException { - Set diff = new HashSet(); + public void setPropertyEntries(Collection propNames) throws ItemExistsException, RepositoryException { + Set diff = new HashSet(); diff.addAll(properties.getPropertyNames()); boolean containsExtra = diff.removeAll(propNames); // add all entries that are missing - for (Iterator it = propNames.iterator(); it.hasNext();) { - Name propName = (Name) it.next(); + for (Iterator it = propNames.iterator(); it.hasNext();) { + Name propName = it.next(); if (!properties.contains(propName)) { // TODO: check again. // setPropertyEntries is used by WorkspaceItemStateFactory upon // creating a NodeState, in which case the uuid/mixins are set - // anyway and not need exists to explicitely load the corresponding + // anyway and not need exists to explicitly load the corresponding // property state in order to retrieve the values. internalAddPropertyEntry(propName, false); } @@ -798,8 +798,8 @@ // collection of property names are removed from this NodeEntry. ItemState state = internalGetItemState(); if (containsExtra && (state == null || state.getStatus() == Status.INVALIDATED)) { - for (Iterator it = diff.iterator(); it.hasNext();) { - Name propName = (Name) it.next(); + for (Iterator it = diff.iterator(); it.hasNext();) { + Name propName = it.next(); PropertyEntry pEntry = properties.get(propName); if (pEntry != null) { pEntry.remove(); @@ -1089,7 +1089,7 @@ } } else { Name propName = childEntry.getName(); - PropertyEntry atticEntry = (PropertyEntry) propertiesInAttic.get(propName); + PropertyEntry atticEntry = propertiesInAttic.get(propName); if (atticEntry == null) { properties.remove((PropertyEntry) childEntry); } else if (atticEntry == childEntry) { @@ -1116,8 +1116,8 @@ if (recursive) { // invalidate all child entries including properties present in the // attic (removed props shadowed by a new property with the same name). - for (Iterator it = getAllChildEntries(true); it.hasNext();) { - HierarchyEntry ce = (HierarchyEntry) it.next(); + for (Iterator it = getAllChildEntries(true); it.hasNext();) { + HierarchyEntry ce = it.next(); ce.invalidate(true); } } @@ -1251,7 +1251,7 @@ // for external prop-removal the attic must be consulted first // in order not access a NEW prop shadowing a transiently removed // property with the same name. - PropertyEntry child = (PropertyEntry) propertiesInAttic.get(childName); + PropertyEntry child = propertiesInAttic.get(childName); if (child == null) { child = properties.get(childName); } @@ -1326,16 +1326,16 @@ * @return iterator over all children entries, that currently are loaded * with this NodeEntry */ - private Iterator getAllChildEntries(boolean includeAttic) { + private Iterator getAllChildEntries(boolean includeAttic) { IteratorChain chain = new IteratorChain(); // attic if (includeAttic) { - Collection attic = propertiesInAttic.values(); - chain.addIterator(new ArrayList(attic).iterator()); + Collection attic = propertiesInAttic.values(); + chain.addIterator(new ArrayList(attic).iterator()); } // add props synchronized (properties) { - Collection props = properties.getPropertyEntries(); + Collection props = properties.getPropertyEntries(); chain.addIterator(props.iterator()); } // add childNodeEntries @@ -1355,12 +1355,12 @@ * this NodeEntry. */ private int getChildIndex(NodeEntry cne, boolean wspIndex) throws ItemNotFoundException, RepositoryException { - List sns = new ArrayList(childNodeEntries.get(cne.getName())); + List sns = new ArrayList(childNodeEntries.get(cne.getName())); if (wspIndex) { - List atticSiblings = childNodeAttic.get(cne.getName()); - for (Iterator it = atticSiblings.iterator(); it.hasNext();) { - NodeEntryImpl sibl = (NodeEntryImpl) it.next(); + List atticSiblings = childNodeAttic.get(cne.getName()); + for (Iterator it = atticSiblings.iterator(); it.hasNext();) { + NodeEntryImpl sibl = it.next(); if (sibl.revertInfo != null) { sns.add(sibl.revertInfo.oldIndex - 1, sibl); } else { @@ -1383,8 +1383,8 @@ } else { // siblings exist. int index = Path.INDEX_DEFAULT; - for (Iterator it = sns.iterator(); it.hasNext(); ) { - NodeEntry entry = (NodeEntry) it.next(); + for (Iterator it = sns.iterator(); it.hasNext(); ) { + NodeEntry entry = it.next(); if (entry == cne) { // TODO see below return index; } @@ -1418,7 +1418,7 @@ * matches the given name/index or if the siblings list contain a reordered * entry that matches. */ - private boolean containsAtticChild(List siblings, Name childName, int childIndex) { + private boolean containsAtticChild(List siblings, Name childName, int childIndex) { // check if a matching entry exists in the attic if (childNodeAttic.contains(childName, childIndex)) { return true; @@ -1426,15 +1426,15 @@ // special treatment for potentially moved/reordered/removed sns // TODO: check again if (childIndex > Path.INDEX_DEFAULT) { - List siblingsInAttic = childNodeAttic.get(childName); + List siblingsInAttic = childNodeAttic.get(childName); if (siblings.size() < childIndex && childIndex <= siblings.size() + siblingsInAttic.size()) { return true; } } if (getStatus() == Status.EXISTING_MODIFIED) { - for (Iterator it = siblings.iterator(); it.hasNext();) { - NodeEntryImpl child = (NodeEntryImpl) it.next(); - if (!EntryValidation.isValidNodeEntry(child) || (child.revertInfo != null && child.revertInfo.oldIndex == childIndex)) { + for (Iterator it = siblings.iterator(); it.hasNext();) { + NodeEntry child = it.next(); + if (!EntryValidation.isValidNodeEntry(child) || ((NodeEntryImpl)child).revertInfo != null && ((NodeEntryImpl)child).revertInfo.oldIndex == childIndex) { return true; } } @@ -1456,8 +1456,8 @@ throw new IllegalArgumentException(); } - for (Iterator it = operation.getAddedStates().iterator(); it.hasNext();) { - HierarchyEntry he = ((ItemState) it.next()).getHierarchyEntry(); + for (Iterator it = operation.getAddedStates().iterator(); it.hasNext();) { + HierarchyEntry he = it.next().getHierarchyEntry(); if (he.getStatus() == Status.NEW) { switch (operation.getStatus()) { case Operation.STATUS_PERSISTED: @@ -1515,7 +1515,7 @@ if (!rmEntry.denotesNode()) { Name propName = rmEntry.getName(); if (propertiesInAttic.containsKey(propName)) { - properties.add((PropertyEntry) propertiesInAttic.remove(propName)); + properties.add(propertiesInAttic.remove(propName)); } // else: propEntry has never been moved to the attic (see 'addPropertyEntry') } rmEntry.revert(); Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java?rev=827966&r1=827965&r2=827966&view=diff ============================================================================== --- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java (original) +++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java Wed Oct 21 11:38:31 2009 @@ -44,7 +44,7 @@ /** * Maps a String uniqueID to a {@link NodeEntry}. */ - private final Map lookUp; + private final Map lookUp; /** * Creates a new UniqueIdResolver. @@ -64,7 +64,7 @@ if (uniqueId == null) { throw new IllegalArgumentException(); } - return (NodeEntry) lookUp.get(uniqueId); + return lookUp.get(uniqueId); } public NodeEntry resolve(NodeId nodeId, NodeEntry rootEntry) throws ItemNotFoundException, RepositoryException { @@ -94,7 +94,7 @@ NodeEntry entry = (NodeEntry) state.getHierarchyEntry(); String uniqueID = entry.getUniqueID(); if (uniqueID != null) { - NodeEntry mapEntry = (NodeEntry) lookUp.get(uniqueID); + NodeEntry mapEntry = lookUp.get(uniqueID); if (mapEntry == entry) { lookUp.remove(uniqueID); } // else: removed entry is not present in lookup but @@ -167,7 +167,7 @@ // some other entry existed before with the same uniqueID if (!sameEntry((NodeEntry) previous, entry)) { // if the new entry represents the externally moved/renamed - // correspondance of the previous the latter needs to marked + // correspondence of the previous the latter needs to marked // removed/stale-destroyed. // otherwise (both represent the same entry) the creation // of entry is the result of gc of the node or any of the Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java?rev=827966&r1=827965&r2=827966&view=diff ============================================================================== --- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java (original) +++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java Wed Oct 21 11:38:31 2009 @@ -76,16 +76,16 @@ * only if a lock ends his life by {@link Node#unlock()} or by implicit * unlock upon {@link Session#logout()}. */ - private final Map lockMap; + private final Map lockMap; public LockManagerImpl(WorkspaceManager wspManager, ItemManager itemManager, CacheBehaviour cacheBehaviour) { this.wspManager = wspManager; this.itemManager = itemManager; this.cacheBehaviour = cacheBehaviour; - // use hard references in order to make sure, that entries refering + // use hard references in order to make sure, that entries referring // to locks created by the current session are not removed. - lockMap = new HashMap(); + lockMap = new HashMap(); } //----------------< org.apache.jackrabbit.jcr2spi.lock.LockStateManager >--- @@ -129,11 +129,11 @@ Operation op = LockRelease.create(nodeState); wspManager.execute(op); - // if unlock was successfull: clean up lock map and lock life cycle + // if unlock was successful: clean up lock map and lock life cycle // in case the corresponding Lock object exists (and thus has been // added to the map. if (lockMap.containsKey(nodeState)) { - LockImpl l = (LockImpl) lockMap.remove(nodeState); + LockImpl l = lockMap.remove(nodeState); l.lockState.unlocked(); } } @@ -220,14 +220,14 @@ */ public void removeLockToken(String lt) throws LockException, RepositoryException { // JSR170 v. 1.0.1 defines that the token of a session-scoped lock may - // not be moved over to another session. thus removal ist not possible + // not be moved over to another session. Thus removal is not possible // and the lock is always present in the lock map. - Iterator it = lockMap.values().iterator(); + Iterator it = lockMap.values().iterator(); boolean found = false; // loop over cached locks to determine if the token belongs to a session // scoped lock, in which case the removal must fail immediately. while (it.hasNext() && !found) { - LockImpl l = (LockImpl) it.next(); + LockImpl l = it.next(); if (lt.equals(l.getLockToken())) { // break as soon as the lock associated with the given token was found. found = true; @@ -250,10 +250,10 @@ */ public void loggingOut(Session session) { // remove any session scoped locks: - NodeState[] lhStates = (NodeState[]) lockMap.keySet().toArray(new NodeState[lockMap.size()]); + NodeState[] lhStates = lockMap.keySet().toArray(new NodeState[lockMap.size()]); for (int i = 0; i < lhStates.length; i++) { NodeState nState = lhStates[i]; - LockImpl l = (LockImpl) lockMap.get(nState); + LockImpl l = lockMap.get(nState); if (l.isSessionScoped() && l.isLockOwningSession()) { try { unlock(nState); @@ -271,7 +271,7 @@ */ public void loggedOut(Session session) { // release all remaining locks without modifying their lock status - LockImpl[] locks = (LockImpl[]) lockMap.values().toArray(new LockImpl[lockMap.size()]); + LockImpl[] locks = lockMap.values().toArray(new LockImpl[lockMap.size()]); for (int i = 0; i < locks.length; i++) { locks[i].lockState.release(); } @@ -285,7 +285,7 @@ * Note, that this methods does NOT check if the given node state would * be affected by the lock present on an ancestor state. * Note, that in certain cases it might not be possible to detect a lock - * being present due to the fact that the hierarchy might be imcomplete or + * being present due to the fact that the hierarchy might be incomplete or * not even readable completely. For this reason it seem equally reasonable * to search for jcr:lockIsDeep property only and omitting all kind of * verification regarding nodetypes present. @@ -419,7 +419,7 @@ private LockImpl getLockFromMap(NodeState nodeState) { try { - LockImpl l = (LockImpl) lockMap.get(nodeState); + LockImpl l = lockMap.get(nodeState); if (l != null && l.isLive()) { return l; } @@ -439,7 +439,7 @@ * @throws RepositoryException */ private void notifyTokenAdded(String lt) throws RepositoryException { - LockTokenListener[] listeners = (LockTokenListener[]) lockMap.values().toArray(new LockTokenListener[lockMap.size()]); + LockTokenListener[] listeners = lockMap.values().toArray(new LockTokenListener[lockMap.size()]); for (int i = 0; i < listeners.length; i++) { listeners[i].lockTokenAdded(lt); } @@ -453,7 +453,7 @@ * @throws RepositoryException */ private void notifyTokenRemoved(String lt) throws RepositoryException { - LockTokenListener[] listeners = (LockTokenListener[]) lockMap.values().toArray(new LockTokenListener[lockMap.size()]); + LockTokenListener[] listeners = lockMap.values().toArray(new LockTokenListener[lockMap.size()]); for (int i = 0; i < listeners.length; i++) { listeners[i].lockTokenRemoved(lt); } @@ -798,7 +798,7 @@ // unless this lock is session-scoped (token is never transfered) // and the session isn't the owner yet (token already present), // it could be that this affects this lock and session became - // lock holder -> releoad info to assert. + // lock holder -> reload info to assert. lockState.reloadLockInfo(); } } Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java?rev=827966&r1=827965&r2=827966&view=diff ============================================================================== --- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java (original) +++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java Wed Oct 21 11:38:31 2009 @@ -16,15 +16,13 @@ */ package org.apache.jackrabbit.jcr2spi.nodetype; -import org.apache.jackrabbit.spi.Name; - -import java.util.TreeSet; -import java.util.HashMap; -import java.util.Iterator; -import java.util.ArrayList; import java.io.PrintStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.TreeSet; +import java.util.concurrent.ConcurrentHashMap; -import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap; +import org.apache.jackrabbit.spi.Name; /** * Implements an effective node type cache that uses a bit set for storing the @@ -50,12 +48,12 @@ /** * An ordered set of the keys. This is used for {@link #findBest(Key)}. */ - private final TreeSet sortedKeys; + private final TreeSet sortedKeys; /** * cache of pre-built aggregations of node types */ - private final HashMap aggregates; + private final HashMap aggregates; /** * A lookup table for bit numbers for a given name. @@ -64,7 +62,7 @@ * be stored in the node type registry since only registered node type names * are allowed in the keys. */ - private final ConcurrentReaderHashMap nameIndex = new ConcurrentReaderHashMap(); + private final ConcurrentHashMap nameIndex = new ConcurrentHashMap(); /** * The reverse lookup table for bit numbers to names @@ -75,8 +73,8 @@ * Creates a new bitset effective node type cache */ BitsetENTCacheImpl() { - sortedKeys = new TreeSet(); - aggregates = new HashMap(); + sortedKeys = new TreeSet(); + aggregates = new HashMap(); } //---------------------------------------------< EffectiveNodeTypeCache >--- @@ -110,9 +108,7 @@ if (contains(key)) { return key; } - Iterator iter = sortedKeys.iterator(); - while (iter.hasNext()) { - Key k = (Key) iter.next(); + for (Key k : sortedKeys) { if (key.contains(k)) { return k; } @@ -128,9 +124,8 @@ * remove all affected effective node types from aggregates cache * (copy keys first to prevent ConcurrentModificationException) */ - ArrayList keys = new ArrayList(aggregates.keySet()); - for (Iterator keysIter = keys.iterator(); keysIter.hasNext();) { - Key k = (Key) keysIter.next(); + ArrayList keys = new ArrayList(aggregates.keySet()); + for (Key k : keys) { EffectiveNodeType ent = get(k); if (ent.includesNodeType(name)) { remove(k); @@ -149,7 +144,7 @@ * @see EffectiveNodeTypeCache#get(Key) */ public EffectiveNodeType get(Key key) { - return (EffectiveNodeType) aggregates.get(key); + return aggregates.get(key); } /** @@ -170,13 +165,13 @@ * @return the bit number for the given name */ private int getBitNumber(Name name) { - Integer i = (Integer) nameIndex.get(name); + Integer i = nameIndex.get(name); if (i == null) { synchronized (nameIndex) { - i = (Integer) nameIndex.get(name); + i = nameIndex.get(name); if (i == null) { int idx = nameIndex.size(); - i = new Integer(idx); + i = idx; nameIndex.put(name, i); if (idx >= names.length) { Name[] newNames = new Name[names.length*2]; @@ -187,7 +182,7 @@ } } } - return i.intValue(); + return i; } /** @@ -207,7 +202,7 @@ * never cached. */ private EffectiveNodeType remove(Key key) { - EffectiveNodeType removed = (EffectiveNodeType) aggregates.remove(key); + EffectiveNodeType removed = aggregates.remove(key); if (removed != null) { // other than the original implementation, the weights in the // treeset are now the same as in the given keys. so we can use @@ -221,6 +216,7 @@ /** * @see Cloneable#clone() */ + @Override public Object clone() { BitsetENTCacheImpl clone = new BitsetENTCacheImpl(); clone.sortedKeys.addAll(sortedKeys); @@ -240,9 +236,7 @@ ps.println(); ps.println("EffectiveNodeTypes in cache:"); ps.println(); - Iterator iter = sortedKeys.iterator(); - while (iter.hasNext()) { - Key k = (Key) iter.next(); + for (Key k : sortedKeys) { //EffectiveNodeType ent = (EffectiveNodeType) aggregates.get(k); ps.println(k); } @@ -291,7 +285,7 @@ /** * Creates new bitset key. * @param bits the array if bits - * @param numBits the number of bits that are '1' in the given bis + * @param numBits the number of bits that are '1' in the given bits */ private BitsetKey(long[] bits, int numBits) { this.bits = bits; @@ -307,7 +301,7 @@ /** * Returns the bit number of the next bit that is set, starting at - * fromIndex inclusieve. + * fromIndex inclusive. * * @param fromIndex the bit position to start the search * @return the bit position of the bit or -1 if none found. @@ -426,12 +420,12 @@ /** * {@inheritDoc} * - * This compares 1. the cardinailty (number of set bits) and 2. the - * nummeric value of the bitsets in descending order. + * This compares 1. the cardinality (number of set bits) and 2. the + * numeric value of the bitsets in descending order. * * @see Comparable#compareTo(Object) */ - public int compareTo(Object other) { + public int compareTo(Key other) { BitsetKey o = (BitsetKey) other; int res = o.names.length - names.length; if (res == 0) { @@ -459,6 +453,7 @@ /** * @see Object#equals(Object) */ + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -485,6 +480,7 @@ /** * @see Object#hashCode() */ + @Override public int hashCode() { return hashCode; } @@ -492,6 +488,7 @@ /** * @see Object#toString() */ + @Override public String toString() { StringBuffer buf = new StringBuffer("w="); buf.append(names.length); Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/DefinitionValidator.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/DefinitionValidator.java?rev=827966&r1=827965&r2=827966&view=diff ============================================================================== --- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/DefinitionValidator.java (original) +++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/DefinitionValidator.java Wed Oct 21 11:38:31 2009 @@ -35,6 +35,7 @@ import javax.jcr.nodetype.ConstraintViolationException; import javax.jcr.nodetype.InvalidNodeTypeDefinitionException; +import java.util.List; import java.util.Stack; import java.util.Map; import java.util.Collection; @@ -67,18 +68,18 @@ * @throws InvalidNodeTypeDefinitionException * @throws RepositoryException */ - public Map validateNodeTypeDefs(Collection ntDefs, Map validatedDefs) + public Map validateNodeTypeDefs(Collection ntDefs, + Map validatedDefs) throws InvalidNodeTypeDefinitionException, RepositoryException { // tmp. map containing names/defs of validated nodetypes - Map tmpMap = new HashMap(validatedDefs); - for (Iterator it = ntDefs.iterator(); it.hasNext();) { - QNodeTypeDefinition ntd = (QNodeTypeDefinition) it.next(); + Map tmpMap = new HashMap(validatedDefs); + for (QNodeTypeDefinition ntd : ntDefs) { tmpMap.put(ntd.getName(), ntd); } // map of nodetype definitions and effective nodetypes to be registered - Map ntMap = new HashMap(); - ArrayList list = new ArrayList(ntDefs); + Map ntMap = new HashMap(); + List list = new ArrayList(ntDefs); // iterate over definitions until there are no more definitions with // unresolved (i.e. unregistered) dependencies or an error occurs; @@ -86,12 +87,12 @@ int count = -1; // number of validated nt's per iteration while (list.size() > 0 && count != 0) { count = 0; - Iterator iterator = list.iterator(); + Iterator iterator = list.iterator(); while (iterator.hasNext()) { - QNodeTypeDefinition ntd = (QNodeTypeDefinition) iterator.next(); + QNodeTypeDefinition ntd = iterator.next(); // check if definition has unresolved dependencies /* Note: don't compared to 'registered' nodetypes since registr. is performed later on */ - Collection dependencies = ntd.getDependencies(); + Collection dependencies = ntd.getDependencies(); if (tmpMap.keySet().containsAll(dependencies)) { EffectiveNodeType ent = validateNodeTypeDef(ntd, tmpMap); ntMap.put(ntd, ent); @@ -105,9 +106,9 @@ if (list.size() > 0) { StringBuffer msg = new StringBuffer(); msg.append("the following node types could not be registered because of unresolvable dependencies: "); - Iterator iterator = list.iterator(); + Iterator iterator = list.iterator(); while (iterator.hasNext()) { - msg.append(((QNodeTypeDefinition) iterator.next()).getName()); + msg.append(iterator.next().getName()); msg.append(" "); } log.error(msg.toString()); @@ -126,7 +127,7 @@ * @throws InvalidNodeTypeDefinitionException * @throws RepositoryException */ - public EffectiveNodeType validateNodeTypeDef(QNodeTypeDefinition ntDef, Map validatedDefs) + public EffectiveNodeType validateNodeTypeDef(QNodeTypeDefinition ntDef, Map validatedDefs) throws InvalidNodeTypeDefinitionException, RepositoryException { /** * the effective (i.e. merged and resolved) node type resulting from @@ -173,7 +174,7 @@ * check for circularity in inheritance chain * ('a' extends 'b' extends 'a') */ - Stack inheritanceChain = new Stack(); + Stack inheritanceChain = new Stack(); inheritanceChain.push(name); checkForCircularInheritance(supertypes, inheritanceChain, validatedDefs); } @@ -353,7 +354,7 @@ * of auto-created child nodes (node type 'a' defines * auto-created child node with default primary type 'a') */ - Stack definingNTs = new Stack(); + Stack definingNTs = new Stack(); definingNTs.push(name); checkForCircularNodeAutoCreation(defaultENT, definingNTs, validatedDefs); } @@ -466,7 +467,7 @@ * @throws InvalidNodeTypeDefinitionException * @throws RepositoryException */ - private void checkForCircularInheritance(Name[] supertypes, Stack inheritanceChain, Map ntdMap) + private void checkForCircularInheritance(Name[] supertypes, Stack inheritanceChain, Map ntdMap) throws InvalidNodeTypeDefinitionException, RepositoryException { for (int i = 0; i < supertypes.length; i++) { Name stName = supertypes[i]; @@ -486,7 +487,7 @@ } if (ntdMap.containsKey(stName)) { - Name[] sta = ((QNodeTypeDefinition)ntdMap.get(stName)).getSupertypes(); + Name[] sta = ntdMap.get(stName).getSupertypes(); if (sta.length > 0) { // check recursively inheritanceChain.push(stName); @@ -507,7 +508,7 @@ * @throws InvalidNodeTypeDefinitionException */ private void checkForCircularNodeAutoCreation(EffectiveNodeType childNodeENT, - Stack definingParentNTs, Map ntdMap) + Stack definingParentNTs, Map ntdMap) throws InvalidNodeTypeDefinitionException { // check for circularity through default node types of auto-created child nodes // (node type 'a' defines auto-created child node with default node type 'a') @@ -562,7 +563,7 @@ * is registered; a null argument is silently ignored. * @param name name whose namespace is to be checked * @throws RepositoryException if the namespace of the given name is not - * registered or if an unspecified error occured + * registered or if an unspecified error occurred */ private void checkNamespace(Name name) throws RepositoryException { if (name != null) { Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeCache.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeCache.java?rev=827966&r1=827965&r2=827966&view=diff ============================================================================== --- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeCache.java (original) +++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeCache.java Wed Oct 21 11:38:31 2009 @@ -90,7 +90,7 @@ * An ENTKey uniquely identifies * a combination (i.e. an aggregation) of one or more node types. */ - interface Key extends Comparable { + interface Key extends Comparable { /** * Returns the node type names of this key. Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java?rev=827966&r1=827965&r2=827966&view=diff ============================================================================== --- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java (original) +++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java Wed Oct 21 11:38:31 2009 @@ -27,7 +27,6 @@ import javax.jcr.nodetype.ConstraintViolationException; import javax.jcr.nodetype.NoSuchNodeTypeException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.TreeSet; import java.util.Arrays; @@ -47,38 +46,35 @@ private static Logger log = LoggerFactory.getLogger(EffectiveNodeTypeImpl.class); // list of explicitly aggregated {i.e. merged) node types - private final TreeSet mergedNodeTypes = new TreeSet(); + private final TreeSet mergedNodeTypes = new TreeSet(); // list of implicitly aggregated {through inheritance) node types - private final TreeSet inheritedNodeTypes = new TreeSet(); + private final TreeSet inheritedNodeTypes = new TreeSet(); // list of all either explicitly (through aggregation) or implicitly // (through inheritance) included node types. - private final TreeSet allNodeTypes = new TreeSet(); + private final TreeSet allNodeTypes = new TreeSet(); // map of named item definitions (maps name to list of definitions) - private final Map namedItemDefs = new HashMap(); + private final Map> namedItemDefs = new HashMap>(); // list of unnamed item definitions (i.e. residual definitions) - private final List unnamedItemDefs = new ArrayList(); + private final List unnamedItemDefs = new ArrayList(); // (optional) set of additional mixins supported on node type - private Set supportedMixins; + private Set supportedMixins; /** * constructor. */ - EffectiveNodeTypeImpl(TreeSet mergedNodeTypes, TreeSet inheritedNodeTypes, - TreeSet allNodeTypes, Map namedItemDefs, - List unnamedItemDefs, Set supportedMixins) { + EffectiveNodeTypeImpl(TreeSet mergedNodeTypes, TreeSet inheritedNodeTypes, + TreeSet allNodeTypes, Map> namedItemDefs, + List unnamedItemDefs, Set supportedMixins) { this.mergedNodeTypes.addAll(mergedNodeTypes); this.inheritedNodeTypes.addAll(inheritedNodeTypes); this.allNodeTypes.addAll(allNodeTypes); - Iterator iter = namedItemDefs.keySet().iterator(); - while (iter.hasNext()) { - Object key = iter.next(); - List list = (List) namedItemDefs.get(key); - this.namedItemDefs.put(key, new ArrayList(list)); + for (Map.Entry> entry : namedItemDefs.entrySet()) { + this.namedItemDefs.put(entry.getKey(), new ArrayList(entry.getValue())); } this.unnamedItemDefs.addAll(unnamedItemDefs); if (supportedMixins != null) { - this.supportedMixins = new HashSet(); + this.supportedMixins = new HashSet(); this.supportedMixins.addAll(supportedMixins); } } @@ -88,21 +84,21 @@ * @see EffectiveNodeType#getInheritedNodeTypes() */ public Name[] getInheritedNodeTypes() { - return (Name[]) inheritedNodeTypes.toArray(new Name[inheritedNodeTypes.size()]); + return inheritedNodeTypes.toArray(new Name[inheritedNodeTypes.size()]); } /** * @see EffectiveNodeType#getAllNodeTypes() */ public Name[] getAllNodeTypes() { - return (Name[]) allNodeTypes.toArray(new Name[allNodeTypes.size()]); + return allNodeTypes.toArray(new Name[allNodeTypes.size()]); } /** * @see EffectiveNodeType#getMergedNodeTypes() */ public Name[] getMergedNodeTypes() { - return (Name[]) mergedNodeTypes.toArray(new Name[mergedNodeTypes.size()]); + return mergedNodeTypes.toArray(new Name[mergedNodeTypes.size()]); } /** @@ -112,20 +108,15 @@ if (namedItemDefs.size() == 0 && unnamedItemDefs.size() == 0) { return QNodeDefinition.EMPTY_ARRAY; } - ArrayList defs = new ArrayList(namedItemDefs.size() + unnamedItemDefs.size()); - Iterator iter = unnamedItemDefs.iterator(); - while (iter.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter.next(); + ArrayList defs = new ArrayList(namedItemDefs.size() + unnamedItemDefs.size()); + for (QItemDefinition qDef : unnamedItemDefs) { if (qDef.definesNode()) { defs.add(qDef); } } - iter = namedItemDefs.values().iterator(); - while (iter.hasNext()) { - List list = (List) iter.next(); - Iterator iter1 = list.iterator(); - while (iter1.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter1.next(); + + for (List list : namedItemDefs.values()) { + for (QItemDefinition qDef : list) { if (qDef.definesNode()) { defs.add(qDef); } @@ -134,7 +125,7 @@ if (defs.size() == 0) { return QNodeDefinition.EMPTY_ARRAY; } - return (QNodeDefinition[]) defs.toArray(new QNodeDefinition[defs.size()]); + return defs.toArray(new QNodeDefinition[defs.size()]); } /** @@ -144,20 +135,14 @@ if (namedItemDefs.size() == 0 && unnamedItemDefs.size() == 0) { return QPropertyDefinition.EMPTY_ARRAY; } - ArrayList defs = new ArrayList(namedItemDefs.size() + unnamedItemDefs.size()); - Iterator iter = unnamedItemDefs.iterator(); - while (iter.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter.next(); + ArrayList defs = new ArrayList(namedItemDefs.size() + unnamedItemDefs.size()); + for (QItemDefinition qDef : unnamedItemDefs) { if (!qDef.definesNode()) { defs.add(qDef); } } - iter = namedItemDefs.values().iterator(); - while (iter.hasNext()) { - List list = (List) iter.next(); - Iterator iter1 = list.iterator(); - while (iter1.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter1.next(); + for (List list : namedItemDefs.values()) { + for (QItemDefinition qDef : list) { if (!qDef.definesNode()) { defs.add(qDef); } @@ -166,7 +151,7 @@ if (defs.size() == 0) { return QPropertyDefinition.EMPTY_ARRAY; } - return (QPropertyDefinition[]) defs.toArray(new QPropertyDefinition[defs.size()]); + return defs.toArray(new QPropertyDefinition[defs.size()]); } /** @@ -178,13 +163,9 @@ if (namedItemDefs.size() == 0) { return QNodeDefinition.EMPTY_ARRAY; } - ArrayList defs = new ArrayList(namedItemDefs.size()); - Iterator iter = namedItemDefs.values().iterator(); - while (iter.hasNext()) { - List list = (List) iter.next(); - Iterator iter1 = list.iterator(); - while (iter1.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter1.next(); + ArrayList defs = new ArrayList(namedItemDefs.size()); + for (List list : namedItemDefs.values()) { + for (QItemDefinition qDef : list) { if (qDef.definesNode() && qDef.isAutoCreated()) { defs.add(qDef); } @@ -193,7 +174,7 @@ if (defs.size() == 0) { return QNodeDefinition.EMPTY_ARRAY; } - return (QNodeDefinition[]) defs.toArray(new QNodeDefinition[defs.size()]); + return defs.toArray(new QNodeDefinition[defs.size()]); } /** @@ -205,13 +186,9 @@ if (namedItemDefs.size() == 0) { return QPropertyDefinition.EMPTY_ARRAY; } - ArrayList defs = new ArrayList(namedItemDefs.size()); - Iterator iter = namedItemDefs.values().iterator(); - while (iter.hasNext()) { - List list = (List) iter.next(); - Iterator iter1 = list.iterator(); - while (iter1.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter1.next(); + ArrayList defs = new ArrayList(namedItemDefs.size()); + for (List list : namedItemDefs.values()) { + for (QItemDefinition qDef : list) { if (!qDef.definesNode() && qDef.isAutoCreated()) { defs.add(qDef); } @@ -220,7 +197,7 @@ if (defs.size() == 0) { return QPropertyDefinition.EMPTY_ARRAY; } - return (QPropertyDefinition[]) defs.toArray(new QPropertyDefinition[defs.size()]); + return defs.toArray(new QPropertyDefinition[defs.size()]); } /** @@ -232,13 +209,9 @@ if (namedItemDefs.size() == 0) { return QPropertyDefinition.EMPTY_ARRAY; } - ArrayList defs = new ArrayList(namedItemDefs.size()); - Iterator iter = namedItemDefs.values().iterator(); - while (iter.hasNext()) { - List list = (List) iter.next(); - Iterator iter1 = list.iterator(); - while (iter1.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter1.next(); + ArrayList defs = new ArrayList(namedItemDefs.size()); + for (List list : namedItemDefs.values()) { + for (QItemDefinition qDef : list) { if (!qDef.definesNode() && qDef.isMandatory()) { defs.add(qDef); } @@ -247,7 +220,7 @@ if (defs.size() == 0) { return QPropertyDefinition.EMPTY_ARRAY; } - return (QPropertyDefinition[]) defs.toArray(new QPropertyDefinition[defs.size()]); + return defs.toArray(new QPropertyDefinition[defs.size()]); } /** @@ -259,13 +232,9 @@ if (namedItemDefs.size() == 0) { return QNodeDefinition.EMPTY_ARRAY; } - ArrayList defs = new ArrayList(namedItemDefs.size()); - Iterator iter = namedItemDefs.values().iterator(); - while (iter.hasNext()) { - List list = (List) iter.next(); - Iterator iter1 = list.iterator(); - while (iter1.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter1.next(); + ArrayList defs = new ArrayList(namedItemDefs.size()); + for (List list : namedItemDefs.values()) { + for (QItemDefinition qDef : list) { if (qDef.definesNode() && qDef.isMandatory()) { defs.add(qDef); } @@ -274,21 +243,19 @@ if (defs.size() == 0) { return QNodeDefinition.EMPTY_ARRAY; } - return (QNodeDefinition[]) defs.toArray(new QNodeDefinition[defs.size()]); + return defs.toArray(new QNodeDefinition[defs.size()]); } /** * @see EffectiveNodeType#getNamedQNodeDefinitions(Name) */ public QNodeDefinition[] getNamedQNodeDefinitions(Name name) { - List list = (List) namedItemDefs.get(name); + List list = namedItemDefs.get(name); if (list == null || list.size() == 0) { return QNodeDefinition.EMPTY_ARRAY; } - ArrayList defs = new ArrayList(list.size()); - Iterator iter = list.iterator(); - while (iter.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter.next(); + ArrayList defs = new ArrayList(list.size()); + for (QItemDefinition qDef : list) { if (qDef.definesNode()) { defs.add(qDef); } @@ -296,7 +263,7 @@ if (defs.size() == 0) { return QNodeDefinition.EMPTY_ARRAY; } - return (QNodeDefinition[]) defs.toArray(new QNodeDefinition[defs.size()]); + return defs.toArray(new QNodeDefinition[defs.size()]); } /** @@ -306,10 +273,8 @@ if (unnamedItemDefs.size() == 0) { return QNodeDefinition.EMPTY_ARRAY; } - ArrayList defs = new ArrayList(unnamedItemDefs.size()); - Iterator iter = unnamedItemDefs.iterator(); - while (iter.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter.next(); + ArrayList defs = new ArrayList(unnamedItemDefs.size()); + for (QItemDefinition qDef : unnamedItemDefs) { if (qDef.definesNode()) { defs.add(qDef); } @@ -317,21 +282,19 @@ if (defs.size() == 0) { return QNodeDefinition.EMPTY_ARRAY; } - return (QNodeDefinition[]) defs.toArray(new QNodeDefinition[defs.size()]); + return defs.toArray(new QNodeDefinition[defs.size()]); } /** * @see EffectiveNodeType#getNamedQPropertyDefinitions(Name) */ public QPropertyDefinition[] getNamedQPropertyDefinitions(Name name) { - List list = (List) namedItemDefs.get(name); + List list = namedItemDefs.get(name); if (list == null || list.size() == 0) { return QPropertyDefinition.EMPTY_ARRAY; } - ArrayList defs = new ArrayList(list.size()); - Iterator iter = list.iterator(); - while (iter.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter.next(); + ArrayList defs = new ArrayList(list.size()); + for (QItemDefinition qDef : list) { if (!qDef.definesNode()) { defs.add(qDef); } @@ -339,7 +302,7 @@ if (defs.size() == 0) { return QPropertyDefinition.EMPTY_ARRAY; } - return (QPropertyDefinition[]) defs.toArray(new QPropertyDefinition[defs.size()]); + return defs.toArray(new QPropertyDefinition[defs.size()]); } /** @@ -349,10 +312,8 @@ if (unnamedItemDefs.size() == 0) { return QPropertyDefinition.EMPTY_ARRAY; } - ArrayList defs = new ArrayList(unnamedItemDefs.size()); - Iterator iter = unnamedItemDefs.iterator(); - while (iter.hasNext()) { - QItemDefinition qDef = (QItemDefinition) iter.next(); + ArrayList defs = new ArrayList(unnamedItemDefs.size()); + for (QItemDefinition qDef : unnamedItemDefs) { if (!qDef.definesNode()) { defs.add(qDef); } @@ -360,7 +321,7 @@ if (defs.size() == 0) { return QPropertyDefinition.EMPTY_ARRAY; } - return (QPropertyDefinition[]) defs.toArray(new QPropertyDefinition[defs.size()]); + return defs.toArray(new QPropertyDefinition[defs.size()]); } /** @@ -490,30 +451,29 @@ if (namedItemDefs.size() == 0) { return QItemDefinition.EMPTY_ARRAY; } - ArrayList defs = new ArrayList(namedItemDefs.size()); - Iterator iter = namedItemDefs.values().iterator(); - while (iter.hasNext()) { - defs.addAll((List) iter.next()); + ArrayList defs = new ArrayList(namedItemDefs.size()); + for (List list : namedItemDefs.values()) { + defs.addAll(list); } if (defs.size() == 0) { return QItemDefinition.EMPTY_ARRAY; } - return (QItemDefinition[]) defs.toArray(new QItemDefinition[defs.size()]); + return defs.toArray(new QItemDefinition[defs.size()]); } private QItemDefinition[] getNamedItemDefs(Name name) { - List list = (List) namedItemDefs.get(name); + List list = namedItemDefs.get(name); if (list == null || list.size() == 0) { return QNodeDefinition.EMPTY_ARRAY; } - return (QItemDefinition[]) list.toArray(new QItemDefinition[list.size()]); + return list.toArray(new QItemDefinition[list.size()]); } private QItemDefinition[] getUnnamedItemDefs() { if (unnamedItemDefs.size() == 0) { return QItemDefinition.EMPTY_ARRAY; } - return (QItemDefinition[]) unnamedItemDefs.toArray(new QItemDefinition[unnamedItemDefs.size()]); + return unnamedItemDefs.toArray(new QItemDefinition[unnamedItemDefs.size()]); } /** @@ -527,7 +487,7 @@ EffectiveNodeTypeImpl merge(EffectiveNodeTypeImpl other) throws ConstraintViolationException { // create a clone of this instance and perform the merge on - // the 'clone' to avoid a potentially inconsistant state + // the 'clone' to avoid a potentially inconsistent state // of this instance if an exception is thrown during // the merge. EffectiveNodeTypeImpl copy = (EffectiveNodeTypeImpl) clone(); @@ -573,12 +533,12 @@ continue; } Name name = qDef.getName(); - List existingDefs = (List) namedItemDefs.get(name); + List existingDefs = namedItemDefs.get(name); if (existingDefs != null) { if (existingDefs.size() > 0) { // there already exists at least one definition with that name for (int j = 0; j < existingDefs.size(); j++) { - QItemDefinition qItemDef = (QItemDefinition) existingDefs.get(j); + QItemDefinition qItemDef = existingDefs.get(j); // make sure none of them is auto-create if (qDef.isAutoCreated() || qItemDef.isAutoCreated()) { // conflict @@ -628,7 +588,7 @@ } } } else { - existingDefs = new ArrayList(); + existingDefs = new ArrayList(); namedItemDefs.put(name, existingDefs); } existingDefs.add(qDef); @@ -642,9 +602,7 @@ // ignore redundant definitions continue; } - Iterator iter = unnamedItemDefs.iterator(); - while (iter.hasNext()) { - QItemDefinition existing = (QItemDefinition) iter.next(); + for (QItemDefinition existing : unnamedItemDefs) { // compare with existing definition if (qDef.definesNode() == existing.definesNode()) { if (!qDef.definesNode()) { Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeProvider.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeProvider.java?rev=827966&r1=827965&r2=827966&view=diff ============================================================================== --- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeProvider.java (original) +++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeProvider.java Wed Oct 21 11:38:31 2009 @@ -58,7 +58,7 @@ * @throws ConstraintViolationException * @throws NoSuchNodeTypeException */ - public EffectiveNodeType getEffectiveNodeType(Name[] ntNames, Map ntdMap) + public EffectiveNodeType getEffectiveNodeType(Name[] ntNames, Map ntdMap) throws ConstraintViolationException, NoSuchNodeTypeException; /** @@ -74,6 +74,6 @@ * @throws NoSuchNodeTypeException */ public EffectiveNodeType getEffectiveNodeType(QNodeTypeDefinition ntd, - Map ntdMap) + Map ntdMap) throws ConstraintViolationException, NoSuchNodeTypeException; } Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java?rev=827966&r1=827965&r2=827966&view=diff ============================================================================== --- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java (original) +++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java Wed Oct 21 11:38:31 2009 @@ -40,12 +40,12 @@ /** * The caches per repository service instance */ - private static final Map CACHES_PER_SERVICE = new WeakHashMap(); + private static final Map> CACHES_PER_SERVICE = new WeakHashMap>(); /** * Maps node type Names to QNodeTypeDefinition */ - private final Map nodeTypes = new HashMap(); + private final Map nodeTypes = new HashMap(); /** * @param service the repository service. @@ -59,9 +59,9 @@ if (userId == null) { return new NodeTypeCache(); } - Map caches; + Map caches; synchronized (CACHES_PER_SERVICE) { - caches = (Map) CACHES_PER_SERVICE.get(service); + caches = CACHES_PER_SERVICE.get(service); if (caches == null) { // use soft references for the node type caches caches = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT); @@ -69,7 +69,7 @@ } } synchronized (caches) { - NodeTypeCache cache = (NodeTypeCache) caches.get(userId); + NodeTypeCache cache = caches.get(userId); if (cache == null) { cache = new NodeTypeCache(); caches.put(userId, cache); @@ -87,11 +87,11 @@ * @return * @throws javax.jcr.RepositoryException */ - public Iterator getAllDefinitions(NodeTypeStorage storage) + public Iterator getAllDefinitions(NodeTypeStorage storage) throws RepositoryException { - Map allNts = new HashMap(); - for (Iterator it = storage.getAllDefinitions(); it.hasNext(); ) { - QNodeTypeDefinition def = (QNodeTypeDefinition) it.next(); + Map allNts = new HashMap(); + for (Iterator it = storage.getAllDefinitions(); it.hasNext(); ) { + QNodeTypeDefinition def = it.next(); allNts.put(def.getName(), def); } // update the cache @@ -112,16 +112,16 @@ * @throws javax.jcr.nodetype.NoSuchNodeTypeException * @throws RepositoryException */ - public Iterator getDefinitions(NodeTypeStorage storage, Name[] nodeTypeNames) + public Iterator getDefinitions(NodeTypeStorage storage, Name[] nodeTypeNames) throws NoSuchNodeTypeException, RepositoryException { - List nts = new ArrayList(); - List missing = null; + List nts = new ArrayList(); + List missing = null; synchronized (nodeTypes) { for (int i = 0; i < nodeTypeNames.length; i++) { - QNodeTypeDefinition def = (QNodeTypeDefinition) nodeTypes.get(nodeTypeNames[i]); + QNodeTypeDefinition def = nodeTypes.get(nodeTypeNames[i]); if (def == null) { if (missing == null) { - missing = new ArrayList(); + missing = new ArrayList(); } missing.add(nodeTypeNames[i]); } else { @@ -130,11 +130,11 @@ } } if (missing != null) { - Name[] ntNames = (Name[]) missing.toArray(new Name[missing.size()]); - Iterator it = storage.getDefinitions(ntNames); + Name[] ntNames = missing.toArray(new Name[missing.size()]); + Iterator it = storage.getDefinitions(ntNames); synchronized (nodeTypes) { while (it.hasNext()) { - QNodeTypeDefinition def = (QNodeTypeDefinition) it.next(); + QNodeTypeDefinition def = it.next(); nts.add(def); nodeTypes.put(def.getName(), def); } @@ -166,10 +166,10 @@ */ public NodeTypeStorage wrap(final NodeTypeStorage storage) { return new NodeTypeStorage() { - public Iterator getAllDefinitions() throws RepositoryException { + public Iterator getAllDefinitions() throws RepositoryException { return NodeTypeCache.this.getAllDefinitions(storage); } - public Iterator getDefinitions(Name[] nodeTypeNames) + public Iterator getDefinitions(Name[] nodeTypeNames) throws NoSuchNodeTypeException, RepositoryException { return NodeTypeCache.this.getDefinitions(storage, nodeTypeNames); } Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java?rev=827966&r1=827965&r2=827966&view=diff ============================================================================== --- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java (original) +++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java Wed Oct 21 11:38:31 2009 @@ -24,7 +24,6 @@ import org.apache.jackrabbit.spi.QValue; import org.apache.jackrabbit.spi.commons.conversion.NameException; import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver; -import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver; import org.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint; import org.apache.jackrabbit.spi.commons.nodetype.AbstractNodeType; import org.apache.jackrabbit.spi.commons.value.ValueFormat; @@ -32,7 +31,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.jcr.NamespaceException; import javax.jcr.PropertyType; import javax.jcr.RepositoryException; import javax.jcr.Value; @@ -51,7 +49,6 @@ private static Logger log = LoggerFactory.getLogger(NodeTypeImpl.class); - private final QNodeTypeDefinition ntd; private final EffectiveNodeType ent; private final NodeTypeManagerImpl ntMgr; private final ManagerProvider mgrProvider; @@ -70,15 +67,10 @@ */ NodeTypeImpl(EffectiveNodeType ent, QNodeTypeDefinition ntd, NodeTypeManagerImpl ntMgr, ManagerProvider mgrProvider) { - super(ntMgr); + super(ntd, ntMgr, mgrProvider.getNamePathResolver()); this.ent = ent; this.ntMgr = ntMgr; this.mgrProvider = mgrProvider; - this.ntd = ntd; - } - - private NamespaceResolver nsResolver() { - return mgrProvider.getNamespaceResolver(); } private NamePathResolver resolver() { @@ -106,30 +98,13 @@ } /** - * Test if this nodetype equals or is directly or indirectly derived from - * the node type with the specified nodeTypeName, without - * checking of a node type of that name really exists. - * - * @param nodeTypeName A node type name. - * @return true if this node type represents the type with the given - * nodeTypeName or if it is directly or indirectly derived - * from it; otherwise false. If no node type exists with the - * specified name this method will also return false. + * {@inheritDoc} */ public boolean isNodeType(Name nodeTypeName) { return ent.includesNodeType(nodeTypeName); } /** - * Returns the node type definition. - * - * @return the internal node type definition. - */ - QNodeTypeDefinition getDefinition() { - return ntd; - } - - /** * Tests if the value constraints defined in the property definition * def are satisfied by the the specified values. *

@@ -149,43 +124,6 @@ } //-------------------------------------------------< NodeTypeDefinition >--- - /** - * @see javax.jcr.nodetype.NodeTypeDefinition#getName() - */ - public String getName() { - try { - return resolver().getJCRName(ntd.getName()); - } catch (NamespaceException e) { - // should never get here - log.error("encountered unregistered namespace in node type name", e); - return ntd.getName().toString(); - } - } - - /** - * @see javax.jcr.nodetype.NodeTypeDefinition#getPrimaryItemName() - */ - public String getPrimaryItemName() { - try { - Name piName = ntd.getPrimaryItemName(); - if (piName != null) { - return resolver().getJCRName(piName); - } else { - return null; - } - } catch (NamespaceException e) { - // should never get here - log.error("encountered unregistered namespace in name of primary item", e); - return ntd.getName().toString(); - } - } - - /** - * @see javax.jcr.nodetype.NodeTypeDefinition#isMixin() - */ - public boolean isMixin() { - return ntd.isMixin(); - } /** * @see javax.jcr.nodetype.NodeTypeDefinition#hasOrderableChildNodes() @@ -194,80 +132,7 @@ return ntd.hasOrderableChildNodes(); } - /** - * @see javax.jcr.nodetype.NodeTypeDefinition#isAbstract() - */ - public boolean isAbstract() { - return ntd.isAbstract(); - } - - /** - * @see javax.jcr.nodetype.NodeTypeDefinition#isQueryable() - */ - public boolean isQueryable() { - return ntd.isQueryable(); - } - - /** - * @see javax.jcr.nodetype.NodeTypeDefinition#getDeclaredPropertyDefinitions() - */ - public PropertyDefinition[] getDeclaredPropertyDefinitions() { - QPropertyDefinition[] pda = ntd.getPropertyDefs(); - PropertyDefinition[] propDefs = new PropertyDefinition[pda.length]; - for (int i = 0; i < pda.length; i++) { - propDefs[i] = ntMgr.getPropertyDefinition(pda[i]); - } - return propDefs; - } - - - /** - * @see javax.jcr.nodetype.NodeTypeDefinition#getDeclaredChildNodeDefinitions() - */ - public NodeDefinition[] getDeclaredChildNodeDefinitions() { - QNodeDefinition[] cnda = ntd.getChildNodeDefs(); - NodeDefinition[] nodeDefs = new NodeDefinition[cnda.length]; - for (int i = 0; i < cnda.length; i++) { - nodeDefs[i] = ntMgr.getNodeDefinition(cnda[i]); - } - return nodeDefs; - } - - /** - * @see javax.jcr.nodetype.NodeTypeDefinition#getDeclaredSupertypeNames() - */ - public String[] getDeclaredSupertypeNames() { - Name[] stNames = ntd.getSupertypes(); - String[] dstn = new String[stNames.length]; - for (int i = 0; i < stNames.length; i++) { - try { - dstn[i] = resolver().getJCRName(stNames[i]); - } catch (NamespaceException e) { - // should never get here - log.error("invalid node type name: " + stNames[i], e); - dstn[i] = stNames.toString(); - } - } - return dstn; - } - //-----------------------------------------------------------< NodeType >--- - /** - * @see javax.jcr.nodetype.NodeType#isNodeType(String) - */ - public boolean isNodeType(String nodeTypeName) { - Name ntName; - try { - ntName = resolver().getQName(nodeTypeName); - } catch (NamespaceException e) { - log.warn("invalid node type name: " + nodeTypeName, e); - return false; - } catch (NameException e) { - log.warn("invalid node type name: " + nodeTypeName, e); - return false; - } - return isNodeType(ntName); - } /** * @see javax.jcr.nodetype.NodeType#getSupertypes() @@ -312,24 +177,6 @@ } /** - * @see javax.jcr.nodetype.NodeType#getDeclaredSupertypes() - */ - public NodeType[] getDeclaredSupertypes() { - Name[] ntNames = ntd.getSupertypes(); - NodeType[] supertypes = new NodeType[ntNames.length]; - for (int i = 0; i < ntNames.length; i++) { - try { - supertypes[i] = ntMgr.getNodeType(ntNames[i]); - } catch (NoSuchNodeTypeException e) { - // should never get here - log.error("undefined supertype", e); - return new NodeType[0]; - } - } - return supertypes; - } - - /** * @see javax.jcr.nodetype.NodeType#canSetProperty(String, Value) */ public boolean canSetProperty(String propertyName, Value value) { @@ -424,7 +271,7 @@ targetType = type; } - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList(); // convert values and compact array (purge null entries) for (int i = 0; i < values.length; i++) { if (values[i] != null) { @@ -435,7 +282,7 @@ list.add(qValue); } } - QValue[] internalValues = (QValue[]) list.toArray(new QValue[list.size()]); + QValue[] internalValues = list.toArray(new QValue[list.size()]); checkSetPropertyValueConstraints(def, internalValues); return true; } catch (NameException be) { Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java?rev=827966&r1=827965&r2=827966&view=diff ============================================================================== --- jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java (original) +++ jackrabbit/sandbox/JCR-1456/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java Wed Oct 21 11:38:31 2009 @@ -86,19 +86,19 @@ * A cache for NodeType instances created by this * NodeTypeManager */ - private final Map ntCache; + private final Map ntCache; /** * A cache for PropertyDefinition instances created by this * NodeTypeManager */ - private final Map pdCache; + private final Map pdCache; /** * A cache for NodeDefinition instances created by this * NodeTypeManager */ - private final Map ndCache; + private final Map ndCache; /** * Creates a new NodeTypeManagerImpl instance. @@ -134,7 +134,7 @@ */ public NodeTypeImpl getNodeType(Name name) throws NoSuchNodeTypeException { synchronized (ntCache) { - NodeTypeImpl nt = (NodeTypeImpl) ntCache.get(name); + NodeTypeImpl nt = ntCache.get(name); if (nt == null) { EffectiveNodeType ent = entProvider().getEffectiveNodeType(name); QNodeTypeDefinition def = ntReg.getNodeTypeDefinition(name); @@ -174,7 +174,7 @@ */ public NodeDefinition getNodeDefinition(QNodeDefinition def) { synchronized (ndCache) { - NodeDefinition ndi = (NodeDefinition) ndCache.get(def); + NodeDefinition ndi = ndCache.get(def); if (ndi == null) { ndi = new NodeDefinitionImpl(def, this, getNamePathResolver()); ndCache.put(def, ndi); @@ -192,7 +192,7 @@ */ public PropertyDefinition getPropertyDefinition(QPropertyDefinition def) { synchronized (pdCache) { - PropertyDefinition pdi = (PropertyDefinition) pdCache.get(def); + PropertyDefinition pdi = pdCache.get(def); if (pdi == null) { pdi = new PropertyDefinitionImpl(def, this, getNamePathResolver(), valueFactory); pdCache.put(def, pdi); @@ -234,18 +234,18 @@ try { String name = getNamePathResolver().getJCRName(ntName); synchronized (pdCache) { - Iterator iter = pdCache.values().iterator(); + Iterator iter = pdCache.values().iterator(); while (iter.hasNext()) { - PropertyDefinition pd = (PropertyDefinition) iter.next(); + PropertyDefinition pd = iter.next(); if (name.equals(pd.getDeclaringNodeType().getName())) { iter.remove(); } } } synchronized (ndCache) { - Iterator iter = ndCache.values().iterator(); + Iterator iter = ndCache.values().iterator(); while (iter.hasNext()) { - NodeDefinition nd = (NodeDefinition) iter.next(); + NodeDefinition nd = iter.next(); if (name.equals(nd.getDeclaringNodeType().getName())) { iter.remove(); } @@ -271,18 +271,18 @@ try { String name = getNamePathResolver().getJCRName(ntName); synchronized (pdCache) { - Iterator iter = pdCache.values().iterator(); + Iterator iter = pdCache.values().iterator(); while (iter.hasNext()) { - PropertyDefinition pd = (PropertyDefinition) iter.next(); + PropertyDefinition pd = iter.next(); if (name.equals(pd.getDeclaringNodeType().getName())) { iter.remove(); } } } synchronized (ndCache) { - Iterator iter = ndCache.values().iterator(); + Iterator iter = ndCache.values().iterator(); while (iter.hasNext()) { - NodeDefinition nd = (NodeDefinition) iter.next(); + NodeDefinition nd = iter.next(); if (name.equals(nd.getDeclaringNodeType().getName())) { iter.remove(); } @@ -305,7 +305,7 @@ */ public NodeTypeIterator getAllNodeTypes() throws RepositoryException { Name[] ntNames = ntReg.getRegisteredNodeTypes(); - ArrayList list = new ArrayList(ntNames.length); + ArrayList list = new ArrayList(ntNames.length); for (int i = 0; i < ntNames.length; i++) { list.add(getNodeType(ntNames[i])); } @@ -317,7 +317,7 @@ */ public NodeTypeIterator getPrimaryNodeTypes() throws RepositoryException { Name[] ntNames = ntReg.getRegisteredNodeTypes(); - ArrayList list = new ArrayList(ntNames.length); + ArrayList list = new ArrayList(ntNames.length); for (int i = 0; i < ntNames.length; i++) { NodeType nt = getNodeType(ntNames[i]); if (!nt.isMixin()) { @@ -332,7 +332,7 @@ */ public NodeTypeIterator getMixinNodeTypes() throws RepositoryException { Name[] ntNames = ntReg.getRegisteredNodeTypes(); - ArrayList list = new ArrayList(ntNames.length); + ArrayList list = new ArrayList(ntNames.length); for (int i = 0; i < ntNames.length; i++) { NodeType nt = getNodeType(ntNames[i]); if (nt.isMixin()) { @@ -399,7 +399,7 @@ * @see NodeTypeManager#unregisterNodeTypes(String[]) */ public void unregisterNodeTypes(String[] names) throws RepositoryException { - HashSet ntNames = new HashSet(); + HashSet ntNames = new HashSet(); for (String name : names) { ntNames.add(getNamePathResolver().getQName(name)); }