|
||||||||||
| 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(java.lang.String serverName)
Returns the admin address of a particular server. |
protected java.io.File |
getDomainXml()
|
private java.io.File |
getJKS()
|
protected java.lang.String |
getMasterPassword()
Get the master password, either from a password file or by asking the user. |
protected java.io.File |
getMasterPasswordFile()
|
protected int |
getPrevPid()
|
protected ServerDirs |
getServerDirs()
|
private java.io.File |
getUniquePath(java.io.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(java.lang.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(java.io.File ourDir,
java.lang.String directoryKey)
See if the server is alive and is the one at the specified directory. |
protected boolean |
loadAndVerifyKeystore(java.io.File jks,
java.lang.String mpv)
|
private long |
parseUptime(java.lang.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 java.lang.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 java.lang.String |
retry(int times)
|
protected void |
setLocalPassword()
|
protected void |
setServerDirs(ServerDirs sd)
|
protected void |
unsetLocalPassword()
|
private boolean |
usingLocalPassword()
|
protected boolean |
verifyMasterPassword(java.lang.String mpv)
|
protected void |
waitForRestart(java.io.File pwFile,
long oldTimeStamp,
long uptimeOldServer)
|
private void |
waitForRestartLocal(java.io.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(java.lang.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 java.io.IOException
java.io.IOExceptionprotected final ServerDirs getServerDirs()
protected final java.io.File getDomainXml()
protected final java.lang.String readFromMasterPasswordFile()
protected final boolean verifyMasterPassword(java.lang.String mpv)
protected boolean loadAndVerifyKeystore(java.io.File jks, java.lang.String mpv)
protected final java.lang.String getMasterPassword() throws CommandException
CommandExceptionprotected final boolean isThisServer(java.io.File ourDir, java.lang.String directoryKey)
protected final boolean isRunning(java.lang.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(java.io.File pwFile, long oldTimeStamp, long uptimeOldServer) throws CommandException
CommandExceptionprotected final int getPrevPid()
private final boolean isRunningUsingJps()
private boolean isRunningByCheckingForPidFile()
private void waitForRestartLocal(java.io.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(java.lang.String up)
private boolean usingLocalPassword()
private final java.io.File getJKS()
protected java.io.File getMasterPasswordFile()
private java.lang.String retry(int times) throws CommandException
CommandExceptionprivate java.io.File getUniquePath(java.io.File f)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||