You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/04/21 12:39:09 UTC

svn commit: r767106 - in /jackrabbit/branches/1.5: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/ jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/...

Author: jukka
Date: Tue Apr 21 10:39:08 2009
New Revision: 767106

URL: http://svn.apache.org/viewvc?rev=767106&view=rev
Log:
1.5: Merged revision 761634 (JCR-2048)

Added:
    jackrabbit/branches/1.5/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/WorkspaceInitTest.java
      - copied unchanged from r761634, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/WorkspaceInitTest.java
    jackrabbit/branches/1.5/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SlowQueryHandler.java
      - copied unchanged from r761634, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SlowQueryHandler.java
    jackrabbit/branches/1.5/jackrabbit-core/src/test/repository/workspaces/workspace-init-test/
      - copied from r761634, jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/workspace-init-test/
    jackrabbit/branches/1.5/jackrabbit-core/src/test/repository/workspaces/workspace-init-test/workspace.xml
      - copied unchanged from r761634, jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/workspace-init-test/workspace.xml
Modified:
    jackrabbit/branches/1.5/   (props changed)
    jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/branches/1.5/jackrabbit-core/src/test/repository/repository.xml

Propchange: jackrabbit/branches/1.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Apr 21 10:39:08 2009
@@ -1,2 +1,2 @@
 /jackrabbit/branches/1.3:631261
-/jackrabbit/trunk:703899-704158,704165,704167,704324,704358,704361,704864,704933,704939,705010,705033,705243,705496,705522,705579,705925,705932,705934,705937-705938,705961,706242,706273,706285-706286,706562,706606,706649,706655,706660,706697,706918,707303-707304,707307,707310,707630,708206,708598,708609,708613,708619,708634,708840,708863,708909,708929,708943,709115,709142,709207,709211,710047,711238,711566-711567,711595,711841-711843,712984-712985,713037,713059,713065,713072,713076,713162,713214,713956,713958,713964,713971,713975,714034,718218,718249-718250,718371,718376,718566,718632,718981,719225,719282,719575-719577,719579,719585-719586,719588,719592,720455,720484,720492,720524,720533,720540,720673,720679,720687,720784,720940,720969,721186,721191,721194,721235,721387-721389,721470,721495,722068-722069,722463,722465,722467,722470,722825,723281,723346,723728,723784,724300,724387,725292,727376,727388,727390,727395,727397,727402,727492,727701,728022,731896,731934,731941,73234
 7,732678,732686,732689,732693,732703,732715-732716,732719,732728,732730,732734-732738,732740,732742-732743,732745,732867,732883,733057-733059,733061,733080,734092,734366,734375,734400,734709,735401,736021,736030,736274,736276,736650-736651,736653-736656,736658,736680,737695,738087,738119,738121,738419,738422,738474,738512,739210,739212,739226,740262,740734,740736-740738,740747,740749-740750,741052,741100,741121,741206,741208-741210,741213,741509,741524,741652,741803,742382,742538,743295,743713,743718,743726,743734,743738,744883-744884,744889,744895,744911,744935,744940,744954,744956,745041,745051,745053,745056,745060,745120,745500,745534,745824,745849,746301-746302,746486,746602-746603,746609,746666,746747-746748,747325,747347,747358-747360,747362,747365,747368,747372,747785,747839,748232-748233,748247,748486,749237,749448,749622,749953,749965,750011,750437,752036-752039,752044,752046-752051,752053-752054,752056,752058-752060,752063-752067,752115,752131,752414-752415,752478,
 752543-752545,752809,752840-752841,753225-753228,753232,753244,755582,756378,756403,756405,756409,756442,756444,757698,757775-757776,757814,757854,757856,757862,758263,758265,758349,758354,758629,758632,758634-758636,758639-758642,758646,758649,758653-758654,759880,760386,760479,761690-761691,761715,762671,762675,762700,762702,762731,762737,762755,762780-762781,762789,762793,762797,762802,762804,762808,762813-762814,762817-762818,762821-762823,763146,763160,763188,763205,763215,763242,763244,763248,763617,765322,765328,765337,765532,765551,765554,765556,765585
