Package fr.imag.adele.apam.declarations

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


       * CoreMetadataParser and computeEffectiverelation
       */
      Component declaringComponent = source;
      while (declaringComponent != null) {

        RelationDeclaration declaration = declaringComponent.getDeclaration().getRelation(relToResolve.getName());
        if (declaration != null && declaration.getMissingException() != null && declaration.getMissingException().equals(exceptionName)) {
          break;
        }

        declaringComponent = declaringComponent.getGroup();
      }
View Full Code Here


    int counter = 1;
    triggers = new ArrayList<RelToResolve>();
    for (ConstrainedReference trigger : declaration.getTriggers()) {

      RelationDeclaration triggerRelation = new RelationDeclaration(declaration.getReference(), "trigger-" + counter, trigger.getTarget(), false);
      triggerRelation.getImplementationConstraints().addAll(trigger.getImplementationConstraints());
      triggerRelation.getInstanceConstraints().addAll(trigger.getInstanceConstraints());

      RelToResolveImpl parsedTrigger = new RelToResolveImpl(owner, triggerRelation);
      // parsedTrigger.computeFilters(owner);
      triggers.add(parsedTrigger);
      counter++;
View Full Code Here

      }
     
      // Check that the relation exists and has as target the OWN resource
      // OWN is a specification or an implem but the granted relation can be anything
     
      RelationDeclaration  grantedRelation = granted.getRelation(grantDeclaration.getRelation().getIdentifier());

      if (grantedRelation == null) {
        error("invalid grant expression, the relation "+ quoted(grantDeclaration.getRelation().getIdentifier()) +" is not defined in component " + granted.getName());
      }
      else if (!isCandidateTarget(grantedRelation,owned)) {
View Full Code Here

      ComponentDeclaration source = getComponent(promotion.getContentRelation().getDeclaringComponent(),true);
      if (source == null) {
        error("invalid promotion, the source component "+ promotion.getContentRelation().getDeclaringComponent() +" is unknown");
      }
     
      RelationDeclaration promotedRelation = source != null ? source.getRelation(promotion.getContentRelation().getIdentifier()) : null;
      // Check if the dependencies are compatible
      if (source != null && promotedRelation == null) {
        error("invalid promotion, the promoted relation "+ quoted(promotion.getContentRelation().getIdentifier()) +" is not defined in component "+source.getName());
        continue;
      }

      RelationDeclaration compositeRelation = getComposite().getRelation(promotion.getCompositeRelation());
      if (compositeRelation == null) {
        error("invalid promotion, the composite relation "+ quoted(promotion.getCompositeRelation().getIdentifier()) +" is not defined");
        continue;
      }
View Full Code Here

    if (apam == null) {
      System.err.println("unresolve failure for client " + getInstanceName() + " : APAM not found");
      return false;
    }

    RelationDeclaration relation = injection.getRelation();
    for (Link outgoing : ((InstanceImpl)getApform().getApamComponent()).getExistingLinks(relation.getIdentifier())) {
      outgoing.remove();
    }

    return true;
  }
View Full Code Here

    for (Element relation : every(element.getElements(RELATION, APAM), element.getElements(OVERRIDE, APAM))) {

      /*
       * Add to content contextual declaration
       */
      RelationDeclaration relationDeclaration = parseRelation(relation, composite, true);
      Collection<RelationDeclaration> declarations = relationDeclaration.isOverride() ? composite.getOverridenDependencies() : composite.getContextualDependencies();

      if (!declarations.add(relationDeclaration)) {
        errorHandler.report(Severity.ERROR, "Duplicate relation identifier " + relationDeclaration);
      }

View Full Code Here

    String mustHide = parseString(component.getName(), element, ATT_HIDE, false);

    /*
     * Create the relation and add the declared instrumentation
     */
    RelationDeclaration relation;
    if (! isContextual) {
      relation = new RelationDeclaration(component.getReference(), id, sourceKind, targetDef, targetKind, isMultiple,
                creationPolicy, resolvePolicy,
                missingPolicy, missingException, mustHide != null ? Boolean.valueOf(mustHide) : null);
    }
    else {
      relation = new RelationDeclaration(component.getReference(), id, sourceKind, targetDef, targetKind, isMultiple,
          creationPolicy, resolvePolicy,
          missingPolicy, missingException, mustHide != null ? Boolean.valueOf(mustHide) : null,
          true, sourceName, isOverride);
    }
         

    for (RequirerInstrumentation instrumentation : instrumentations) {
      relation.getInstrumentations().add(instrumentation);
    }
   
    /*
     * look for bind and unbind callbacks
     */
    String bindCallback = parseString(component.getName(), element, ATT_BIND, false);
    String unbindCallback = parseString(component.getName(), element, ATT_UNBIND, false);

    if (component instanceof AtomicImplementationDeclaration) {
      if (bindCallback != null) {
        CallbackDeclaration callback = new CallbackDeclaration((AtomicImplementationDeclaration) component, bindCallback,true);
        if (!callback.isValidInstrumentation()) {
          errorHandler.report(Severity.ERROR, component.getName() + " : the specified method \"" + bindCallback + "\" in \"" + ATT_BIND + "\" is invalid or not found");
        }
        relation.addCallback(RelationDeclaration.Event.BIND, callback);
      }
      if (unbindCallback != null) {
        CallbackDeclaration callback = new CallbackDeclaration((AtomicImplementationDeclaration) component, unbindCallback,true);
        if (!callback.isValidInstrumentation()) {
          errorHandler.report(Severity.ERROR, component.getName() + " : the specified method \"" + unbindCallback + "\" in \"" + ATT_UNBIND + "\" is invalid or not found");
        }
        relation.addCallback(RelationDeclaration.Event.UNBIND, callback);
      }
    }

    /*
     * Get the optional constraints and preferences
View Full Code Here

     */
    for (Element relation : every(element.getElements(DEPENDENCY, APAM), element.getElements(RELATION, APAM))) {
      /*
       * Add to component declaration
       */
      RelationDeclaration relationDeclaration = parseRelation(relation, component);
      if (!component.getRelations().add(relationDeclaration)) {
        errorHandler.report(Severity.ERROR, "Duplicate relation identifier " + relationDeclaration);
      }

    }
View Full Code Here

      return propertyName.startsWith(CST.RELATION_PREFIX);
  }
 
  private final RelationDeclaration relation(String propertyName) {
      String relation = propertyName.substring(CST.RELATION_PREFIX.length());
        return new RelationDeclaration(component.getReference(),relation,reference(propertyName),false);
   
  }
View Full Code Here

      else {

        /*
         * For normal relations, we get the relation declaration and follow the specified target
         */
        RelationDeclaration relation = source.getRelation(relationName);
       
        if (relation == null) {
          error("Invalid substitute expression "+value+ " , relation "+quoted(relationName)+" not defined in component "+source.getName());
          return null;
        }
       
        target          = relation.getTarget();
        hasMultipleNavigation  = hasMultipleNavigation || relation.isMultiple();
       
        /*
         * If the target is a component, we can move the source one step further
         */
        if (relation.getTarget().as(ComponentReference.class) != null) {
          source = getComponent(relation.getTarget().as(ComponentReference.class),true);
          if (source == null) {
            error("Invalid substitute expression "+value+ " , relation "+quoted(relationName)+" has unknown target "+relation.getTarget().getName());
            return null;
          }
         
        }
       
View Full Code Here

TOP

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

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.