org.globus.exec.service.exec.utils
Class FileMappingConfig

java.lang.Object
  extended byorg.globus.exec.service.exec.utils.FileMappingConfig

public class FileMappingConfig
extends java.lang.Object

Helper class to add, replace, remove map elements from an xml file containing a fileSystemMaps document (typically used with $GLOBUS_LOCATION/etc/gram-service/globus_gram_fS_map_config.xml).


Field Summary
static java.lang.String DEFAULT_MAP_FILE
           
private  org.w3c.dom.Document doc
           
private static java.util.Properties env
           
private static java.lang.String GLOBUS_HOSTNAME_EXEC
           
private static java.lang.String GRAM_NS
           
private static javax.xml.namespace.QName MAP_QNAME
           
private  java.io.File path
           
 
Constructor Summary
FileMappingConfig(java.io.File config)
          Create a new FileMappingConfig for manipulating a map in a file.
 
Method Summary
 void addMap(FileSystemMapType map)
          Add a map entry for a scheduler.
private static java.lang.String getHostName()
          Determine host name for default (grid)ftp server
private  org.w3c.dom.Node getOldMap(java.lang.String scheduler)
          Get the first mapping for a particular scheduler if present.
private static void loadEnvironment()
          Determine environment values
static void main(java.lang.String[] args)
           
 void removeMap(java.lang.String scheduler)
          Remove map entries for the named scheduler.
 void replaceMap(FileSystemMapType map)
          Replace all existing map entries for this scheduler with the new map.
(package private) static void usage()
          Display usage message
 void writeConfig()
          Replace the config file on disk with the modified map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doc

private org.w3c.dom.Document doc

path

private java.io.File path

DEFAULT_MAP_FILE

public static final java.lang.String DEFAULT_MAP_FILE
See Also:
Constant Field Values

GLOBUS_HOSTNAME_EXEC

private static final java.lang.String GLOBUS_HOSTNAME_EXEC
See Also:
Constant Field Values

env

private static java.util.Properties env

GRAM_NS

private static final java.lang.String GRAM_NS
See Also:
Constant Field Values

MAP_QNAME

private static final javax.xml.namespace.QName MAP_QNAME
Constructor Detail

FileMappingConfig

public FileMappingConfig(java.io.File config)
                  throws java.io.FileNotFoundException,
                         javax.xml.parsers.ParserConfigurationException,
                         org.xml.sax.SAXException,
                         java.io.IOException
Create a new FileMappingConfig for manipulating a map in a file.

Parameters:
config - Path to xml file.
Method Detail

getOldMap

private org.w3c.dom.Node getOldMap(java.lang.String scheduler)
Get the first mapping for a particular scheduler if present.

Parameters:
scheduler - Scheduler name to look for.

removeMap

public void removeMap(java.lang.String scheduler)
               throws org.w3c.dom.DOMException
Remove map entries for the named scheduler.

Throws:
org.w3c.dom.DOMException

addMap

public void addMap(FileSystemMapType map)
            throws java.io.IOException,
                   SerializationException
Add a map entry for a scheduler.

Parameters:
map - FileSystemMapType containing all mappings for the particular scheduler.
Throws:
java.io.IOException
SerializationException

replaceMap

public void replaceMap(FileSystemMapType map)
                throws java.io.IOException,
                       SerializationException
Replace all existing map entries for this scheduler with the new map.

Parameters:
map - FileSystemMapType containing all mappings for the particular scheduler.
Throws:
java.io.IOException
SerializationException

writeConfig

public void writeConfig()
                 throws java.io.IOException
Replace the config file on disk with the modified map.

Throws:
java.io.IOException

usage

static void usage()
Display usage message


loadEnvironment

private static void loadEnvironment()
                             throws java.io.IOException
Determine environment values

Throws:
java.io.IOException

getHostName

private static java.lang.String getHostName()
                                     throws java.io.IOException
Determine host name for default (grid)ftp server

Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)