errorFlag = true;
message = " terminated \n" + err.toString();
printInConsole(errorFlag, message);
return;
}
InstallationController installationController = new InstallationController(mainComponentId,
localPearFile, installationDir);
// adding installation controller message listener
installationController.addMsgListener(new MessageRouter.StdChannelListener() {
public void errMsgPosted(String errMsg) {
printInConsole(true, errMsg);
}
public void outMsgPosted(String outMsg) {
printInConsole(false, outMsg);
}
});
insdObject = installationController.installComponent();
if (insdObject == null) {
runButton.setEnabled(false);
/* installation failed */
errorFlag = true;
message = " \nInstallation of " + mainComponentId + " failed => \n "
+ installationController.getInstallationMsg();
printInConsole(errorFlag, message);
} else {
try {
/* save modified installation descriptor file */
installationController.saveInstallationDescriptorFile();
mainComponentRootPath = insdObject.getMainComponentRoot();
errorFlag = false;
message = " \nInstallation of " + mainComponentId + " completed \n";
printInConsole(errorFlag, message);
message = "The " + mainComponentRootPath + "/" + SET_ENV_FILE
+ " \n file contains required " + "environment variables for this component\n";
printInConsole(errorFlag, message);
/* 2nd step: verification of main component installation */
if (installationController.verifyComponent()) {
// enable 'run' button only for AE
File xmlDescFile = new File(insdObject.getMainComponentDesc());
try {
String uimaCompCtg = UIMAUtil.identifyUimaComponentCategory(xmlDescFile);
if (UIMAUtil.ANALYSIS_ENGINE_CTG.equals(uimaCompCtg))
runButton.setEnabled(true);
} catch (Exception e) {
// Ignore exceptions!
}
errorFlag = false;
message = "Verification of " + mainComponentId + " completed \n";
printInConsole(errorFlag, message);
} else {
runButton.setEnabled(false);
errorFlag = true;
message = "Verification of " + mainComponentId + " failed => \n "
+ installationController.getVerificationMsg();
printInConsole(errorFlag, message);
}
} catch (Exception exc) {
errorFlag = true;
message = "Error in InstallationController.main(): " + exc.toString();
printInConsole(errorFlag, message);
} finally {
installationController.terminate();
}
}
}