use of org.iobserve.model.snapshot.SnapshotBuilder in project iobserve-analysis by research-iobserve.
the class ModelModificationFactory method copyRepoToOutput.
/**
* Copies all files to the given output location.
*/
private static URI copyRepoToOutput(final URI outputLocation, final PCMModelHandler modelProviders) {
SnapshotBuilder.setBaseSnapshotURI(outputLocation);
final SnapshotBuilder snapshotBuilder;
URI snapshotURI = null;
try {
snapshotBuilder = new SnapshotBuilder("", modelProviders);
snapshotURI = snapshotBuilder.createSnapshot();
} catch (final IOException e) {
ModelModificationFactory.LOGGER.error("Cannot copy repo to output, IO error: {}", e.getLocalizedMessage());
} catch (final InitializationException e1) {
ModelModificationFactory.LOGGER.error("Cannot copy repo to output, initialization error: {}", e1.getLocalizedMessage());
}
return snapshotURI;
}
use of org.iobserve.model.snapshot.SnapshotBuilder in project iobserve-analysis by research-iobserve.
the class ModelProcessing method execute.
@Override
protected void execute(final URI element) throws Exception {
CandidateGeneration.LOG.info("Model Processing");
final PlanningData planningData = new PlanningData();
final AdaptationData adaptationData = new AdaptationData();
adaptationData.setRuntimeModelURI(element);
planningData.setAdaptationData(adaptationData);
planningData.setPerOpteryxDir(this.perOpteryxDir);
planningData.setOriginalModelDir(element);
planningData.setLqnsDir(this.lqnsDir);
final File directory = new File(adaptationData.getReDeploymentURI().toFileString());
final PCMModelHandler models = new PCMModelHandler(directory);
final SnapshotBuilder snapshotBuilder = new SnapshotBuilder(ModelProcessing.PROCESSED_MODEL_FOLDER, models);
final URI snapshotLocation = snapshotBuilder.createSnapshot();
planningData.setProcessedModelDir(snapshotLocation);
final ModelTransformer modelTransformer = new ModelTransformer(planningData);
modelTransformer.transformModel();
this.outputPort.send(planningData);
}
use of org.iobserve.model.snapshot.SnapshotBuilder in project iobserve-analysis by research-iobserve.
the class ModelTransformer method initModelTransformation.
private void initModelTransformation() throws IOException, InitializationException {
this.processedModelDir = this.planningData.getOriginalModelDir().appendSegment(ModelProcessing.PROCESSED_MODEL_FOLDER);
SnapshotBuilder.setBaseSnapshotURI(this.planningData.getOriginalModelDir());
final SnapshotBuilder snapshotBuilder = new SnapshotBuilder(ModelProcessing.PROCESSED_MODEL_FOLDER, this.originalModelHandler);
snapshotBuilder.createSnapshot();
this.planningData.setProcessedModelDir(this.processedModelDir);
this.processedModelHandler = new PCMModelHandler(new File(this.processedModelDir.toFileString()));
this.allocationModel = this.processedModelHandler.getAllocationModel();
this.cloudProfileModel = this.processedModelHandler.getCloudProfileModel();
this.costModel = this.processedModelHandler.getCostModel();
this.resourceEnvironmentModel = this.processedModelHandler.getResourceEnvironmentModel();
this.decisionModel = this.processedModelHandler.getDesignDecisionModel();
this.decisionSpace = this.processedModelHandler.getDesignDecisionModel();
if (this.decisionSpace == null) {
this.decisionSpace = DesignDecisionModelFactory.createDecisionSpace("processedDecision");
}
final Allocation originalAllocation = this.originalModelHandler.getAllocationModel();
this.originalAllocationGroups = new AllocationGroupsContainer(originalAllocation);
}
Aggregations