Package com.sun.enterprise.util.io
Class ServerDirs
java.lang.Object
com.sun.enterprise.util.io.ServerDirs
The hierarchy of directories above a running DAS or server instance can get
messy to deal with -- thus this class. This class is a bullet-proof holder of
that information.
Instances and DAS are arranged differently:
examples:
DAS
domainDir = getServerDir() == C:/glassfish8/glassfish/domains/domain1
domainsDir = getServerParentDir() == C:/glassfish8/glassfish/domains
grandparent-dir is meaningless
Instance
instanceDir = getServerDir() == C:/glassfish8/glassfish/nodes/mymachine/instance1
agentDir = getServerParentDir() == C:/glassfish8/glassfish/nodes/mymachine
agentsDir = getServerGrandParentDir() == C:/glassfish8/glassfish/nodes
Currently in all cases the name of the serverDir is the name of the server --
by our definition.
THIS CLASS IS GUARANTEED THREAD SAFE
THIS CLASS IS GUARANTEED IMMUTABLE
Contract: Caller is supposed to NOT call methods on an instance of this class.
It's "advanced java" to be able to do that anyway.
I don't allow half-baked data out. It's all or none. The "valid" flag
is checked and if invalid -- all methods return null. They don't throw an Exception
because the caller is not supposed to call the methods - it would just annoy
the caller.
- Since:
- 3.1 Created: April 19, 2010
- Author:
- Byron Nevins
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ServerDirs
public ServerDirs() -
ServerDirs
- Throws:
IOException
-
-
Method Details
-
getServerName
- Returns:
- domain name or instance name
-
refresh
- Throws:
IOException
-
getServerDir
-
getAgentDir
-
getServerParentDir
-
getServerGrandParentDir
-
getDomainXml
-
getConfigDir
-
getPidFile
If the server is running, must exist. If the server is stopped, shoud be deleted, but it cannot be guaranteed.- Returns:
- file containing the process ID.
-
getLastPidFile
If the server is running, must exist. If the server is stopped, shoud be deleted, but it cannot be guaranteed.- Returns:
- file containing the process ID.
-
getDasPropertiesFile
-
getLocalPassword
-
getLocalPasswordFile
-
isValid
public final boolean isValid() -
toString
-