Search in sources :

Example 1 with SnapshotBuilder

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;
}
Also used : SnapshotBuilder(org.iobserve.model.snapshot.SnapshotBuilder) IOException(java.io.IOException) InitializationException(org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException) URI(org.eclipse.emf.common.util.URI)

Example 2 with SnapshotBuilder

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);
}
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 3 with SnapshotBuilder

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);
}
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

SnapshotBuilder (org.iobserve.model.snapshot.SnapshotBuilder)3 File (java.io.File)2 URI (org.eclipse.emf.common.util.URI)2 PCMModelHandler (org.iobserve.model.PCMModelHandler)2 IOException (java.io.IOException)1 InitializationException (org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException)1 AdaptationData (org.iobserve.adaptation.data.AdaptationData)1 AllocationGroupsContainer (org.iobserve.planning.data.AllocationGroupsContainer)1 PlanningData (org.iobserve.planning.data.PlanningData)1 Allocation (org.palladiosimulator.pcm.allocation.Allocation)1