Search in sources :

Example 36 with ResourceEnvironment

use of org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment in project iobserve-analysis by research-iobserve.

the class PrivacyViolationDetectionServiceMain method createConfiguration.

@Override
protected PrivacyViolationDetectionConfiguration createConfiguration(final Configuration configuration) throws ConfigurationException {
    /**
     * load models.
     */
    final PCMModelHandler modelHandler = new PCMModelHandler(this.pcmDirectory);
    final GraphLoader graphLoader = new GraphLoader(this.modelDatabaseDirectory);
    final Graph allocationModelGraph = graphLoader.initializeAllocationModelGraph(modelHandler.getAllocationModel());
    final Graph resourceEnvironmentGraph = graphLoader.initializeResourceEnvironmentModelGraph(modelHandler.getResourceEnvironmentModel());
    final Graph systemGraph = graphLoader.initializeSystemModelGraph(modelHandler.getSystemModel());
    final ModelProvider<Allocation> allocationModelProvider = new ModelProvider<>(allocationModelGraph);
    final ModelProvider<ResourceEnvironment> resourceEnvironmentModelProvider = new ModelProvider<>(resourceEnvironmentGraph);
    final ModelProvider<System> systemModelProvider = new ModelProvider<>(systemGraph);
    try {
        return new PrivacyViolationDetectionConfiguration(this.inputPort, this.outputs, modelHandler.getCorrespondenceModel(), resourceEnvironmentModelProvider, allocationModelProvider, systemModelProvider, this.warningFile, this.alarmsFile);
    } catch (final IOException e) {
        throw new ConfigurationException(e);
    }
}
Also used : ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) ModelProvider(org.iobserve.model.provider.neo4j.ModelProvider) PCMModelHandler(org.iobserve.model.PCMModelHandler) IOException(java.io.IOException) System(org.palladiosimulator.pcm.system.System) Graph(org.iobserve.model.provider.neo4j.Graph) GraphLoader(org.iobserve.model.provider.neo4j.GraphLoader) Allocation(org.palladiosimulator.pcm.allocation.Allocation) ConfigurationException(org.iobserve.stages.general.ConfigurationException)

Example 37 with ResourceEnvironment

use of org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment in project iobserve-analysis by research-iobserve.

the class ModelGenerationFactory method createNewModel.

public static void createNewModel(final CommandLine commandLine) throws InitializationException, IOException {
    ModelGenerationFactory.LOGGER.info("Creating new model!");
    final URI repoLocation = URI.createFileURI(commandLine.getOptionValue("i"));
    final URI outputLocation = URI.createFileURI(commandLine.getOptionValue("o"));
    ModelGenerationFactory.LOGGER.info("Copying repository model to new location.");
    final RepositoryModelHandler repoModelProvider = new RepositoryModelHandler();
    repoModelProvider.load(repoLocation);
    ModelGenerationFactory.copyRepoToOutput(outputLocation, repoModelProvider);
    ModelGenerationFactory.LOGGER.info("Generating system model.");
    final System systemModel = ModelGenerationFactory.generateAndSaveSystem(commandLine, outputLocation);
    ModelGenerationFactory.LOGGER.info("Generating resource environment model.");
    final ResourceEnvironment resEnvModel = ModelGenerationFactory.generateAndSaveResourceEnvironment(commandLine, outputLocation, systemModel.getEntityName());
    ModelGenerationFactory.LOGGER.info("Generating allocation model.");
    ModelGenerationFactory.generateAndSaveAllocation(outputLocation, systemModel, resEnvModel);
    ModelGenerationFactory.LOGGER.info("Generating done!");
}
Also used : RepositoryModelHandler(org.iobserve.model.provider.file.RepositoryModelHandler) ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) URI(org.eclipse.emf.common.util.URI) System(org.palladiosimulator.pcm.system.System)

Example 38 with ResourceEnvironment

use of org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment in project iobserve-analysis by research-iobserve.

the class AllocationModelProviderTest method createThenUpdateThenReadUpdated.

