Class LocalInstanceCommand
- java.lang.Object
-
- com.sun.enterprise.admin.cli.CLICommand
-
- com.sun.enterprise.admin.servermgmt.cli.LocalServerCommand
-
- com.sun.enterprise.admin.cli.cluster.LocalInstanceCommand
-
- All Implemented Interfaces:
org.glassfish.hk2.api.PostConstruct
- Direct Known Subclasses:
ChangeNodeMasterPasswordCommand,CreateLocalInstanceFilesystemCommand,DeleteInstanceFilesystem,DeleteLocalInstanceCommand,ImportSyncBundleCommand,StopLocalInstanceCommand,SynchronizeInstanceCommand,ValidateDasOptions
public abstract class LocalInstanceCommand extends LocalServerCommand
A base class for local commands that manage a local server instance. This base class is used by a LOT of other classes. There is a big comment before each section of the file -- sorted by visibility. If you specifically want a method to be overridden -- make it protected but not final. final protected means -- "call me but don't override me". This convention is to make things less confusing. If you add a method or change whether it is final -- move it to the right section. Default instance file structure.||---- <GlassFish Install Root> ||---- nodes (nodeDirRoot, --nodedir) ||---- <node-1> (nodeDirChild, --node) || ---- agent || ---- config | ---- das.properties || ---- <instance-1> (instanceDir) ||---- config ||---- applications ||---- java-web-start ||---- generated ||---- lib ||---- docroot || ---- <instance-2> (instanceDir) ||---- <node-2> (nodeDirChild)- Author:
- Byron Nevins
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancheckOneAndOnlyprotected StringdomainNameprotected FileinstanceDirprotected StringinstanceNameprotected booleanisCreateInstanceFilesystemprotected Stringnodeprotected StringnodeDirprotected FilenodeDirChildprotected FilenodeDirRoot-
Fields inherited from class com.sun.enterprise.admin.servermgmt.cli.LocalServerCommand
DEFAULT_MASTER_PASSWORD
-
Fields inherited from class com.sun.enterprise.admin.cli.CLICommand
argv, ASADMIN, commandModel, CONNECTION_ERROR, env, ERROR, INVALID_COMMAND_ERROR, lineReader, logger, metadataErrors, name, operands, options, passwords, programOpts, SUCCESS, terminal, WARNING
-
-
Constructor Summary
Constructors Constructor Description LocalInstanceCommand()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PropertiesgetDasProperties(File propfile)protected InstanceDirsgetInstanceDirs()StringgetInstanceName()protected FilegetMasterPasswordFile()protected StringgetNodeInstallDir()protected PropertiesgetNodeProperties(File propertyFile)protected StringgetProductRootPath()Gets the GlassFish product installation root (using property com.sun.aas.productRoot), first from asenv.conf.protected voidinitInstance()protected booleanisDirectory(File f)Override this method if your class does NOT want CommandException thrown if directory does not exist.protected booleanmkdirs(File f)Override this method if your class does NOT want to create directoriesprotected voidsetDasDefaults(File propfile)Set the programOpts based on the das.properties file.voidsetInstanceName(String instanceName)protected booleansetServerDirs()Override this method if your class does NOT want to set ServerDirsprotected voidvalidate()The validate method can be used by a subclass to validate that the type and quantity of parameters and operands matches the requirements for this command.protected voidvalidateDasOptions(String hostOption, String portOption, String isSecureOption, File propfile)Checks if programOpts values match das.properties file.protected voidwhackFilesystem()-
Methods inherited from class com.sun.enterprise.admin.servermgmt.cli.LocalServerCommand
checkAdditionalTrustAndKeyStores, checkForSpecialFiles, dataGridEncryptionEnabled, getAdminAddress, getAdminAddress, getDomainXml, getInstallRootPath, getMasterPassword, getPrevPid, getServerDirs, getServerPid, getUptime, isLocal, isRemote, isRestartable, isRunning, isRunning, isThisServer, loadAndVerifyKeystore, readFromMasterPasswordFile, resetServerDirs, setLocalPassword, setServerDirs, unsetLocalPassword, verifyMasterPassword, waitForRestart, waitForRestart
-
Methods inherited from class com.sun.enterprise.admin.cli.CLICommand
buildLineReader, buildTerminal, checkHelp, closeTerminal, execute, execute, executeCommand, expandManPage, getBooleanOption, getBriefCommandUsage, getCommand, getCommand, getCommandScope, getCommandUsage, getManPage, getName, getOperandModel, getOption, getOptions, getPassword, getPassword, getProgramOptions, getSystemProperties, getSystemProperty, getUsage, initializeLogger, initializePasswords, inject, newLineReaderBuilder, ok, parse, postConstruct, prepare, prevalidate, printExceptionStackTrace, processProgramOptions, quote, readPassword, setCommandScope, toString, usageOptions
-
-
-
-
Field Detail
-
nodeDir
protected String nodeDir
-
node
protected String node
-
instanceName
protected String instanceName
-
nodeDirRoot
protected File nodeDirRoot
-
nodeDirChild
protected File nodeDirChild
-
instanceDir
protected File instanceDir
-
domainName
protected String domainName
-
isCreateInstanceFilesystem
protected boolean isCreateInstanceFilesystem
-
checkOneAndOnly
protected boolean checkOneAndOnly
-
-
Method Detail
-
validate
protected void validate() throws CommandException, CommandValidationExceptionDescription copied from class:CLICommandThe validate method can be used by a subclass to validate that the type and quantity of parameters and operands matches the requirements for this command.- Overrides:
validatein classCLICommand- Throws:
CommandException- if execution of the command failsCommandValidationException- if there's something wrong with the options or arguments
-
mkdirs
protected boolean mkdirs(File f)
Override this method if your class does NOT want to create directories- Parameters:
f- the directory to create- Returns:
- true iff the directory was created
-
isDirectory
protected boolean isDirectory(File f)
Override this method if your class does NOT want CommandException thrown if directory does not exist.- Parameters:
f- directory to check
-
setServerDirs
protected boolean setServerDirs()
Override this method if your class does NOT want to set ServerDirs
-
initInstance
protected void initInstance() throws CommandException- Throws:
CommandException
-
getInstanceDirs
protected final InstanceDirs getInstanceDirs()
-
setDasDefaults
protected final void setDasDefaults(File propfile) throws CommandException
Set the programOpts based on the das.properties file.- Throws:
CommandException
-
validateDasOptions
protected final void validateDasOptions(String hostOption, String portOption, String isSecureOption, File propfile) throws CommandException
Checks if programOpts values match das.properties file.- Throws:
CommandException
-
getDasProperties
protected final Properties getDasProperties(File propfile) throws CommandException
- Throws:
CommandException
-
getNodeProperties
protected final Properties getNodeProperties(File propertyFile) throws CommandException
- Throws:
CommandException
-
whackFilesystem
protected final void whackFilesystem() throws CommandException- Throws:
CommandException
-
getProductRootPath
protected String getProductRootPath() throws CommandException
Gets the GlassFish product installation root (using property com.sun.aas.productRoot), first from asenv.conf. If that's not available, then from java.lang.System. This will typically be the parent of the glassfish install root- Returns:
- path of GlassFish product install root
- Throws:
CommandException- if the GlassFish install root is not found
-
getNodeInstallDir
protected String getNodeInstallDir() throws CommandException
- Throws:
CommandException
-
getMasterPasswordFile
protected File getMasterPasswordFile()
- Overrides:
getMasterPasswordFilein classLocalServerCommand
-
getInstanceName
public String getInstanceName()
- Returns:
- the instanceName
-
setInstanceName
public void setInstanceName(String instanceName)
- Parameters:
instanceName- the instanceName to set
-
-