Changeset 9874
- Timestamp:
- 2005-05-16T11:02:50+12:00 (19 years ago)
- Location:
- trunk
- Files:
-
- 26 added
- 40 deleted
- 132 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/greenstone3-extensions/gsdl-as/build.xml
r8738 r9874 147 147 --> 148 148 149 <taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/> 150 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"/> 151 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/> 152 <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask"/> 149 <taskdef name="install" classname="org.apache.catalina.ant.InstallTask" 150 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 151 <taskdef name="list" classname="org.apache.catalina.ant.ListTask" 152 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 153 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask" 154 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 155 <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask" 156 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 153 157 154 158 … … 220 224 <include name="*.jar"/> 221 225 </fileset> 222 226 <!-- include greenstone files --> 227 <fileset dir="../../lib/java"> 228 <include name="*.jar"/> 229 </fileset> 223 230 <!-- Include all elements that Tomcat exposes to applications --> 224 231 <pathelement location="${catalina.home}/common/classes"/> -
trunk/greenstone3-extensions/gsdl-as/src/org/greenstone/gsdlas/AlertingService.java
r8888 r9874 86 86 String title = "Unknown action"; 87 87 String message = "I don't know how to " + action; 88 String details = "The only actions I know are " + Array s.toString(actions);88 String details = "The only actions I know are " + ArrayHelper.toString(actions); 89 89 return showError(context, message, details); 90 90 } -
trunk/greenstone3-extensions/gsdl-as/src/org/greenstone/gsdlas/EventStore.java
r8888 r9874 101 101 */ 102 102 private String encodeSpecialChars(String string) { 103 String encodedString = string.replace ("&", "&");104 encodedString = encodedString.replace ("<", "<");105 encodedString = encodedString.replace (">", ">");106 encodedString = encodedString.replace ("'", "'");107 encodedString = encodedString.replace ("\"", """);103 String encodedString = string.replaceAll("&", "&"); 104 encodedString = encodedString.replaceAll("<", "<"); 105 encodedString = encodedString.replaceAll(">", ">"); 106 encodedString = encodedString.replaceAll("\'", "'"); 107 encodedString = encodedString.replaceAll("\"", """); 108 108 return encodedString; 109 109 } -
trunk/greenstone3-extensions/gsdl-as/src/org/greenstone/gsdlas/GreenstoneCommunicator.java
r8874 r9874 21 21 import org.w3c.dom.*; 22 22 23 import org.greenstone.gsdlas.util.ArrayHelper; 23 24 24 25 /** … … 70 71 } 71 72 72 System.out.println(Arrays.toString(result));73 System.out.println(ArrayHelper.toString(result)); 73 74 74 75 return result; -
trunk/greenstone3-extensions/gsdl-as/src/org/greenstone/gsdlas/NotificationStore.java
r8738 r9874 54 54 String key = (String) iter.next(); 55 55 String value = (String) event.get(key); 56 String encodedValue = value.replace ("&", "&");57 encodedValue = encodedValue.replace ("<", "<");58 encodedValue = encodedValue.replace (">", ">");59 encodedValue = encodedValue.replace ("'", "'");60 encodedValue = encodedValue.replace ("\"", """);56 String encodedValue = value.replaceAll("&", "&"); 57 encodedValue = encodedValue.replaceAll("<", "<"); 58 encodedValue = encodedValue.replaceAll(">", ">"); 59 encodedValue = encodedValue.replaceAll("\'", "'"); 60 encodedValue = encodedValue.replaceAll("\"", """); 61 61 62 62 event.put(key, encodedValue); -
trunk/greenstone3-extensions/gsdl-as/src/org/greenstone/gsdlas/util/ArrayHelper.java
r8775 r9874 26 26 return index > -1 && index <= array.length; 27 27 } 28 29 static public String toString(String [] array) { 30 StringBuffer buffer = new StringBuffer(); 31 buffer.append("["); 32 for (int i=0; i<array.length; i++) { 33 buffer.append((String)array[i]); 34 buffer.append(","); 35 } 36 buffer.append("]"); 37 return buffer.toString(); 38 39 } 28 40 } -
trunk/greenstone3-extensions/vishnu/README
r8412 r9874 5 5 If you want to run it standalone: 6 6 7 The environment variable JAVA_HOME needs to be set. 7 You need to have Java 1.4 or higher and Ant installed. The environment variable JAVA_HOME needs to be set. 8 8 You need to have MG installed - this should be the version from Greenstone, and you need the mg.jar file in your CLASSPATH and the libmgjni.so in your LD_LIBRARY_PATH. 9 9 You need the lucene 1.4 or higher jar file in your CLASSPATH. 10 Other jar files needed in CLASSPATH: xercesImpl.jar, servlet .jar.10 Other jar files needed in CLASSPATH: xercesImpl.jar, servlet-api.jar. 11 11 These jar files all come as part of the Greenstone download. Some in gsdl3/lib/java, and servlet.jar in gsdl3/comms/jakarta/tomcat/lib (when unpacked). 12 12 13 Edit the src/vishnu Makefile/winMake.bat and uncomment the prefix for stand-alone vishnu.13 Edit the build.xml file and change the prefix property to be the current directory. 14 14 15 Then run the following (on both linux or windows) 16 17 make 18 make install 15 Then run 'ant' (or "ant all'). 19 16 20 17 … … 70 67 We have provided an example configuration for use with Tomcat (version 4.1). 71 68 72 Set the prefix in the src/vishnu Makefile to be ../.., then the servlet class and jar files will be installed in the correct places.73 69 The vishnu/web directory is setup to be the context directory for vishnu in Tomcat. 74 70 You need to edit Tomcat's conf/server.xml file, and add in the context for vishnu. Add the following element after the tomcat root context element: -
trunk/gsdl3/README.txt
r8428 r9874 4 4 This is free software, and you are welcome to redistribute it 5 5 6 |--------| 7 | Linux: | 8 |--------| 9 10 Installing Greenstone from a binary distribution: 11 ------------------------------------------------- 6 Installing Greenstone from a binary distribution (Linux): 7 --------------------------------------------------------- 12 8 13 9 Download the gsdl3-x.xx-linux executable file, and run it. Follow the instructions given. 14 10 15 Installing Greenstone from a CVS checkout:16 ------------------------------------------ 11 Installing Greenstone from a binary distribution (Windows): 12 ----------------------------------------------------------- 17 13 18 (cvs co gsdl3) (if not already done) 19 cd gsdl3 20 ./gs3-install.sh 14 Download the gsdl3-x.xx-win32.exe executable file, and double click on it. 15 Follow the instructions given. 21 16 22 If you change the source and want to compile it again later, you can run 'make' then 'make install' from this directory.23 17 24 If you want to compile the test servlet, (useful is you are unsure whether Tomcat is working properly), go to gsdl3/web/WEB-INF/classes, and run 'javac TestServlet.java'. 18 Installing Greenstone from a CVS checkout (Linux and Windows): 19 -------------------------------------------------------------- 25 20 26 Greenstone requires Java 1.4. 21 Checkout the code: 22 23 cvs -d :pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src co gsdl3 24 25 Build and install: 26 27 Greenstone is built and installed using Ant (Apache's Java based build tool, 28 http://ant.apache.org). You will need a Java Development 29 Environment (1.4 or higher), and Ant installed to use Greenstone. You can download Ant from http://ant.apache.org/bindownload.cgi. 30 31 In the gsdl3 directory, you can run 'ant' which will give you a help message. 32 Running 'ant -projecthelp' gives a list of the targets that you can run - these 33 do various things like compile the source code, startup the server etc. 34 35 For a first time install, run 'ant install'. 36 37 The file build.properties contains various parameters that can be set by the user. Please check these settings before running 'ant install'. The install process will ask you if you accept the properties before starting. 38 For a non-interactive version of the install, run 39 ant -Dproperties.accepted=yes install 40 41 To log the output in build.log, run 42 ant -Dproperties.accepted=yes -logfile build.log install 43 44 Under Linux, Java and C/C++ compilation is carried out. For windows, since Visual Studio is not a standard component, only Java compilation is carried out. Pre-compiled binaries are provided for the C/C++ components (packages and Greenstone 2 style building). If you have Visual Studio installed (version 6), you can run the compile-windows-c++ targets to compile the code locally. (Don't forget to setup the Visual Studio environment first, by running, e.g. C:/Program Files/Microsoft Visual Studio/VC98/Bin/VCVARS32.BAT or equivalent.) 27 45 28 46 Running Greenstone: 29 47 ------------------- 30 48 31 Run the script gs3-launch.sh from the gsdl3 directory. This starts up a Tomcat web server and a mysql database server. To shutdown, run gs3-launch.sh -shutdown 49 To startup the servers, run 'ant start'. 'ant restart' and 'ant stop' restarts and shuts down the servers. To start or stop just Tomcat or MYSQL, use the start-tomcat, start-mysql, stop-tomcat, stop-mysql targets. 32 50 33 Using SOAP: 34 ------------ 51 On Windows, if you have installed a binary version, you can also start Greenstone by selecting Greenstone 3 Digital Library from the Start menu. 35 52 36 Greenstone comes setup to use SOAP. SOAP runs as a servlet inside Tomcat, and is disabled by default. To enable it, run 37 ./gs3-enable-soap.sh 38 Then re-launch Greenstone: 39 ./gs3-launch.sh -shutdown 40 ./gs3-launch.sh 53 Greenstone will be available in a browser at "http://localhost:8080/gsdl3". 41 54 42 A SOAP server for localsite comes predeployed. 43 You should be able to see all localsite's collections through the gateway servlet. 55 Using SOAP (Linux and Windows): 56 ------------------------------- 57 58 Greenstone comes with Apache Axis installed as a webapp in Tomcat. A SOAP server on localsite is deployed during installation. You should be able to see all localsite's collections through the gateway servlet. 44 59 45 60 To set up a SOAP server on a new site, run 46 gs3-soap-deploy-site.sh <sitename> <siteURI> 47 where the sitename is the directory name of the site, and siteURI is a unique 48 identifier for the sites 'web service'. 61 ant soap-deploy-site 62 This will prompt you for the sitename (the directory name), and the site uri - this should be a unique identifier for the site's web service. 49 63 64 For a non-interactive version, run 65 ant -Daxis.sitename=xxx -Daxis.siteuri=yyy soap-deploy-site 50 66 67 Building Collections: 68 ----------------------- 51 69 52 |----------| 53 | Windows: | 54 |----------| 70 You can build collections using either Greenstone 2 style building, or native Greenstone 3 style. 55 71 56 Installing Greenstone from a binary distribution: 57 ------------------------------------------------- 72 Greenstone 2: 58 73 59 Download the gsdl3-x.xx-win32.exe executable file, and double click on it. 74 You need to have Perl installed and on your PATH. 75 run 'ant gli", or cd to gsdl3/gli and run gli4gs3.sh/bat. This is a graphical tool for building collections. 60 76 61 To run Greenstone, select Greenstone 3 Digital Library from the Start menu. 77 Greenstone 3: 62 78 63 Installing Greenstone from a CVS checkout: 64 ------------------------------------------ 79 In the gsdl3 directory, run: 'source gs3-setup.sh' (linux) or 'gs3-setup' (windows). 80 To create a new collection, run 'gs3-mkcol.sh/bat <sitename> <collname>' 81 Put documents in the import directory (gsdl3/web/sites/<sitename>/collect/<collname>/import), edit the collection configuration file (gsdl3/web/sites/<sitename>/collect/<collname>/etc/collectionConfig.xml), and run 'gs3-build.sh <sitename> <collname>' 82 Rename the building directory to index (in gsdl3/web/sites/<sitename>/collect/<collname>) and reload the collection in Tomcat (?a=s&sa=a&st=collection&sn=<collname>), or restart Tomcat. 65 83 66 (cvs co gsdl3) (if not already done) 67 cd gsdl3 68 gs3-install 84 See the manual for more details about both styles of collection building. 69 85 70 To run Greenstone, run 71 gs3-launch 72 This starts up the Tomcat web server and mysql database server. 73 74 Using SOAP: 75 ------------ 76 77 Greenstone comes setup to use SOAP. SOAP runs as a servlet inside Tomcat, and is disabled by default. To enable it, run 78 gs3-enable-soap 79 Then shutdown and restart Greenstone. 80 81 A SOAP server for localsite comes predeployed. 82 You should be able to see all localsite's collections through the gateway servlet. 83 84 To set up a SOAP server on a new site, run 85 gs3-soap-deploy-site <sitename> <siteURI> 86 where the sitename is the directory name of the site, and siteURI is a unique 87 identifier for the sites 'web service'. 88 89 |--------------| 90 | Other notes: | 91 |--------------| 86 Other Notes: 87 --------------- 92 88 93 89 See gsdl3/docs/manual/manual.pdf for more details about the software and installation etc. 94 90 91 Under Linux, Tomcat logs output in gsdl3/comms/jakarta/tomcat/logs/catalina.out. 92 95 93 To prevent Tomcat showing directory listings, edit the gsdl3/comms/jakarta/tomcat/conf/web.xml file and set the value of the "listings" servlet parameter to false. 96 94 95 ant can't seem to do cvs using authenticated cvs on windows: 96 there were some classes missing - www.ibiblio.org/maven/jsch/jars/jsch-0.1.17.jar 97 many ssh processes seemed to be started up - all waiting in the background for password?? 98 So should only use anonymous cvs. 99 -
trunk/gsdl3/bin/script/convert_coll_from_gs2.pl
r8967 r9874 103 103 my $buildwriter = new XML::Writer(OUTPUT => $buildoutput, NEWLINES => 1); 104 104 105 $buildwriter->startTag('buildConfig', 'xmlns:gsf'=>"http://www.greenstone.org/ configformat");105 $buildwriter->startTag('buildConfig', 'xmlns:gsf'=>"http://www.greenstone.org/greenstone3/schema/ConfigFormat"); 106 106 107 107 my $colloutput = new IO::File(">$colloutfile"); 108 108 my $collwriter = new XML::Writer(OUTPUT => $colloutput, NEWLINES => 1); 109 109 110 $collwriter->startTag('collectionConfig', 'xmlns:gsf'=>"http://www.greenstone.org/ configformat", 'xmlns:xsl'=>'http://www.w3.org/1999/XSL/Transform');110 $collwriter->startTag('collectionConfig', 'xmlns:gsf'=>"http://www.greenstone.org/greenstone3/schema/ConfigFormat", 'xmlns:xsl'=>'http://www.w3.org/1999/XSL/Transform'); 111 111 112 112 #output the collection metadata to the collectionConfig file -
trunk/gsdl3/build.xml
r8424 r9874 1 1 <?xml version="1.0"?> 2 2 3 <!-- ====================================================================== 3 Oct 11, 2004 1:54:59 AM4 5 GSDL3 build script for rebuilding gsdl3.jar4 March 2005 5 6 GSDL3 build and install script 6 7 7 schweer8 kjdon 8 9 ====================================================================== --> 9 <project name="gsdl3" default="build"> 10 11 <property name="src" value="src/java"/> 12 <property name="build" value="classes"/> 13 <property name="lib" value="lib/java"/> 14 <property name="weblib" value="web/lib"/> 15 <property name="javadocs" value="docs/javadoc"/> 16 17 <description> 18 GSDL3 build script for rebuilding gsdl3.jar 19 </description> 20 21 <target name="init"> 22 <tstamp/> 23 <mkdir dir="${build}"/> 24 </target> 25 26 <target name="build" depends="init" description="build the java code"> 27 <javac debug="true" destdir="${build}" extdirs="${lib}:comms/jakarta/tomcat/common/lib/servlet.jar" optimize="false" srcdir="${src}" excludes="org/greenstone/testing/** org/greenstone/applet/** "/> 28 </target> 29 30 <target name="jar" depends="build" description="re-create gsdl3.jar"> 31 <jar destfile="${lib}/gsdl3.jar"> 32 <fileset dir="${build}" excludes="org/greenstone/testing/**" /> 33 <manifest> 34 <attribute name="Built-By" value="${user.name}" /> 35 </manifest> 36 </jar> 37 </target> 38 39 <target name="install" depends="jar" description="copy gsdl3.jar to where it's supposed to be"> 40 <copy file="${lib}/gsdl3.jar" todir="${weblib}"/> 41 </target> 42 43 44 <target name="javadocs" depends="init" description="create javadocs"> 45 <javadoc author="true" destdir="${javadocs}" extdirs="${lib}" failonerror="true" private="true" source="1.4" sourcepath="${src}" version="true"> 46 <packageset dir="${src}" excludes="org/greenstone/testing/** org/greenstone/applet/** org/greenstone/gdbm/**"/> 47 </javadoc> 48 </target> 10 <project name="gsdl3" default="usage" basedir="."> 11 12 <!-- ============ self defined tasks =================== --> 13 14 <taskdef name="mysetproxy" classname="org.greenstone.anttasks.MySetProxy" classpath="${basedir}/lib/java/anttasks.jar"/> 15 <taskdef name="getuserandpassword" classname="org.greenstone.anttasks.MyGetUserAndPassword" classpath="${basedir}/lib/java/anttasks.jar"/> 16 17 18 19 <!-- ===================== Property Definitions =========================== --> 20 21 <!-- 22 23 Each of the following properties are used in the build script. 24 Values for these properties are set by the first place they are 25 defined, from the following list: 26 27 * Definitions on the "ant" command line (ant -Dfoo=bar compile). 28 29 * Definitions from a "build.properties" file in the top level 30 source directory of this application. 31 32 * Definitions from a "build.properties" file in the user's 33 home directory. 34 35 * Default definitions in this build.xml file. 36 37 You will note below that property values can be composed based on the 38 contents of previously defined properties. This is a powerful technique 39 that helps you minimize the number of changes required when your development 40 environment is modified. Note that property composition is allowed within 41 "build.properties" files as well as in the "build.xml" script. 42 43 --> 44 45 <property file="build.properties"/> 46 <property file="${user.home}/build.properties"/> 47 48 <!-- get properties from the environment --> 49 <property environment="env"/> 50 <property name="src.home" value="${basedir}/src/java"/> 51 <property name="build.home" value="${basedir}/build"/> 52 <property name="packages.home" value="${basedir}/packages"/> 53 <property name="javalib" value="${basedir}/lib/java"/> 54 <property name="web.home" value="${basedir}/web"/> 55 <property name="web.lib" value="${web.home}/lib"/> 56 <property name="web.classes" value="${web.home}/WEB-INF/classes"/> 57 58 <property name="javadocs" value="${basedir}/docs/javadoc"/> 59 60 <property name="app.name" value="gsdl3"/> 61 <property name="app.path" value="/${app.name}"/> 62 <property name="app.version" value="3.00alpha"/> 63 <property name="catalina.home" value="${basedir}/comms/jakarta/tomcat"/> 64 65 <property name="os.linux" value="Linux"/> <!-- mac??--> 66 <property name="os.windows" value="Windows 95,Windows 98,Windows 2000,Windows XP, Windows NT,Windows ME"/> <!-- check this!!!--> 67 68 <condition property="current.os.islinux"> 69 <os family="unix"/> 70 </condition> 71 <condition property="current.os.iswindows"> 72 <os family="windows"/> 73 </condition> 74 <!-- ============= Base dirs for each package and component ============ --> 75 <property name="applet.home" value="${src.home}/org/greenstone/applet"/> 76 <property name="gsdl3.home" value="${src.home}/org/greenstone/gsdl3"/> 77 <property name="anttasks.home" value="${src.home}/org/greenstone/anttasks"/> 78 <property name="gs2build.home" value="${basedir}/gs2build"/> 79 <property name="gli.home" value="${basedir}/gli"/> 80 <property name="vishnu.home" value="${packages.home}/vishnu"/> 81 <property name="mg.home" value="${packages.home}/mg"/> 82 <property name="mgpp.home" value="${packages.home}/mgpp"/> 83 <property name="mysql.home" value="${packages.home}/mysql"/> 84 <property name="gsdl-as.home" value="${packages.home}/gsdl-as"/> 85 86 <!-- ==================== Compilation Control Options ==================== --> 87 88 <!-- 89 90 These properties control option settings on the Javac compiler when it 91 is invoked using the <javac> task. 92 93 compile.debug Should compilation include the debug option? 94 95 compile.deprecation Should compilation include the deprecation option? 96 97 compile.optimize Should compilation include the optimize option? 98 99 --> 100 101 <property name="compile.debug" value="true"/> 102 <property name="compile.deprecation" value="true"/> 103 <property name="compile.optimize" value="true"/> 104 105 <!-- 106 107 Rather than relying on the CLASSPATH environment variable, Ant includes 108 features that makes it easy to dynamically construct the classpath you 109 need for each compilation. The example below constructs the compile 110 classpath to include the servlet.jar file, as well as the other components 111 that Tomcat makes available to web applications automatically, plus anything 112 that you explicitly added. 113 114 --> 115 116 <path id="compile.classpath"> 117 <!-- Include all jar files in our lib directory --> 118 <pathelement location="${javalib}"/> 119 <fileset dir="${javalib}"> 120 <include name="*.jar"/> 121 </fileset> 122 <!-- Include the resources directory --> 123 <pathelement location="${basedir}/resources/java"/> 124 <pathelement location="${basedir}/resources/dtd"/> 125 126 <!-- Include the axis jar files --> 127 <fileset dir="${basedir}/comms/soap/axis/lib"> 128 <include name="*.jar"/> 129 </fileset> 130 131 <!-- include the jar files from the packages --> 132 <!-- mg and mgpp get installed into lib/java but they may not be there yet --> 133 <pathelement location="${javalib}/mg.jar"/> 134 <pathelement location="${javalib}/mgpp.jar"/> 135 <pathelement location="${vishnu.home}/build/vishnu.jar"/> 136 137 <!-- Include all elements that Tomcat exposes to applications --> 138 <pathelement location="${catalina.home}/common/classes"/> 139 <fileset dir="${catalina.home}/common/endorsed"> 140 <include name="*.jar"/> 141 </fileset> 142 <fileset dir="${catalina.home}/common/lib"> 143 <include name="*.jar"/> 144 </fileset> 145 <pathelement location="${catalina.home}/shared/classes"/> 146 <fileset dir="${catalina.home}/shared/lib"> 147 <include name="*.jar"/> 148 </fileset> 149 </path> 150 151 <path id="running.path"> 152 <pathelement location="${mysql.home}/bin"/> 153 <pathelement location="${basedir}/bin/script"/> 154 <pathelement location="${basedir}/bin"/> 155 <pathelement location="${basedir}/lib"/> 156 <pathelement path="${env.PATH}"/> 157 <pathelement path="${env.Path}"/> 158 </path> 159 160 <path id="ld.library.path"> 161 <pathelement path="${env.LD_LIBRARY_PATH}"/> 162 <pathelement location="${basedir}/lib"/> 163 <pathelement location="${mysql.home}/lib/mysql"/> 164 </path> 165 166 <!-- ==================== Primary and Global Targets ============================= --> 167 168 <!-- add comments about using xxx-core, xxx-packages if only want certain parts?? --> 169 170 <target name="install" depends="accept-properties,init,prepare,cvsupdate,configure,clean,compile,deploy-localsite" 171 description="Install Greenstone 3. Use this when you first checkout the code. Also running this target later on will reinstall Greenstone. Most things will be reset back to their defaults, except for code changes."/> 172 173 <target name="prepare" depends="init,prepare-core,prepare-packages,prepare-gs2building,prepare-tomcat,prepare-axis,prepare-mysql,prepare-collections,prepare-extra"/> 174 175 <target name="cvsupdate" depends="init,cvsupdate-packages,cvsupdate-core,cvsupdate-gs2building" 176 description="Do a cvs update for all sources. Doesn't reompile the code."/> 177 178 <target name="configure" depends="init,configure-tomcat,configure-files,configure-packages,configure-core,configure-gs2building" 179 description="Configure the installation. Includes setting up config files and configuring the C/C++ packages. This is called from install and update. Should be re-run if you change the build.properties file."/> 180 181 <target name="clean" depends="init,clean-packages,clean-core,clean-gs2building" 182 description="Remove all old compiled code. Includes core, packages and gs2building if necessary"/> 183 <target name="clean-windows-c++" depends="init,clean-windows-c++-gs2building,clean-windows-c++-packages" 184 description="Remove C++ compiled code for Windows. Requires Microsoft Visual Studio"/> 185 <target name="compile" depends="init,compile-extra,compile-packages,compile-core,compile-gs2building" 186 description="Compile all the source code, includes core, packages and gs2building if necessary. Copy jar files and executables to their correct places."/> 187 <target name="compile-windows-c++" depends="init,compile-windows-c++-gs2building,compile-windows-c++-packages" 188 description="Compile the C/C++ code for Windows. Requires Microsoft Visual Studio"/> 189 <target name="update" depends="init,update-packages,update-core,update-gs2building" 190 description="Update (thru CVS) all the source (including core, packages and gs2building) and recompile. Similar to install but doesn't reinstall components such as Tomcat and axis."/> 191 192 <target name="start" depends="init,start-mysql,start-tomcat" 193 description="Startup the (local) Greenstone servers (tomcat,mysql...)" /> 194 195 <target name="stop" depends="init,stop-tomcat,stop-mysql" 196 description="Shutdown the (local) Greenstone servers."/> 197 198 <target name="restart" description="Shutdown and restart the Greenstone servers" depends="init,stop,start"/> 199 200 201 <!-- =========== Help targets =================================== --> 202 203 <target name="usage" description="Print a help message"> 204 <echo message=" Execute 'ant -projecthelp' for a list of targets."/> 205 <echo message=" Execute 'ant -help' for Ant help."/> 206 <echo>To install Greenstone, run 'ant [options] install'. 207 There are properties defined in build.properties. The install process will ask you if these properties are set correctly. To avoid this prompt, use the '-Dproperties.accepted=yes' option. 208 To log the output, use the '-logfile build.log' option. 209 </echo> 210 </target> 211 212 <target name="help" depends="usage" description="Print a help message"/> 213 214 <target name="debug" depends="init" description="Display all the currently used properties"> 215 <echoproperties/> 216 </target> 217 218 <!-- ====== initialization and setup targets ================== --> 219 220 <target name="accept-properties" unless="properties.accepted"> 221 <input addproperty="properties.ok" validargs="y,n">The following properties (among others) are being used from a build.properties file found in this directory: 222 tomcat.server=${tomcat.server} 223 tomcat.port=${tomcat.port} 224 tomcat.installed.path=${tomcat.installed.path} (this is the location of Tomcat's base dir if it is already installed) 225 gsdl2.installed.path=${gsdl2.installed.path} (this is the location of Greenstone 2 if you have it) 226 proxy.host=${proxy.host} 227 proxy.port=${proxy.port} 228 mysql.installed.path=${mysql.installed.path} (this is the location of mysql if it is already installed) 229 mysql.admin.user=${mysql.admin.user} 230 mysql.port=${mysql.port} 231 If these are not acceptable, please change them and rerun this target. Continue [y/n]?" /> 232 </input> 233 <condition property="do.abort"> 234 <equals arg1="n" arg2="${properties.ok}"/> 235 </condition> 236 <fail if="do.abort">Build aborted by user. Please change your properties settings and re-run the target</fail> 237 </target> 238 239 <target name="check-cvsroot"> 240 <condition property="cvsroot.notset"> 241 <or> 242 <not> 243 <isset property="env.CVSROOT"/> 244 </not> 245 <equals arg1="" arg2="${env.CVSROOT}"/> 246 </or> 247 </condition> 248 <fail if="cvsroot.notset" message="You need to set the CVSROOT variable"/> 249 </target> 250 <!-- this sets up some initial properties --> 251 <target name="init"> 252 253 <condition property="java.too.old"> 254 <or> 255 <equals arg1="1.1" arg2="${ant.java.version}"/> 256 <equals arg1="1.2" arg2="${ant.java.version}"/> 257 <equals arg1="1.3" arg2="${ant.java.version}"/> 258 </or> 259 </condition> 260 <fail if="java.too.old" message="You need Java 1.4 or greater to run Greenstone 3"/> 261 262 <available file="${basedir}/packages/mgpp/text" property="mgpp.present"/> 263 <available file="${basedir}/packages/mysql/bin" property="mysql.present"/> 264 <available file="${basedir}/gli" property="gli.present"/> 265 <available file="${basedir}/gs2build" property="gs2build.present"/> 266 <available file="${basedir}/comms/soap/axis" property="axis.present"/> 267 <available file="${basedir}/comms/jakarta/tomcat/webapps/axis" property="axis.installed"/> 268 <condition property="gsdl2.islocal"> 269 <or> 270 <not> 271 <isset property="gsdl2.installed.path"/> 272 </not> 273 <equals arg1="" arg2="${gsdl2.installed.path}"/> 274 </or> 275 </condition> 276 <condition property="mysql.islocal"> 277 <or> 278 <not> 279 <isset property="mysql.installed.path"/> 280 </not> 281 <equals arg1="" arg2="${mysql.installed.path}"/> 282 </or> 283 </condition> 284 <condition property="tomcat.islocal"> 285 <or> 286 <not> 287 <isset property="tomcat.installed.path"/> 288 </not> 289 <equals arg1="" arg2="${tomcat.installed.path}"/> 290 </or> 291 </condition> 292 293 <echo>tomcat.port:${tomcat.port}, gli.present:${gli.present} gsdlislocal=${gsdl2.islocal} gs2build.present=${gs2build.present} gsdl2.installed.path = ${gsdl2.installed.path}</echo> 294 <condition property="proxy.present"> 295 <and> 296 <isset property="proxy.host"/> 297 <not> 298 <equals arg1="" arg2="${proxy.host}"/> 299 </not> 300 </and> 301 </condition> 302 </target> 303 304 <target name="setup-proxy" depends="init" if="proxy.present"> 305 <condition property="ask.user"> 306 <or> 307 <equals arg1="" arg2="${proxy.user}"/> 308 <equals arg1="" arg2="${proxy.password}"/> 309 </or> 310 </condition> 311 <getuserandpassword message="Using proxy: ${proxy.host}:${proxy.port}" if="ask.user" username="${proxy.user}"/> 312 <mysetproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.password}"/> 313 </target> 314 315 <!-- ========== Miscellaneous Targets ================================ --> 316 317 <target name="prepare-collections"> 318 <property name="collect.dir" value="${basedir}/web/sites/localsite/collect"/> 319 <!-- gs3mgdemo --> 320 <unzip src="${collect.dir}/gs3mgdemo/import.zip" 321 dest="${collect.dir}/gs3mgdemo"/> 322 <unzip src="${collect.dir}/gs3mgdemo/archives.zip" 323 dest="${collect.dir}/gs3mgdemo"/> 324 <unzip src="${collect.dir}/gs3mgdemo/index/index.zip" 325 dest="${collect.dir}/gs3mgdemo/index"/> 326 <!-- gs2mgdemo --> 327 <unzip src="${collect.dir}/gs2mgdemo/import.zip" 328 dest="${collect.dir}/gs2mgdemo"/> 329 <unzip src="${collect.dir}/gs2mgdemo/metadata.zip" 330 dest="${collect.dir}/gs2mgdemo"/> 331 <unzip src="${collect.dir}/gs2mgdemo/index/index.zip" 332 dest="${collect.dir}/gs2mgdemo/index"/> 333 <!-- gs2mgppdemo --> 334 <unzip src="${collect.dir}/gs2mgppdemo/import.zip" 335 dest="${collect.dir}/gs2mgppdemo"/> 336 <unzip src="${collect.dir}/gs2mgppdemo/metadata.zip" 337 dest="${collect.dir}/gs2mgppdemo"/> 338 <unzip src="${collect.dir}/gs2mgppdemo/index/index.zip" 339 dest="${collect.dir}/gs2mgppdemo/index"/> 340 <!-- gberg --> 341 <unzip src="${collect.dir}/gberg/index/index.zip" 342 dest="${collect.dir}/gberg/index"/> 343 </target> 344 345 <target name="prepare-extra" depends="init"> 346 <!-- copy some jar files to web/lib for the phind applet --> 347 <copy file="${catalina.home}/common/endorsed/xml-apis.jar" 348 tofile="${basedir}/web/lib/xml-apis.jar"/> 349 <copy file="${catalina.home}/common/endorsed/xercesImpl.jar" 350 tofile="${basedir}/web/lib/xercesImpl.jar"/> 351 </target> 352 353 <target name="configure-files" depends="configure-files-gsdl3,configure-files-server"/> 354 355 <target name="configure-files-gsdl3" depends="init"> 356 <filter token="gsdl3home" value="${basedir}"/> 357 <copy file="${basedir}/web/WEB-INF/web.xml.in" tofile="${basedir}/web/WEB-INF/web.xml" filtering="true"/> 358 <copy file="${basedir}/resources/java/SOAPServer.cfg.in" tofile="${basedir}/resources/java/SOAPServer.cfg" filtering="true"/> 359 </target> 360 361 <target name="configure-files-server" depends="init"> 362 <filter token="port" value="${tomcat.port}"/> 363 <filter token="hostname" value="${tomcat.server}"/> 364 <copy file="${basedir}/web/sites/localsite/siteConfig.xml.in" tofile="${basedir}/web/sites/localsite/siteConfig.xml" filtering="true" overwrite="true"/> 365 <copy file="${basedir}/web/sites/gateway/siteConfig.xml.in" tofile="${basedir}/web/sites/gateway/siteConfig.xml" filtering="true" overwrite="true"/> 366 </target> 367 368 <target name="compile-extra" depends="init"> 369 <javac srcdir="${web.home}/WEB-INF/classes" 370 destdir="${web.home}/WEB-INF/classes" 371 debug="${compile.debug}" 372 deprecation="${compile.deprecation}" 373 optimize="${compile.optimize}"> 374 <classpath> 375 <path refid="compile.classpath"/> 376 </classpath> 377 </javac> 378 </target> 379 380 381 382 383 <!-- ======================= Tomcat Targets ========================== --> 384 385 <!-- this target sets up tomcat for the first time, or resets it any subsequent times --> 386 <target name="prepare-tomcat" depends="init,setup-proxy" if="tomcat.islocal"> 387 <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7.zip" 388 dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip" 389 usetimestamp="true"/> 390 <delete dir="${basedir}/comms/jakarta/tomcat.bak"/> 391 <move todir="${basedir}/comms/jakarta/tomcat.bak" failonerror="false"> 392 <fileset dir="${basedir}/comms/jakarta/tomcat"/> 393 </move> 394 <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7.zip" 395 dest="${basedir}/comms/jakarta"/> 396 <condition property="need.tomcat.compat"> 397 <equals arg1="1.4" arg2="${ant.java.version}"/> 398 </condition> 399 <antcall target="prepare-tomcat-compat"/> 400 <move todir="${basedir}/comms/jakarta/tomcat"> 401 <fileset dir="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7"/> 402 </move> 403 <!-- make sure we have execute permission for the .sh files --> 404 <chmod dir="${basedir}/comms/jakarta/tomcat/bin" perm="ugo+rx" 405 includes="*.sh"/> 406 <copy file="${basedir}/comms/jakarta/setclasspath.bat" 407 tofile="${basedir}/comms/jakarta/tomcat/bin/setclasspath.bat" 408 overwrite="true"/> 409 </target> 410 411 412 <target name="prepare-tomcat-compat" if="need.tomcat.compat"> 413 <get src="http://www.greenstone.org/gs3files/jakarta-tomcat-5.5.7-compat.zip" 414 dest="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip" 415 usetimestamp="true"/> 416 <unzip src="${basedir}/comms/jakarta/jakarta-tomcat-5.5.7-compat.zip" 417 dest="${basedir}/comms/jakarta"/> 418 </target> 419 420 <target name="configure-tomcat" depends="init" if="tomcat.islocal"> 421 <!-- re-setup the server.xml file --> 422 <copy file="${basedir}/comms/jakarta/server.xml.in" tofile="${basedir}/comms/jakarta/tomcat/conf/server.xml" overwrite="true"> 423 <filterset> 424 <filter token="port" value="${tomcat.port}"/> 425 <filter token="gsdl3home" value="${basedir}"/> 426 </filterset> 427 </copy> 428 </target> 429 430 <target name="reload" description="Reload web application" 431 depends="init,setup-catalina-ant-tasks"> 432 <reload url="http://kanuka:7070/manager" username="admin" password="admin" 433 path="/gsdl3"/> 434 </target> 435 436 <target name="start-tomcat" description="Startup only Tomcat" depends="init" if="tomcat.islocal"> 437 <property name="tomcat.classpath" refid="compile.classpath"/> 438 <property name="tomcat.path" refid="running.path"/> 439 <property name="catalina.opts" value="-Djava.util.prefs.syncInterval=2000000 -DGSDL3HOME=$GSDL3HOME -DGSDLOS=$GSDLOS -DPATH=$PATH -Xmx400M"/> 440 <exec executable="${catalina.home}/bin/startup.sh" os="${os.linux}" dir="${catalina.home}/bin" spawn="false"> 441 <env key="GSDLOS" value="linux"/> 442 <env key="GSDL3HOME" value="${basedir}"/> 443 <env key="PATH" path="${tomcat.path}"/> 444 <env key="CATALINA_OPTS" value="${catalina.opts}"/> 445 <env key="CATALINA_HOME" value="${catalina.home}"/> 446 <env key="CLASSPATH" path="${tomcat.classpath}"/> 447 <env key="LD_LIBRARY_PATH" path="${env.LD_LIBRARY_PATH}:${basedir}/lib:${mysql.home}/lib/mysql"/> 448 </exec> 449 <exec executable="${catalina.home}/bin/startup.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="true"> 450 <env key="GSDLOS" value="windows"/> 451 <env key="GSDL3HOME" value="${basedir}"/> 452 <env key="Path" path="${tomcat.path}"/> 453 <env key="PATH" path="${tomcat.path}"/> 454 <env key="CATALINA_OPTS" value="${catalina.opts}"/> 455 <env key="CLASSPATH" path="${tomcat.classpath}"/> 456 </exec> 457 <!-- wait for the server to startup in case other targets need it running --> 458 <waitfor maxwait="5" maxwaitunit="second"> 459 <and> 460 <socket server="${tomcat.server}" port="${tomcat.port}"/> 461 <http url="http://${tomcat.server}:${tomcat.port}/gsdl3/index.html"/> 462 </and> 463 </waitfor> 464 </target> 465 <!-- windows: do we want to launch a webrowser?? --> 466 <target name="stop-tomcat" description="Shutdown only Tomcat" depends="init" if="tomcat.islocal"> 467 <exec executable="${catalina.home}/bin/shutdown.sh" os="${os.linux}" dir="${catalina.home}/bin" spawn="false"> 468 <env key="CATALINA_HOME" value="${catalina.home}"/> 469 </exec> 470 <exec executable="${catalina.home}/bin/shutdown.bat" os="${os.windows}" dir="${catalina.home}/bin" spawn="false"/> 471 </target> 472 473 <target name="restart-tomcat" description="Shutdown and restart only Tomcat" depends="init,stop-tomcat,start-tomcat"/> 474 475 <target name="setup-catalina-ant-tasks"> 476 <!-- Configure the custom Ant tasks for the Tomcat Manager application --> 477 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" 478 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 479 <taskdef name="list" classname="org.apache.catalina.ant.ListTask" 480 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 481 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask" 482 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 483 <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask" 484 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 485 <taskdef name="roles" classname="org.apache.catalina.ant.RolesTask" 486 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 487 <taskdef name="start" classname="org.apache.catalina.ant.StartTask" 488 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 489 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask" 490 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 491 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" 492 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 493 </target> 494 495 496 <!-- ======================= Mysql Targets =========================== --> 497 498 <!-- this is one target that we only want to run once. --> 499 <target name="prepare-mysql" depends="init,init-mysql-vars,install-mysql,start-mysql,setup-mysql,stop-mysql"/> 500 501 <target name="init-mysql-vars"> 502 <condition property="mysql.islocal.linux"> 503 <and> 504 <isset property="mysql.islocal"/> 505 <isset property="current.os.islinux"/> 506 </and> 507 </condition> 508 509 <condition property="mysql.islocal.windows"> 510 <and> 511 <isset property="mysql.islocal"/> 512 <isset property="current.os.iswindows"/> 513 </and> 514 </condition> 515 </target> 516 517 <target name="install-mysql" depends="init,init-mysql-vars,install-mysql-linux,install-mysql-windows"/> 518 519 <!-- install and set up the database --> 520 <target name="install-mysql-linux" depends="init,init-mysql-vars" if="mysql.islocal.linux" unless="mysql.present"> 521 <get src="http://www.greenstone.org/gs3files/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz" 522 dest="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz" 523 usetimestamp="true"/> 524 <untar src="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686.tar.gz" 525 dest="${packages.home}" 526 compression="gzip"/> 527 <move todir="${packages.home}/mysql"> 528 <fileset dir="${packages.home}/mysql-standard-4.1.11-pc-linux-gnu-i686"/> 529 </move> 530 <!-- file permissions are screwed up, so make executables executable --> 531 <chmod file="${mysql.home}/scripts/mysql_install_db" perm="a+x"/> 532 <chmod perm="a+x"> 533 <fileset dir="${mysql.home}/bin" /> 534 </chmod> 535 <mkdir dir="${mysql.home}/var/"/> 536 <mkdir dir="${mysql.home}/var/log/"/> 537 <chmod file="${mysql.home}/var/" perm="777"/> 538 <chmod file="${mysql.home}/var/log/" perm="777"/> 539 540 <exec executable="${mysql.home}/scripts/mysql_install_db" dir="${mysql.home}"> 541 <arg value="--datadir=./data"/> 542 <arg value="--basedir=."/> 543 <arg value="--user=root"/> 544 <arg value="--force"/> 545 </exec> 546 </target> 547 548 <target name="install-mysql-windows" depends="init,init-mysql-vars" if="mysql.islocal.windows" unless="mysql.present"> 549 <get src="http://www.greenstone.org/gs3files/mysql-noinstall-4.1.11-win32.zip" 550 dest="${packages.home}/mysql-noinstall-4.1.11-win32.zip" 551 usetimestamp="true"/> 552 <!-- can we run the installer?? --> 553 <unzip src="${packages.home}/mysql-noinstall-4.1.11-win32.zip" 554 dest="${packages.home}"/> 555 <move todir="${packages.home}/mysql"> 556 <fileset dir="${packages.home}/mysql-4.1.11-win32"/> 557 </move> 558 </target> 559 560 <!-- is this just linux or both??. also we probably need to do this for external mysql --> 561 <!-- had unless mysql.present --> 562 <target name="setup-mysql" depends="init,init-mysql-vars" if="mysql.islocal"> 563 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"> 564 <arg value="--user=root"/> 565 <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost;"/> 566 </exec> 567 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"> 568 <arg value="--user=root"/> 569 <arg value="--execute=GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@'%'"/> 570 </exec> 571 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"> 572 <arg value="--user=root"/> 573 <arg value="--execute=GRANT SELECT ON *.* TO gsdl3reader@localhost;"/> 574 </exec> 575 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}"> 576 <arg value="--user=root"/> 577 <arg value="--execute=create database localsite_gs3mgdemo;"/> 578 </exec> 579 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}" 580 input="${basedir}/web/sites/localsite/collect/gs3mgdemo/mysqldatadump.sql"> 581 <arg value="--user=root"/> 582 <arg value="localsite_gs3mgdemo"/> 583 </exec> 584 </target> 585 586 <target name="start-mysql" depends="init,init-mysql-vars" if="mysql.islocal" 587 description="Startup only mysql"> 588 <exec executable="${mysql.home}/bin/mysqld_safe" dir="${mysql.home}" 589 spawn="true" os="${os.linux}"> 590 <arg value="--user=root"/> 591 <arg value="--datadir=./data"/> 592 <arg value="--basedir=."/> 593 <arg value="--pid_file=gsdl3.pid"/> 594 <arg value="--socket=/tmp/mysql.sock"/> 595 <arg value="--err-log=./var/log/mysql.log"/> 596 </exec> 597 <exec executable="${mysql.home}/bin/mysqld" dir="${mysql.home}" spawn="true" os="${os.windows}"> 598 </exec> 599 <sleep seconds="2"/> 600 <!-- need to test that the server has started up --> 601 <exec executable="${mysql.home}/bin/mysql" dir="${mysql.home}" 602 failonerror="true" outputproperty="throw.away"> 603 <arg value="--user=root"/> 604 <arg value="--execute=show databases;"/> 605 </exec> 606 <echo>MYSQL database server started successfully</echo> 607 </target> 608 609 <target name="stop-mysql" depends="init" if="mysql.islocal" 610 description="Shutdown only mysql"> 611 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}" 612 failonerror="true" os="${os.linux}"> 613 <arg value="--user=root"/> 614 <arg value="--socket=/tmp/mysql.sock"/> 615 <arg value="shutdown"/> 616 </exec> 617 <exec executable="${mysql.home}/bin/mysqladmin" dir="${mysql.home}" 618 failonerror="true" os="${os.windows}"> 619 <arg value="--user=root"/> 620 <arg value="shutdown"/> 621 </exec> 622 <echo>MYSQL database server shutdown successfully</echo> 623 </target> 624 625 <target name="restart-mysql" description="Shutdown and restart only mysql" depends="init,stop-mysql,start-mysql"/> 626 627 628 <!-- ======================= Axis Targets ============================ --> 629 630 <target name="prepare-axis" depends="init"> 631 <mkdir dir="${basedir}/comms/soap"/> 632 <get src="http://www.greenstone.org/gs3files/axis-1_1.zip" 633 dest="${basedir}/comms/soap/axis-1_1.zip" 634 usetimestamp="true"/> 635 <delete dir="${basedir}/comms/soap/axis.bak"/> 636 <move todir="${basedir}/comms/soap/axis.bak" failonerror="false"> 637 <fileset dir="${basedir}/comms/soap/axis"/> 638 </move> 639 <unzip src="${basedir}/comms/soap/axis-1_1.zip" 640 dest="${basedir}/comms/soap/"/> 641 <move todir="${basedir}/comms/soap/axis"> 642 <fileset dir="${basedir}/comms/soap/axis-1_1"/> 643 </move> 644 <!-- install the webapp into tomcat --> 645 <copy todir="${basedir}/comms/jakarta/tomcat/webapps/axis"> 646 <fileset dir="${basedir}/comms/soap/axis/webapps/axis"/> 647 </copy> 648 </target> 649 650 <target name="soap-deploy-site" depends="get-sitename,get-siteuri,create-deployment-files,restart-tomcat" 651 description="Deploy a SOAP web service for a local Greenstone site"> 652 <java classname="org.apache.axis.client.AdminClient"> 653 <classpath refid="compile.classpath"/> 654 <arg value="-p"/> 655 <arg value="${tomcat.port}"/> 656 <arg file="${basedir}/resources/soap/${axis.sitename}.wsdd"/> 657 </java> 658 </target> 659 660 <target name="soap-undeploy-site" depends="get-sitename" 661 description="Undeploy a SOAP web service for a local Greenstone site"> 662 <java classname="org.apache.axis.client.AdminClient"> 663 <classpath refid="compile.classpath"/> 664 <arg value="-p"/> 665 <arg value="${tomcat.port}"/> 666 <arg file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/> 667 </java> 668 </target> 669 670 <target name="deploy-localsite" depends="init"> 671 <antcall target="start-tomcat"/> 672 <antcall target="soap-deploy-site"> 673 <param name="axis.sitename" value="localsite"/> 674 <param name="axis.siteuri" value="localsite"/> 675 </antcall> 676 <antcall target="stop-tomcat"/> 677 </target> 678 679 <target name="get-sitename" unless="axis.sitename"> 680 <input addproperty="axis.sitename" message="What site? (press enter for default:localsite)" defaultvalue="localsite"/> 681 </target> 682 683 <target name="get-siteuri" depends="get-sitename" unless="axis.siteuri"> 684 <input addproperty="axis.siteuri" message="What name do you want the service to have? (press enter for default:${axis.sitename})" defaultvalue="${axis.sitename}"/> 685 <echo>${axis.sitename}, ${axis.siteuri}</echo> 686 </target> 687 <target name="check-deployment-files" depends="get-sitename"> 688 <condition property="deploy.exists"> 689 <available file="${basedir}/resources/soap/${axis.sitename}.wsdd"/> 690 </condition> 691 <condition property="undeploy.exists"> 692 <available file="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd"/> 693 </condition> 694 <echo>${axis.sitename}, ${deploy.exists}, ${undeploy.exists}</echo> 695 </target> 696 <target name="create-deployment-files" depends="get-sitename,check-deployment-files" 697 if="axis.sitename" unless="deploy.exists"> 698 <filter token="sitename" value="${axis.sitename}"/> 699 <filter token="siteuri" value="${axis.siteuri}"/> 700 <copy file="${basedir}/resources/soap/site.wsdd.template" 701 tofile="${basedir}/resources/soap/${axis.sitename}.wsdd" 702 filtering="true"/> 703 <copy file="${basedir}/resources/soap/undeploy-site.wsdd.template" 704 tofile="${basedir}/resources/soap/undeploy-${axis.sitename}.wsdd" 705 filtering="true"/> 706 <!-- create the java files and compile them --> 707 <copy file="${gsdl3.home}/SOAPServer.java.in" 708 tofile="${gsdl3.home}/SOAPServer${axis.sitename}.java" 709 filtering="true"/> 710 <javac srcdir="${src.home}" 711 destdir="${build.home}" 712 debug="${compile.debug}" 713 deprecation="${compile.deprecation}" 714 optimize="${compile.optimize}"> 715 <classpath refid="compile.classpath"/> 716 <include name="org/greenstone/gsdl3/SOAPServer${axis.sitename}.java" /> 717 </javac> 718 <jar destfile="${build.home}/gsdl3.jar"> 719 <fileset dir="${build.home}"> 720 <include name="org/greenstone/gsdl3/**"/> 721 <exclude name="**/Test.class"/> 722 </fileset> 723 <manifest> 724 <attribute name="Built-By" value="${user.name}" /> 725 </manifest> 726 </jar> 727 <copy file="${build.home}/gsdl3.jar" todir="${javalib}"/> 728 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/> 729 </target> 730 731 732 <!-- ====================== Core targets ============================== --> 733 <!-- core targets refer to the core gsdl3 java src --> 734 735 <target name="prepare-core"> 736 <!-- just get rid of empty directories--> 737 <cvs command="update -P"/> 738 </target> 739 <target name="configure-core"/> 740 <target name="update-core" depends="init,cvsupdate-core,clean-core,compile-core" 741 description="Update only the Greenstone core" /> 742 743 <target name="cvsupdate-core"> 744 <cvs command="update -l"/> 745 <cvs command="update -dP bin comms dist-resources docs interfaces lib resources src web winutil"/> 746 </target> 747 748 <target name="clean-core" 749 description="Clean only the Greenstone core"> 750 <delete dir="${build.home}"/> 751 </target> 752 753 <target name="compile-core" 754 description="Compile only the Greenstone core"> 755 <mkdir dir="${build.home}"/> 756 <javac srcdir="${src.home}" 757 destdir="${build.home}" 758 debug="${compile.debug}" 759 deprecation="${compile.deprecation}" 760 optimize="${compile.optimize}"> 761 <classpath> 762 <path refid="compile.classpath"/> 763 </classpath> 764 </javac> 765 <jar destfile="${build.home}/gsdl3.jar"> 766 <fileset dir="${build.home}"> 767 <include name="org/greenstone/gsdl3/**"/> 768 <exclude name="**/Test.class"/> 769 </fileset> 770 <manifest> 771 <attribute name="Built-By" value="${user.name}" /> 772 </manifest> 773 </jar> 774 <copy file="${build.home}/gsdl3.jar" todir="${javalib}"/> 775 <copy file="${build.home}/gsdl3.jar" todir="${web.lib}"/> 776 <mkdir dir="${web.classes}/org/greenstone/gsdl3"/> 777 <copy file="${build.home}/org/greenstone/gsdl3/LibraryServlet.class" 778 todir="${web.classes}/org/greenstone/gsdl3"/> 779 <jar destfile="${build.home}/phind.jar"> 780 <fileset dir="${build.home}"> 781 <include name="org/greenstone/applet/phind/**"/> 782 </fileset> 783 <manifest> 784 <attribute name="Built-By" value="${user.name}" /> 785 </manifest> 786 </jar> 787 <copy file="${build.home}/phind.jar" todir="${javalib}"/> 788 <copy file="${build.home}/phind.jar" todir="${web.lib}"/> 789 <jar destfile="${build.home}/anttasks.jar"> 790 <fileset dir="${build.home}"> 791 <include name="org/greenstone/anttasks/**"/> 792 </fileset> 793 <manifest> 794 <attribute name="Built-By" value="${user.name}" /> 795 </manifest> 796 </jar> 797 <copy file="${build.home}/anttasks.jar" todir="${javalib}"/> 798 <jar destfile="${build.home}/gsdl3test.jar"> 799 <fileset dir="${build.home}"> 800 <include name="org/greenstone/gsdl3/**/*Test.class"/> 801 <include name="org/greenstone/testing/**"/> 802 </fileset> 803 <manifest> 804 <attribute name="Built-By" value="${user.name}" /> 805 </manifest> 806 </jar> 807 </target> 808 809 <!-- ================== Packages targets ================================ --> 810 <!-- these targets refer to the greenstone packages - these need updating 811 less often, so are in separate targets to the core --> 812 <target name="prepare-packages" depends="init,prepare-mgpp,prepare-windows"/> 813 814 <target name="prepare-windows" depends="init" if="current.os.iswindows"> 815 <!-- need to download precompiled binaries for mg and mgpp --> 816 </target> 817 <target name="prepare-mgpp" depends="check-cvsroot,init" unless="mgpp.present"> 818 <cvs command="checkout -P" package="mgpp" dest="${basedir}/packages/"/> 819 </target> 820 821 <target name="update-packages" depends="init,cvsupdate-packages,configure-packages,clean-packages,compile-packages" 822 description="Update only the packages"/> 823 824 <target name="cvsupdate-packages"> 825 <cvs command="update -dP" dest="${packages.home}"/> 826 </target> 827 828 <target name="configure-packages" description="Configure only the packages."> 829 <echo> 830 Configuring MG 831 </echo> 832 <exec executable="configure" os="${os.linux}" 833 dir="${mg.home}"> 834 <arg value="--prefix=${basedir}"/> 835 </exec> 836 <echo> 837 Configuring MGPP 838 </echo> 839 <exec executable="configure" os="${os.linux}" 840 dir="${mgpp.home}"> 841 <arg value="--prefix=${basedir}"/> 842 </exec> 843 </target> 844 845 <target name="clean-packages" 846 description="Clean only the packages"> 847 <!-- mg : just call the make target --> 848 <exec executable="make" os="${os.linux}" 849 dir="${mg.home}"> 850 <arg value="clean"/> 851 </exec> 852 <!-- mgpp --> 853 <exec executable="make" os="${os.linux}" 854 dir="${mg.home}"> 855 <arg value="clean"/> 856 </exec> 857 <!-- vishnu : just call the ant target --> 858 <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}" 859 inheritall="false" target="clean"/> 860 861 <!-- gsdl-as : just call the ant target--> 862 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}" 863 inheritall="false" target="clean"/> 864 </target> 865 866 <target name="clean-windows-c++-packages" depends="init" if="current.os.iswindows" 867 description="Clean only the C/C++ packages"> 868 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}"> 869 <arg value="clean"/> 870 </exec> 871 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}"> 872 <arg value="clean"/> 873 </exec> 874 </target> 875 876 <target name="compile-packages" 877 description="Compile only the packages"> 878 <echo>Compiling MG</echo> 879 <exec executable="make" os="${os.linux}" 880 dir="${mg.home}"> 881 </exec> 882 <exec executable="make" os="${os.linux}" 883 dir="${mg.home}"> 884 <arg value="install"/> 885 </exec> 886 <!-- windows: just the java stuff. --> 887 <exec executable="${mg.home}/winMake.bat" os="${os.windows}" 888 dir="${mg.home}"> 889 <arg value="compile"/> 890 <arg value="javaonly"/> 891 </exec> 892 <exec executable="${mg.home}/winMake.bat" os="${os.windows}" 893 dir="${mg.home}"> 894 <arg value="install"/> 895 <arg value="javaonly"/> 896 <env key="GSDL3HOME" value="${basedir}"/> 897 </exec> 898 899 <!-- mgpp --> 900 <echo>Compiling MGPP</echo> 901 <exec executable="make" os="${os.linux}" 902 dir="${mgpp.home}"> 903 </exec> 904 <exec executable="make" os="${os.linux}" 905 dir="${mgpp.home}"> 906 <arg value="install"/> 907 </exec> 908 <!-- windows: just the java stuff. --> 909 <exec executable="${mgpp.home}/winMake.bat" os="${os.windows}" 910 dir="${mgpp.home}"> 911 <arg value="compile"/> 912 <arg value="javaonly"/> 913 </exec> 914 <exec executable="${mgpp.home}/winMake.bat" os="${os.windows}" 915 dir="${mgpp.home}"> 916 <arg value="install"/> 917 <arg value="javaonly"/> 918 <env key="GSDL3HOME" value="${basedir}"/> 919 </exec> 920 921 <!-- vishnu --> 922 <echo>Compiling Vishnu</echo> 923 <ant antfile="${vishnu.home}/build.xml" dir="${vishnu.home}" 924 inheritall="false" target="compile"/> 925 926 <!-- gsdl-as --> 927 <echo>Compiling GSDL-AS</echo> 928 <ant antfile="${gsdl-as.home}/build.xml" dir="${gsdl-as.home}" 929 inheritall="false" target="compile"/> 930 </target> 931 932 <target name="compile-windows-c++-packages" depends="init" if="current.os.iswindows" 933 description="Compile only the C/C++ packages"> 934 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}"/> 935 <exec executable="${mg.home}/winMake.bat" dir="${mg.home}"> 936 <arg value="install"/> 937 <env key="GSDL3HOME" value="${basedir}"/> 938 </exec> 939 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}"/> 940 <exec executable="${mgpp.home}/winMake.bat" dir="${mgpp.home}"> 941 <arg value="install"/> 942 <env key="GSDL3HOME" value="${basedir}"/> 943 </exec> 944 </target> 945 946 <!-- ================== gs2building targets ===============--> 947 948 949 <target name="update-gs2building" if="gsdl2.islocal" 950 depends="init,cvsupdate-gs2building,configure-gs2building,clean-gs2building,compile-gs2building" 951 description="Update only the Greenstone 2 building components"/> 952 953 <target name="cvsupdate-gs2building" if="gsdl2.islocal" depends="init"> 954 <cvs command="update -dP" dest="${gli.home}"/> 955 <!-- Note: can't do a -d update here cos it will get all of gsdl 956 also, an update doesn't get new files, so we do a checkout instead. --> 957 <cvs command="co gs2build" dest="${basedir}"/> 958 <!-- rename the .gs2build files - we may have gotten changes to the main 959 gsdl versions - make sure they are set back to the gs2build versions --> 960 <antcall target="rename-gs2build-files"/> 961 </target> 962 963 <target name="prepare-gs2building" depends="init,prepare-gs2build,prepare-gli" if="gsdl2.islocal"> 964 <echo>checking out gs2 building stuff</echo> 965 </target> 966 967 <target name="prepare-gs2build" depends="check-cvsroot,init" if="gsdl2.islocal" unless="gs2build.present"> 968 <echo>checking out gs2build</echo> 969 <cvs command="checkout -P" package="gs2build"/> 970 971 <!-- rename the .gs2build files --> 972 <antcall target="rename-gs2build-files"/> 973 <antcall target="unzip-windows-packages"/> 974 <antcall target="get-windows-binaries"/> 975 </target> 976 977 <target name="get-windows-binaries" depends="init" if="current.os.iswindows"> 978 <cvs command="checkout -P" package="winbin"/> 979 <copy todir="${basedir}/bin"> 980 <fileset dir="${basedir}/winbin/bin" includes="mg*.exe"/> 981 </copy> 982 <move todir="${gs2build.home}/bin/windows" failonerror="false"> 983 <fileset dir="${basedir}/winbin/bin"/> 984 </move> 985 <delete dir="${basedir}/winbin"/> 986 </target> 987 <target name="unzip-windows-packages" depends="init"> 988 <unzip src="${gs2build.home}/packages/windows/gdbm/gdbm.zip" 989 dest="${gs2build.home}/packages/windows/gdbm"/> 990 <unzip src="${gs2build.home}/packages/windows/crypt/crypt.zip" 991 dest="${gs2build.home}/packages/windows/crypt"/> 992 <unzip src="${gs2build.home}/packages/windows/expat/expat.zip" 993 dest="${gs2build.home}/packages/windows/expat"/> 994 </target> 995 996 <target name="rename-gs2build-files" depends="rename-gs2build-files-linux,rename-gs2build-files-windows"/> 997 998 <target name="rename-gs2build-files-windows" if="current.os.iswindows"> 999 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/> 1000 <copy file="${gs2build-extra.home}/lib.win32.mak" tofile="${gs2build.home}/lib/win32.mak"/> 1001 <copy file="${gs2build-extra.home}/win32.mak" tofile="${gs2build.home}/win32.mak"/> 1002 <copy file="${gs2build-extra.home}/setup.bat" tofile="${gs2build.home}/setup.bat"> 1003 <filterset> 1004 <filter token="gsdlhome" value="${gs2build.home}"/> 1005 </filterset> 1006 </copy> 1007 </target> 1008 <target name="rename-gs2build-files-linux" if="current.os.islinux"> 1009 <property name="gs2build-extra.home" value="${gs2build.home}/gs2build-extra"/> 1010 <copy file="${gs2build-extra.home}/configure" tofile="${gs2build.home}/configure"/> 1011 <chmod file="${gs2build.home}/configure" perm="a+x"/> 1012 <copy file="${gs2build-extra.home}/configure.in" tofile="${gs2build.home}/configure.in"/> 1013 <copy file="${gs2build-extra.home}/Makefile.in" tofile="${gs2build.home}/Makefile.in"/> 1014 <copy file="${gs2build-extra.home}/packages.configure" tofile="${gs2build.home}/packages/configure"/> 1015 <chmod file="${gs2build.home}/packages/configure" perm="a+x"/> 1016 <copy file="${gs2build-extra.home}/packages.Makefile" tofile="${gs2build.home}/packages/Makefile"/> 1017 <copy file="${gs2build-extra.home}/lib.Makefile.in" tofile="${gs2build.home}/lib/Makefile.in"/> 1018 1019 </target> 1020 <target name="prepare-gli" depends="check-cvsroot,init" if="gsdl2.islocal" unless="gli.present"> 1021 <echo>checking out gli</echo> 1022 <cvs command="checkout -P" package="gli"/> 1023 </target> 1024 1025 <target name="configure-gs2building" depends="init" if="gsdl2.islocal" 1026 description="Configure only the Greenstone 2 building components"> 1027 <exec executable="${gs2build.home}/configure" os="${os.linux}" 1028 dir="${gs2build.home}"> 1029 <arg value="--prefix=${gs2build.home}"/> 1030 </exec> 1031 </target> 1032 1033 <target name="clean-gs2building" depends="init" if="gsdl2.islocal" 1034 description="Clean only the Greenstone 2 building components"> 1035 <!-- gli --> 1036 <property name="gli.home" value="${basedir}/gli"/> 1037 <!-- linux --> 1038 <exec executable="clean.sh" os="${os.linux}" dir="${gli.home}" 1039 resolveExecutable="true"/> 1040 <!-- windows --> 1041 <exec executable="clean.bat" os="${os.windows}" dir="${gli.home}" 1042 resolveExecutable="true"/> 1043 <!-- gs2build --> 1044 <!--linux: --> 1045 <exec executable="make" os="${os.linux}" dir="${gs2build.home}"> 1046 <arg value="clean"/> 1047 </exec> 1048 <!-- windows: --> 1049 </target> 1050 1051 <target name="clean-windows-c++-gs2building" depends="init" if="current.os.iswindows" 1052 description="remove all object files and executables"> 1053 <!-- run the setup script --> 1054 <exec executable="${compile.windows.c++.setup}"/> 1055 <exec executable="nmake" dir="${gs2build.home}"> 1056 <arg value="/f"/> 1057 <arg value="win32.mak"/> 1058 <arg value="clean"/> 1059 </exec> 1060 </target> 1061 1062 <target name="compile-gs2building" depends="init" if="gsdl2.islocal" 1063 description="Compile only the Greenstone 2 building components"> 1064 <!-- gli --> 1065 <property name="gli.home" value="${basedir}/gli"/> 1066 <!-- linux --> 1067 <exec executable="makegli.sh" os="${os.linux}" dir="${gli.home}" 1068 resolveExecutable="true"/> 1069 <!-- windows --> 1070 <exec executable="makegli.bat" os="${os.windows}" dir="${gli.home}" 1071 resolveExecutable="true"/> 1072 <!-- gs2build --> 1073 <!--linux: make, make install --> 1074 <exec executable="make" os="${os.linux}" dir="${gs2build.home}"> 1075 </exec> 1076 <exec executable="make" os="${os.linux}" dir="${gs2build.home}"> 1077 <arg value="install"/> 1078 </exec> 1079 </target> 1080 <!-- windows: --> 1081 <target name="compile-windows-c++-gs2building" depends="init" if="current.os.iswindows" 1082 description="Use this if you want to compile the C++ code for the gs2build package"> 1083 <!-- run the setup script --> 1084 <exec executable="${compile.windows.c++.setup}"/> 1085 <exec executable="nmake" dir="${gs2build.home}"> 1086 <arg value="/f"/> 1087 <arg value="win32.mak"/> 1088 </exec> 1089 </target> 1090 <target name="gli" description="Run the Greenstone Librarian Interface" depends="gli-local,gli-external"> 1091 <echo>Running GLI from Ant means that you don't get to see any of the terminal output. If you have problems with GLI and want to see the output, please run the script gli4gs3.sh/bat from the gsdl3/gli directory. 1092 </echo> 1093 </target> 1094 1095 <target name="gli-local" depends="init" if="gsdl2.islocal"> 1096 <exec executable="${basedir}/gli/gli4gs3.sh" os="${os.linux}" dir="${basedir}/gli" spawn="true"> 1097 <env key="GSDLHOME" path="${basedir}/gs2build"/> 1098 <env key="GSDL3HOME" value="${basedir}"/> 1099 </exec> 1100 <exec executable="${basedir}/gli/gli4gs3.bat" os="${os.windows}" dir="${basedir}/gli" spawn="true"> 1101 <env key="GSDLHOME" value="${basedir}/gs2build"/> 1102 <env key="GSDL3HOME" value="${basedir}"/> 1103 </exec> 1104 </target> 1105 1106 <target name="gli-external" depends="init" unless="gsdl2.islocal"> 1107 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.sh" os="${os.linux}" dir="${gsdl2.installed.path}/gli"/> 1108 <exec executable="${gsdl2.installed.path}/gli/gli4gs3.bat" os="${os.windows}" dir="${gsdl2.installed.path}/gli"/> 1109 </target> 1110 1111 1112 <!-- ======================== TESTING Targets ========================= --> 1113 1114 <target name="test" description="Run the (incomplete) JUnit test suite " 1115 depends="init"> 1116 <mkdir dir="${basedir}/test"/> 1117 <junit printsummary="withOutAndErr" 1118 errorproperty="test.failed" 1119 failureproperty="test.failed" 1120 fork="${junit.fork}"> 1121 <formatter type="plain"/> 1122 <classpath> 1123 <pathelement location="${build.home}/gsdl3test.jar"/> 1124 <path refid="compile.classpath"/> 1125 </classpath> 1126 <test name="${testcase}" if="testcase"/> 1127 <batchtest todir="${basedir}/test" unless="testcase"> 1128 <fileset dir="${build.home}" 1129 includes="**/*Test.class" 1130 /> 1131 </batchtest> 1132 </junit> 1133 <echo> 1134 ********************************************* 1135 Test output can be found in directory 'test' 1136 ********************************************* 1137 </echo> 1138 </target> 1139 1140 1141 <target name="reconfigure-server-settings" depends="init,configure-tomcat,configure-files-server" 1142 description="If you have changed any of the Tomcat properties in the build.properties file, run this target to update the Tomcat configuration, and any Greenstone configuration files that specify the server address"> 1143 </target> 1144 49 1145 50 1146 </project> 51 1147 1148 -
trunk/gsdl3/comms/jakarta/server.xml.in
r7971 r9874 1 <!-- Alternate Example-lessConfiguration File -->1 <!-- Example Server Configuration File --> 2 2 <!-- Note that component elements are nested corresponding to their 3 3 parent-child relationships with each other --> … … 11 11 --> 12 12 13 <Server port="8005" shutdown="SHUTDOWN" debug="0"> 14 15 16 <!-- Uncomment this entry to enable JMX MBeans support --> 17 <!-- 18 <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" 19 debug="0" port="-1" login="admin" password="admin"/> 20 --> 21 13 <Server port="8005" shutdown="SHUTDOWN"> 14 15 <!-- Comment these entries out to disable JMX MBeans support used for the 16 administration web application --> 17 <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> 18 <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> 19 <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/> 20 21 <!-- Global JNDI resources --> 22 <GlobalNamingResources> 23 24 <!-- Test entry for demonstration purposes --> 25 <Environment name="simpleValue" type="java.lang.Integer" value="30"/> 26 27 <!-- Editable user database that can also be used by 28 UserDatabaseRealm to authenticate users --> 29 <Resource name="UserDatabase" auth="Container" 30 type="org.apache.catalina.UserDatabase" 31 description="User database that can be updated and saved" 32 factory="org.apache.catalina.users.MemoryUserDatabaseFactory" 33 pathname="conf/tomcat-users.xml" /> 34 35 </GlobalNamingResources> 22 36 23 37 <!-- A "Service" is a collection of one or more "Connectors" that share … … 31 45 32 46 <!-- Define the Tomcat Stand-Alone Service --> 33 <Service name=" Tomcat-Standalone">47 <Service name="Catalina"> 34 48 35 49 <!-- A "Connector" represents an endpoint by which requests are received … … 41 55 following the instructions below and uncommenting the second Connector 42 56 entry. SSL support requires the following steps (see the SSL Config 43 HOWTO in the Tomcat 4.0documentation bundle for more detailed57 HOWTO in the Tomcat 5 documentation bundle for more detailed 44 58 instructions): 45 * Download and install JSSE 1.0.2 or later, and put the JAR files46 into "$JAVA_HOME/jre/lib/ext".59 * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or 60 later, and put the JAR files into "$JAVA_HOME/jre/lib/ext". 47 61 * Execute: 48 62 %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows) … … 60 74 61 75 <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --> 62 <Connector className="org.apache.catalina.connector.http.HttpConnector" 63 port="8080" minProcessors="5" maxProcessors="75" 64 enableLookups="true" redirectPort="8443" 65 acceptCount="10" debug="0" connectionTimeout="60000"/> 66 <!-- Note : To disable connection timeouts, set connectionTimeout value 67 to -1 --> 68 69 <!-- Define an SSL HTTP/1.1 Connector on port 8443 --> 76 <Connector port="@port@" 77 maxThreads="150" minSpareThreads="25" maxSpareThreads="75" 78 enableLookups="false" redirectPort="8443" acceptCount="100" 79 connectionTimeout="20000" disableUploadTimeout="true" /> 80 <!-- Note : To disable connection timeouts, set connectionTimeout value 81 to 0 --> 82 83 <!-- Note : To use gzip compression you could set the following properties : 84 85 compression="on" 86 compressionMinSize="2048" 87 noCompressionUserAgents="gozilla, traviata" 88 compressableMimeType="text/html,text/xml" 89 --> 90 91 <!-- Define a SSL HTTP/1.1 Connector on port 8443 --> 70 92 <!-- 71 <Connector className="org.apache.catalina.connector.http.HttpConnector" 72 port="8443" minProcessors="5" maxProcessors="75" 73 enableLookups="true" 74 acceptCount="10" debug="0" scheme="https" secure="true"> 75 <Factory className="org.apache.catalina.net.SSLServerSocketFactory" 76 clientAuth="false" protocol="TLS"/> 77 </Connector> 93 <Connector port="8443" 94 maxThreads="150" minSpareThreads="25" maxSpareThreads="75" 95 enableLookups="false" disableUploadTimeout="true" 96 acceptCount="100" scheme="https" secure="true" 97 clientAuth="false" sslProtocol="TLS" /> 78 98 --> 79 99 80 100 <!-- Define an AJP 1.3 Connector on port 8009 --> 81 <!-- 82 <Connector className="org.apache.ajp.tomcat4.Ajp13Connector" 83 port="8009" minProcessors="5" maxProcessors="75" 84 acceptCount="10" debug="0"/> 85 --> 86 87 <!-- Define a Proxied HTTP/1.1 Connector on port 8081 --> 101 <Connector port="8009" 102 enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /> 103 104 <!-- Define a Proxied HTTP/1.1 Connector on port 8082 --> 88 105 <!-- See proxy documentation for more information about using this. --> 89 106 <!-- 90 <Connector className="org.apache.catalina.connector.http.HttpConnector" 91 port="8081" minProcessors="5" maxProcessors="75" 92 enableLookups="true" 93 acceptCount="10" debug="0" connectionTimeout="60000" 94 proxyPort="80"/> 95 --> 96 97 <!-- Define a non-SSL HTTP/1.0 Test Connector on port 8082 --> 98 <!-- 99 <Connector className="org.apache.catalina.connector.http10.HttpConnector" 100 port="8082" minProcessors="5" maxProcessors="75" 101 enableLookups="true" redirectPort="8443" 102 acceptCount="10" debug="0"/> 107 <Connector port="8082" 108 maxThreads="150" minSpareThreads="25" maxSpareThreads="75" 109 enableLookups="false" acceptCount="100" connectionTimeout="20000" 110 proxyPort="80" disableUploadTimeout="true" /> 103 111 --> 104 112 … … 108 116 on to the appropriate Host (virtual host). --> 109 117 118 <!-- You should set jvmRoute to support load-balancing via AJP ie : 119 <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1"> 120 --> 121 110 122 <!-- Define the top level container in our container hierarchy --> 111 <Engine name=" Standalone" defaultHost="localhost" debug="0">123 <Engine name="Catalina" defaultHost="localhost"> 112 124 113 125 <!-- The request dumper valve dumps useful debugging information about … … 118 130 element inside the corresponding <Host> or <Context> entry instead. 119 131 120 For a similar mechanism that is portable to all Servlet 2. 3132 For a similar mechanism that is portable to all Servlet 2.4 121 133 containers, check out the "RequestDumperFilter" Filter in the 122 134 example application (the source for this filter may be found in … … 129 141 --> 130 142 131 <!-- Global logger unless overridden at lower levels -->132 <Logger className="org.apache.catalina.logger.FileLogger"133 prefix="catalina_log." suffix=".txt"134 timestamp="true"/>135 136 143 <!-- Because this Realm is here, an instance will be shared globally --> 137 144 145 <!-- This Realm uses the UserDatabase configured in the global JNDI 146 resources under the key "UserDatabase". Any edits 147 that are performed against this UserDatabase are immediately 148 available for use by the Realm. --> 149 <Realm className="org.apache.catalina.realm.UserDatabaseRealm" 150 resourceName="UserDatabase"/> 151 152 <!-- Comment out the old realm but leave here for now in case we 153 need to go back quickly --> 154 <!-- 138 155 <Realm className="org.apache.catalina.realm.MemoryRealm" /> 156 --> 139 157 140 158 <!-- Replace the above Realm with one of the following to get a Realm … … 142 160 143 161 <!-- 144 <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"162 <Realm className="org.apache.catalina.realm.JDBCRealm" 145 163 driverName="org.gjt.mm.mysql.Driver" 146 164 connectionURL="jdbc:mysql://localhost/authority" … … 151 169 152 170 <!-- 153 <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"171 <Realm className="org.apache.catalina.realm.JDBCRealm" 154 172 driverName="oracle.jdbc.driver.OracleDriver" 155 173 connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL" … … 160 178 161 179 <!-- 162 <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"180 <Realm className="org.apache.catalina.realm.JDBCRealm" 163 181 driverName="sun.jdbc.odbc.JdbcOdbcDriver" 164 182 connectionURL="jdbc:odbc:CATALINA" … … 167 185 --> 168 186 169 <!-- Define the default virtual host --> 170 <Host name="localhost" debug="0" appBase="webapps" 171 unpackWARs="true" autoDeploy="true"> 187 <!-- Define the default virtual host 188 Note: XML Schema validation will not work with Xerces 2.2. 189 --> 190 <Host name="localhost" appBase="webapps" 191 unpackWARs="true" autoDeploy="true" 192 xmlValidation="false" xmlNamespaceAware="false"> 193 194 <!-- GSDL3 Service --> 195 <Context path="/gsdl3" docBase="@gsdl3home@/web" debug="1" reloadable="true"><Resources allowLinking='true'/></Context> 196 197 <!-- Defines a cluster for this node, 198 By defining this element, means that every manager will be changed. 199 So when running a cluster, only make sure that you have webapps in there 200 that need to be clustered and remove the other ones. 201 A cluster has the following parameters: 202 203 className = the fully qualified name of the cluster class 204 205 name = a descriptive name for your cluster, can be anything 206 207 mcastAddr = the multicast address, has to be the same for all the nodes 208 209 mcastPort = the multicast port, has to be the same for all the nodes 210 211 mcastBindAddr = bind the multicast socket to a specific address 212 213 mcastTTL = the multicast TTL if you want to limit your broadcast 214 215 mcastSoTimeout = the multicast readtimeout 216 217 mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat 218 219 mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received 220 221 tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes 222 223 tcpListenAddress = the listen address (bind address) for TCP cluster request on this host, 224 in case of multiple ethernet cards. 225 auto means that address becomes 226 InetAddress.getLocalHost().getHostAddress() 227 228 tcpListenPort = the tcp listen port 229 230 tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS 231 has a wakup bug in java.nio. Set to 0 for no timeout 232 233 printToScreen = true means that managers will also print to std.out 234 235 expireSessionsOnShutdown = true means that 236 237 useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called. 238 false means to replicate the session after each request. 239 false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager) 240 <% 241 HashMap map = (HashMap)session.getAttribute("map"); 242 map.put("key","value"); 243 %> 244 replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'. 245 * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication. 246 * Synchronous means that the thread that executes the request, is also the 247 thread the replicates the data to the other nodes, and will not return until all 248 nodes have received the information. 249 * Asynchronous means that there is a specific 'sender' thread for each cluster node, 250 so the request thread will queue the replication request into a "smart" queue, 251 and then return to the client. 252 The "smart" queue is a queue where when a session is added to the queue, and the same session 253 already exists in the queue from a previous request, that session will be replaced 254 in the queue instead of replicating two requests. This almost never happens, unless there is a 255 large network delay. 256 --> 257 <!-- 258 When configuring for clustering, you also add in a valve to catch all the requests 259 coming in, at the end of the request, the session may or may not be replicated. 260 A session is replicated if and only if all the conditions are met: 261 1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND 262 2. a session exists (has been created) 263 3. the request is not trapped by the "filter" attribute 264 265 The filter attribute is to filter out requests that could not modify the session, 266 hence we don't replicate the session after the end of this request. 267 The filter is negative, ie, anything you put in the filter, you mean to filter out, 268 ie, no replication will be done on requests that match one of the filters. 269 The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to. 270 271 filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI 272 ending with .gif and .js are intercepted. 273 274 The deployer element can be used to deploy apps cluster wide. 275 Currently the deployment only deploys/undeploys to working members in the cluster 276 so no WARs are copied upons startup of a broken node. 277 The deployer watches a directory (watchDir) for WAR files when watchEnabled="true" 278 When a new war file is added the war gets deployed to the local instance, 279 and then deployed to the other instances in the cluster. 280 When a war file is deleted from the watchDir the war is undeployed locally 281 and cluster wide 282 --> 283 284 <!-- 285 <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster" 286 managerClassName="org.apache.catalina.cluster.session.DeltaManager" 287 expireSessionsOnShutdown="false" 288 useDirtyFlag="true" 289 notifyListenersOnReplication="true"> 290 291 <Membership 292 className="org.apache.catalina.cluster.mcast.McastService" 293 mcastAddr="228.0.0.4" 294 mcastPort="45564" 295 mcastFrequency="500" 296 mcastDropTime="3000"/> 297 298 <Receiver 299 className="org.apache.catalina.cluster.tcp.ReplicationListener" 300 tcpListenAddress="auto" 301 tcpListenPort="4001" 302 tcpSelectorTimeout="100" 303 tcpThreadCount="6"/> 304 305 <Sender 306 className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" 307 replicationMode="pooled" 308 ackTimeout="15000"/> 309 310 <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve" 311 filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/> 312 313 <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer" 314 tempDir="/tmp/war-temp/" 315 deployDir="/tmp/war-deploy/" 316 watchDir="/tmp/war-listen/" 317 watchEnabled="false"/> 318 </Cluster> 319 --> 320 321 172 322 173 323 <!-- Normally, users must authenticate themselves to each web app … … 178 328 in this virtual host. --> 179 329 <!-- 180 <Valve className="org.apache.catalina.authenticator.SingleSignOn" 181 debug="0"/> 330 <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> 182 331 --> 183 332 … … 188 337 (to $CATALINA_HOME) or absolute path to the desired directory. 189 338 --> 339 <!-- 190 340 <Valve className="org.apache.catalina.valves.AccessLogValve" 191 341 directory="logs" prefix="localhost_access_log." suffix=".txt" 192 pattern="common"/> 193 194 <!-- Logger shared by all Contexts related to this virtual host. By 195 default (when using FileLogger), log files are created in the "logs" 196 directory relative to $CATALINA_HOME. If you wish, you can specify 197 a different directory with the "directory" attribute. Specify either a 198 relative (to $CATALINA_HOME) or absolute path to the desired 199 directory.--> 200 <Logger className="org.apache.catalina.logger.FileLogger" 201 directory="logs" prefix="localhost_log." suffix=".txt" 202 timestamp="true"/> 203 204 <!-- Define properties for each web application. This is only needed 205 if you want to set non-default properties, or have web application 206 document roots in places other than the virtual host's appBase 207 directory. --> 208 209 <!-- Tomcat Root Context --> 210 <!-- 211 <Context path="" docBase="ROOT" debug="0"/> 212 --> 213 214 <!-- GSDL3 Service --> 215 <Context path="/gsdl3" docBase="@gsdl3home@/web" debug="1" reloadable="true"> 216 <Resources allowLinking='true'/> 217 </Context> 218 219 <!-- SOAP Service --> 220 <Context path="/soap" docBase="@gsdl3home@/comms/soap/soap/webapps/soap" debug="1" reloadable="true"/> 342 pattern="common" resolveHosts="false"/> 343 --> 344 345 <!-- Access log processes all requests for this virtual host. By 346 default, log files are created in the "logs" directory relative to 347 $CATALINA_HOME. If you wish, you can specify a different 348 directory with the "directory" attribute. Specify either a relative 349 (to $CATALINA_HOME) or absolute path to the desired directory. 350 This access log implementation is optimized for maximum performance, 351 but is hardcoded to support only the "common" and "combined" patterns. 352 --> 353 <!-- 354 <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve" 355 directory="logs" prefix="localhost_access_log." suffix=".txt" 356 pattern="common" resolveHosts="false"/> 357 --> 358 <!-- Access log processes all requests for this virtual host. By 359 default, log files are created in the "logs" directory relative to 360 $CATALINA_HOME. If you wish, you can specify a different 361 directory with the "directory" attribute. Specify either a relative 362 (to $CATALINA_HOME) or absolute path to the desired directory. 363 This access log implementation is optimized for maximum performance, 364 but is hardcoded to support only the "common" and "combined" patterns. 365 366 This valve use NIO direct Byte Buffer to asynchornously store the 367 log. 368 --> 369 <!-- 370 <Valve className="org.apache.catalina.valves.ByteBufferAccessLogValve" 371 directory="logs" prefix="localhost_access_log." suffix=".txt" 372 pattern="common" resolveHosts="false"/> 373 --> 221 374 222 375 </Host> … … 226 379 </Service> 227 380 228 <!-- The MOD_WEBAPP connector is used to connect Apache 1.3 with Tomcat 4.0229 as its servlet container. Please read the README.txt file coming with230 the WebApp Module distribution on how to build it.231 (Or check out the "jakarta-tomcat-connectors/webapp" CVS repository)232 233 To configure the Apache side, you must ensure that you have the234 "ServerName" and "Port" directives defined in "httpd.conf". Then,235 lines like these to the bottom of your "httpd.conf" file:236 237 LoadModule webapp_module libexec/mod_webapp.so238 WebAppConnection warpConnection warp localhost:8008239 WebAppDeploy examples warpConnection /examples/240 241 The next time you restart Apache (after restarting Tomcat, if needed)242 the connection will be established, and all applications you make243 visible via "WebAppDeploy" directives can be accessed through Apache.244 -->245 246 <!-- Define an Apache-Connector Service -->247 <Service name="Tomcat-Apache">248 249 <Connector className="org.apache.catalina.connector.warp.WarpConnector"250 port="8008" minProcessors="5" maxProcessors="75"251 enableLookups="true"252 acceptCount="10" debug="0"/>253 254 <!-- Replace "localhost" with what your Apache "ServerName" is set to -->255 <Engine className="org.apache.catalina.connector.warp.WarpEngine"256 name="Apache" debug="0" appBase="webapps">257 258 <!-- Global logger unless overridden at lower levels -->259 <Logger className="org.apache.catalina.logger.FileLogger"260 prefix="apache_log." suffix=".txt"261 timestamp="true"/>262 263 <!-- Because this Realm is here, an instance will be shared globally -->264 <Realm className="org.apache.catalina.realm.MemoryRealm" />265 266 </Engine>267 268 </Service>269 270 381 </Server> 271 -
trunk/gsdl3/docs/manual/manual.tex
r9445 r9874 66 66 This section covers where to get \gsiii\ from, how to install it and how to run it. The standard method of running \gsiii\ is as a Java servlet. We provide the Tomcat servlet container to run the servlet. Standard web servers may be able to be configured to provide servlet support, and thereby remove the need to use Tomcat. Please see your web server documentation for this. This documentation assumes that you are using Tomcat. To access \gsiii, Tomcat must be started up, and then it can be accessed via a web browser. 67 67 68 Ant (Java's XML based build tool) is used for compilation, installation and running Greenstone. The build.xml file is the configuration file for the Greenstone project, and build.properties contains parameters that can be altered by the user. 68 69 69 70 \subsection{Get and install \gs\ } … … 75 76 \subsubsection{Linux} 76 77 77 Download the latest version of the installer, \gst{gsdl3-x.xx-linux}, and run it in a shell (\gst{./gsdl3-x.xx-linux}). The installation process will prompt you for the installation directory, the name of your computer and what port to run Tomcat on ( the defaults being \gst{localhost} and \gst{8080}). Once \gsiii\ has been installed, you can start the library by running \gst{.gs3-launch.sh} from the gsdl3 directory, and opening up a browser pointing to \gst{http://localhost:8080/gsdl3} (substituting your chosen name and port if necessary).78 Download the latest version of the installer, \gst{gsdl3-x.xx-linux}, and run it in a shell (\gst{./gsdl3-x.xx-linux}). The installation process will prompt you for the installation directory, the name of your computer and what port to run Tomcat on (defaults are \gst{localhost} and \gst{8080}). Once \gsiii\ has been installed, you can start the library by running \gst{ant start} from the gsdl3 directory, and opening up a browser pointing to \gst{http://localhost:8080/gsdl3} (substituting your chosen name and port if necessary). 78 79 79 80 \subsubsection{Windows} 80 81 81 Download the latest Windows installer, \gst{gsdl3-x.xx-win32.exe}, and double click it to start the installation. You will be prompted for the installation directory, installation type, your computer name and the port number to run Tomcat on (defaults are \gst{localhost} and \gst{8080}). Once \gsiii\ is installed, you can access the library by selecting \gst{Greenstone Digital Library 3} in the Start menu .82 Download the latest Windows installer, \gst{gsdl3-x.xx-win32.exe}, and double click it to start the installation. You will be prompted for the installation directory, installation type, your computer name and the port number to run Tomcat on (defaults are \gst{localhost} and \gst{8080}). Once \gsiii\ is installed, you can access the library by selecting \gst{Greenstone Digital Library 3} in the Start menu (or by running \gst{ant start} in the gsdl3 directory). 82 83 83 84 \subsubsection{Accessing the library in a browser}\label{sec:browser-access} … … 93 94 \subsubsection{Restarting the library} 94 95 95 The library program (actually Tomcat) can be restarted in Windows by closing the window, and restarting it from the Start menu. In Linux, you need to go to the gsdl3 directory, and run \gst{ ./gs3-launch.sh -shutdown}, then \gst{./gs3-launch.sh}.96 The library program (actually Tomcat) can be restarted in Windows by closing the window, and restarting it from the Start menu. In Linux, you need to go to the gsdl3 directory, and run \gst{ant restart}. 96 97 97 98 … … 366 367 \begin{figure}[h] 367 368 \centering 368 \includegraphics[width=4in]{pagebanner } %5.8369 \includegraphics[width=4in]{pagebanner.ps} %5.8 369 370 \caption{A sample collection page banner} 370 371 \label{fig:page-banner} … … 389 390 390 391 To create the director 391 Building native \gsiii\ collections is done using the \gst{gs3-build.sh } script, with the \gst{collectionConfig.xml} file controlling how the building is done. There are a number of considerations in building a collection: what documents appear in the collection, how they are indexed for searching, which classifications are used for browsing, etc.392 Building native \gsiii\ collections is done using the \gst{gs3-build.sh/bat} script, with the \gst{collectionConfig.xml} file controlling how the building is done. There are a number of considerations in building a collection: what documents appear in the collection, how they are indexed for searching, which classifications are used for browsing, etc. 392 393 393 394 Firstly, the documents that comprise the collection should be placed in the import subdirectory. At present, only documents in this directory will appear in the collection. Documents can be organised into sub folders inside the import directory. … … 453 454 The collectionConfig.xml file controls the all of these options for collection building, and the format is described in Section~\ref{sec:collconfig}. 454 455 455 To build a collection, place the source documents and optional metadata.xml file(s) in the import directory, place the \gst{collectionConfig.xml} file in the etc directory, and execute \gst{gs3build.sh/bat sitename collectionname}. The process will run, placing the new indexes in the \gst{building} subdirectory of the collection's directory. You must have mysql running before you start building---running \gst{ gs3-launch.sh/bat} will start up the MySQL server as well as tomcat.456 To build a collection, place the source documents and optional metadata.xml file(s) in the import directory, place the \gst{collectionConfig.xml} file in the etc directory, and execute \gst{gs3build.sh/bat sitename collectionname}. The process will run, placing the new indexes in the \gst{building} subdirectory of the collection's directory. You must have mysql running before you start building---running \gst{ant start} will start up the MySQL server as well as tomcat. 456 457 457 458 Once the build process is complete, the building directory should be renamed to index (after deleting or renaming the existing index directory, if any), and Tomcat prompted to reload the collection---either by restarting the server, or by sending an activate collection command to the library servlet. … … 1031 1032 \begin{figure}[t] 1032 1033 \centering 1033 \includegraphics[width=4in]{ newlocal} %5.81034 \includegraphics[width=4in]{local} %5.8 1034 1035 \caption{A simple stand-alone site.} 1035 1036 \label{fig:local} … … 2176 2177 \end{figure} 2177 2178 2178 We have used Apache SOAP for Java. This is run as a servlet in Tomcat. Tomcat in Greenstone comes set up to use SOAP, but it is not enabled. To enable it, run \gst{gs3-enable-soap.sh/bat}. For more details about SOAP in Greenstone, see Appendix~\ref{app:soap}. Debugging soap is described in Appendix~\ref{app:soap-debug}.2179 We have used Apache Axis SOAP implementation. This is run as a servlet in Tomcat. Axis is setup during installation of Greenstone. For more details about SOAP in Greenstone, see Appendix~\ref{app:soap}. Debugging soap is described in Appendix~\ref{app:soap-debug}. 2179 2180 2180 2181 \subsection{Serving a site using soap} 2181 2182 2182 A script has been created to setup a SOAP server for a site. On Linux, from the gsdl3 directory, run 2183 \gst{./gs3-soap-deploy-site.sh <sitename> <siteuri>} 2184 2185 Sitename is the name of the site's directory, e.g. localsite. The siteuri is the identifier that will be used for the SOAP resource, e.g. org.greenstone.localsite. It should be a unique name amongst all the SOAP services that you want to connect to. 2186 2187 The script deploys the service for the site specified. A resource file (\gst{sitename.xml}) is created which is used to specify the service. It can be found in \gst{gsdl3/resources/soap}, and is generated from \gst{site.xml.in}. 2183 A webs service for localsite comes predeployed, but if you want to setup a service for another site, run \gst{ant soap-deploy-site}. This will prompt you for the sitename (its directory name), and a siteuri - a unique identifier for the web service. 2184 2185 The ant target deploys the service for the site specified. A resource file (\gst{<sitename>.wsdd}) is created which is used to specify the service. It can be found in \gst{gsdl3/resources/soap}, and is generated from \gst{site.wsdd.template}. 2188 2186 2189 2187 To get siteA to talk to siteB, you need to deploy a SOAP server on siteB, then add a \gst{<site>} element to the \gst{<siteList>} of siteA's \gst{siteConfig.xml} file (in \gst{gsdl3/web/sites/siteA/siteConfig.xml}). … … 2193 2191 \begin{gsc}\begin{verbatim} 2194 2192 <site name="siteAuri" 2195 address="http://localhost:8080/ soap/servlet/rpcrouter"2193 address="http://localhost:8080/axis/services/siteAuri" 2196 2194 type="soap"/> 2197 2195 \end{verbatim}\end{gsc} … … 2208 2206 \gsiii\ is also available via CVS. You can download the latest version of the code. This is not guaranteed to be stable, in fact it is likely to be unstable. The advantage of using CVS is that you can update the code and get the latest fixes. 2209 2207 2210 Note that you will need the Java 2 SDK, version 1.4.0 or higher .2208 Note that you will need the Java 2 SDK, version 1.4.0 or higher, and Ant (Apache's Java based build tool, http://ant.apache.org) installed. 2211 2209 2212 2210 To check out the \gs\ code, use: … … 2219 2217 If you need it, the password for anonymous CVS access is \gst{anonymous}. Note that some older versions of CVS have trouble accessing this repository due to the port number being present. We are using version 1.11.1p1. 2220 2218 2221 The software needs to be compiled and installed. The installation procedure uses a shell script or batch file. The most up to date instructions may be found in the README.txt file in the top level gsdl3 directory. 2222 2223 To install Greenstone once you have checked it out of CVS, do the following (alternatives for Linux or Windows): 2219 Greenstone is built and installed using Ant (Apache's Java based build tool, 2220 http://ant.apache.org). You will need a Java Development 2221 Environment (1.4 or higher), and Ant installed to use Greenstone. You can download Ant from http://ant.apache.org/bindownload.cgi. 2222 2223 In the gsdl3 directory, you can run 'ant' which will give you a help message. 2224 Running 'ant -projecthelp' gives a list of the targets that you can run - these 2225 do various things like compile the source code, startup the server etc. 2226 2227 For a first time install, run 'ant install'. 2228 2229 The file build.properties contains various parameters that can be set by the user. Please check these settings before running 'ant install'. The install process will ask you if you accept the properties before starting. 2230 For a non-interactive version of the install, run 2231 ant -Dproperties.accepted=yes install 2232 2233 To log the output in build.log, run 2234 ant -Dproperties.accepted=yes -logfile build.log install 2235 2236 Under Linux, Java and C/C++ compilation is carried out. For windows, since Visual Studio is not a standard component, only Java compilation is carried out. Pre-compiled binaries are provided for the C/C++ components (packages and Greenstone 2 style building). If you have Visual Studio installed (version 6), you can run the compile-windows-c++ targets to compile the code locally. (Don't forget to setup the Visual Studio environment first, by running, e.g. C:/Program Files/Microsoft Visual Studio/VC98/Bin/VCVARS32.BAT or equivalent.) 2237 2238 2239 Note: \gst{gs3-setup} sets the environment variables \gst{CLASSPATH, PATH, JAVA\_HOME} and needs to be done in a shell before doing collection building etc. 2240 2241 To startup or shutdown the library (includes the Tomcat server and MYSQL server), the commands are (run from the gsdl3 directory): 2224 2242 2225 2243 \begin{quote}\begin{gsc} 2226 cd gsdl3\\ 2227 ./gs3-install.sh or gs3-install\\ 2228 source gs3-setup.sh or gs3-setup 2244 ant start \\ 2245 ant stop 2229 2246 \end{gsc}\end{quote} 2230 2247 2231 To recompile the code at any stage, you can use 2232 \begin{quote}\begin{gsc} 2233 source gs3-setup.sh or gs3-setup\\ 2234 make\\ 2235 make install\\ 2236 \end{gsc}\end{quote} 2237 2238 Note: \gst{gs3-setup} sets the environment variables \gst{CLASSPATH, PATH, JAVA\_HOME} and needs to be done in a shell before doing collection building etc. 2239 2240 To startup or shutdown the library (includes the Tomcat server and MYSQL server), the commands are (run from the gsdl3 directory): 2241 \begin{quote}\begin{gsc} 2242 ./gs3-launch.sh or gs3-launch \\ 2243 ./gs3-launch.sh -shutdown or close the window 2244 \end{gsc}\end{quote} 2245 2248 If you want to restart only Tomcat, run \gst{ant restart-tomcat}. 2246 2249 2247 2250 \newpage 2248 2251 \section{Tomcat}\label{app:tomcat} 2249 2252 2250 Tomcat is a servlet container . It is used to serve a \gs\ site using a servlet.2253 Tomcat is a servlet container, and Greenstone 3 runs as a servlet inside it. 2251 2254 2252 2255 The file \gst{\gsdlhome/comms/jakarta/tomcat/conf/server.xml} is the Tomcat configuration file. The installation process adds a context for \gsiii\ servlets (\gst{\gsdlhome/web})---this tells Tomcat where to find the web.xml file, and what URL (\gst{/gsdl3}) to give it. Anything inside the context directory is accessible via Tomcat\footnote{can we use .htaccess files to restrict access??}. For example, the index.html file that lives in \gst{\gsdlhome/web} can be accessed through the URL \gst{localhost:8080/gsdl3/index.html}. The demo collection's images can be accessed through \\ … … 2254 2257 2255 2258 2256 Tomcat runs by default on port 8080---this can be changed in server.xml, in the \begin{quote}\begin{gsc} 2257 <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->\\ 2258 <Connector> 2259 \end{gsc}\end{quote} 2260 element. The siteConfig files also need changing if Tomcat's port is changed: \gst{<httpAddress>} for the site, and \gst{<address>} for a remote site both use this. 2259 Grenstone sets up Tomcat to run on port 8080 by default. To change this, you can edit the tomcat.port property in build.properties. If you do this before installing Greenstone, then running 'ant install' will use the new port number. If you want to change it later on, shutdown tomcat, run 'ant reconfigure-server-settings', then when you restart tomcat it will use the new port. 2261 2260 2262 2261 Note: Tomcat must be shutdown and restarted any time you make changes in the following for those changes to take effect: … … 2264 2263 \begin{gsc} 2265 2264 \item \gsdlhome/web/WEB-INF/web.xml 2266 \item \gsdlhome/comms/jakarta/tomcat -tomcat-4.0.1/conf/server.xml2265 \item \gsdlhome/comms/jakarta/tomcat/conf/server.xml 2267 2266 \end{gsc} 2268 2267 \item any classes or jar files used by the servlets 2269 2268 \end{bulletedlist} 2270 \noindent Note: stdin and stdout for the servlets both go to\\2269 \noindent Note: stdin and stdout for the servlets (on linux) both go to\\ 2271 2270 \gst{\gsdlhome/comms/jakarta/tomcat/logs/catalina.out} 2272 2271 … … 2282 2281 \end{gsc}\end{quote} 2283 2282 2284 We have set up Tomcat to disallow directory listings for everything in the docBase directory. To turn this back on, you need to edit Tomcat's default web.xml file (\gst{\$GSDL3HOME/comms/jakarta/tomcat/conf/web.xml}): 2285 2286 In the default servlet definition, change the 'listings' parameter to true. 2283 By default, Tomcat allows directory listings. To disable this, change the 'listings' paramter to false in the default servlet definition, in Tomcat's web.xml file (\gst{\$GSDL3HOME/comms/jakarta/tomcat/conf/web.xml}): 2287 2284 2288 2285 Tomcat uses a Manager to handle HTTP session information. This may be stored between restarts if possible. To use a persistent session handling manager, uncomment the \gst{<Manager>} element in \\ … … 2314 2311 \section{SOAP}\label{app:soap} 2315 2312 2316 Grenstone uses Apache SOAP for distributed communications. This runs as a servlet inside Tomcat, and services can be deployed by the servlet. The SOAP servlet comes ready to run, but not enabled. To enable it, run: 2317 2318 \begin{quote}\begin{gsc} 2319 gs3-enable-soap.[sh/bat] 2320 \end{gsc}\end{quote} 2321 2322 All this does is to rename the SOAP web.xml.disabled file to web.xml. 2323 2324 The SOAP service for localsite comes pre-deployed. To get the gateway servlet talking to the localsite SOAP server, you need to shutdown and restart Tomcat. You should now see more collections when you run the gateway servlet. 2325 2326 To deploy a SOAP service for other sites, run 2327 \begin{quote}\begin{gsc} 2328 gs3-soap-deploy-site.[sh/bat] <sitename> <siteURI> 2329 \end{gsc}\end{quote} 2330 2331 This creates a new SOAPServer class for the site \\(\gst{\$GSDL3HOME/src/java/org/greenstone/gsdl3/SOAPServer<sitename>.java}), creates a resource file for deployment (\gst{\$GSDL3HOME/resources/soap/<sitename>.xml}), and then tries to deploy the service. If the deployment doesn't work, you can run it from the command line like: 2332 2333 \begin{gsc}\begin{verbatim} 2334 java org.apache.soap.server.ServiceManagerClient 2335 http://localhost:8080/soap/servlet/rpcrouter deploy 2336 resources/soap/<sitename>.xml 2337 \end{verbatim}\end{gsc} 2338 2339 You can also deploy a service through the website. If Tomcat is not running, start it up. 2340 2341 The SOAP servlet can be accessed at \begin{gsc}{\tt http://localhost:8080/soap}\end{gsc}. You should see a welcome page. Click on ``Run the admin client''. This enables you to list, deploy and undeploy SOAP services. 2342 2343 To deploy the SOAPServer for siteX: 2344 2345 Click on ``deploy'' and edit the following fields in the deploy form: 2346 2347 \begin{tabular}{ll} 2348 ID: & <URI for siteX>\\ 2349 Scope: (choose Session & Request---new instantiation for each request\\ 2350 or Application) & Session---same instantiation across a session\\ 2351 & Application---only uses one instantiation\\ 2352 Methods: &process\\ 2353 Java Provider / Provider Class: & org.greenstone.gsdl3.SOAPServersiteX\\ 2354 \end{tabular} 2355 2356 Now click the ``deploy'' button at the bottom of the page. If the service has been deployed, it should appear when you click on the left hand ``List'' button. 2357 2358 Information about deployed services is maintained between Tomcat sessions---you only need to deploy it once. 2313 Grenstone uses the Apache Axis SOAP implementation for distributed communications. Axis runs as a servlet inside Tomcat, and SOAP web services can be deployed by this Axis servlet. The Greenstone installation process sets up Axis for Tomcat, and predeploys the localsite web service. 2314 2315 To deploy a SOAP service for other sites, run \gst{ant soap-deploy-site} 2316 2317 This will prompt you for the sitename (the site's directory name), and a unique URI for the site. It creates a new SOAPServer class for the site \\(\gst{\$GSDL3HOME/src/java/org/greenstone/gsdl3/SOAPServer<sitename>.java}), creates a resource file for deployment (\gst{\$GSDL3HOME/resources/soap/<sitename>.wsdd}), and then tries to deploy the service. 2318 2319 Information about deployed services is maintained between Tomcat sessions---you only need to deploy something once. To undeploy a site, use \gst{ant undeploy-soap-site}. 2320 2321 The axis servlet can be accessed at \gst{localhost:8080/axis}. 2359 2322 2360 2323 \subsection{Debugging SOAP}\label{app:soap-debug} 2361 2324 2362 If you need to debug the SOAP stuff for some reason, or just want to look at the SOAP messages that are being passed back and forth, use a program called TcpTunnelGui. This intercepts messages coming in to one port, displays them, and passes them to another port.2325 If you need to debug the SOAP stuff for some reason, or just want to look at the SOAP messages that are being passed back and forth, you can use the TCP monitor. This intercepts messages coming in to one port, displays them, and passes them to another port. 2363 2326 To run it, type: 2364 2327 2365 \begin{quote}\gst{java org.apache.soap.util.net.TcpTunnelGui 8070 localhost 8080} 2328 \begin{quote}\gst{java -cp <path to gsdl3>/comms/soap/axis/lib/axis.jar \\ 2329 org.apache.axis.utils.tcpmon} 2366 2330 \end{quote} 2367 2331 2368 8070 is the port that TcpTunnelGui listens on, and 8080 is the port that it sends the messages onto---the port that Tomcat is using. You need to modify \gs\ to talk to port 8070 when it wants to talk to Tomcat, so that the messages go through TcpTunnelGui. This is specified in the \gst{<site>} element of the gateway site configuration file (\gst{\gsdlhome/web/sites/gateway/siteConfig.xml}). 2369 \begin{quote}\begin{gsc}\begin{verbatim} 2370 <site name="org.greenstone.localsite" 2371 address="http://localhost:8080/soap/servlet/rpcrouter" 2372 type="soap"/> 2373 \end{verbatim}\end{gsc}\end{quote} 2374 2375 Note that \gst{http://localhost:8080/soap/servlet/rpcrouter} is the 2376 address for talking to the Tomcat SOAP servlet services. 2377 2332 The listen port is the port that you want the monitor to be listening on. It should 'act as' a Listener, with target hostname 127.0.0.1 (localhost), and target port the port that Tomcat is running on (8080). You need to modify the address used to talk to the SOAP service. For example, if you want to monitor traffic between the gateway site and the localsite SOAP server, you will need to edit gateway's siteConfig.xml file and change the port number (in the site element) to whatever you have chosen as the listen port. 2378 2333 2379 2334 \newpage -
trunk/gsdl3/extensions/gsdl-as/build.xml
r8738 r9874 147 147 --> 148 148 149 <taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/> 150 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"/> 151 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/> 152 <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask"/> 149 <taskdef name="install" classname="org.apache.catalina.ant.InstallTask" 150 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 151 <taskdef name="list" classname="org.apache.catalina.ant.ListTask" 152 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 153 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask" 154 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 155 <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask" 156 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 153 157 154 158 … … 220 224 <include name="*.jar"/> 221 225 </fileset> 222 226 <!-- include greenstone files --> 227 <fileset dir="../../lib/java"> 228 <include name="*.jar"/> 229 </fileset> 223 230 <!-- Include all elements that Tomcat exposes to applications --> 224 231 <pathelement location="${catalina.home}/common/classes"/> -
trunk/gsdl3/extensions/gsdl-as/src/org/greenstone/gsdlas/AlertingService.java
r8888 r9874 86 86 String title = "Unknown action"; 87 87 String message = "I don't know how to " + action; 88 String details = "The only actions I know are " + Array s.toString(actions);88 String details = "The only actions I know are " + ArrayHelper.toString(actions); 89 89 return showError(context, message, details); 90 90 } -
trunk/gsdl3/extensions/gsdl-as/src/org/greenstone/gsdlas/EventStore.java
r8888 r9874 101 101 */ 102 102 private String encodeSpecialChars(String string) { 103 String encodedString = string.replace ("&", "&");104 encodedString = encodedString.replace ("<", "<");105 encodedString = encodedString.replace (">", ">");106 encodedString = encodedString.replace ("'", "'");107 encodedString = encodedString.replace ("\"", """);103 String encodedString = string.replaceAll("&", "&"); 104 encodedString = encodedString.replaceAll("<", "<"); 105 encodedString = encodedString.replaceAll(">", ">"); 106 encodedString = encodedString.replaceAll("\'", "'"); 107 encodedString = encodedString.replaceAll("\"", """); 108 108 return encodedString; 109 109 } -
trunk/gsdl3/extensions/gsdl-as/src/org/greenstone/gsdlas/GreenstoneCommunicator.java
r8874 r9874 21 21 import org.w3c.dom.*; 22 22 23 import org.greenstone.gsdlas.util.ArrayHelper; 23 24 24 25 /** … … 70 71 } 71 72 72 System.out.println(Arrays.toString(result));73 System.out.println(ArrayHelper.toString(result)); 73 74 74 75 return result; -
trunk/gsdl3/extensions/gsdl-as/src/org/greenstone/gsdlas/NotificationStore.java
r8738 r9874 54 54 String key = (String) iter.next(); 55 55 String value = (String) event.get(key); 56 String encodedValue = value.replace ("&", "&");57 encodedValue = encodedValue.replace ("<", "<");58 encodedValue = encodedValue.replace (">", ">");59 encodedValue = encodedValue.replace ("'", "'");60 encodedValue = encodedValue.replace ("\"", """);56 String encodedValue = value.replaceAll("&", "&"); 57 encodedValue = encodedValue.replaceAll("<", "<"); 58 encodedValue = encodedValue.replaceAll(">", ">"); 59 encodedValue = encodedValue.replaceAll("\'", "'"); 60 encodedValue = encodedValue.replaceAll("\"", """); 61 61 62 62 event.put(key, encodedValue); -
trunk/gsdl3/extensions/gsdl-as/src/org/greenstone/gsdlas/util/ArrayHelper.java
r8775 r9874 26 26 return index > -1 && index <= array.length; 27 27 } 28 29 static public String toString(String [] array) { 30 StringBuffer buffer = new StringBuffer(); 31 buffer.append("["); 32 for (int i=0; i<array.length; i++) { 33 buffer.append((String)array[i]); 34 buffer.append(","); 35 } 36 buffer.append("]"); 37 return buffer.toString(); 38 39 } 28 40 } -
trunk/gsdl3/extensions/vishnu/README
r8412 r9874 5 5 If you want to run it standalone: 6 6 7 The environment variable JAVA_HOME needs to be set. 7 You need to have Java 1.4 or higher and Ant installed. The environment variable JAVA_HOME needs to be set. 8 8 You need to have MG installed - this should be the version from Greenstone, and you need the mg.jar file in your CLASSPATH and the libmgjni.so in your LD_LIBRARY_PATH. 9 9 You need the lucene 1.4 or higher jar file in your CLASSPATH. 10 Other jar files needed in CLASSPATH: xercesImpl.jar, servlet .jar.10 Other jar files needed in CLASSPATH: xercesImpl.jar, servlet-api.jar. 11 11 These jar files all come as part of the Greenstone download. Some in gsdl3/lib/java, and servlet.jar in gsdl3/comms/jakarta/tomcat/lib (when unpacked). 12 12 13 Edit the src/vishnu Makefile/winMake.bat and uncomment the prefix for stand-alone vishnu.13 Edit the build.xml file and change the prefix property to be the current directory. 14 14 15 Then run the following (on both linux or windows) 16 17 make 18 make install 15 Then run 'ant' (or "ant all'). 19 16 20 17 … … 70 67 We have provided an example configuration for use with Tomcat (version 4.1). 71 68 72 Set the prefix in the src/vishnu Makefile to be ../.., then the servlet class and jar files will be installed in the correct places.73 69 The vishnu/web directory is setup to be the context directory for vishnu in Tomcat. 74 70 You need to edit Tomcat's conf/server.xml file, and add in the context for vishnu. Add the following element after the tomcat root context element: -
trunk/gsdl3/gs3-setup.sh
r8067 r9874 43 43 export MANPATH 44 44 45 CLASSPATH=$GSDL3HOME/resources/java:$GSDL3HOME/resources/dtd:$GSDL3HOME/src/java:$GSDL3HOME/comms/jakarta/tomcat/common/lib/servlet .jar:$GSDL3HOME/lib/java45 CLASSPATH=$GSDL3HOME/resources/java:$GSDL3HOME/resources/dtd:$GSDL3HOME/src/java:$GSDL3HOME/comms/jakarta/tomcat/common/lib/servlet-api.jar:$GSDL3HOME/lib/java 46 46 for JARFILE in $GSDL3HOME/lib/java/*.jar; do 47 47 CLASSPATH=$CLASSPATH:$JARFILE 48 48 done 49 for JARFILE in $GSDL3HOME/comms/soap/axis/lib/*.jar; do 50 CLASSPATH=$CLASSPATH:$JARFILE 51 done 49 52 export CLASSPATH 50 53 -
trunk/gsdl3/packages/gsdl-as/build.xml
r8738 r9874 147 147 --> 148 148 149 <taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/> 150 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"/> 151 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/> 152 <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask"/> 149 <taskdef name="install" classname="org.apache.catalina.ant.InstallTask" 150 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 151 <taskdef name="list" classname="org.apache.catalina.ant.ListTask" 152 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 153 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask" 154 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 155 <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask" 156 classpath="${catalina.home}/server/lib/catalina-ant.jar"/> 153 157 154 158 … … 220 224 <include name="*.jar"/> 221 225 </fileset> 222 226 <!-- include greenstone files --> 227 <fileset dir="../../lib/java"> 228 <include name="*.jar"/> 229 </fileset> 223 230 <!-- Include all elements that Tomcat exposes to applications --> 224 231 <pathelement location="${catalina.home}/common/classes"/> -
trunk/gsdl3/packages/gsdl-as/src/org/greenstone/gsdlas/AlertingService.java
r8888 r9874 86 86 String title = "Unknown action"; 87 87 String message = "I don't know how to " + action; 88 String details = "The only actions I know are " + Array s.toString(actions);88 String details = "The only actions I know are " + ArrayHelper.toString(actions); 89 89 return showError(context, message, details); 90 90 } -
trunk/gsdl3/packages/gsdl-as/src/org/greenstone/gsdlas/EventStore.java
r8888 r9874 101 101 */ 102 102 private String encodeSpecialChars(String string) { 103 String encodedString = string.replace ("&", "&");104 encodedString = encodedString.replace ("<", "<");105 encodedString = encodedString.replace (">", ">");106 encodedString = encodedString.replace ("'", "'");107 encodedString = encodedString.replace ("\"", """);103 String encodedString = string.replaceAll("&", "&"); 104 encodedString = encodedString.replaceAll("<", "<"); 105 encodedString = encodedString.replaceAll(">", ">"); 106 encodedString = encodedString.replaceAll("\'", "'"); 107 encodedString = encodedString.replaceAll("\"", """); 108 108 return encodedString; 109 109 } -
trunk/gsdl3/packages/gsdl-as/src/org/greenstone/gsdlas/GreenstoneCommunicator.java
r8874 r9874 21 21 import org.w3c.dom.*; 22 22 23 import org.greenstone.gsdlas.util.ArrayHelper; 23 24 24 25 /** … … 70 71 } 71 72 72 System.out.println(Arrays.toString(result));73 System.out.println(ArrayHelper.toString(result)); 73 74 74 75 return result; -
trunk/gsdl3/packages/gsdl-as/src/org/greenstone/gsdlas/NotificationStore.java
r8738 r9874 54 54 String key = (String) iter.next(); 55 55 String value = (String) event.get(key); 56 String encodedValue = value.replace ("&", "&");57 encodedValue = encodedValue.replace ("<", "<");58 encodedValue = encodedValue.replace (">", ">");59 encodedValue = encodedValue.replace ("'", "'");60 encodedValue = encodedValue.replace ("\"", """);56 String encodedValue = value.replaceAll("&", "&"); 57 encodedValue = encodedValue.replaceAll("<", "<"); 58 encodedValue = encodedValue.replaceAll(">", ">"); 59 encodedValue = encodedValue.replaceAll("\'", "'"); 60 encodedValue = encodedValue.replaceAll("\"", """); 61 61 62 62 event.put(key, encodedValue); -
trunk/gsdl3/packages/gsdl-as/src/org/greenstone/gsdlas/util/ArrayHelper.java
r8775 r9874 26 26 return index > -1 && index <= array.length; 27 27 } 28 29 static public String toString(String [] array) { 30 StringBuffer buffer = new StringBuffer(); 31 buffer.append("["); 32 for (int i=0; i<array.length; i++) { 33 buffer.append((String)array[i]); 34 buffer.append(","); 35 } 36 buffer.append("]"); 37 return buffer.toString(); 38 39 } 28 40 } -
trunk/gsdl3/packages/mg/java/org/greenstone/mg/MGQueryResult.java
r3794 r9874 53 53 } 54 54 55 public boolean isClear() { 56 return (total_num_docs_ == 0 && docs_.isEmpty() && terms_.isEmpty()); 57 } 55 58 56 59 /** returns the result as a String - useful for printing out results */ -
trunk/gsdl3/packages/mg/jni/MGWrapperImpl.c
r8920 r9874 315 315 316 316 /* Check that the index was loaded successfully */ 317 assert(qd != NULL); 317 if (qd==NULL) { 318 return NULL; 319 } 320 /*assert(qd != NULL);*/ 318 321 319 322 /* Get the document position and length in the text file */ … … 372 375 jthrowable exc; 373 376 374 /* Make sure an index has been specified */ 375 index_path = data->queryInfo->index; 376 assert(index_path != NULL); 377 378 /* Obtain C versions of the two string parameters */ 379 base_dir = (*j_env)->GetStringUTFChars(j_env, j_base_dir, NULL); 380 if (base_dir == NULL) { 381 return; 382 } 383 text_path = (*j_env)->GetStringUTFChars(j_env, j_text_path, NULL); 384 if (text_path == NULL) { 385 (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir); 386 return; 387 } 388 389 /* Load the appropriate index for satisfying this request */ 390 qd = loadIndexData((char*) base_dir, (char*) index_path, (char*) text_path); 391 392 /* The C text strings are no longer needed */ 393 (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir); 394 (*j_env)->ReleaseStringUTFChars(j_env, j_text_path, text_path); 395 396 /* Check that the index was loaded successfully */ 397 assert(qd != NULL); 398 399 /* Remove anything hanging around from last time */ 400 FreeQueryDocs(qd); 401 377 /* First of all, clear the previous result */ 402 378 /* The result to write to */ 403 379 result_ptr = (*j_env)->GetObjectField(j_env, j_obj, FID_query_result); … … 411 387 return; 412 388 } 389 390 /* Make sure an index has been specified */ 391 index_path = data->queryInfo->index; 392 assert(index_path != NULL); 393 394 /* Obtain C versions of the two string parameters */ 395 base_dir = (*j_env)->GetStringUTFChars(j_env, j_base_dir, NULL); 396 if (base_dir == NULL) { 397 return; 398 } 399 text_path = (*j_env)->GetStringUTFChars(j_env, j_text_path, NULL); 400 if (text_path == NULL) { 401 (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir); 402 return; 403 } 404 405 /* Load the appropriate index for satisfying this request */ 406 qd = loadIndexData((char*) base_dir, (char*) index_path, (char*) text_path); 407 408 /* The C text strings are no longer needed */ 409 (*j_env)->ReleaseStringUTFChars(j_env, j_base_dir, base_dir); 410 (*j_env)->ReleaseStringUTFChars(j_env, j_text_path, text_path); 411 412 /* Check that the index was loaded successfully */ 413 if (qd == NULL) { 414 return; 415 } 416 /*assert(qd != NULL);*/ 417 418 /* Remove anything hanging around from last time */ 419 FreeQueryDocs(qd); 413 420 414 421 /* Obtain a C version of the query string */ -
trunk/gsdl3/packages/mg/src/images/WIN32.MAK
r3921 r9874 156 156 157 157 mostlyclean: 158 rm -f *$o _*.c _*.o *._c *._o core core.* 158 if exist *$o del *$o 159 if exist _*.c del _*.c 160 if exist _*.o del _*.o 161 if exist *._c del *._c 162 if exist *._o del *._o 163 if exist core del core 164 if exist core.* del core.* 159 165 160 166 clean: mostlyclean 161 rm -f $(EXEC)167 if exist *$e del *$e 162 168 163 169 distclean: clean 164 rm -f ansi2knr 165 rm -f Makefile 166 170 del ansi2knr 171 167 172 maintainer-clean: distclean 168 173 @echo "This command is intended only for maintainers to use;" -
trunk/gsdl3/packages/mg/src/text/win32.mak
r7585 r9874 237 237 clean: 238 238 if exist *$o del *$o 239 if exist $(EXEC) del $(EXEC)239 if exist *$e del *$e 240 240 if exist libmgtextin.lib del libmgtextin.lib 241 241 if exist libmgpass.lib del libmgpass.lib -
trunk/gsdl3/packages/mg/winMake.bat
r6416 r9874 29 29 cd ..\.. 30 30 31 cd java\org\greenstone\mg 32 call winMake.bat %1 33 cd ..\..\..\.. 34 31 35 cd jni 32 36 %MAKE% %MAKE_OPTIONS% win32.mak %1 … … 40 44 41 45 :done 46 47 -
trunk/gsdl3/packages/vishnu/README
r8412 r9874 5 5 If you want to run it standalone: 6 6 7 The environment variable JAVA_HOME needs to be set. 7 You need to have Java 1.4 or higher and Ant installed. The environment variable JAVA_HOME needs to be set. 8 8 You need to have MG installed - this should be the version from Greenstone, and you need the mg.jar file in your CLASSPATH and the libmgjni.so in your LD_LIBRARY_PATH. 9 9 You need the lucene 1.4 or higher jar file in your CLASSPATH. 10 Other jar files needed in CLASSPATH: xercesImpl.jar, servlet .jar.10 Other jar files needed in CLASSPATH: xercesImpl.jar, servlet-api.jar. 11 11 These jar files all come as part of the Greenstone download. Some in gsdl3/lib/java, and servlet.jar in gsdl3/comms/jakarta/tomcat/lib (when unpacked). 12 12 13 Edit the src/vishnu Makefile/winMake.bat and uncomment the prefix for stand-alone vishnu.13 Edit the build.xml file and change the prefix property to be the current directory. 14 14 15 Then run the following (on both linux or windows) 16 17 make 18 make install 15 Then run 'ant' (or "ant all'). 19 16 20 17 … … 70 67 We have provided an example configuration for use with Tomcat (version 4.1). 71 68 72 Set the prefix in the src/vishnu Makefile to be ../.., then the servlet class and jar files will be installed in the correct places.73 69 The vishnu/web directory is setup to be the context directory for vishnu in Tomcat. 74 70 You need to edit Tomcat's conf/server.xml file, and add in the context for vishnu. Add the following element after the tomcat root context element: -
trunk/gsdl3/src/java/org/greenstone/gsdl3/SOAPServer.java.in
r8081 r9874 17 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 18 */ 19 19 20 package org.greenstone.gsdl3; 20 21 21 22 import org.greenstone.gsdl3.core.*; 23 import org.greenstone.gsdl3.util.GSXML; 22 24 import org.w3c.dom.Element; 23 25 import java.io.File; … … 30 32 * 31 33 * @author <a href="mailto:[email protected]">Katherine Don</a> 32 * @version $Revision$33 34 * @see <a href="http://www.w3.org/TR/SOAP/">Simple Object Access Protocol (SOAP) 1.1 </a> 34 35 */ 35 36 36 public class SOAPServer 37 implements ModuleInterface { 38 37 public class SOAPServerlocalsite 38 { 39 39 private String config_file_name = "SOAPServer.cfg"; 40 40 … … 43 43 44 44 /** The no-args constructor */ 45 public SOAPServer () {45 public SOAPServer@sitename@() { 46 46 // find out gsdl3home 47 47 URL url = ClassLoader.getSystemResource(config_file_name); … … 54 54 return; 55 55 } 56 String site_home=gsdl3_home+File.separator+"web"+File.separator+"sites"+File.separator+" @sitename@";56 String site_home=gsdl3_home+File.separator+"web"+File.separator+"sites"+File.separator+"localsite"; 57 57 58 58 File site_file = new File(site_home); … … 66 66 } 67 67 68 69 /** Process a String request */ 70 public String process(String xml_in) { 71 return mr_.process(xml_in); 72 73 } 74 75 /** Process an Element request */ 76 public Element process(Element xml_in) { 77 return mr_.process(xml_in); 68 public Element [] process (Element [] xml_in) { 69 Element [] result = new Element[xml_in.length]; 70 for (int i=0; i<xml_in.length; i++) { 71 Element req = xml_in[i]; 72 // get rid of the obligatory namespace that axis needs 73 String tag_name = req.getTagName(); 74 String namespace=""; 75 if (tag_name.indexOf(':')!= -1) { 76 namespace = tag_name.substring(0, tag_name.indexOf(':')); 77 tag_name = tag_name.substring(tag_name.indexOf(':')+1); 78 } 79 Element new_req = GSXML.duplicateWithNewName(req.getOwnerDocument(), req, tag_name, true); 80 Element r = mr_.process(new_req); 81 // add the namespace back on 82 //Element new_res = r; 83 //if (!namespace.equals("")) { 84 // new_res = GSXML.duplicateWithNewName(r.getOwnerDocument(), r, namespace+r.getTagName(), true); 85 //} 86 result[i] = r; 87 } 88 return result; 78 89 } 79 90 … … 92 103 return null; 93 104 } 94 105 95 106 } 96 107 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/Action.java
r8832 r9874 52 52 public String process(String xml_in) { 53 53 54 Element message = this.converter.getDOM(xml_in).getDocumentElement(); 55 56 Element result = process(message); 54 Document message_doc = this.converter.getDOM(xml_in); 55 if (message_doc == null) { 56 System.err.println("Action.process(String) Error: Couldn't parse request"); 57 System.err.println(xml_in); 58 return null; 59 } 60 Element result = process(message_doc.getDocumentElement()); 57 61 return this.converter.getString(result); 58 62 } … … 115 119 } 116 120 121 protected boolean processErrorElements(Element message, Element page) { 122 NodeList error_nodes = message.getElementsByTagName(GSXML.ERROR_ELEM); 123 if (error_nodes.getLength()==0) { 124 return false; 125 } 126 Document owner = page.getOwnerDocument(); 127 for (int i=0; i<error_nodes.getLength(); i++) { 128 page.appendChild(owner.importNode(error_nodes.item(i), true)); 129 } 130 return true; 131 } 117 132 } 118 133 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/DocumentAction.java
r9007 r9874 209 209 // Process the document structure retrieve message 210 210 Element ds_response_message = (Element) this.mr.process(ds_message); 211 211 if (processErrorElements(ds_response_message, page_response)) { 212 return result; 213 } 214 212 215 // get the info and print out 213 216 String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); … … 309 312 doc_list.appendChild(doc_node); 310 313 Element dm_response_message = (Element) this.mr.process(dm_message); 314 if (processErrorElements(dm_response_message, page_response)) { 315 return result; 316 } 311 317 312 318 String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); … … 348 354 System.err.println("request = "+converter.getString(dc_message)); 349 355 Element dc_response_message = (Element) this.mr.process(dc_message); 356 if (processErrorElements(dc_response_message, page_response)) { 357 return result; 358 } 359 350 360 Element dc_response_doc_list = (Element) GSXML.getNodeByPath(dc_response_message, path); 351 361 … … 536 546 HashMap params = GSXML.extractParams(cgi_param_list, false); 537 547 538 539 String service_name = (String)((HashMap)params.get("p")).get(GSParams.SERVICE); 548 HashMap previous_params = (HashMap)params.get("p"); 549 if (previous_params == null) { 550 return dc_response_doc_content; 551 } 552 String service_name = (String)previous_params.get(GSParams.SERVICE); 540 553 if (service_name == null || !service_name.endsWith("Query")) { // hack for now - we only do highlighting if we were in a query last - ie not if we were in a browse thingy 541 554 System.err.println("DocumentAction: invalid service, not doing highlighting"); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/GS2BrowseAction.java
r8575 r9874 126 126 horizontal_at_top = true; 127 127 } 128 if (top_id.equals(classifier_node) && horizontal_at_top) { 128 // *** TODO need to fix this 129 //if (top_id.equals(classifier_node) && horizontal_at_top) { 129 130 // we have asked for a top node - if the first list is horizontal, we will select the first element of that list 130 // this is a hack. also it craps out if the classifier really isn't horizontalAtTop. 131 classifier_node = classifier_node+".1";131 // this is a hack. also it craps out if the classifier really isn't horizontalAtTop. - 132 //classifier_node = classifier_node+".1"; 132 133 133 }134 //} 134 135 135 136 // get the browse structure for the selected node -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java
r9264 r9874 60 60 String to = GSPath.appendLink(collection, service_name); 61 61 62 // part of the response is the service description 63 // for now get this again from the service. 64 // this will probably need to be cached somehow later on. 65 Element mr_info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 66 Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid); 67 mr_info_message.appendChild(mr_info_request); 68 62 if (request_type.indexOf("d")!=-1) { 63 // we have been asked for the service description 64 Element mr_info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 65 Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid); 66 mr_info_message.appendChild(mr_info_request); 67 68 // process the message 69 Element mr_info_response = (Element) this.mr.process(mr_info_message); 70 // the response 71 Element service_response = (Element)GSXML.getChildByTagName(mr_info_response, GSXML.RESPONSE_ELEM); 72 73 Element service_description = (Element)this.doc.importNode(GSXML.getChildByTagName(service_response, GSXML.SERVICE_ELEM), true); 74 page_response.appendChild(service_description); 75 } 76 77 if (request_type.indexOf("r") == -1) { 78 // just a display request, no actual processing to do 79 return page_response; 80 } 81 82 // check that we have some service params 83 HashMap service_params = (HashMap)params.get("s1"); 84 if (service_params == null) { // no query 85 return page_response; 86 } 87 88 // create the query request 89 Element mr_query_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 90 Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid); 91 mr_query_message.appendChild(mr_query_request); 92 93 Element query_param_list = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 94 GSXML.addParametersToList(this.doc, query_param_list, service_params); 95 mr_query_request.appendChild(query_param_list); 96 69 97 // also get the format stuff now if there is some 70 98 Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, lang, uid); 71 mr_info_message.appendChild(format_request); 72 73 // process the messages 74 Element mr_info_response = (Element) this.mr.process(mr_info_message); 75 76 // the two responses 77 NodeList responses = mr_info_response.getElementsByTagName(GSXML.RESPONSE_ELEM); 78 Element service_response = (Element)responses.item(0); 79 Element format_response = (Element)responses.item(1); 80 81 Element service_description = (Element)this.doc.importNode(GSXML.getChildByTagName(service_response, GSXML.SERVICE_ELEM), true); 82 page_response.appendChild(service_description); 83 84 if (request_type.equals("d")) {// just a display request 85 return page_response; 86 } 87 99 mr_query_message.appendChild(format_request); 100 101 // do the query 102 Element mr_query_response = (Element)this.mr.process(mr_query_message); 103 104 // check for errors 105 if (processErrorElements(mr_query_response, page_response)) { 106 return page_response; 107 } 108 109 NodeList responses = mr_query_response.getElementsByTagName(GSXML.RESPONSE_ELEM); 110 Element query_response = (Element) responses.item(0); 111 Element format_response = (Element) responses.item(1); 112 113 Element query_result_metadata_list = (Element) GSXML.getChildByTagName(query_response, GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 114 if (query_result_metadata_list == null) { 115 System.err.println("QueryAction: Warning: No query result metadata.\n"); 116 } else { // add it into the page response 117 page_response.appendChild(this.doc.importNode(query_result_metadata_list, true)); 118 } 119 120 Element query_term_info_list = (Element) GSXML.getChildByTagName(query_response, GSXML.TERM_ELEM+GSXML.LIST_MODIFIER); 121 if (query_term_info_list == null) { 122 System.err.println("QueryAction: Warning: No query term information.\n"); 123 } else { // add it into the page response 124 page_response.appendChild(this.doc.importNode(query_term_info_list, true)); 125 } 126 127 // check that there are some documents - for now check the list, but later should use a numdocs metadata elem 128 Element document_list = (Element)GSXML.getChildByTagName(query_response, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 129 // documentList not present if no docs found 130 if (document_list == null) { 131 return page_response; 132 } 133 134 // now we check to see if there is metadata already - some search services return predefined metadata. if there is some, don't do a metadata request 135 NodeList doc_metadata = document_list.getElementsByTagName(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 136 if (doc_metadata.getLength()>0) { 137 System.err.println("have already found metadata!"); 138 // append the doc list to the result 139 page_response.appendChild(this.doc.importNode(document_list, true)); 140 return page_response; 141 } 142 143 // get the metadata elements needed from the format statement if any 88 144 HashSet metadata_names = new HashSet(); 89 145 metadata_names.add("Title"); … … 98 154 extractMetadataNames(format_elem, metadata_names); 99 155 } 100 101 // do the query102 Element mr_query_message = this.doc.createElement(GSXML.MESSAGE_ELEM);103 Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);104 mr_query_message.appendChild(mr_query_request);105 106 // paramList107 HashMap service_params = (HashMap)params.get("s1");108 if (service_params == null) { // no query109 return page_response;110 }111 Element query_param_list = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);112 GSXML.addParametersToList(this.doc, query_param_list, service_params);113 ///ystem.out.println("service params are "+this.converter.getString(query_param_list));114 mr_query_request.appendChild(query_param_list);115 116 // do the query117 Element mr_query_response = (Element)this.mr.process(mr_query_message);118 119 //. check for errors120 String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.ERROR_ELEM);121 Element error_elem = (Element) GSXML.getNodeByPath(mr_query_response, path);122 if (error_elem != null) {123 // should we continue?? perhaps have a kind of error - information vs fatal??124 System.err.println("found an error elem");125 page_response.appendChild(this.doc.importNode(error_elem, true));126 return page_response;127 }128 path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);129 Element query_result_metadata_list = (Element) GSXML.getNodeByPath(mr_query_response, path);130 if (query_result_metadata_list == null) {131 System.err.println("QueryAction: Warning: No query result metadata.\n");132 } else { // add it into the page response133 page_response.appendChild(this.doc.importNode(query_result_metadata_list, true));134 }135 136 path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.TERM_ELEM+GSXML.LIST_MODIFIER);137 Element query_term_info_list = (Element) GSXML.getNodeByPath(mr_query_response, path);138 if (query_term_info_list == null) {139 System.err.println("QueryAction: Warning: No query term information.\n");140 } else { // add it into the page response141 page_response.appendChild(this.doc.importNode(query_term_info_list, true));142 }143 144 // check that there are some documents - for now check the list, but later should use a numdocs metadata elem145 path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER);146 147 Element document_list = (Element)GSXML.getNodeByPath(mr_query_response,148 path);149 // documentList not present if no docs found150 if (document_list == null) {151 return page_response;152 }153 156 154 157 // paging of the results is done here - we filter the list to remove unwanted entries before retrieving metadata 155 Element filtered_doc_list = filterDocList(params, service_description, document_list); 156 157 // now we check to see if there is metadata already - some search services return predefined metadata. if there is some, don't do a metadata request 158 NodeList doc_metadata = document_list.getElementsByTagName(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 159 if (doc_metadata.getLength()>0) { 160 System.err.println("have already found metadata!"); 161 // append the doc list to the result 162 page_response.appendChild(this.doc.importNode(document_list, true)); 163 return page_response; 164 } 158 Element filtered_doc_list = filterDocList(params, service_params, document_list); 159 165 160 // do the metadata request on the filtered list 166 161 Element mr_metadata_message = this.doc.createElement(GSXML.MESSAGE_ELEM); … … 176 171 mr_metadata_request.appendChild(dm_param_list); 177 172 178 179 173 // add in the doc node list too 180 174 mr_metadata_request.appendChild(filtered_doc_list); 181 175 182 176 Element mr_metadata_response = (Element) this.mr.process(mr_metadata_message); 183 184 path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 185 Element query_result_document_list = (Element) GSXML.getNodeByPath(mr_metadata_response, path); 186 177 // check for errors 178 processErrorElements(mr_metadata_response, page_response); 179 180 Element metadata_response = (Element) GSXML.getChildByTagName(mr_metadata_response, GSXML.RESPONSE_ELEM); 181 182 Element query_result_document_list = (Element) GSXML.getChildByTagName(metadata_response, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 183 187 184 if (query_result_document_list != null) { 188 185 page_response.appendChild(this.doc.importNode(query_result_document_list, true)); 189 186 } 190 191 System.out.println("Query page:\n" + this.converter.getPrettyString(page_response));187 188 ///ystem.out.println("Query page:\n" + this.converter.getPrettyString(page_response)); 192 189 return page_response; 193 190 } 194 191 195 192 /** this filters out some of the doc results for result paging */ 196 protected Element filterDocList(HashMap params, Element service_description, Element orig_doc_list) { 197 198 // check in the service descripiton to see if hitsPerpage is a param 199 Element service_p_list = (Element)GSXML.getChildByTagName(service_description, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 200 Element hits_param = GSXML.getNamedElement(service_p_list, GSXML.PARAM_ELEM, GSXML.NAME_ATT, "hitsPerPage"); 201 202 boolean service_paging = false; 203 if (hits_param != null) { 204 service_paging = true; 205 } 206 if (service_paging) { 207 // the service is doing the paging, so we want to display all of teh returned docs 193 protected Element filterDocList(HashMap params, HashMap service_params, Element orig_doc_list) { 194 195 // check the hits_per_page param - is it a service param?? 196 String hits_pp = (String) service_params.get("hitsPerPage"); 197 if (hits_pp != null) { 198 // the service is doing the paging, so we want to display all of the returned docs 208 199 return (Element)this.doc.importNode(orig_doc_list, true); 209 200 } 210 201 211 Stringhits_pp = (String)params.get("hitsPerPage");202 hits_pp = (String)params.get("hitsPerPage"); 212 203 int hits = 20; 213 204 if (hits_pp != null && !hits_pp.equals("")) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/Collection.java
r5403 r9874 101 101 } 102 102 // get the xml for both files 103 Element coll_config_elem = this.converter.getDOM(coll_config_file, CONFIG_ENCODING).getDocumentElement(); 103 Document coll_config_doc = this.converter.getDOM(coll_config_file, CONFIG_ENCODING); 104 Element coll_config_elem = null; 105 if (coll_config_doc != null) { 106 coll_config_elem = coll_config_doc.getDocumentElement(); 107 } 104 108 return coll_config_elem; 105 109 … … 116 120 return null; 117 121 } 118 Element build_config_elem = this.converter.getDOM(build_config_file, CONFIG_ENCODING).getDocumentElement(); 119 122 Document build_config_doc = this.converter.getDOM(build_config_file, CONFIG_ENCODING); 123 Element build_config_elem = null; 124 if (build_config_doc != null) { 125 build_config_elem = build_config_doc.getDocumentElement(); 126 } 120 127 return build_config_elem; 121 128 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java
r9433 r9874 34 34 import java.io.File; 35 35 import java.util.HashMap; 36 import java.util.Iterator; 36 37 37 38 /* ServiceCluster - a groups of services that are related in some way … … 91 92 } 92 93 94 public void cleanUp() { 95 Iterator i = this.service_map.values().iterator(); 96 while (i.hasNext()) { 97 ServiceRack s = (ServiceRack)i.next(); 98 s.cleanUp(); 99 } 100 } 93 101 public void setClusterName(String name) { 94 102 this.cluster_name = name; … … 139 147 140 148 Document doc = this.converter.getDOM(config_file, CONFIG_ENCODING); 149 if (doc == null) { 150 System.err.println("ServiceCluster: couldn't parse config file "+config_file.getPath()); 151 return false; 152 } 141 153 142 154 // get the appropriate service cluster element … … 147 159 return this.configure(sc); 148 160 } 149 161 150 162 151 163 public boolean configure(Element service_cluster_info) { … … 159 171 } 160 172 } 161 173 162 174 // get the display info 163 175 Element display_list = (Element) GSXML.getChildByTagName(service_cluster_info, GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER); … … 528 540 } 529 541 530 Element site_config_elem = this.converter.getDOM(configFile).getDocumentElement(); 542 Document site_config_doc = this.converter.getDOM(configFile); 543 if (site_config_doc == null) { 544 System.err.println("ServiceCluster: could not read in site config file: "+configFile.getPath()); 545 return false; 546 } 547 548 Element site_config_elem = site_config_doc.getDocumentElement(); 531 549 Element cluster_config_elem = GSXML.getNamedElement((Element)GSXML.getChildByTagName(site_config_elem, GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER), GSXML.CLUSTER_ELEM, GSXML.NAME_ATT, this.cluster_name); 532 550 if (cluster_config_elem == null) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/comms/Communicator.java
r4035 r9874 48 48 converter_ = new XMLConverter(); 49 49 } 50 public void cleanUp() {} 50 51 51 52 public void setLocalSiteName(String name) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/comms/SOAPCommunicator.java
r4035 r9874 26 26 import java.net.MalformedURLException; 27 27 import java.util.Vector; 28 import org.apache.soap.SOAPException; 29 import org.apache.soap.Fault; 30 import org.apache.soap.Constants; 31 import org.apache.soap.rpc.Call; 32 import org.apache.soap.rpc.Parameter; 33 import org.apache.soap.rpc.Response; 28 // import org.apache.soap.SOAPException; 29 // import org.apache.soap.Fault; 30 // import org.apache.soap.Constants; 31 // import org.apache.soap.rpc.Call; 32 // import org.apache.soap.rpc.Parameter; 33 // import org.apache.soap.rpc.Response; 34 import org.apache.axis.client.Call; 35 import org.apache.axis.client.Service; 36 import org.apache.axis.message.SOAPBodyElement; 37 import javax.xml.namespace.QName; 34 38 35 39 import org.w3c.dom.Node; … … 57 61 public SOAPCommunicator() { 58 62 59 call_ = new Call(); 63 60 64 // Set Encoding Style to standard SOAP encoding 61 65 //call_.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); 62 66 // set Encoding Style to use literal XML 63 call_.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);67 //call_.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML); 64 68 } 65 69 66 70 public boolean configure(Element site_elem) { 67 71 72 68 73 String type = site_elem.getAttribute(GSXML.TYPE_ATT); 69 74 if (!type.equals(GSXML.COMM_TYPE_SOAP_JAVA)) { … … 81 86 return false; 82 87 } 83 call_.setTargetObjectURI(remote_site_name_); 84 call_.setMethodName("process"); 85 88 try { 89 Service service = new Service(); 90 call_ = (Call) service.createCall(); 91 92 //call_.setTargetObjectURI(remote_site_name_); 93 //call_.setMethodName("process"); 94 call_.setTargetEndpointAddress( new java.net.URL(remote_site_address_) ); 95 // call_.setOperationStyle(org.apache.axis.enum.Style.MESSAGE_STR); 96 //call_.setOperationUse(org.apache.axis.enum.Use.LITERAL_STR); 97 //call_.setOperationName(new QName("http://soapinterop.org/", "process")); 98 } catch (Exception e) { 99 System.err.println("SOAPCommunicator.configure() Error: Exception occurred "+e); 100 return false; 101 } 86 102 return true; 87 103 } 88 104 89 90 105 public Element process(Element message) { 91 106 92 107 NodeList requests = message.getElementsByTagName(GSXML.REQUEST_ELEM); 93 108 if (requests.getLength()==0) { … … 95 110 return null; 96 111 } 97 112 98 113 // if the communicator is part of a site, it needs to edit the to and from fields, otherwise it just passes the message on, as is 99 114 // for now, use local_site_name_ as the flag. … … 110 125 } 111 126 } 127 // else do nothing to the requests, just pass it on 128 129 // the soap impl needs a namespace for the top level element 130 Element message_to_send = message; 131 if (message.getNamespaceURI() == null) { 132 message_to_send = GSXML.duplicateWithNewNameNS(message.getOwnerDocument(), message, "gs3:"+message.getTagName(), "urn:foo", true); 133 //System.err.println("**"+new XMLConverter().getPrettyString(new_message)); 134 } 135 136 // do the soap query 137 Element result = null; 138 try { 139 SOAPBodyElement[] input = new SOAPBodyElement[1]; 140 input[0] = new SOAPBodyElement(message_to_send); 141 Vector output = (Vector) call_.invoke( input ); 142 SOAPBodyElement elem = (SOAPBodyElement) output.get(0); 143 result = elem.getAsDOM(); 144 } catch (Exception e) { 145 e.printStackTrace(); 146 return null; 147 } 148 149 if (local_site_name_ != null) {// have to modify the from field 150 151 NodeList responses = result.getElementsByTagName(GSXML.RESPONSE_ELEM); 152 for (int i=0;i<responses.getLength(); i++) { 153 Element e = (Element)responses.item(i); 154 String from = e.getAttribute(GSXML.FROM_ATT); 155 from = GSPath.prependLink(from, remote_site_name_); 156 e.setAttribute(GSXML.FROM_ATT, from); 157 } 158 } // else return as is 159 160 return result; 161 } 162 163 public static void main (String [] args) { 164 SOAPCommunicator comm = new SOAPCommunicator(); 165 XMLConverter converter = new XMLConverter(); 166 String message = "<site name=\"localsite\" address=\"http://kanuka.cs.waikato.ac.nz:7070/axis/services/localsite\" type=\"soap\"/>"; 167 Element site_elem = converter.getDOM(message).getDocumentElement(); 168 comm.configure(site_elem); 169 message = "<message><request type=\"describe\" to=\"\" lang=\"en\"/></message>"; 170 //message = "<message><request type=\"describe\" to=\"\" lang=\"en\"/></message>"; 171 Element request_elem = converter.getDOM(message).getDocumentElement(); 172 Element response = comm.process(request_elem); 173 174 System.err.println("response was "+converter.getPrettyString(response)); 175 } 176 /* 177 public Element process(Element message) { 178 179 NodeList requests = message.getElementsByTagName(GSXML.REQUEST_ELEM); 180 if (requests.getLength()==0) { 181 // no requests 182 return null; 183 } 184 185 // if the communicator is part of a site, it needs to edit the to and from fields, otherwise it just passes the message on, as is 186 // for now, use local_site_name_ as the flag. 187 if (local_site_name_!=null) { // no local site 188 189 for (int i=0;i<requests.getLength(); i++) { 190 Element e = (Element)requests.item(i); 191 String to = e.getAttribute(GSXML.TO_ATT); 192 to = GSPath.removeFirstLink(to); // remove the server name, should check that it is present 193 e.setAttribute(GSXML.TO_ATT, to); 194 String from = e.getAttribute(GSXML.FROM_ATT); 195 from = GSPath.appendLink(from, local_site_name_); 196 e.setAttribute(GSXML.FROM_ATT, from); 197 } 198 } 112 199 // else do nothing to the message, just pass it on 113 200 … … 116 203 117 204 // Set Method Parameters - use literal xml 118 Parameter param = new Parameter("xml_in",119 org.w3c.dom.Element.class,120 message,121 Constants.NS_URI_LITERAL_XML);205 // Parameter param = new Parameter("xml_in", 206 // org.w3c.dom.Element.class, 207 // message, 208 // Constants.NS_URI_LITERAL_XML); 122 209 123 Vector param_list = new Vector ();124 param_list.addElement (param);125 call_.setParams (param_list);126 127 // Set the URL for the Web Service128 URL url = new URL(remote_site_address_);210 // Vector param_list = new Vector (); 211 // param_list.addElement (param); 212 // call_.setParams (param_list); 213 214 // // Set the URL for the Web Service 215 // URL url = new URL(remote_site_address_); 129 216 130 217 // Invoke the Service … … 167 254 } 168 255 } 169 256 */ 170 257 } 171 258 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/DefaultReceptionist.java
r7825 r9874 24 24 25 25 Element page_request = (Element)GSXML.getChildByTagName(page, GSXML.PAGE_REQUEST_ELEM); 26 // if it is a system request, then we don't bother with this. 27 String action = page_request.getAttribute(GSXML.ACTION_ATT); 28 if (action.equals("s")) { 29 System.err.println("HACK: don't ask for coll info if system action"); 30 return; 31 } 26 32 ///ystem.out.println("add extra info, page request="+this.converter.getString(page_request)); 27 33 // is a collection defined? … … 60 66 Element coll_about_response_message = this.mr.process(coll_about_message); 61 67 Element coll_about_response = (Element)GSXML.getChildByTagName(coll_about_response_message, GSXML.RESPONSE_ELEM); 68 if (coll_about_response == null) { 69 return; 70 } 62 71 coll_description = (Element)GSXML.getChildByTagName(coll_about_response, GSXML.COLLECTION_ELEM); 63 72 if (coll_description==null) { // may be a cluster -
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/MessageRouter.java
r9276 r9874 98 98 this.converter = new XMLConverter(); 99 99 this.doc = this.converter.newDOM(); 100 101 102 } 103 100 } 101 102 public void cleanUp() { 103 if (this.module_map != null) { 104 Iterator i = this.module_map.values().iterator(); 105 while (i.hasNext()) { 106 ((ModuleInterface)i.next()).cleanUp(); 107 } 108 } 109 } 104 110 /** site_home must be set before configure called */ 105 111 public void setSiteHome(String home) { … … 133 139 this.module_map = new HashMap(); 134 140 135 Element config = this.converter.getDOM(configFile).getDocumentElement(); 136 137 Element local_site_name = (Element)GSXML.getChildByTagName(config, GSXML.SITE_NAME_ELEM); 141 Document config_doc = this.converter.getDOM(configFile); 142 if (config_doc == null) { 143 System.err.println("MessageRouter: couldn't parse site config file: "+configFile.getPath()); 144 return false; 145 } 146 Element config_elem = config_doc.getDocumentElement(); 147 148 Element local_site_name = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_NAME_ELEM); 138 149 if (local_site_name == null) { 139 150 System.err.println("MessageRouter configure error:no site name in config file"); … … 143 154 } 144 155 145 Element http_address = (Element)GSXML.getChildByTagName(config , GSXML.SITE_HTTP_ADDRESS_ELEM);156 Element http_address = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_HTTP_ADDRESS_ELEM); 146 157 if (http_address == null) { 147 158 System.err.println("MessageRouter configure error: no http address in config file"); … … 151 162 } 152 163 153 Element proxy = (Element)GSXML.getChildByTagName(config , "proxy");164 Element proxy = (Element)GSXML.getChildByTagName(config_elem, "proxy"); 154 165 if (proxy != null) { 155 166 String host = proxy.getAttribute("host"); … … 180 191 181 192 // load up the services 182 Element service_rack_list = (Element)GSXML.getChildByTagName(config , GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER);193 Element service_rack_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.SERVICE_CLASS_ELEM+GSXML.LIST_MODIFIER); 183 194 configureServices(service_rack_list); 184 195 185 196 // load up the service clusters 186 Element cluster_list = (Element)GSXML.getChildByTagName(config , GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER);197 Element cluster_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.CLUSTER_ELEM+GSXML.LIST_MODIFIER); 187 198 configureClusters(cluster_list); 188 199 … … 191 202 192 203 // load up the external sites - this also adds their services/clusters/collections to the other lists - so must be done last 193 Element site_list = (Element)GSXML.getChildByTagName(config , GSXML.SITE_ELEM+GSXML.LIST_MODIFIER);204 Element site_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_ELEM+GSXML.LIST_MODIFIER); 194 205 configureSites(site_list); 195 206 … … 603 614 continue; 604 615 } 605 site_config_elem = this.converter.getDOM(configFile).getDocumentElement(); 616 Document site_config_doc = this.converter.getDOM(configFile); 617 if (site_config_doc == null) { 618 System.err.println("MessageRouter: couldn't parse site config file: "+configFile.getPath()); 619 continue; 620 } 621 site_config_elem = site_config_doc.getDocumentElement(); 606 622 } 607 623 if (subset.equals(GSXML.SERVICE_ELEM+GSXML.LIST_MODIFIER)) { … … 684 700 File init_file = new File(GSFile.collectionInitFile(this.site_home, col_name)); 685 701 if (init_file.exists()) { 686 Element init_elem = this.converter.getDOM(init_file).getDocumentElement(); 687 String coll_class_name = init_elem.getAttribute("class"); 688 if (coll_class_name.equals("")) { 689 c = new Collection(); 690 } else { 691 try { 692 c = (Collection)Class.forName("org.greenstone.gsdl3.collection."+coll_class_name).newInstance(); 693 } catch (Exception e) { 694 System.out.println("MessageRouter: couldn't create a new collection, type "+coll_class_name+", defaulting to class Collection"); 695 c = new Collection(); 696 } 697 } 698 } else { 699 // use the defualt collection 702 Document init_doc = this.converter.getDOM(init_file); 703 if (init_doc != null) { 704 Element init_elem = init_doc.getDocumentElement(); 705 if (init_elem != null) { 706 String coll_class_name = init_elem.getAttribute("class"); 707 if (!coll_class_name.equals("")) { 708 try { 709 c = (Collection)Class.forName("org.greenstone.gsdl3.collection."+coll_class_name).newInstance(); 710 } catch (Exception e) { 711 System.out.println("MessageRouter: couldn't create a new collection, type "+coll_class_name+", defaulting to class Collection"); 712 } 713 } 714 } 715 } 716 } 717 if (c==null) { // we haven't found anpther classname to use 700 718 c = new Collection(); 701 719 } 720 702 721 c.setCollectionName(col_name); 703 722 c.setSiteHome(this.site_home); … … 720 739 721 740 } 722 741 723 742 protected boolean activateSite(String site_name) { 724 743 System.out.println("MessageRouter:Activating site: "+site_name+"."); … … 732 751 return false; 733 752 } 734 Element config = this.converter.getDOM(configFile).getDocumentElement(); 735 736 Element site_list = (Element)GSXML.getChildByTagName(config, GSXML.SITE_ELEM+GSXML.LIST_MODIFIER); 753 Document config_doc = this.converter.getDOM(configFile); 754 if (config_doc == null) { 755 System.err.println("MessageRouter: couldn't parse site config file: "+configFile.getPath()); 756 return false; 757 } 758 Element config_elem = config_doc.getDocumentElement(); 759 760 Element site_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.SITE_ELEM+GSXML.LIST_MODIFIER); 737 761 if (site_list ==null ) { 738 762 System.err.println("MessageRouter:activateSite, no sites found"); … … 789 813 790 814 System.out.println("MessageRouter: deactivating "+name); 791 this.module_map.remove(name);792 815 ModuleInterface m = (ModuleInterface)this.module_map.remove(name); 816 m.cleanUp(); // clean up any open files/connections etc - can cause trouble on windows 793 817 // also remove the xml bit from description list 794 818 if (type.equals(GSXML.COLLECTION_ELEM)) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/ModuleInterface.java
r3502 r9874 52 52 */ 53 53 abstract public Element process(Element xml_in); 54 55 /** 56 * Do any clean up necessary for deactivating the module, eg 57 * close any open file handles (gdbm in particular) or windows 58 * holds locks on them. 59 */ 60 abstract public void cleanUp(); 54 61 } 55 62 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/Receptionist.java
r8921 r9874 50 50 } 51 51 52 public void cleanUp() {} 52 53 public void setParams(GSParams params) { 53 54 this.params = params; … … 81 82 } 82 83 83 Element config_doc = this.converter.getDOM(interface_config_file).getDocumentElement(); 84 String base_interface = config_doc.getAttribute("baseInterface"); 84 Document config_doc = this.converter.getDOM(interface_config_file); 85 if (config_doc == null) { 86 System.err.println("Receptionist: could not parse interface config file: "+interface_config_file.getPath()); 87 return false; 88 } 89 Element config_elem = config_doc.getDocumentElement(); 90 String base_interface = config_elem.getAttribute("baseInterface"); 85 91 setUpBaseInterface(base_interface); 86 setUpInterfaceOptions(config_ doc);92 setUpInterfaceOptions(config_elem); 87 93 88 94 // load up the actions 89 Element action_list = (Element)GSXML.getChildByTagName(config_ doc, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER);95 Element action_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER); 90 96 NodeList actions = action_list.getElementsByTagName(GSXML.ACTION_ELEM); 91 97 … … 109 115 } 110 116 111 this.language_list = (Element)GSXML.getChildByTagName(config_ doc, "languageList");117 this.language_list = (Element)GSXML.getChildByTagName(config_elem, "languageList"); 112 118 if (language_list == null) { 113 119 System.err.println("Receptionist: didn't find a language list in the config file!!"); … … 229 235 base_interfaces.add(base_interface); 230 236 // now see if this has a base interface 231 Element config_doc = this.converter.getDOM(base_interface_config_file).getDocumentElement(); 232 base_interface = config_doc.getAttribute("baseInterface"); 237 Document config_doc = this.converter.getDOM(base_interface_config_file); 238 if (config_doc == null) { 239 System.err.println("Receptionist: could not parse base interface config file: "+base_interface_config_file.getPath()); 240 return false; 241 } 242 Element config_elem = config_doc.getDocumentElement(); 243 base_interface = config_elem.getAttribute("baseInterface"); 233 244 } 234 245 return true; 235 246 } 236 247 237 protected boolean setUpInterfaceOptions(Element config_ doc) {238 Element option_list = (Element)GSXML.getChildByTagName(config_ doc, "optionList");248 protected boolean setUpInterfaceOptions(Element config_elem) { 249 Element option_list = (Element)GSXML.getChildByTagName(config_elem, "optionList"); 239 250 if (option_list != null) { 240 251 System.err.println("found an option list"); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
r9405 r9874 52 52 return false; 53 53 } 54 55 Element config_doc = this.converter.getDOM(interface_config_file, "utf-8").getDocumentElement(); 56 String base_interface = config_doc.getAttribute("baseInterface"); 54 Document config_doc = this.converter.getDOM(interface_config_file, "utf-8"); 55 if (config_doc == null) { 56 System.err.println("TransformingReceptionist: could not parse interface config file: "+interface_config_file.getPath()); 57 return false; 58 } 59 Element config_elem = config_doc.getDocumentElement(); 60 String base_interface = config_elem.getAttribute("baseInterface"); 57 61 setUpBaseInterface(base_interface); 58 setUpInterfaceOptions(config_ doc);59 60 Element action_list = (Element)GSXML.getChildByTagName(config_ doc, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER);62 setUpInterfaceOptions(config_elem); 63 64 Element action_list = (Element)GSXML.getChildByTagName(config_elem, GSXML.ACTION_ELEM+GSXML.LIST_MODIFIER); 61 65 NodeList actions = action_list.getElementsByTagName(GSXML.ACTION_ELEM); 62 66 … … 97 101 98 102 } 99 Element lang_list = (Element)GSXML.getChildByTagName(config_ doc, "languageList");103 Element lang_list = (Element)GSXML.getChildByTagName(config_elem, "languageList"); 100 104 if (lang_list == null) { 101 105 System.err.println("TransformingReceptionist: didn't find a language list in the config file!!"); … … 157 161 } 158 162 Document style_doc = this.converter.getDOM(new File(xslt_file), "UTF-8"); 163 if (style_doc == null) { 164 System.err.println("TransformingReceptionist: cant parse the xslt file needed, so returning the original page!"); 165 return page; 166 167 } 159 168 160 169 // look for the format element in the page response … … 166 175 // need to transform the format info 167 176 String stylesheet_file = GSFile.stylesheetFile((String)this.config_params.get(GSConstants.GSDL3_HOME), (String)this.config_params.get(GSConstants.SITE_NAME), collection, (String)this.config_params.get(GSConstants.INTERFACE_NAME), base_interfaces, "config_format.xsl"); 168 Document stylesheet = this.converter.getDOM(new File(stylesheet_file)); 169 Document format_doc = this.converter.newDOM(); 170 format_doc.appendChild(format_doc.importNode(format_elem, true)); 171 Element new_format = (Element)this.transformer.transform(stylesheet, format_doc); 177 Document stylesheet_doc = this.converter.getDOM(new File(stylesheet_file)); 178 if (stylesheet_doc != null) { 179 Document format_doc = this.converter.newDOM(); 180 format_doc.appendChild(format_doc.importNode(format_elem, true)); 181 Element new_format = (Element)this.transformer.transform(stylesheet_doc, format_doc); 172 182 ///ystem.err.println("new format elem="+this.converter.getPrettyString(new_format)); 173 183 174 184 // add it in to the main stylesheet 175 GSXSLT.mergeStylesheets(style_doc, new_format); 185 GSXSLT.mergeStylesheets(style_doc, new_format); 186 } else { 187 System.err.println("TransformingReceptionist: couldn't parse the config_format stylesheet, adding the format info as is"); 188 GSXSLT.mergeStylesheets(style_doc, format_elem); 189 } 176 190 ///ystem.out.println("the converted stylesheet is:"); 177 191 ///ystem.out.println(this.converter.getPrettyString(style_doc.getDocumentElement())); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/CollectionManager.java
r8969 r9874 216 216 GS3SQLSelect select = new GS3SQLSelect("build"); 217 217 select.addField("*"); 218 this.database.execute(select.toString()); 219 ResultSet results = this.database.getResultSet(); 220 if (results != null && 221 results.first()) { 218 Statement statement = this.database.createStatement(); 219 ResultSet results = statement.executeQuery(select.toString()); 220 if (results.first()) { 222 221 System.out.println("Reading all keys"); 223 222 do { … … 238 237 } while (results.next()); 239 238 } 239 statement.close(); 240 240 } 241 241 catch (SQLException ex) … … 479 479 480 480 // Update build date information 481 GS3SQLDelete remove = new GS3SQLDelete("build"); 482 // GS3SQLWhere where = new GS3SQLWhere(new GS3SQLWhereItem("buildKey", "=", "NextSeqNo")); 483 // rem 484 this.database.execute(remove.toString()); 485 486 GS3SQLInsert insert = new GS3SQLInsert("build"); 487 insert.addValue("buildKey", "NextSeqNo"); 488 insert.addValue("buildValue", Integer.toString(this.buildDocNo)); 489 this.database.execute(insert.toString()); 490 491 insert = new GS3SQLInsert("build"); 492 insert.addValue("buildKey", "lastBuildDate"); 493 insert.addValue("buildValue", getDateString(this.lastBuildDate)); 494 this.database.execute(insert.toString()); 495 481 try { 482 GS3SQLDelete remove = new GS3SQLDelete("build"); 483 // GS3SQLWhere where = new GS3SQLWhere(new GS3SQLWhereItem("buildKey", "=", "NextSeqNo")); 484 // rem 485 Statement statement = this.database.createStatement(); 486 statement.execute(remove.toString()); 487 488 GS3SQLInsert insert = new GS3SQLInsert("build"); 489 insert.addValue("buildKey", "NextSeqNo"); 490 insert.addValue("buildValue", Integer.toString(this.buildDocNo)); 491 statement.execute(insert.toString()); 492 493 insert = new GS3SQLInsert("build"); 494 insert.addValue("buildKey", "lastBuildDate"); 495 insert.addValue("buildValue", getDateString(this.lastBuildDate)); 496 statement.execute(insert.toString()); 497 statement.close(); 498 } catch (SQLException e) { 499 System.err.println("CollectionManager.endBuild(): Can't update build information: "+e); 500 } 501 496 502 // Do tail of build output 497 503 Date startDate = this.lastBuildDate.getTime(); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/Create.java
r8497 r9874 48 48 49 49 System.err.println("New collection created in "+coll_home); 50 System.err.println("Put source documents into import, set the collection's configuration in etc/collectionConfig.xml, then run gs3-build.sh to build the collection");50 System.err.println("Put source documents into import, set the collection's configuration in etc/collectionConfig.xml, then run gs3-build.sh (linux) or gs3-build (windows) to build the collection"); 51 51 } 52 52 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/AZListClassifier.java
r8742 r9874 9 9 import java.sql.ResultSet; 10 10 import java.sql.SQLException; 11 import java.sql.Statement; 11 12 12 13 import org.xml.sax.XMLReader; … … 189 190 select.setWhere(where); 190 191 191 connection.execute(select.toString());192 192 193 193 try { 194 ResultSet results = connection.getResultSet(); 195 if (results != null && results.first()) { 194 Statement statement = connection.createStatement(); 195 ResultSet results = statement.executeQuery(select.toString()); 196 if (results.first()) { 196 197 GS3SQLUpdate update = new GS3SQLUpdate("classifiers"); 197 198 update.setWhere(where); … … 206 207 207 208 action = insert; 209 classifyRef = -1; 208 210 } 209 211 action.addValue("ClassifyID", label); … … 213 215 action.addValue("NumLeafDocs", Integer.toString(noOfLeafDocs), GS3SQLField.INTEGER_TYPE); 214 216 215 connection.execute(action.toString()); 216 classifyRef = -1; 217 } 218 catch (SQLException sqlEx) { 219 System.err.println(sqlEx); 220 return -1; 221 } 222 223 // get the ClassifyRef if we don't already have it (have done a 224 // insert action above)... 225 if (classifyRef == -1) { 226 connection.execute(select.toString()); 227 228 try { 229 ResultSet results = connection.getResultSet(); 230 if (results == null || !results.first()) { 217 // do the update/insert 218 statement.execute(action.toString()); 219 220 221 // get the ClassifyRef if we don't already have it (have done a 222 // insert action above)... 223 if (classifyRef == -1) { 224 results = statement.executeQuery(select.toString()); 225 if (!results.first()) { 231 226 return -1; 232 227 } … … 234 229 classifyRef = results.getInt("ClassifyRef"); 235 230 } 236 catch (SQLException sqlEx) { 237 System.err.println(sqlEx); 231 232 statement.close(); 233 } catch (SQLException sqlEx) { 234 System.err.println("AZListClassifier.writeSQLClassifyNode(): "+sqlEx); 238 235 return -1; 239 240 }236 } 237 241 238 242 239 return classifyRef; … … 274 271 } 275 272 273 try { 274 Statement statement = connection.createStatement(); 275 276 276 List children; 277 277 … … 292 292 Iterator iterator = childDocs.iterator(); 293 293 int childOrder = 1; 294 //St 294 295 while (iterator.hasNext()) { 295 296 AZDocumentItem documentItem = (AZDocumentItem) iterator.next(); … … 301 302 insert.addValue("DocOrder", Integer.toString(childOrder), GS3SQLField.INTEGER_TYPE); 302 303 303 connection.execute(insert.toString());304 statement.execute(insert.toString()); 304 305 305 306 childOrder ++; … … 310 311 } 311 312 313 312 314 /* 313 315 else { … … 318 320 delete.setWhere(where); 319 321 320 connection.execute(delete.toString());322 statement.execute(delete.toString()); 321 323 } 322 324 … … 331 333 } 332 334 */ 335 statement.close(); 336 } catch (SQLException e) { 337 System.err.println("AZListClassifier.writeSQL(): "+e); 338 return false; 339 } 333 340 334 341 return true; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/AbstractHierarchyNode.java
r8742 r9874 7 7 import java.sql.ResultSet; 8 8 import java.sql.SQLException; 9 import java.sql.Statement; 9 10 10 11 import org.greenstone.gsdl3.gs3build.doctypes.DocumentID; … … 273 274 GS3SQLInsert insert; 274 275 276 Statement statement; 277 // can we connect to the database? 278 try { 279 statement = connection.createStatement(); 280 } catch (SQLException e) { 281 System.err.println("AbstractHierarchyNode.writeSQL(): "+e); 282 return false; 283 } 284 275 285 // Get own full id 276 286 String fullId = this.id.length() > 0 ? this.prefix+"."+this.id : this.prefix; … … 283 293 select.setWhere(where); 284 294 285 connection.execute(select.toString());286 295 287 296 // update or insert the classifier as required 288 297 try { 289 ResultSet results = connection.getResultSet();290 if (results != null && results.first()) {298 ResultSet results = statement.executeQuery(select.toString()); 299 if (results.first()) { 291 300 GS3SQLUpdate update = new GS3SQLUpdate("classifiers"); 292 301 update.setWhere(where); … … 313 322 314 323 action = insert; 324 classifyRef = -1; 315 325 } 316 326 action.addValue("ClassifyID", fullId); … … 331 341 action.addValue("NumLeafDocs", Integer.toString(this.noOfLeafDocs()), GS3SQLField.INTEGER_TYPE); 332 342 333 connection.execute(action.toString()); 334 classifyRef = -1; 343 statement.execute(action.toString()); 335 344 } 336 345 catch (SQLException sqlEx) { 337 346 if (action == null) { 338 System.err.println( sqlEx);347 System.err.println("AbstractHierarchyNode.writeSQL(): "+sqlEx); 339 348 } 340 349 else { 341 System.err.println( sqlEx + " " + action.toString());350 System.err.println("AbstractHierarchyNode.writeSQL(): "+sqlEx + " " + action.toString()); 342 351 } 343 352 return false; … … 347 356 // insert action above)... 348 357 if (classifyRef == -1) { 349 connection.execute(select.toString());350 351 358 try { 352 ResultSet results = connection.getResultSet(); 353 if (results == null || !results.first()) { 354 return false; 359 ResultSet results = statement.executeQuery(select.toString()); 360 if (!results.first()) { 361 statement.close(); 362 return false; 355 363 } 356 364 357 365 classifyRef = results.getInt("ClassifyRef"); 366 358 367 } 359 368 catch (SQLException sqlEx) { 360 System.err.println( sqlEx);369 System.err.println("AbstractHierarchyNode.writeSQL(): "+sqlEx); 361 370 return false; 362 371 } … … 368 377 GS3SQLDelete delete = new GS3SQLDelete("classdocuments"); 369 378 delete.setWhere(where); 370 371 connection.execute(delete.toString()); 372 } 373 379 try { 380 statement.execute(delete.toString()); 381 } catch (SQLException e) { 382 System.err.println("AbstractHierarchyNode.writeSQL(): "+e); 383 return false; 384 } 385 } 386 374 387 // post the child nodes... 375 388 Iterator iterator = this.childNodes.iterator(); … … 379 392 if (!childNode.writeSQL(connection)) { 380 393 System.out.println("Failed to write " ); 381 return false;394 return false; 382 395 } 383 396 } … … 394 407 insert.addValue("DocID", docId.toString()); 395 408 insert.addValue("DocOrder", Integer.toString(order), GS3SQLField.INTEGER_TYPE); 396 397 connection.execute(insert.toString()); 398 409 try { 410 statement.execute(insert.toString()); 411 } catch (SQLException e) { 412 System.err.println("AbstractHierarchyNode.writeSQL(): "+e); 413 return false; 414 } 399 415 order ++; 400 416 } 417 // close the statment 418 try { 419 statement.close(); 420 } catch (SQLException e) { 421 System.err.println("AbstractHierarchyNode.writeSQL(): "+e); 422 } 423 401 424 return true; 402 425 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/database/GS3SQLConnection.java
r8773 r9874 14 14 { 15 15 16 public GS3SQLConnection(java.sql.Connection connection )16 public GS3SQLConnection(java.sql.Connection connection, String database) 17 17 { 18 super(connection );18 super(connection, database); 19 19 } 20 20 … … 25 25 } 26 26 27 27 public GS3SQLConnection cloneConnection() { 28 GS3SQLConnection conn = GS3SQLConnectionFactory.getGS3SQLConnection(this.database); 29 return conn; 30 } 28 31 /** 29 32 * Initialise a collection for use. … … 62 65 63 66 try { 64 statement = this.connection.createStatement();67 Statement statement = this.connection.createStatement(); 65 68 66 69 // create build history table … … 224 227 statement.execute(classData.toString()); 225 228 229 statement.close(); 226 230 // 227 231 // END OF GSDL TABLES -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/database/GS3SQLConnectionFactory.java
r8745 r9874 32 32 return null; 33 33 } 34 return new SQLConnection(c );34 return new SQLConnection(c, database); 35 35 } 36 36 … … 42 42 return null; 43 43 } 44 return new GS3SQLConnection(c );44 return new GS3SQLConnection(c, database); 45 45 } 46 46 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/database/SQLConnection.java
r8745 r9874 10 10 { 11 11 protected Connection connection; 12 protected Statement statement; 13 14 15 public SQLConnection(java.sql.Connection connection) 12 protected String database; 13 14 public SQLConnection(java.sql.Connection connection, String database) 16 15 { 17 16 this.connection = connection; 17 this.database = database; 18 18 } 19 19 … … 21 21 if (this.connection!=null) { 22 22 try { 23 this.connection.close(); 23 this.connection.close(); 24 24 } catch (Exception e) {} 25 26 this.connection = null; 27 } 25 } 26 this.connection = null; 28 27 } 29 28 30 public boolean execute(String sql) 31 { 32 try { 33 this.statement = this.connection.createStatement(); 34 this.statement.execute(sql); 35 } 36 catch (SQLException ex) { 37 System.out.println(ex); 38 return false; 39 } 40 return true; 29 public void close() { 30 finalize(); 41 31 } 42 32 43 public Statement createStatement() 33 public Statement createStatement() throws SQLException 44 34 { 45 try { 46 return this.connection.createStatement(); 47 } 48 catch (SQLException ex) { 49 return null; 50 } 51 } 52 53 public Statement getStatement() 54 { 55 return this.statement; 56 } 57 58 public ResultSet getResultSet() 59 { 60 try { 61 return this.statement.getResultSet(); 62 } 63 catch (SQLException ex) { 64 return null; 65 } 35 return this.connection.createStatement(); 66 36 } 67 37 68 38 public boolean connectToDatabase(String database) { 39 if (this.connection != null) { 40 try { 41 this.connection.close(); 42 } catch (Exception e) {} 43 } 69 44 this.connection = GS3SQLConnectionFactory.getConnection(database); 70 45 if (this.connection == null) { 71 46 return false; 72 47 } 48 this.database = database; 73 49 return true; 74 50 } … … 76 52 public boolean dropDatabase(String database) { 77 53 try { 78 this.statement = this.connection.createStatement(); 79 this.statement.execute("DROP DATABASE "+database+";"); 54 Statement statement = this.connection.createStatement(); 55 statement.execute("DROP DATABASE "+database+";"); 56 statement.close(); 80 57 } 81 58 catch (SQLException ex){ … … 90 67 try { 91 68 String command = "CREATE DATABASE " + database; 92 this.statement = this.connection.createStatement(); 93 this.statement.execute(command); 69 Statement statement = this.connection.createStatement(); 70 statement.execute(command); 71 statement.close(); 94 72 } catch (Exception e) { 95 73 System.err.println(e); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/AbstractDocument.java
r8742 r9874 9 9 10 10 import java.sql.SQLException; 11 import java.sql.Statement; 11 12 import java.sql.ResultSet; 12 13 import java.sql.Timestamp; … … 190 191 // Query for documents using the same file... 191 192 String query = "SELECT DocID FROM files INNER JOIN filegroups ON files.FileGroupRef=filegroups.FileGroupRef WHERE (filegroups.FileGroupId=\"default\" AND files.FileLocation=\"" + this.fileSet.getFile(0).getLocation().toString() + "\")"; 192 connection.execute(query);193 194 List docs = new ArrayList();195 ResultSet results = connection.getResultSet();196 197 193 try { 198 if (results != null && 199 results.first()) 200 { do { 201 String value = results.getString("DocID"); 202 203 docs.add(value); 204 } while (results.next()); 205 206 Iterator docIterator = docs.iterator(); 207 while (docIterator.hasNext()) { 208 String docId = docIterator.next().toString(); 209 String innerQuery = "SELECT * FROM document WHERE DocID=\"" + docId + "\""; 210 connection.execute(innerQuery); 211 ResultSet innerSet = connection.getResultSet(); 212 if (innerSet != null && innerSet.first()) { 213 String docType = innerSet.getString("DocType"); 214 if (docType.equals(this.getDocumentType())) { 215 return docId; 194 Statement statement = connection.createStatement(); 195 ResultSet results = statement.executeQuery(query); 196 197 List docs = new ArrayList(); 198 199 if (results.first()) { 200 do { 201 String value = results.getString("DocID"); 202 docs.add(value); 203 } while (results.next()); 204 205 Iterator docIterator = docs.iterator(); 206 while (docIterator.hasNext()) { 207 String docId = docIterator.next().toString(); 208 String innerQuery = "SELECT * FROM document WHERE DocID=\"" + docId + "\""; 209 results = statement.executeQuery(innerQuery); 210 if (results.first()) { 211 String docType = results.getString("DocType"); 212 if (docType.equals(this.getDocumentType())) { 213 return docId; 214 } 215 } 216 216 } 217 }218 217 } 219 } 218 statement.close(); 220 219 } 221 220 catch (java.sql.SQLException sqlEx) { 222 System.err.println( sqlEx);221 System.err.println("AbstractDocument.getDuplicateID(): "+sqlEx); 223 222 } 224 223 … … 447 446 * Obtain a document from the SQL database 448 447 */ 449 public static AbstractDocument readSQL(GS3SQLConnection connection, ResultSet sqlResult)448 public static AbstractDocument readSQL(GS3SQLConnection connection, ResultSet sqlResult) 450 449 { try { 451 450 DocumentID id = new DocumentID(sqlResult.getString("DocID")); … … 454 453 // Use a factory method to create the correct subtype... 455 454 AbstractDocument document = DocumentFactory.createDocument(type, id); 456 457 455 // Append the document date information 458 456 document.indexDate = sqlResult.getTimestamp("IndexedDate"); … … 473 471 } 474 472 catch (SQLException sqlEx) { 475 System. out.println("Failure to load document: " + sqlEx);473 System.err.println("AbstractDocument.readSQL(): Failure to load document: " + sqlEx); 476 474 } 477 475 return null; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/DocumentFactory.java
r8742 r9874 2 2 3 3 import java.sql.SQLException; 4 import java.sql.Statement; 4 5 import java.sql.ResultSet; 5 6 import java.net.URL; … … 61 62 { 62 63 String query = "SELECT * FROM document WHERE DocID=\""+id.toString()+"\";"; 63 connection.execute(query);64 65 64 try { 66 ResultSet results = connection.getResultSet(); 67 if (results != null && results.first()) { 68 return AbstractDocument.readSQL(connection, results); 69 } 65 Statement statement = connection.createStatement(); 66 ResultSet results = statement.executeQuery(query); 67 68 DocumentInterface di = null; 69 if (results.first()) { 70 di = AbstractDocument.readSQL(connection, results); 71 } 72 statement.close(); 73 return di; 70 74 } 71 75 catch (SQLException sqlEx) { 72 System.err.println( sqlEx);76 System.err.println("AbstractDocument.readSQLDocument():"+sqlEx); 73 77 } 74 78 return null; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/DocumentList.java
r8861 r9874 13 13 14 14 import java.sql.SQLException; 15 import java.sql.Statement; 15 16 import java.sql.ResultSet; 16 17 … … 68 69 select.setWhere(where); 69 70 70 this.connection.execute(select.toString()); 71 72 ResultSet results = this.connection.getResultSet(); 73 if (results != null) { 74 select = new GS3SQLSelect("filegroups"); 75 select.addField("DocID"); 76 select.setDistinct(true); 77 78 where = new GS3SQLWhere(); 79 where.setCondition(GS3SQLWhere.OR_CONDITION); 80 81 GS3SQLWhereItem whereItem = null; 82 83 try { 84 results.first(); 71 try { 72 Statement statement = connection.createStatement(); 73 ResultSet results = statement.executeQuery(select.toString()); 74 75 select = new GS3SQLSelect("filegroups"); 76 select.addField("DocID"); 77 select.setDistinct(true); 78 79 where = new GS3SQLWhere(); 80 where.setCondition(GS3SQLWhere.OR_CONDITION); 81 82 GS3SQLWhereItem whereItem = null; 83 84 results.first(); 85 85 do { 86 86 int fileGroupRef = results.getInt("FileGroupRef"); … … 90 90 while (results.next()); 91 91 select.setWhere(where); 92 results.close(); 93 94 this.connection.execute(select.toString()); 95 96 results = this.connection.getResultSet(); 92 93 results = statement.executeQuery(select.toString()); 94 97 95 results.first(); 98 96 do { … … 100 98 reply.add(docId); 101 99 } while (results.next()); 102 } 103 catch (SQLException sqlEx) 104 { System.err.println(sqlEx); 105 } 106 } 100 statement.close(); 101 } 102 catch (SQLException sqlEx) { 103 System.err.println("DocumentList.getDocumentIdsWithFile(): "+sqlEx); 104 } 105 107 106 return reply; 108 107 } … … 173 172 } 174 173 175 private List findDocumentIdsUsingFileQuery(String query) 176 { this.connection.execute(query); 177 178 try { 179 180 ResultSet results = this.connection.getResultSet(); 181 if (results == null || 182 !results.first()) { 183 return null; 184 } 174 private List findDocumentIdsUsingFileQuery(String query) { 175 176 try { 177 178 Statement statement = connection.createStatement(); 179 ResultSet results = statement.executeQuery(query); 180 181 if (!results.first()) { 182 statement.close(); 183 return null; 184 } 185 185 186 186 // get a list of group ids first and turn it into a query on filegroups … … 207 207 // structures...recreating new filegroup queries as necessary 208 208 while (queryBuffer.length() > 0) { 209 connection.execute(queryBuffer.toString());210 211 results = this.connection.getResultSet();212 if (results == null || !results.first()) {213 return null;209 results = statement.executeQuery(queryBuffer.toString()); 210 211 if (!results.first()) { 212 statement.close(); 213 return null; 214 214 } 215 215 … … 256 256 257 257 // execute the division query 258 this.connection.execute(queryBuffer.toString()); 259 260 results = this.connection.getResultSet(); 261 if (results == null || 262 !results.first()) { 263 return null; 258 results = statement.executeQuery(queryBuffer.toString()); 259 260 if (!results.first()) { 261 statement.close(); 262 return null; 264 263 } 265 264 … … 268 267 reply.add(results.getString("DocID")); 269 268 } while (results.next()); 270 269 270 statement.close(); 271 271 return reply; 272 272 } 273 273 catch (SQLException ex) { 274 System.err.println( ex);274 System.err.println("DocumentList.findDocumentIdsUsingFileQuery()"+ ex); 275 275 } 276 276 return null; … … 454 454 select.addField("*"); 455 455 456 ResultSet documents;457 456 try { 458 connection.execute(select.toString());459 documents = connection.getResultSet();460 461 if (documents.first()) 462 { do 463 { DocumentInterface document = AbstractDocument.readSQL(connection, documents);464 list.addDocument(document); 465 }466 while (documents.next());467 } 468 } 469 catch (java.sql.SQLException ex) 470 { System.out.println(ex);471 457 Statement statement = connection.createStatement(); 458 ResultSet documents = statement.executeQuery(select.toString()); 459 if (documents.first()) { 460 do { 461 DocumentInterface document = AbstractDocument.readSQL(connection, documents); 462 list.addDocument(document); 463 } 464 while (documents.next()); 465 } 466 statement.close(); 467 } 468 catch (java.sql.SQLException ex) { 469 System.out.println("DocumentList.writeSQLDocuments(): "+ex); 470 return null; 472 471 } 473 472 … … 487 486 { 488 487 private boolean hasNext; 488 private Statement statement; 489 489 private ResultSet resultSet; 490 490 private GS3SQLConnection connection; … … 498 498 499 499 try { 500 connection.execute(select.toString());501 this.resultSet = connection.getResultSet();500 this.statement = connection.createStatement(); 501 this.resultSet = statement.executeQuery(select.toString()); 502 502 this.hasNext = this.resultSet.first(); 503 503 } catch (SQLException ex) { 504 System.err.println("DocumentListIterator(): "+ex); 504 505 this.hasNext = false; 505 506 } … … 520 521 521 522 if (!this.hasNext) { 522 this.resultSet.close(); // be a good citizen & close used result sets523 this.statement.close(); // be a good citizen & close used statement 523 524 } 524 525 } catch (SQLException ex) { 526 System.err.println("DocumentList.iterator.next(): "+ex); 525 527 this.hasNext = false; 526 528 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/DocumentSQLWriter.java
r8742 r9874 19 19 update.addDate("IndexedDate", new java.sql.Timestamp(touchTime)); 20 20 update.addDate("ModifiedDate", new java.sql.Timestamp(modTime)); 21 connection.execute(update.toString()); 21 try { 22 Statement statement = connection.createStatement(); 23 statement.execute(update.toString()); 24 statement.close(); 25 } catch (SQLException e) { 26 System.err.println("DocumentSQLWriter.touchDocument() Error: "+ e); 27 return false; 28 } 22 29 System.out.println(update.toString()); 23 30 return true; … … 39 46 select.addField("*"); 40 47 select.setWhere(new GS3SQLWhere(new GS3SQLWhereItem("DocID", "=", document.getID().toString()))); 41 connection.execute(select.toString());42 48 43 ResultSet results = connection.getResultSet(); 44 45 if (results == null || 46 !results.first()) 47 { GS3SQLInsert insert = new GS3SQLInsert("document"); 49 Statement statement = connection.createStatement(); 50 ResultSet results = statement.executeQuery(select.toString()); 51 if (!results.first()) { // empty result 52 GS3SQLInsert insert = new GS3SQLInsert("document"); 48 53 insert.addValue("DocID", document.getID().toString()); 49 54 insert.addValue("DocType", document.getDocumentType()); … … 53 58 insert.addDate("ModifiedDate", new java.sql.Timestamp(document.getModifiedDatestamp())); 54 59 55 connection.execute(insert.toString());60 statement.execute(insert.toString()); 56 61 } 57 62 else { … … 61 66 // connection.execute(update.toString()); 62 67 } 68 statement.close(); 63 69 } 64 } catch ( Exception ex) {65 System.out.println( ex);70 } catch (SQLException ex) { 71 System.out.println("DocumentSQLWriter.writeDocument() Error:"+ex); 66 72 } 67 73 // output.println(tag); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/doctypes/HTMLDocument.java
r8929 r9874 279 279 public Document getDOMDocument() 280 280 { 281 if (this.domDocument == null) {281 if (this.domDocument == null) { 282 282 URL url =(URL) this.fileSet.getFile(0).getLocation(); 283 283 this.loadDocument(url); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/indexers/MGPPIndexer.java
r9006 r9874 175 175 { 176 176 if (this.pass == 0) { 177 document.removeAllMetadata("gsdl3", "mg ppseqno");177 document.removeAllMetadata("gsdl3", "mgseqno"); 178 178 } 179 179 … … 188 188 String docText = null; 189 189 190 int startSeqNo = this.sectionSeqNo; 191 this.sectionSeqNo ++; 192 190 //int startSeqNo = this.sectionSeqNo; 191 //this.sectionSeqNo ++; 192 int startSeqNo = this.documentSeqNo; 193 193 194 Document domDocument = document.getDOMDocument(); 194 195 if (domDocument != null) { … … 288 289 289 290 if (this.pass == 0) { 290 document.addDocumentMetadata("gsdl3", "mg ppseqno", "dtx."+Integer.toString(startSeqNo));291 } 292 this.documentSeqNo += 1;291 document.addDocumentMetadata("gsdl3", "mgseqno", "dtx."+Integer.toString(startSeqNo)); 292 } 293 this.documentSeqNo++; 293 294 294 295 // try { … … 317 318 this.firstDocument = true; 318 319 this.documentSeqNo = 1; 319 320 this.sectionSeqNo = 1; 321 320 322 this.mgppPasses = new MGPPPassesWrapper(); 321 323 this.indexBuffer = new StringBuffer(); … … 430 432 System.out.println("Compressed dictionary successfully written"); 431 433 } else { 432 System.err.println("Error from mg_compression_dict: " + exit_value); 433 index.setError(true); 434 434 System.err.println("Error from mgpp_compression_dict: " + exit_value); 435 //index.setError(true); 435 436 return false; 436 437 } … … 444 445 } else { 445 446 System.err.println("Unable to build the perfect hash"); 446 index.setError(true);447 //index.setError(true); 447 448 return false; 448 449 } … … 456 457 } else { 457 458 System.err.println("Unable to create weights file"); 458 index.setError(true);459 //index.setError(true); 459 460 return false; 460 461 } … … 466 467 } else { 467 468 System.out.println("Unable to create inverted dictionary file"); 468 index.setError(true);469 //index.setError(true); 469 470 return false; 470 471 } … … 476 477 } else { 477 478 System.out.println("Unable to create stemmed index 1"); 478 index.setError(true);479 //index.setError(true); 479 480 return false; 480 481 } … … 485 486 } else { 486 487 System.out.println("Unable to create stemmed index 2"); 487 index.setError(true);488 //index.setError(true); 488 489 return false; 489 490 } … … 493 494 } else { 494 495 System.out.println("Unable to create stemmed index 3"); 495 index.setError(true);496 //index.setError(true); 496 497 return false; 497 498 } … … 553 554 Element default_index = doc.createElement("defaultIndex"); 554 555 default_index.setAttribute(GSXML.NAME_ATT, def_index); 556 555 557 Element base_index_name = doc.createElement("baseIndexPrefix"); 556 base_index_name.setAttribute(GSXML.NAME_ATT, "index"); //overallName); 558 base_index_name.setAttribute(GSXML.NAME_ATT, "dtx"); //overallName); 559 557 560 Element index_stem = doc.createElement("indexStem"); 558 561 index_stem.setAttribute(GSXML.NAME_ATT, "index"); … … 561 564 Element retrieve_service_elem = doc.createElement(GSXML.SERVICE_CLASS_ELEM); 562 565 Element default_level = doc.createElement("defaultLevel"); 563 default_index.setAttribute(GSXML.NAME_ATT, "Document"); 566 default_level.setAttribute(GSXML.NAME_ATT, "Document"); 567 568 Element level_list = doc.createElement("levelList"); 569 Element level = doc.createElement("level"); 570 level.setAttribute(GSXML.NAME_ATT, "Document"); 571 level_list.appendChild(level); 572 573 Element field_list = doc.createElement("fieldList"); 574 Element field = doc.createElement("field"); 575 field.setAttribute(GSXML.NAME_ATT, "ZZ"); 576 field_list.appendChild(field); 577 564 578 service_rack_list.appendChild(search_service_elem); 565 579 service_rack_list.appendChild(retrieve_service_elem); … … 568 582 search_service_elem.appendChild(index_list); 569 583 search_service_elem.appendChild(default_index); 584 search_service_elem.appendChild(level_list); 570 585 search_service_elem.appendChild(default_level); 586 search_service_elem.appendChild(field_list); // do we need this?? 571 587 search_service_elem.appendChild(base_index_name); 572 588 search_service_elem.appendChild(index_stem); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/metadata/METSDescriptive.java
r8742 r9874 8 8 9 9 import java.sql.SQLException; 10 import java.sql.Statement; 10 11 import java.sql.ResultSet; 11 12 … … 275 276 } else { 276 277 // TODO: raise an error! 277 System.out.println("Error: METSDescri iptive: unrecognised tag "+childName);278 System.out.println("Error: METSDescriptive: unrecognised tag "+childName); 278 279 } 279 280 } … … 375 376 select.setWhere(where); 376 377 377 connection.execute(select.toString());378 379 378 try { 379 Statement statement = connection.createStatement(); 380 ResultSet resultSet = statement.executeQuery(select.toString()); 380 381 GS3SQLAction action; 381 382 382 ResultSet resultSet = connection.getResultSet(); 383 384 if (resultSet != null && 385 resultSet.first()) { 383 if (resultSet.first()) { 386 384 // the node already exists - no need to do anything as such 387 385 GS3SQLUpdate update = new GS3SQLUpdate("metadata"); … … 389 387 action = update; 390 388 } 391 else 392 { // Set result set to null, just in case next() didn't work above... 393 resultSet = null; 394 395 // It is a new node and needs writing 396 action = new GS3SQLInsert("metadata"); 397 398 action.addValue("DocID", document.getID().toString()); 399 action.addValue("MetaID", this.ID); 400 } 389 else { // Set result set to null, just in case first() didn't work above... 390 // It is a new node and needs writing 391 action = new GS3SQLInsert("metadata"); 392 393 action.addValue("DocID", document.getID().toString()); 394 action.addValue("MetaID", this.ID); 395 } 401 396 402 397 // always set the group identifier … … 404 399 405 400 // execute the action as required 406 connection.execute(action.toString()); 407 408 // create a new resultset if necessary 409 if (resultSet == null) { 410 // now execute the select statement again to get the new identifier 411 // 'MetadataRef' 412 // System.out.println(select.toString()); 413 connection.execute(select.toString()); 414 415 resultSet = connection.getResultSet(); 416 resultSet.first(); 417 } 418 419 // get the reference for this item... 420 sqlId = resultSet.getInt("MetadataRef"); 401 statement.execute(action.toString()); 402 403 // get the resultSet again 404 // now execute the select statement again to get the new identifier 405 // 'MetadataRef' 406 // System.out.println(select.toString()); 407 resultSet = statement.executeQuery(select.toString()); 408 409 if (resultSet.first()) { 410 // get the reference for this item... 411 sqlId = resultSet.getInt("MetadataRef"); 412 } 413 statement.close(); 421 414 } 422 415 catch (SQLException sql){ 423 System.out.println(sql); 416 System.err.println("METSDescriptive.writeSQL(): "+sql); 417 } 418 if (sqlId == -1) { 419 return false; 424 420 } 425 421 … … 471 467 select.setWhere(where); 472 468 473 connection.execute(select.toString()); 474 475 // parse through the namespaces, calling the namespace class to create instances 476 // as it will 477 ResultSet namespaceSet = connection.getResultSet(); 478 if (namespaceSet != null && namespaceSet.first()) { 469 Statement statement = connection.createStatement(); 470 ResultSet namespaceSet = statement.executeQuery(select.toString()); 471 472 // parse through the namespaces, calling the namespace class to create instances as it will 473 if (namespaceSet.first()) { 479 474 do { 480 475 METSNamespace namespace = METSNamespace.readSQL(connection, namespaceSet); … … 483 478 } 484 479 else { 485 System. out.println("Null namespace output");480 System.err.println("Null namespace output"); 486 481 } 487 482 } 488 483 while (namespaceSet.next()); 489 484 } 490 485 statement.close(); 491 486 return descriptive; 492 487 } 493 488 catch (SQLException sqlEx){ 494 System. out.println(sqlEx);489 System.err.println("METSDescriptive.readSQL(): "+sqlEx); 495 490 System.exit(1); 496 491 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/metadata/METSDescriptiveSet.java
r8742 r9874 9 9 10 10 import java.sql.SQLException; 11 import java.sql.Statement; 11 12 import java.sql.ResultSet; 12 13 … … 236 237 GS3SQLWhereItem whereItem = new GS3SQLWhereItem("DocID", "=", document.getID().toString()); 237 238 select.setWhere(new GS3SQLWhere(whereItem)); 238 connection.execute(select.toString()); 239 239 240 240 // start going through the matching metadata blocks 241 241 try { 242 ResultSet resultSet = connection.getResultSet(); 243 resultSet.first(); 244 do { 245 METSDescriptive descriptive = METSDescriptive.readSQL(document, connection, resultSet); 246 if (descriptive != null) { 247 set.addDescriptive(descriptive); 248 } 249 else { 250 System.out.println("Null descriptive"); 251 } 252 } while (resultSet.next()); 242 Statement statement = connection.createStatement(); 243 ResultSet resultSet = statement.executeQuery(select.toString()); 244 if (resultSet.first()) { 245 do { 246 METSDescriptive descriptive = METSDescriptive.readSQL(document, connection, resultSet); 247 if (descriptive != null) { 248 set.addDescriptive(descriptive); 249 } 250 else { 251 System.out.println("Null descriptive"); 252 } 253 } while (resultSet.next()); 254 } 255 statement.close(); 253 256 } 254 257 catch (SQLException sqlEx) { 255 System. out.println(sqlEx);258 System.err.println("METSDescriptiveSet.readSQL(): "+sqlEx); 256 259 System.exit(1); 257 260 } 258 261 262 259 263 return set; 260 264 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/metadata/METSDivision.java
r8742 r9874 10 10 11 11 import java.sql.SQLException; 12 import java.sql.Statement; 12 13 import java.sql.ResultSet; 13 14 … … 475 476 select.setWhere(where); 476 477 477 connection.execute(select.toString()); 478 Statement statement = null; 479 ResultSet resultSet = null; 478 480 479 481 // Do the actual writing 480 482 GS3SQLAction action; 481 483 482 ResultSet resultSet = connection.getResultSet();483 484 try { 484 if (resultSet == null ||485 !resultSet.first()) {486 resultSet = null;485 statement = connection.createStatement(); 486 resultSet = statement.executeQuery(select.toString()); 487 if (!resultSet.first()) { 487 488 488 489 GS3SQLInsert insert = new GS3SQLInsert("divisions"); … … 499 500 GS3SQLUpdate update = new GS3SQLUpdate("divisions"); 500 501 GS3SQLWhere updateWhere = 501 new GS3SQLWhere(new GS3SQLWhereItem("DivisionRef", "=", Integer.toString(sqlRef), 502 GS3SQLField.INTEGER_TYPE)); 502 new GS3SQLWhere(new GS3SQLWhereItem("DivisionRef", "=", Integer.toString(sqlRef), GS3SQLField.INTEGER_TYPE)); 503 503 update.setWhere(updateWhere); 504 504 action = update; … … 515 515 action.addValue("UserLabel", this.userLabel); 516 516 517 if (!connection.execute(action.toString())){ 517 try { 518 statement.execute(action.toString()); 519 } catch (SQLException e) { 520 System.err.println("METSDivision.writeSQL(): "+e); 518 521 return false; 519 522 } 520 523 521 524 // if doing a fresh item, get the new structure reference... 522 if ( resultSet == null){525 if (sqlRef == -1){ 523 526 // get the new structure reference 524 connection.execute(select.toString());525 526 // get the sql reference for the division527 527 try { 528 528 // read in the structure reference 529 resultSet = connection.getResultSet();530 if (resultSet == null) {531 return false;529 resultSet = statement.executeQuery(select.toString()); 530 if (resultSet.first()) { 531 sqlRef = resultSet.getInt("DivisionRef"); 532 532 } 533 resultSet.first();534 sqlRef = resultSet.getInt("DivisionRef");535 resultSet.close();536 resultSet = null;537 533 } 538 534 catch (SQLException sqlex) { 539 System.err.println(" Unable to retrieve reference for Division " + sqlex);535 System.err.println("METSDIVISION.writeSQL(): Unable to retrieve reference for Division " + sqlex); 540 536 return false; 541 537 } 542 538 } 543 // close the open resultSet, as we don't need it any longer...544 else {545 try {546 resultSet.close();547 }548 catch (SQLException sql) {549 System.err.println(sql + " " + select.toString());550 }551 }552 539 553 540 // delete the old file/metadata references 554 GS3SQLWhere referenceWhere = 555 new GS3SQLWhere(new GS3SQLWhereItem("DivisionRef", "=", Integer.toString(sqlRef), 556 GS3SQLField.INTEGER_TYPE)); 557 558 GS3SQLDelete delete = new GS3SQLDelete("divisionfilerefs"); 559 delete.setWhere(referenceWhere); 560 connection.execute(delete.toString()); 561 562 delete = new GS3SQLDelete("divisionmetarefs"); 563 delete.setWhere(referenceWhere); 564 connection.execute(delete.toString()); 565 566 // write the new file references 567 if (this.fileRefs.size() > 0){ 568 Iterator iterator = this.fileRefs.iterator(); 569 570 while (iterator.hasNext()) { 571 GS3SQLInsert fileinsert = new GS3SQLInsert("divisionfilerefs"); 572 fileinsert.addValue("DocID", docId.toString()); 573 fileinsert.addValue("DivisionRef", Integer.toString(sqlRef), GS3SQLField.INTEGER_TYPE); 574 fileinsert.addValue("DivisionType", "Group"); 575 fileinsert.addValue("FileID", iterator.next().toString()); 576 connection.execute(fileinsert.toString()); 577 } 578 } 579 580 // write the metadata references 581 if (this.metadataRefs.size() > 0){ 582 Iterator iterator = this.metadataRefs.iterator(); 583 584 while (iterator.hasNext()) { 585 GS3SQLInsert metainsert = new GS3SQLInsert("divisionmetarefs"); 586 metainsert.addValue("DocID", docId.toString()); 587 metainsert.addValue("DivisionRef", Integer.toString(sqlRef), GS3SQLField.INTEGER_TYPE); 588 metainsert.addValue("DivisionType", "Group"); 589 metainsert.addValue("MetaID", iterator.next().toString()); 590 connection.execute(metainsert.toString()); 591 } 592 } 593 541 try { 542 GS3SQLWhere referenceWhere = 543 new GS3SQLWhere(new GS3SQLWhereItem("DivisionRef", "=", Integer.toString(sqlRef), 544 GS3SQLField.INTEGER_TYPE)); 545 546 GS3SQLDelete delete = new GS3SQLDelete("divisionfilerefs"); 547 delete.setWhere(referenceWhere); 548 549 statement.execute(delete.toString()); 550 551 delete = new GS3SQLDelete("divisionmetarefs"); 552 delete.setWhere(referenceWhere); 553 statement.execute(delete.toString()); 554 555 // write the new file references 556 if (this.fileRefs.size() > 0){ 557 Iterator iterator = this.fileRefs.iterator(); 558 559 while (iterator.hasNext()) { 560 GS3SQLInsert fileinsert = new GS3SQLInsert("divisionfilerefs"); 561 fileinsert.addValue("DocID", docId.toString()); 562 fileinsert.addValue("DivisionRef", Integer.toString(sqlRef), GS3SQLField.INTEGER_TYPE); 563 fileinsert.addValue("DivisionType", "Group"); 564 fileinsert.addValue("FileID", iterator.next().toString()); 565 statement.execute(fileinsert.toString()); 566 } 567 } 568 569 // write the metadata references 570 if (this.metadataRefs.size() > 0){ 571 Iterator iterator = this.metadataRefs.iterator(); 572 573 while (iterator.hasNext()) { 574 GS3SQLInsert metainsert = new GS3SQLInsert("divisionmetarefs"); 575 metainsert.addValue("DocID", docId.toString()); 576 metainsert.addValue("DivisionRef", Integer.toString(sqlRef), GS3SQLField.INTEGER_TYPE); 577 metainsert.addValue("DivisionType", "Group"); 578 metainsert.addValue("MetaID", iterator.next().toString()); 579 statement.execute(metainsert.toString()); 580 } 581 } 582 statement.close(); 583 } catch (SQLException e) { 584 System.err.println("METSDIVISION.writeSQL(): "+e); 585 return false; 586 } 594 587 // write out any children in turn 595 588 Iterator groups = this.children.values().iterator(); … … 633 626 select.setWhere(where); 634 627 635 connection.execute(select.toString()); 628 Statement statement = connection.createStatement(); 629 ResultSet childSet = statement.executeQuery(select.toString()); 636 630 637 631 // circulate through to obtain further children 638 ResultSet childSet = connection.getResultSet();639 632 if (childSet.first()) 640 633 { … … 645 638 while (childSet.next()); 646 639 } 647 648 640 select = new GS3SQLSelect("divisionfilerefs"); 649 641 select.addField("*"); … … 652 644 select.setWhere(where); 653 645 654 connection.execute(select.toString()); 655 656 ResultSet fileSet = connection.getResultSet(); 657 if (fileSet != null && fileSet.first()){ 646 ResultSet fileSet = statement.executeQuery(select.toString()); 647 648 if (fileSet.first()){ 658 649 do { 659 650 String reference = fileSet.getString("FileID"); … … 662 653 while (fileSet.next()); 663 654 } 664 655 665 656 select = new GS3SQLSelect("divisionmetarefs"); 666 657 select.addField("*"); … … 669 660 select.setWhere(where); 670 661 671 connection.execute(select.toString()); 672 673 ResultSet metaSet = connection.getResultSet(); 674 if (metaSet != null && metaSet.first()){ 662 ResultSet metaSet = statement.executeQuery(select.toString()); 663 664 if (metaSet.first()){ 675 665 do { 676 666 String reference = metaSet.getString("MetaID"); … … 680 670 } 681 671 672 statement.close(); 682 673 return division; 683 674 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/metadata/METSFile.java
r8742 r9874 11 11 import java.sql.ResultSet; 12 12 import java.sql.SQLException; 13 import java.sql.Statement; 13 14 14 15 import org.w3c.dom.Document; … … 201 202 where.add(whereItem); 202 203 select.setWhere(where); 203 connection.execute(select.toString()); 204 205 Statement statement = null; 204 206 205 207 // if not, then make an insert action 206 208 try { 207 ResultSet results = connection.getResultSet();208 if (results == null ||209 209 statement = connection.createStatement(); 210 ResultSet results = statement.executeQuery(select.toString()); 211 if (!results.first()){ 210 212 GS3SQLInsert insert = new GS3SQLInsert("files"); 211 213 … … 223 225 } 224 226 catch (SQLException ex){ 225 System.err.println( ex);227 System.err.println("METSFile.writeSQL(): "+ex); 226 228 return false; 227 229 } … … 230 232 action.addValue("MIMEType", this.MIMEType); 231 233 232 return connection.execute(action.toString()); 234 try { 235 statement.execute(action.toString()); 236 statement.close(); 237 238 } catch (SQLException e) { 239 System.err.println("METSFile.writeSQL():"+e); 240 return false; 241 } 242 return true; 233 243 } 234 244 … … 248 258 } 249 259 catch (SQLException ex){ 250 System.out.println( ex);260 System.out.println("METSFile.readSQL(): "+ex); 251 261 } 252 262 catch (java.net.MalformedURLException urlEx){ 253 System.out.println( urlEx);263 System.out.println("METSFile.readSQL(): "+urlEx); 254 264 } 255 265 return null; … … 309 319 } catch (java.net.MalformedURLException ex) { 310 320 // TODO: raise error 311 System.err.println( ex);321 System.err.println("METSFile.parse_flocateXML(): "+ex); 312 322 } 313 323 return thisFilePos; -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/metadata/METSFileGroup.java
r8742 r9874 8 8 9 9 import java.sql.SQLException; 10 import java.sql.Statement; 10 11 import java.sql.ResultSet; 11 12 … … 271 272 { 272 273 int sqlId = -1; 273 274 274 // check if this node is in the database already 275 275 GS3SQLSelect select = new GS3SQLSelect("filegroups"); … … 281 281 select.setWhere(where); 282 282 283 connection.execute(select.toString()); 284 285 ResultSet selectResult = connection.getResultSet(); 283 ResultSet results = null; 284 Statement statement = null; 286 285 287 286 try { 288 if (selectResult == null || 289 !selectResult.first()) { 287 statement = connection.createStatement(); 288 results = statement.executeQuery(select.toString()); 289 if (!results.first()) { 290 290 GS3SQLInsert insert = new GS3SQLInsert("filegroups"); 291 291 … … 295 295 insert.addValue("ParentType", parentIsSection ? SECTION_PARENT : GROUP_PARENT); 296 296 297 if (!connection.execute(insert.toString())) { 298 return false; 299 } 297 statement.execute(insert.toString()); 300 298 } 301 299 else { … … 304 302 } 305 303 catch (SQLException ex){ 306 System.err.println( ex);304 System.err.println("METSFileGroup.writeSQL(): "+ex); 307 305 return false; 308 306 } 309 307 310 308 // get the filegroup reference now 311 connection.execute(select.toString());312 313 309 try { 314 ResultSet results = connection.getResultSet(); 315 if (results == null) { 310 results = statement.executeQuery(select.toString()); 311 if (results.first()) { 312 sqlId = results.getInt("FileGroupRef"); 313 } else { 314 statement.close(); 316 315 return false; 317 316 } 318 results.first(); 319 sqlId = results.getInt("FileGroupRef"); 320 } 321 catch (SQLException sqlex) { 322 System.out.println(sqlex); 317 statement.close(); 318 } catch (SQLException sqlex) { 319 System.err.println("METSFileGroup.writeSQL(): "+sqlex); 323 320 return false; 324 321 } 325 326 322 // iterate over the child groups 327 323 Iterator childIter = childGroups.iterator(); … … 330 326 331 327 if (!fileGroup.writeSQL(document, Integer.toString(sqlId), false, connection)){ 328 System.err.println("METSFileGroup.writeSQL(): Couldn't write FileGroup"); 332 329 return false; 333 330 } … … 337 334 childIter = children.iterator(); 338 335 while (childIter.hasNext()){ 339 METSFile file = (METSFile) childIter.next(); 340 336 METSFile file = (METSFile) childIter.next(); 341 337 if (!file.writeSQL(sqlId, connection)){ 338 System.err.println("METSFileGroup.writeSQL(): Couldn't write File"); 342 339 return false; 343 340 } … … 371 368 select.setWhere(where); 372 369 373 connection.execute(select.toString());370 Statement statement = connection.createStatement(); 374 371 375 372 // parse through the child groups 376 ResultSet childSet = connection.getResultSet();373 ResultSet childSet = statement.executeQuery(select.toString()); 377 374 if (childSet.first()) { 378 375 do { … … 384 381 while (childSet.next()); 385 382 } 386 387 383 // now scan for file members 388 384 select = new GS3SQLSelect("files"); 389 385 select.addField("*"); 390 whereItem = new GS3SQLWhereItem("FileGroupRef", "=", Integer.toString(groupRef), 391 GS3SQLField.INTEGER_TYPE); 386 whereItem = new GS3SQLWhereItem("FileGroupRef", "=", Integer.toString(groupRef), GS3SQLField.INTEGER_TYPE); 392 387 where = new GS3SQLWhere(whereItem); 393 388 select.setWhere(where); 394 connection.execute(select.toString()); 395 396 ResultSet childFileSet = connection.getResultSet(); 397 if (childFileSet != null && childFileSet.first()) { 389 ResultSet childFileSet = statement.executeQuery(select.toString()); 390 if (childFileSet.first()) { 398 391 do { 399 392 METSFile file = METSFile.readSQL(connection, childFileSet); … … 404 397 while (childFileSet.next()); 405 398 } 406 399 statement.close(); 407 400 return group; 408 401 } 409 402 catch (SQLException sqlEx){ 410 System. out.println(sqlEx);403 System.err.println("METSFileGroup.readSQL(): "+sqlEx); 411 404 System.exit(1); 412 405 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/metadata/METSFileSet.java
r8742 r9874 16 16