Examples of PortMapping


Examples of archmapper.main.model.archmapping.PortMapping

   
    Object usesPort = getAnnotationValue(binding, UsesPort.class);
    Object exposedByPort = getAnnotationValue(binding, ExposedByPort.class);
   
    if (usesPort != null) {
      PortMapping portMapping = getOrCreatePortMapping(compMapping, (String) usesPort);
      if (portMapping != null) {
        if (!portMapping.getUsingClass().contains(implDef)) {
          portMapping.getUsingClass().add(implDef);
        }
      }
    }
    if (exposedByPort != null) {
      PortMapping portMapping = getOrCreatePortMapping(compMapping, (String) exposedByPort);
      if (portMapping != null) {
        if (!portMapping.getExposedClass().contains(implDef)) {
          portMapping.getExposedClass().add(implDef);
        }
      }
    }
  }
View Full Code Here

Examples of archmapper.main.model.archmapping.PortMapping

   * @param compMapping
   * @param portName
   * @return
   */
  public PortMapping getOrCreatePortMapping(ComponentMapping compMapping, String portName) {
    PortMapping portMapping = compMapping.getPortMapping(portName);
    if (portMapping == null) {
      // look if this port exists in the component
      Component comp = arch.getComponentByName(compMapping.getComponentName());
      if (comp != null) {
        if (comp.getPortByName(portName) != null) {
          // ok, the port exists. We can create a new PortMapping
          portMapping = new PortMapping();
          portMapping.setPortName(portName);
          portMapping.setParent(compMapping);
          compMapping.getPortMapping().add(portMapping);
        }
      }
    }
   
View Full Code Here

Examples of archmapper.main.model.archmapping.PortMapping

    compMapping.getFileDefinition().add(fileDef);
    fileDef.setFilename("file1");
    fileDef.setType("filetype1");
   
    // create a port mapping
    PortMapping portMapping = new PortMapping();
    compMapping.getPortMapping().add(portMapping);
    portMapping.setParent(compMapping);
    portMapping.setPortName("p");
    portMapping.getExposedClass().add(classDef);
    portMapping.getUsingClass().add(classDef);
   
    // Mapping for component2
    ComponentMapping comp2Mapping = new ComponentMapping();
    comp2Mapping.setComponentName("Comp2");
    archMapping.getComponentMapping().add(comp2Mapping);
View Full Code Here

Examples of archmapper.main.model.archmapping.PortMapping

  @Test
  public void testCommunicationIntegrityTests() {
    loadFiles();
   
    ComponentMapping comp1Mapping = archMapping.getComponentMapping("Comp1");
    PortMapping pMapping = comp1Mapping.getPortMapping("p");
    Component comp1 = architecture.getComponentByName("Comp1");
    Port p = comp1.getPortByName("p");
   
    assertTrue(mappingHelper.isClassExposedByPort(comp1Mapping.getInterfaceDefinition().get(0),
        p, pMapping));
View Full Code Here

Examples of archmapper.main.model.archmapping.PortMapping

          List<ComponentToComponentConnection> connections = comp.getConnectionsOverPort(RoleDirection.out, port);
         
          for (ComponentToComponentConnection connection : connections) {
            ComponentMapping remoteComp = archMapping.getComponentMapping(connection.getTargetComponent().getName());
            if (remoteComp != null) {
              PortMapping remotePortMapping = remoteComp.getPortMapping(connection.getTargetPort().getName());
             
              for (ClassDefinition remoteClass : remoteComp.getClassDefinition()) {
                if (mappingHelper.isClassExposedByPort(classDef, connection.getTargetPort(), remotePortMapping) &&
                    mappingHelper.isClassSingleton(remoteClass)) {
                  // we could need an attribute for this class...
View Full Code Here

Examples of com.spotify.helios.common.descriptors.PortMapping

    final ImmutableMap.Builder<String, Integer> allocation = ImmutableMap.builder();

    // Allocate static ports
    for (Map.Entry<String, PortMapping> entry : mappings.entrySet()) {
      final String name = entry.getKey();
      final PortMapping portMapping = entry.getValue();
      final Integer externalPort = portMapping.getExternalPort();

      // Skip dynamic ports
      if (externalPort == null) {
        continue;
      }

      // Verify that this port is not in use
      if (used.contains(externalPort)) {
        return null;
      }
      used.add(externalPort);
      allocation.put(name, externalPort);
    }

    // Allocate dynamic ports
    for (Map.Entry<String, PortMapping> entry : mappings.entrySet()) {
      final String name = entry.getKey();
      final PortMapping portMapping = entry.getValue();
      final Integer externalPort = portMapping.getExternalPort();

      // Skip static ports
      if (externalPort != null) {
        continue;
      }
View Full Code Here

Examples of com.spotify.helios.common.descriptors.PortMapping

    checkArgument(job.getPorts().containsKey(port), "port %s not found", port);
    final TaskStatus status = statuses.get(host);
    if (status == null) {
      return null;
    }
    final PortMapping portMapping = status.getPorts().get(port);
    if (portMapping == null) {
      return null;
    }
    return portMapping.getExternalPort();
  }
View Full Code Here

Examples of com.spotify.helios.common.descriptors.PortMapping

    if (ts == null) {
      table.row(jobIdString, host, goal, "", "", "");
    } else {
      final List<String> portMappings = new ArrayList<>();
      for (Map.Entry<String, PortMapping> entry : ts.getPorts().entrySet()) {
        final PortMapping portMapping = entry.getValue();
        portMappings.add(String.format("%s=%d:%d", entry.getKey(),
                                       portMapping.getInternalPort(),
                                       portMapping.getExternalPort()));
      }
      String state = ts.getState().toString();
      if (ts.getThrottled() != ThrottleState.NO) {
        state += " (" + ts.getThrottled() + ")";
      }
View Full Code Here

Examples of com.spotify.helios.common.descriptors.PortMapping

   * Get final port mappings using allocated ports.
   */
  public Map<String, PortMapping> ports() {
    final ImmutableMap.Builder<String, PortMapping> builder = ImmutableMap.builder();
    for (final Map.Entry<String, PortMapping> e : job.getPorts().entrySet()) {
      final PortMapping mapping = e.getValue();
      builder.put(e.getKey(), mapping.hasExternalPort()
                              ? mapping
                              : mapping.withExternalPort(checkNotNull(ports.get(e.getKey()))));
    }
    return builder.build();
  }
View Full Code Here

Examples of com.spotify.helios.common.descriptors.PortMapping

    for (final Map.Entry<ServiceEndpoint, ServicePorts> entry :
        job.getRegistration().entrySet()) {
      final ServiceEndpoint registration = entry.getKey();
      final ServicePorts servicePorts = entry.getValue();
      for (String portName : servicePorts.getPorts().keySet()) {
        final PortMapping mapping = job.getPorts().get(portName);
        if (mapping == null) {
          log.error("no '{}' port mapped for registration: '{}'", portName, registration);
          continue;
        }
        final Integer externalPort;
        if (mapping.getExternalPort() != null) {
          // Use the statically assigned port if one is specified
          externalPort = mapping.getExternalPort();
        } else {
          // Otherwise use the dynamically allocated port
          externalPort = ports.get(portName);
        }
        if (externalPort == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.