*
* @param artifact - Registry/Resource artifact
* @return - RegistryConfig instance
*/
private RegistryConfig buildRegistryConfig(Artifact artifact) {
RegistryConfig regConfig = null;
// get the file path of the registry config file
List<CappFile> files = artifact.getFiles();
if (files.size() == 1) {
String fileName = artifact.getFiles().get(0).getName();
String regConfigPath = artifact.getExtractedPath() +
File.separator + fileName;
File f = new File(regConfigPath);
if (f.exists()) {
// read the reg config file and build the configuration
InputStream xmlInputStream = null;
try {
xmlInputStream = new FileInputStream(f);
regConfig = AppDeployerUtils.populateRegistryConfig(
new StAXOMBuilder(xmlInputStream).getDocumentElement());
} catch (Exception e) {
log.error("Error while reading file : " + fileName, e);
} finally {
if (xmlInputStream != null) {
try {
xmlInputStream.close();
} catch (IOException e) {
log.error("Error while closing input stream.", e);
}
}
}
if (regConfig != null) {
regConfig.setExtractedPath(artifact.getExtractedPath());
regConfig.setParentArtifactName(artifact.getName());
regConfig.setConfigFileName(fileName);
}
} else {
log.error("Registry config file not found at : " + regConfigPath);
}
} else {