Search in sources :

Example 1 with ResourceEnvironmentModelHandler

use of org.iobserve.model.provider.file.ResourceEnvironmentModelHandler in project iobserve-analysis by research-iobserve.

the class ModelGenerationFactory method generateAndSaveResourceEnvironment.

private static ResourceEnvironment generateAndSaveResourceEnvironment(final CommandLine commandLine, final URI outputLocation, final String modelName) {
    final ResourceEnvironmentGeneration resEnvGen = new ResourceEnvironmentGeneration(modelName);
    final ResourceEnvironment resEnvModel = resEnvGen.craeteResourceEnvironment(Integer.parseInt(commandLine.getOptionValue("r")));
    final ResourceEnvironmentModelHandler resEnvModelProvider = new ResourceEnvironmentModelHandler();
    final URI resEnvModelURI = URI.createFileURI(outputLocation.toFileString() + File.separator + resEnvModel.getEntityName() + ".resourceenvironment");
    resEnvModelProvider.save(resEnvModelURI, resEnvModel);
    return resEnvModel;
}
Also used : ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) ResourceEnvironmentModelHandler(org.iobserve.model.provider.file.ResourceEnvironmentModelHandler) URI(org.eclipse.emf.common.util.URI)

Example 2 with ResourceEnvironmentModelHandler

use of org.iobserve.model.provider.file.ResourceEnvironmentModelHandler in project iobserve-analysis by research-iobserve.

the class ModelHelper method fillResourceEnvironmentFromCloudProfile.

/**
 * Creates resource containers and their associated costs from the cloud profile given in the
 * model provider.
 *
 * The created resource containers are of the type {@link ResourceContainerCloud} and are
 * connected via an Internet linking resource
 * ({@link #getInternetLinkingResource(ResourceEnvironment)}. For every vm type in the cloud
 * profile, this method creates one resource container representing an instance of this specific
 * vm type. The model is saved after the creation of containers is completed.
 *
 * @param writeURI
 *            location where all files are stored
 * @param modelHandler
 *            the model providers with an initialized resource environment, cost model and cloud
 *            profile
 * @throws ModelHandlingErrorException
 *             model handling issue
 */
public static void fillResourceEnvironmentFromCloudProfile(final org.eclipse.emf.common.util.URI writeURI, final PCMModelHandler modelHandler) throws ModelHandlingErrorException {
    final ResourceEnvironment environment = modelHandler.getResourceEnvironmentModel();
    final CloudProfile cloudProfileModel = modelHandler.getCloudProfileModel();
    final CostRepository costRepositoryModel = modelHandler.getCostModel();
    for (final CloudProvider provider : cloudProfileModel.getCloudProviders()) {
        for (final CloudResourceType cloudResource : provider.getCloudResources()) {
            if (cloudResource instanceof VMType) {
                final VMType cloudVM = (VMType) cloudResource;
                ModelHelper.createResourceContainerFromVMType(environment, costRepositoryModel, cloudVM, cloudVM.getName());
            }
        }
    }
    new ResourceEnvironmentModelHandler().save(writeURI.appendFileExtension(PCMModelHandler.RESOURCE_ENVIRONMENT_SUFFIX), environment);
    new CostModelHandler().save(writeURI.appendFileExtension(PCMModelHandler.COST_SUFFIX), costRepositoryModel);
}
Also used : CloudProfile(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProfile) ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) CloudResourceType(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudResourceType) VMType(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.VMType) CostRepository(de.uka.ipd.sdq.pcm.cost.CostRepository) CostModelHandler(org.iobserve.model.provider.file.CostModelHandler) CloudProvider(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProvider) ResourceEnvironmentModelHandler(org.iobserve.model.provider.file.ResourceEnvironmentModelHandler)

Example 3 with ResourceEnvironmentModelHandler

use of org.iobserve.model.provider.file.ResourceEnvironmentModelHandler in project iobserve-analysis by research-iobserve.

the class PCMModelHandler method save.

/**
 * Saves all currently available models in this provider into the snapshot location.
 *
 * @param fileLocationURI
 *            the location directory for the snapshot
 */
public void save(final URI fileLocationURI) {
    new AllocationModelHandler().save(fileLocationURI.appendFileExtension(PCMModelHandler.ALLOCATION_SUFFIX), this.allocationModel);
    new CloudProfileModelHandler().save(fileLocationURI.appendFileExtension(PCMModelHandler.CLOUD_PROFILE_SUFFIX), this.cloudProfileModel);
    new CostModelHandler().save(fileLocationURI.appendFileExtension(PCMModelHandler.COST_SUFFIX), this.costModel);
    new DesignDecisionModelHandler().save(fileLocationURI.appendFileExtension(PCMModelHandler.DESIGN_DECISION_SUFFIX), this.designDecisionModel);
    new RepositoryModelHandler().save(fileLocationURI.appendFileExtension(PCMModelHandler.REPOSITORY_SUFFIX), this.repositoryModel);
    new ResourceEnvironmentModelHandler().save(fileLocationURI.appendFileExtension(PCMModelHandler.RESOURCE_ENVIRONMENT_SUFFIX), this.resourceEnvironmentModel);
    new SystemModelHandler().save(fileLocationURI.appendFileExtension(PCMModelHandler.SYSTEM_SUFFIX), this.systemModel);
    new UsageModelHandler().save(fileLocationURI.appendFileExtension(PCMModelHandler.USAGE_MODEL_SUFFIX), this.usageModel);
    new QMLDeclarationsModelHandler().save(fileLocationURI.appendFileExtension(PCMModelHandler.QML_DECLARATIONS_MODEL), this.qmlDeclarationsModel);
}
Also used : RepositoryModelHandler(org.iobserve.model.provider.file.RepositoryModelHandler) AllocationModelHandler(org.iobserve.model.provider.file.AllocationModelHandler) CostModelHandler(org.iobserve.model.provider.file.CostModelHandler) DesignDecisionModelHandler(org.iobserve.model.provider.file.DesignDecisionModelHandler) ResourceEnvironmentModelHandler(org.iobserve.model.provider.file.ResourceEnvironmentModelHandler) UsageModelHandler(org.iobserve.model.provider.file.UsageModelHandler) QMLDeclarationsModelHandler(org.iobserve.model.provider.file.QMLDeclarationsModelHandler) CloudProfileModelHandler(org.iobserve.model.provider.file.CloudProfileModelHandler) SystemModelHandler(org.iobserve.model.provider.file.SystemModelHandler)

