Index: /gs3-extensions/fedora/trunk/src/README
===================================================================
--- /gs3-extensions/fedora/trunk/src/README	(revision 26433)
+++ /gs3-extensions/fedora/trunk/src/README	(revision 26434)
@@ -4,4 +4,5 @@
 
 A. To install your GS3 Fedora extension from fedora3-gs3ext.tar.gz
+	Uninstalling Fedora
 
 B. How to manually build fedora collections
@@ -21,5 +22,5 @@
 Fedora GSearch 2.5
 
-Web services pages once installed: 
+Web services pages once installed (by default GS3 is set to use localhost:8383): 
 http://localhost:8383/fedora/services
 http://localhost:8383/fedoragsearch/services
@@ -58,4 +59,5 @@
 	#fedora.maxpermsize=-XX:MaxPermSize=128m
 	#fedora.password=pounamu
+	#index.writelock.timeout=10000
 
 Uncomment all these properties and change the value for the fedora password if necessary:
@@ -65,5 +67,5 @@
 	fedora.maxpermsize=-XX:MaxPermSize=128m
 	fedora.password=pounamu		
-
+	index.writelock.timeout=10000
 
 6. Use a terminal to go into this folder:
@@ -89,4 +91,6 @@
 	$ ./gli/fli.sh
 
+
+9. Once you've tested everything is working, you may want to set logging level of Fedora GSearch to log ERRORs rather than all DEBUG statements. See the Debugging section in this file.
 
 
@@ -138,4 +142,19 @@
 
 
+*****************************************
+UNINSTALLING FEDORA
+*****************************************
+
+1. Make sure tomcat is stopped.
+
+2. Go to /GS3/ext/fedora3 and run:
+	ant uninstall-fedora
+
+The above will remove 
+- the deployed webapps (fedora, fedoragsearch, fedora-demo, fop, imagemanip and saxon.war)
+- as well as the ext/fedora3 folder itself.
+
+
+
 ********************************************************************************************************************
 					B. Manual building of fedora collections
@@ -152,8 +171,8 @@
 	source gs3-setup.bash
 
-3. Create a new collection with mkcol.pl. Call it "fedora1" for example 
-	mkcol.pl -site localsite fedora1
-
-(Deprecated: mkcol.pl -gs3mode -collectdir /<GS3>/web/sites/localsite/collect fedora1)
+3. Create a new collection with mkcol.pl.
+	mkcol.pl -site localsite <COLNAME>
+
+(Deprecated: mkcol.pl -gs3mode -collectdir /<GS3>/web/sites/localsite/collect <COLNAME>)
 
 4. Run import and build to ingest the new collection. Make sure to use the correct host and port, as specified in your /<GS3>/build.properties file.
@@ -161,8 +180,8 @@
 - First put the documents you want into the import directory of your new collection.
 
-- g2f-import.pl -hostname localhost -port 8383 -password pounamu -removeold -collectdir /<GS3>/web/sites/localsite/collect fedora1
+- g2f-import.pl -hostname localhost -port 8383 -password pounamu -removeold -collectdir /<GS3>/web/sites/localsite/collect <COLNAME>
 (password may be optional at this stage, by include it for convenience)
 
-- g2f-buildcol.pl -hostname localhost -port 8383 -password pounamu -removeold -collectdir /<GS3>/web/sites/localsite/collect fedora1
+- g2f-buildcol.pl -hostname localhost -port 8383 -password pounamu -removeold -collectdir /<GS3>/web/sites/localsite/collect <COLNAME>
 
 
@@ -181,4 +200,9 @@
 - use FLI to transfer dls to dc metadata upon Gathering the documents.
 - then before building, turn on the description_tags in the HTMLPlugin.
+Or manually add to the etc/collectionConfig.xml of the demo collection:
+
+	<plugin name="HTMLPlugin">
+	  <option name="-description_tags"/>
+	</plugin>
 
 
@@ -190,5 +214,4 @@
 Also open each folder's jpg document cover image in GIMP and resave under the same name (at 100% quality).
 
-
 6. If you ran FLI, exit it. It should stop the Greenstone server.
 
@@ -202,5 +225,5 @@
 	ant start
 
-8. To activate the collection, first visit the web page
+8. Alternatively, to activate the collection, first visit the web page
 http://<host>:<port>/greenstone3/library?a=s&sa=a&st=collection&sn=<COLNAME>
 
@@ -217,6 +240,9 @@
 Deleting a Fedora GS3 collection is accomplished with the following 2 steps:
 
-1. Run the g2f-deletecol.pl script over the collection to be deleted. Assuming the collection is called fedora1, you'd run:
-	g2f-deletecol.pl -hostname localhost -port 8383 -password pounamu -collectdir /<GS3>/web/sites/localsite/collect fedora1
+1. Run the g2f-deletecol.pl script over the collection to be deleted:
+	g2f-deletecol.pl -hostname localhost -port 8383 -password pounamu -collectdir /<GS3>/web/sites/localsite/collect <COLNAME>
+
+(Note: no -removeold flag, otherwise the command is similar to the g2f-import.pl and g2f-buildcol.pl scripts)
+
 2. Manually delete the Greenstone collection directory from the filesystem
 
@@ -224,10 +250,10 @@
 To run this manually, 
 - first remove the pids from the GSearch index:
-/<GS3>/packages/tomcat/webapps/fedoragsearch/client>/<GS3>/packages/tomcat/webapps/fedoragsearch/client/runRESTClient.sh localhost:8383 updateIndex deletePID <greenstone:fedora1-HASH010313b14474bc72b296b15f>
+/<GS3>/packages/tomcat/webapps/fedoragsearch/client>/<GS3>/packages/tomcat/webapps/fedoragsearch/client/runRESTClient.sh localhost:8383 updateIndex deletePID <DOC-PID e.g. greenstone:fedora1-HASH010313b14474bc72b296b15f>
 
 It will ask for the fedoragsearch username and password, which by default are fedoraAdmin and pounamu, respectively.
 
 - then purge the necessary documents (pids) from the fedora repository:
-/<GS3>/ext/fedora3/client/bin>./fedora-purge.sh localhost:8383 fedoraAdmin pounamu greenstone:fedora1-HASHe14e36cba08bd41c663237 http "purging"
+/<GS3>/ext/fedora3/client/bin>./fedora-purge.sh localhost:8383 fedoraAdmin pounamu <DOC-PID e.g. greenstone:fedora1-HASHe14e36cba08bd41c663237> http "purging"
 
 - You can check it's all been deleted by visiting http://localhost:8383/fedora/search 
@@ -263,7 +289,15 @@
 
 - ./install/install.properties.in
+- ./install/server.xml.in
 - ./server/config/spring/akubra-llstore.xml.in
+- ./server/config/spring/web/web.properties.in
 - ./server/config/fedora.fcfg.in
 - ./server/config/fedora-users.xml.in
+
+
+(The following also need to refer to the servername and custom Greenstone tomcat port
+- ./client/bin/fedora-ingest-demos.bat.in
+- ./client/bin/fedora-ingest-demos.sh.in)
+
 
 All these files get converted to filenames without the ".in" suffix upon installation, and placeholder strings in these template files get replaced. The replacements are on the strings 
@@ -394,5 +428,7 @@
 
 The installation process will write out this property into GSearch's FgsConfig/FgsConfigIndexTemplate/Lucene/index.properties: 
-	fgsindex.defaultWriteLockTimeout = 1000
+	fgsindex.defaultWriteLockTimeout = 10000
+
+(Another relevant place to change it would be ./FgsConfig/configDemoOnLucene/fgsconfigFinal/index/FgsIndex/index.properties)
 
 When fedoragsearch then gets deployed, this value will be propagated into: 
@@ -576,19 +612,22 @@
     </filter>
 
-7. Start tomcat to have it deploy fedoragsearch.
+7. Open GSearch's FgsConfig/FgsConfigIndexTemplate/Lucene/index.properties and adjust the lock timeout property to 1000 or 10000 ms:
+	fgsindex.defaultWriteLockTimeout = 10000
+
+8. Start tomcat to have it deploy fedoragsearch.
 This will unpack fedoragsearch.
 
-8. With tomcat running, configure fedoragsearch, which will adjust various config files. You will need to go into the deployed fedoragsearch webapps folder's FgsConfig folder first to be able to run the configuration target:
+9. With tomcat running, configure fedoragsearch, which will adjust various config files. You will need to go into the deployed fedoragsearch webapps folder's FgsConfig folder first to be able to run the configuration target:
 
 	<GS3>/packages/tomcat/webapps/fedoragsearch/FgsConfig>ant -f fgsconfig-basic.xml
 
