Package fr.imag.adele.apam

Examples of fr.imag.adele.apam.RelationDefinition


      }
    }

    // CompositeType compoType = CompositeTypeImpl.getRootCompositeType();

    RelationDefinition rel = new RelationDefinitionImpl(targetComponent, client.getKind(), targetKind, null, null);
    Resolved<?> res = resolveLink(client, rel);
    if (res == null) {
      return null;
    }
    return res.singletonResolved;
View Full Code Here


      /*
       * If we find a matching explicit promotion try to resolve using the matched composite relation
       */
      if (matching != null) {
       
        RelationDefinition compositeRelation  = client.getComposite().getRelation(promotion.getCompositeRelation().getIdentifier());
       
        /*
         * Validate the source's and composite's relations are compatible.
         *
         * NOTE This is already validated at build time, but we do the tests again at runtime
         */
        if (!relation.getRelationDefinition().matchRelation(client,compositeRelation)) {
          logger.error("Promotion is invalid. relation " + relation.getName() + " of component " + client.getName() + " does not match the composite relation " + compositeRelation);
          continue search;
        }
         
        Resolved<T> candidates = getPromotionCandidates(client, relation, compositeRelation);
        if (candidates != null && !candidates.isEmpty()) {

          /*
           * Create the promotion links and return
           */
          updateModel(client, relation, candidates, relation.hasConstraints() || compositeRelation.hasConstraints(), true);
         
          /*
           * NOTE IMPORTAN SPECIAL CASE for relations with cardinality multiple, we allow merging the result of
           * several promotions
           */
 
View Full Code Here

  public Instance resolveImpl(Component client, Implementation impl, Set<String> constraints, List<String> preferences) {
    if (client == null) {
      client = CompositeImpl.getRootInstance();
    }

    @SuppressWarnings("rawtypes")
    // RelToResolve dep = new RelToResolveImpl(new
    // ImplementationReference(impl.getName()), client.getKind(),
    // ComponentKind.INSTANCE, constraints, preferences);
    RelationDefinition dep = new RelationDefinitionImpl(new ImplementationReference(impl.getName()), client.getKind(), ComponentKind.INSTANCE, constraints, preferences);
View Full Code Here

  public Set<Instance> resolveImpls(Component client, Implementation impl, Set<String> constraints) {
    if (client == null) {
      client = CompositeImpl.getRootInstance();
    }

    @SuppressWarnings("rawtypes")
    // RelToResolve dep = new RelToResolveImpl(new
    // ImplementationReference(impl.getName()), client.getKind(),
    // ComponentKind.INSTANCE, constraints, null);
    RelationDefinition dep = new RelationDefinitionImpl(new ImplementationReference(impl.getName()), client.getKind(), ComponentKind.INSTANCE, constraints, null);
View Full Code Here

      logger.error("missing client or relation name");
      return null;
    }

    // Get the relation
    RelationDefinition relDef = source.getRelation(depName);
    if (relDef == null) {
      logger.error("Relation declaration invalid or not found " + depName);
      return null;
    }
    return resolveLink(source, relDef);
View Full Code Here

  }

  @Override
  public Implementation resolveSpecByInterface(Component client, String interfaceName, Set<String> constraints, List<String> preferences) {

    RelationDefinition dep = new RelationDefinitionImpl(new InterfaceReference(interfaceName), client.getKind(), ComponentKind.IMPLEMENTATION, constraints, preferences);
    return resolveSpecByResource(client, dep);
  }
View Full Code Here

  }

  @Override
  public Implementation resolveSpecByMessage(Component client, String messageName, Set<String> constraints, List<String> preferences) {

    RelationDefinition dep = new RelationDefinitionImpl(new MessageReference(messageName), client.getKind(), ComponentKind.IMPLEMENTATION, constraints, preferences);
    return resolveSpecByResource(client, dep);
  }
View Full Code Here

  public Implementation resolveSpecByName(Instance client, String specName, Set<String> constraints, List<String> preferences) {
    if (client == null) {
      client = CompositeImpl.getRootInstance();
    }

    RelationDefinition dep = new RelationDefinitionImpl(new SpecificationReference(specName), client.getKind(), ComponentKind.IMPLEMENTATION, constraints, preferences);

    return resolveSpecByResource(client, dep);
  }
View Full Code Here

      }
      group = group.getGroup();
    }

    // None are present. Try to resolve
    RelationDefinition rel = getRelation(relName);
    if (rel == null) {
      logger.error("relation " + relName + " undefined for " + this);
      return null;
    }
    Component source = rel.getRelSource(this);
    CST.apamResolver.resolveLink(source, rel);
    return getExistingLink(relName);
  }
View Full Code Here

    if (!dests.isEmpty()) {
      return dests;
    }

    // None are present. Try to resolve
    RelationDefinition rel = getRelation(relName);
    if (rel == null) {
      logger.error("relation " + relName + " undefined for " + this);
      return null;
    }

    // if (!rel.isLazy())
    // return dests ;

    Component source = rel.getRelSource(this);
    CST.apamResolver.resolveLink(source, rel);
    return getExistingLinks(relName);
  }
View Full Code Here

TOP

Related Classes of fr.imag.adele.apam.RelationDefinition

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.