use of org.palladiosimulator.pcm.allocation.Allocation in project Palladio-Editors-Sirius by PalladioSimulator.
the class AllocationCreationWizard method init.
@Override
protected void init(IStructuredSelection selection) {
String viewpointName = Activator.VIEWPOINT_NAME;
viewpoint = Activator.getDefault().getViewpoint();
String ext = Activator.getDefault().getViewpoint().getModelFileExtension();
modelCreationPage = new ModelCreationPage(selection, viewpointName + " Creation Wizard", "new" + viewpointName, ext);
representationDescription = Activator.getDefault().getRepresentationDescription();
String defaultRepresentationName = "new " + Activator.REPRESENTATION_NAME;
this.representationCreationPage.setDefaultRepresentationName(defaultRepresentationName);
resourceEnvironmentSelectorpage = new ResourceEnvironmentSelectorPage();
systemSelectorPage = new SystemSelectorPage();
additionalPages.add(resourceEnvironmentSelectorpage);
additionalPages.add(systemSelectorPage);
Allocation obj = AllocationFactory.eINSTANCE.createAllocation();
obj.setEntityName("New Allocation");
modelObject = obj;
}
use of org.palladiosimulator.pcm.allocation.Allocation in project iobserve-analysis by research-iobserve.
the class AnalysisMain method createTeetimeConfiguration.
@Override
protected AnalysisConfiguration createTeetimeConfiguration() throws ConfigurationException {
/**
* Configure model handling.
*/
if (this.parameterConfiguration.isPcmFeature()) {
try {
final ModelImporter modelHandler = new ModelImporter(this.parameterConfiguration.getModelInitDirectory());
/**
* initialize neo4j graphs.
*/
final Neo4JModelResource<CorrespondenceModel> correspondenceModelResource = new Neo4JModelResource<>(CorrespondencePackage.eINSTANCE, new File(this.parameterConfiguration.getModelDatabaseDirectory(), "correspondence"));
correspondenceModelResource.storeModelPartition(modelHandler.getCorrespondenceModel());
final Neo4JModelResource<Repository> repositoryModelResource = new Neo4JModelResource<>(RepositoryPackage.eINSTANCE, new File(this.parameterConfiguration.getModelDatabaseDirectory(), "repository"));
repositoryModelResource.storeModelPartition(modelHandler.getRepositoryModel());
final Neo4JModelResource<ResourceEnvironment> resourceEnvironmentModelResource = new Neo4JModelResource<>(ResourceenvironmentPackage.eINSTANCE, // add
new File(this.parameterConfiguration.getModelDatabaseDirectory(), "resourceenvironment"));
resourceEnvironmentModelResource.storeModelPartition(modelHandler.getResourceEnvironmentModel());
final Neo4JModelResource<System> systemModelResource = new Neo4JModelResource<>(SystemPackage.eINSTANCE, new File(this.parameterConfiguration.getModelDatabaseDirectory(), "system"));
systemModelResource.storeModelPartition(modelHandler.getSystemModel());
final Neo4JModelResource<Allocation> allocationModelResource = new Neo4JModelResource<>(AllocationPackage.eINSTANCE, new File(this.parameterConfiguration.getModelDatabaseDirectory(), "allocation"));
allocationModelResource.storeModelPartition(modelHandler.getAllocationModel());
final Neo4JModelResource<UsageModel> usageModelResource = new Neo4JModelResource<>(UsagemodelPackage.eINSTANCE, new File(this.parameterConfiguration.getModelDatabaseDirectory(), "usageModel"));
usageModelResource.storeModelPartition(modelHandler.getUsageModel());
final Neo4JModelResource<DataProtectionModel> privacyModelResource = new Neo4JModelResource<>(PrivacyPackage.eINSTANCE, new File(this.parameterConfiguration.getModelDatabaseDirectory(), "privacy"));
privacyModelResource.storeModelPartition(modelHandler.getPrivacyModel());
// get systemId
final System systemModel = systemModelResource.getModelRootNode(System.class, SystemPackage.Literals.SYSTEM);
this.kiekerConfiguration.setProperty(ConfigurationKeys.SYSTEM_ID, systemModel.getId());
return new AnalysisConfiguration(this.kiekerConfiguration, repositoryModelResource, resourceEnvironmentModelResource, systemModelResource, allocationModelResource, usageModelResource, correspondenceModelResource);
} catch (final IOException e) {
// TODO should be replaced by logger
// NOPMD
java.lang.System.err.println("Cannot load all models " + e.getLocalizedMessage());
// required
return null;
} catch (final DBException e) {
// TODO should be replaced by logger
// NOPMD
java.lang.System.err.println("Cannot store all models in DB " + e.getLocalizedMessage());
// required
return null;
}
} else {
return new AnalysisConfiguration(this.kiekerConfiguration);
}
}
use of org.palladiosimulator.pcm.allocation.Allocation in project iobserve-analysis by research-iobserve.
the class AssemblyContextActionFactory method generateMigrateAction.
/**
* Create a migration action.
*
* @param runtimeNode
* source node
* @param reDeploymentNode
* target node
* @return returns the migration action
*/
public static MigrateAction generateMigrateAction(final ComponentNode runtimeNode, final ComponentNode reDeploymentNode) {
final MigrateAction action = SystemadaptationFactory.eINSTANCE.createMigrateAction();
final Allocation runtimeAllocation = ActionFactory.getRuntimeModels().getAllocationModel();
final Allocation redeploymentAllocation = ActionFactory.getRedeploymentModels().getAllocationModel();
final System runtimeSystem = ActionFactory.getRuntimeModels().getSystemModel();
final System redeploymentSystem = ActionFactory.getRedeploymentModels().getSystemModel();
AssemblyContextActionFactory.initializeAssemblyContextAction(action, reDeploymentNode, redeploymentAllocation, redeploymentSystem);
action.setSourceAllocationContext(ActionFactory.getAllocationContext(runtimeNode.getAllocationContextID(), runtimeAllocation));
// source providing allocation contexts
ActionFactory.getProvidingAssemblyContexts(runtimeNode.getAssemblyContextID(), runtimeSystem).forEach(ac -> action.getSourceProvidingAllocationContexts().add(ActionFactory.getAllocationContextContainingAssemblyContext(ac.getId(), runtimeAllocation)));
// source requiring allocation contexts
ActionFactory.getRequiringAssemblyContexts(runtimeNode.getAssemblyContextID(), runtimeSystem).forEach(ac -> action.getSourceRequiringAllocationContexts().add(ActionFactory.getAllocationContextContainingAssemblyContext(ac.getId(), runtimeAllocation)));
return action;
}
use of org.palladiosimulator.pcm.allocation.Allocation in project iobserve-analysis by research-iobserve.
the class AssemblyContextActionFactory method generateChangeRepositoryComponentAction.
/**
* Create a change repository component action.
*
* @param runtimeNode
* node to be changed
* @param reDeploymentNode
* target node
* @return returns the composed action
*/
public static ChangeRepositoryComponentAction generateChangeRepositoryComponentAction(final ComponentNode runtimeNode, final ComponentNode reDeploymentNode) {
final ChangeRepositoryComponentAction action = SystemadaptationFactory.eINSTANCE.createChangeRepositoryComponentAction();
final Allocation runtimeAllocation = ActionFactory.getRuntimeModels().getAllocationModel();
final Allocation redeploymentAllocation = ActionFactory.getRedeploymentModels().getAllocationModel();
final System redeploymentSystem = ActionFactory.getRedeploymentModels().getSystemModel();
AssemblyContextActionFactory.initializeAssemblyContextAction(action, reDeploymentNode, redeploymentAllocation, redeploymentSystem);
action.setSourceAllocationContext(ActionFactory.getAllocationContext(runtimeNode.getAllocationContextID(), runtimeAllocation));
return action;
}
use of org.palladiosimulator.pcm.allocation.Allocation in project iobserve-analysis by research-iobserve.
the class NetworkLink method execute.
/**
* Execute this filter.
*
* @param event
* event to use
* @throws NodeLookupException
* @throws DBException
* on db errors
*/
@Override
protected void execute(final TraceMetadata event) throws NodeLookupException, DBException {
final ResourceEnvironment resourceEnvironment = this.resourceEnvironmentModelResource.getAndLockModelRootNode(ResourceEnvironment.class, ResourceenvironmentPackage.Literals.RESOURCE_ENVIRONMENT);
final System system = this.systemModelResource.getModelRootNode(System.class, SystemPackage.Literals.SYSTEM);
final Allocation allocation = this.allocationModelResource.getModelRootNode(Allocation.class, AllocationPackage.Literals.ALLOCATION);
NetworkLink.collectUnLinkedResourceContainer(resourceEnvironment).stream().forEach(unLinkedResCont -> {
NetworkLink.getAsmContextDeployedOnContainer(allocation, unLinkedResCont).stream().map(asmCtx -> NetworkLink.getConnectedAsmCtx(system, asmCtx)).map(listAsmCtxToConnect -> NetworkLink.collectResourceContainer(allocation, listAsmCtxToConnect)).map(listResContToConnectTo -> NetworkLink.getLinkingResources(resourceEnvironment, listResContToConnectTo)).flatMap(l -> l.stream()).collect(Collectors.toList()).stream().forEach(link -> link.getConnectedResourceContainers_LinkingResource().add(unLinkedResCont));
});
this.resourceEnvironmentModelResource.updatePartition(resourceEnvironment);
}
Aggregations