You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by st...@apache.org on 2004/07/16 18:37:45 UTC
cvs commit: jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core SystemTicket.java StableWorkspaceDef.java Test.java TicketImpl.java UnknownPrefixException.java WorkspaceDef.java WorkspaceImpl.java
stefan 2004/07/16 09:37:45
Modified: proposals/jcrri/src/org/apache/slide/jcr/core
StableWorkspaceDef.java Test.java TicketImpl.java
UnknownPrefixException.java WorkspaceDef.java
WorkspaceImpl.java
Added: proposals/jcrri/src/org/apache/slide/jcr/core
SystemTicket.java
Log:
jcrri
Revision Changes Path
1.4 +8 -8 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/StableWorkspaceDef.java
Index: StableWorkspaceDef.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/StableWorkspaceDef.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StableWorkspaceDef.java 22 Jun 2004 18:03:07 -0000 1.3
+++ StableWorkspaceDef.java 16 Jul 2004 16:37:45 -0000 1.4
@@ -45,13 +45,13 @@
* Creates a <code>StableWorkspaceDef</code> object, defining a stable
* workspace.
*
- * @param name name of the stable workspace
- * @param wspStore file system where the stable workspace stores its state
- * @param blobStore file system where the stable workspace stores BLOB data
+ * @param name name of the stable workspace
+ * @param wspStore file system where the stable workspace stores its state
+ * @param blobStore file system where the stable workspace stores BLOB data
* @param persistenceManagerClass FQN of class implementing the <code>PersistenceManager</code> interface
- * @param persistenceManagerParams parameters for the <code>PersistenceManager</code>
- * @param dynWorkspaces array of dynamic workspaces that are based on this
- * stable workspace.
+ * @param persistenceManagerParams parameters for the <code>PersistenceManager</code>
+ * @param dynWorkspaces array of dynamic workspaces that are based on this
+ * stable workspace.
*/
StableWorkspaceDef(String name, FileSystem wspStore, FileSystem blobStore,
String persistenceManagerClass, HashMap persistenceManagerParams,
1.8 +17 -9 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/Test.java
Index: Test.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/Test.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Test.java 13 Jul 2004 15:49:30 -0000 1.7
+++ Test.java 16 Jul 2004 16:37:45 -0000 1.8
@@ -110,11 +110,13 @@
root.setProperty("bla", 1.4);
root.setProperty("bla", "blabla");
Node file = root.addNode("blu", "nt:file");
- file.addNode("jcr:content");
+ file.addNode("jcr:content", "nt:unstructured");
root.addNode("blu", "nt:folder");
root.addNode("blu");
Properties repProps = ((RepositoryImpl) r).getProperties();
+ System.out.println("repository properties:");
+ System.out.println(repProps);
dumpTree(root, System.out);
root.orderBefore("blu", null);
@@ -128,6 +130,8 @@
root.save();
+ //t.getWorkspace().move("/imported/src", "/misc/gurk");
+
System.out.println("after save()...");
System.out.println();
dumpTree(root, System.out);
@@ -169,7 +173,7 @@
imported = root.getNode("imported");
}
- importNode(new File("d:/temp"), imported);
+ //importNode(new File("d:/dev/jcr/ri/src"), imported);
if (root.hasNode("foo")) {
root.remove("foo");
@@ -177,38 +181,42 @@
Node n = root.addNode("foo", "nt:folder");
Node n2 = n.addNode("foofile", "nt:file");
- Node n3 = n2.addNode("jcr:content");
+ Node n3 = n2.addNode("jcr:content", "nt:unstructured");
Property p1 = n3.setProperty("prop1", new LongValue(123));
Property p2 = n3.setProperty("prop2", new StringValue("blabla"));
System.out.println("before save()...");
System.out.println();
- dumpTree(n, System.out);
+ dumpTree(root, System.out);
root.save();
System.out.println("after save()...");
System.out.println();
- dumpTree(n, System.out);
+ dumpTree(root, System.out);
n3.remove("prop1");
System.out.println();
- dumpTree(n, System.out);
+ dumpTree(root, System.out);
System.out.println("before refresh()...");
System.out.println();
- dumpTree(n, System.out);
+ dumpTree(root, System.out);
root.refresh(false);
System.out.println("after refresh()...");
System.out.println();
- dumpTree(n, System.out);
+ dumpTree(root, System.out);
System.out.println("exiting...");
System.out.println();
((WorkspaceImpl) wsp).dump(System.out);
+
+ repProps = ((RepositoryImpl) r).getProperties();
+ System.out.println("repository properties:");
+ System.out.println(repProps);
((RepositoryImpl) r).shutdown();
}
1.13 +31 -31 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/TicketImpl.java
Index: TicketImpl.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/TicketImpl.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TicketImpl.java 13 Jul 2004 15:49:30 -0000 1.12
+++ TicketImpl.java 16 Jul 2004 16:37:45 -0000 1.13
@@ -32,7 +32,6 @@
import javax.jcr.*;
import javax.jcr.access.AccessDeniedException;
-import javax.jcr.access.AccessManager;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import java.io.IOException;
@@ -48,7 +47,7 @@
* @author Stefan Guggisberg
* @version $Revision$, $Date$
*/
-public class TicketImpl implements Ticket, NamespaceResolver {
+public class TicketImpl implements Ticket {
private static Logger log = Logger.getLogger(TicketImpl.class);
@@ -130,14 +129,14 @@
userId = null;
}
- ntMgr = new NodeTypeManagerImpl(rep.getNodeTypeRegistry(), this);
+ nsMappings = new TransientNamespaceMappings(rep.getNamespaceRegistry());
+
+ ntMgr = new NodeTypeManagerImpl(rep.getNodeTypeRegistry(), getNamespaceResolver());
wsp = new WorkspaceImpl(wd, rep.getWorkspaceStateManager(wd), rep, this);
itemStateMgr = new TicketItemStateManager(rep.getRootNodeUUID(), wsp.getPersistentStateManager(), getNamespaceResolver());
hierMgr = itemStateMgr.getHierarchyMgr();
itemMgr = new ItemManager(itemStateMgr, hierMgr, this, ntMgr.getRootNodeDefinition(), rep.getRootNodeUUID());
accessMgr = new AccessManagerImpl(credentials, hierMgr, getNamespaceResolver());
-
- nsMappings = new TransientNamespaceMappings(rep.getNamespaceRegistry());
}
/**
@@ -153,13 +152,13 @@
this.userId = userId;
- ntMgr = new NodeTypeManagerImpl(rep.getNodeTypeRegistry(), this);
+ nsMappings = new TransientNamespaceMappings(rep.getNamespaceRegistry());
+
+ ntMgr = new NodeTypeManagerImpl(rep.getNodeTypeRegistry(), getNamespaceResolver());
wsp = new WorkspaceImpl(wd, rep.getWorkspaceStateManager(wd), rep, this);
itemStateMgr = new TicketItemStateManager(rep.getRootNodeUUID(), wsp.getPersistentStateManager(), getNamespaceResolver());
hierMgr = itemStateMgr.getHierarchyMgr();
itemMgr = new ItemManager(itemStateMgr, hierMgr, this, ntMgr.getRootNodeDefinition(), rep.getRootNodeUUID());
-
- nsMappings = new TransientNamespaceMappings(rep.getNamespaceRegistry());
}
/**
@@ -167,7 +166,7 @@
*
* @return the <code>AccessManager</code> associated with this ticket
*/
- AccessManager getAccessManager() {
+ AccessManagerImpl getAccessManager() {
return accessMgr;
}
@@ -181,12 +180,21 @@
}
/**
+ * Returns the <code>ItemManager</code> of this ticket.
+ *
+ * @return the <code>ItemManager</code>
+ */
+ ItemManager getItemManager() {
+ return itemMgr;
+ }
+
+ /**
* Returns the <code>NamespaceResolver</code> of this ticket.
*
* @return the <code>NamespaceResolver</code> of this ticket
*/
- NamespaceResolver getNamespaceResolver() {
- return this;
+ public NamespaceResolver getNamespaceResolver() {
+ return nsMappings;
}
/**
@@ -472,23 +480,8 @@
return nsMappings.getPrefix(uri);
}
- //----------------------------------------------------< NamespaceResolver >
- /**
- * @see NamespaceResolver#getPrefix
- */
- public String getPrefix(String uri) throws NamespaceException {
- return getNamespacePrefix(uri);
- }
-
- /**
- * @see NamespaceResolver#getURI
- */
- public String getURI(String prefix) throws NamespaceException {
- return getNamespaceURI(prefix);
- }
-
//--------------------------------------------------------< inner classes >
- class TransientNamespaceMappings {
+ class TransientNamespaceMappings implements NamespaceResolver {
// the global persistent namespace registry
private NamespaceRegistry nsReg;
@@ -584,7 +577,11 @@
return (String[]) prefixes.toArray(new String[prefixes.size()]);
}
- String getURI(String prefix) throws NamespaceException {
+ //------------------------------------------------< NamespaceResolver >
+ /**
+ * @see NamespaceResolver#getURI
+ */
+ public String getURI(String prefix) throws NamespaceException {
if (prefixToURI.isEmpty()) {
// shortcut
return nsReg.getURI(prefix);
@@ -602,7 +599,10 @@
throw new NamespaceException(prefix + ": unknown prefix");
}
- String getPrefix(String uri) throws NamespaceException {
+ /**
+ * @see NamespaceResolver#getPrefix
+ */
+ public String getPrefix(String uri) throws NamespaceException {
if (prefixToURI.isEmpty()) {
// shortcut
return nsReg.getPrefix(uri);
1.4 +0 -0 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/UnknownPrefixException.java
Index: UnknownPrefixException.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/UnknownPrefixException.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
1.4 +6 -6 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/WorkspaceDef.java
Index: WorkspaceDef.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/WorkspaceDef.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WorkspaceDef.java 22 Jun 2004 18:03:07 -0000 1.3
+++ WorkspaceDef.java 16 Jul 2004 16:37:45 -0000 1.4
@@ -44,11 +44,11 @@
/**
* Package private constructor.
*
- * @param name name of the workspace
- * @param wspStore the file system where the workspace stores its state
- * @param blobStore the file system where the workspace stores BLOB data
+ * @param name name of the workspace
+ * @param wspStore the file system where the workspace stores its state
+ * @param blobStore the file system where the workspace stores BLOB data
* @param persistenceManagerClass FQN of class implementing the <code>PersistenceManager</code> interface
- * @param persistenceManagerParams parameters for the <code>PersistenceManager</code>
+ * @param persistenceManagerParams parameters for the <code>PersistenceManager</code>
*/
WorkspaceDef(String name, FileSystem wspStore, FileSystem blobStore,
String persistenceManagerClass, HashMap persistenceManagerParams) {
1.5 +262 -9 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/WorkspaceImpl.java
Index: WorkspaceImpl.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/WorkspaceImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WorkspaceImpl.java 1 Jul 2004 18:29:41 -0000 1.4
+++ WorkspaceImpl.java 16 Jul 2004 16:37:45 -0000 1.5
@@ -24,13 +24,16 @@
package org.apache.slide.jcr.core;
import org.apache.log4j.Logger;
-import org.apache.slide.jcr.core.state.PersistentItemStateManager;
+import org.apache.slide.jcr.core.nodetype.*;
+import org.apache.slide.jcr.core.state.*;
+import org.apache.slide.jcr.util.MalformedPathException;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import javax.jcr.*;
import javax.jcr.access.AccessDeniedException;
import javax.jcr.access.AccessManager;
+import javax.jcr.access.Permission;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.NodeTypeManager;
import javax.jcr.observation.EventListener;
@@ -42,6 +45,10 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
/**
* A <code>WorkspaceImpl</code> ...
@@ -64,12 +71,19 @@
protected final RepositoryImpl rep;
/**
- * the persistent state mgr associated with the workspace represented by <i>this</i>
- * <code>Workspace</code> instance
+ * The persistent state mgr associated with the workspace represented by <i>this</i>
+ * <code>Workspace</code> instance.
*/
protected final PersistentItemStateManager persistentStateMgr;
/**
+ * The hierarchy mgr that reflects persistent state only
+ * (i.e. that is isolated from transient changes made through
+ * the ticket).
+ */
+ protected final HierarchyManager hierMgr;
+
+ /**
* The <code>ObservationManager</code> instance for this ticket.
*/
protected ObservationManager obsMgr;
@@ -91,6 +105,7 @@
this.wsDef = wsDef;
this.rep = rep;
this.persistentStateMgr = persistentStateMgr;
+ hierMgr = new HierarchyManagerImpl(rep.getRootNodeUUID(), persistentStateMgr, ticket.getNamespaceResolver());
this.ticket = ticket;
}
@@ -132,6 +147,72 @@
}
}
+ /**
+ * Helper method that builds the effective (i.e. merged and resolved)
+ * node type representation of the specified node's primary and mixin
+ * node types.
+ *
+ * @param state
+ * @return the effective node type
+ * @throws RepositoryException
+ */
+ private EffectiveNodeType getEffectiveNodeType(NodeState state)
+ throws RepositoryException {
+ // build effective node type of mixins & primary type
+ NodeTypeRegistry ntReg = ticket.getNodeTypeManager().getNodeTypeRegistry();
+ // existing mixin's
+ HashSet set = new HashSet(((NodeState) state).getMixinTypeNames());
+ // primary type
+ set.add(state.getNodeTypeName());
+ try {
+ return ntReg.buildEffectiveNodeType((QName[]) set.toArray(new QName[set.size()]));
+ } catch (NodeTypeConflictException ntce) {
+ String msg = "internal error: failed to build effective node type for node " + state.getUUID();
+ log.error(msg, ntce);
+ throw new RepositoryException(msg, ntce);
+ }
+ }
+
+ /**
+ * Helper method that returns the definition of the specified node.
+ *
+ * @param state
+ * @param name
+ * @param parentState
+ * @return a <code>ChildNodeDef</code>
+ * @throws RepositoryException if no applicable child node definition
+ * could be found
+ */
+ private ChildNodeDef getDefinition(NodeState state, QName name, NodeState parentState)
+ throws RepositoryException {
+ NodeDefId defId = state.getDefinitionId();
+ if (defId != null) {
+ return ticket.getNodeTypeManager().getNodeDef(defId).unwrap();
+ } else {
+ // fallback: find matching definition in parent node's node type
+ return findApplicableDefinition(name, state.getNodeTypeName(), parentState);
+ }
+ }
+
+ /**
+ * Helper method that finds the applicable definition for the
+ * a child node with the given name and node type in the parent node's
+ * node type and mixin types.
+ *
+ * @param name
+ * @param nodeTypeName
+ * @param parentState
+ * @return a <code>ChildNodeDef</code>
+ * @throws ConstraintViolationException if no applicable child node definition
+ * could be found
+ * @throws RepositoryException if another error occurs
+ */
+ private ChildNodeDef findApplicableDefinition(QName name, QName nodeTypeName, NodeState parentState)
+ throws RepositoryException, ConstraintViolationException {
+ EffectiveNodeType entParent = getEffectiveNodeType(parentState);
+ return entParent.getApplicableChildNodeDef(name, nodeTypeName);
+ }
+
//------------------------------------------------------------< Workspace >
/**
* @see Workspace#getName
@@ -188,9 +269,181 @@
/**
* @see Workspace#move
*/
- public void move(String srcPath, String destPath) throws ConstraintViolationException, AccessDeniedException, PathNotFoundException, ItemExistsException, RepositoryException {
- // @todo implement workspace move
- throw new RepositoryException("not yet implemented");
+ public void move(String srcAbsPath, String destAbsPath)
+ throws ConstraintViolationException, AccessDeniedException,
+ PathNotFoundException, ItemExistsException, RepositoryException {
+
+ // 1. check paths, access rights & retrieve state
+
+ AccessManagerImpl accessMgr = ticket.getAccessManager();
+ PersistentNodeState targetState;
+ PersistentNodeState srcParentState;
+ Path srcPath;
+ Path.PathElement srcName;
+ try {
+ srcPath = Path.create(srcAbsPath, ticket.getNamespaceResolver(), true);
+ srcName = srcPath.getNameElement();
+ ItemId srcId = hierMgr.resolvePath(srcPath);
+ Path srcParentPath = srcPath.getAncestor(1);
+ ItemId srcParentId = hierMgr.resolvePath(srcParentPath);
+ // check access rights
+ if (!accessMgr.isGranted(srcId, Permission.READ_ITEM)) {
+ throw new PathNotFoundException(srcAbsPath);
+ }
+ if (!accessMgr.isGranted(srcId, Permission.REMOVE_ITEM)) {
+ throw new AccessDeniedException(srcAbsPath + ": not allowed to move");
+ }
+ ItemState state = persistentStateMgr.getItemState(srcId);
+ if (!state.isNode()) {
+ String msg = "cannot move a property";
+ log.error(msg);
+ throw new RepositoryException(msg);
+ }
+ targetState = (PersistentNodeState) state;
+ srcParentState = (PersistentNodeState) persistentStateMgr.getItemState(srcParentId);
+ } catch (MalformedPathException mpe) {
+ String msg = "invalid path: " + srcAbsPath;
+ log.error(msg, mpe);
+ throw new RepositoryException(msg, mpe);
+ } catch (ItemStateException ise) {
+ String msg = "internal error: failed to retrieve state of " + srcAbsPath;
+ log.error(msg, ise);
+ throw new RepositoryException(msg, ise);
+ }
+
+ Path destPath;
+ Path.PathElement destName;
+ PersistentNodeState destParentState;
+ try {
+ destPath = Path.create(destAbsPath, ticket.getNamespaceResolver(), true);
+ destName = destPath.getNameElement();
+ Path destParentPath = destPath.getAncestor(1);
+ ItemId destParentId = hierMgr.resolvePath(destParentPath);
+ // check access rights
+ if (!accessMgr.isGranted(destParentId, Permission.READ_ITEM)) {
+ throw new PathNotFoundException(destAbsPath);
+ }
+ if (!accessMgr.isGranted(destParentId, Permission.ADD_NODE)) {
+ throw new AccessDeniedException(destAbsPath + ": not allowed to add node");
+ }
+ ItemState state = persistentStateMgr.getItemState(destParentId);
+ if (!state.isNode()) {
+ String msg = destAbsPath + ": invalid destination path";
+ log.error(msg);
+ throw new RepositoryException(msg);
+ }
+ destParentState = (PersistentNodeState) state;
+ } catch (MalformedPathException mpe) {
+ String msg = "invalid path: " + destAbsPath;
+ log.error(msg, mpe);
+ throw new RepositoryException(msg, mpe);
+ } catch (ItemStateException ise) {
+ String msg = "internal error: failed to retrieve state of " + destAbsPath;
+ log.error(msg, ise);
+ throw new RepositoryException(msg, ise);
+ }
+
+ boolean renameOnly = srcParentState.getUUID().equals(destParentState.getUUID());
+
+ // 2. check note type constraints
+
+ // check removal of target node from old parent
+ ChildNodeDef oldTargetDef = getDefinition(targetState, srcName.getName(), srcParentState);
+ if (oldTargetDef.isMandatory()) {
+ throw new ConstraintViolationException("can't move mandatory node");
+ }
+ if (oldTargetDef.isProtected()) {
+ throw new ConstraintViolationException("can't move protected node");
+ }
+ // check adding of target node to new parent
+ EffectiveNodeType entDestParent = getEffectiveNodeType(destParentState);
+ entDestParent.checkAddNodeConstraints(destName.getName(), targetState.getNodeTypeName());
+ ChildNodeDef newTargetDef = findApplicableDefinition(destName.getName(), targetState.getNodeTypeName(), destParentState);
+
+ // 3. check for name collisions
+ if (destParentState.hasPropertyEntry(destName.getName())) {
+ // there's already a property with that name
+ throw new ItemExistsException(destAbsPath);
+ }
+ if (destParentState.hasChildNodeEntry(destName.getName())) {
+ // there's already a node with that name...
+
+ // get definition of existing conflicting node
+ NodeState.ChildNodeEntry entry = destParentState.getChildNodeEntry(destName.getName(), 1);
+ NodeState conflictingState;
+ try {
+ conflictingState = (NodeState) persistentStateMgr.getItemState(new NodeId(entry.getUUID()));
+ } catch (ItemStateException ise) {
+ String msg = "internal error: failed to retrieve state of " + destAbsPath;
+ log.error(msg, ise);
+ throw new RepositoryException(msg, ise);
+ }
+ ChildNodeDef conflictingTargetDef = getDefinition(conflictingState, destName.getName(), destParentState);
+ // check same-name sibling setting of both target and existing node
+ if (!conflictingTargetDef.allowSameNameSibs() ||
+ !newTargetDef.allowSameNameSibs()) {
+ throw new ItemExistsException(destAbsPath);
+ }
+ }
+
+ // 3. do move operation (modify and persist affected states)
+
+ // add to new parent
+ if (!renameOnly) {
+ targetState.addParentUUID(destParentState.getUUID());
+ }
+ boolean insertTargetEntry = false;
+ int ind = destName.getIndex();
+ if (ind > 0) {
+ // target name contains subscript:
+ // validate subscript
+ List sameNameSibs = destParentState.getChildNodeEntries(destName.getName());
+ if (ind > sameNameSibs.size() + 1) {
+ String msg = "invalid subscript in name: " + destAbsPath;
+ log.error(msg);
+ throw new RepositoryException(msg);
+ }
+ insertTargetEntry = (ind < sameNameSibs.size() + 1) ? true : false;
+ }
+ if (!insertTargetEntry) {
+ // append target entry
+ destParentState.addChildNodeEntry(destName.getName(), targetState.getUUID());
+ } else {
+ // insert target entry at specified position
+ Iterator iter = new ArrayList(destParentState.getChildNodeEntries()).iterator();
+ destParentState.removeAllChildNodeEntries();
+ while (iter.hasNext()) {
+ NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
+ if (entry.getName().equals(destName.getName()) &&
+ entry.getIndex() == destName.getIndex()) {
+ destParentState.addChildNodeEntry(destName.getName(), targetState.getUUID());
+ }
+ destParentState.addChildNodeEntry(entry.getName(), entry.getUUID());
+ }
+ }
+ // change definition (id) of target node
+ targetState.setDefinitionId(new NodeDefId(newTargetDef));
+
+ // remove from old parent
+ if (!renameOnly) {
+ targetState.removeParentUUID(srcParentState.getUUID());
+ }
+ srcParentState.removeChildNodeEntry(srcName.getName(), srcName.getIndex() == 0 ? 1 : srcName.getIndex());
+
+ // persist states
+ try {
+ targetState.store();
+ if (renameOnly) {
+ srcParentState.store();
+ } else {
+ destParentState.store();
+ srcParentState.store();
+ }
+ } catch (ItemStateException ise) {
+ String msg = "internal error: failed to persist state of " + destAbsPath;
+ log.error(msg, ise);
+ throw new RepositoryException(msg, ise);
+ }
}
/**
@@ -213,7 +466,7 @@
*/
public synchronized ObservationManager getObservationManager() {
if (obsMgr == null) {
- obsMgr = rep.getObservationManagerFactory(wsDef).createObservationManager(ticket, ticket.itemMgr);
+ obsMgr = rep.getObservationManagerFactory(wsDef).createObservationManager(ticket, ticket.getItemManager());
}
return obsMgr;
}
1.1 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/SystemTicket.java
Index: SystemTicket.java
===================================================================
/*
* $Id: SystemTicket.java,v 1.1 2004/07/16 16:37:45 stefan Exp $
*
* Copyright 2002-2004 Day Management AG, Switzerland.
*
* Licensed under the Day RI License, Version 2.0 (the "License"),
* as a reference implementation of the following specification:
*
* Content Repository API for Java Technology, revision 0.13
* <http://www.jcp.org/en/jsr/detail?id=170>
*
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License files at
*
* http://www.day.com/content/en/licenses/day-ri-license-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.slide.jcr.core;
import org.apache.log4j.Logger;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
/**
* A <code>SystemTicket</code> ...
*
* @author Stefan Guggisberg
* @version $Revision: 1.1 $, $Date: 2004/07/16 16:37:45 $
*/
class SystemTicket extends TicketImpl {
private static Logger log = Logger.getLogger(SystemTicket.class);
private static final String SYSTEM_USER_ID = "system";
/**
* Package private constructor.
*
* @param rep
*/
SystemTicket(RepositoryImpl rep, WorkspaceDef wd)
throws RepositoryException {
super(rep, SYSTEM_USER_ID, wd);
accessMgr = new SystemAccessManqager();
}
//--------------------------------------------------------< inner classes >
private class SystemAccessManqager extends AccessManagerImpl {
SystemAccessManqager() {
super(null, getHierarchyManager(), getNamespaceResolver());
}
/**
* @see AbstractAccessManager#getPermissions(String)
*/
public long getPermissions(String absPath)
throws PathNotFoundException, RepositoryException {
return PermissionImpl.ALL_VALUES;
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org