portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r1721081 [1/2] - in /portals/jetspeed-2/portal/trunk: applications/jetspeed/src/main/webapp/WEB-INF/min-pages/ applications/jetspeed/src/main/webapp/WEB-INF/min-pages/search/ applications/jetspeed/src/main/webapp/WEB-INF/pages/ applications...
Date Mon, 21 Dec 2015 04:04:52 GMT
Author: taylor
Date: Mon Dec 21 04:04:51 2015
New Revision: 1721081

URL: http://svn.apache.org/viewvc?rev=1721081&view=rev
Log:
JS2-1348: implemented Search feature, adding support to search over some demo html content found in j2-admin app

Added:
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/definition2.fpsml
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/search/
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/search/folder.metadata
      - copied unchanged from r1710106, portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/system/prm/folder.metadata
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/search/results.psml
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/definition2.fpsml
      - copied, changed from r1710106, portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/definition.fpsml
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/search/
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/search/folder.metadata
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/search/results.psml
    portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/test/testdocs/
    portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/test/testdocs/about.html
      - copied unchanged from r1709942, portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/info/about.html
    portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/test/testdocs/developers.html
      - copied unchanged from r1709942, portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/info/developers.html
    portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/test/testdocs/welcome.html
      - copied unchanged from r1709942, portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/info/welcome.html
Modified:
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-blue/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-blue/header.vm
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-green/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-green/header.vm
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-red/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-red/header.vm
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap/header.vm
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/greenearth/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/greenearth/header.vm
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/jetspeed/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/jetspeed/header.vm
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/oldstyle/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/oldstyle/header.vm
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/purpleplanet/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/purpleplanet/header.vm
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/turbo/css/styles.css
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/turbo/header.vm
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentPageImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/main/java/org/apache/jetspeed/search/lucene/SearchEngineImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/main/java/org/apache/jetspeed/search/solr/SolrSearchEngineImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/test/java/org/apache/jetspeed/search/lucene/TestPortletRegistrySearch.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/search/SearchEngine.java
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/alternate/search-embedded-solr-override.xml
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/alternate/search-http-solr-override.xml
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/assembly/search.xml
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/conf/jetspeed/jetspeed.properties
    portals/jetspeed-2/portal/trunk/maven/jetspeed-db-maven-plugin/pom.xml

Added: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/definition2.fpsml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/definition2.fpsml?rev=1721081&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/definition2.fpsml (added)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/definition2.fpsml Mon Dec 21 04:04:51 2015
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+    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.
+-->
+<fragment-definition id="definition"
+                     xmlns="http://portals.apache.org/jetspeed"
+                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                     xsi:schemaLocation="http://portals.apache.org/jetspeed http://portals.apache.org/jetspeed-2/2.2/schemas/fpsml.xsd">
+
+  <title>DEFINITION</title>
+  <fragment id="sp-definition" type="portlet" name="j2-admin::SearchPortlet"/>
+</fragment-definition>
+
+

Added: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/search/results.psml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/search/results.psml?rev=1721081&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/search/results.psml (added)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/min-pages/search/results.psml Mon Dec 21 04:04:51 2015
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+        <!--
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+            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.
+        -->
+<page id="search.psml" hidden="true"
+      xmlns="http://portals.apache.org/jetspeed"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="http://portals.apache.org/jetspeed http://portals.apache.org/jetspeed-2/2.2/schemas/psml.xsd">
+    <title>Jetspeed Search Results</title>
+    <short-title>Search Results</short-title>
+    <fragment id="js-search-results.1" type="layout" name="jetspeed-layouts::VelocityOneColumn">
+        <fragment id="js-search-results.2" type="portlet" name="j2-admin::SearchPortlet"></fragment>
+        <fragment id="js-search-results.3" type="portlet" name="j2-admin::SearchResultsPortlet"></fragment>
+    </fragment>
+</page>

