Permalink
Browse files

Merging deployment models

  • Loading branch information...
nicolasferry committed Jan 16, 2017
1 parent cf1464d commit eee520a341c25690890a4b9dd4b542e5d7d446c9
@@ -70,6 +70,6 @@
*/
public Deployment getDeploymentModel();
public Deployment merge(String path);
}
@@ -440,6 +440,32 @@ private void saveMetadata(Deployment deploy2) {
}
}
public Deployment merge(String path){
InputStream instream = null;
try {
instream = new FileInputStream(path);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Deployment target = (Deployment) new JsonCodec().load(instream);
if (isDeploymentLoaded()) {
deploy.getComponents().replaceAll(target.getComponents());
deploy.getRelationships().replaceAll(target.getRelationships());
//TODO: Check if names are unique
deploy.getComponentInstances().replaceAll(target.getComponentInstances());
deploy.getExecuteInstances().replaceAll(target.getExecuteInstances());
deploy.getProviders().replaceAll(target.getProviders());
deploy.getRelationshipInstances().replaceAll(target.getRelationshipInstances());
}else{
deploy=target;
}
initCoordinator();
return deploy;
}
@Override
public void handle(LoadDeployment command) {
String path = command.getPathToModel();

0 comments on commit eee520a

Please sign in to comment.