private void deployRecursively(List<Artifact.Dependency> deps, AxisConfiguration axisConfig) {
String artifactPath, destPath;
String repo = axisConfig.getRepository().getPath();
for (Artifact.Dependency dependency : deps) {
Artifact artifact = dependency.getArtifact();
if (artifact == null) {
continue;
}
if (!isAccepted(artifact.getType())) {
log.warn("Can't deploy artifact : " + artifact.getName() + " of type : " +
artifact.getType() + ". Required features are not installed in the system");
continue;
}
if (AAR_TYPE.equals(artifact.getType())) {
destPath = repo + File.separator + axisConfig
.getParameter(DeploymentConstants.SERVICE_DIR_PATH).getValue().toString();
} else if (JAXWS_TYPE.equals(artifact.getType())) {
destPath = repo + File.separator + JAXWS_DIR;
} else if (DS_TYPE.equals(artifact.getType())) {
destPath = repo + File.separator + DS_DIR;
} else if (AppDeployerConstants.CARBON_APP_TYPE.equals(artifact.getType())) {
destPath = repo + File.separator + AppDeployerConstants.CARBON_APPS;
} else if (artifact.getType().startsWith("lib/") && AppDeployerUtils
.getTenantId(axisConfig) == MultitenantConstants.SUPER_TENANT_ID) {
// library installation is only allowed for teh super tenant
destPath = CarbonUtils.getCarbonOSGiDropinsDir();
} else {
continue;
}
List<CappFile> files = artifact.getFiles();
if (files.size() != 1) {
log.error(artifact.getType() + " type must have a single file to " +
"be deployed. But " + files.size() + " files found.");
continue;
}
String fileName = artifact.getFiles().get(0).getName();
artifactPath = artifact.getExtractedPath() + File.separator + fileName;
AppDeployerUtils.createDir(destPath);
String destFilePath = destPath + File.separator + fileName;
AppDeployerUtils.copyFile(artifactPath, destFilePath);
/**
* if the current artifact is a lib or bundle, we have to manually install it into the
* OSGi environment for the usage of the lib before the first restart..
* Important : This OSGi library installation is only allowed for the super tenant
*/
if ((artifact.getType().startsWith("lib/") || BUNDLE_TYPE.equals(artifact.getType()))
&& AppDeployerUtils.getTenantId(axisConfig) ==
MultitenantConstants.SUPER_TENANT_ID) {
installBundle(destFilePath);
artifact.setRuntimeObjectName(fileName);
}
deployRecursively(artifact.getDependencies(), axisConfig);
}
}