uk.ac.starlink.soap.util
Class RemoteUtilities

java.lang.Object
  extended by uk.ac.starlink.soap.util.RemoteUtilities

public class RemoteUtilities
extends Object

This class provides utility methods to allow the Soap Server to read and write a contact file. Uses the adam user directory (if this has been pushed into the Java properties), or ~/.soap directory if this is undefined.

Version:
$Id$
Author:
Peter W. Draper, Alasdair Allan

Method Summary
static File getConfigDirectory()
          The name of the directory used for storing configuration information.
static File getConfigFile(String name)
          Construct the proper name of a file stored in the configuration directory.
static Object[] readContactFile(String appName)
          Parse the contact file returning its contents as an Object array.
static String writeContactFile(int port, String appName)
          Write contact details to a file only readable by the owner process and privileged local users.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeContactFile

public static String writeContactFile(int port,
                                      String appName)
Write contact details to a file only readable by the owner process and privileged local users.

These details are used to authenticate any requests.

The file contains the simple line:

    hostname port_number cookie
 
The cookie is generated by this method and returned as its result.

Parameters:
port - the port number being used by a server process that is listening for connections.
Returns:
the cookie for authenticating connections. This is null if a failure to write the contact file is encountered.

readContactFile

public static Object[] readContactFile(String appName)
Parse the contact file returning its contents as an Object array.

Returns:
array of three Objects. These are really the hostname String, an Integer with the port number and a String containing the validation cookie. Returns null if not available.

getConfigDirectory

public static File getConfigDirectory()
The name of the directory used for storing configuration information. This directory is created if it doesn't exist already.


getConfigFile

public static File getConfigFile(String name)
Construct the proper name of a file stored in the configuration directory.

Parameters:
name - the name of the file to be stored/located in the the configuration directory.


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.