Package archmapper.main.model.archmapping

Examples of archmapper.main.model.archmapping.ImplementationArtifactDefinition


        ITypeBinding binding = type.resolveBinding();
        String compName = mappingHelper.getComponentName(binding);
        if (compName != null) {
          ComponentMapping compMapping = archMapping.getComponentMapping(compName);
          if (compMapping != null) {
            ImplementationArtifactDefinition classDef = mappingHelper.getImplementationArtifactDefinitionByClassname(compMapping, binding.getQualifiedName());
            if (classDef != null) {
              String classTypeName = classDef.getType();
              if (classTypeName != null) {
                ComponentTypeMapping typeMapping = mappingHelper.getComponentTypeMapping(compName);
                if (typeMapping != null) {
                  ClassType classType = typeMapping.getClassType(classTypeName);
                  if (classType != null) {
View Full Code Here


      ITypeBinding binding = type.resolveBinding();
      if (binding == null) {
        continue;
      }
     
      ImplementationArtifactDefinition artifactDef = qualifiedNames.
          get(binding.getQualifiedName());
      if (artifactDef == null) {
        // The information could also be contained in
        // annotations or classNamePatterns
        artifactDef = mappingHelper.getClassInformation(binding);
      }
     
     
      if (artifactDef != null) {
        // We have found the artifact
        artifactsNotPresent.remove(artifactDef);

        if (artifactDef instanceof InterfaceDefinition &&
            !binding.isInterface()) {
          generateResultsForASTNode(history, type, resource,
              "The type "+ binding.getQualifiedName() + " is a class"+
              ", but should be an interface according to the definition in "+
              artifactDef.getParent().getName());
          continue;
        }
        if (artifactDef instanceof ClassDefinition &&
            binding.isInterface()) {
          generateResultsForASTNode(history, type, resource,
              "The type "+ binding.getQualifiedName() + " is "+
              "an interface, but should be a class according to the definition in "+
              artifactDef.getParent().getName());
          continue;
        }
       

        if (binding.getSuperclass() != null &&
            binding.getSuperclass() != type.getAST().resolveWellKnownType("java.lang.Object")) {
          // Check Restriction.noSuperClass
          ImplementationArtifactType artifactType = mappingHelper.getTypeOf(artifactDef);
          if (artifactType != null && artifactType instanceof ClassType) {
            ClassType classType = (ClassType) artifactType;
            if (classType.getRestrictions().contains(ClassTypeRestriction.noSuperclass)) {
              generateResultsForASTNode(history, type, resource,
                  "The type "+ binding.getQualifiedName() + " should "+
                  "not have a superclass according to the style mapping.");
            }
          }
        }
       
       
        // Now we have to check if all superclasses and interfaces
        // are ok
        List<String> interfaces = mappingHelper.getSuperInterfaces(artifactDef);
        String superClass = mappingHelper.getSuperClass(artifactDef);
       
       
        if (superClass != null &&
            !hasSuperclass(binding, superClass)) {
          generateResultsForASTNode(history, type, resource,
              "The type "+ binding.getQualifiedName() + " should "+
              "have the superclass " + superClass + " according to the definition in "+
              artifactDef.getParent().getName());
        }
       
        List<String> actualInterfaces = getAllInterfaces(binding);
        for (String iface : interfaces) {
          if (!actualInterfaces.contains(iface)) {
            generateResultsForASTNode(history, type, resource,
                "The type "+ binding.getQualifiedName() + " should "+
                "implement the interface " + iface + " according to the definition in "+
                artifactDef.getParent().getName());
          }
        }
       
      }
     
View Full Code Here

      ImplementableArchitectureElementMapping compMapping = getOrCreateComponentOrConnectorMapping(compName);
      if (compMapping == null) {
        return null;
      }
     
      ImplementationArtifactDefinition artifactDef = getImplementationArtifactDefinitionByClassname(compMapping, className);
      if (artifactDef != null && !hasPortOrArtifactTypeAnnotations(binding)) {
        return artifactDef;
      }
     
     
      if (artifactDef == null || artifactDef instanceof ClassNamePattern) {
        artifactDef = createClassDefinitionFromAnnotationOrClassNamePattern(binding, compMapping, artifactDef);
      }
     
      addTypeInformationFromAnnotation(artifactDef, binding);
      addPortOptionInformationFromAnnotation(artifactDef, binding, compMapping);
     
      return artifactDef;
    }


    for (ImplementableArchitectureElementMapping implMapping : archMapping.getAllImplementableArchitectureElementMappings()) {
      ImplementationArtifactDefinition artifactDef =
          getImplementationArtifactDefinitionByClassname(implMapping, className);
      if (artifactDef != null) {
        if (hasPortOrArtifactTypeAnnotations(binding) && artifactDef instanceof ClassNamePattern) {
          artifactDef = createClassDefinitionFromAnnotationOrClassNamePattern(binding, implMapping, artifactDef);
        }
View Full Code Here

   * @param type
   *            The type to be searched for a component definition
   * @return the component name, or null, if no mapping could be found.
   */
  public String getComponentName(ITypeBinding binding) {
    ImplementationArtifactDefinition def = getClassInformation(binding);
    if (def == null) {
      return null;
    }
    return def.getParent().getName();
  }
View Full Code Here

    // If they are connected, we have to look closer...
   
    ImplementableArchitectureElementMapping comp1Mapping = archMapping.getComponentOrConnectorMappingByName(componentOrConnectorName);
    ImplementableArchitectureElementMapping comp2Mapping = archMapping.getComponentOrConnectorMappingByName(otherComponentOrConnectorName);
   
    ImplementationArtifactDefinition class1Def = getImplementationArtifactDefinitionByClassname(comp1Mapping, className);
    ImplementationArtifactDefinition class2Def = getImplementationArtifactDefinitionByClassname(comp2Mapping, otherClassName);
   
    // The procedure depends on the type of the ImplementableArtitectureElements
   
    if (comp1 instanceof Component && comp2 instanceof Component) {     
      return mayClassInComponentReferenceClassInOtherComponent(class1Def, (Component) comp1, (ComponentMapping) comp1Mapping, class2Def,
View Full Code Here

TOP

Related Classes of archmapper.main.model.archmapping.ImplementationArtifactDefinition

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.