@Override
@Test
public void createThenUpdateThenReadUpdated() {
    final ModelProvider<Allocation> modelProvider = new ModelProvider<>(AllocationModelProviderTest.graph);
    final TestModelBuilder testModelBuilder = new TestModelBuilder();
    final Allocation writtenModel = testModelBuilder.getAllocation();
    final AllocationContext businessOrderServerAllocationContext = testModelBuilder.getBusinessOrderServerAllocationContext();
    final AllocationContext privateOrderServerAllocationContext = testModelBuilder.getPrivateOrderServerAllocationContext();
    final Allocation readModel;
    modelProvider.createComponent(writtenModel);
    // Update the model by allocating new separate servers for business and private orders
    final ResourceEnvironment resourceEnvironment = testModelBuilder.getResourceEnvironment();
    final ResourceContainer businessOrderServer = ResourceenvironmentFactory.eINSTANCE.createResourceContainer();
    businessOrderServer.setEntityName("businessOrderServer");
    businessOrderServer.setResourceEnvironment_ResourceContainer(testModelBuilder.getResourceEnvironment());
    businessOrderServer.getActiveResourceSpecifications_ResourceContainer().add(testModelBuilder.getOrderServerSpecification());
    final ResourceContainer privateOrderServer = ResourceenvironmentFactory.eINSTANCE.createResourceContainer();
    privateOrderServer.setEntityName("privateOrderServer");
    privateOrderServer.setResourceEnvironment_ResourceContainer(testModelBuilder.getResourceEnvironment());
    privateOrderServer.getActiveResourceSpecifications_ResourceContainer().add(testModelBuilder.getOrderServerSpecification());
    resourceEnvironment.getResourceContainer_ResourceEnvironment().add(businessOrderServer);
    resourceEnvironment.getResourceContainer_ResourceEnvironment().add(privateOrderServer);
    businessOrderServerAllocationContext.setResourceContainer_AllocationContext(businessOrderServer);
    privateOrderServerAllocationContext.setResourceContainer_AllocationContext(privateOrderServer);
    modelProvider.updateComponent(Allocation.class, writtenModel);
    readModel = modelProvider.readOnlyRootComponent(Allocation.class);
    Assert.assertTrue(this.equalityHelper.equals(writtenModel, readModel));
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) Allocation(org.palladiosimulator.pcm.allocation.Allocation) ResourceContainer(org.palladiosimulator.pcm.resourceenvironment.ResourceContainer) Test(org.junit.Test)

Example 39 with ResourceEnvironment

use of org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment in project iobserve-analysis by research-iobserve.

the class ResourceEnvironmentModelProviderTest method createThenClearGraph.

@Override
@Test
public void createThenClearGraph() {
    final ModelProvider<ResourceEnvironment> modelProvider = new ModelProvider<>(ResourceEnvironmentModelProviderTest.graph);
    final ResourceEnvironment writtenModel = new TestModelBuilder().getResourceEnvironment();
    modelProvider.createComponent(writtenModel);
    Assert.assertFalse(IModelProviderTest.isGraphEmpty(modelProvider));
    modelProvider.clearGraph();
    Assert.assertTrue(IModelProviderTest.isGraphEmpty(modelProvider));
}
Also used : ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) Test(org.junit.Test)

Example 40 with ResourceEnvironment

use of org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment in project iobserve-analysis by research-iobserve.

the class ResourceEnvironmentModelProviderTest method createThenUpdateThenReadUpdated.

