Class Env
package: net.jxta.myjxta.util
public class Env
A class that defined various environment variables
Version:
$Id: Env.java,v 1.11 2005/06/08 07:30:29 gonzo Exp $
Author:
james todd [gonzo at jxta dot org]
Field Summary
public final static String
public final static String
public final static String
public final static String
public final static String
public final static int
public final static String
public final static String
public final static String
private final static String
public final static String
public final static String
   The directory in which preference and configuration info is saved
 
private static boolean
private final static Logger
public final static String
private static String
private static boolean
public final static int
public final static int
public final static String
   The directory relative to which all path information is handled
 
private static URI
   Home directory for configuration and log files.
 
public final static String
   The environment string that indicated the selected password
 
public final static String
public final static int
   The number of minutes before we res-send a ping signal on the ManyToMany Chat
 
public final static String
   The ping message to send
 
public final static String
   The file the contains configuration information written by the platform code
 
public final static String
public final static String
public final static String
public final static String
   The environment string that indicates the user name
 
public final static String
public final static String
public final static String
   The directory structure under which runtime config and property files reside
 
public final static String
public final static String
public final static String
public final static int
   The interval between tree updates in minutes
 
private final static String
Method Summary
private static void
createFile(File newFile, String sourceFilePath)
public static URL
   Returns the URL of the current configuration file.
 
public static URI
   Returns the URI path of the Home Directory.
 
public static String
   Returns the Canonical path of the Home Directory if possible; otherwise, returns the Absolute path.
 
public static String
public static URL
   Return the path to platform specific configuration file
 
private static String
initHomeBase(String base)
   Initializes base directory URI, myjxta, and returns a String representing the URI.
 
public static void
   Initialzes the Env object with a default preference directory of HOME and a preference path
 
public static synchronized void
initialize(String base)
   Initializes the Env class attributes, ensures that required files exists and initializes Log4J logging.
 
private static void
initLog4JConfig(String dirPath)
   Ensures that the Log4J config file exists.
 
private static void
initMyJxtaConfig(String homeBase)
   Ensures that the application config file exists in the base directory.
 
public static boolean
   Returns true if the log4j config file pointed to by log4jConfigFilePath has a ".xml" extension, and false otherwise.
 
public static void
setReconfigure(boolean reconfigure)
   Creates or deletes a Reconfigure file (home/reconf) depending on whether the reconfigure param is true or false, respectively.
 
Field Detail
ADMINISTRATION_PORT
public final static String ADMINISTRATION_PORT = "myjxta.sid"

CMS
public final static String CMS = "data"

CONFIGURATION
public final static String CONFIGURATION = "profile.xml"

CONFIG_URL
public final static String CONFIG_URL = "net.jxta.myjxta.config.url"

CONSTANTS
public final static String CONSTANTS = "/net/jxta/myjxta/resources/myjxta.xml"

DEFAULT_ADMINISTRATION_PORT
public final static int DEFAULT_ADMINISTRATION_PORT = 10701

DEFAULT_CONFIG
public final static String DEFAULT_CONFIG = "file:conf/PublicAdminRules.xml"

DEFAULT_CONFIGURATION
public final static String DEFAULT_CONFIGURATION = "/net/jxta/myjxta/resources/" + CONFIGURATION

DEFAULT_LOG4J
public final static String DEFAULT_LOG4J = "/net/jxta/myjxta/resources/" + LOG4J

FILE_SCHEME
private final static String FILE_SCHEME = "file"

FREETTS
public final static String FREETTS = "net.jxta.myjxta.freetts"

HOME
public final static String HOME = ".myjxta"
The directory in which preference and configuration info is saved

isInitialized
private static boolean isInitialized = false

LOG
private final static Logger LOG = Logger.getLogger(Env.class)

LOG4J
public final static String LOG4J = "log4j.xml"

log4jConfigFilePath
private static String log4jConfigFilePath = null

log4jConfigFileXml
private static boolean log4jConfigFileXml = false

MAX_ADMINISTRATION_PORT_TRY
public final static int MAX_ADMINISTRATION_PORT_TRY = 1000

