Package org.glassfish.deployment.client
Class AbstractDeploymentFacility
- java.lang.Object
-
- org.glassfish.deployment.client.AbstractDeploymentFacility
-
- All Implemented Interfaces:
DeploymentFacility,TargetOwner
- Direct Known Subclasses:
RemoteDeploymentFacility
public abstract class AbstractDeploymentFacility extends Object implements DeploymentFacility, TargetOwner
Provides common behavior for the local and remote deployment facilities.Code that needs an instance of a remote deployment facility use the
DeploymentFacilityFactory.- Author:
- tjquinn, David Matejcek
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAbstractDeploymentFacility.DFCommandRunnerDefines behavior implemented in the local or remote deployment facility for actually executing the requested command.
-
Field Summary
Fields Modifier and Type Field Description static LoggerdeplLoggerShared deployment logger: "javax.enterprise.system.tools.deployment.client"-
Fields inherited from interface org.glassfish.deployment.client.DeploymentFacility
STUBS_JARFILENAME
-
-
Constructor Summary
Constructors Constructor Description AbstractDeploymentFacility()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description javax.enterprise.deploy.spi.TargetModuleID[]_listAppRefs(String[] targets)list all application refs that are present in the provided list of targetsjavax.enterprise.deploy.spi.TargetModuleID[]_listAppRefs(String[] targets, String state)list all application refs that are present in the provided list of targets with the specified statejavax.enterprise.deploy.spi.TargetModuleID[]_listAppRefs(String[] targets, String state, String type)list all application refs that are present in the provided list of targets with the specified state and specified typejavax.enterprise.deploy.spi.TargetModuleID[]_listAppRefs(javax.enterprise.deploy.spi.Target[] targets, String state, String type)list all application refs that are present in the provided list of targets with the specified state and specified typeprotected DFProgressObjectchangeState(javax.enterprise.deploy.spi.Target[] targets, String moduleID, String commandName, String action)Changes the state of an application.booleanconnect(ServerConnectionIdentifier targetDAS)Connects the deployment facility to the DAS.DFProgressObjectcreateAppRef(javax.enterprise.deploy.spi.Target[] targets, String moduleID, Map options)Add an application ref on the selected targetsjavax.enterprise.deploy.spi.TargetcreateTarget(String name)Creates a singleTargetwith the given name.javax.enterprise.deploy.spi.Target[]createTargets(String[] targets)Creates an array of Target objects corresponding to the list of target names.DFProgressObjectdeleteAppRef(javax.enterprise.deploy.spi.Target[] targets, String moduleID, Map options)remove the application ref for the provided list of targets.DFProgressObjectdeploy(javax.enterprise.deploy.spi.Target[] targets, URI source, URI deploymentPlan, Map origOptions)Initiates a deployment operation on the server, using a source archive abstraction and an optional deployment plan if the server specific information is not embedded in the source archive.DFProgressObjectdeploy(javax.enterprise.deploy.spi.Target[] targets, ReadableArchive source, ReadableArchive deploymentPlan, Map deploymentOptions)DFProgressObjectdisable(javax.enterprise.deploy.spi.Target[] targets, String moduleID)Disables an app on the specified targets.booleandisconnect()Disconnects the deployment facility from the DAS.protected abstract booleandoConnect()Performs any local- or remote-specific work related to connecting to the DAS.protected abstract booleandoDisconnect()Performs any local- or remote-specific work to end the connection to the DAS.StringdownloadFile(File location, String moduleID, String moduleURI)Downloads a particular file from the server repository.DFProgressObjectenable(javax.enterprise.deploy.spi.Target[] targets, String moduleID)Enables an app on the specified targets.StringexportClientStubs(String appName, String destDir)Exports the Client stub jars to the given location.voidgetClientStubs(String location, String moduleID)Downloads the client stubs from the server repository.StringgetContextRoot(String moduleName)Get context root for the moduleprotected abstract AbstractDeploymentFacility.DFCommandRunnergetDFCommandRunner(String commandName, DFDeploymentProperties commandOptions, String[] operands)Returns a command runner for the concrete implementation.HostAndPortgetHostAndPort(String target)get the host and port informationHostAndPortgetHostAndPort(String target, boolean securityEnabled)get the host and port information with security enabled attributeHostAndPortgetHostAndPort(String target, String moduleId, boolean securityEnabled)get the host and port information with the specified module id and security enabled attributejavax.enterprise.deploy.shared.ModuleTypegetModuleType(String moduleName)Get module type for the moduleList<String>getSubModuleInfoForJ2EEApplication(String appName)Get sub module info for earprotected ServerConnectionIdentifiergetTargetDAS()HostAndPortgetVirtualServerHostAndPort(String target, String virtualServer, boolean securityEnabled)get the host and port information with the specified virtual server and security enabled attributeStringgetWebURL(javax.enterprise.deploy.spi.TargetModuleID tmid)Returns the Web URL for the specified module on theTargetimplied by the TargetModuleID.booleanisConnected()Reports whether the deployment facility is connected.javax.enterprise.deploy.spi.TargetModuleID[]listAppRefs(String[] targets)list all application refs that are present in the provided list of targetsjavax.enterprise.deploy.spi.Target[]listReferencedTargets(String appName)list the referenced targets for applicationjavax.enterprise.deploy.spi.Target[]listTargets()list all targetsvoidsetWebURL(javax.enterprise.deploy.spi.TargetModuleID tmid, String webURL)Sets the Web URL for the specified module on theTargetimplied by the TargetModuleID.DFProgressObjectundeploy(javax.enterprise.deploy.spi.Target[] targets, String moduleID)Undeploys an application from specified targets.DFProgressObjectundeploy(javax.enterprise.deploy.spi.Target[] origTargets, String moduleID, Map origOptions)Undeploys an application from specified targets.DFDeploymentStatuswaitFor(DFProgressObject po)Convenient method to wait for the operation monitored by the progress object to complete, returning the final operation status.
-
-
-
Field Detail
-
deplLogger
public static final Logger deplLogger
Shared deployment logger: "javax.enterprise.system.tools.deployment.client"
-
-
Method Detail
-
getDFCommandRunner
protected abstract AbstractDeploymentFacility.DFCommandRunner getDFCommandRunner(String commandName, DFDeploymentProperties commandOptions, String[] operands) throws CommandException
Returns a command runner for the concrete implementation.- Parameters:
commandName-commandOptions-operands-- Returns:
AbstractDeploymentFacility.DFCommandRunner- Throws:
CommandException
-
changeState
protected DFProgressObject changeState(javax.enterprise.deploy.spi.Target[] targets, String moduleID, String commandName, String action)
Changes the state of an application.Used for enable and disable.
- Parameters:
targets- targets on which the change should occurmoduleID- name of the module affectedcommandName- enable or disableaction- name enabling or disabling- Returns:
- DFProgressObject the caller can use to monitor progress and query final status
-
doConnect
protected abstract boolean doConnect()
Performs any local- or remote-specific work related to connecting to the DAS.- Returns:
- true if the connection was made successfully; false otherwise
-
connect
public boolean connect(ServerConnectionIdentifier targetDAS)
Connects the deployment facility to the DAS.- Specified by:
connectin interfaceDeploymentFacility- Parameters:
targetDAS- the DAS to contact- Returns:
- true if the connection was made successfully; false otherwise
-
doDisconnect
protected abstract boolean doDisconnect()
Performs any local- or remote-specific work to end the connection to the DAS.- Returns:
- true if the disconnection succeeded; false otherwise
-
disconnect
public boolean disconnect()
Disconnects the deployment facility from the DAS.- Specified by:
disconnectin interfaceDeploymentFacility- Returns:
- true if the disconnection was successful; false otherwise
-
createAppRef
public DFProgressObject createAppRef(javax.enterprise.deploy.spi.Target[] targets, String moduleID, Map options)
Description copied from interface:DeploymentFacilityAdd an application ref on the selected targets- Specified by:
createAppRefin interfaceDeploymentFacility
-
deleteAppRef
public DFProgressObject deleteAppRef(javax.enterprise.deploy.spi.Target[] targets, String moduleID, Map options)
Description copied from interface:DeploymentFacilityremove the application ref for the provided list of targets.- Specified by:
deleteAppRefin interfaceDeploymentFacility
-
createTarget
public javax.enterprise.deploy.spi.Target createTarget(String name)
Description copied from interface:TargetOwnerCreates a singleTargetwith the given name.- Specified by:
createTargetin interfaceTargetOwner- Parameters:
name- the name of the Target to be returned- Returns:
- a new Target
-
createTargets
public javax.enterprise.deploy.spi.Target[] createTargets(String[] targets)
Description copied from interface:DeploymentFacilityCreates an array of Target objects corresponding to the list of target names.- Specified by:
createTargetsin interfaceDeploymentFacility- Specified by:
createTargetsin interfaceTargetOwner- Parameters:
targets- the names of the targets of interest- Returns:
- an array of Target objects for the selected target names
-
deploy
public DFProgressObject deploy(javax.enterprise.deploy.spi.Target[] targets, ReadableArchive source, ReadableArchive deploymentPlan, Map deploymentOptions) throws IOException
- Specified by:
deployin interfaceDeploymentFacility- Throws:
IOException
-
deploy
public DFProgressObject deploy(javax.enterprise.deploy.spi.Target[] targets, URI source, URI deploymentPlan, Map origOptions)
Description copied from interface:DeploymentFacilityInitiates a deployment operation on the server, using a source archive abstraction and an optional deployment plan if the server specific information is not embedded in the source archive. The deploymentOptions is a key-value pair map of deployment options for this operation.Once the deployment is successful, the TargetModuleID objects representing where the application now resides are available using the
ProgressObject.getResultTargetModuleIDs()method.- Specified by:
deployin interfaceDeploymentFacility- Parameters:
targets- the Target objects to which to deploy the application - an empty array indicates a request to deploy to the default serversource- URI to the Java EE module abstraction (with or without the server specific artifacts).deploymentPlan- URI to the optional deployment plan if the source archive is portable.origOptions- deployment options- Returns:
- a DFProgressObject to receive deployment events and status
-
disable
public DFProgressObject disable(javax.enterprise.deploy.spi.Target[] targets, String moduleID)
Disables an app on the specified targets.- Specified by:
disablein interfaceDeploymentFacility- Parameters:
targets- the targets on which to disable the appmoduleID- the app- Returns:
- DFProgressObject for monitoring progress and querying status
-
downloadFile
public String downloadFile(File location, String moduleID, String moduleURI) throws IOException
Description copied from interface:DeploymentFacilityDownloads a particular file from the server repository. The filePath is a relative path from the root directory of the deployed component identified with the moduleID parameter. The resulting downloaded file should be placed in the location directory keeping the relative path constraint.- Specified by:
downloadFilein interfaceDeploymentFacility- Parameters:
location- is the root directory where to place the downloaded filemoduleID- is the moduleID of the deployed component to download the file frommoduleURI- is the relative path to the file in the repository or STUBS_JARFILENAME to download the appclient jar file.- Returns:
- the downloaded local file absolute path.
- Throws:
IOException
-
enable
public DFProgressObject enable(javax.enterprise.deploy.spi.Target[] targets, String moduleID)
Enables an app on the specified targets.- Specified by:
enablein interfaceDeploymentFacility- Parameters:
targets- the targets on which to enable the appmoduleID- the app- Returns:
- DFProgressObject for monitoring progress and querying status
-
isConnected
public boolean isConnected()
Reports whether the deployment facility is connected.- Specified by:
isConnectedin interfaceDeploymentFacility- Returns:
- true if connected, false otherwise
-
getSubModuleInfoForJ2EEApplication
public List<String> getSubModuleInfoForJ2EEApplication(String appName) throws IOException
Description copied from interface:DeploymentFacilityGet sub module info for ear- Specified by:
getSubModuleInfoForJ2EEApplicationin interfaceDeploymentFacility- Throws:
IOException
-
getContextRoot
public String getContextRoot(String moduleName) throws IOException
Description copied from interface:DeploymentFacilityGet context root for the module- Specified by:
getContextRootin interfaceDeploymentFacility- Throws:
IOException
-
getModuleType
public javax.enterprise.deploy.shared.ModuleType getModuleType(String moduleName) throws IOException
Description copied from interface:DeploymentFacilityGet module type for the module- Specified by:
getModuleTypein interfaceDeploymentFacility- Throws:
IOException
-
listTargets
public javax.enterprise.deploy.spi.Target[] listTargets() throws IOExceptionDescription copied from interface:DeploymentFacilitylist all targets- Specified by:
listTargetsin interfaceDeploymentFacility- Throws:
IOException
-
listReferencedTargets
public javax.enterprise.deploy.spi.Target[] listReferencedTargets(String appName) throws IOException
Description copied from interface:DeploymentFacilitylist the referenced targets for application- Specified by:
listReferencedTargetsin interfaceDeploymentFacility- Throws:
IOException
-
getClientStubs
public void getClientStubs(String location, String moduleID) throws IOException
Description copied from interface:DeploymentFacilityDownloads the client stubs from the server repository.- Specified by:
getClientStubsin interfaceDeploymentFacility- Parameters:
location- is the root path where to place the downloaded stubsmoduleID- is the moduleID of the deployed component to download the stubs for- Throws:
IOException
-
getHostAndPort
public HostAndPort getHostAndPort(String target) throws IOException
Description copied from interface:DeploymentFacilityget the host and port information- Specified by:
getHostAndPortin interfaceDeploymentFacility- Throws:
IOException
-
getHostAndPort
public HostAndPort getHostAndPort(String target, boolean securityEnabled) throws IOException
Description copied from interface:DeploymentFacilityget the host and port information with security enabled attribute- Specified by:
getHostAndPortin interfaceDeploymentFacility- Throws:
IOException
-
getVirtualServerHostAndPort
public HostAndPort getVirtualServerHostAndPort(String target, String virtualServer, boolean securityEnabled) throws IOException
Description copied from interface:DeploymentFacilityget the host and port information with the specified virtual server and security enabled attribute- Specified by:
getVirtualServerHostAndPortin interfaceDeploymentFacility- Throws:
IOException
-
getHostAndPort
public HostAndPort getHostAndPort(String target, String moduleId, boolean securityEnabled) throws IOException
Description copied from interface:DeploymentFacilityget the host and port information with the specified module id and security enabled attribute- Specified by:
getHostAndPortin interfaceDeploymentFacility- Throws:
IOException
-
listAppRefs
public javax.enterprise.deploy.spi.TargetModuleID[] listAppRefs(String[] targets) throws IOException
Description copied from interface:DeploymentFacilitylist all application refs that are present in the provided list of targets- Specified by:
listAppRefsin interfaceDeploymentFacility- Throws:
IOException
-
_listAppRefs
public javax.enterprise.deploy.spi.TargetModuleID[] _listAppRefs(String[] targets) throws IOException
Description copied from interface:DeploymentFacilitylist all application refs that are present in the provided list of targets- Specified by:
_listAppRefsin interfaceDeploymentFacility- Throws:
IOException
-
_listAppRefs
public javax.enterprise.deploy.spi.TargetModuleID[] _listAppRefs(String[] targets, String state) throws IOException
Description copied from interface:DeploymentFacilitylist all application refs that are present in the provided list of targets with the specified state- Specified by:
_listAppRefsin interfaceDeploymentFacility- Throws:
IOException
-
_listAppRefs
public javax.enterprise.deploy.spi.TargetModuleID[] _listAppRefs(String[] targets, String state, String type) throws IOException
Description copied from interface:DeploymentFacilitylist all application refs that are present in the provided list of targets with the specified state and specified type- Specified by:
_listAppRefsin interfaceDeploymentFacility- Throws:
IOException
-
_listAppRefs
public javax.enterprise.deploy.spi.TargetModuleID[] _listAppRefs(javax.enterprise.deploy.spi.Target[] targets, String state, String type) throws IOExceptionDescription copied from interface:DeploymentFacilitylist all application refs that are present in the provided list of targets with the specified state and specified type- Specified by:
_listAppRefsin interfaceDeploymentFacility- Throws:
IOException
-
undeploy
public DFProgressObject undeploy(javax.enterprise.deploy.spi.Target[] targets, String moduleID)
Undeploys an application from specified targets.- Specified by:
undeployin interfaceDeploymentFacility- Parameters:
targets- the targets from which to undeploy the appmoduleID- the app- Returns:
- DFProgressObject for monitoring progress and querying status
-
undeploy
public DFProgressObject undeploy(javax.enterprise.deploy.spi.Target[] origTargets, String moduleID, Map origOptions)
Undeploys an application from specified targets.- Specified by:
undeployin interfaceDeploymentFacility- Parameters:
origTargets- the targets from which to undeploy the appmoduleID- the apporigOptions- options to control the undeployment- Returns:
- DFProgressObject for monitoring progress and querying status
-
exportClientStubs
public String exportClientStubs(String appName, String destDir) throws IOException
Exports the Client stub jars to the given location.- Specified by:
exportClientStubsin interfaceTargetOwner- Parameters:
appName- The name of the application or module.destDir- The directory into which the stub jar file should be exported.- Returns:
- the absolute location to the main jar file.
- Throws:
IOException
-
waitFor
public DFDeploymentStatus waitFor(DFProgressObject po)
Convenient method to wait for the operation monitored by the progress object to complete, returning the final operation status.- Specified by:
waitForin interfaceDeploymentFacility- Parameters:
po- DFProgressObject for the operation of interestt- Returns:
- DFDeploymentStatus final status for the operation
-
getWebURL
public String getWebURL(javax.enterprise.deploy.spi.TargetModuleID tmid)
Description copied from interface:TargetOwnerReturns the Web URL for the specified module on theTargetimplied by the TargetModuleID.- Specified by:
getWebURLin interfaceTargetOwner- Returns:
- web url
-
setWebURL
public void setWebURL(javax.enterprise.deploy.spi.TargetModuleID tmid, String webURL)Description copied from interface:TargetOwnerSets the Web URL for the specified module on theTargetimplied by the TargetModuleID. represents a Web module or submodule on a Target.- Specified by:
setWebURLin interfaceTargetOwner
-
getTargetDAS
protected ServerConnectionIdentifier getTargetDAS()
-
-