Search in sources :

Example 1 with DecisionSpace

use of de.uka.ipd.sdq.pcm.designdecision.DecisionSpace in project iobserve-analysis by research-iobserve.

the class SerializePcmModelStage method execute.

@Override
protected void execute(final EObject model) throws Exception {
    final ResourceSet resourceSet = model.eResource().getResourceSet();
    final String filePathPrefix = this.modelDirectory.getAbsolutePath() + File.separator + this.modelName;
    final String filePath;
    if (model instanceof Allocation) {
        filePath = filePathPrefix + "." + AllocationPackage.eNAME;
        new FileModelHandler<Allocation>(resourceSet, AllocationPackage.eINSTANCE).save(URI.createFileURI(filePath), (Allocation) model);
    } else if (model instanceof CloudProfile) {
        filePath = filePathPrefix + "." + CloudprofilePackage.eNAME;
        new FileModelHandler<CloudProfile>(resourceSet, CloudprofilePackage.eINSTANCE).save(URI.createFileURI(filePath), (CloudProfile) model);
    } else if (model instanceof CostRepository) {
        filePath = filePathPrefix + "." + costPackage.eNAME;
        new FileModelHandler<CostRepository>(resourceSet, costPackage.eINSTANCE).save(URI.createFileURI(filePath), (CostRepository) model);
    } else if (model instanceof DecisionSpace) {
        filePath = filePathPrefix + "." + designdecisionPackage.eNAME;
        new FileModelHandler<DecisionSpace>(resourceSet, designdecisionPackage.eINSTANCE).save(URI.createFileURI(filePath), (DecisionSpace) model);
    } else if (model instanceof QMLDeclarations) {
        filePath = filePathPrefix + "." + QMLDeclarationsPackage.eNAME;
        new FileModelHandler<QMLDeclarations>(resourceSet, QMLDeclarationsPackage.eINSTANCE).save(URI.createFileURI(filePath), (QMLDeclarations) model);
    } else if (model instanceof Repository) {
        filePath = filePathPrefix + "." + RepositoryPackage.eNAME;
        new FileModelHandler<Repository>(resourceSet, RepositoryPackage.eINSTANCE).save(URI.createFileURI(filePath), (Repository) model);
    } else if (model instanceof ResourceEnvironment) {
        filePath = filePathPrefix + "." + ResourceenvironmentPackage.eNAME;
        new FileModelHandler<ResourceEnvironment>(resourceSet, ResourceenvironmentPackage.eINSTANCE).save(URI.createFileURI(filePath), (ResourceEnvironment) model);
    } else if (model instanceof System) {
        filePath = filePathPrefix + "." + SystemPackage.eNAME;
        new FileModelHandler<System>(resourceSet, SystemPackage.eINSTANCE).save(URI.createFileURI(filePath), (System) model);
    } else if (model instanceof UsageModel) {
        filePath = filePathPrefix + UsagemodelPackage.eNAME;
        new FileModelHandler<UsageModel>(resourceSet, UsagemodelPackage.eINSTANCE).save(URI.createFileURI(filePath), (UsageModel) model);
    } else {
        throw new IllegalArgumentException("The EObject passed to this stage must be a PCM model!");
    }
    this.getOutputPort().send(new File(filePath));
}
Also used : CloudProfile(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProfile) ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) QMLDeclarations(de.uka.ipd.sdq.dsexplore.qml.declarations.QMLDeclarations.QMLDeclarations) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) System(org.palladiosimulator.pcm.system.System) CostRepository(de.uka.ipd.sdq.pcm.cost.CostRepository) Repository(org.palladiosimulator.pcm.repository.Repository) FileModelHandler(org.iobserve.model.persistence.file.FileModelHandler) Allocation(org.palladiosimulator.pcm.allocation.Allocation) CostRepository(de.uka.ipd.sdq.pcm.cost.CostRepository) DecisionSpace(de.uka.ipd.sdq.pcm.designdecision.DecisionSpace) UsageModel(org.palladiosimulator.pcm.usagemodel.UsageModel) File(java.io.File)

Example 2 with DecisionSpace

use of de.uka.ipd.sdq.pcm.designdecision.DecisionSpace in project iobserve-analysis by research-iobserve.

the class DesignDecisionModelFactory method createDecisionSpace.

/**
 * Creates a new decision space with the specified name.
 *
 * @param name
 *            the name of the decision space
 * @return the new decision space
 */
