Methods Summary |
---|
private com.sun.enterprise.deployment.client.JESProgressObject | changeState(javax.enterprise.deploy.spi.Target[] targets, java.lang.String moduleID, javax.enterprise.deploy.shared.CommandType cmd)
if(!isConnected()) {
throw new IllegalStateException(localStrings.getString("enterprise.deployment.client.disconnected_state"));
}
SunTarget[] targetList = getSunTargets(targets);
ProgressObjectImpl progressObject = new ChangeStateAction(targetList);
Object args[] = new Object[5];
args[0] = dasConnection;
args[1] = targetList;
args[2] = moduleID;
args[3] = cmd;
args[4] = domain;
progressObject.setCommand(cmd, args);
Thread newThread = new Thread(progressObject);
newThread.start();
return progressObject;
|
public boolean | connect(ServerConnectionIdentifier targetDAS)Connects to a particular instance of the domain adminstration
server using the provided connection information
try {
TLSParams tlsParams = null;
if (targetDAS.isSecure()) {
X509TrustManager trustManager =
(X509TrustManager)targetDAS.getConnectionEnvironment().
get(DefaultConfiguration.TRUST_MANAGER_PROPERTY_NAME);
tlsParams = new TLSParams(trustManager, null);
}
dasConnection = new AppserverConnectionSource(
AppserverConnectionSource.PROTOCOL_HTTP,
targetDAS.getHostName(), targetDAS.getHostPort(),
targetDAS.getUserName(), targetDAS.getPassword(),
tlsParams, null);
} catch (IllegalArgumentException illEx) {
return false;
}
serverId = targetDAS;
domain = new SunTarget(targetDAS);
domain.setConnectionSource(dasConnection);
domain.setTargetType(TargetType.DOMAIN);
return true;
|
public com.sun.enterprise.deployment.client.JESProgressObject | createAppRef(javax.enterprise.deploy.spi.Target[] targets, java.lang.String moduleID, java.util.Map options)Add an application ref on the selected targets
return(doApplicationReferenceAction(targets, moduleID, options, CommandType.DISTRIBUTE));
|
public javax.enterprise.deploy.spi.Target[] | createTargets(java.lang.String[] targets)
if(!isConnected()) {
throw new IllegalStateException(localStrings.getString("enterprise.deployment.client.disconnected_state"));
}
Target[] targetsArray = new Target[targets.length];
Map serverProxies = null;
Map clusterProxies = null;
try {
// parse through given targets
for(int i=0; i<targets.length; i++) {
// if this is "domain" add a domain target
if(TargetType.DOMAIN.equals(targets[i])) {
// Add a domain target
SunTarget dom = new SunTarget(serverId);
dom.setAppServerInstance(TargetType.DOMAIN);
dom.setConnectionSource(dasConnection);
dom.setTargetType(TargetType.DOMAIN);
targetsArray[i] = dom;
continue;
}
// if this is "server" add a server target
if(DAS.equals(targets[i])) {
// Add a target for default server
SunTarget serv = new SunTarget(serverId);
serv.setAppServerInstance(DAS);
serv.setConnectionSource(dasConnection);
serv.setTargetType(TargetType.STAND_ALONE_SERVER);
targetsArray[i] = serv;
continue;
}
// for PE, it will not come here at all; go ahead and get proxies and server/cluster keysets from the proxies
if(serverProxies == null || clusterProxies == null) {
DomainConfig domainCfg = ProxyFactory.getInstance(dasConnection).getDomainRoot().getDomainConfig();
serverProxies = domainCfg.getStandaloneServerConfigMap();
clusterProxies = domainCfg.getClusterConfigMap();
}
// check if ctarget is a stand alone server
if(serverProxies.get(targets[i]) != null) {
SunTarget aTarget = new SunTarget(serverId);
aTarget.setAppServerInstance(targets[i]);
aTarget.setConnectionSource(dasConnection);
aTarget.setTargetType(TargetType.STAND_ALONE_SERVER);
targetsArray[i] = aTarget;
continue;
}
// check if ctarget is a cluster
if(clusterProxies.get(targets[i]) != null) {
SunTarget aTarget = new SunTarget(serverId);
aTarget.setAppServerInstance(targets[i]);
aTarget.setConnectionSource(dasConnection);
aTarget.setTargetType(TargetType.CLUSTER);
targetsArray[i] = aTarget;
continue;
}
// if we are here, it means given target does not exist at all - return null
return null;
}
} catch (Throwable ex) {
// it's too late to change the DeploymentFacility.createTargets
// interface to throw approriate exceptions as this point,
// but let's at least re-throw the RuntimeException so
// connection failure (for example, due to wrong user/password)
// could be reported back to user.
if (ex instanceof RuntimeException) {
throw (RuntimeException)ex;
}
return null;
}
return targetsArray;
|
public com.sun.enterprise.deployment.client.JESProgressObject | deleteAppRef(javax.enterprise.deploy.spi.Target[] targets, java.lang.String moduleID, java.util.Map options)remove the application ref for the provided list of targets.
return(doApplicationReferenceAction(targets, moduleID, options, CommandType.UNDEPLOY));
|
public com.sun.enterprise.deployment.client.JESProgressObject | deploy(javax.enterprise.deploy.spi.Target[] targets, com.sun.enterprise.deployment.deploy.shared.Archive source, com.sun.enterprise.deployment.deploy.shared.Archive deploymentPlan, java.util.Map deploymentOptions)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. The deploymentOptions is a key-value pair map of
deployment options for this operations. Once the deployment
is successful, the targets server instances
if(!isConnected()) {
throw new IllegalStateException(localStrings.getString("enterprise.deployment.client.disconnected_state"));
}
SunTarget[] targetList = getSunTargets(targets);
ProgressObjectImpl progressObject = new DeployAction(targetList);
Object args[] = new Object[8];
args[0] = dasConnection;
args[1] = source;
args[2] = deploymentPlan;
args[3] = (deploymentOptions == null) ? new HashMap() : DeploymentProperties.propsToMap((Properties)deploymentOptions);
args[4] = targetList;
args[5] = domain;
args[6] = localConnection;
args[7] = serverId;
progressObject.setCommand(CommandType.DISTRIBUTE, args);
Thread newThread = new Thread(progressObject);
newThread.start();
return progressObject;
|
public com.sun.enterprise.deployment.client.JESProgressObject | disable(javax.enterprise.deploy.spi.Target[] targets, java.lang.String moduleID)Disables a deployed component on the provided list of targets
return(changeState(targets, moduleID, CommandType.STOP));
|
public boolean | disconnect()Disconnects from a domain administration server and releases
all associated resouces.
dasConnection = null;
return true;
|
private com.sun.enterprise.deployment.client.JESProgressObject | doApplicationReferenceAction(javax.enterprise.deploy.spi.Target[] targets, java.lang.String moduleID, java.util.Map options, javax.enterprise.deploy.shared.CommandType cmd)
if(!isConnected()) {
throw new IllegalStateException(localStrings.getString("enterprise.deployment.client.disconnected_state"));
}
SunTarget[] targetList = getSunTargets(targets);
ProgressObjectImpl progressObject = new ApplicationReferenceAction(targetList);
Object args[] = new Object[5];
args[0] = dasConnection;
args[1] = targetList;
args[2] = moduleID;
args[3] = cmd;
args[4] = (options == null) ? new HashMap() : DeploymentProperties.propsToMap((Properties)options);
progressObject.setCommand(cmd, args);
Thread newThread = new Thread(progressObject);
newThread.start();
return progressObject;
|
public java.lang.String | downloadFile(java.io.File location, java.lang.String moduleID, java.lang.String moduleURI)Downloads 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.
Note that the current implementation only supports the download
of the appclient jar file.
if(!isConnected()) {
throw new IllegalStateException(
localStrings.getString("enterprise.deployment.client.disconnected_state"));
}
return DeploymentClientUtils.downloadClientStubs(
moduleID, location.getAbsolutePath(), dasConnection);
|
public com.sun.enterprise.deployment.client.JESProgressObject | enable(javax.enterprise.deploy.spi.Target[] targets, java.lang.String moduleID)Enables a deployed component on the provided list of targets.
return(changeState(targets, moduleID, CommandType.START));
|
private com.sun.enterprise.deployapi.SunTarget[] | getSunTargets(javax.enterprise.deploy.spi.Target[] givenTargets)Create SunTarget[] from given Target[]
SunTarget[] result = new SunTarget[givenTargets.length];
for(int i=0; i<givenTargets.length; i++) {
if(givenTargets[i] instanceof SunTarget) {
result[i] = new SunTarget((SunTarget)givenTargets[i]);
} else {
throw new IllegalArgumentException(localStrings.getString("enterprise.deployment.client.notASunTarget",
givenTargets[i].getClass().getName()));
}
}
return result;
|
public boolean | isConnected()
if(dasConnection == null) {
return false;
}
return true;
|
public javax.enterprise.deploy.spi.TargetModuleID[] | listAppRefs(java.lang.String[] targets)list all application refs that are present in the provided list of targets
if(!isConnected()) {
throw new IllegalStateException(localStrings.getString("enterprise.deployment.client.disconnected_state"));
}
Vector tmpVector = new Vector();
DomainConfig domainCfg = ProxyFactory.getInstance(dasConnection).getDomainRoot().getDomainConfig();
Map serverProxies = domainCfg.getStandaloneServerConfigMap();
Map clusterProxies = domainCfg.getClusterConfigMap();
Map clusteredServerProxies = domainCfg.getClusteredServerConfigMap();
for(int i=0; i<targets.length; i++) {
Set proxySet = null;
if(serverProxies.get(targets[i]) != null) {
StandaloneServerConfig tgtProxy =
(StandaloneServerConfig)domainCfg.getContainee(
XTypes.STANDALONE_SERVER_CONFIG, targets[i]);
proxySet = tgtProxy.getContaineeSet(XTypes.DEPLOYED_ITEM_REF_CONFIG);
} else if(clusterProxies.get(targets[i]) != null) {
ClusterConfig tgtProxy =
(ClusterConfig)domainCfg.getContainee(
XTypes.CLUSTER_CONFIG, targets[i]);
proxySet = tgtProxy.getContaineeSet(XTypes.DEPLOYED_ITEM_REF_CONFIG);
} else if(clusteredServerProxies.get(targets[i]) != null) {
ClusteredServerConfig tgtProxy =
(ClusteredServerConfig)domainCfg.getContainee(
XTypes.CLUSTERED_SERVER_CONFIG, targets[i]);
proxySet = tgtProxy.getContaineeSet(XTypes.DEPLOYED_ITEM_REF_CONFIG);
} else if(TargetType.DOMAIN.equals(targets[i])) {
StandaloneServerConfig tgtProxy =
(StandaloneServerConfig)domainCfg.getContainee(
XTypes.STANDALONE_SERVER_CONFIG, DAS);
proxySet = tgtProxy.getContaineeSet(XTypes.DEPLOYED_ITEM_REF_CONFIG);
} else {
return null;
}
Object[] appRefs = proxySet.toArray();
for(int k=0; k<appRefs.length; k++) {
SunTarget aTarget = new SunTarget(serverId);
aTarget.setAppServerInstance(targets[i]);
aTarget.setConnectionSource(dasConnection);
DeployedItemRefConfig item = (DeployedItemRefConfig) appRefs[k];
SunTargetModuleID tgtId = new SunTargetModuleID(item.getRef(), aTarget);
tmpVector.add(tgtId);
}
}
SunTargetModuleID[] result = new SunTargetModuleID[tmpVector.size()];
return (TargetModuleID[]) tmpVector.toArray(result);
|
public com.sun.enterprise.deployment.client.JESProgressObject | undeploy(javax.enterprise.deploy.spi.Target[] targets, java.lang.String moduleID)Initiates a undeployment operation on the server
return(undeploy(targets, moduleID, null));
|
public com.sun.enterprise.deployment.client.JESProgressObject | undeploy(javax.enterprise.deploy.spi.Target[] targets, java.lang.String moduleID, java.util.Map options)
if(!isConnected()) {
throw new IllegalStateException(localStrings.getString("enterprise.deployment.client.disconnected_state"));
}
SunTarget[] targetList = getSunTargets(targets);
ProgressObjectImpl progressObject = new UndeployAction(targetList);
Object args[] = new Object[6];
args[0] = dasConnection;
args[1] = moduleID;
args[2] = (options == null) ? new HashMap() : DeploymentProperties.propsToMap((Properties)options);
args[3] = targetList;
args[4] = domain;
args[5] = localConnection;
progressObject.setCommand(CommandType.UNDEPLOY, args);
Thread newThread = new Thread(progressObject);
newThread.start();
return progressObject;
|
public com.sun.enterprise.deployment.backend.DeploymentStatus | waitFor(com.sun.enterprise.deployment.client.JESProgressObject po)Wait for a Progress object to be in a completed state
(sucessful or failed) and return the DeploymentStatus for
this progress object.
DeploymentStatus status = null;
do {
try {
Thread.currentThread().sleep(100);
} catch (InterruptedException ie) {
// Exception swallowed deliberately
}
status = po.getCompletedStatus();
} while(status == null);
return status;
|