use of de.uka.ipd.sdq.dsexplore.qml.declarations.QMLDeclarations.QMLDeclarations 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));
}
Aggregations