String clientCode = null;
Log.print(this,localStrings.getLocalString(
"enterprise.tools.deployment.main.deploytool.deploy_command",
"Deploy {0} on {1}", msg));
JarInstaller backend = this.getServerManager().getServerForName(serverName);
DeploymentSession deploymentSessionToUse = null;
if (deploymentSession == null) {
deploymentSessionToUse = this.getServerManager().createDeploymentSession(serverName);
} else {
deploymentSessionToUse = deploymentSession;
}
FileInputStream fis = new FileInputStream(appArchiveFile);
DataInputStream dis = new DataInputStream(fis);
byte[] jarData = new byte[(int) appArchiveFile.length()];
dis.readFully(jarData);
dis.close();
fis.close();
clientCode = backend.deployApplication(jarData, applicationName, deploymentSessionToUse);
Log.print(this, localStrings.getLocalString(
"enterprise.tools.deployment.main.clientcodeat",
"client code at {0}", new Object[] {clientCode}));
if (clientCode != null && clientCodeFile != null) {
writeClientJarToFile(clientCode, clientCodeFile);
deploymentSessionToUse.notification(new NotificationEvent(this, DeploymentSession.CLIENT_CODE_RETURNED, this));
deploymentSessionToUse.setStatusMessage(localStrings.getLocalString(
"enterprise.tools.deployment.main.clientcodefordeployedapplicationsavedtofile",
"Client code for the deployed application {0} saved to {1}", new Object[] {applicationName, clientCodeFile}));
}
}