use of org.iobserve.model.PCMModelHandler in project iobserve-analysis by research-iobserve.
the class EvaluationGenerationMain method main.
/**
* main routine.
*
* @param args
* program arguments
*/
public static void main(final String[] args) {
final CommandLineParser parser = new DefaultParser();
try {
CommandLine commandLine = parser.parse(EvaluationGenerationMain.createHelpOptions(), args);
if (commandLine.hasOption("h")) {
final HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("iobserve-analysis", EvaluationGenerationMain.createOptions());
} else {
commandLine = parser.parse(EvaluationGenerationMain.createOptions(), args);
final File model = new File(commandLine.getOptionValue("o"));
if (commandLine.hasOption("n")) {
EvaluationGenerationMain.clearDirectory(commandLine.getOptionValue("o"));
ModelGenerationFactory.createNewModel(commandLine);
final PCMModelHandler modelProviders = new PCMModelHandler(model);
final GraphFactory graphFactory = new GraphFactory();
graphFactory.buildGraph(modelProviders);
}
if (commandLine.hasOption("m")) {
EvaluationGenerationMain.clearDirectory(commandLine.getOptionValue("o"));
ModelModificationFactory.createNewModel(commandLine);
final PCMModelHandler modelProviers = new PCMModelHandler(model);
final GraphFactory graphFactory = new GraphFactory();
graphFactory.buildGraph(modelProviers);
}
}
} catch (final Exception e) {
// NOCS NOPMD
e.printStackTrace();
}
}
use of org.iobserve.model.PCMModelHandler in project iobserve-analysis by research-iobserve.
the class ModelGenerationFactory method generateAndSaveSystem.
private static System generateAndSaveSystem(final CommandLine commandLine, final URI outputLocation) {
final PCMModelHandler modelProviders = new PCMModelHandler(new File(outputLocation.toFileString()));
final SystemGeneration systemGen = new SystemGeneration(modelProviders.getRepositoryModel());
final System systemModel = systemGen.generateSystemModel(Integer.parseInt(commandLine.getOptionValue("a")));
final SystemModelHandler systemModelProvider = new SystemModelHandler();
final URI systemModelURI = URI.createFileURI(outputLocation.toFileString() + File.separator + systemModel.getEntityName() + ".system");
systemModelProvider.save(systemModelURI, systemModel);
return systemModel;
}
use of org.iobserve.model.PCMModelHandler in project iobserve-analysis by research-iobserve.
the class CandidateProcessing method execute.
@Override
protected void execute(final PlanningData element) throws Exception {
CandidateGeneration.LOG.info("Candiate Processing");
final AdaptationData adapdationData = element.getAdaptationData();
final GraphFactory factory = new GraphFactory();
final File directory = new File(adapdationData.getReDeploymentURI().toFileString());
final ModelGraph graph = factory.buildGraph(new PCMModelHandler(directory));
element.getAdaptationData().setReDeploymentGraph(graph);
this.outputPort.send(element.getAdaptationData());
}
use of org.iobserve.model.PCMModelHandler 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.PCMModelHandler 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