You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2005/08/22 14:44:35 UTC

svn commit: r234479 - in /incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core: ItemImpl.java NamespaceRegistryImpl.java RepositoryImpl.java SessionImpl.java WorkspaceImpl.java

Author: stefan
Date: Mon Aug 22 05:44:30 2005
New Revision: 234479

URL: http://svn.apache.org/viewcvs?rev=234479&view=rev
Log:
minor change: changed access modifiers on selecr methods to improve reusability/extensibility

Modified:
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/ItemImpl.java
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/SessionImpl.java
    incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/ItemImpl.java?rev=234479&r1=234478&r2=234479&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/ItemImpl.java Mon Aug 22 05:44:30 2005
@@ -297,7 +297,7 @@
      *
      * @return the id of this <code>Item</code>
      */
-    ItemId getId() {
+    public ItemId getId() {
         return id;
     }
 

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java?rev=234479&r1=234478&r2=234479&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java Mon Aug 22 05:44:30 2005
@@ -75,12 +75,12 @@
     private final FileSystem nsRegStore;
 
     /**
-     * Package private constructor: Constructs a new instance of this class.
+     * Protected constructor: Constructs a new instance of this class.
      *
      * @param nsRegStore
      * @throws RepositoryException
      */
-    NamespaceRegistryImpl(FileSystem nsRegStore) throws RepositoryException {
+    protected NamespaceRegistryImpl(FileSystem nsRegStore) throws RepositoryException {
         this.nsRegStore = nsRegStore;
         load();
     }

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=234479&r1=234478&r2=234479&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/RepositoryImpl.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/RepositoryImpl.java Mon Aug 22 05:44:30 2005
@@ -422,13 +422,6 @@
         delegatingDispatcher.addDispatcher(getObservationManagerFactory(wspName));
     }
 
-    RepositoryConfig getConfig() {
-        // check sanity of this instance
-        sanityCheck();
-
-        return repConfig;
-    }
-
     NamespaceRegistryImpl getNamespaceRegistry() {
         // check sanity of this instance
         sanityCheck();
@@ -499,9 +492,11 @@
      *                             already exists or if another error occurs
      * @see SessionImpl#createWorkspace(String)
      */
-    synchronized void createWorkspace(String workspaceName) throws RepositoryException {
+    protected synchronized void createWorkspace(String workspaceName)
+            throws RepositoryException {
         if (wspInfos.containsKey(workspaceName)) {
-            throw new RepositoryException("workspace '" + workspaceName + "' already exists.");
+            throw new RepositoryException("workspace '"
+                    + workspaceName + "' already exists.");
         }
 
         // create the workspace configuration
@@ -582,10 +577,14 @@
     }
 
     /**
-     * Creates a new session on the specified workspace for the
-     * authenticated subject of the given login context.
+     * Creates a new repository session on the specified workspace for the
+     * <b><i>authenticated</i></b> subject of the given login context and
+     * adds it to the <i>active</i> sessions.
+     * <p/>
+     * Calls {@link #createSessionInstance(AuthContext, WorkspaceConfig)} to
+     * create the actual <code>SessionImpl</code> instance.
      *
-     * @param loginContext  login context with authenticated subject
+    * @param loginContext  login context with authenticated subject
      * @param workspaceName workspace name
      * @return a new session
      * @throws NoSuchWorkspaceException if the specified workspace does not exist
@@ -594,7 +593,7 @@
      *                                  workspace
      * @throws RepositoryException      if another error occurs
      */
-    SessionImpl createSession(AuthContext loginContext,
+    protected final SessionImpl createSession(AuthContext loginContext,
                               String workspaceName)
             throws NoSuchWorkspaceException, AccessDeniedException,
             RepositoryException {
@@ -606,8 +605,12 @@
     }
 
     /**
-     * Creates a new session on the specified workspace for the given
-     * authenticated subject.
+     * Creates a new repository session on the specified workspace for the given
+     * <b><i>authenticated</i></b> subject and adds it to the <i>active</i>
+     * sessions.
+     * <p/>
+     * Calls {@link #createSessionInstance(Subject, WorkspaceConfig)} to
+     * create the actual <code>SessionImpl</code> instance.
      *
      * @param subject       authenticated subject
      * @param workspaceName workspace name
@@ -618,7 +621,8 @@
      *                                  workspace
      * @throws RepositoryException      if another error occurs
      */
-    SessionImpl createSession(Subject subject, String workspaceName)
+    protected final SessionImpl createSession(Subject subject,
+                                              String workspaceName)
             throws NoSuchWorkspaceException, AccessDeniedException,
             RepositoryException {
         WorkspaceInfo wspInfo = getWorkspaceInfo(workspaceName);
@@ -655,9 +659,6 @@
             wspInfo.dispose();
         }
 
-        /**
-         * todo further cleanup tasks, free resources, etc.
-         */
         try {
             vMgr.close();
         } catch (Exception e) {
@@ -690,6 +691,14 @@
     }
 
     /**
+     * Returns the configuration of this repository.
+     * @return repository configuration
+     */
+    public RepositoryConfig getConfig() {
+        return repConfig;
+    }
+
+    /**
      * Returns an <code>InputStream</code> on a <code>Properties</code> resource
      * which contains the default properties for the repository. This method is
      * only called once during repository initialization.
@@ -829,7 +838,7 @@
         // login either using JAAS or our own LoginModule
         AuthContext authCtx;
         try {
-            LoginModuleConfig lmc = this.repConfig.getLoginModuleConfig();
+            LoginModuleConfig lmc = repConfig.getLoginModuleConfig();
             if (lmc == null) {
                 authCtx = new AuthContext.JAAS(repConfig.getAppName(), credentials);
             } else {
@@ -982,7 +991,7 @@
      * representing the same named workspace, i.e. the same physical
      * storage.
      */
-    class WorkspaceInfo {
+    protected class WorkspaceInfo {
 
         /**
          * workspace configuration
@@ -1052,7 +1061,7 @@
          *
          * @return the workspace configuration
          */
-        WorkspaceConfig getConfig() {
+        public WorkspaceConfig getConfig() {
             return config;
         }
 
@@ -1092,7 +1101,8 @@
          * Returns the workspace item state provider
          *
          * @return the workspace item state provider
-         * @throws RepositoryException if the workspace item state provider could not be created
+         * @throws RepositoryException if the workspace item state provider
+         *                             could not be created
          */
         synchronized SharedItemStateManager getItemStateProvider()
                 throws RepositoryException {
@@ -1198,7 +1208,8 @@
                 try {
                     persistMgr.close();
                 } catch (Exception e) {
-                    log.error("error while closing persistence manager of workspace " + config.getName(), e);
+                    log.error("error while closing persistence manager of workspace "
+                            + config.getName(), e);
                 }
                 persistMgr = null;
             }
@@ -1212,7 +1223,8 @@
                 // close workspace file system
                 config.getFileSystem().close();
             } catch (FileSystemException e) {
-                log.error("error while closing filesystem of workspace " + config.getName(), e);
+                log.error("error while closing filesystem of workspace "
+                        + config.getName(), e);
             }
         }
     }

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/SessionImpl.java?rev=234479&r1=234478&r2=234479&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/SessionImpl.java Mon Aug 22 05:44:30 2005
@@ -317,7 +317,7 @@
      *
      * @return the <code>Subject</code> associated with this session
      */
-    Subject getSubject() {
+    protected Subject getSubject() {
         return subject;
     }
 
@@ -371,7 +371,7 @@
      *
      * @return the <code>HierarchyManager</code> associated with this session
      */
-    protected HierarchyManager getHierarchyManager() {
+    public HierarchyManager getHierarchyManager() {
         return hierMgr;
     }
 

Modified: incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java?rev=234479&r1=234478&r2=234479&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java (original)
+++ incubator/jackrabbit/trunk/core/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java Mon Aug 22 05:44:30 2005
@@ -196,6 +196,14 @@
     }
 
     /**
+     * Returns the configuration of this workspace.
+     * @return the workspace configuration
+     */
+    public WorkspaceConfig getConfig() {
+        return wspConfig;
+    }
+
+    /**
      * @param srcAbsPath
      * @param srcWsp
      * @param destAbsPath