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:56 UTC

cvs commit: jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core Path.java PropertyId.java PropertyImpl.java QName.java RepositoryFactory.java RepositoryImpl.java

stefan      2004/07/16 09:37:56

  Modified:    proposals/jcrri/src/org/apache/slide/jcr/core Path.java
                        PropertyId.java PropertyImpl.java QName.java
                        RepositoryFactory.java RepositoryImpl.java
  Log:
  jcrri
  
  Revision  Changes    Path
  1.5       +5 -6      jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/Path.java
  
  Index: Path.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/Path.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Path.java	2 Jul 2004 16:25:02 -0000	1.4
  +++ Path.java	16 Jul 2004 16:37:56 -0000	1.5
  @@ -25,11 +25,11 @@
   
   import org.apache.slide.jcr.util.MalformedPathException;
   
  -import javax.jcr.PathNotFoundException;
   import javax.jcr.NamespaceException;
  +import javax.jcr.PathNotFoundException;
   import java.util.ArrayList;
  -import java.util.LinkedList;
   import java.util.Arrays;
  +import java.util.LinkedList;
   import java.util.regex.Matcher;
   import java.util.regex.Pattern;
   
  @@ -118,7 +118,6 @@
       }
   
       /**
  -     *
        * @param master
        * @param relPath
        * @param canonicalize
  @@ -606,7 +605,7 @@
   	    int index = getIndex();
   	    /** FIXME the [1] subscript should only be suppressed if the item
   	     * in question can't have same-name siblings.
  - 	     */
  +	     */
   	    //if (index > 0) {
   	    if (index > 1) {
   		sb.append('[');
  
  
  
  1.4       +0 -0      jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/PropertyId.java
  
  Index: PropertyId.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/PropertyId.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  
  
  
  1.16      +5 -2      jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/PropertyImpl.java
  
  Index: PropertyImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/PropertyImpl.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PropertyImpl.java	9 Jul 2004 16:48:44 -0000	1.15
  +++ PropertyImpl.java	16 Jul 2004 16:37:56 -0000	1.16
  @@ -110,6 +110,7 @@
   		persistentState = itemStateMgr.createPersistentPropertyState(thisState.getParentUUID(), thisState.getName());
   	    }
   	    // copy state from transient state
  +	    persistentState.setDefinitionId(thisState.getDefinitionId());
   	    persistentState.setType(thisState.getType());
   	    persistentState.setValues(thisState.getValues());
   	    // make state persistent
  @@ -178,6 +179,7 @@
        * Same as <code>{@link Property#setValue(String)}</code> except that
        * this method takes a <code>QName</code> instead of a <code>String</code>
        * value.
  +     *
        * @param name
        * @throws ValueFormatException
        * @throws RepositoryException
  @@ -194,6 +196,7 @@
        * Same as <code>{@link Property#setValue(String[])}</code> except that
        * this method takes an array of <code>QName</code> instead of
        * <code>String</code> values.
  +     *
        * @param names
        * @throws ValueFormatException
        * @throws RepositoryException
  
  
  
  1.4       +3 -3      jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/QName.java
  
  Index: QName.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/QName.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- QName.java	22 Jun 2004 18:03:07 -0000	1.3
  +++ QName.java	16 Jul 2004 16:37:56 -0000	1.4
  @@ -99,7 +99,7 @@
        * @see #toString()
        */
       public static QName valueOf(String s) {
  -	if ((s == null) || s.equals("")) {
  +	if ("".equals(s) || s == null) {
   	    throw new IllegalArgumentException("invalid QName literal");
   	}
   
  
  
  
  1.11      +0 -0      jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/RepositoryFactory.java
  
  Index: RepositoryFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/RepositoryFactory.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  
  
  
  1.14      +48 -12    jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/RepositoryImpl.java
  
  Index: RepositoryImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/RepositoryImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- RepositoryImpl.java	13 Jul 2004 15:49:30 -0000	1.13
  +++ RepositoryImpl.java	16 Jul 2004 16:37:56 -0000	1.14
  @@ -30,6 +30,7 @@
   import org.apache.slide.jcr.core.state.ItemStateException;
   import org.apache.slide.jcr.core.state.PersistenceManager;
   import org.apache.slide.jcr.core.state.PersistentItemStateManager;
  +import org.apache.slide.jcr.core.version.VersionManager;
   import org.apache.slide.jcr.fs.BasedFileSystem;
   import org.apache.slide.jcr.fs.FileSystem;
   import org.apache.slide.jcr.fs.FileSystemException;
  @@ -84,10 +85,14 @@
       private static final String REP_NAME = "JCR 1.0 Reference Implementation";
       private static final String REP_VERSION = "0.1";
   
  +    // system root location
  +    public static QName SYSTEM_ROOT_NAME = new QName(NamespaceRegistryImpl.NS_JCR_URI, "system");
  +
       private String rootNodeUUID;
   
       private final NamespaceRegistryImpl nsReg;
       private final NodeTypeRegistry ntReg;
  +    private final VersionManager vMgr;
   
       // the master filesystem
       private final FileSystem repStore;
  @@ -259,6 +264,25 @@
   
   	ntReg = NodeTypeRegistry.create(nsReg, new BasedFileSystem(repStore, "/nodetypes"));
   
  +	/**
  +	 * todo implement 'System' workspace
  +	 * - the system workspace should have the /jcr:system node
  +	 * - versions, version history and node types should be reflected in
  +	 *   this system workspace as content under /jcr:system
  +	 * - all other workspaces should be dynamic workspaces based on
  +	 *   this 'read-only' system workspace
  +	 */
  +
  +	// FIXME version manager should not operate on default workspace
  +	// check system root node of system workspace
  +	TicketImpl sysTicket = getSystemTicket((WorkspaceDef) wspDefs.get(DEFAULT_WORKSPACE_NAME));
  +	if (!sysTicket.getRootNode().hasNode(SYSTEM_ROOT_NAME.toJCRName(sysTicket.getNamespaceResolver()))) {
  +	    sysTicket.getRootNode().addNode(SYSTEM_ROOT_NAME.toJCRName(sysTicket.getNamespaceResolver()), NodeTypeRegistry.NT_UNSTRUCTURED.toJCRName(sysTicket.getNamespaceResolver()));
  +	    sysTicket.getRootNode().save();
  +	}
  +	// init version manager
  +	vMgr = new VersionManager(getSystemTicket((WorkspaceDef) wspDefs.get(DEFAULT_WORKSPACE_NAME)));
  +
   	// load repository properties
   	repProps = new Properties();
   	loadRepProps();
  @@ -266,7 +290,6 @@
   	nodesCount = Long.parseLong(repProps.getProperty(STATS_NODE_COUNT_PROPERTY));
   	propsCount = Long.parseLong(repProps.getProperty(STATS_PROP_COUNT_PROPERTY));
   
  -
   	// get the system ticket for every defined workspace and
   	// register as an event listener
   	Iterator iter = wspDefs.values().iterator();
  @@ -287,6 +310,10 @@
   	return ntReg;
       }
   
  +    VersionManager getVersionManager() {
  +	return vMgr;
  +    }
  +
       String getRootNodeUUID() {
   	return rootNodeUUID;
       }
  @@ -382,6 +409,13 @@
        * Shuts down this repository
        */
       protected void shutdown() {
  +	// persist repository properties
  +	try {
  +	    storeRepProps();
  +	} catch (RepositoryException e) {
  +	    log.error("failed to persist repository properties", e);
  +	}
  +
   	/**
   	 * todo free resources, shutdown workspaces, close tickets,
   	 * shutdown item state mgr's, persistence mgr's, etc.
  @@ -398,13 +432,6 @@
   	    ObservationManagerFactory obsMgr = (ObservationManagerFactory) it.next();
   	    obsMgr.dispose();
   	}
  -
  -	// persist repository properties
  -	try {
  -	    storeRepProps();
  -	} catch (RepositoryException e) {
  -	    log.error("failed to persist repository properties", e);
  -	}
       }
   
       private void loadRepProps() throws RepositoryException {
  @@ -460,7 +487,6 @@
       }
   
       /**
  -     *
        * @return
        */
       public Properties getProperties() {
  @@ -468,12 +494,22 @@
       }
   
       /**
  -     *
        * @param key
        * @return
        */
       public String getProperty(String key) {
   	return repProps.getProperty(key);
  +    }
  +
  +    /**
  +     * Returns the system root node (i.e. /jcr:system)
  +     *
  +     * @param ticket
  +     * @return
  +     * @throws RepositoryException
  +     */
  +    public Node getSystemRootNode(TicketImpl ticket) throws RepositoryException {
  +	return ticket.getRootNode().getNode(SYSTEM_ROOT_NAME.toJCRName(ticket.getNamespaceResolver()));
       }
   
       //-----------------------------------------------------------< Repository >
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org