Search in sources :

Example 1 with CommunicationLinkResourceSpecification

use of org.palladiosimulator.pcm.resourceenvironment.CommunicationLinkResourceSpecification in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddLinkingResourceAction method execute.

@Override
public void execute(final Collection<? extends EObject> selections, final Map<String, Object> parameters) {
    final Object parameter = parameters.get(NEW_COMMUNICATION_LINK_RESOURCE_SPECIFICATION);
    if (parameter == null || !(parameter instanceof CommunicationLinkResourceSpecification)) {
        return;
    }
    final CommunicationLinkResourceSpecification communicationLinkResourceSpecification = (CommunicationLinkResourceSpecification) parameter;
    // latency
    final PCMRandomVariable latency = getRandomVariableFromStoExDialog(LATENCY_DISPLAY_TITLE);
    if (latency == null) {
        return;
    }
    communicationLinkResourceSpecification.setLatency_CommunicationLinkResourceSpecification(latency);
    // throughput
    final PCMRandomVariable throughput = getRandomVariableFromStoExDialog(THROUGHPUT_DISPLAY_TITLE);
    if (throughput == null) {
        return;
    }
    communicationLinkResourceSpecification.setThroughput_CommunicationLinkResourceSpecification(throughput);
    // Communication Link
    Session session = SessionManager.INSTANCE.getSession(communicationLinkResourceSpecification);
    URI uri = URI.createURI("pathmap://PCM_MODELS/Palladio.resourcetype");
    Resource palladioResources = SiriusCustomUtil.getResourceByURI(uri, session);
    if (palladioResources != null) {
        ResourceRepository rep = (ResourceRepository) palladioResources.getContents().iterator().next();
        for (EObject o : rep.eContents()) {
            if ((o instanceof CommunicationLinkResourceType) && ((CommunicationLinkResourceType) o).getEntityName().equals("LAN")) {
                communicationLinkResourceSpecification.setCommunicationLinkResourceType_CommunicationLinkResourceSpecification((CommunicationLinkResourceType) o);
                break;
            }
        }
    }
}
Also used : CommunicationLinkResourceSpecification(org.palladiosimulator.pcm.resourceenvironment.CommunicationLinkResourceSpecification) EObject(org.eclipse.emf.ecore.EObject) CommunicationLinkResourceType(org.palladiosimulator.pcm.resourcetype.CommunicationLinkResourceType) Resource(org.eclipse.emf.ecore.resource.Resource) EObject(org.eclipse.emf.ecore.EObject) ResourceRepository(org.palladiosimulator.pcm.resourcetype.ResourceRepository) URI(org.eclipse.emf.common.util.URI) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable) Session(org.eclipse.sirius.business.api.session.Session)

Example 2 with CommunicationLinkResourceSpecification

use of org.palladiosimulator.pcm.resourceenvironment.CommunicationLinkResourceSpecification in project Palladio-Editors-Sirius by PalladioSimulator.

the class EditLinkingResourceFailureProbability method setProbability.

@Override
protected void setProbability(EObject eObject, double probability) {
    CommunicationLinkResourceSpecification c = (CommunicationLinkResourceSpecification) eObject;
    c.setFailureProbability(probability);
}
Also used : CommunicationLinkResourceSpecification(org.palladiosimulator.pcm.resourceenvironment.CommunicationLinkResourceSpecification)

Aggregations

CommunicationLinkResourceSpecification (org.palladiosimulator.pcm.resourceenvironment.CommunicationLinkResourceSpecification)2 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 Session (org.eclipse.sirius.business.api.session.Session)1 PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)1 CommunicationLinkResourceType (org.palladiosimulator.pcm.resourcetype.CommunicationLinkResourceType)1 ResourceRepository (org.palladiosimulator.pcm.resourcetype.ResourceRepository)1