Package archmapper.main.model.architecture

Examples of archmapper.main.model.architecture.Component


   
    Configuration conf = converter.convertFromAdl("testfiles/families",
        "testfiles/TestArchitecture.acme");
    assertNotNull(conf);
   
    Component productManager = conf.getComponentByName("ProductAdmin.ProductManager");
    Component productModel = conf.getComponentByName("ProductAdmin.ProductModel");
   
    Connector conn = conf.getConnectorByName("ProductAdmin.MethodCallT0");
    Connector conn2 = conf.getConnectorByName("ProductAdmin.MethodCallT1");
   
    assertNotNull(productManager);
    assertEquals("DAOT", productManager.getStyleType());
   
    assertNotNull(productModel);
    assertEquals(1, productManager.getPorts().size());
    assertEquals(conn, productManager.getPorts().get(0).getRoles().get(0).getConnector());
    assertEquals(conn2, productModel.getPorts().get(0).getRoles().get(0).getConnector());
   
    assertTrue(conf.getArchitectureRuleViolations().size() > 0);
  }
View Full Code Here


        }
        return;
      }
    }

    Component component = new Component();
    component.setParent(conf);
    conf.getComponents().add(component);

    component.setName(getQualifiedName(acmeComp));

    if (acmeComp.getDeclaredTypes().size() > 0) {
      IAcmeElementTypeRef<IAcmeComponentType> type = acmeComp
          .getDeclaredTypes().iterator().next();
      component.setStyleType(type.getReferencedName());
    }

    addProperties(component, acmeComp.getProperties());

    for (IAcmePort acmePort : acmeComp.getPorts()) {
      Port port = new Port();
      port.setParent(component);
      component.getPorts().add(port);

      port.setName(acmePort.getName());

      if (acmePort.getDeclaredTypes().size() > 0) {
        IAcmeElementTypeRef<IAcmePortType> type = acmePort
View Full Code Here

      TypeDeclaration typeDec = (TypeDeclaration) obj;
      ITypeBinding binding = typeDec.resolveBinding();
     
      String compName = mappingHelper.getComponentName(binding);
      if (compName != null) {
        Component comp = arch.getComponentByName(compName);
        if (comp != null && MODEL_COMPONENT_TYPE.equals(comp.getStyleType())) {
          // look at the methods...
         
          List<?> methods = resource.getTypedNodeList(typeDec, ASTNode.METHOD_DECLARATION, false);
          for (Object methObj : methods) {
            MethodDeclaration meth = (MethodDeclaration) methObj;
View Full Code Here

public class DatabaseAccessOnlyFromDAOComponentsRule extends
    AbstractRuleWithoutSourceCheck {

  @Override
  public void analyzeWithoutSource(AnalysisHistory history) {
    Component databaseComp = arch.getComponentByName(DATABASE_COMPONENT_NAME);
    if (databaseComp != null) {
      for (Component connectedComp : databaseComp.getConnectedComponents(RoleDirection.in)) {
        if (!DAO_COMPONENT_TYPE.equals(connectedComp.getStyleType())) {
          String typeString = "";
          if (connectedComp.getStyleType() != null) {
            typeString = " of type "+ connectedComp.getStyleType();
          }
View Full Code Here

      TypeDeclaration typeDec = (TypeDeclaration) obj;
      ITypeBinding binding = typeDec.resolveBinding();
     
      String compName = mappingHelper.getComponentName(binding);
      if (compName != null) {
        Component comp = arch.getComponentByName(compName);
        if (comp != null && VIEW_COMPONENT_TYPE.equals(comp.getStyleType())) {
          List<?> constructions = resource.getTypedNodeList(typeDec, ASTNode.CLASS_INSTANCE_CREATION, true);
         
          for (Object constrObj : constructions) {
            ClassInstanceCreation constrInv = (ClassInstanceCreation) constrObj;
            Type type = constrInv.getType();
            ITypeBinding classBinding = type.resolveBinding();
           
            String createdClassCompName = mappingHelper.getComponentName(classBinding);
            if (createdClassCompName != null) {
              Component createdClassComp = arch.getComponentByName(createdClassCompName);
              if (createdClassComp != null && MODEL_COMPONENT_TYPE.equals(createdClassComp.getStyleType())) {
                generateResultsForASTNode(history, constrInv, resource,
                    "The class "+ classBinding.getQualifiedName() + " from the component "+
                    createdClassCompName + " may not be instantiated in a View component.");
              }
            }
View Full Code Here

    Set<Component> cyclicComponents = new HashSet<Component>();
   
    for (Component comp : arch.getComponents()) {
      Set<Component> visitedComponents = new HashSet<Component>();
     
      Component cyclicComponent = findCycle(comp, visitedComponents);
      if (cyclicComponent != null) {
        cyclicComponents.add(cyclicComponent);
      }
    }
   
View Full Code Here

    Set<Component> newVisitedComponents = new HashSet<Component>();
    newVisitedComponents.addAll(visitedComponents);
    newVisitedComponents.add(comp);
   
    for (Component connectedComp : comp.getConnectedComponents(RoleDirection.out)) {
      Component cyclicComponent = findCycle(connectedComp, newVisitedComponents);
      if (cyclicComponent != null) {
        return cyclicComponent;
      }
    }
   
View Full Code Here

  protected void createArchitecture() {
    architecture.setArchitecturalStyle("testStyle");
    architecture.setName("Test-Architecture");
   
    // add a component
    Component comp = new Component();
    comp.setParent(architecture);
    architecture.getComponents().add(comp);
   
    comp.setName("Comp1");
    comp.setStyleType("CompType1");
   
    // add a property
    architecture.getProperties().put("Prop", "Value");
   
    // add a port to the component
    Port port = new Port();
    port.setParent(comp);
    comp.getPorts().add(port);
   
    port.setName("p");
    port.setStyleType("PortType1");
   
   
    // second component
    Component comp2 = new Component();
    comp2.setParent(architecture);
    architecture.getComponents().add(comp2);
   
    comp2.setName("Comp2");
    comp2.setStyleType("CompType2");
   
    Port port2 = new Port();
    port2.setParent(comp2);
    comp2.getPorts().add(port2);
   
    port2.setName("p2");
    port2.setStyleType("PortType2");
   
   
View Full Code Here

  protected void checkInvalidNamesInComponentAndConnectorMappings(ImplementableArchitectureElementMapping mapping) {
    ImplementableTypeMapping typeMapping = null;
   
    if (styleMapping != null) {
      if (mapping instanceof ComponentMapping) {
        Component comp = arch.getComponentByName(mapping.getName());
        typeMapping = styleMapping.getComponentType(comp.getStyleType());
      } else {
        Connector conn = arch.getConnectorByName(mapping.getName());
        typeMapping = styleMapping.getConnectorTypeMapping(conn.getStyleType());
      }
    }
View Full Code Here

  }
 
  protected void checkInvalidPortNames(List<PortMapping> portMappings) {
    for (PortMapping portMapping : portMappings) {
      ComponentMapping compMapping = portMapping.getParent();
      Component comp = arch.getComponentByName(compMapping.getComponentName());
      if (comp.getPortByName(portMapping.getPortName()) == null) {
        archMappingErrors.add("The port "+ portMapping.getPortName() + " of the component "+
            comp.getName() + " does not exist in the architecture.");
      }
    }
  }
View Full Code Here

TOP

Related Classes of archmapper.main.model.architecture.Component

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.