Search in sources :

Example 6 with PCMModelHandler

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();
    }
}
Also used : HelpFormatter(org.apache.commons.cli.HelpFormatter) CommandLine(org.apache.commons.cli.CommandLine) GraphFactory(org.iobserve.analysis.data.graph.GraphFactory) PCMModelHandler(org.iobserve.model.PCMModelHandler) CommandLineParser(org.apache.commons.cli.CommandLineParser) File(java.io.File) DefaultParser(org.apache.commons.cli.DefaultParser)

Example 7 with PCMModelHandler

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;
}
Also used : PCMModelHandler(org.iobserve.model.PCMModelHandler) File(java.io.File) URI(org.eclipse.emf.common.util.URI) System(org.palladiosimulator.pcm.system.System) SystemModelHandler(org.iobserve.model.provider.file.SystemModelHandler)

Example 8 with PCMModelHandler

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());
}
Also used : GraphFactory(org.iobserve.analysis.data.graph.GraphFactory) ModelGraph(org.iobserve.analysis.data.graph.ModelGraph) PCMModelHandler(org.iobserve.model.PCMModelHandler) AdaptationData(org.iobserve.adaptation.data.AdaptationData) File(java.io.File)

Example 9 with PCMModelHandler

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);
}
Also used : SnapshotBuilder(org.iobserve.model.snapshot.SnapshotBuilder) PCMModelHandler(org.iobserve.model.PCMModelHandler) PlanningData(org.iobserve.planning.data.PlanningData) AdaptationData(org.iobserve.adaptation.data.AdaptationData) File(java.io.File) URI(org.eclipse.emf.common.util.URI)

Example 10 with PCMModelHandler

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);
}
Also used : Allocation(org.palladiosimulator.pcm.allocation.Allocation) SnapshotBuilder(org.iobserve.model.snapshot.SnapshotBuilder) AllocationGroupsContainer(org.iobserve.planning.data.AllocationGroupsContainer) PCMModelHandler(org.iobserve.model.PCMModelHandler) File(java.io.File)

Aggregations

PCMModelHandler (org.iobserve.model.PCMModelHandler)10 File (java.io.File)8 URI (org.eclipse.emf.common.util.URI)4 Allocation (org.palladiosimulator.pcm.allocation.Allocation)4 AdaptationData (org.iobserve.adaptation.data.AdaptationData)3 GraphFactory (org.iobserve.analysis.data.graph.GraphFactory)3 ResourceEnvironment (org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment)3 System (org.palladiosimulator.pcm.system.System)3 IOException (java.io.IOException)2 CommandLine (org.apache.commons.cli.CommandLine)2 CommandLineParser (org.apache.commons.cli.CommandLineParser)2 DefaultParser (org.apache.commons.cli.DefaultParser)2 HelpFormatter (org.apache.commons.cli.HelpFormatter)2 ModelGraph (org.iobserve.analysis.data.graph.ModelGraph)2 Graph (org.iobserve.model.provider.neo4j.Graph)2 GraphLoader (org.iobserve.model.provider.neo4j.GraphLoader)2 ModelProvider (org.iobserve.model.provider.neo4j.ModelProvider)2 SnapshotBuilder (org.iobserve.model.snapshot.SnapshotBuilder)2 PlanningData (org.iobserve.planning.data.PlanningData)2 Repository (org.palladiosimulator.pcm.repository.Repository)2