Package fr.imag.adele.apam.declarations

Examples of fr.imag.adele.apam.declarations.GrantDeclaration


        identifier = identifier != null ? identifier : ownedComponent.getComponent().getName();
        RelationDeclaration.Reference relation = new RelationDeclaration.Reference(definingComponent, identifier);

        String states = parseString(composite.getName(), grant, ATT_WHEN, true);

        GrantDeclaration grantDeclaration = new GrantDeclaration(relation, new HashSet<String>(list(states,true)));
        ownedComponent.getGrants().add(grantDeclaration);
      }

      /*
       * parse explicit denies
       */
      for (Element deny : optional(owned.getElements(DENY, APAM))) {

        ComponentReference<?> definingComponent = parseComponentReference(composite.getName(), deny, true);
        String identifier = parseString(composite.getName(), deny, ATT_RELATION, false);
        identifier = identifier != null ? identifier : ownedComponent.getComponent().getName();
        RelationDeclaration.Reference relation = new RelationDeclaration.Reference(definingComponent, identifier);

        String states = parseString(composite.getName(), deny, ATT_WHEN, true);

        GrantDeclaration denyDeclaration = new GrantDeclaration(relation, new HashSet<String>(list(states,true)));
        ownedComponent.getDenies().add(denyDeclaration);
      }

      composite.getOwnedComponents().add(ownedComponent);
    }
View Full Code Here


   */
  private void preempt(OwnedComponentDeclaration ownedDeclaration, Instance ownedInstance) {

    assert this.owns(ownedInstance);

    GrantDeclaration grant = getCurrentGrant(ownedDeclaration);
    for (Link incoming : ownedInstance.getInvLinks()) {
      if (grant != null && !match(grant, incoming)) {
        incoming.remove();
      }
    }
View Full Code Here

      /*
       * If the current grant is still valid there is nothing to do
       */
      synchronized (granted) {
        GrantDeclaration previuos = granted.get(ownedDeclaration);
        if (previuos != null && previuos.getStates().contains(newState)) {
          continue;
        }
      }

      /*
       * Set new grant, according to new state
       */

      GrantDeclaration newGrant = null;
      for (GrantDeclaration grant : ownedDeclaration.getGrants()) {
        if (grant.getStates().contains(newState)) {
          newGrant = grant;
        }
      }
View Full Code Here

        PendingRequest.current() :
        new PendingRequest(CST.apamResolver,relation.getLinkSource(),relation.getRelationDefinition());

    for (OwnedComponentDeclaration ownedDeclaration : getOwned()) {

      GrantDeclaration grant = getCurrentGrant(ownedDeclaration);
      boolean granted = grant == null || match(grant, request);

      /*
       * Add a constraint to avoid that a request be resolved against an owned instance that
       * is not granted to the source of the request
View Full Code Here

TOP

Related Classes of fr.imag.adele.apam.declarations.GrantDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.