com.gigaspaces.start
Class Locator

java.lang.Object
  extended by com.gigaspaces.start.Locator

public class Locator
extends java.lang.Object

The Locator class derives the location of GigaSpaces Technologies system directories and provides various utilities for finding files and directories


Field Summary
static java.lang.String GS_GRID_BOOT_LIB
           
static java.lang.String GS_GRID_LIB
           
static java.lang.String GS_HOME
           
static java.lang.String GS_JINI_LIB
           
static java.lang.String GS_LIB
           
 
Constructor Summary
Locator()
           
 
Method Summary
static java.lang.String checkDirFormat(java.lang.String dir)
          Make sure the directory exists, that read access is permitted and the name has a File.separator as it's last character
static java.util.Properties deriveDirectories(java.lang.Class clazz)
          Derive the location of product directories based on a class We fill a properties object with all the product directories variables.
static java.lang.String derivePath(java.lang.String fileName)
          Derive the location of a file or subdirectory, starting from the GigaSpaces base directory and scanning sub-directories.
static java.lang.String derivePath(java.lang.String baseDir, java.lang.String fileName)
          Derive the location of a file or subdirectory, starting from the GigaSpaces base directory and scanning sub-directories.
static java.lang.String getGSDeploymentDir()
          Derive the location of the "deployment" directory in the distribution.
static java.lang.String includes(java.lang.String fileName)
          The import utility provides a specialized enabler to include a file into a deployment descriptor.
static java.lang.String readFile(java.lang.String fileName)
          Read the contents of the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GS_HOME

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

GS_LIB

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

GS_GRID_LIB

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

GS_GRID_BOOT_LIB

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

GS_JINI_LIB

public static final java.lang.String GS_JINI_LIB
See Also:
Constant Field Values
Constructor Detail

Locator

public Locator()
Method Detail

deriveDirectories

public static java.util.Properties deriveDirectories(java.lang.Class clazz)
Derive the location of product directories based on a class We fill a properties object with all the product directories variables. We set the following variables: com.gs.home com.gigaspaces.lib com.gigaspaces.grid.lib com.gigaspaces.jini.lib That is populated only once because of performance reasons


derivePath

public static java.lang.String derivePath(java.lang.String fileName)
Derive the location of a file or subdirectory, starting from the GigaSpaces base directory and scanning sub-directories.

Parameters:
fileName - The file name to locate. This parameter must not be null
Returns:
The first occurance of the file will be returned, as a cannonical path. If not found, null is returned

getGSDeploymentDir

public static java.lang.String getGSDeploymentDir()
                                           throws java.io.IOException
Derive the location of the "deployment" directory in the distribution. The location found as follows:
 $GS_HOME/config/deployment
 

Returns:
The first occurance of the subdirectory named "deployment", as a cannonical path. If not found, null is returned
Throws:
java.io.IOException

includes

public static java.lang.String includes(java.lang.String fileName)
The import utility provides a specialized enabler to include a file into a deployment descriptor. Although it is a general use method, it will only locate files that are in the subdirectory found as follows:
 $GS_HOME/config/deployment/includes
 


derivePath

public static java.lang.String derivePath(java.lang.String baseDir,
                                          java.lang.String fileName)
Derive the location of a file or subdirectory, starting from the GigaSpaces base directory and scanning sub-directories.

Parameters:
fileName - The file name to locate. This parameter must not be null
baseDir - The directory to base/start the location from. Must not be null. If the value start wih a "$", the value is interpreted as a System property. If the
Returns:
The first occurance of the file will be returned, as a cannonical path. If not found, null is returned

readFile

public static java.lang.String readFile(java.lang.String fileName)
Read the contents of the file.

Parameters:
fileName - The name of the file to locate and read from. This parameter must not be null
Returns:
A String containing the contents of the file, if the fileName was indeed found. If the file was not found then an empty String is returned.

checkDirFormat

public static java.lang.String checkDirFormat(java.lang.String dir)
Make sure the directory exists, that read access is permitted and the name has a File.separator as it's last character

Parameters:
dir - A non-null String
Returns:
A String appended with File.separator as it's last character
Throws:
java.lang.NullPointerException - if the dir param is null
java.lang.IllegalArgumentException - if the dir directory does not exist or cannot be read from


Copyright (c) 2007 GigaSpaces Technologies, Inc.
All Rights Reserved.