-9. With tomcat still running, run updateIndex once to create the empty index for the first time (by running the runRESTClient.sh script with the command: "host:port updateIndex createEmpty [indexName]")
+19. With tomcat still running, run updateIndex once to create the empty index for the first time (by running the runRESTClient.sh script with the command: "host:port updateIndex createEmpty [indexName]")
 
 	./<GS3>/packages/tomcat/webapps/fedoragsearch/client/runRESTClient.sh localhost:8383 updateIndex createEmpty FgsIndex
 
-10. Check fedoragsearch has been properly installed by visiting:
+11. Check fedoragsearch has been properly installed by visiting:
 http://localhost:8383/fedoragsearch/rest
 
-10. If you wish to remove the various war files from GS3's tomcat webapps folder, you will need to stop tomcat first before deleting the war files, because doing so when tomcat is running will undeploy those webapps.
+12. If you wish to remove the various war files from GS3's tomcat webapps folder, you will need to stop tomcat first before deleting the war files, because doing so when tomcat is running will undeploy those webapps.
 
 
Index: /gs3-extensions/fedora/trunk/src/build.xml
===================================================================
--- /gs3-extensions/fedora/trunk/src/build.xml	(revision 26433)
+++ /gs3-extensions/fedora/trunk/src/build.xml	(revision 26434)
@@ -67,8 +67,18 @@
     <copy file="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/fgsconfig-basic.properties.in" tofile="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/fgsconfig-basic.properties" filtering="true" overwrite="true"/>
     <copy file="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/index.properties.in" tofile="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/index.properties" filtering="true" overwrite="true"/>
+    <copy file="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/foxmlToLucene.xslt.in" tofile="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/foxmlToLucene.xslt" filtering="true" overwrite="true"/>
+    <copy file="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/foxmlToLuceneGenerated.xslt.in" tofile="${basedir}/adjust_war_files/fedoragsearch/FgsConfig/FgsConfigIndexTemplate/Lucene/foxmlToLuceneGenerated.xslt" filtering="true" overwrite="true"/>
+
+
+    <copy file="${basedir}/install/server.xml.in" tofile="${basedir}/install/server.xml" filtering="true" overwrite="true"/>
     <copy file="${basedir}/install/install.properties.in" tofile="${basedir}/install/install.properties" filtering="true" overwrite="true"/>
     <copy file="${basedir}/server/config/fedora.fcfg.in" tofile="${basedir}/server/config/fedora.fcfg" filtering="true" overwrite="true"/>
     <copy file="${basedir}/server/config/fedora-users.xml.in" tofile="${basedir}/server/config/fedora-users.xml" filtering="true" overwrite="true"/>
     <copy file="${basedir}/server/config/spring/akubra-llstore.xml.in" tofile="${basedir}/server/config/spring/akubra-llstore.xml" filtering="true" overwrite="true"/>
+    <copy file="${basedir}/server/config/spring/web/web.properties.in" tofile="${basedir}/server/config/spring/web/web.properties" filtering="true" overwrite="true"/>
+
+    <!-- not really important, just host and port values in demo ingest files -->
+    <copy file="${basedir}/client/bin/fedora-ingest-demos.sh.in" tofile="${basedir}/client/bin/fedora-ingest-demos.sh" filtering="true" overwrite="true"/>
+    <copy file="${basedir}/client/bin/fedora-ingest-demos.bat.in" tofile="${basedir}/client/bin/fedora-ingest-demos.bat" filtering="true" overwrite="true"/>
 
     <!-- zip up fedoragsearch, rename as .war file and put it in the install folder-->
@@ -125,4 +135,6 @@
     <chmod file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/client/runRESTClient.sh" perm="755"/>
     <chmod file="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch/client/runSOAPClient.sh" perm="755"/>
+
+    <chmod file="${basedir}/client/bin/fedora-ingest-demos.sh" perm="755"/>
     
     <!-- call Update EmptyIndex on GSearch to create the initial index (segments) file:
@@ -188,3 +200,23 @@
   </target>
   
+  <target name="uninstall-fedora" 
+	  description="Uninstalls the Greenstone 3 Fedora extension (including GSearch). Tomcat must not be running when this target is run.">
+    <!-- clean up the war files -->
+    <delete dir="${gsdl3src.home}/packages/tomcat/webapps/fedora"/>
+    <delete dir="${gsdl3src.home}/packages/tomcat/webapps/fedoragsearch"/>
+    <delete dir="${gsdl3src.home}/packages/tomcat/webapps/fedora-demo"/>
+    <delete dir="${gsdl3src.home}/packages/tomcat/webapps/fop"/>
+    <delete dir="${gsdl3src.home}/packages/tomcat/webapps/imagemanip"/>
+    <delete dir="${gsdl3src.home}/packages/tomcat/webapps/saxon"/>
+
+    <!-- attempt to remove GS3/ext/fedora3 -->
+    <delete dir="${basedir}"/>
+    <echo>
+      *********************************************************
+      Fedora uninstall complete.
+      *********************************************************
+   </echo>
+    
+  </target>
+
 </project>