@Override
@Test
public void createThenUpdateThenReadUpdated() {
    final ModelProvider<ResourceEnvironment> modelProvider = new ModelProvider<>(ResourceEnvironmentModelProviderTest.graph);
    final TestModelBuilder testModelBuilder = new TestModelBuilder();
    final ResourceEnvironment writtenModel = testModelBuilder.getResourceEnvironment();
    final ResourceContainer orderServer = testModelBuilder.getOrderServer();
    final LinkingResource writtenLan1 = testModelBuilder.getLan1();
    final ResourceEnvironment readModel;
    modelProvider.createComponent(writtenModel);
    // Update the model by replacing the orderServer by two separated servers
    writtenModel.getResourceContainer_ResourceEnvironment().remove(orderServer);
    writtenLan1.getConnectedResourceContainers_LinkingResource().remove(orderServer);
    final ResourceContainer businessOrderServer = ResourceenvironmentFactory.eINSTANCE.createResourceContainer();
    final ProcessingResourceSpecification businessOrderServerSpecification = ResourceenvironmentFactory.eINSTANCE.createProcessingResourceSpecification();
    final ProcessingResourceType businessOrderServerType = ResourcetypeFactory.eINSTANCE.createProcessingResourceType();
    businessOrderServer.setEntityName("businessOrderServer");
    businessOrderServer.setResourceEnvironment_ResourceContainer(writtenModel);
    businessOrderServer.getActiveResourceSpecifications_ResourceContainer().add(businessOrderServerSpecification);
    businessOrderServerSpecification.setActiveResourceType_ActiveResourceSpecification(businessOrderServerType);
    businessOrderServerType.setEntityName("Cisco Business Server PRO");
    final ResourceContainer privateOrderServer = ResourceenvironmentFactory.eINSTANCE.createResourceContainer();
    final ProcessingResourceSpecification privateOrderServerSpecification = ResourceenvironmentFactory.eINSTANCE.createProcessingResourceSpecification();
    final ProcessingResourceType privateOrderServerType = ResourcetypeFactory.eINSTANCE.createProcessingResourceType();
    privateOrderServer.setEntityName("privateOrderServer");
    privateOrderServer.setResourceEnvironment_ResourceContainer(writtenModel);
    privateOrderServer.getActiveResourceSpecifications_ResourceContainer().add(privateOrderServerSpecification);
    privateOrderServerSpecification.setActiveResourceType_ActiveResourceSpecification(privateOrderServerType);
    privateOrderServerType.setEntityName("Lenovo High Load Server PRO");
    writtenModel.getResourceContainer_ResourceEnvironment().add(businessOrderServer);
    writtenModel.getResourceContainer_ResourceEnvironment().add(privateOrderServer);
    writtenLan1.getConnectedResourceContainers_LinkingResource().add(businessOrderServer);
    writtenLan1.getConnectedResourceContainers_LinkingResource().add(privateOrderServer);
    modelProvider.updateComponent(ResourceEnvironment.class, writtenModel);
    readModel = modelProvider.readOnlyRootComponent(ResourceEnvironment.class);
    Assert.assertTrue(this.equalityHelper.equals(writtenModel, readModel));
}
Also used : ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) LinkingResource(org.palladiosimulator.pcm.resourceenvironment.LinkingResource) ProcessingResourceSpecification(org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification) ProcessingResourceType(org.palladiosimulator.pcm.resourcetype.ProcessingResourceType) ResourceContainer(org.palladiosimulator.pcm.resourceenvironment.ResourceContainer) Test(org.junit.Test)

Aggregations

ResourceEnvironment (org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment)55 ResourceContainer (org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)23 Test (org.junit.Test)15 CostRepository (de.uka.ipd.sdq.pcm.cost.CostRepository)12 Allocation (org.palladiosimulator.pcm.allocation.Allocation)12 LinkingResource (org.palladiosimulator.pcm.resourceenvironment.LinkingResource)12 VMType (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.VMType)11 CloudProfile (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProfile)8 ResourceContainerCloud (org.palladiosimulator.pcm.cloud.pcmcloud.resourceenvironmentcloud.ResourceContainerCloud)8 System (org.palladiosimulator.pcm.system.System)8 CloudProvider (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudProvider)7 CloudResourceType (org.palladiosimulator.pcm.cloud.pcmcloud.cloudprofile.CloudResourceType)7 EObject (org.eclipse.emf.ecore.EObject)6 ProcessingResourceSpecification (org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification)6 UsageModel (org.palladiosimulator.pcm.usagemodel.UsageModel)6 IOException (java.io.IOException)5 URI (org.eclipse.emf.common.util.URI)5 PCMModelHandler (org.iobserve.model.PCMModelHandler)5 ResourceEnvironmentModelHandler (org.iobserve.model.provider.file.ResourceEnvironmentModelHandler)5 AllocationContext (org.palladiosimulator.pcm.allocation.AllocationContext)5