Changeset 801


Ignore:
Timestamp:
05/13/11 18:58:07 (8 years ago)
Author:
philsmart
Message:
 
Location:
raptor-ica/trunk
Files:
3 added
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • raptor-ica/trunk/.classpath

    r729 r801  
    77        <classpathentry kind="src" output="target/conf" path="src/main/config"/> 
    88        <classpathentry kind="src" output="target/bin" path="src/main/bin"/> 
     9        <classpathentry kind="src" output="target/keys" path="src/main/keys"/> 
    910        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> 
    1011        <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> 
  • raptor-ica/trunk/pom.xml

    r789 r801  
    33  <groupId>uk.ac.cardiff.raptor</groupId> 
    44  <artifactId>raptor-ica</artifactId> 
    5   <version>0.0.1-SNAPSHOT</version> 
     5  <version>0.1.0-SNAPSHOT</version> 
    66  <name>Raptor Information Collector Agent</name> 
    77  <description> </description> 
  • raptor-ica/trunk/src/main/bin/raptoricad

    r729 r801  
    99# 2006-07-02 chdh: Minor improvements. 
    1010# 2006-07-10 chdh: Changes for SUSE 10.0. 
     11# 2009-03-04 Josh Davis: Ubuntu/Redhat version. 
     12# 2010-09-21 Josh Davis: Changed 'sudo' to 'su', fix some typos, removed unused variables 
     13# 2011-05-12 Rhys Smith: Changed for RaptorICA 
    1114 
    1215### BEGIN INIT INFO 
    13 # Provides:                   javaDaemonTest 
     16# Provides:                   raptoricad 
    1417# Required-Start:             $network $local_fs $remote_fs 
    15 # X-UnitedLinux-Should-Start: $named sendmail 
    1618# Required-Stop:              $network $local_fs $remote_fs 
    17 # X-UnitedLinux-Should-Stop:  $named sendmail 
    1819# Default-Start:              3 5 
    1920# Default-Stop:               0 1 2 6 
    20 # Short-Description:          JavaDaemonTest 
    21 # Description:                A Java daemon for testing. 
     21# Short-Description: initscript to start/stop the Raptor ICA 
     22# Description:       initscript to start/stop the Raptor ICA 
    2223### END INIT INFO 
    2324 
    24 #. /etc/rc.status                                           # load start/stop script "rc" definitions 
    2525if [ -z "$JAVA_HOME" ]; then                               # if JAVA_HOME is undefined 
    2626   if [ -f /usr/share/java-utils/java-functions ]; then 
     
    3131   fi 
    3232 
     33serviceNameLo="raptoricad"                                 # service name with the first letter in lowercase 
     34serviceName="raptoricad"                                   # service name 
     35serviceUser="root"                                         # OS user name for the service 
     36serviceGroup="root"                                        # OS group name for the service 
     37 
     38applDir="/opt/raptor/ica"                                  # home directory of the service application 
     39serviceUserHome="$applDir"                                 # home directory of the service user 
     40 
    3341scriptFile=$(readlink -fn $(type -p $0))                   # the absolute, dereferenced path of this script file 
    3442scriptDir=$(dirname $scriptFile)                           # absolute path of the script directory 
    35 applDir="/usr/local/raptor/raptor-ica-embedded-0.0.1-SNAPSHOT/"                                       # home directory of the service application 
    36 serviceName="RaptorICA"                    # service name 
    37 serviceNameLo="raptorICA"                  # service name with the first letter in lowercase 
    38 serviceUser="root"                                          # OS user name for the service 
    39 serviceUserHome="$applDir"                                 # home directory of the service user 
    40 serviceGroup="root"                                    # OS group name for the service 
     43 
    4144serviceLogFile="/var/log/$serviceNameLo.log"               # log file for StdOut/StdErr 
    4245maxShutdownTime=15                                         # maximum number of seconds to wait for the daemon to terminate normally 
     46 
    4347pidFile="/var/run/$serviceNameLo.pid"                      # name of PID file (PID = process ID number) 
     48 
    4449javaCommand="java"                                         # name of the Java launcher without the path 
    45 javaExe="/usr/local/java/jre1.6.0_23/bin/$javaCommand"                      # file name of the Java application launcher executable 
    46  
    47 javaArgs="-Xmx128M -jar -DconfigurationFiles=/usr/local/raptor/raptor-ica-embedded-0.0.1-SNAPSHOT/conf/ica-core.xml raptor-ica-embedded-0.0.1-SNAPSHOT.jar" 
    48       # arguments for Java launcher 
     50javaExe="$JAVA_HOME/bin/$javaCommand"                      # file name of the Java application launcher executable 
     51javaArgs="-DconfigurationFiles=/opt/raptor/ica/conf/ -jar raptor-ica.jar -server -Xmx64M" 
     52                                                           # arguments for Java launcher 
    4953javaCommandLine="$javaExe $javaArgs"                       # command line to start the Java service application 
    50 javaCommandLineKeyword="com.sharemail.cfdev.idmpublicinterfaces.init.ApplicationInit"                    # a keyword that occurs on the commandline, used to detect an already running service process and to distinguish it from others 
    51 rcFileBaseName="rc$serviceNameLo"                          # basename of the "rc" symlink file for this script 
    52 rcFileName="/usr/local/sbin/$rcFileBaseName"               # full path of the "rc" symlink file for this script 
    53 etcInitDFile="/etc/init.d/$serviceNameLo"                  # symlink to this script from /etc/init.d 
     54javaCommandLineKeyword="raptor-ica.jar"                    # a keyword that occurs on the commandline, used to detect an already running service process and to distinguish it from others 
     55rcFileBaseName="rcraptoricad"                              # basename of the "rc" symlink file for this script 
     56rcFileName="/usr/local/sbin/rcraptoricad"                  # full path of the "rc" symlink file for this script 
     57etcInitDFile="/etc/init.d/raptoricad"                      # symlink to this script from /etc/init.d 
    5458 
    5559# Makes the file $1 writable by the group $serviceGroup. 
     
    9094   makeFileWritable $serviceLogFile || return 1 
    9195   cmd="nohup $javaCommandLine >>$serviceLogFile 2>&1 & echo \$! >$pidFile" 
    92    echo $cmd 
    93    echo "\n" 
    94    echo $javaCommandLine 
    95    $SHELL -c "$cmd" || return 1 
     96   su -m $serviceUser -s $SHELL -c "$cmd" || return 1 
    9697   sleep 0.1 
    9798   pid="$(<$pidFile)" 
     
    99100      echo -ne "\n$serviceName start failed, see logfile." 
    100101      return 1 
    101       fi 
     102   fi 
    102103   return 0; } 
    103104 
     
    113114      done 
    114115   echo -e "\n$serviceName did not terminate within $maxShutdownTime seconds, sending SIGKILL..." 
    115    kill -s SIGKILL $pid || return 1 
     116   kill -s KILL $pid || return 1 
    116117   local killWaitTime=15 
    117118   for ((i=0; i<killWaitTime*10; i++)); do 
     
    136137function startService { 
    137138   getServicePID 
    138    if [ $? -eq 0 ]; then echo -n "$serviceName is already running"; return 0; fi 
     139   if [ $? -eq 0 ]; then echo -n "$serviceName is already running"; RETVAL=0; return 0; fi 
    139140   echo -n "Starting $serviceName   " 
    140141   startServiceProcess 
    141    if [ $? -ne 0 ]; then return 1; fi 
     142   if [ $? -ne 0 ]; then RETVAL=1; echo "failed"; return 1; fi 
     143   echo "started PID=$pid" 
     144   RETVAL=0 
    142145   return 0; } 
    143146 
    144147function stopService { 
    145148   getServicePID 
    146    if [ $? -ne 0 ]; then echo -n "$serviceName is not running"; return 0; fi 
     149   if [ $? -ne 0 ]; then echo -n "$serviceName is not running"; RETVAL=0; echo ""; return 0; fi 
    147150   echo -n "Stopping $serviceName   " 
    148151   stopServiceProcess 
    149    if [ $? -ne 0 ]; then return 1; fi 
     152   if [ $? -ne 0 ]; then RETVAL=1; echo "failed"; return 1; fi 
     153   echo "stopped PID=$pid" 
     154   RETVAL=0 
    150155   return 0; } 
    151156 
     
    153158   echo -n "Checking for $serviceName:   " 
    154159   if getServicePID; then 
    155       rc_failed 0 
    156     else 
    157       rc_failed 3 
    158       fi 
    159    rc_status -v 
     160        echo "running PID=$pid" 
     161        RETVAL=0 
     162   else 
     163        echo "stopped" 
     164        RETVAL=3 
     165   fi 
    160166   return 0; } 
    161167 
    162 function installService { 
    163    getent group $serviceGroup >/dev/null 2>&1 
    164    if [ $? -ne 0 ]; then 
    165       echo Creating group $serviceGroup 
    166       groupadd -r $serviceGroup || return 1 
    167       fi 
    168    id -u $serviceUser >/dev/null 2>&1 
    169    if [ $? -ne 0 ]; then 
    170       echo Creating user $serviceUser 
    171       useradd -r -c "user for $serviceName service" -g $serviceGroup -G users -d $serviceUserHome $serviceUser 
    172       fi 
    173    ln -s $scriptFile $rcFileName || return 1 
    174    ln -s $scriptFile $etcInitDFile || return 1 
    175    insserv $serviceNameLo || return 1 
    176    echo $serviceName installed. 
    177    echo You may now use $rcFileBaseName to call this script. 
    178    return 0; } 
    179  
    180 function uninstallService { 
    181    insserv -r $serviceNameLo || return 1 
    182    rm -f $rcFileName 
    183    rm -f $etcInitDFile 
    184    echo $serviceName uninstalled. 
    185    return 0; } 
    186168 
    187169function main { 
    188  
     170   RETVAL=0 
    189171   case "$1" in 
    190       console)                                             # runs the Java program in console mode 
    191          runInConsoleMode 
    192          ;; 
    193172      start)                                               # starts the Java program as a Linux service 
    194173         startService 
     
    200179         stopService && startService 
    201180         ;; 
     181      console)                                             # runs in console mode 
     182        runInConsoleMode 
     183        ;; 
    202184      status)                                              # displays the service status 
    203185         checkServiceStatus 
    204186         ;; 
    205       install)                                             # installs the service in the OS 
    206          installService 
    207          ;; 
    208       uninstall)                                           # uninstalls the service in the OS 
    209          uninstallService 
    210          ;; 
    211187      *) 
    212          echo "Usage: $0 {console|start|stop|restart|status|install|uninstall}" 
     188         echo "Usage: $0 {start|stop|restart|console|status}" 
    213189         exit 1 
    214190         ;; 
    215191      esac 
    216     } 
     192   exit $RETVAL 
     193} 
    217194 
    218195main $1 
  • raptor-ica/trunk/src/main/config/event-release.xml

    r789 r801  
    3333            <list> 
    3434                <bean id="cardiffRaptorMUA" class="uk.ac.cardiff.raptor.registry.Endpoint"> 
     35                <property name="supportedEvents"> 
     36                        <list> 
     37                            <value type="java.lang.Class">uk.ac.cardiff.model.event.ShibbolethIdpAuthenticationEvent</value> 
     38                            <value type="java.lang.Class">uk.ac.cardiff.model.event.EzproxyAuthenticationEvent</value> 
     39                        </list> 
     40                    </property> 
    3541                    <property name="serviceEndpoint"> 
    3642                        <value>https://localhost:8443/MUA/MultiUnitAggregator</value> 
     
    4551 
    4652                <bean id="cardiffRaptorMUA-Second" class="uk.ac.cardiff.raptor.registry.Endpoint"> 
     53                <property name="supportedEvents"> 
     54                        <list> 
     55                            <value type="java.lang.Class">uk.ac.cardiff.model.event.ShibbolethIdpAuthenticationEvent</value> 
     56                            <value type="java.lang.Class">uk.ac.cardiff.model.event.EzproxyAuthenticationEvent</value> 
     57                        </list> 
     58                    </property> 
    4759                    <property name="serviceEndpoint"> 
    4860                        <value>https://localhost:8444/MUA/MultiUnitAggregator</value> 
  • raptor-ica/trunk/src/main/config/ica-core.xml

    r795 r801  
    135135 
    136136    <import resource="metadata.xml"/> 
    137         <import resource="database.xml"/> 
    138137        <import resource="event-parse.xml" /> 
    139138        <import resource="event-release.xml" /> 
  • raptor-ica/trunk/src/main/config/logging.xml

    r789 r801  
    1212 
    1313  <appender name="FILE" class="ch.qos.logback.core.FileAppender"> 
    14     <file>${USER_HOME}/raptor-ica-process.log</file> 
     14    <file>${LOG_HOME}/raptor-ica-process.log</file> 
    1515    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 
    1616            <FileNamePattern>${USER_HOME}/raptor-ica-process-%d{yyyy-MM-dd}.log</FileNamePattern> 
     
    2323  <logger name="org.springframework" level="ERROR"> 
    2424    <appender-ref ref="stdout"/> 
     25    <appender-ref ref="FILE"/> 
    2526  </logger> 
    2627 
    27   <logger name="uk" level="DEBUG"> 
     28  <logger name="uk.ac.cardiff" level="DEBUG"> 
    2829    <appender-ref ref="stdout"/> 
    2930    <appender-ref ref="FILE"/> 
     
    3233  <logger name="org.mortbay" level="INFO"> 
    3334    <appender-ref ref="stdout"/> 
     35    <appender-ref ref="FILE"/> 
    3436  </logger> 
    3537 
  • raptor-ica/trunk/src/main/config/metadata.xml

    r766 r801  
    2323    <!-- ICA Metadata --> 
    2424    <bean id="ICAMetadata" class="uk.ac.cardiff.model.ServiceMetadata"> 
    25         <property name="description"><value>Cardiff University IdP Shibboleth Log File Parser</value></property> 
    2625        <property name="organisationName"><value>Cardiff University</value></property> 
    2726        <property name="contactEmail"><value>smartp@cf.ac.uk</value></property> 
    28         <property name="serviceName"><value>Cardiff University Shibboleth Identity Provider</value></property> 
     27        <property name="serviceName"><value>Cardiff University Idp Service</value></property> 
    2928        <property name="entityId"><value>https://HOSTNAME/raptor-ica</value></property> 
    3029    </bean> 
  • raptor-ica/trunk/src/main/java/uk/ac/cardiff/raptorica/server/RunServer.java

    r789 r801  
    1717 
    1818import java.io.File; 
     19import java.io.FileInputStream; 
    1920import java.io.FileNotFoundException; 
    2021import java.io.IOException; 
    2122import java.net.URL; 
    2223import java.security.ProtectionDomain; 
     24import java.util.Properties; 
    2325import java.util.TimeZone; 
    2426 
     
    5961                configureLogger(configurationFiles+"/logging.xml"); 
    6062 
    61                 int portNumber = Integer.parseInt(System.getProperty("port", "8089")); 
     63                Properties props = new Properties(); 
     64                props.load(new FileInputStream(configurationFiles + "/server.properties")); 
     65 
     66                int portNumber = Integer.parseInt(props.getProperty("jetty.port", "8110")); 
    6267 
    6368                System.out.println("[INFO] Jetty Config: Using Port " + portNumber); 
  • raptor-ica/trunk/src/main/resources/package.xml

    r729 r801  
    4545        </fileSet> 
    4646        <fileSet> 
     47            <directory>target/keys</directory> 
     48            <outputDirectory>keys</outputDirectory> 
     49            <includes> 
     50                <include>*</include> 
     51            </includes> 
     52        </fileSet> 
     53        <fileSet> 
    4754            <directory>target/bin</directory> 
    4855            <outputDirectory>bin</outputDirectory> 
Note: See TracChangeset for help on using the changeset viewer.