}
public void doDeploy() {
if (wsToDeploy.size() > 0) {
for (int i = 0; i < wsToDeploy.size(); i++) {
ArchiveFileData currentArchiveFile = (ArchiveFileData) wsToDeploy.get(i);
boolean explodedDir = currentArchiveFile.getFile().isDirectory();
int type = currentArchiveFile.getType();
try {
ArchiveReader archiveReader;
StringWriter errorWriter = new StringWriter();
switch (type) {
case TYPE_SERVICE :
currentArchiveFile.setClassLoader(explodedDir,
axisConfig.getServiceClassLoader());
archiveReader = new ArchiveReader();
String serviceStatus = "";
try {
HashMap wsdlservice = archiveReader.processWSDLs(currentArchiveFile);
if (wsdlservice != null && wsdlservice.size() > 0) {
Iterator services = wsdlservice.values().iterator();
while (services.hasNext()) {
AxisService service = (AxisService) services.next();
Iterator operations = service.getOperations();
while (operations.hasNext()) {
AxisOperation axisOperation = (AxisOperation) operations.next();
axisConfig.getPhasesInfo().setOperationPhases(axisOperation);
}
}
}
AxisServiceGroup sericeGroup = new AxisServiceGroup(axisConfig);
sericeGroup.setServiceGroupClassLoader(
currentArchiveFile.getClassLoader());
ArrayList serviceList = archiveReader.processServiceGroup(
currentArchiveFile.getAbsolutePath(), currentArchiveFile,
sericeGroup, explodedDir, wsdlservice,
configContext);
addServiceGroup(sericeGroup, serviceList, currentArchiveFile.getFile().toURL(), currentArchiveFile);
log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_WS,
currentArchiveFile.getName()));
} catch (DeploymentException de) {
de.printStackTrace();
log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
currentArchiveFile.getName(),
de.getMessage()),
de);
PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
de.printStackTrace(error_ptintWriter);
serviceStatus = "Error:\n" + errorWriter.toString();
} catch (AxisFault axisFault) {
log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_SERVICE,
currentArchiveFile.getName(),
axisFault.getMessage()),
axisFault);
PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
axisFault.printStackTrace(error_ptintWriter);
serviceStatus = "Error:\n" + errorWriter.toString();
} catch (Exception e) {
if (log.isInfoEnabled()) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
log.info(Messages.getMessage(
DeploymentErrorMsgs.INVALID_SERVICE,
currentArchiveFile.getName(),
sw.getBuffer().toString()));
}
PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
e.printStackTrace(error_ptintWriter);
serviceStatus = "Error:\n" + errorWriter.toString();
} catch (Throwable t) {
if (log.isInfoEnabled()) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
log.info(Messages.getMessage(
DeploymentErrorMsgs.INVALID_SERVICE,
currentArchiveFile.getName(),
sw.getBuffer().toString()));
}
PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
t.printStackTrace(error_ptintWriter);
serviceStatus = "Error:\n" + errorWriter.toString();
} finally {
if (serviceStatus.startsWith("Error:")) {
axisConfig.getFaultyServices().put(currentArchiveFile.getFile().getAbsolutePath(),
serviceStatus);
}
currentArchiveFile = null;
}
break;
case TYPE_MODULE :
currentArchiveFile.setClassLoader(explodedDir,
axisConfig.getModuleClassLoader());
archiveReader = new ArchiveReader();
String moduleStatus = "";
try {
AxisModule metaData = new AxisModule();
metaData.setModuleClassLoader(currentArchiveFile.getClassLoader());
metaData.setParent(axisConfig);
archiveReader.readModuleArchive(currentArchiveFile, metaData, explodedDir,
axisConfig);
metaData.setFileName(currentArchiveFile.getFile().toURL());
addNewModule(metaData);
log.info(Messages.getMessage(DeploymentErrorMsgs.DEPLOYING_MODULE,
metaData.getName().getLocalPart()));
} catch (DeploymentException e) {
log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
currentArchiveFile.getName(),
e.getMessage()),
e);
PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
e.printStackTrace(error_ptintWriter);
moduleStatus = "Error:\n" + errorWriter.toString();
} catch (AxisFault axisFault) {
log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
currentArchiveFile.getName(),
axisFault.getMessage()),
axisFault);
PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
axisFault.printStackTrace(error_ptintWriter);
moduleStatus = "Error:\n" + errorWriter.toString();
} catch (MalformedURLException e) {
log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
currentArchiveFile.getName(),
e.getMessage()),
e);
PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
e.printStackTrace(error_ptintWriter);
moduleStatus = "Error:\n" + errorWriter.toString();
} catch (Throwable t) {
if (log.isInfoEnabled()) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
log.error(Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE,
currentArchiveFile.getName(),
t.getMessage()),
t);
}
PrintWriter error_ptintWriter = new PrintWriter(errorWriter);
t.printStackTrace(error_ptintWriter);
moduleStatus = "Error:\n" + errorWriter.toString();
} finally {
if (moduleStatus.startsWith("Error:")) {
axisConfig.getFaultyModules().put(
getAxisServiceName(currentArchiveFile.getName()), moduleStatus);
}
currentArchiveFile = null;
}
break;
}