Package fr.imag.adele.apam.declarations.references.resources

Examples of fr.imag.adele.apam.declarations.references.resources.ResourceReference


     *  Validate the instrumented provided resources are actually declared as provided 
     */
    ComponentDeclaration effective = getGroup() != null ? getComponent().getEffectiveDeclaration(getGroup()) : getComponent();
    for (ProviderInstrumentation instrumentation : getComponent().getProviderInstrumentation()) {
     
      ResourceReference instrumented = instrumentation.getProvidedResource();
     
      checkResourceExists(instrumented);
     
      if ( instrumented != null && ! (instrumented instanceof UnknownReference) && !effective.getProvidedResources().contains(instrumented)) {
        error("the return type of the specified method "+quoted(instrumentation.getName())+ " is not one of the provided resources");
View Full Code Here


    /*
     * validate missing exception
     */
    if (getRelation().getMissingException() != null) {
      checkResourceExists(new ResourceReference(getRelation().getMissingException()));
    }
   
  }
View Full Code Here

     * For java resources and specifications the metadata contains all the information to find the
     * provider components. For specific component references we search by name.
     */
    String requirementQuery = null;
   
    ResourceReference requestedResource = relation.getTarget().as(ResourceReference.class);
    if (requestedResource != null) {
     
      if (requestedResource instanceof InterfaceReference) {
        requirementQuery = "("+CST.PROVIDE_INTERFACES+"*>" + requestedResource.getJavaType() + ")";
      }
     
      else if (requestedResource instanceof MessageReference) {
        requirementQuery = "("+CST.PROVIDE_MESSAGES+"*>" + requestedResource.getJavaType() + ")";
      }
     
    }
   
    ComponentReference<?> requestedComponent = relation.getTarget().as(ComponentReference.class);
View Full Code Here

      boolean injected = false;
      boolean defined = false;

      for (ProviderInstrumentation providerInstrumentation : declaration.getProviderInstrumentation()) {

        ResourceReference instrumentedResource = providerInstrumentation.getProvidedResource();

        if (instrumentedResource instanceof UnknownReference) {
          continue;
        }

        defined = true;

        if (!instrumentedResource.equals(message)) {
          continue;
        }

        injected = true;
        break;
View Full Code Here

      break;
    }

    if (attribute.equals(Decoder.UNDEFINED) && mandatory) {
      errorHandler.report(Severity.ERROR, "component name or resource must be specified in " + element.getName());
      return new UnknownReference(new ResourceReference(Decoder.UNDEFINED));
    }

    if (attribute.equals(Decoder.UNDEFINED) && !mandatory) {
      return null;
    }
View Full Code Here

      return parseResourceReference(inComponent, element, attribute, mandatory);
    }

    if (mandatory) {
      errorHandler.report(Severity.ERROR, "component name or resource must be specified in " + element.getName());
      return  new UnknownReference(new ResourceReference(Decoder.UNDEFINED));
    }

    return null;
  }
View Full Code Here

    }
   

    if (mandatory) {
      errorHandler.report(Severity.ERROR, "resource name must be specified in " + element.getName());
      return new UnknownReference(new ResourceReference(element.getName()));
    }

    return null;
  }
View Full Code Here

        if (relationName.equals(CST.REL_COMPOSITE) || relationName.equals(CST.REL_COMPOTYPE) || relationName.equals(CST.REL_CONTAINS)) {
          /*
           * For relations that navigate the nested hierarchy of composites, we cannot know the actual types
           * at build-time, as this hierarchy is completely build at runtime. We simply stop navigation
           */
          target = new UnknownReference(new ResourceReference("<RUNTIME>"));
        }       
        else {
          /*
           * For relations that navigate the abstraction levels, we can navigate to more abstract levels, and
           * for more concrete levels we continue validating in the same context
View Full Code Here

   * part of the validation and repository API directly to the declarations package.
   */
  protected boolean isCandidateTarget(RelationDeclaration relation, ComponentDeclaration candidate) {

    ComponentReference<?> targetComponent  = relation.getTarget().as(ComponentReference.class);
    ResourceReference targetResource     = relation.getTarget().as(ResourceReference.class);

    if (targetComponent != null) {
      return isAncestor(candidate,targetComponent,true);
    }
    else if (targetResource != null) {
View Full Code Here

    if (getGroupRelation().getTarget() instanceof ResourceReference) {
   
      /*
       * If the group targets a resource
       */
      ResourceReference groupTarget = getGroupRelation().getTarget().as(ResourceReference.class);
     
      /*
       * and the refinement targets a resource it must match
       */
      if (targetIsResource() && !getTargetReference().equals(groupTarget)) {
        error("Invalid target refinement in relation " + quoted(getRelation().getIdentifier()) + ", "+getTargetReference()+ " is not compatible with "+groupTarget);
      }
     
      /*
       * and the refinement targets a component, it must provide the resource
       */
      if (targetIsComponent() && getTarget() != null && !getTarget().getProvidedResources().contains(groupTarget)) {
        error("Invalid target refinement in relation " + quoted(getRelation().getIdentifier()) + ", "+getTargetReference()+ " doesn't provide the resource specified in the group "+groupTarget);
      }
    }
   
    if (getGroupRelation().getTarget() instanceof ComponentReference) {
     
      /*
       * If the group targets a component
       */
      ComponentDeclaration groupTarget = getComponent(getGroupRelation().getTarget().as(ComponentReference.class),true);

      /*
       * and the refinement targets a resource, it must be provided by the component
       */
      if (targetIsResource() && groupTarget != null && !groupTarget.getProvidedResources().contains(getTargetReference())) {
        error("Invalid target refinement in relation " + quoted(getRelation().getIdentifier()) + ", "+getTargetReference()+ " is not provided by the component specified in the group "+groupTarget.getName());
      }

      if (targetIsComponent() && getTarget() != null && groupTarget != null) {

        /*
         * and the refinement targets a most concrete component, it must be a descendant
         */

        if (groupTarget.getKind().isMoreAbstractThan(getTarget().getKind()) && ! isAncestor(getTarget(), groupTarget.getReference(),true)) {
          error("Invalid target refinement in relation " + quoted(getRelation().getIdentifier()) + ", "+getTargetReference()+ " is not a descendant of the component specified in the group "+groupTarget.getName());
        }
       
        /*
         * and the refinement targets a most abstract  component, it must be an ancestor
         */
        if (getTarget().getKind().isMoreAbstractThan(groupTarget.getKind()) && ! isAncestor(groupTarget,getTarget().getReference(),true)) {
          error("Invalid target refinement in relation " + quoted(getRelation().getIdentifier()) + ", "+getTargetReference()+ " is not a ancestor of the component specified in the group "+groupTarget.getName());
        }

        /*
         * and the refinement targets a equally abstract  component, it must be the samer
         */
        if (getTarget().getKind().equals(groupTarget.getKind()) && ! getTarget().equals(groupTarget)) {
          error("Invalid target refinement in relation " + quoted(getRelation().getIdentifier()) + ", "+getTargetReference()+ " is not compatible with the component specified in the group "+groupTarget.getName());
        }
       
      }
     
    }
View Full Code Here

TOP

Related Classes of fr.imag.adele.apam.declarations.references.resources.ResourceReference

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.