« October 2007 | Main | December 2007 »

November 30, 2007

create-administrator ... makes an admin user in dspace

This cmd line function steps you though creating a admmin user in dspace

location:
/usr/local/dspace-sr-dev/bin/create-administrator


I had to make changes to the script documented below:
########################################################################### # Shell script creating a starting administrator account # Get the DSPACE/bin directory BINDIR=`dirname $0` #***************************************************************** # Within the dspace.jar for Agecon there was no class called: # edu.umn.dspace.administer.CreateAdministrator # however I found a class called: # org/dspace/administer/CreateAdministrator # I used that jar and this script worked properly # # #$BINDIR/dsrun edu.umn.dspace.administer.CreateAdministrator # # J Silvis # 29 Nov 2007 #***************************************************************** $BINDIR/dsrun org/dspace/administer/CreateAdministrator

November 21, 2007

bash functions to run more than one instance of tomcat on a box

# The functions below are used to manage a box where two or more instances # of tomcat are running simultaneously. # # Ports used by Tomcat (see $TOMCAT_BASE/conf/server.xml): # 1) <Connector port="8080" maxHttpHeaderSize="8192" # maxThreads="150" minSpareThreads="25" maxSpareThreads="75" # enableLookups="false" redirectPort="8443" acceptCount="100" # connectionTimeout="20000" disableUploadTimeout="true" /> # 2) <Server port="8005" shutdown="SHUTDOWN"> # # 3) <!-- Define an AJP 1.3 Connector on port 8009 --> # <Connector port="8009" # enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /> # # The first two ports need to be modified to set up a new instance of tomcat. # the third port is for a ajp server that talks to aphache and it does not need to be # changed. # http://tomcat.apache.org/tomcat-4.0-doc/config/ajp.html # # # # I) Creating the new set of code. # # # Suppose you want an instance of tomcat to run on port 8070 # and the primary set of tomcat files are in # TOMCAT_BASE=/usr/local/apache-tomcat-5.5.23 # # 1) Create a duplicate set of the tomcat files # cp -R /usr/local/apache-tomcat-5.5.23 /usr/local/apache-tomcat-5.5.23_8070 # # 2) Modify the file /usr/local/apache-tomcat-5.5.23_8070/conf/server.xml # a) set <Connector port="8080"... to <Connector port="8070" # b) <Server port="8005" shutdown="SHUTDOWN"> to <Server port="8006" shutdown="SHUTDOWN"> # or whatever port you like for shutdown. # # # II) Examples of using the scripts # tomstart - will start an instance of tomcat on 8080 # tomstart 8070 - will start an instance of tomcat on 8070 # tomkill - will kill -9 an instance of tomcat on 8080 # tomskill 8070 - will kill -9 an instance of tomcat on 8070 # ect. # # III) I have the line # source ~/TOMCAT_SCRIPTS.sh # in my .bashrc file where TOMCAT_SCRIPTS.sh is this file # # # J. Silvis Nov 2007 # ********************************************************************************************** export TOMCAT_BASE=/usr/local/apache-tomcat-5.5.23 function tom { if [ -n "$1" ]; then cd ${TOMCAT_BASE}_${1} else cd $TOMCAT_BASE fi } # Start tomcat server: # tomstart portnumber will start a server that is is # within the directory $TOMCAT_BASE_$portnumber and will be # on the port: portnumber Otherwise stop the server on 8080 function tomstart { export CATALINA_HOME=$TOMCAT_BASE port=8080 if [ -n "$1" ]; then port=${1} export CATALINA_HOME=${CATALINA_HOME}_$port fi export CATALINA_PID=${CATALINA_HOME}/temp/tomcat.pid ${CATALINA_HOME}/bin/catalina.sh run & sleep 4 # wait for CATALINA_PID file to be written termtitle "Tomcat on port $port pid `cat $CATALINA_PID`" } # Stop tomcat server: # tomstop portnumber will start a server that is is # within the directory $TOMCAT_BASE_$portnumber and will be # on the port: portnumber Otherwise stop the server on 8080 function tomstop { export CATALINA_HOME=$TOMCAT_BASE if [ -n "$1" ]; then export CATALINA_HOME=${CATALINA_HOME}_${1} fi $CATALINA_HOME/bin/shutdown.sh termtitle "$USER" } # kill -9 the tomcat server: # tomkill portnumber will start a server that is is # within the directory $TOMCAT_BASE_$portnumber and will be # on the port: portnumber Otherwise stop the server on 8080 function tomkill { export CATALINA_HOME=$TOMCAT_BASE if [ -n "$1" ]; then export CATALINA_HOME=${CATALINA_HOME}_${1} fi export CATALINA_PID=${CATALINA_HOME}/temp/tomcat.pid kill -9 `cat $CATALINA_PID` rm $CATALINA_PID termtitle "$USER" } # gives the pid of the tomcat server: # tomkill portnumber will start a server that is is # within the directory $TOMCAT_BASE_$portnumber and will be # on the port: portnumber Otherwise stop the server on 8080 function tompid { export CATALINA_HOME=$TOMCAT_BASE if [ -n "$1" ]; then export CATALINA_HOME=${CATALINA_HOME}_${1} fi export CATALINA_PID=${CATALINA_HOME}/temp/tomcat.pid cat $CATALINA_PID } # Go to the root of the dspace development tree function dsrt { cd ~/Documents/workspace/trunk_8070 } # Copy dspace war files into tomcat function tomds { export CATALINA_HOME=$TOMCAT_BASE dsCodeRoot=~/Documents/workspace/trunk if [ -n "$1" ]; then export CATALINA_HOME=${CATALINA_HOME}_${1} dsCodeRoot=${dsCodeRoot}_${1} cp ${dsCodeRoot}/build/*war ${CATALINA_HOME}/webapps/. else echo -n "You are putting war files into the 8080 server ... proceed (Y/N) ? " read PROCEED ymatch=`echo $PROCEED | grep -Ei '^y(es)?$' | wc -l` if [ $ymatch == "1" ] ; then cp ${dsCodeRoot}/build/*war ${CATALINA_HOME}/webapps/. fi fi }