public static DecisionSpace createDecisionSpace(final String name) {
    final DecisionSpace decisionSpace = designdecisionFactory.eINSTANCE.createDecisionSpace();
    decisionSpace.setId(EcoreUtil.generateUUID());
    decisionSpace.setName(name);
    return decisionSpace;
}
Also used : DecisionSpace(de.uka.ipd.sdq.pcm.designdecision.DecisionSpace)

Example 3 with DecisionSpace

use of de.uka.ipd.sdq.pcm.designdecision.DecisionSpace in project iobserve-analysis by research-iobserve.

the class DeserializePcmModelStage method execute.

@Override
protected void execute(final File modelFile) throws Exception {
    final String modelFileName = modelFile.getName();
    final String modelFileExtension = modelFileName.substring(modelFileName.lastIndexOf('.') + 1);
    final EObject model;
    if (AllocationPackage.eNAME.equals(modelFileExtension)) {
        model = new FileModelHandler<Allocation>(this.resourceSet, AllocationPackage.eINSTANCE).load(URI.createFileURI(modelFile.getAbsolutePath()));
    } else if (CloudprofilePackage.eNAME.equals(modelFileExtension)) {
        model = new FileModelHandler<CloudProfile>(this.resourceSet, CloudprofilePackage.eINSTANCE).load(URI.createFileURI(modelFile.getAbsolutePath()));
    } else if (costPackage.eNAME.equals(modelFileExtension)) {
        model = new FileModelHandler<CostRepository>(this.resourceSet, costPackage.eINSTANCE).load(URI.createFileURI(modelFile.getAbsolutePath()));
    } else if (designdecisionPackage.eNAME.equals(modelFileExtension)) {
        model = new FileModelHandler<DecisionSpace>(this.resourceSet, designdecisionPackage.eINSTANCE).load(URI.createFileURI(modelFile.getAbsolutePath()));
    } else if (QMLDeclarationsPackage.eNAME.equals(modelFileExtension)) {
        model = new FileModelHandler<QMLDeclarations>(this.resourceSet, QMLDeclarationsPackage.eINSTANCE).load(URI.createFileURI(modelFile.getAbsolutePath()));
    } else if (RepositoryPackage.eNAME.equals(modelFileExtension)) {
        model = new FileModelHandler<Repository>(this.resourceSet, RepositoryPackage.eINSTANCE).load(URI.createFileURI(modelFile.getAbsolutePath()));
    } else if (ResourceenvironmentPackage.eNAME.equals(modelFileExtension)) {
        model = new FileModelHandler<ResourceEnvironment>(this.resourceSet, ResourceenvironmentPackage.eINSTANCE).load(URI.createFileURI(modelFile.getAbsolutePath()));
    } else if (SystemPackage.eNAME.equals(modelFileExtension)) {
        model = new FileModelHandler<System>(this.resourceSet, SystemPackage.eINSTANCE).load(URI.createFileURI(modelFile.getAbsolutePath()));
    } else if (UsagemodelPackage.eNAME.equals(modelFileExtension)) {
        model = new FileModelHandler<UsageModel>(this.resourceSet, UsagemodelPackage.eINSTANCE).load(URI.createFileURI(modelFile.getAbsolutePath()));
    } else {
        throw new IllegalArgumentException("File extension does not look like a PCM model!");
    }
    this.getOutputPort().send(model);
}
Also used : CloudProfile(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProfile) CostRepository(de.uka.ipd.sdq.pcm.cost.CostRepository) Repository(org.palladiosimulator.pcm.repository.Repository) FileModelHandler(org.iobserve.model.persistence.file.FileModelHandler) DecisionSpace(de.uka.ipd.sdq.pcm.designdecision.DecisionSpace) EObject(org.eclipse.emf.ecore.EObject) System(org.palladiosimulator.pcm.system.System)

Aggregations

DecisionSpace (de.uka.ipd.sdq.pcm.designdecision.DecisionSpace)3 CostRepository (de.uka.ipd.sdq.pcm.cost.CostRepository)2 FileModelHandler (org.iobserve.model.persistence.file.FileModelHandler)2 CloudProfile (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProfile)2 Repository (org.palladiosimulator.pcm.repository.Repository)2 System (org.palladiosimulator.pcm.system.System)2 QMLDeclarations (de.uka.ipd.sdq.dsexplore.qml.declarations.QMLDeclarations.QMLDeclarations)1 File (java.io.File)1 EObject (org.eclipse.emf.ecore.EObject)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 Allocation (org.palladiosimulator.pcm.allocation.Allocation)1 ResourceEnvironment (org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment)1 UsageModel (org.palladiosimulator.pcm.usagemodel.UsageModel)1