|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.enterprise.admin.cli.CLICommand
com.sun.enterprise.admin.cli.LocalServerCommand
public abstract class LocalServerCommand
A class that's supposed to capture all the behavior common to operation on a "local" server. It's getting fairly complicated thus the "section headers" comments. This class plays two roles,
| Field Summary | |
|---|---|
private ServerDirs |
serverDirs
|
private static LocalStringsImpl |
strings
|
| Fields inherited from class com.sun.enterprise.admin.cli.CLICommand |
|---|
argv, commandModel, CONNECTION_ERROR, env, ERROR, INVALID_COMMAND_ERROR, logger, metadataErrors, name, operands, options, passwords, programOpts, SUCCESS, WARNING |
| Constructor Summary | |
|---|---|
LocalServerCommand()
|
|
| Method Summary | |
|---|---|
protected boolean |
checkForSpecialFiles()
Override this method and return false to turn-off the file validation. |
protected HostAndPort |
getAdminAddress()
Returns the admin address of the local domain. |
protected HostAndPort |
getAdminAddress(String serverName)
Returns the admin address of a particular server. |
protected File |
getDomainXml()
|
private File |
getJKS()
|
protected String |
getMasterPassword()
Get the master password, either from a password file or by asking the user. |
protected File |
getMasterPasswordFile()
|
protected int |
getPrevPid()
|
protected ServerDirs |
getServerDirs()
|
private File |
getUniquePath(File f)
|
protected long |
getUptime()
Get uptime from the server. |
protected boolean |
isRestartable()
See if the server is restartable As of March 2011 -- this only returns false if a passwordfile argument was given when the server started -- but it is no longer available - i.e. |
protected boolean |
isRunning()
Is the server still running? This is only called when we're hanging around waiting for the server to die. |
protected boolean |
isRunning(int port)
convenience method for the local machine |
protected boolean |
isRunning(String host,
int port)
There is sometimes a need for subclasses to know if a local domain is running. |
private boolean |
isRunningByCheckingForPidFile()
Is the server still running? This is only called when we're hanging around waiting for the server to die. |
private boolean |
isRunningUsingJps()
Is the server still running? This is only called when we're hanging around waiting for the server to die. |
protected boolean |
isThisServer(File ourDir,
String directoryKey)
See if the server is alive and is the one at the specified directory. |
protected boolean |
loadAndVerifyKeystore(File jks,
String mpv)
|
private long |
parseUptime(String up)
The remote uptime command returns a string like: Uptime: 10 minutes, 53 seconds, Total milliseconds: 653859\n We find that last number and extract it. |
protected String |
readFromMasterPasswordFile()
Checks if the create-domain was created using --savemasterpassword flag which obtains security by obfuscation! Returns null in case of failure of any kind. |
protected void |
resetServerDirs()
|
private String |
retry(int times)
|
protected void |
setLocalPassword()
|
protected void |
setServerDirs(ServerDirs sd)
|
protected void |
unsetLocalPassword()
|
private boolean |
usingLocalPassword()
|
protected boolean |
verifyMasterPassword(String mpv)
|
protected void |
waitForRestart(File pwFile,
long oldTimeStamp,
long uptimeOldServer)
|
private void |
waitForRestartLocal(File pwFile,
long oldTimeStamp,
long uptimeOldServer)
Wait for the local server to restart. |
private void |
waitForRestartRemote(long uptimeOldServer)
Wait for the remote server to restart. |
| Methods inherited from class com.sun.enterprise.admin.cli.CLICommand |
|---|
checkHelp, execute, executeCommand, getBooleanOption, getCommand, getManPage, getName, getOperandModel, getOption, getPassword, getProgramOptions, getSystemProperties, getSystemProperty, getUsage, initializeLogger, initializePasswords, inject, ok, parse, postConstruct, prepare, prevalidate, printExceptionStackTrace, processProgramOptions, quote, readPassword, toString, usageOptions, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private ServerDirs serverDirs
private static final LocalStringsImpl strings
| Constructor Detail |
|---|
public LocalServerCommand()
| Method Detail |
|---|
protected boolean checkForSpecialFiles()
protected final HostAndPort getAdminAddress() throws CommandException
CommandException - in case of parsing errorsprotected final HostAndPort getAdminAddress(String serverName) throws CommandException
CommandException - in case of parsing errorsprotected final void setServerDirs(ServerDirs sd)
protected final void setLocalPassword()
protected final void unsetLocalPassword()
protected final void resetServerDirs() throws IOException
IOExceptionprotected final ServerDirs getServerDirs()
protected final File getDomainXml()
protected final String readFromMasterPasswordFile()
protected final boolean verifyMasterPassword(String mpv)
protected boolean loadAndVerifyKeystore(File jks, String mpv)
protected final String getMasterPassword() throws CommandException
CommandExceptionprotected final boolean isThisServer(File ourDir, String directoryKey)
protected final boolean isRunning(String host, int port)
local domain is running. An example of such a command is
change-master-password command. The stop-domain command also needs to
know if a domain is running without having to provide user
name and password on command line (this is the case when I own a domain
that has non-default admin user and password) and want to stop it
without providing it.
In such cases, we need to know if the domain is running and this method provides a way to do that.
protected final boolean isRunning(int port)
protected boolean isRunning()
protected final void waitForRestart(File pwFile, long oldTimeStamp, long uptimeOldServer) throws CommandException
CommandExceptionprotected final int getPrevPid()
private final boolean isRunningUsingJps()
private boolean isRunningByCheckingForPidFile()
private void waitForRestartLocal(File pwFile, long oldTimeStamp, long uptimeOldServer) throws CommandException
CommandExceptionprivate void waitForRestartRemote(long uptimeOldServer) throws CommandException
CommandExceptionprotected final long getUptime() throws CommandException
CommandExceptionprotected final boolean isRestartable() throws CommandException
CommandExceptionprivate long parseUptime(String up)
private boolean usingLocalPassword()
private final File getJKS()
protected File getMasterPasswordFile()
private String retry(int times) throws CommandException
CommandExceptionprivate File getUniquePath(File f)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||