November 7, 2007

Files changed to make ag econ sort

The files below were changed to make ag econ sort, by clicking the headers of the tables.
SR/trunk/config/dspace.cfg
SR/trunk/jsp/local/search/results.jsp
SR/trunk/src/org/dspace/app/webui/servlet/SimpleSearchServlet.java
SR/trunk/src/org/dspace/search/DSIndexer.java
SR/trunk/src/org/dspace/search/DSQuery.java
SR/trunk/src/org/dspace/search/QueryArgs.java
SR/trunk/src/edu/umn/dspace/app/webui/jsptag/ItemListTag.java

This is R 57 in the SVN Repository

To get the sort to respond to clicking on the header was mostly done in:

SR/trunk/jsp/local/search/results.jsp
and
SR/trunk/src/edu/umn/dspace/app/webui/jsptag/ItemListTag.java

Add a user to a group

The line below adds the user silvi003 to the group dspace:

sudo dscl . merge /groups/dspace users silvi003

Make a Lucene field sortable and searchable

The java code snippet below will add searchable (TOKENIZED) fields and
sortable (UN_TOKENIZED) fields to a Lucene document.


if (value != null)
{
doc.add(new Field(key, value, Field.Store.YES, Field.Index.TOKENIZED));
if (key.equalsIgnoreCase("author") || key.equalsIgnoreCase("title") || key.equalsIgnoreCase("date") )
{
doc.add(new Field(key + "_sortable", value, Field.Store.YES, Field.Index.UN_TOKENIZED));

}
}


This is from the ag econ project file:

./src/org/dspace/search/DSIndexer.java