MAX_ADMINISTRATION_TIME
public final static int MAX_ADMINISTRATION_TIME = 7 * 1000

MYJXTA
public final static String MYJXTA = "JXTA_HOME"
The directory relative to which all path information is handled

myjxta
private static URI myjxta = null
Home directory for configuration and log files.

PASSWORD
public final static String PASSWORD = "net.jxta.tls.password"
The environment string that indicated the selected password

PING_COMMAND
public final static String PING_COMMAND = "ping"

PING_INTERVAL
public final static int PING_INTERVAL = 5
The number of minutes before we res-send a ping signal on the ManyToMany Chat

PING_MESSAGE
public final static String PING_MESSAGE = "**** ping ****"
The ping message to send

PLATFORM
public final static String PLATFORM = "PlatformConfig"
The file the contains configuration information written by the platform code

PLATFORM_CONFIG
public final static String PLATFORM_CONFIG = "config.properties"

PLATFORM_CONFIG_COMMENT
public final static String PLATFORM_CONFIG_COMMENT = "generated from myjxta.xml"

PREFERENCES
public final static String PREFERENCES = "java.util.prefs.userRoot"

PRINCIPAL
public final static String PRINCIPAL = "net.jxta.tls.principal"
The environment string that indicates the user name

PSE
public final static String PSE = "pse"

RECONFIGURE
public final static String RECONFIGURE = "reconf"

RESOURCES
public final static String RESOURCES = "/resources/"
The directory structure under which runtime config and property files reside

SHARE
public final static String SHARE = "share"

TCP_PORT
public final static String TCP_PORT = System.getProperty("jxta.tcp.port")

TMP
public final static String TMP = "tmp"

TREE_UPDATE_PERIOD
public final static int TREE_UPDATE_PERIOD = 3
The interval between tree updates in minutes

URI_DELIMITER
private final static String URI_DELIMITER = ":/"
Method Detail
createFile
private static void createFile(File newFile, String sourceFilePath)
Throws:
IOException

getConfiguration
public static URL getConfiguration()
Returns the URL of the current configuration file.

getHome
public static URI getHome()
Returns the URI path of the Home Directory.

getHomeDirPath
public static String getHomeDirPath()
Returns the Canonical path of the Home Directory if possible; otherwise, returns the Absolute path.

getLog4jConfigFilePath
public static String getLog4jConfigFilePath()
Return:
Returns the log4jConfigFilePath.

getPlatform
public static URL getPlatform()
Return the path to platform specific configuration file
Return:
the path to the platform specific configuration file

initHomeBase
private static String initHomeBase(String base)
Initializes base directory URI, myjxta, and returns a String representing the URI.
Parameters:
base the base directory for the configuration information, relative to the user's home directory.

initialize
public static void initialize()
Initialzes the Env object with a default preference directory of HOME and a preference path

initialize
public static synchronized void initialize(String base)
Initializes the Env class attributes, ensures that required files exists and initializes Log4J logging.
Parameters:
base the base directory for the configuration information, relative to the user's home directory.

initLog4JConfig
private static void initLog4JConfig(String dirPath)
Ensures that the Log4J config file exists.
Looks first for a log4j.properties configuration file, then for a log4j.xml file.
Parameters:
dirPath The base directory for the config file, relative to the user's home directory.

initMyJxtaConfig
private static void initMyJxtaConfig(String homeBase)
Ensures that the application config file exists in the base directory.
Parameters:
homeBase The base directory for the configuration information, relative to the user's home directory.

isLog4jConfigFileXml
public static boolean isLog4jConfigFileXml()
Returns true if the log4j config file pointed to by log4jConfigFilePath has a ".xml" extension, and false otherwise.

setReconfigure
public static void setReconfigure(boolean reconfigure)
Creates or deletes a Reconfigure file (home/reconf) depending on whether the reconfigure param is true or false, respectively.
Parameters:
reconfigure If true, a new Reconfigure file is created; otherwise, the existing Reconfigure file is deleted.