+/jackrabbit/trunk:703899-704158,704165,704167,704324,704358,704361,704864,704933,704939,705010,705033,705243,705496,705522,705579,705925,705932,705934,705937-705938,705961,706242,706273,706285-706286,706562,706606,706649,706655,706660,706697,706918,707303-707304,707307,707310,707630,708206,708598,708609,708613,708619,708634,708840,708863,708909,708929,708943,709115,709142,709207,709211,710047,711238,711566-711567,711595,711841-711843,712984-712985,713037,713059,713065,713072,713076,713162,713214,713956,713958,713964,713971,713975,714034,718218,718249-718250,718371,718376,718566,718632,718981,719225,719282,719575-719577,719579,719585-719586,719588,719592,720455,720484,720492,720524,720533,720540,720673,720679,720687,720784,720940,720969,721186,721191,721194,721235,721387-721389,721470,721495,722068-722069,722463,722465,722467,722470,722825,723281,723346,723728,723784,724300,724387,725292,727376,727388,727390,727395,727397,727402,727492,727701,728022,731896,731934,731941,73234
 7,732678,732686,732689,732693,732703,732715-732716,732719,732728,732730,732734-732738,732740,732742-732743,732745,732867,732883,733057-733059,733061,733080,734092,734366,734375,734400,734709,735401,736021,736030,736274,736276,736650-736651,736653-736656,736658,736680,737695,738087,738119,738121,738419,738422,738474,738512,739210,739212,739226,740262,740734,740736-740738,740747,740749-740750,741052,741100,741121,741206,741208-741210,741213,741509,741524,741652,741803,742382,742538,743295,743713,743718,743726,743734,743738,744883-744884,744889,744895,744911,744935,744940,744954,744956,745041,745051,745053,745056,745060,745120,745500,745534,745824,745849,746301-746302,746486,746602-746603,746609,746666,746747-746748,747325,747347,747358-747360,747362,747365,747368,747372,747785,747839,748232-748233,748247,748486,749237,749448,749622,749953,749965,750011,750437,752036-752039,752044,752046-752051,752053-752054,752056,752058-752060,752063-752067,752115,752131,752414-752415,752478,
 752543-752545,752809,752840-752841,753225-753228,753232,753244,755582,756378,756403,756405,756409,756429,756442,756444,757698,757775-757776,757814,757854,757856,757862,758263,758265,758349,758354,758629,758632,758634-758636,758639-758642,758646,758649,758653-758654,759880,760386,760479,761634,761645,761690-761691,761715,762671,762675,762700,762702,762731,762737,762755,762780-762781,762789,762793,762797,762802,762804,762808,762813-762814,762817-762818,762821-762823,763146,763160,763188,763205,763215,763242,763244,763248,763617,765322,765328,765337,765532,765551,765554,765556,765585

Modified: jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=767106&r1=767105&r2=767106&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java (original)
+++ jackrabbit/branches/1.5/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java Tue Apr 21 10:39:08 2009
@@ -480,7 +480,7 @@
            secWspName = smc.getWorkspaceName();
         }
         try {
-            initWorkspace((WorkspaceInfo) wspInfos.get(wspName));
+            ((WorkspaceInfo) wspInfos.get(wspName)).initialize();
             if (secWspName != null && !wspInfos.containsKey(secWspName)) {
                 createWorkspace(secWspName);
                 log.info("created system workspace: {}", secWspName);
@@ -635,48 +635,6 @@
         }
     }
 
