jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r123974 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: . jndi/provider version
Date Mon, 03 Jan 2005 14:11:34 GMT
Author: tripod
Date: Mon Jan  3 06:11:33 2005
New Revision: 123974

URL: http://svn.apache.org/viewcvs?view=rev&rev=123974
Log:
- simplified version manager
- fixing context factory
Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/provider/DummyInitialContextFactory.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java?view=diff&rev=123974&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java&r1=123973&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java&r2=123974
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java	Mon Jan 
3 06:11:33 2005
@@ -2863,7 +2863,7 @@
     public VersionHistory getVersionHistory()
             throws UnsupportedRepositoryOperationException, RepositoryException {
         checkVersionable();
-        return session.versionMgr.getVersionHistory(this);
+        return (VersionHistory) getProperty(VersionManager.PROPNAME_VERSION_HISTORY).getNode();
     }
 
     /**
@@ -2872,7 +2872,7 @@
     public Version getBaseVersion()
             throws UnsupportedRepositoryOperationException, RepositoryException {
         checkVersionable();
-        return session.versionMgr.getBaseVersion(this);
+        return (Version) getProperty(VersionManager.PROPNAME_BASE_VERSION).getNode();
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/provider/DummyInitialContextFactory.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/provider/DummyInitialContextFactory.java?view=diff&rev=123974&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/provider/DummyInitialContextFactory.java&r1=123973&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/provider/DummyInitialContextFactory.java&r2=123974
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/provider/DummyInitialContextFactory.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/jndi/provider/DummyInitialContextFactory.java
Mon Jan  3 06:11:33 2005
@@ -20,16 +20,31 @@
 import javax.naming.NamingException;
 import javax.naming.spi.InitialContextFactory;
 import java.util.Hashtable;
+import java.util.HashMap;
 
 /**
  * <code>DummyInitialContextFactory</code> ...
  */
 public class DummyInitialContextFactory implements InitialContextFactory {
 
+    private static HashMap contexts = new HashMap();
     /**
      * @see InitialContextFactory#getInitialContext(java.util.Hashtable)
      */
     public Context getInitialContext(Hashtable environment) throws NamingException {
-        return new DummyContext(environment);
+
+	String url = (String) environment.get(Context.PROVIDER_URL);
+	if (url==null) {
+	    throw new NamingException("Unable to create context. Environment is missing a " + Context.PROVIDER_URL);
+	}
+
+	synchronized (DummyInitialContextFactory.contexts) {
+	    DummyContext ctx = (DummyContext) contexts.get(url);
+	    if (ctx==null) {
+		ctx = new DummyContext(environment);
+		contexts.put(url, ctx);
+	    }
+	    return ctx;
+	}
     }
 }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java?view=diff&rev=123974&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java&r1=123973&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java&r2=123974
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManager.java
Mon Jan  3 06:11:33 2005
@@ -104,27 +104,6 @@
      */
     public VersionHistory createVersionHistory(NodeImpl node) throws RepositoryException;
 
-
-    /**
-     * Returns the base version of the given node. assuming mix:versionable
-     *
-     * @param node
-     * @return
-     * @throws RepositoryException
-     */
-    public Version getBaseVersion(NodeImpl node) throws RepositoryException;
-
-    /**
-     * Returns the version history for the given node. assuming mix:versionable
-     * and version history set in property
-     *
-     * @param node
-     * @return
-     * @throws RepositoryException
-     */
-    public VersionHistory getVersionHistory(NodeImpl node)
-            throws RepositoryException;
-
     /**
      * invokes the checkin() on the persistent version manager and remaps the
      * newly created version objects.

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java?view=diff&rev=123974&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java&r1=123973&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java&r2=123974
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
Mon Jan  3 06:11:33 2005
@@ -120,35 +120,6 @@
     }
 
     /**
-     * Returns the base version of the given node. assuming mix:versionable
-     *
-     * @param node
-     * @return
-     * @throws RepositoryException
-     */
-    public Version getBaseVersion(NodeImpl node) throws RepositoryException {
-        String histUUID = node.getProperty(VersionManager.PROPNAME_VERSION_HISTORY).getString();
-        InternalVersionHistory history = vMgr.getVersionHistory(histUUID);
-        InternalVersion version = history.getVersion(node.getProperty(PROPNAME_BASE_VERSION).getString());
-        return version == null ? null : (Version) node.getSession().getNodeByUUID(version.getId());
-    }
-
-    /**
-     * Returns the version history for the given node. assuming mix:versionable
-     * and version history set in property
-     *
-     * @param node
-     * @return
-     * @throws RepositoryException
-     */
-    public VersionHistory getVersionHistory(NodeImpl node)
-            throws RepositoryException {
-        String histUUID = node.getProperty(VersionManager.PROPNAME_VERSION_HISTORY).getString();
-        InternalVersionHistory history = vMgr.getVersionHistory(histUUID);
-        return (VersionHistory) node.getSession().getNodeByUUID(history.getId());
-    }
-
-    /**
      * Checks if the version history with the given id exists
      *
      * @param id

Mime
View raw message