Example 4 with ResourceEnvironmentModelHandler

use of org.iobserve.model.provider.file.ResourceEnvironmentModelHandler in project iobserve-analysis by research-iobserve.

the class ModelHelper method fillResourceEnvironmentFromCloudProfile.

/**
 * Creates resource containers and their associated costs from the cloud profile given in the
 * model provider.
 *
 * The created resource containers are of the type {@link ResourceContainerCloud} and are
 * connected via an Internet linking resource
 * ({@link #getInternetLinkingResource(ResourceEnvironment)}. For every vm type in the cloud
 * profile, this method creates one resource container representing an instance of this specific
 * vm type. The model is saved after the creation of containers is completed.
 *
 * @param writeURI
 *            location where all files are stored
 * @param modelHandler
 *            the model providers with an initialized resource environment, cost model and cloud
 *            profile
 * @throws ModelHandlingErrorException
 *             model handling error
 */
public static void fillResourceEnvironmentFromCloudProfile(final org.eclipse.emf.common.util.URI writeURI, final PCMModelHandler modelHandler) throws ModelHandlingErrorException {
    final ResourceEnvironment environment = modelHandler.getResourceEnvironmentModel();
    final CloudProfile cloudProfileModel = modelHandler.getCloudProfileModel();
    final CostRepository costRepositoryModel = modelHandler.getCostModel();
    for (final CloudProvider provider : cloudProfileModel.getCloudProviders()) {
        for (final CloudResourceType cloudResource : provider.getCloudResources()) {
            if (cloudResource instanceof VMType) {
                final VMType cloudVM = (VMType) cloudResource;
                ModelHelper.createResourceContainerFromVMType(environment, costRepositoryModel, cloudVM, cloudVM.getName());
            }
        }
    }
    new ResourceEnvironmentModelHandler().save(writeURI.appendFileExtension(PCMModelHandler.RESOURCE_ENVIRONMENT_SUFFIX), environment);
    new CostModelHandler().save(writeURI.appendFileExtension(PCMModelHandler.COST_SUFFIX), costRepositoryModel);
}
Also used : CloudProfile(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProfile) ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) CloudResourceType(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudResourceType) VMType(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.VMType) CostRepository(de.uka.ipd.sdq.pcm.cost.CostRepository) CostModelHandler(org.iobserve.model.provider.file.CostModelHandler) CloudProvider(org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProvider) ResourceEnvironmentModelHandler(org.iobserve.model.provider.file.ResourceEnvironmentModelHandler)

Example 5 with ResourceEnvironmentModelHandler

use of org.iobserve.model.provider.file.ResourceEnvironmentModelHandler in project iobserve-analysis by research-iobserve.

the class ModelTransformer method saveModels.

private void saveModels() {
    new DesignDecisionModelHandler().save(this.processedModelDir.appendFileExtension(PCMModelHandler.DESIGN_DECISION_SUFFIX), this.decisionModel);
    new AllocationModelHandler().save(this.processedModelDir.appendFileExtension(PCMModelHandler.ALLOCATION_SUFFIX), this.allocationModel);
    new CostModelHandler().save(this.processedModelDir.appendFileExtension(PCMModelHandler.COST_SUFFIX), this.costModel);
    new ResourceEnvironmentModelHandler().save(this.processedModelDir.appendFileExtension(PCMModelHandler.RESOURCE_ENVIRONMENT_SUFFIX), this.resourceEnvironmentModel);
}
Also used : AllocationModelHandler(org.iobserve.model.provider.file.AllocationModelHandler) DesignDecisionModelHandler(org.iobserve.model.provider.file.DesignDecisionModelHandler) CostModelHandler(org.iobserve.model.provider.file.CostModelHandler) ResourceEnvironmentModelHandler(org.iobserve.model.provider.file.ResourceEnvironmentModelHandler)

Aggregations

ResourceEnvironmentModelHandler (org.iobserve.model.provider.file.ResourceEnvironmentModelHandler)5 CostModelHandler (org.iobserve.model.provider.file.CostModelHandler)4 ResourceEnvironment (org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment)3 CostRepository (de.uka.ipd.sdq.pcm.cost.CostRepository)2 AllocationModelHandler (org.iobserve.model.provider.file.AllocationModelHandler)2 DesignDecisionModelHandler (org.iobserve.model.provider.file.DesignDecisionModelHandler)2 CloudProfile (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProfile)2 CloudProvider (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProvider)2 CloudResourceType (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudResourceType)2 VMType (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.VMType)2 URI (org.eclipse.emf.common.util.URI)1 CloudProfileModelHandler (org.iobserve.model.provider.file.CloudProfileModelHandler)1 QMLDeclarationsModelHandler (org.iobserve.model.provider.file.QMLDeclarationsModelHandler)1 RepositoryModelHandler (org.iobserve.model.provider.file.RepositoryModelHandler)1 SystemModelHandler (org.iobserve.model.provider.file.SystemModelHandler)1 UsageModelHandler (org.iobserve.model.provider.file.UsageModelHandler)1