isArtifact = true;
} catch(Exception e) {
/**/
}
OperationalString toDeploy = null;
Webster embeddedWebster = null;
URL oarUrl = null;
//String oarUrl = null;
try {
if(!isArtifact) {
try {
oarUrl = new URL(deployName);
} catch(MalformedURLException e) {
File oarFile = getDeploymentFile(deployName);
OAR oar = new OAR(oarFile);
embeddedWebster = new Webster(0, oarFile.getParentFile().getAbsolutePath());
toDeploy = oar.loadOperationalStrings()[0];
oarUrl = new URL("http://"+embeddedWebster.getAddress()+":"+embeddedWebster.getPort()+"/"+oarFile.getName());
}
System.out.println("===> "+oarUrl);
}
} catch (Exception e) {
e.printStackTrace();
return("Problem resolving ["+deployName+"], Exception : "+e.getLocalizedMessage());
}
try {
DeployAdmin deployAdmin =
(DeployAdmin)CLI.getInstance().getServiceFinder().getPreparedAdmin(item.service);
Boolean wait = (Boolean)CLI.getInstance().settings.get(CLI.DEPLOY_BLOCK);
if(deployOptions.getDeployTimeout()>0 && wait) {
ServiceProvisionNotification spn = CLI.getInstance().provisionNotifier;
String label = "Artifact";
if(isArtifact) {
deployAdmin.deploy(deployName, spn.getServiceProvisionListener());
} else {
label = "OAR";
try{
//deployAdmin.deploy(toDeploy, spn.getServiceProvisionListener());
deployAdmin.deploy(oarUrl, spn.getServiceProvisionListener());
} finally {
if(embeddedWebster!=null)
embeddedWebster.terminate();
}
}
long t0 = System.currentTimeMillis();
out.println("Deploying "+label+" ["+deployName+"] ...");
spn.notify(1, deployOptions.getDeployTimeout());