-    private void initWorkspace(WorkspaceInfo wspInfo) throws RepositoryException {
-        // first initialize workspace info
-        if (!wspInfo.initialize()) {
-            // workspace has already been initialized, we're done
-            return;
-        }
-
-        // get system session and Workspace instance
-        SessionImpl sysSession = wspInfo.getSystemSession();
-        WorkspaceImpl wsp = (WorkspaceImpl) sysSession.getWorkspace();
-
-        /**
-         * todo implement 'System' workspace
-         * FIXME
-         * - there should be one 'System' workspace per repository
-         * - 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
-         *
-         * for now, the jcr:system node is created in
-         * {@link org.apache.jackrabbit.core.state.SharedItemStateManager#createRootNodeState}
-         */
-
-        // register the repository as event listener for keeping repository statistics
-        wsp.getObservationManager().addEventListener(this,
-                Event.NODE_ADDED | Event.NODE_REMOVED
-                | Event.PROPERTY_ADDED | Event.PROPERTY_REMOVED,
-                "/", true, null, null, false);
-
-        // register SearchManager as event listener
-        SearchManager searchMgr = wspInfo.getSearchManager();
-        if (searchMgr != null) {
-            wsp.getObservationManager().addEventListener(searchMgr,
-                    Event.NODE_ADDED | Event.NODE_REMOVED
-                    | Event.PROPERTY_ADDED | Event.PROPERTY_REMOVED
-                    | Event.PROPERTY_CHANGED,
-                    "/", true, null, null, false);
-        }
-    }
-
     /**
      * Returns the system search manager or <code>null</code> if none is
      * configured.
@@ -768,7 +726,7 @@
         }
 
         try {
-            initWorkspace(wspInfo);
+            wspInfo.initialize();
         } catch (RepositoryException e) {
             log.error("Unable to initialize workspace '" + workspaceName + "'", e);
             throw new NoSuchWorkspaceException(workspaceName);
@@ -1875,6 +1833,7 @@
                 log.info("initializing workspace '" + getName() + "'...");
                 doInitialize();
                 initialized = true;
+                doPostInitialize();
                 log.info("workspace '" + getName() + "' initialized");
                 return true;
             } finally {
@@ -1929,6 +1888,49 @@
         }
 
         /**
+         * Initializes the search manager of this workspace info. This method
+         * is called while still holding the write lock on this workspace
+         * info, but {@link #initialized} is already set to <code>true</code>.
+         *
+         * @throws RepositoryException if the search manager could not be created
+         */
+        protected void doPostInitialize()
+                throws RepositoryException {
+            // get system Workspace instance
+            WorkspaceImpl wsp = (WorkspaceImpl) getSystemSession().getWorkspace();
+
+            /**
+             * todo implement 'System' workspace
+             * FIXME
+             * - there should be one 'System' workspace per repository
+             * - 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
+             *
+             * for now, the jcr:system node is created in
+             * {@link org.apache.jackrabbit.core.state.SharedItemStateManager#createRootNodeState}
+             */
+
+            // register the repository as event listener for keeping repository statistics
+            wsp.getObservationManager().addEventListener(RepositoryImpl.this,
+                    Event.NODE_ADDED | Event.NODE_REMOVED
+                    | Event.PROPERTY_ADDED | Event.PROPERTY_REMOVED,
+                    "/", true, null, null, false);
+
+            // register SearchManager as event listener
+            SearchManager searchMgr = getSearchManager();
+            if (searchMgr != null) {
+                wsp.getObservationManager().addEventListener(searchMgr,
+                        Event.NODE_ADDED | Event.NODE_REMOVED
+                                | Event.PROPERTY_ADDED | Event.PROPERTY_REMOVED
+                                | Event.PROPERTY_CHANGED,
+                        "/", true, null, null, false);
+            }
+        }
+
+        /**
          * Disposes this <code>WorkspaceInfo</code> if it has been idle for more
          * than <code>maxIdleTime</code> milliseconds.
          *

Modified: jackrabbit/branches/1.5/jackrabbit-core/src/test/repository/repository.xml
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-core/src/test/repository/repository.xml?rev=767106&r1=767105&r2=767106&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-core/src/test/repository/repository.xml (original)
+++ jackrabbit/branches/1.5/jackrabbit-core/src/test/repository/repository.xml Tue Apr 21 10:39:08 2009
@@ -62,7 +62,7 @@
     <!--
         location of workspaces root directory and name of default workspace
     -->
-    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
+    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default" maxIdleTime="2"/>
     <!--
         workspace configuration template:
         used to create the initial workspace if there's no workspace yet