Copied: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/definition2.fpsml (from r1710106, portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/definition.fpsml)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/definition2.fpsml?p2=portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/definition2.fpsml&p1=portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/definition.fpsml&r1=1710106&r2=1721081&rev=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/definition.fpsml (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/definition2.fpsml Mon Dec 21 04:04:51 2015
@@ -14,10 +14,12 @@ See the License for the specific languag
 limitations under the License.
 -->
 <fragment-definition id="definition"
-    xmlns="http://portals.apache.org/jetspeed"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-    xsi:schemaLocation="http://portals.apache.org/jetspeed http://portals.apache.org/jetspeed-2/2.2/schemas/fpsml.xsd">
+                     xmlns="http://portals.apache.org/jetspeed"
+                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                     xsi:schemaLocation="http://portals.apache.org/jetspeed http://portals.apache.org/jetspeed-2/2.2/schemas/fpsml.xsd">
 
   <title>DEFINITION</title>
-  <fragment id="wp-definition" type="portlet" name="demo::WeatherPortlet"/>
+  <fragment id="sp-definition" type="portlet" name="j2-admin::SearchPortlet"/>
 </fragment-definition>
+
+

Added: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/search/folder.metadata
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/search/folder.metadata?rev=1721081&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/search/folder.metadata (added)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/search/folder.metadata Mon Dec 21 04:04:51 2015
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+    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.
+-->
+<folder hidden="true"
+    xmlns="http://portals.apache.org/jetspeed"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://portals.apache.org/jetspeed http://portals.apache.org/jetspeed-2/2.2/schemas/folder-metadata.xsd">
+  <security-constraints>
+    <security-constraints-ref>AEUV</security-constraints-ref>
+  </security-constraints>
+</folder>

Added: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/search/results.psml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/search/results.psml?rev=1721081&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/search/results.psml (added)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/search/results.psml Mon Dec 21 04:04:51 2015
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+        <!--
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You under the Apache License, Version 2.0
+        (the "License"); you may not use this file except in compliance with
+        the License.  You may obtain a copy of the License at
+
+            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.
+        -->
+<page id="search.psml" hidden="true"
+      xmlns="http://portals.apache.org/jetspeed"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="http://portals.apache.org/jetspeed http://portals.apache.org/jetspeed-2/2.2/schemas/psml.xsd">
+    <title>Jetspeed Search Results</title>
+    <short-title>Search Results</short-title>
+    <fragment id="js-search-results.1" type="layout" name="jetspeed-layouts::VelocityOneColumn">
+        <fragment id="js-search-results.2" type="portlet" name="j2-admin::SearchResultsPortlet">
+        </fragment>
+    </fragment>
+</page>

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-blue/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-blue/css/styles.css?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-blue/css/styles.css (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-blue/css/styles.css Mon Dec 21 04:04:51 2015
@@ -464,6 +464,14 @@ background-position: 0px -30px
     font-size:8pt;
 }
 
+.layout-jetspeed .layout-searcharea {
+    position: absolute;
+    right: 210px; top: 10px;
+    color: #000;
+    text-decoration:none;
+    font-size:8pt;
+}
+
 .layout-jetspeed .layout-jetspeed-logout:hover{
     text-decoration: underline;
 }

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-blue/header.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-blue/header.vm?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-blue/header.vm (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-blue/header.vm Mon Dec 21 04:04:51 2015
@@ -99,6 +99,7 @@ else if (window.attachEvent) // Microsof
 <!--  BEGIN: layout/html/jetspeed/decorator.vm -->
 <!-- Page Action Bar -->
 #if ($request.getUserPrincipal())
+<span class="layout-searcharea">$jetspeed.renderPortletWindow("sp-definition", "j2-admin::SearchPortlet")</span>
 <span class="layout-statusarea"><b>$jetspeed.getUserAttribute("user.name.given","") $jetspeed.getUserAttribute("user.name.family", ${request.userPrincipal.name})</b> | <a href="#BaseHref()login/logout">Log out</a></span>
 #end
 #if (!$jetspeed.isAjaxCustomizationEnabled())

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-green/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-green/css/styles.css?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-green/css/styles.css (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-green/css/styles.css Mon Dec 21 04:04:51 2015
@@ -464,6 +464,14 @@ background-position: 0px -30px
     font-size:8pt;
 }
 
+.layout-jetspeed .layout-searcharea {
+    position: absolute;
+    right: 210px; top: 10px;
+    color: #000;
+    text-decoration:none;
+    font-size:8pt;
+}
+
 .layout-jetspeed .layout-jetspeed-logout:hover{
     text-decoration: underline;
 }

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-green/header.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-green/header.vm?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-green/header.vm (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-green/header.vm Mon Dec 21 04:04:51 2015
@@ -99,6 +99,7 @@ else if (window.attachEvent) // Microsof
 <!--  BEGIN: layout/html/jetspeed/decorator.vm -->
 <!-- Page Action Bar -->
 #if ($request.getUserPrincipal())
+<span class="layout-searcharea">$jetspeed.renderPortletWindow("sp-definition", "j2-admin::SearchPortlet")</span>
 <span class="layout-statusarea"><b>$jetspeed.getUserAttribute("user.name.given","") $jetspeed.getUserAttribute("user.name.family", ${request.userPrincipal.name})</b> | <a href="#BaseHref()login/logout">Log out</a></span>
 #end
 #if (!$jetspeed.isAjaxCustomizationEnabled())

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-red/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-red/css/styles.css?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-red/css/styles.css (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-red/css/styles.css Mon Dec 21 04:04:51 2015
@@ -464,6 +464,14 @@ background-position: 0px -30px
     font-size:8pt;
 }
 
+.layout-jetspeed .layout-searcharea {
+    position: absolute;
+    right: 210px; top: 10px;
+    color: #000;
+    text-decoration:none;
+    font-size:8pt;
+}
+
 .layout-jetspeed .layout-jetspeed-logout:hover{
     text-decoration: underline;
 }

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-red/header.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-red/header.vm?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-red/header.vm (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap-red/header.vm Mon Dec 21 04:04:51 2015
@@ -99,6 +99,7 @@ else if (window.attachEvent) // Microsof
 <!--  BEGIN: layout/html/jetspeed/decorator.vm -->
 <!-- Page Action Bar -->
 #if ($request.getUserPrincipal())
+<span class="layout-searcharea">$jetspeed.renderPortletWindow("sp-definition", "j2-admin::SearchPortlet")</span>
 <span class="layout-statusarea"><b>$jetspeed.getUserAttribute("user.name.given","") $jetspeed.getUserAttribute("user.name.family", ${request.userPrincipal.name})</b> | <a href="#BaseHref()login/logout">Log out</a></span>
 #end
 #if (!$jetspeed.isAjaxCustomizationEnabled())

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap/css/styles.css?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap/css/styles.css (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap/css/styles.css Mon Dec 21 04:04:51 2015
@@ -464,6 +464,14 @@ color: #fff;
 font-size:8pt;
 }
 
+.layout-jetspeed .layout-searcharea {
+    position: absolute;
+    right: 210px; top: 10px;
+    color: #000;
+    text-decoration:none;
+    font-size:8pt;
+}
+
 .layout-jetspeed .layout-jetspeed-logout:hover{
 text-decoration: underline;
 }

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap/header.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap/header.vm?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap/header.vm (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/bootstrap/header.vm Mon Dec 21 04:04:51 2015
@@ -99,6 +99,7 @@ else if (window.attachEvent) // Microsof
 <!--  BEGIN: layout/html/jetspeed/decorator.vm -->
 <!-- Page Action Bar -->
 #if ($request.getUserPrincipal())
+<span class="layout-searcharea">$jetspeed.renderPortletWindow("sp-definition", "j2-admin::SearchPortlet")</span>
 <span class="layout-statusarea"><b>$jetspeed.getUserAttribute("user.name.given","") $jetspeed.getUserAttribute("user.name.family", ${request.userPrincipal.name})</b> | <a href="#BaseHref()login/logout">Log out</a></span>
 #end
 #if (!$jetspeed.isAjaxCustomizationEnabled())

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/greenearth/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/greenearth/css/styles.css?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/greenearth/css/styles.css (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/greenearth/css/styles.css Mon Dec 21 04:04:51 2015
@@ -462,6 +462,16 @@ font-size:8pt;
 text-decoration: underline;
 }
 
+.layout-greenearth .layout-searcharea {
+    position: absolute;
+    right: 210px; top: 10px;
+    color: #fff;
+    text-decoration:none;
+    font-size:8pt;
+}
+
+
+
 .layout-jetspeed .tooltext { font-size: 8pt; }
 .layout-greenearth .navmenu ul { margin: 0 0 0 3px; padding: 2px; }
 .layout-greenearth .navmenu li { margin: 0 0 0 3px; padding: 2px; }

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/greenearth/header.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/greenearth/header.vm?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/greenearth/header.vm (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/greenearth/header.vm Mon Dec 21 04:04:51 2015
@@ -97,6 +97,7 @@ else if (window.attachEvent) // Microsof
 <!--  BEGIN: layout/html/jetspeed/decorator.vm -->
 <!-- Page Action Bar -->
 #if ($request.getUserPrincipal())
+<span class="layout-searcharea">$jetspeed.renderPortletWindow("sp-definition", "j2-admin::SearchPortlet")</span>
 <span class="layout-statusarea"><b>$jetspeed.getUserAttribute("user.name.given","") $jetspeed.getUserAttribute("user.name.family", ${request.userPrincipal.name})</b> | <a href="#BaseHref()login/logout">Log out</a></span>
 #end
 #if (!$jetspeed.isAjaxCustomizationEnabled())

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/jetspeed/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/jetspeed/css/styles.css?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/jetspeed/css/styles.css (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/jetspeed/css/styles.css Mon Dec 21 04:04:51 2015
@@ -458,6 +458,14 @@ color: #fff;
 font-size:8pt;
 }
 
+.layout-jetspeed .layout-searcharea {
+    position: absolute;
+    right: 210px; top: 10px;
+    color: #fff;
+    text-decoration:none;
+    font-size:8pt;
+}
+
 .layout-jetspeed .layout-jetspeed-logout:hover{
 text-decoration: underline;
 }

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/jetspeed/header.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/jetspeed/header.vm?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/jetspeed/header.vm (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/jetspeed/header.vm Mon Dec 21 04:04:51 2015
@@ -97,6 +97,7 @@ else if (window.attachEvent) // Microsof
 <!--  BEGIN: layout/html/jetspeed/decorator.vm -->
 <!-- Page Action Bar -->
 #if ($request.getUserPrincipal())
+<span class="layout-searcharea">$jetspeed.renderPortletWindow("sp-definition", "j2-admin::SearchPortlet")</span>
 <span class="layout-statusarea"><b>$jetspeed.getUserAttribute("user.name.given","") $jetspeed.getUserAttribute("user.name.family", ${request.userPrincipal.name})</b> | <a href="#BaseHref()login/logout">Log out</a></span>
 #end
 #if (!$jetspeed.isAjaxCustomizationEnabled())

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/oldstyle/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/oldstyle/css/styles.css?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/oldstyle/css/styles.css (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/oldstyle/css/styles.css Mon Dec 21 04:04:51 2015
@@ -16,43 +16,43 @@ limitations under the License.
 */
 
 @import url("../../css/portal-standard.css");
-
-
-* { margin:0; padding:0; }
-
-body, div, span, a, form, li, ul, ol, input, select, textarea, button, pre, blockquote, label, h1, h2, h3, h4, td, tr, th, tbody, table, p, iframe, img  {
- padding:0px;margin:0px;
- white-space:normal;
- font-weight:normal;
+
+
+* { margin:0; padding:0; }
+
+body, div, span, a, form, li, ul, ol, input, select, textarea, button, pre, blockquote, label, h1, h2, h3, h4, td, tr, th, tbody, table, p, iframe, img  {
+ padding:0px;margin:0px;
+ white-space:normal;
+ font-weight:normal;
  font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif;
  voice-family: "\"}\"";
- voice-family: inherit;
- font-size: 8pt;
-}
+ voice-family: inherit;
+ font-size: 8pt;
+}
 
 body {
     background: #fff;;
-}
-
-textarea, button, select, form {
- padding:1px;
-}
-
-p {
- margin-top:4px;
- margin-bottom:4px;
-}
-
-h2 {
- margin-bottom:6px;
- color:#12293f;
- font-size:9pt;
- font-weight:bold;
-}
-
-h3 {
- margin-bottom:4px;
- text-decoration:underline;
+}
+
+textarea, button, select, form {
+ padding:1px;
+}
+
+p {
+ margin-top:4px;
+ margin-bottom:4px;
+}
+
+h2 {
+ margin-bottom:6px;
+ color:#12293f;
+ font-size:9pt;
+ font-weight:bold;
+}
+
+h3 {
+ margin-bottom:4px;
+ text-decoration:underline;
 }
 
 /** 
@@ -179,38 +179,38 @@ background-position: 0px -30px
     width:10px;
     padding-left: 0px;
     padding-right: 9px;
-}
-
-.layout-oldstyle .menu {
-    background:url(../images/blue_gradient.gif) #05549c;
-    padding:1px;
-    border-top:1px solid #033563;
-}
-
-.layout-oldstyle .menu a {
-   color:#ced7dc;
-   text-decoration:none;
-}
-
-.layout-oldstyle .menu a:hover {
-   color:#f5f7f8;
-   text-decoration:underline;
-}
+}
+
+.layout-oldstyle .menu {
+    background:url(../images/blue_gradient.gif) #05549c;
+    padding:1px;
+    border-top:1px solid #033563;
+}
+
+.layout-oldstyle .menu a {
+   color:#ced7dc;
+   text-decoration:none;
+}
+
+.layout-oldstyle .menu a:hover {
+   color:#f5f7f8;
+   text-decoration:underline;
+}
 
 .layout-oldstyle .tabs {
-   list-style-type:none;
-   list-style-position:inside;
+   list-style-type:none;
+   list-style-position:inside;
    display:table;
-}
-
-.layout-oldstyle .tabs li {
-   float:left;
-   display:inline;
-   border-collapse:collapse;
-   margin-right:10px;
-   padding: 3px;
-   color:#fff;
-}
+}
+
+.layout-oldstyle .tabs li {
+   float:left;
+   display:inline;
+   border-collapse:collapse;
+   margin-right:10px;
+   padding: 3px;
+   color:#fff;
+}
 
 .layout-oldstyle #banner h1 {
     font-size: 1.25em;
@@ -267,7 +267,7 @@ color: #012d46;
 }
 
 .layout-oldstyle #leftcol a:active, .layout-oldstyle #leftcol a:hover {
-    color: #000000 !important;
+    color: #000000 !important;
     text-decoration: underline;
 }
 
@@ -389,26 +389,26 @@ color: #012d46;
 {
   font-family: Verdana,sans-serif;
   font-size: 8pt; 
-}
+}
 
 .layout-oldstyle td{
  font-size: 8pt;
  font-family: Verdana,sans-serif;
  vertical-align: top;
 }
-
-.layout-oldstyle .header {
-	width:100%;
-	background:#fff;
-	border-bottom:4px solid #eef0f0;
-	margin:0px;
-}
+
+.layout-oldstyle .header {
+	width:100%;
+	background:#fff;
+	border-bottom:4px solid #eef0f0;
+	margin:0px;
+}
 
 .layout-oldstyle .logo {
 text-indent: -9999px;   
-background: url("../images/Jetspeed_blue_med.png") no-repeat;
-background-position: 1px 1px;
-height:35px;
+background: url("../images/Jetspeed_blue_med.png") no-repeat;
+background-position: 1px 1px;
+height:35px;
 padding:1px;
 }
 
@@ -418,12 +418,12 @@ padding:1px;
 position: absolute; 
 right: 5px; top: 5px; 
 z-index: 10;  
-color: #000;
-padding:2px;
+color: #000;
+padding:2px;
 text-decoration:none;
-}
+}
 
-.layout-oldstyle .layout-oldstyle-logout:hover{
+.layout-oldstyle .layout-oldstyle-logout:hover{
 text-decoration: underline;
 }
 
@@ -552,3 +552,31 @@ font-weight: bold;
     clear: both;
 }
 
+.layout-oldstyle .layout-statusarea {
+    position: absolute;
+    right: 2px; top: 10px;
+    color: #000;
+    padding:2px;
+    text-decoration:none;
+    font-size:8pt;
+}
+.layyout-oldstyle .layout-statusarea A:visited,
+.layout-oldstyle .layout-statusarea A {
+    color: #000;
+    font-size:8pt;
+}
+
+
+.layout-oldstyle .layout-oldstyle-logout:hover{
+    text-decoration: underline;
+}
+
+.layout-oldstyle .layout-searcharea {
+    position: absolute;
+    right: 210px; top: 10px;
+    color: #fff;
+    text-decoration:none;
+    font-size:8pt;
+}
+
+

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/oldstyle/header.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/oldstyle/header.vm?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/oldstyle/header.vm (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/oldstyle/header.vm Mon Dec 21 04:04:51 2015
@@ -62,7 +62,8 @@ else if (window.attachEvent) // Microsof
 <!--  BEGIN: layout/html/oldstyle/decorator.vm -->
 <!-- Page Action Bar -->
 #if ($request.getUserPrincipal())
-<a class="layout-oldstyle-logout" href="#BaseHref()login/logout">Logout</a>
+<span class="layout-searcharea">$jetspeed.renderPortletWindow("sp-definition", "j2-admin::SearchPortlet")</span>
+<span class="layout-statusarea"><b>$jetspeed.getUserAttribute("user.name.given","") $jetspeed.getUserAttribute("user.name.family", ${request.userPrincipal.name})</b> | <a href="#BaseHref()login/logout">Log out</a></span>
 #end
 #PageActionBar()
 <!-- end of header -->

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/purpleplanet/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/purpleplanet/css/styles.css?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/purpleplanet/css/styles.css (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/purpleplanet/css/styles.css Mon Dec 21 04:04:51 2015
@@ -457,6 +457,15 @@ color: #fff;
 font-size:8pt;
 }
 
+
+.layout-purpleplanet .layout-searcharea {
+    position: absolute;
+    right: 210px; top: 10px;
+    color: #fff;
+    text-decoration:none;
+    font-size:8pt;
+}
+
 .layout-purpleplanet .layout-purpleplanet-logout:hover{
 text-decoration: underline;
 }

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/purpleplanet/header.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/purpleplanet/header.vm?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/purpleplanet/header.vm (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/purpleplanet/header.vm Mon Dec 21 04:04:51 2015
@@ -97,6 +97,7 @@ else if (window.attachEvent) // Microsof
 <!--  BEGIN: layout/html/jetspeed/decorator.vm -->
 <!-- Page Action Bar -->
 #if ($request.getUserPrincipal())
+<span class="layout-searcharea">$jetspeed.renderPortletWindow("sp-definition", "j2-admin::SearchPortlet")</span>
 <span class="layout-statusarea"><b>$jetspeed.getUserAttribute("user.name.given","") $jetspeed.getUserAttribute("user.name.family", ${request.userPrincipal.name})</b> | <a href="#BaseHref()login/logout">Log out</a></span>
 #end
 #if (!$jetspeed.isAjaxCustomizationEnabled())

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/turbo/css/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/turbo/css/styles.css?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/turbo/css/styles.css (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/turbo/css/styles.css Mon Dec 21 04:04:51 2015
@@ -458,6 +458,14 @@ font-size:8pt;
 }
 
 
+.layout-turbo .layout-searcharea {
+    position: absolute;
+    right: 210px; top: 10px;
+    color: #fff;
+    text-decoration:none;
+    font-size:8pt;
+}
+
 .layout-turbo .layout-turbo-logout:hover{
 text-decoration: underline;
 }

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/turbo/header.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/turbo/header.vm?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/turbo/header.vm (original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/decorations/layout/turbo/header.vm Mon Dec 21 04:04:51 2015
@@ -97,6 +97,7 @@ else if (window.attachEvent) // Microsof
 <!--  BEGIN: layout/html/jetspeed/decorator.vm -->
 <!-- Page Action Bar -->
 #if ($request.getUserPrincipal())
+<span class="layout-searcharea">$jetspeed.renderPortletWindow("sp-definition", "j2-admin::SearchPortlet")</span>
 <span class="layout-statusarea"><b>$jetspeed.getUserAttribute("user.name.given","") $jetspeed.getUserAttribute("user.name.family", ${request.userPrincipal.name})</b> | <a href="#BaseHref()login/logout">Log out</a></span>
 #end
 #if (!$jetspeed.isAjaxCustomizationEnabled())

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java Mon Dec 21 04:04:51 2015
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentPageImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentPageImpl.java?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentPageImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentPageImpl.java Mon Dec 21 04:04:51 2015
@@ -265,6 +265,20 @@ public class ContentPageImpl implements
         return rootContentFragment;
     }
 
+    public ContentFragment getRootFragmentUnlocked()
+    {
+        ContentFragment root = rootContentFragment;
+        if (root.isLocked()) {
+            for (ContentFragment f : root.getFragments()) {
+                if (!f.isTemplate() && !f.isLocked()) {
+                    return f;
+                }
+            }
+        }
+        return root;
+
+    }
+
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.ContentPage#getShortTitle()
      */

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java Mon Dec 21 04:04:51 2015
@@ -298,6 +298,20 @@ public class JetspeedPowerToolImpl imple
         return (ContentFragment) renderRequest.getAttribute(PortalReservedParameters.FRAGMENT_ATTRIBUTE);
     }
 
+    public ContentFragment getCurrentFragmentUnlocked()
+    {
+        checkState();
+        ContentFragment root = (ContentFragment)renderRequest.getAttribute(PortalReservedParameters.FRAGMENT_ATTRIBUTE);
+        if (root.isLocked()) {
+            for (ContentFragment f : root.getFragments()) {
+                if (!f.isTemplate() && !f.isLocked()) {
+                    return f;
+                }
+            }
+        }
+        return root;
+    }
+
     /**
      * 
      * @param f

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/main/java/org/apache/jetspeed/search/lucene/SearchEngineImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/main/java/org/apache/jetspeed/search/lucene/SearchEngineImpl.java?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/main/java/org/apache/jetspeed/search/lucene/SearchEngineImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/main/java/org/apache/jetspeed/search/lucene/SearchEngineImpl.java Mon Dec 21 04:04:51 2015
@@ -16,17 +16,6 @@
  */
 package org.apache.jetspeed.search.lucene;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.commons.collections.MultiMap;
 import org.apache.commons.collections.map.MultiValueMap;
 import org.apache.commons.lang.StringUtils;
@@ -57,99 +46,128 @@ import org.apache.lucene.util.Version;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * @author <a href="mailto: jford@apache.org">Jeremy Ford</a>
  * @version $Id$
  */
-public class SearchEngineImpl implements SearchEngine
-{
+public class SearchEngineImpl implements SearchEngine {
     protected final static Logger log = LoggerFactory.getLogger(SearchEngineImpl.class);
     private Directory directory;
     private Analyzer analyzer;
     private boolean optimizeAfterUpdate = true;
     private HandlerFactory handlerFactory;
-    
+
     private static final int KEYWORD = 0;
     private static final int TEXT = 1;
-    
+
     private int defaultTopHitsCount = 1000;
-    
+    private Boolean documentsEnabled = false;
+    private String documentsLocation = null;
+
     public SearchEngineImpl(Directory directory, Analyzer analyzer, boolean optimzeAfterUpdate, HandlerFactory handlerFactory)
-    throws Exception
-    {
+            throws Exception {
         this(directory, analyzer, optimzeAfterUpdate, handlerFactory, 0);
     }
-    
+
     public SearchEngineImpl(Directory directory, Analyzer analyzer, boolean optimzeAfterUpdate, HandlerFactory handlerFactory, int defaultTopHitsCount)
-    throws Exception
-    {
+            throws Exception {
         this.directory = directory;
         this.analyzer = analyzer;
         this.optimizeAfterUpdate = optimzeAfterUpdate;
         this.handlerFactory = handlerFactory;
-        
-        if (defaultTopHitsCount > 0)
-        {
+
+        if (defaultTopHitsCount > 0) {
             this.defaultTopHitsCount = defaultTopHitsCount;
         }
-        
+
         validateIndexDirectory();
     }
-    
+
     public SearchEngineImpl(String indexRoot, String analyzerClassName, boolean optimzeAfterUpdate, HandlerFactory handlerFactory)
-    throws Exception
-    {
+            throws Exception {
         this(indexRoot, analyzerClassName, optimzeAfterUpdate, handlerFactory, 0);
     }
-    
+
     public SearchEngineImpl(String indexRoot, String analyzerClassName, boolean optimzeAfterUpdate, HandlerFactory handlerFactory, int defaultTopHitsCount)
-    throws Exception
-    {
-        if(analyzerClassName != null)
-        {
+            throws Exception {
+        if (analyzerClassName != null) {
             try {
                 Class analyzerClass = Class.forName(analyzerClassName);
                 analyzer = (Analyzer) analyzerClass.newInstance();
-            } catch(InstantiationException ce) {
+            } catch (InstantiationException ce) {
                 //logger.error("InstantiationException", e);
-            } catch(ClassNotFoundException ce) {
+            } catch (ClassNotFoundException ce) {
                 //logger.error("ClassNotFoundException", e);
-            } catch(IllegalAccessException ce) {
+            } catch (IllegalAccessException ce) {
                 //logger.error("IllegalAccessException", e);
             }
         }
-        
-        if (analyzer == null) 
-        {
+
+        if (analyzer == null) {
             analyzer = new StandardAnalyzer(Version.LUCENE_30);
         }
-        
+
         this.optimizeAfterUpdate = optimzeAfterUpdate;
         this.handlerFactory = handlerFactory;
-        
-        if (defaultTopHitsCount > 0)
-        {
+
+        if (defaultTopHitsCount > 0) {
             this.defaultTopHitsCount = defaultTopHitsCount;
         }
-        
+
         //assume it's full path for now
         File rootIndexDir = new File(indexRoot);
-        
-        if (!rootIndexDir.isDirectory())
-        {
+
+        if (!rootIndexDir.isDirectory()) {
             rootIndexDir.mkdirs();
         }
-        
+
         directory = FSDirectory.open(rootIndexDir);
-        
+
         validateIndexDirectory();
     }
-    
+
+    public void start() throws IOException {
+        if (documentsEnabled) {
+            String query = ParsedObject.FIELDNAME_TYPE + ":\"" + ParsedObject.OBJECT_TYPE_URL + "\" ";
+            SearchResults searchResults = search(query);
+            if (searchResults.size() == 0) {
+                log.info("Adding Jetspeed documentation to search index ....");
+                indexDirectory(documentsLocation);
+            }
+        }
+    }
+
+    public Boolean getDocumentsEnabled() {
+        return documentsEnabled;
+    }
+
+    public void setDocumentsEnabled(Boolean documentsEnabled) {
+        this.documentsEnabled = documentsEnabled;
+    }
+
+    public String getDocumentsLocation() {
+        return documentsLocation;
+    }
+
+    public void setDocumentsLocation(String documentsLocation) {
+        this.documentsLocation = documentsLocation;
+    }
+
     /* (non-Javadoc)
      * @see org.apache.jetspeed.search.SearchEnging#add(java.lang.Object)
      */
-    public boolean add(Object o)
-    {
+    public boolean add(Object o) {
         Collection c = new ArrayList(1);
         c.add(o);
 
@@ -159,16 +177,14 @@ public class SearchEngineImpl implements
     /* (non-Javadoc)
      * @see org.apache.jetspeed.search.SearchEnging#add(java.util.Collection)
      */
-    public boolean add(Collection objects)
-    {
+    public boolean add(Collection objects) {
         return removeIfExistsAndAdd(objects);
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.jetspeed.search.SearchEnging#remove(java.lang.Object)
      */
-    public boolean remove(Object o)
-    {
+    public boolean remove(Object o) {
         Collection c = new ArrayList(1);
         c.add(o);
 
@@ -178,21 +194,17 @@ public class SearchEngineImpl implements
     /* (non-Javadoc)
      * @see org.apache.jetspeed.search.SearchEnging#remove(java.util.Collection)
      */
-    public synchronized boolean remove(Collection objects)
-    {
+    public synchronized boolean remove(Collection objects) {
         IndexReader indexReader = null;
         int deleteCount = 0;
-        
-        try 
-        {
+
+        try {
             Iterator it = objects.iterator();
-            while (it.hasNext()) 
-            {
-                if (indexReader == null)
-                {
+            while (it.hasNext()) {
+                if (indexReader == null) {
                     indexReader = IndexReader.open(directory, false);
                 }
-                
+
                 Object o = it.next();
                 // Look up appropriate handler
                 ObjectHandler handler = handlerFactory.getHandler(o);
@@ -203,8 +215,7 @@ public class SearchEngineImpl implements
                 // Create term
                 Term term = null;
 
-                if (parsedObject.getKey() != null)
-                {
+                if (parsedObject.getKey() != null) {
                     term = new Term(ParsedObject.FIELDNAME_KEY, parsedObject.getKey());
                     // Remove the document from search index
                     deleteCount += indexReader.deleteDocuments(term);
@@ -212,32 +223,22 @@ public class SearchEngineImpl implements
                     //System.out.println("Attempted to delete '" + term.toString() + "' from index, documents deleted = " + rc);
                 }
             }
-            
-            if (indexReader != null)
-            {
+
+            if (indexReader != null) {
                 indexReader.close();
                 indexReader = null;
             }
-            
-            if (deleteCount > 0 && optimizeAfterUpdate)
-            {
+
+            if (deleteCount > 0 && optimizeAfterUpdate) {
                 optimizeIndex();
             }
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             log.error("Exception during removing documents in the search index.", e);
-        }
-        finally
-        {
-            if (indexReader != null)
-            {
-                try
-                {
+        } finally {
+            if (indexReader != null) {
+                try {
                     indexReader.close();
-                }
-                catch (IOException ce)
-                {
+                } catch (IOException ce) {
                 }
             }
         }
@@ -248,242 +249,199 @@ public class SearchEngineImpl implements
     /* (non-Javadoc)
      * @see org.apache.jetspeed.search.SearchEnging#update(java.lang.Object)
      */
-    public boolean update(Object o)
-    {
+    public boolean update(Object o) {
         Collection c = new ArrayList(1);
         c.add(o);
-        
+
         return update(c);
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.search.SearchEnging#update(java.util.Collection)
      */
-    public boolean update(Collection objects)
-    {
+    public boolean update(Collection objects) {
         return removeIfExistsAndAdd(objects);
     }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.search.SearchEnging#optimize()
      */
-    public synchronized boolean optimize()
-    {
+    public synchronized boolean optimize() {
         return optimizeIndex();
     }
-    
-    private boolean optimizeIndex()
-    {
+
+    private boolean optimizeIndex() {
         boolean result = false;
 
-        try
-        {
+        try {
             IndexWriter indexWriter = new IndexWriter(directory, analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED);
             indexWriter.optimize();
             indexWriter.close();
             result = true;
-        }
-        catch (IOException e)
-        {
-             //logger.error("Error while trying to optimize index.");
+        } catch (IOException e) {
+            //logger.error("Error while trying to optimize index.");
         }
         return result;
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.jetspeed.search.SearchEngine#search(java.lang.String)
      */
-    public SearchResults search(String queryString)
-    {
+    public SearchResults search(String queryString) {
         return search(queryString, ParsedObject.FIELDNAME_SYNTHETIC);
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.jetspeed.search.SearchEngine#search(java.lang.String, java.lang.String)
      */
-    public SearchResults search(String queryString, String defaultFieldName)
-    {
+    public SearchResults search(String queryString, String defaultFieldName) {
         return search(queryString, defaultFieldName, defaultTopHitsCount);
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.jetspeed.search.SearchEngine#search(java.lang.String, java.lang.String, int)
      */
-    public SearchResults search(String queryString, String defaultFieldName, int topHitsCount)
-    {
+    public SearchResults search(String queryString, String defaultFieldName, int topHitsCount) {
         SearchResults results = null;
-        
+
         IndexReader indexReader = null;
         Searcher searcher = null;
-        
-        try
-        {
+
+        try {
             indexReader = IndexReader.open(directory);
             searcher = new IndexSearcher(indexReader);
-            
+
             QueryParser queryParser = new QueryParser(Version.LUCENE_30, defaultFieldName, analyzer);
             Query query = queryParser.parse(queryString);
             TopDocs topDocs = searcher.search(query, topHitsCount);
-            
+
             int count = Math.min(topHitsCount, topDocs.totalHits);
             List<ParsedObject> resultList = new ArrayList<ParsedObject>(count);
-            
-            for (int i = 0; i < count; i++)
-            {
+
+            for (int i = 0; i < count; i++) {
                 ParsedObject result = new BaseParsedObject();
-                
-	            Document doc = searcher.doc(topDocs.scoreDocs[i].doc);
-	        
-		        addFieldsToParsedObject(doc, result);
-		        
-		        result.setScore(topDocs.scoreDocs[i].score);
-		        Field type = doc.getField(ParsedObject.FIELDNAME_TYPE);
-		        if(type != null)
-		        {
-		            result.setType(type.stringValue());
-		        }
-		        
-		        Field key = doc.getField(ParsedObject.FIELDNAME_KEY);
-		        if(key != null)
-		        {
-		            result.setKey(key.stringValue());
-		        }
-		        
-		        Field description = doc.getField(ParsedObject.FIELDNAME_DESCRIPTION);
-		        if(description != null)
-		        {
-		            result.setDescription(description.stringValue());
-		        }
-		        
-		        Field title = doc.getField(ParsedObject.FIELDNAME_TITLE);
-		        if(title != null)
-		        {
-		            result.setTitle(title.stringValue());
-		        }
-		        
-		        Field content = doc.getField(ParsedObject.FIELDNAME_CONTENT);
-		        if(content != null)
-		        {
-		            result.setContent(content.stringValue());
-		        }
-		        
-		        Field language = doc.getField(ParsedObject.FIELDNAME_LANGUAGE);
-		        if (language != null)
-		        {
-		        	result.setLanguage(language.stringValue());
-		        }
-		        
-		        Field classname = doc.getField(ParsedObject.FIELDNAME_CLASSNAME);
-		        if (classname != null)
-		        {
-		        	result.setClassName(classname.stringValue());
-		        }
-		        
-		        Field url = doc.getField(ParsedObject.FIELDNAME_URL);
-		        if (url != null)
-		        {
-		            result.setURL(new URL(url.stringValue()));
-		        }
-		        
-		        Field[] keywords = doc.getFields(ParsedObject.FIELDNAME_KEYWORDS);
-		        if(keywords != null)
-		        {
-		        	String[] keywordArray = new String[keywords.length];
-		        	
-		        	for(int j=0; j<keywords.length; j++)
-		        	{
-		        		Field keyword = keywords[j];
-		        		keywordArray[j] = keyword.stringValue();
-		        	}
-		        	
-		        	result.setKeywords(keywordArray);
-		        }
-		        
-		        resultList.add(i, result);
+
+                Document doc = searcher.doc(topDocs.scoreDocs[i].doc);
+
+                addFieldsToParsedObject(doc, result);
+
+                result.setScore(topDocs.scoreDocs[i].score);
+                Field type = doc.getField(ParsedObject.FIELDNAME_TYPE);
+                if (type != null) {
+                    result.setType(type.stringValue());
+                }
+
+                Field key = doc.getField(ParsedObject.FIELDNAME_KEY);
+                if (key != null) {
+                    result.setKey(key.stringValue());
+                }
+
+                Field description = doc.getField(ParsedObject.FIELDNAME_DESCRIPTION);
+                if (description != null) {
+                    result.setDescription(description.stringValue());
+                }
+
+                Field title = doc.getField(ParsedObject.FIELDNAME_TITLE);
+                if (title != null) {
+                    result.setTitle(title.stringValue());
+                }
+
+                Field content = doc.getField(ParsedObject.FIELDNAME_CONTENT);
+                if (content != null) {
+                    result.setContent(content.stringValue());
+                }
+
+                Field language = doc.getField(ParsedObject.FIELDNAME_LANGUAGE);
+                if (language != null) {
+                    result.setLanguage(language.stringValue());
+                }
+
+                Field classname = doc.getField(ParsedObject.FIELDNAME_CLASSNAME);
+                if (classname != null) {
+                    result.setClassName(classname.stringValue());
+                }
+
+                Field url = doc.getField(ParsedObject.FIELDNAME_URL);
+                if (url != null) {
+                    result.setURL(new URL(url.stringValue()));
+                }
+
+                Field[] keywords = doc.getFields(ParsedObject.FIELDNAME_KEYWORDS);
+                if (keywords != null) {
+                    String[] keywordArray = new String[keywords.length];
+
+                    for (int j = 0; j < keywords.length; j++) {
+                        Field keyword = keywords[j];
+                        keywordArray[j] = keyword.stringValue();
+                    }
+
+                    result.setKeywords(keywordArray);
+                }
+
+                resultList.add(i, result);
             }
-            
+
             results = new SearchResultsImpl(resultList);
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             log.error("Failed to search. ", e);
-        }
-        finally
-        {
-            if (searcher != null)
-            {
-                try
-                {
+        } finally {
+            if (searcher != null) {
+                try {
                     searcher.close();
-                }
-                catch (IOException ioe)
-                {
+                } catch (IOException ioe) {
                     //logger.error("Closing Searcher", ioe);
                 }
             }
-            
-            if (indexReader != null)
-            {
-                try
-                {
+
+            if (indexReader != null) {
+                try {
                     indexReader.close();
-                }
-                catch (IOException ioe)
-                {
+                } catch (IOException ioe) {
                     //logger.error("Closing Index Reader", ioe);
                 }
             }
         }
-        
+
         return (results != null ? results : new SearchResultsImpl(new ArrayList<ParsedObject>()));
     }
-    
-    private synchronized boolean removeIfExistsAndAdd(Collection objects)
-    {
+
+    private synchronized boolean removeIfExistsAndAdd(Collection objects) {
         IndexWriter indexWriter = null;
         IndexReader indexReader = null;
         Searcher searcher = null;
-        
-        try
-        {
+
+        try {
             Iterator it = objects.iterator();
-            while (it.hasNext()) 
-            {
-                if (indexWriter == null)
-                {
+            while (it.hasNext()) {
+                if (indexWriter == null) {
                     indexWriter = new IndexWriter(directory, analyzer, false, IndexWriter.MaxFieldLength.UNLIMITED);
                     indexReader = indexWriter.getReader();
                     searcher = new IndexSearcher(indexReader);
                 }
-                
+
                 Object o = it.next();
                 // Look up appropriate handler
                 ObjectHandler handler = null;
-                try
-                {
+                try {
                     handler = handlerFactory.getHandler(o);
-                }
-                catch (Exception e)
-                {
+                } catch (Exception e) {
                     log.error("Failed to create hanlder for object " + o.getClass().getName());
                     continue;
                 }
-    
+
                 // Parse the object
                 ParsedObject parsedObject = handler.parseObject(o);
-                
+
                 String key = parsedObject.getKey();
                 // if there's an existing one with the same key, then remove it first.
-                if (parsedObject.getKey() != null)
-                {
+                if (parsedObject.getKey() != null) {
                     Term keyTerm = new Term(ParsedObject.FIELDNAME_KEY, key);
                     TopDocs topDocs = searcher.search(new TermQuery(keyTerm), 1);
-                    if (topDocs.totalHits > 0)
-                    {
+                    if (topDocs.totalHits > 0) {
                         indexWriter.deleteDocuments(keyTerm);
                     }
                 }
-                
+
                 String type = parsedObject.getType();
                 String title = parsedObject.getTitle();
                 String description = parsedObject.getDescription();
@@ -491,67 +449,55 @@ public class SearchEngineImpl implements
                 String language = parsedObject.getLanguage();
                 URL url = parsedObject.getURL();
                 String className = parsedObject.getClassName();
-                
+
                 // Create document
                 Document doc = new Document();
-                
+
                 // Populate document from the parsed object
-                if (key != null)
-                {
+                if (key != null) {
                     doc.add(new Field(ParsedObject.FIELDNAME_KEY, key, Field.Store.YES, Field.Index.NOT_ANALYZED));
                 }
-                if (type != null)
-                {
+                if (type != null) {
                     doc.add(new Field(ParsedObject.FIELDNAME_TYPE, type, Field.Store.YES, Field.Index.ANALYZED));
                 }
-                if (title != null)
-                {
+                if (title != null) {
                     doc.add(new Field(ParsedObject.FIELDNAME_TITLE, title, Field.Store.YES, Field.Index.ANALYZED));
                 }
-                if (description != null)
-                {
+                if (description != null) {
                     doc.add(new Field(ParsedObject.FIELDNAME_DESCRIPTION, description, Field.Store.YES, Field.Index.ANALYZED));
                 }
-                if (content != null)
-                {
+                if (content != null) {
                     doc.add(new Field(ParsedObject.FIELDNAME_CONTENT, content, Field.Store.NO, Field.Index.ANALYZED));
                 }
-                if (language != null)
-                {
+                if (language != null) {
                     doc.add(new Field(ParsedObject.FIELDNAME_LANGUAGE, language, Field.Store.YES, Field.Index.ANALYZED));
                 }
-                if (url != null)
-                {
+                if (url != null) {
                     String urlString = url.toString();
                     doc.add(new Field(ParsedObject.FIELDNAME_URL, urlString, Field.Store.YES, Field.Index.ANALYZED));
                 }
-                if (className != null)
-                {
+                if (className != null) {
                     doc.add(new Field(ParsedObject.FIELDNAME_CLASSNAME, className, Field.Store.YES, Field.Index.ANALYZED));
                 }
-                
+
                 String[] keywordArray = parsedObject.getKeywords();
-                if(keywordArray != null)
-                {
-                    for(int i=0; i<keywordArray.length; ++i)
-                    {
+                if (keywordArray != null) {
+                    for (int i = 0; i < keywordArray.length; ++i) {
                         String keyword = keywordArray[i];
                         doc.add(new Field(ParsedObject.FIELDNAME_KEYWORDS, keyword, Field.Store.YES, Field.Index.NOT_ANALYZED));
                     }
                 }
-    
+
                 Map keywords = parsedObject.getKeywordsMap();
                 addFieldsToDocument(doc, keywords, KEYWORD);
-                
+
                 Map fields = parsedObject.getFields();
                 addFieldsToDocument(doc, fields, TEXT);
-                
+
                 List<String> syntheticField = new ArrayList<String>();
-                for (Fieldable fieldable : doc.getFields())
-                {
+                for (Fieldable fieldable : doc.getFields()) {
                     String value = fieldable.stringValue();
-                    if (value != null)
-                    {
+                    if (value != null) {
                         syntheticField.add(value);
                     }
                 }
@@ -563,156 +509,110 @@ public class SearchEngineImpl implements
                 //logger.info("Added '" + parsedObject.getTitle() + "' to index");
             }
 
-            if (objects.size() > 0 && optimizeAfterUpdate && indexWriter != null)
-            {
-                try
-                {
+            if (objects.size() > 0 && optimizeAfterUpdate && indexWriter != null) {
+                try {
                     indexWriter.optimize();
-                }
-                catch (IOException e)
-                {
+                } catch (IOException e) {
                     log.error("Error while trying to optimize index.", e);
                 }
             }
-        }
-        catch (IOException e)
-        {
+        } catch (IOException e) {
             log.error("Error while writing index.", e);
             return false;
-        }
-        finally
-        {
-            if (searcher != null)
-            {
-                try
-                {
+        } finally {
+            if (searcher != null) {
+                try {
                     searcher.close();
-                }
-                catch (IOException ce)
-                {
+                } catch (IOException ce) {
                 }
             }
-            if (indexReader != null)
-            {
-                try
-                {
+            if (indexReader != null) {
+                try {
                     indexReader.close();
-                }
-                catch (IOException ce)
-                {
+                } catch (IOException ce) {
                 }
             }
-            if (indexWriter != null)
-            {
-                try
-                {
+            if (indexWriter != null) {
+                try {
                     indexWriter.close();
-                }
-                catch (IOException ce)
-                {
+                } catch (IOException ce) {
                 }
             }
         }
-        
+
         return true;
     }
 
-    private void addFieldsToDocument(Document doc, Map fields, int type)
-    {
-        if(fields != null)
-        {
+    private void addFieldsToDocument(Document doc, Map fields, int type) {
+        if (fields != null) {
             Iterator keyIter = fields.keySet().iterator();
-            while(keyIter.hasNext())
-            {
+            while (keyIter.hasNext()) {
                 Object key = keyIter.next();
-                if(key != null)
-                {
+                if (key != null) {
                     Object values = fields.get(key);
-                    if(values != null)
-                    {
-                        if(values instanceof Collection)
-                        {
-                            Iterator valueIter = ((Collection)values).iterator();
-                            while(valueIter.hasNext())
-                            {
+                    if (values != null) {
+                        if (values instanceof Collection) {
+                            Iterator valueIter = ((Collection) values).iterator();
+                            while (valueIter.hasNext()) {
                                 Object value = valueIter.next();
-                                if(value != null)
-                                {
-                                    if(type == TEXT)
-                                    {
+                                if (value != null) {
+                                    if (type == TEXT) {
                                         doc.add(new Field(key.toString(), value.toString(), Field.Store.YES, Field.Index.ANALYZED));
-                                    }
-                                    else
-                                    {
+                                    } else {
                                         doc.add(new Field(key.toString(), value.toString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
                                     }
                                 }
                             }
-                        }
-                        else
-                        {
-                            if(type == TEXT)
-                            {
+                        } else {
+                            if (type == TEXT) {
                                 doc.add(new Field(key.toString(), values.toString(), Field.Store.YES, Field.Index.ANALYZED));
-                            }
-                            else
-                            {
+                            } else {
                                 doc.add(new Field(key.toString(), values.toString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
                             }
                         }
                     }
                 }
-            } 
+            }
         }
     }
-    
-    private void addFieldsToParsedObject(Document doc, ParsedObject o)
-    {
-        try
-        {
+
+    private void addFieldsToParsedObject(Document doc, ParsedObject o) {
+        try {
             MultiMap multiKeywords = new MultiValueMap();
             MultiMap multiFields = new MultiValueMap();
             HashMap fieldMap = new HashMap();
-            
+
             Field classNameField = doc.getField(ParsedObject.FIELDNAME_CLASSNAME);
-            if(classNameField != null)
-            {
+            if (classNameField != null) {
                 String className = classNameField.stringValue();
                 o.setClassName(className);
                 ObjectHandler handler = handlerFactory.getHandler(className);
-                
+
                 Set fields = handler.getFields();
                 addFieldsToMap(doc, fields, multiFields);
                 addFieldsToMap(doc, fields, fieldMap);
-                
+
                 Set keywords = handler.getKeywords();
                 addFieldsToMap(doc, keywords, multiKeywords);
             }
-            
+
             o.setKeywordsMap(multiKeywords);
             o.setFields(multiFields);
             o.setFields(fieldMap);
-        }
-        catch(Exception e)
-        {
+        } catch (Exception e) {
             //logger.error("Error trying to add fields to parsed object.", e);
         }
     }
-    
-    private void addFieldsToMap(Document doc, Set fieldNames, Map fields)
-    {
+
+    private void addFieldsToMap(Document doc, Set fieldNames, Map fields) {
         Iterator fieldIter = fieldNames.iterator();
-        while(fieldIter.hasNext())
-        {
-            String fieldName = (String)fieldIter.next();
+        while (fieldIter.hasNext()) {
+            String fieldName = (String) fieldIter.next();
             Field[] docFields = doc.getFields(fieldName);
-            if(docFields != null)
-            {
-                for(int i=0; i<docFields.length; i++)
-                {
+            if (docFields != null) {
+                for (int i = 0; i < docFields.length; i++) {
                     Field field = docFields[i];
-                    if(field != null)
-                    {
+                    if (field != null) {
                         String value = field.stringValue();
                         fields.put(fieldName, value);
                     }
@@ -720,80 +620,80 @@ public class SearchEngineImpl implements
             }
         }
     }
-    
-    private void validateIndexDirectory() throws Exception
-    {
+
+    @Override
+    public void indexDirectory(String dir) throws IOException {
+        Collection<Object> docs = new ArrayList<>();
+        indexDocs(new File(dir), docs);
+        this.add(docs);
+    }
+
+    private void indexDocs(File file, Collection<Object> docs) throws IOException {
+        if (file.canRead()) {
+            if (file.isDirectory()) {
+                String[] files = file.list();
+                if (files != null) {
+                    for (int i = 0; i < files.length; i++) {
+                        indexDocs(new File(file, files[i]), docs);
+                    }
+                }
+            } else {
+                docs.add(file.toURI().toURL());
+            }
+        }
+    }
+
+    private void validateIndexDirectory() throws Exception {
         boolean recreateIndex = false;
-        
+
         IndexReader indexReader = null;
         Searcher searcher = null;
-        
-        try
-        {
+
+        try {
             indexReader = IndexReader.open(directory);
             searcher = new IndexSearcher(indexReader);
             searcher.close();
             searcher = null;
             indexReader.close();
             indexReader = null;
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             recreateIndex = true;
-        }
-        finally
-        {
-            if (searcher != null)
-            {
-                try 
-                {
+        } finally {
+            if (searcher != null) {
+                try {
                     searcher.close();
-                }
-                catch (Exception ce)
-                {
+                } catch (Exception ce) {
                 }
             }
-            if (indexReader != null)
-            {
-                try 
-                {
+            if (indexReader != null) {
+                try {
                     indexReader.close();
-                }
-                catch (Exception ce)
-                {
+                } catch (Exception ce) {
                 }
             }
         }
-        
-        if (recreateIndex)
-        {
+
+        if (recreateIndex) {
             IndexWriter indexWriter = null;
-            
-            try
-            {
+
+            try {
                 indexWriter = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
                 indexWriter.close();
                 indexWriter = null;
-            }
-            catch (Exception e1)
-            {
-                String message = "Cannot RECREATE Portlet Registry indexes in "  + directory;
+            } catch (Exception e1) {
+                String message = "Cannot RECREATE Portlet Registry indexes in " + directory;
                 log.error(message, e1);
                 throw new Exception(message);
-            }
-            finally
-            {
-                if (indexWriter != null)
-                {
-                    try 
-                    {
+            } finally {
+                if (indexWriter != null) {
+                    try {
                         indexWriter.close();
-                    }
-                    catch (Exception ce)
-                    {
+                    } catch (Exception ce) {
                     }
                 }
             }
         }
+
+
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/main/java/org/apache/jetspeed/search/solr/SolrSearchEngineImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/main/java/org/apache/jetspeed/search/solr/SolrSearchEngineImpl.java?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/main/java/org/apache/jetspeed/search/solr/SolrSearchEngineImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/main/java/org/apache/jetspeed/search/solr/SolrSearchEngineImpl.java Mon Dec 21 04:04:51 2015
@@ -16,18 +16,6 @@
  */
 package org.apache.jetspeed.search.solr;
 
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.commons.collections.MultiMap;
 import org.apache.commons.collections.map.MultiValueMap;
 import org.apache.commons.lang.StringUtils;
@@ -50,6 +38,19 @@ import org.apache.solr.common.SolrInputF
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * @version $Id: SolrSearchEngineImpl.java 1086464 2011-03-29 02:08:39Z woonsan $
  */
@@ -75,7 +76,10 @@ public class SolrSearchEngineImpl implem
                                           "description",
                                           "fieldname.description"
                                           ));
-    
+
+    private Boolean documentsEnabled = false;
+    private String documentsLocation = null;
+
     public SolrSearchEngineImpl(SolrServer server, boolean optimzeAfterUpdate, HandlerFactory handlerFactory)
     {
         this.server = server;
@@ -93,6 +97,22 @@ public class SolrSearchEngineImpl implem
         this.searchableMetadataFieldNames = searchableMetadataFieldNames;
     }
 
+    public Boolean getDocumentsEnabled() {
+        return documentsEnabled;
+    }
+
+    public void setDocumentsEnabled(Boolean documentsEnabled) {
+        this.documentsEnabled = documentsEnabled;
+    }
+
+    public String getDocumentsLocation() {
+        return documentsLocation;
+    }
+
+    public void setDocumentsLocation(String documentsLocation) {
+        this.documentsLocation = documentsLocation;
+    }
+
     /* (non-Javadoc)
      * @see org.apache.jetspeed.search.SearchEnging#add(java.lang.Object)
      */
@@ -215,10 +235,32 @@ public class SolrSearchEngineImpl implem
     {
         return search(queryString, defaultFieldName, 0);
     }
-    
+
+    @Override
+    public void indexDirectory(String dir) throws IOException {
+        Collection<Object> docs = new ArrayList<>();
+        indexDocs(new File(dir), docs);
+        this.add(docs);
+    }
+
+    private void indexDocs(File file, Collection<Object> docs) throws IOException {
+        if (file.canRead()) {
+            if (file.isDirectory()) {
+                String[] files = file.list();
+                if (files != null) {
+                    for (int i = 0; i < files.length; i++) {
+                        indexDocs(new File(file, files[i]), docs);
+                    }
+                }
+            } else {
+                docs.add(file.toURI().toURL());
+            }
+        }
+    }
+
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.search.SearchEngine#search(java.lang.String, java.lang.String, int)
-     */
+         * @see org.apache.jetspeed.search.SearchEngine#search(java.lang.String, java.lang.String, int)
+         */
     public SearchResults search(String queryString, String defaultFieldName, int topHitsCount)
     {
         SearchResults results = null;
@@ -574,5 +616,16 @@ public class SolrSearchEngineImpl implem
             }
         }
     }
+
+    public void start() throws IOException {
+        if (documentsEnabled) {
+            String query = ParsedObject.FIELDNAME_TYPE + ":\"" + ParsedObject.OBJECT_TYPE_URL + "\" ";
+            SearchResults searchResults = search(query);
+            if (searchResults.size() == 0) {
+                log.info("Adding Jetspeed documentation to search index ....");
+                indexDirectory(documentsLocation);
+            }
+        }
+    }
 
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/test/java/org/apache/jetspeed/search/lucene/TestPortletRegistrySearch.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/test/java/org/apache/jetspeed/search/lucene/TestPortletRegistrySearch.java?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/test/java/org/apache/jetspeed/search/lucene/TestPortletRegistrySearch.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-search/src/test/java/org/apache/jetspeed/search/lucene/TestPortletRegistrySearch.java Mon Dec 21 04:04:51 2015
@@ -16,13 +16,8 @@
  */
 package org.apache.jetspeed.search.lucene;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
 import junit.framework.Test;
 import junit.framework.TestSuite;
-
 import org.apache.commons.collections.MultiHashMap;
 import org.apache.jetspeed.search.AbstractObjectHandler;
 import org.apache.jetspeed.search.BaseParsedObject;
@@ -30,7 +25,7 @@ import org.apache.jetspeed.search.Parsed
 import org.apache.jetspeed.search.SearchEngine;
 import org.apache.jetspeed.search.SearchResults;
 import org.apache.jetspeed.search.handlers.HandlerFactoryImpl;
-import org.apache.jetspeed.search.lucene.SearchEngineImpl;
+import org.apache.jetspeed.search.handlers.URLToDocHandler;
 import org.apache.jetspeed.test.JetspeedTestCase;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
@@ -38,6 +33,11 @@ import org.apache.lucene.store.Directory
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.Version;
 
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * TestPortletRegistrySearch
  * @version $Id$
@@ -81,9 +81,10 @@ public class TestPortletRegistrySearch e
         super.setUp();
         HashMap mapping = new HashMap();
         mapping.put("java.util.HashMap", MapObjectHandler.class.getName());
+        mapping.put("java.net.URL", URLToDocHandler.class.getName());
         HandlerFactoryImpl hfi = new HandlerFactoryImpl(mapping);
         directory = new RAMDirectory();
-        analyzer = new StandardAnalyzer(Version.LUCENE_29);
+        analyzer = new StandardAnalyzer(Version.LUCENE_30);
         searchEngine = new SearchEngineImpl(directory, analyzer, true, hfi);
     }
     
@@ -225,7 +226,36 @@ public class TestPortletRegistrySearch e
         searchResults = searchEngine.search(query);
         assertEquals(1, searchResults.size());
     }
-    
+
+    public void testIndexFileURL() throws Exception
+    {
+        searchEngine.add(new File(getBaseDir() + "src/test/testdocs/about.html").toURI().toURL());
+        searchEngine.add(new File(getBaseDir() + "src/test/testdocs/developers.html").toURI().toURL());
+        searchEngine.add(new File(getBaseDir() + "src/test/testdocs/welcome.html").toURI().toURL());
+
+        SearchResults searchResults = searchEngine.search("Captcha");
+        assertEquals(1, searchResults.size());
+
+        searchResults = searchEngine.search("Architecture");
+        assertEquals(2, searchResults.size());
+    }
+
+    public void testIndexDirectory() throws Exception
+    {
+        searchEngine.indexDirectory(getBaseDir() + "src/test/testdocs");
+
+        SearchResults searchResults = searchEngine.search("Captcha");
+        assertEquals(1, searchResults.size());
+
+        searchResults = searchEngine.search("Architecture");
+        assertEquals(2, searchResults.size());
+
+        String query = ParsedObject.FIELDNAME_TYPE + ":\"" + ParsedObject.OBJECT_TYPE_URL + "\" ";
+        searchResults = searchEngine.search(query);
+        assertEquals(3, searchResults.size());
+
+    }
+
     public static class MapObjectHandler extends AbstractObjectHandler
     {
         private String keyPrefix;

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/search/SearchEngine.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/search/SearchEngine.java?rev=1721081&r1=1721080&r2=1721081&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/search/SearchEngine.java (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/search/SearchEngine.java Mon Dec 21 04:04:51 2015
@@ -16,6 +16,7 @@
  */
 package org.apache.jetspeed.search;
 
+import java.io.IOException;
 import java.util.Collection;
 
 /**
@@ -118,4 +119,12 @@ public interface SearchEngine
      * @return
      */
     SearchResults search(String query, String defaultFieldName, int topHitsCount);
+
+    /**
+     * Index a directory of files
+     *
+     * Recursively index contents of a directory
+     * @since 2.3.1
+     */
+    void indexDirectory(String directory) throws IOException;
 }




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


Mime
View raw message