Search in sources :

Example 1 with InfrastructureSignature

use of org.palladiosimulator.pcm.repository.InfrastructureSignature in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetInfrastructureSignature method getSignature.

private InfrastructureSignature getSignature(InfrastructureCall call) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(InfrastructureInterface.class);
    filter.add(InfrastructureSignature.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, call.eResource().getResourceSet());
    dialog.setProvidedService(InfrastructureSignature.class);
    // only take required InfrastructureInterfaces
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        if (!(o instanceof InfrastructureInterface))
            continue;
        ServiceEffectSpecification seff = (ServiceEffectSpecification) call.getAction__InfrastructureCall().getResourceDemandingBehaviour_AbstractAction();
        BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
        boolean found = false;
        for (RequiredRole r : parent.getRequiredRoles_InterfaceRequiringEntity()) {
            if (!(r instanceof InfrastructureRequiredRole))
                continue;
            InfrastructureRequiredRole ir = (InfrastructureRequiredRole) r;
            if (ir.getRequiredInterface__InfrastructureRequiredRole().equals(o)) {
                found = true;
                call.setRequiredRole__InfrastructureCall(ir);
            }
        }
        if (!found)
            dialog.getTreeViewer().remove(o);
    }
    dialog.open();
    return (InfrastructureSignature) dialog.getResult();
}
Also used : InfrastructureRequiredRole(org.palladiosimulator.pcm.repository.InfrastructureRequiredRole) RequiredRole(org.palladiosimulator.pcm.repository.RequiredRole) ArrayList(java.util.ArrayList) ServiceEffectSpecification(org.palladiosimulator.pcm.seff.ServiceEffectSpecification) InfrastructureInterface(org.palladiosimulator.pcm.repository.InfrastructureInterface) InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) InfrastructureRequiredRole(org.palladiosimulator.pcm.repository.InfrastructureRequiredRole) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 2 with InfrastructureSignature

use of org.palladiosimulator.pcm.repository.InfrastructureSignature in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetInfrastructureSignature method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    InfrastructureCall call = (InfrastructureCall) parameters.get("instance");
    InfrastructureSignature sig = getSignature(call);
    call.setSignature__InfrastructureCall(sig);
}
Also used : InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) InfrastructureCall(org.palladiosimulator.pcm.seff.seff_performance.InfrastructureCall)

Example 3 with InfrastructureSignature

use of org.palladiosimulator.pcm.repository.InfrastructureSignature in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddCollectionIteratorAction method getParameter.

private Parameter getParameter(CollectionIteratorAction action, ServiceEffectSpecification seff) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(Interface.class);
    filter.add(Signature.class);
    filter.add(Parameter.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, action.eResource().getResourceSet());
    dialog.setProvidedService(Parameter.class);
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        if (o instanceof Signature) {
            if (!o.equals(seff.getDescribedService__SEFF())) {
                dialog.getTreeViewer().remove(o);
                continue;
            }
            EList<Parameter> parameters = null;
            if (o instanceof OperationSignature)
                parameters = ((OperationSignature) o).getParameters__OperationSignature();
            else if (o instanceof InfrastructureSignature) {
                parameters = ((InfrastructureSignature) o).getParameters__InfrastructureSignature();
            }
            for (Parameter p : parameters) {
                if (!(p.getDataType__Parameter() instanceof CollectionDataType))
                    dialog.getTreeViewer().remove(p);
            }
        }
    }
    dialog.open();
    return (Parameter) dialog.getResult();
}
Also used : OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) Signature(org.palladiosimulator.pcm.repository.Signature) CollectionDataType(org.palladiosimulator.pcm.repository.CollectionDataType) ArrayList(java.util.ArrayList) Parameter(org.palladiosimulator.pcm.repository.Parameter) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 4 with InfrastructureSignature

use of org.palladiosimulator.pcm.repository.InfrastructureSignature in project Palladio-Editors-Sirius by PalladioSimulator.

the class Services method printParameters.

public String printParameters(Signature sig) {
    String result = "";
    EList<Parameter> parameters = null;
    if (sig instanceof OperationSignature)
        parameters = ((OperationSignature) sig).getParameters__OperationSignature();
    else if (sig instanceof InfrastructureSignature) {
        parameters = ((InfrastructureSignature) sig).getParameters__InfrastructureSignature();
    }
    if (// invalid list
    parameters == null)
        return "";
    for (Parameter p : parameters) {
        DataType parameterType = p.getDataType__Parameter();
        String type = getDataTypeName(parameterType);
        result += type + " " + p.getParameterName() + ", ";
    }
    if (result.endsWith(", "))
        result = result.substring(0, result.length() - 2);
    return result;
}
Also used : OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) Parameter(org.palladiosimulator.pcm.repository.Parameter) PrimitiveDataType(org.palladiosimulator.pcm.repository.PrimitiveDataType) CollectionDataType(org.palladiosimulator.pcm.repository.CollectionDataType) DataType(org.palladiosimulator.pcm.repository.DataType)

Aggregations

InfrastructureSignature (org.palladiosimulator.pcm.repository.InfrastructureSignature)4 ArrayList (java.util.ArrayList)2 EObject (org.eclipse.emf.ecore.EObject)2 EReference (org.eclipse.emf.ecore.EReference)2 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)2 CollectionDataType (org.palladiosimulator.pcm.repository.CollectionDataType)2 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)2 Parameter (org.palladiosimulator.pcm.repository.Parameter)2 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)1 DataType (org.palladiosimulator.pcm.repository.DataType)1 InfrastructureInterface (org.palladiosimulator.pcm.repository.InfrastructureInterface)1 InfrastructureRequiredRole (org.palladiosimulator.pcm.repository.InfrastructureRequiredRole)1 PrimitiveDataType (org.palladiosimulator.pcm.repository.PrimitiveDataType)1 RequiredRole (org.palladiosimulator.pcm.repository.RequiredRole)1 Signature (org.palladiosimulator.pcm.repository.Signature)1 ServiceEffectSpecification (org.palladiosimulator.pcm.seff.ServiceEffectSpecification)1 InfrastructureCall (org.palladiosimulator.pcm.seff.seff_performance.InfrastructureCall)1