com.sun.enterprise.admin.cli.cluster
Class LocalInstanceCommand

java.lang.Object
  extended by com.sun.enterprise.admin.cli.CLICommand
      extended by com.sun.enterprise.admin.cli.LocalServerCommand
          extended by com.sun.enterprise.admin.cli.cluster.LocalInstanceCommand
All Implemented Interfaces:
org.jvnet.hk2.component.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. ||---- ||---- nodes (nodeDirRoot, --nodedir) ||---- (nodeDirChild, --node) || ---- agent || ---- config | ---- das.properties || ---- (instanceDir) ||---- config ||---- applications ||---- java-web-start ||---- generated ||---- lib ||---- docroot || ---- (instanceDir) ||---- (nodeDirChild)

Author:
Byron Nevins

Field Summary
protected  boolean checkOneAndOnly
           
protected  java.lang.String domainName
           
protected  java.io.File instanceDir
           
protected  java.lang.String instanceName
           
protected  boolean isCreateInstanceFilesystem
           
protected  java.lang.String node
           
protected  java.lang.String nodeDir
           
protected  java.io.File nodeDirChild
           
protected  java.io.File nodeDirRoot
           
 
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
LocalInstanceCommand()
           
 
Method Summary
protected  java.util.Properties getDasProperties(java.io.File propfile)
           
protected  java.lang.String getInstallRootPath()
          Gets the GlassFish installation root (using property com.sun.aas.installRoot), first from asenv.conf.
protected  InstanceDirs getInstanceDirs()
           
protected  java.io.File getMasterPasswordFile()
           
protected  java.lang.String getNodeInstallDir()
           
protected  java.lang.String getProductRootPath()
          Gets the GlassFish product installation root (using property com.sun.aas.productRoot), first from asenv.conf.
protected  void initInstance()
           
protected  boolean isDirectory(java.io.File f)
          Override this method if your class does NOT want CommandException thrown if directory does not exist.
protected  boolean mkdirs(java.io.File f)
          Override this method if your class does NOT want to create directories
protected  void setDasDefaults(java.io.File propfile)
          Set the programOpts based on the das.properties file.
protected  boolean setServerDirs()
          Override this method if your class does NOT want to set ServerDirs
protected  void validate()
           
protected  void validateDasOptions(java.lang.String hostOption, java.lang.String portOption, java.lang.String isSecureOption, java.io.File propfile)
          Checks if programOpts values match das.properties file.
protected  void whackFilesystem()
           
 
Methods inherited from class com.sun.enterprise.admin.cli.LocalServerCommand
checkForSpecialFiles, getAdminAddress, getAdminAddress, getDomainXml, getMasterPassword, getPrevPid, getServerDirs, getUptime, isRestartable, isRunning, isRunning, isRunning, isThisServer, loadAndVerifyKeystore, readFromMasterPasswordFile, resetServerDirs, setLocalPassword, setServerDirs, unsetLocalPassword, verifyMasterPassword, waitForRestart
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nodeDir

protected java.lang.String nodeDir

node

protected java.lang.String node

instanceName

protected java.lang.String instanceName

nodeDirRoot

protected java.io.File nodeDirRoot

nodeDirChild

protected java.io.File nodeDirChild

instanceDir

protected java.io.File instanceDir

domainName

protected java.lang.String domainName

isCreateInstanceFilesystem

protected boolean isCreateInstanceFilesystem

checkOneAndOnly

protected boolean checkOneAndOnly
Constructor Detail

LocalInstanceCommand

public LocalInstanceCommand()
Method Detail

validate

protected void validate()
                 throws CommandException,
                        CommandValidationException
Overrides:
validate in class CLICommand
Throws:
CommandException
CommandValidationException

mkdirs

protected boolean mkdirs(java.io.File f)
Override this method if your class does NOT want to create directories

Parameters:
f - the directory to create

isDirectory

protected boolean isDirectory(java.io.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(java.io.File propfile)
                             throws CommandException
Set the programOpts based on the das.properties file.

Throws:
CommandException

validateDasOptions

protected final void validateDasOptions(java.lang.String hostOption,
                                        java.lang.String portOption,
                                        java.lang.String isSecureOption,
                                        java.io.File propfile)
                                 throws CommandException
Checks if programOpts values match das.properties file.

Throws:
CommandException

getDasProperties

protected final java.util.Properties getDasProperties(java.io.File propfile)
                                               throws CommandException
Throws:
CommandException

whackFilesystem

protected final void whackFilesystem()
                              throws CommandException
Throws:
CommandException

getInstallRootPath

protected java.lang.String getInstallRootPath()
                                       throws CommandException
Gets the GlassFish installation root (using property com.sun.aas.installRoot), first from asenv.conf. If that's not available, then from java.lang.System.

Returns:
path of GlassFish install root
Throws:
CommandException - if the GlassFish install root is not found

getProductRootPath

protected java.lang.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 java.lang.String getNodeInstallDir()
                                      throws CommandException
Throws:
CommandException

getMasterPasswordFile

protected java.io.File getMasterPasswordFile()
Overrides:
getMasterPasswordFile in class LocalServerCommand


Copyright © 2012 GlassFish Community. All Rights Reserved.