Changeset 4474


Ignore:
Timestamp:
May 28, 2013, 4:27:44 PM (10 years ago)
Author:
Fredrik Levander
Message:

Refs #776. Added possibility for alternate tomcat paths, and some error checking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/org/proteios/action/file/PublishFiles.java

    r4302 r4474  
    4545
    4646/**
    47  * This action will change the access rights of the underlying files
     47 * This action will change the access rights of the underlying files, which are currently assumed to be on the Swestore storage
    4848 *
    4949 * @author fredrik
     
    5353    implements ContextEnabled
    5454{
    55   static String initsh = "/usr/share/tomcat6/create_proxy.sh";
     55  String initsh = "/usr/share/tomcat6/create_proxy.sh";
    5656  String SRMcommand = "/opt/d-cache/srm/bin/srm-set-permissions";
    5757  static String httpsstart = "https://srm.swegrid.se";
     
    7777      return;
    7878    }
     79    java.io.File test = new java.io.File(initsh);
     80    if (!test.canRead())
     81    {
     82      initsh = "/usr/share/tomcat/create_proxy.sh";
     83      test = new java.io.File(initsh);
     84      if (!test.canRead())
     85      {
     86        initsh = "/usr/share/tomcat7/create_proxy.sh";
     87        test = new java.io.File(initsh);
     88        if (!test.canRead())
     89        {
     90          throw new ActionException("Cannot execute script for proxy generation. create_proxy.sh not found or not readable");
     91        }
     92      }
     93    }
    7994    ProcessBuilder pb1 = new ProcessBuilder("bash", initsh);
    8095    pb1.redirectErrorStream(true);
    81     System.out.println("Executing");
     96    log.info("Executing proxy generation script");
    8297    Process proc1;
    8398    Directory dir = null;
     
    91106      while ((line = reader.readLine()) != null)
    92107      {
    93         System.out.println(line);
     108        log.warn("Proxy generation output:"+line);
     109        if (line.contains("No such file") || line.contains("Error"))
     110        {
     111          throw new ActionException("Error in proxy generation:"+line);
     112        }
    94113      }
    95114      proc1.waitFor();
     
    109128            .startsWith("https://");
    110129          infoCount++;
    111           System.out.println("SRM client");
     130          log.debug("SRM client");
    112131          String[] commandarray =
    113132            {
     
    127146          while ((line = reader.readLine()) != null)
    128147          {
    129             System.out.println(line);
     148            log.error("SRM client output"+line);
    130149          }
    131150          proc.waitFor();
Note: See TracChangeset for help on using the changeset viewer.