Index: /gs3-extensions/fedora/trunk/src/fedora-files/fedora-ingest-demos.bat.in
===================================================================
--- /gs3-extensions/fedora/trunk/src/fedora-files/fedora-ingest-demos.bat.in	(revision 26434)
+++ /gs3-extensions/fedora/trunk/src/fedora-files/fedora-ingest-demos.bat.in	(revision 26434)
@@ -0,0 +1,28 @@
+@echo off
+setlocal
+
+if not "%FEDORA_HOME%" == "" goto gotFedoraHome
+echo ERROR: The FEDORA_HOME environment variable is not defined.
+exit /B 1
+:gotFedoraHome
+
+set LAUNCHER="%FEDORA_HOME%\client\bin\env-client.bat"
+
+if not "%5"=="" goto enoughArgs
+echo ERROR: Not enough arguments.
+echo Usage:
+echo   fedora-ingest-demos host port user password protocol [context]
+echo Example:
+echo   fedora-ingest-demos @tomcatserver@ @tomcatport@ fedoraAdmin @fedorapassw@ http my-fedora
+exit /B 1
+:enoughArgs
+
+set DEMO_PATH="%FEDORA_HOME%\client\demo\foxml\local-server-demos"
+set DEMO_FORMAT=info:fedora/fedora-system:FOXML-1.1
+
+set ARGS=d
+set ARGS=%ARGS% %DEMO_PATH%
+set ARGS=%ARGS% %DEMO_FORMAT%
+set ARGS=%ARGS% "%1:%2" %3 %4 %5 "" %6
+
+call %LAUNCHER% org.fcrepo.client.utility.ingest.Ingest %ARGS%
Index: /gs3-extensions/fedora/trunk/src/fedora-files/fedora-ingest-demos.sh.in
===================================================================
--- /gs3-extensions/fedora/trunk/src/fedora-files/fedora-ingest-demos.sh.in	(revision 26434)
+++ /gs3-extensions/fedora/trunk/src/fedora-files/fedora-ingest-demos.sh.in	(revision 26434)
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+scriptdir=`dirname "$0"`
+. "$scriptdir"/env-client.sh
+
+if [ $# -lt 5 ]; then
+	echo "ERROR: Not enough arguments."
+	echo "Usage:"
+	echo "  fedora-ingest-demos host port user password protocol [context]"
+	echo "Example:"
+	echo "  fedora-ingest-demos @tomcatserver@ @tomcatport@ fedoraAdmin @fedorapassw@ http my-fedora"
+	exit 1
+fi
+
+demo_path="$FEDORA_HOME"/client/demo/foxml/local-server-demos
+demo_format=info:fedora/fedora-system:FOXML-1.1
+
+args="\"d\" \"$demo_path\" \"$demo_format\" \"$1:$2\" \"$3\" \"$4\" \"$5\" \"\" \"$6\""
+
+execWithTheseArgs org.fcrepo.client.utility.ingest.Ingest "$args"
+
+exit $?
Index: /gs3-extensions/fedora/trunk/src/fedora-files/fedora.fcfg.in
===================================================================
--- /gs3-extensions/fedora/trunk/src/fedora-files/fedora.fcfg.in	(revision 26433)
+++ /gs3-extensions/fedora/trunk/src/fedora-files/fedora.fcfg.in	(revision 26434)
@@ -58,5 +58,5 @@
 		datastreamExpirationLimit.</comment>
   </param>
-  <param name="fedoraServerPort" value="8383">
+  <param name="fedoraServerPort" value="@tomcatport@">
     <comment>Defines the port number on which the Fedora server runs; 
 		default is 8080.</comment>
@@ -188,5 +188,5 @@
             directory (unpackaged), or the $CATALINA_HOME/webapps/fedora/WEB_INF/lib director (packaged).</comment>
     </param>
-    <param name="gSearchRESTURL" value="http://localhost:8080/fedoragsearch/rest">
+    <param name="gSearchRESTURL" value="http://@tomcatserver@:@tomcatport@/fedoragsearch/rest">
       <comment>The REST endpoint of the Fedora Generic Search service.
             This parameter is only required if GSearchDOManager is 
Index: /gs3-extensions/fedora/trunk/src/fedora-files/server.xml.in
===================================================================
--- /gs3-extensions/fedora/trunk/src/fedora-files/server.xml.in	(revision 26434)
+++ /gs3-extensions/fedora/trunk/src/fedora-files/server.xml.in	(revision 26434)
@@ -0,0 +1,118 @@
+<?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.
+-->
+<!-- Note:  A "Server" is not itself a "Container", so you may not
+     define subcomponents such as "Valves" at this level.
+     Documentation at /docs/config/server.html
+ -->
+<Server port="8305" shutdown="SHUTDOWN"> 
+  <!-- Security listener. Documentation at /docs/config/listeners.html
+  <Listener className="org.apache.catalina.security.SecurityListener" />
+  -->  
+  <!--APR library loader. Documentation at /docs/apr.html -->  
+  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>  
+  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->  
+  <Listener className="org.apache.catalina.core.JasperListener"/>  
+  <!-- Prevent memory leaks due to use of particular java/javax APIs-->  
+  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>  
+  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>  
+  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>  
+  <!-- Global JNDI resources
+       Documentation at /docs/jndi-resources-howto.html
+  -->  
+  <GlobalNamingResources> 
+    <!-- Editable user database that can also be used by
+         UserDatabaseRealm to authenticate users
+    -->  
+    <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/> 
+  </GlobalNamingResources>  
+  <!-- A "Service" is a collection of one or more "Connectors" that share
+       a single "Container" Note:  A "Service" is not itself a "Container",
+       so you may not define subcomponents such as "Valves" at this level.
+       Documentation at /docs/config/service.html
+   -->  
+  <Service name="Catalina"> 
+    <!--The connectors can use a shared executor, you can define one or more named thread pools-->  
+    <!--
+    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
+        maxThreads="150" minSpareThreads="4"/>
+    -->  
+    <!-- A "Connector" represents an endpoint by which requests are received
+         and responses are returned. Documentation at :
+         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
+         Java AJP  Connector: /docs/config/ajp.html
+         APR (HTTP/AJP) Connector: /docs/apr.html
+         Define a non-SSL HTTP/1.1 Connector on port 8383
+    -->  
+    <Connector port="@tomcatport@" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" compression="on" compressionMinSize="524288" compressableMimeType="text/html,text/xml,text/css,text/xsl,text/javascript" noCompressionUserAgents="gozilla, traviata" URIEncoding="UTF-8" enableLookups="true" acceptCount="100" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"/>  
+    <!-- A "Connector" using the shared thread pool-->  
+    <!--
+    <Connector executor="tomcatThreadPool"
+               port="8080" protocol="HTTP/1.1"
+               connectionTimeout="20000"
+               redirectPort="8443" />
+    -->  
+    <!-- Define a SSL HTTP/1.1 Connector on port 8443
+         This connector uses the JSSE configuration, when using APR, the
+         connector should be using the OpenSSL style configuration
+         described in the APR documentation -->  
+    <!--
+    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
+               maxThreads="150" scheme="https" secure="true"
+               clientAuth="false" sslProtocol="TLS" />
+    -->  
+    <!-- Define an AJP 1.3 Connector on port 8009 -->  
+    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/>  
+    <!-- An Engine represents the entry point (within Catalina) that processes
+         every request.  The Engine implementation for Tomcat stand alone
+         analyzes the HTTP headers included with the request, and passes them
+         on to the appropriate Host (virtual host).
+         Documentation at /docs/config/engine.html -->  
+    <!-- You should set jvmRoute to support load-balancing via AJP ie :
+    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
+    -->  
+    <Engine name="Catalina" defaultHost="localhost"> 
+      <!--For clustering, please take a look at documentation at:
+          /docs/cluster-howto.html  (simple how to)
+          /docs/config/cluster.html (reference documentation) -->  
+      <!--
+      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
+      -->  
+      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
+           via a brute-force attack -->  
+      <Realm className="org.apache.catalina.realm.LockOutRealm"> 
+        <!-- This Realm uses the UserDatabase configured in the global JNDI
+             resources under the key "UserDatabase".  Any edits
+             that are performed against this UserDatabase are immediately
+             available for use by the Realm.  -->  
+        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> 
+      </Realm>  
+      <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> 
+        <!-- SingleSignOn valve, share authentication between web applications
+             Documentation at: /docs/config/valve.html -->  
+        <!--
+        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+        -->  
+        <!-- Access log processes all example.
+             Documentation at: /docs/config/valve.html
+             Note: The pattern used is equivalent to using pattern="common" -->  
+        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/> 
+      </Host> 
+    </Engine> 
+  </Service> 
+</Server>
Index: /gs3-extensions/fedora/trunk/src/fedora-files/web.properties.in
===================================================================
--- /gs3-extensions/fedora/trunk/src/fedora-files/web.properties.in	(revision 26434)
+++ /gs3-extensions/fedora/trunk/src/fedora-files/web.properties.in	(revision 26434)
@@ -0,0 +1,10 @@
+#Spring override properties
+#Fri Oct 19 15:27:23 NZDT 2012
+security.ssl.api.management=ANY_CHANNEL
+security.auth.filters=AuthFilterJAAS
+security.fesl.authN.jaas.apia.enabled=false
+fedora.port=@tomcatport@
+security.fesl.authZ.enabled=false
+fedora.port.secure=@tomcatport@
+security.ssl.api.default=ANY_CHANNEL
+security.ssl.api.access=ANY_CHANNEL
Index: /gs3-extensions/fedora/trunk/src/fedoragsearch-files/fgsconfig-basic.properties.in
===================================================================
--- /gs3-extensions/fedora/trunk/src/fedoragsearch-files/fgsconfig-basic.properties.in	(revision 26433)
+++ /gs3-extensions/fedora/trunk/src/fedoragsearch-files/fgsconfig-basic.properties.in	(revision 26434)
@@ -51,5 +51,5 @@
 
   # fedoraBase is base url of the repository.
-  fedoraBase=http://localhost:8383
+  fedoraBase=http://@tomcatserver@:@tomcatport@
 
   # fedoraAppName is Fedora app name of this repository.
Index: 3-extensions/fedora/trunk/src/fedoragsearch-files/foxmlToLucene.xslt
===================================================================
--- /gs3-extensions/fedora/trunk/src/fedoragsearch-files/foxmlToLucene.xslt	(revision 26433)
+++ 	(revision )
@@ -1,224 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?> 
-<!-- $Id: foxmlToLucene.xslt $ -->
-<xsl:stylesheet version="1.0"
-		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   
-    	xmlns:exts="xalan://dk.defxws.fedoragsearch.server.GenericOperationsImpl"
-    		exclude-result-prefixes="exts"
-		xmlns:foxml="info:fedora/fedora-system:def/foxml#"
-		xmlns:dtu_meta="http://www.dtu.dk/dtu_meta/" 
-		xmlns:meta="http://www.dtu.dk/dtu_meta/meta/"
-		xmlns:dc="http://purl.org/dc/elements/1.1/"
-		xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
-		xmlns:ex="http://www.greenstone.org/namespace/fake/ex"
-		xmlns:dls="http://www.greenstone.org/namespace/fake/dls">
-	<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
-		
-	<xsl:param name="REPOSITORYNAME" select="'FgsRepos'"/>
-	<xsl:param name="REPOSBASEURL" select="'http://@tomcatserver@:@tomcatport@/fedora'"/>
-	<xsl:param name="FEDORASOAP" select="'http://@tomcatserver@:@tomcatport@/fedora/services'"/>
-	<xsl:param name="FEDORAUSER" select="'fedoraAdmin'"/>
-	<xsl:param name="FEDORAPASS" select="'@fedorapassw@'"/>
-	<xsl:param name="TRUSTSTOREPATH" select="'trustStorePath'"/>
-	<xsl:param name="TRUSTSTOREPASS" select="'trustStorePass'"/>
-<!--
-	 This xslt stylesheet generates the IndexDocument consisting of IndexFields
-     from a FOXML record. The IndexFields are:
-       - from the root element = PID
-       - from foxml:property   = type, state, contentModel, ...
-       - from oai_dc:dc        = title, creator, ...
-     The IndexDocument element gets a PID attribute, which is mandatory,
-     while the PID IndexField is optional.
-     Options for tailoring:
-       - IndexField types, see Lucene javadoc for Field.Store, Field.Index, Field.TermVector
-       - IndexField boosts, see Lucene documentation for explanation
-       - IndexDocument boosts, see Lucene documentation for explanation
-       - generation of IndexFields from other XML metadata streams than DC
-         - e.g. as for uvalibdesc included above and called below, the XML is inline
-         - for not inline XML, the datastream may be fetched with the document() function,
-           see the example below (however, none of the demo objects can test this)
-       - generation of IndexFields from other datastream types than XML
-         - from datastream by ID, text fetched, if mimetype can be handled
-         - from datastream by sequence of mimetypes, 
-           text fetched from the first mimetype that can be handled,
-           default sequence given in properties.
--->
-
-	<xsl:variable name="PID" select="/foxml:digitalObject/@PID"/>
-	<xsl:variable name="docBoost" select="1.4*2.5"/> <!-- or any other calculation, default boost is 1.0 -->
-	
-	<xsl:template match="/">
-		<IndexDocument> 
-		    <!-- The PID attribute is mandatory for indexing to work -->
-			<xsl:attribute name="PID">
-				<xsl:value-of select="$PID"/>
-			</xsl:attribute>
-			<xsl:attribute name="boost"> <!-- example of setting a boost -->
-				<xsl:value-of select="$docBoost"/>
-			</xsl:attribute>
-		<!-- The following allows only active FedoraObjects to be indexed. -->
-		<xsl:if test="foxml:digitalObject/foxml:objectProperties/foxml:property[@NAME='info:fedora/fedora-system:def/model#state' and @VALUE='Active']">
-			<xsl:if test="not(foxml:digitalObject/foxml:datastream[@ID='METHODMAP'] or foxml:digitalObject/foxml:datastream[@ID='DS-COMPOSITE-MODEL'])">
-				<xsl:if test="starts-with($PID,'')">
-					<xsl:apply-templates mode="activeFedoraObject"/>
-				</xsl:if>
-			</xsl:if>
-		</xsl:if>
-		</IndexDocument>
-	</xsl:template>
-
-	<xsl:template match="/foxml:digitalObject" mode="activeFedoraObject">
-		    <!-- The PID index field lets you search on the PID value -->
-			<IndexField IFname="PID" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
-				<xsl:value-of select="$PID"/>
-			</IndexField>
-			<IndexField IFname="REPOSITORYNAME" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
-				<xsl:value-of select="$REPOSITORYNAME"/>
-			</IndexField>
-			<IndexField IFname="REPOSBASEURL" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
-				<xsl:value-of select="substring($FEDORASOAP, 1, string-length($FEDORASOAP)-9)"/>
-			</IndexField>
-			
-			<!-- indexing foxml property fields -->
-			
-			<xsl:for-each select="foxml:objectProperties/foxml:property">
-				<IndexField index="UN_TOKENIZED" store="YES" termVector="NO">
-					<xsl:attribute name="IFname"> 
-						<xsl:value-of select="concat('fgs.', substring-after(@NAME,'#'))"/>
-					</xsl:attribute>
-					<xsl:value-of select="@VALUE"/>
-				</IndexField>
-			</xsl:for-each>
-			
-			<!-- indexing inline dc fields -->
-			
-			<xsl:for-each select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/*">
-				<IndexField index="TOKENIZED" store="YES" termVector="YES">
-					<xsl:attribute name="IFname">
-						<xsl:value-of select="concat('dc.', substring-after(name(),':'))"/>
-					</xsl:attribute>
-					<xsl:value-of select="text()"/>
-				</IndexField>
-			</xsl:for-each>
-			
-			<!-- indexing dc fields for sorting (must be UN_TOKENIZED) -->
-			
-			<IndexField IFname="TITLE_UNTOK" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
-				<xsl:value-of select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/dc:title"/>
-			</IndexField>
-			<IndexField IFname="AUTHOR_UNTOK" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
-				<xsl:value-of select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/dc:creator"/>
-			</IndexField>
-
-			<!-- a datastream is fetched, if its mimetype 
-			     can be handled, the text becomes the value of the field. 
-			     This is the version using PDFBox,
-			     below is the new version using Apache Tika. -->
-			<xsl:for-each select="foxml:datastream[starts-with(@ID,'EX')]/foxml:datastreamVersion[last()]/foxml:xmlContent/ex:ex/ex:metadata">
-			  <IndexField index="TOKENIZED" store="YES" termVector="YES">
-			    <xsl:attribute name="IFname">
-			      <xsl:value-of select="concat('ex.', @name)"/>
-			    </xsl:attribute>
-			    <xsl:value-of select="text()"/>
-			  </IndexField>
-			</xsl:for-each>
-			
-			<xsl:for-each select="foxml:datastream[starts-with(@ID,'DLS')]/foxml:datastreamVersion[last()]/foxml:xmlContent/dls:dls/dls:metadata">
-			  <IndexField index="TOKENIZED" store="YES" termVector="YES">
-			    <xsl:attribute name="IFname">
-			      <xsl:value-of select="concat('dls.', @name)"/>
-			    </xsl:attribute>
-			    <xsl:value-of select="text()"/>
-			  </IndexField>
-			</xsl:for-each>
-			
-			<!-- 
-			<xsl:for-each select="foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
-				<IndexField index="TOKENIZED" store="YES" termVector="NO">
-					<xsl:attribute name="IFname">
-						<xsl:value-of select="concat('ds.', @ID)"/>
-					</xsl:attribute>
-					<xsl:value-of select="exts:getDatastreamText($PID, $REPOSITORYNAME, @ID, $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
-				</IndexField>
-			</xsl:for-each>
-			 -->
-
-			<!-- Text and metadata extraction using Apache Tika. 
-				Parameters for getDatastreamFromTika, getDatastreamTextFromTika, and getDatastreamMetadataFromTika:
-				- indexFieldTagName		: either "IndexField" (with the Lucene plugin) or "field" (with the Solr plugin)
-				- textIndexField		: fieldSpec for the text index field, null or empty if not to be generated								 (not used with getDatastreamMetadataFromTika)
-				- indexfieldnamePrefix	: optional or empty, prefixed to the metadata indexfield names											 (not used with getDatastreamTextFromTika)
-				- selectedFields		: comma-separated list of metadata fieldSpecs, if empty then all fields are included with default params (not used with getDatastreamTextFromTika)
-				- fieldSpec				: metadataFieldName ['=' indexFieldName] ['/' [index] ['/' [store] ['/' [termVector] ['/' [boost]]]]]
-						metadataFieldName must be exactly as extracted by Tika from the document. 
-										  You may see the available names if you log in debug mode, 
-										  look for "METADATA name=" under "fullDsId=" in the log, when "getFromTika" was called during updateIndex
-						indexFieldName is used as the generated index field name,
-										  if not given, GSearch uses metadataFieldName after replacement of the characters ' ', ':', '/', '=', '(', ')' with '_'
-						the following parameters are used with Lucene (with Solr these values are specified in schema.xml)
-						index			: ['TOKENIZED'|'UN_TOKENIZED']	# first alternative is default
-						store			: ['YES'|'NO']					# first alternative is default
-						termVector		: ['YES'|'NO']					# first alternative is default
-						boost			: <decimal number>				# '1.0' is default
-			-->
-			<xsl:for-each select="foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
-				<xsl:value-of disable-output-escaping="yes" select="exts:getDatastreamFromTika($PID, $REPOSITORYNAME, @ID, 'IndexField', concat('ds.', @ID), concat('dsmd_', @ID, '.'), '', $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
-			</xsl:for-each>
-
-			<!-- example of a dissemination identified in bDefPid, methodName, parameters, asOfDateTime is fetched,  
-			     if its mimetype can be handled, the text becomes the value of the IndexField. 
-			     parameters format is 'name=value name2=value2'-->
-			<!-- 
-			<IndexField IFname="fgs.Diss.text" index="TOKENIZED" store="YES" termVector="NO"
-						bDefPid="demo:19" methodName="getPDF" parameters="" asOfDateTime="" >
-			</IndexField>
-			-->
-
-			<!-- for not inline XML, the datastream may be fetched with the document() function -->
-			<!--  
-			<xsl:call-template name="example-of-xml-not-inline"/>
-			-->
-
-			<!-- This is an example of calling an extension function, see Apache Xalan, may be used for filters.
-			<IndexField IFname="fgs.DS" index="TOKENIZED" store="YES" termVector="NO">
-				<xsl:value-of select="exts:someMethod($PID)"/>
-			</IndexField>
-			-->
-			     
-			<!-- 
-			creating an index field with all text from the foxml record and its datastreams
-			-->
-
-			<IndexField IFname="foxml.all.text" index="TOKENIZED" store="YES" termVector="YES">
-				<xsl:for-each select="//text()">
-					<xsl:value-of select="."/>
-				</xsl:for-each>
-				<xsl:for-each select="//foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
-					<xsl:value-of select="exts:getDatastreamText($PID, $REPOSITORYNAME, @ID, $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
-				</xsl:for-each>
-			</IndexField>
-
-			<IndexField IFname="ds.fulltext" index="TOKENIZED" store="YES" termVector="YES">
-			  <xsl:for-each select="//foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
-			    <xsl:value-of select="exts:getDatastreamText($PID, $REPOSITORYNAME, @ID, $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
-			    <xsl:text>Â </xsl:text>
-			  </xsl:for-each>
-			</IndexField>
-
-	</xsl:template>
-	
-
-	<xsl:template name="example-of-xml-not-inline">
-	
-		<!-- due to Simon Lamb and Steve Bayliss -->
-		<!-- using the test object test:fgs23 -->
-		<!-- namespaces to be included in the stylesheet element -->
-			
-		<xsl:variable name="testMapplXml" select="document('http://localhost:8080/fedora/objects/test:fgs23/datastreams/testMapplXml/content')"/>
-		
-		<IndexField IFname="testMapplXml.meta.title"> 
-			<xsl:value-of select="$testMapplXml//meta:title"/>
-		</IndexField> 
-		
-	</xsl:template>
-	
-</xsl:stylesheet>	
Index: /gs3-extensions/fedora/trunk/src/fedoragsearch-files/foxmlToLucene.xslt.in
===================================================================
--- /gs3-extensions/fedora/trunk/src/fedoragsearch-files/foxmlToLucene.xslt.in	(revision 26434)
+++ /gs3-extensions/fedora/trunk/src/fedoragsearch-files/foxmlToLucene.xslt.in	(revision 26434)
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<!-- $Id: foxmlToLucene.xslt $ -->
+<xsl:stylesheet version="1.0"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   
+    	xmlns:exts="xalan://dk.defxws.fedoragsearch.server.GenericOperationsImpl"
+    		exclude-result-prefixes="exts"
+		xmlns:foxml="info:fedora/fedora-system:def/foxml#"
+		xmlns:dtu_meta="http://www.dtu.dk/dtu_meta/" 
+		xmlns:meta="http://www.dtu.dk/dtu_meta/meta/"
+		xmlns:dc="http://purl.org/dc/elements/1.1/"
+		xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
+		xmlns:ex="http://www.greenstone.org/namespace/fake/ex"
+		xmlns:dls="http://www.greenstone.org/namespace/fake/dls">
+	<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
+		
+	<xsl:param name="REPOSITORYNAME" select="'FgsRepos'"/>
+	<xsl:param name="REPOSBASEURL" select="'http://@tomcatserver@:@tomcatport@/fedora'"/>
+	<xsl:param name="FEDORASOAP" select="'http://@tomcatserver@:@tomcatport@/fedora/services'"/>
+	<xsl:param name="FEDORAUSER" select="'fedoraAdmin'"/>
+	<xsl:param name="FEDORAPASS" select="'@fedorapassw@'"/>
+	<xsl:param name="TRUSTSTOREPATH" select="'trustStorePath'"/>
+	<xsl:param name="TRUSTSTOREPASS" select="'trustStorePass'"/>
+<!--
+	 This xslt stylesheet generates the IndexDocument consisting of IndexFields
+     from a FOXML record. The IndexFields are:
+       - from the root element = PID
+       - from foxml:property   = type, state, contentModel, ...
+       - from oai_dc:dc        = title, creator, ...
+     The IndexDocument element gets a PID attribute, which is mandatory,
+     while the PID IndexField is optional.
+     Options for tailoring:
+       - IndexField types, see Lucene javadoc for Field.Store, Field.Index, Field.TermVector
+       - IndexField boosts, see Lucene documentation for explanation
+       - IndexDocument boosts, see Lucene documentation for explanation
+       - generation of IndexFields from other XML metadata streams than DC
+         - e.g. as for uvalibdesc included above and called below, the XML is inline
+         - for not inline XML, the datastream may be fetched with the document() function,
+           see the example below (however, none of the demo objects can test this)
+       - generation of IndexFields from other datastream types than XML
+         - from datastream by ID, text fetched, if mimetype can be handled
+         - from datastream by sequence of mimetypes, 
+           text fetched from the first mimetype that can be handled,
+           default sequence given in properties.
+-->
+
+	<xsl:variable name="PID" select="/foxml:digitalObject/@PID"/>
+	<xsl:variable name="docBoost" select="1.4*2.5"/> <!-- or any other calculation, default boost is 1.0 -->
+	
+	<xsl:template match="/">
+		<IndexDocument> 
+		    <!-- The PID attribute is mandatory for indexing to work -->
+			<xsl:attribute name="PID">
+				<xsl:value-of select="$PID"/>
+			</xsl:attribute>
+			<xsl:attribute name="boost"> <!-- example of setting a boost -->
+				<xsl:value-of select="$docBoost"/>
+			</xsl:attribute>
+		<!-- The following allows only active FedoraObjects to be indexed. -->
+		<xsl:if test="foxml:digitalObject/foxml:objectProperties/foxml:property[@NAME='info:fedora/fedora-system:def/model#state' and @VALUE='Active']">
+			<xsl:if test="not(foxml:digitalObject/foxml:datastream[@ID='METHODMAP'] or foxml:digitalObject/foxml:datastream[@ID='DS-COMPOSITE-MODEL'])">
+				<xsl:if test="starts-with($PID,'')">
+					<xsl:apply-templates mode="activeFedoraObject"/>
+				</xsl:if>
+			</xsl:if>
+		</xsl:if>
+		</IndexDocument>
+	</xsl:template>
+
+	<xsl:template match="/foxml:digitalObject" mode="activeFedoraObject">
+		    <!-- The PID index field lets you search on the PID value -->
+			<IndexField IFname="PID" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
+				<xsl:value-of select="$PID"/>
+			</IndexField>
+			<IndexField IFname="REPOSITORYNAME" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
+				<xsl:value-of select="$REPOSITORYNAME"/>
+			</IndexField>
+			<IndexField IFname="REPOSBASEURL" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
+				<xsl:value-of select="substring($FEDORASOAP, 1, string-length($FEDORASOAP)-9)"/>
+			</IndexField>
+			
+			<!-- indexing foxml property fields -->
+			
+			<xsl:for-each select="foxml:objectProperties/foxml:property">
+				<IndexField index="UN_TOKENIZED" store="YES" termVector="NO">
+					<xsl:attribute name="IFname"> 
+						<xsl:value-of select="concat('fgs.', substring-after(@NAME,'#'))"/>
+					</xsl:attribute>
+					<xsl:value-of select="@VALUE"/>
+				</IndexField>
+			</xsl:for-each>
+			
+			<!-- indexing inline dc fields -->
+			
+			<xsl:for-each select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/*">
+				<IndexField index="TOKENIZED" store="YES" termVector="YES">
+					<xsl:attribute name="IFname">
+						<xsl:value-of select="concat('dc.', substring-after(name(),':'))"/>
+					</xsl:attribute>
+					<xsl:value-of select="text()"/>
+				</IndexField>
+			</xsl:for-each>
+			
+			<!-- indexing dc fields for sorting (must be UN_TOKENIZED) -->
+			
+			<IndexField IFname="TITLE_UNTOK" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
+				<xsl:value-of select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/dc:title"/>
+			</IndexField>
+			<IndexField IFname="AUTHOR_UNTOK" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
+				<xsl:value-of select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/dc:creator"/>
+			</IndexField>
+
+			<!-- a datastream is fetched, if its mimetype 
+			     can be handled, the text becomes the value of the field. 
+			     This is the version using PDFBox,
+			     below is the new version using Apache Tika. -->
+			<xsl:for-each select="foxml:datastream[starts-with(@ID,'EX')]/foxml:datastreamVersion[last()]/foxml:xmlContent/ex:ex/ex:metadata">
+			  <IndexField index="TOKENIZED" store="YES" termVector="YES">
+			    <xsl:attribute name="IFname">
+			      <xsl:value-of select="concat('ex.', @name)"/>
+			    </xsl:attribute>
+			    <xsl:value-of select="text()"/>
+			  </IndexField>
+			</xsl:for-each>
+			
+			<xsl:for-each select="foxml:datastream[starts-with(@ID,'DLS')]/foxml:datastreamVersion[last()]/foxml:xmlContent/dls:dls/dls:metadata">
+			  <IndexField index="TOKENIZED" store="YES" termVector="YES">
+			    <xsl:attribute name="IFname">
+			      <xsl:value-of select="concat('dls.', @name)"/>
+			    </xsl:attribute>
+			    <xsl:value-of select="text()"/>
+			  </IndexField>
+			</xsl:for-each>
+			
+			<!-- 
+			<xsl:for-each select="foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
+				<IndexField index="TOKENIZED" store="YES" termVector="NO">
+					<xsl:attribute name="IFname">
+						<xsl:value-of select="concat('ds.', @ID)"/>
+					</xsl:attribute>
+					<xsl:value-of select="exts:getDatastreamText($PID, $REPOSITORYNAME, @ID, $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
+				</IndexField>
+			</xsl:for-each>
+			 -->
+
+			<!-- Text and metadata extraction using Apache Tika. 
+				Parameters for getDatastreamFromTika, getDatastreamTextFromTika, and getDatastreamMetadataFromTika:
+				- indexFieldTagName		: either "IndexField" (with the Lucene plugin) or "field" (with the Solr plugin)
+				- textIndexField		: fieldSpec for the text index field, null or empty if not to be generated								 (not used with getDatastreamMetadataFromTika)
+				- indexfieldnamePrefix	: optional or empty, prefixed to the metadata indexfield names											 (not used with getDatastreamTextFromTika)
+				- selectedFields		: comma-separated list of metadata fieldSpecs, if empty then all fields are included with default params (not used with getDatastreamTextFromTika)
+				- fieldSpec				: metadataFieldName ['=' indexFieldName] ['/' [index] ['/' [store] ['/' [termVector] ['/' [boost]]]]]
+						metadataFieldName must be exactly as extracted by Tika from the document. 
+										  You may see the available names if you log in debug mode, 
+										  look for "METADATA name=" under "fullDsId=" in the log, when "getFromTika" was called during updateIndex
+						indexFieldName is used as the generated index field name,
+										  if not given, GSearch uses metadataFieldName after replacement of the characters ' ', ':', '/', '=', '(', ')' with '_'
+						the following parameters are used with Lucene (with Solr these values are specified in schema.xml)
+						index			: ['TOKENIZED'|'UN_TOKENIZED']	# first alternative is default
+						store			: ['YES'|'NO']					# first alternative is default
+						termVector		: ['YES'|'NO']					# first alternative is default
+						boost			: <decimal number>				# '1.0' is default
+			-->
+			<xsl:for-each select="foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
+				<xsl:value-of disable-output-escaping="yes" select="exts:getDatastreamFromTika($PID, $REPOSITORYNAME, @ID, 'IndexField', concat('ds.', @ID), concat('dsmd_', @ID, '.'), '', $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
+			</xsl:for-each>
+
+			<!-- example of a dissemination identified in bDefPid, methodName, parameters, asOfDateTime is fetched,  
+			     if its mimetype can be handled, the text becomes the value of the IndexField. 
+			     parameters format is 'name=value name2=value2'-->
+			<!-- 
+			<IndexField IFname="fgs.Diss.text" index="TOKENIZED" store="YES" termVector="NO"
+						bDefPid="demo:19" methodName="getPDF" parameters="" asOfDateTime="" >
+			</IndexField>
+			-->
+
+			<!-- for not inline XML, the datastream may be fetched with the document() function -->
+			<!--  
+			<xsl:call-template name="example-of-xml-not-inline"/>
+			-->
+
+			<!-- This is an example of calling an extension function, see Apache Xalan, may be used for filters.
+			<IndexField IFname="fgs.DS" index="TOKENIZED" store="YES" termVector="NO">
+				<xsl:value-of select="exts:someMethod($PID)"/>
+			</IndexField>
+			-->
+			     
+			<!-- 
+			creating an index field with all text from the foxml record and its datastreams
+			-->
+
+			<IndexField IFname="foxml.all.text" index="TOKENIZED" store="YES" termVector="YES">
+				<xsl:for-each select="//text()">
+					<xsl:value-of select="."/>
+				</xsl:for-each>
+				<xsl:for-each select="//foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
+					<xsl:value-of select="exts:getDatastreamText($PID, $REPOSITORYNAME, @ID, $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
+				</xsl:for-each>
+			</IndexField>
+
+			<IndexField IFname="ds.fulltext" index="TOKENIZED" store="YES" termVector="YES">
+			  <xsl:for-each select="//foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
+			    <xsl:value-of select="exts:getDatastreamText($PID, $REPOSITORYNAME, @ID, $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
+			    <xsl:text>Â </xsl:text>
+			  </xsl:for-each>
+			</IndexField>
+
+	</xsl:template>
+	
+
+	<xsl:template name="example-of-xml-not-inline">
+	
+		<!-- due to Simon Lamb and Steve Bayliss -->
+		<!-- using the test object test:fgs23 -->
+		<!-- namespaces to be included in the stylesheet element -->
+			
+		<xsl:variable name="testMapplXml" select="document('http://localhost:8080/fedora/objects/test:fgs23/datastreams/testMapplXml/content')"/>
+		
+		<IndexField IFname="testMapplXml.meta.title"> 
+			<xsl:value-of select="$testMapplXml//meta:title"/>
+		</IndexField> 
+		
+	</xsl:template>
+	
+</xsl:stylesheet>	
Index: 3-extensions/fedora/trunk/src/fedoragsearch-files/foxmlToLuceneGenerated.xslt
===================================================================
--- /gs3-extensions/fedora/trunk/src/fedoragsearch-files/foxmlToLuceneGenerated.xslt	(revision 26433)
+++ 	(revision )
@@ -1,318 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-	
-
-<xsl:stylesheet version="1.0" exclude-result-prefixes="exts" xmlns:audit="info:fedora/fedora-system:def/audit#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exts="xalan://dk.defxws.fedoragsearch.server.GenericOperationsImpl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dtu_meta="http://www.dtu.dk/dtu_meta/" xmlns:foxml="info:fedora/fedora-system:def/foxml#" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://www.dtu.dk/dtu_meta/meta/" xmlns:ex="http://www.greenstone.org/namespace/fake/ex" xmlns:dls="http://www.greenstone.org/namespace/fake/dls">
-<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
-<xsl:param name="REPOSITORYNAME" select="'FgsRepos'"/>
-<xsl:param name="REPOSBASEURL" select="'http://@tomcatserver@:@tomcatport@/fedora'"/>
-<xsl:param name="FEDORASOAP" select="'http://@tomcatserver@:@tomcatport@/fedora/services'"/>
-<xsl:param name="FEDORAUSER" select="'fedoraAdmin'"/>
-<xsl:param name="FEDORAPASS" select="'@fedorapassw@'"/>
-<xsl:param name="TRUSTSTOREPATH" select="'trustStorePath'"/>
-<xsl:param name="TRUSTSTOREPASS" select="'trustStorePass'"/>
-<xsl:variable name="PID" select="/foxml:digitalObject/@PID"/>
-<xsl:template match="/">
-<IndexDocument boost="1.0">
-<xsl:attribute name="PID">
-<xsl:value-of select="$PID"/>
-</xsl:attribute>
-<!--The PID attribute is mandatory for indexing to work-->
-<!--The following allows only active FedoraObjects to be indexed.-->
-<xsl:if test="foxml:digitalObject/foxml:objectProperties/foxml:property[@NAME='info:fedora/fedora-system:def/model#state' and @VALUE='Active']">
-<xsl:if test="not(foxml:digitalObject/foxml:datastream[@ID='METHODMAP'] or foxml:digitalObject/foxml:datastream[@ID='DS-COMPOSITE-MODEL'])">
-<xsl:if test="starts-with($PID,'')">
-<xsl:apply-templates mode="activeFedoraObject"/>
-</xsl:if>
-</xsl:if>
-</xsl:if>
-</IndexDocument>
-</xsl:template>
-<xsl:template match="/foxml:digitalObject" mode="activeFedoraObject">
-<!--The PID index field lets you search on the PID value-->
-<IndexField IFname="PID" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
-<xsl:value-of select="$PID"/>
-</IndexField>
-<IndexField IFname="REPOSITORYNAME" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
-<xsl:value-of select="$REPOSITORYNAME"/>
-</IndexField>
-<IndexField IFname="REPOSBASEURL" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
-<xsl:value-of select="substring($FEDORASOAP, 1, string-length($FEDORASOAP)-9)"/>
-</IndexField>
-<IndexField IFname="TITLE_UNTOK" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
-<xsl:value-of select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/dc:title"/>
-</IndexField>
-<IndexField IFname="AUTHOR_UNTOK" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
-<xsl:value-of select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/dc:creator"/>
-</IndexField>
-<!--indexing foxml property fields-->
-<xsl:for-each select="foxml:objectProperties/foxml:property">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO">
-<xsl:attribute name="IFname">
-<xsl:value-of select="concat('fgs.', substring-after(@NAME,'#'))"/>
-</xsl:attribute>
-<xsl:value-of select="@VALUE"/>
-</IndexField>
-</xsl:for-each>
-<!--indexing foxml fields-->
-<xsl:for-each select="//audit:action">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.action" displayName="audit.action">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//audit:componentID">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.componentID" displayName="audit.componentID">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//audit:date">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.date" displayName="audit.date">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//audit:justification">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.justification" displayName="audit.justification">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//audit:process">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.process" displayName="audit.process">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//audit:process/@type">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="audit.process_type" displayName="audit.process_type">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//audit:record/@ID">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="audit.record_ID" displayName="audit.record_ID">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//audit:responsibility">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.responsibility" displayName="audit.responsibility">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//dc:creator">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.creator" displayName="dc.creator">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//dc:date">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.date" displayName="dc.date">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//dc:description">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.description" displayName="dc.description">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//dc:format">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.format" displayName="dc.format">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//dc:identifier">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.identifier" displayName="dc.identifier">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//dc:publisher">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.publisher" displayName="dc.publisher">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//dc:relation">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.relation" displayName="dc.relation">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//dc:rights">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.rights" displayName="dc.rights">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//dc:subject">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.subject" displayName="dc.subject">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//dc:title">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.title" displayName="dc.title">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:contentLocation">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="foxml.contentLocation" displayName="foxml.contentLocation">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:contentLocation/@REF">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.contentLocation_REF" displayName="foxml.contentLocation_REF">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:contentLocation/@TYPE">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.contentLocation_TYPE" displayName="foxml.contentLocation_TYPE">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:datastream/@CONTROL_GROUP">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastream_CONTROL_GROUP" displayName="foxml.datastream_CONTROL_GROUP">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:datastream/@ID">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastream_ID" displayName="foxml.datastream_ID">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:datastream/@STATE">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastream_STATE" displayName="foxml.datastream_STATE">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:datastream/@VERSIONABLE">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastream_VERSIONABLE" displayName="foxml.datastream_VERSIONABLE">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:datastreamVersion/@CREATED">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_CREATED" displayName="foxml.datastreamVersion_CREATED">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:datastreamVersion/@FORMAT_URI">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_FORMAT_URI" displayName="foxml.datastreamVersion_FORMAT_URI">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:datastreamVersion/@ID">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_ID" displayName="foxml.datastreamVersion_ID">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:datastreamVersion/@LABEL">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_LABEL" displayName="foxml.datastreamVersion_LABEL">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:datastreamVersion/@MIMETYPE">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_MIMETYPE" displayName="foxml.datastreamVersion_MIMETYPE">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:datastreamVersion/@SIZE">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_SIZE" displayName="foxml.datastreamVersion_SIZE">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:digitalObject/@PID">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.digitalObject_PID" displayName="foxml.digitalObject_PID">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:digitalObject/@VERSION">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.digitalObject_VERSION" displayName="foxml.digitalObject_VERSION">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:digitalObject/@xsi:schemaLocation">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.digitalObject_xsi:schemaLocation" displayName="foxml.digitalObject_xsi:schemaLocation">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:property">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="foxml.property" displayName="foxml.property">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:property/@NAME">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.property_NAME" displayName="foxml.property_NAME">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//foxml:property/@VALUE">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.property_VALUE" displayName="foxml.property_VALUE">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//meta:creator">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="meta.creator" displayName="meta.creator">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//meta:description">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="meta.description" displayName="meta.description">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//meta:publisher">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="meta.publisher" displayName="meta.publisher">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//meta:subject">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="meta.subject" displayName="meta.subject">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//meta:title">
-<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="meta.title" displayName="meta.title">
-<xsl:value-of select="text()"/>
-</IndexField>
-</xsl:for-each>
-<xsl:for-each select="//oai_dc:dc/@xsi:schemaLocation">
-<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="oai_dc.dc_xsi:schemaLocation" displayName="oai_dc.dc_xsi:schemaLocation">
-<xsl:value-of select="."/>
-</IndexField>
-</xsl:for-each>
-<!-- a datastream is fetched, if its mimetype 
-			     can be handled, the text becomes the value of the field. 
-			     This is the version using PDFBox,
-			     below is the new version using Apache Tika. -->
-<xsl:for-each select="foxml:datastream[starts-with(@ID,'EX')]/foxml:datastreamVersion[last()]/foxml:xmlContent/ex:ex/ex:metadata">
-  <IndexField index="TOKENIZED" store="YES" termVector="YES">
-    <xsl:attribute name="IFname">
-      <xsl:value-of select="concat('ex.', @name)"/>
-    </xsl:attribute>
-    <xsl:value-of select="text()"/>
-  </IndexField>
-</xsl:for-each>
-
-<xsl:for-each select="foxml:datastream[starts-with(@ID,'DLS')]/foxml:datastreamVersion[last()]/foxml:xmlContent/dls:dls/dls:metadata">
-  <IndexField index="TOKENIZED" store="YES" termVector="YES">
-    <xsl:attribute name="IFname">
-      <xsl:value-of select="concat('dls.', @name)"/>
-    </xsl:attribute>
-    <xsl:value-of select="text()"/>
-  </IndexField>
-</xsl:for-each>
-
-<!---->
-<!-- Text and metadata extraction using Apache Tika. -->
-<xsl:for-each select="foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
-<xsl:value-of disable-output-escaping="yes" select="exts:getDatastreamFromTika($PID, $REPOSITORYNAME, @ID, 'IndexField', concat('ds.', @ID), concat('dsmd.', @ID, '.'), '', $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
-</xsl:for-each>
-<!--creating an index field with all text from the foxml record and its datastreams-->
-<IndexField IFname="foxml.all.text" index="TOKENIZED" store="YES" termVector="YES">
-<xsl:for-each select="//text()">
-<xsl:value-of select="."/>
-<xsl:text>Â </xsl:text>
-</xsl:for-each>
-<xsl:for-each select="//foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
-<xsl:value-of select="exts:getDatastreamText($PID, $REPOSITORYNAME, @ID, $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
-<xsl:text>Â </xsl:text>
-</xsl:for-each>
-</IndexField>
-
-<IndexField IFname="ds.fulltext" index="TOKENIZED" store="YES" termVector="YES">
-  <xsl:for-each select="//foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
-    <xsl:value-of select="exts:getDatastreamText($PID, $REPOSITORYNAME, @ID, $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
-    <xsl:text>Â </xsl:text>
-  </xsl:for-each>
-</IndexField>
-</xsl:template>
-</xsl:stylesheet>
Index: /gs3-extensions/fedora/trunk/src/fedoragsearch-files/foxmlToLuceneGenerated.xslt.in
===================================================================
--- /gs3-extensions/fedora/trunk/src/fedoragsearch-files/foxmlToLuceneGenerated.xslt.in	(revision 26434)
+++ /gs3-extensions/fedora/trunk/src/fedoragsearch-files/foxmlToLuceneGenerated.xslt.in	(revision 26434)
@@ -0,0 +1,318 @@
+<?xml version="1.0" encoding="UTF-8"?>
+	
+
+<xsl:stylesheet version="1.0" exclude-result-prefixes="exts" xmlns:audit="info:fedora/fedora-system:def/audit#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exts="xalan://dk.defxws.fedoragsearch.server.GenericOperationsImpl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dtu_meta="http://www.dtu.dk/dtu_meta/" xmlns:foxml="info:fedora/fedora-system:def/foxml#" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://www.dtu.dk/dtu_meta/meta/" xmlns:ex="http://www.greenstone.org/namespace/fake/ex" xmlns:dls="http://www.greenstone.org/namespace/fake/dls">
+<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
+<xsl:param name="REPOSITORYNAME" select="'FgsRepos'"/>
+<xsl:param name="REPOSBASEURL" select="'http://@tomcatserver@:@tomcatport@/fedora'"/>
+<xsl:param name="FEDORASOAP" select="'http://@tomcatserver@:@tomcatport@/fedora/services'"/>
+<xsl:param name="FEDORAUSER" select="'fedoraAdmin'"/>
+<xsl:param name="FEDORAPASS" select="'@fedorapassw@'"/>
+<xsl:param name="TRUSTSTOREPATH" select="'trustStorePath'"/>
+<xsl:param name="TRUSTSTOREPASS" select="'trustStorePass'"/>
+<xsl:variable name="PID" select="/foxml:digitalObject/@PID"/>
+<xsl:template match="/">
+<IndexDocument boost="1.0">
+<xsl:attribute name="PID">
+<xsl:value-of select="$PID"/>
+</xsl:attribute>
+<!--The PID attribute is mandatory for indexing to work-->
+<!--The following allows only active FedoraObjects to be indexed.-->
+<xsl:if test="foxml:digitalObject/foxml:objectProperties/foxml:property[@NAME='info:fedora/fedora-system:def/model#state' and @VALUE='Active']">
+<xsl:if test="not(foxml:digitalObject/foxml:datastream[@ID='METHODMAP'] or foxml:digitalObject/foxml:datastream[@ID='DS-COMPOSITE-MODEL'])">
+<xsl:if test="starts-with($PID,'')">
+<xsl:apply-templates mode="activeFedoraObject"/>
+</xsl:if>
+</xsl:if>
+</xsl:if>
+</IndexDocument>
+</xsl:template>
+<xsl:template match="/foxml:digitalObject" mode="activeFedoraObject">
+<!--The PID index field lets you search on the PID value-->
+<IndexField IFname="PID" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
+<xsl:value-of select="$PID"/>
+</IndexField>
+<IndexField IFname="REPOSITORYNAME" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
+<xsl:value-of select="$REPOSITORYNAME"/>
+</IndexField>
+<IndexField IFname="REPOSBASEURL" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
+<xsl:value-of select="substring($FEDORASOAP, 1, string-length($FEDORASOAP)-9)"/>
+</IndexField>
+<IndexField IFname="TITLE_UNTOK" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
+<xsl:value-of select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/dc:title"/>
+</IndexField>
+<IndexField IFname="AUTHOR_UNTOK" index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0">
+<xsl:value-of select="foxml:datastream/foxml:datastreamVersion[last()]/foxml:xmlContent/oai_dc:dc/dc:creator"/>
+</IndexField>
+<!--indexing foxml property fields-->
+<xsl:for-each select="foxml:objectProperties/foxml:property">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO">
+<xsl:attribute name="IFname">
+<xsl:value-of select="concat('fgs.', substring-after(@NAME,'#'))"/>
+</xsl:attribute>
+<xsl:value-of select="@VALUE"/>
+</IndexField>
+</xsl:for-each>
+<!--indexing foxml fields-->
+<xsl:for-each select="//audit:action">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.action" displayName="audit.action">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//audit:componentID">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.componentID" displayName="audit.componentID">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//audit:date">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.date" displayName="audit.date">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//audit:justification">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.justification" displayName="audit.justification">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//audit:process">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.process" displayName="audit.process">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//audit:process/@type">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="audit.process_type" displayName="audit.process_type">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//audit:record/@ID">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="audit.record_ID" displayName="audit.record_ID">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//audit:responsibility">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="audit.responsibility" displayName="audit.responsibility">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//dc:creator">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.creator" displayName="dc.creator">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//dc:date">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.date" displayName="dc.date">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//dc:description">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.description" displayName="dc.description">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//dc:format">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.format" displayName="dc.format">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//dc:identifier">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.identifier" displayName="dc.identifier">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//dc:publisher">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.publisher" displayName="dc.publisher">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//dc:relation">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.relation" displayName="dc.relation">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//dc:rights">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.rights" displayName="dc.rights">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//dc:subject">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.subject" displayName="dc.subject">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//dc:title">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="dc.title" displayName="dc.title">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:contentLocation">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="foxml.contentLocation" displayName="foxml.contentLocation">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:contentLocation/@REF">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.contentLocation_REF" displayName="foxml.contentLocation_REF">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:contentLocation/@TYPE">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.contentLocation_TYPE" displayName="foxml.contentLocation_TYPE">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:datastream/@CONTROL_GROUP">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastream_CONTROL_GROUP" displayName="foxml.datastream_CONTROL_GROUP">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:datastream/@ID">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastream_ID" displayName="foxml.datastream_ID">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:datastream/@STATE">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastream_STATE" displayName="foxml.datastream_STATE">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:datastream/@VERSIONABLE">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastream_VERSIONABLE" displayName="foxml.datastream_VERSIONABLE">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:datastreamVersion/@CREATED">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_CREATED" displayName="foxml.datastreamVersion_CREATED">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:datastreamVersion/@FORMAT_URI">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_FORMAT_URI" displayName="foxml.datastreamVersion_FORMAT_URI">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:datastreamVersion/@ID">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_ID" displayName="foxml.datastreamVersion_ID">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:datastreamVersion/@LABEL">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_LABEL" displayName="foxml.datastreamVersion_LABEL">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:datastreamVersion/@MIMETYPE">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_MIMETYPE" displayName="foxml.datastreamVersion_MIMETYPE">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:datastreamVersion/@SIZE">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.datastreamVersion_SIZE" displayName="foxml.datastreamVersion_SIZE">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:digitalObject/@PID">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.digitalObject_PID" displayName="foxml.digitalObject_PID">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:digitalObject/@VERSION">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.digitalObject_VERSION" displayName="foxml.digitalObject_VERSION">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:digitalObject/@xsi:schemaLocation">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.digitalObject_xsi:schemaLocation" displayName="foxml.digitalObject_xsi:schemaLocation">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:property">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="foxml.property" displayName="foxml.property">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:property/@NAME">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.property_NAME" displayName="foxml.property_NAME">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//foxml:property/@VALUE">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="foxml.property_VALUE" displayName="foxml.property_VALUE">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//meta:creator">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="meta.creator" displayName="meta.creator">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//meta:description">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="meta.description" displayName="meta.description">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//meta:publisher">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="meta.publisher" displayName="meta.publisher">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//meta:subject">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="meta.subject" displayName="meta.subject">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//meta:title">
+<IndexField index="TOKENIZED" store="YES" termVector="YES" boost="1.0" IFname="meta.title" displayName="meta.title">
+<xsl:value-of select="text()"/>
+</IndexField>
+</xsl:for-each>
+<xsl:for-each select="//oai_dc:dc/@xsi:schemaLocation">
+<IndexField index="UN_TOKENIZED" store="YES" termVector="NO" boost="1.0" IFname="oai_dc.dc_xsi:schemaLocation" displayName="oai_dc.dc_xsi:schemaLocation">
+<xsl:value-of select="."/>
+</IndexField>
+</xsl:for-each>
+<!-- a datastream is fetched, if its mimetype 
+			     can be handled, the text becomes the value of the field. 
+			     This is the version using PDFBox,
+			     below is the new version using Apache Tika. -->
+<xsl:for-each select="foxml:datastream[starts-with(@ID,'EX')]/foxml:datastreamVersion[last()]/foxml:xmlContent/ex:ex/ex:metadata">
+  <IndexField index="TOKENIZED" store="YES" termVector="YES">
+    <xsl:attribute name="IFname">
+      <xsl:value-of select="concat('ex.', @name)"/>
+    </xsl:attribute>
+    <xsl:value-of select="text()"/>
+  </IndexField>
+</xsl:for-each>
+
+<xsl:for-each select="foxml:datastream[starts-with(@ID,'DLS')]/foxml:datastreamVersion[last()]/foxml:xmlContent/dls:dls/dls:metadata">
+  <IndexField index="TOKENIZED" store="YES" termVector="YES">
+    <xsl:attribute name="IFname">
+      <xsl:value-of select="concat('dls.', @name)"/>
+    </xsl:attribute>
+    <xsl:value-of select="text()"/>
+  </IndexField>
+</xsl:for-each>
+
+<!---->
+<!-- Text and metadata extraction using Apache Tika. -->
+<xsl:for-each select="foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
+<xsl:value-of disable-output-escaping="yes" select="exts:getDatastreamFromTika($PID, $REPOSITORYNAME, @ID, 'IndexField', concat('ds.', @ID), concat('dsmd.', @ID, '.'), '', $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
+</xsl:for-each>
+<!--creating an index field with all text from the foxml record and its datastreams-->
+<IndexField IFname="foxml.all.text" index="TOKENIZED" store="YES" termVector="YES">
+<xsl:for-each select="//text()">
+<xsl:value-of select="."/>
+<xsl:text>Â </xsl:text>
+</xsl:for-each>
+<xsl:for-each select="//foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
+<xsl:value-of select="exts:getDatastreamText($PID, $REPOSITORYNAME, @ID, $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
+<xsl:text>Â </xsl:text>
+</xsl:for-each>
+</IndexField>
+
+<IndexField IFname="ds.fulltext" index="TOKENIZED" store="YES" termVector="YES">
+  <xsl:for-each select="//foxml:datastream[@CONTROL_GROUP='M' or @CONTROL_GROUP='E' or @CONTROL_GROUP='R']">
+    <xsl:value-of select="exts:getDatastreamText($PID, $REPOSITORYNAME, @ID, $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>
+    <xsl:text>Â </xsl:text>
+  </xsl:for-each>
+</IndexField>
+</xsl:template>
+</xsl:stylesheet>
