Changeset 4554 for trunk/client


Ignore:
Timestamp:
Apr 28, 2014, 1:54:37 PM (9 years ago)
Author:
Fredrik Levander
Message:

Refs #776. Moving some settings to configuration file.

Location:
trunk/client/servlet
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/conf/connection.properties.in

    r4551 r4554  
    6666alternate.location.target.2 =
    6767
     68#
     69# Settings for SRM client. Used to publish files on Swestore
     70# Path to script for creating proxy:
     71# create proxy = /usr/share/tomcat6/create_proxy.sh
     72create.proxy = /usr/share/tomcat/create_proxy.sh
     73#
     74# srm-set-permissions command.
     75# command in path:
     76srm.set.permissions = srm-set-permissions 
     77# alternative:
     78# srm.set.permissions = /opt/d-cache/srm/bin/srm-set-permissions
     79
     80
     81
     82
  • trunk/client/servlet/src/org/proteios/action/file/PublishFiles.java

    r4474 r4554  
    11/*
    2  Copyright (C) 2012 Fredrik Levander
     2 Copyright (C) 2012-2014 Fredrik Levander
    33
    44 This file is part of Proteios.
     
    2222package org.proteios.action.file;
    2323
     24import org.proteios.ConnectionPropertiesFile;
    2425import org.proteios.Context;
    2526import org.proteios.ContextEnabled;
     
    4546
    4647/**
    47  * This action will change the access rights of the underlying files, which are currently assumed to be on the Swestore storage
     48 * This action will change the access rights of the underlying files, which are
     49 * currently assumed to be on the Swestore storage
    4850 *
    4951 * @author fredrik
     
    5557  String initsh = "/usr/share/tomcat6/create_proxy.sh";
    5658  String SRMcommand = "/opt/d-cache/srm/bin/srm-set-permissions";
    57   static String httpsstart = "https://srm.swegrid.se";
    58   static String srmstart = "srm://srm.swegrid.se";
    5959
    6060
     
    7777      return;
    7878    }
     79    ConnectionPropertiesFile pf = new ConnectionPropertiesFile();
     80    if (pf.getProperty("srm.set.permissions") != null)
     81      SRMcommand = pf.getProperty("srm.set.permissions");
     82    if (pf.getProperty("create.proxy") != null)
     83      initsh = pf.getProperty("create.proxy");
    7984    java.io.File test = new java.io.File(initsh);
    8085    if (!test.canRead())
     
    8893        if (!test.canRead())
    8994        {
    90           throw new ActionException("Cannot execute script for proxy generation. create_proxy.sh not found or not readable");
     95          throw new ActionException(
     96            "Cannot execute script for proxy generation. create_proxy.sh not found or not readable");
    9197        }
    9298      }
     
    106112      while ((line = reader.readLine()) != null)
    107113      {
    108         log.warn("Proxy generation output:"+line);
     114        log.warn("Proxy generation output:" + line);
    109115        if (line.contains("No such file") || line.contains("Error"))
    110116        {
    111           throw new ActionException("Error in proxy generation:"+line);
     117          throw new ActionException(
     118            "Error in proxy generation:" + line);
    112119        }
    113120      }
     
    142149          pb1.command(commandarray);
    143150          Process proc = pb1.start();
    144           reader = new BufferedReader(new InputStreamReader(proc
    145             .getInputStream()));
     151          reader = new BufferedReader(new InputStreamReader(
     152            proc.getInputStream()));
    146153          while ((line = reader.readLine()) != null)
    147154          {
    148             log.error("SRM client output"+line);
     155            log.error("SRM client output:" + line);
     156            if (line.contains("No such file") || line.contains("Error"))
     157            {
     158              throw new ActionException(
     159              "Error issuing srm-set-permissions:" + line);
     160            }
    149161          }
    150162          proc.waitFor();
     
    240252  {
    241253    String retval = uri.replace("http://", "https://");
    242     return retval.replace(httpsstart, srmstart);
     254    return retval.replace("https://srm.swegrid.se", "srm://srm.swegrid.se");
    243255  }
    244256
Note: See TracChangeset for help on using the changeset viewer.