当前位置: 首页>>代码示例>>Java>>正文


Java ContainerPort.getPublicPort方法代码示例

本文整理汇总了Java中com.github.dockerjava.api.model.ContainerPort.getPublicPort方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerPort.getPublicPort方法的具体用法?Java ContainerPort.getPublicPort怎么用?Java ContainerPort.getPublicPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.dockerjava.api.model.ContainerPort的用法示例。


在下文中一共展示了ContainerPort.getPublicPort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: manageUnknownService

import com.github.dockerjava.api.model.ContainerPort; //导入方法依赖的package包/类
private Record manageUnknownService(Record record, ContainerPort port) {
  if (port.getPublicPort() == null || port.getPublicPort() == 0) {
    return null;
  }
  JsonObject location = new JsonObject();
  location.put("port", port.getPublicPort());
  location.put("internal-port", port.getPrivatePort());
  location.put("type", port.getType());
  location.put("ip", host);

  return record.setLocation(location).setType(ServiceType.UNKNOWN);
}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:13,代码来源:DockerService.java

示例2: manageHttpService

import com.github.dockerjava.api.model.ContainerPort; //导入方法依赖的package包/类
private static Record manageHttpService(Record record, ContainerPort port, Map<String, String> labels) {
  if (port.getPublicPort() == null || port.getPublicPort() == 0) {
    return null;
  }
  record.setType(HttpEndpoint.TYPE);
  HttpLocation location = new HttpLocation()
      .setHost(port.getIp())
      .setPort(port.getPublicPort());

  if (isTrue(labels, "ssl")  || port.getPrivatePort() == 443) {
    location.setSsl(true);
  }
  return record.setLocation(location.toJson());
}
 
开发者ID:vert-x3,项目名称:vertx-service-discovery,代码行数:15,代码来源:DockerService.java

示例3: build

import com.github.dockerjava.api.model.ContainerPort; //导入方法依赖的package包/类
public static KieContainer build(Container container) {
    if (container == null || container.getId() == null || 
            container.getNames() == null || container.getNames().length == 0) {
        // If container is being started just when querying it, or not id or name assigned, do not build the instance.
        return null;
    }
    
    KieContainer kieContainer = new KieContainer();
    kieContainer.setId(container.getId());
    kieContainer.setTruncId(container.getId().substring(0, 12));
    kieContainer.setImage(container.getImage());
    if (container.getNames() != null) {
        
    }
    final String cName = container.getNames()[0];
    kieContainer.setName(cName.substring(1, cName.length()));
    kieContainer.setCommand(container.getCommand());
    final long cDateTime = container.getCreated();
    final Date cDate = new Date(cDateTime * 1000);
    kieContainer.setCreated(cDate);
    kieContainer.setStatus(container.getStatus());
    final String[] _n = parseImageName(container.getImage(), null);
    kieContainer.setRegistry(_n[0]);
    kieContainer.setRepository(_n[1]);
    kieContainer.setTag(_n[2]);
    
    // Ports.
    final ContainerPort[] ports = container.getPorts();
    if (ports != null) {
        final List<KieContainerPort> kiePorts = new LinkedList<KieContainerPort>();
        for (final ContainerPort port : ports) {
            final KieContainerPort kiePort = new KieContainerPort();
            kiePort.setIp(port.getIp());
            kiePort.setPrivatePort(port.getPrivatePort());
            if (port.getPublicPort() != null) kiePort.setPublicPort(port.getPublicPort());
            kiePort.setType(port.getType());
            kiePorts.add(kiePort);
        }
        kieContainer.setPorts(kiePorts);
    }
    
    // Container types.
    final KieImageType kieAppType = KieImageTypeManager.getKIEAppType(kieContainer.getRepository());
    final KieImageType appServerType = KieImageTypeManager.getAppServerType(kieContainer.getRepository());

    KieImageType dbmsType = null;
    if (SharedUtils.supportsDatabase(kieAppType)) {
        // Try to obtain the DBMS used in this container by its name, to avoid inspecting the container and firing new request.
        dbmsType = parseDbmsType(kieContainer.getName());
        if (dbmsType == null) {
            // Container name does not provide the DBMS type used, try to find out it by inspecting the container. 
            dbmsType = KieImageTypeManager.getDBMSType(kieContainer.getRepository(), dockerService.inspect(container.getId()));
        }
    }
    
    KieImageType type = null;
    final List<KieImageType> types = new LinkedList<KieImageType>();
    if (kieAppType != null) type = kieAppType;
    if (appServerType != null && type != null) types.add(appServerType);
    else type = appServerType;
    if (dbmsType != null && type != null) types.add(dbmsType);
    if (type == null) type = OthersType.INSTANCE;
    kieContainer.setType(type);
    if (!types.isEmpty()) kieContainer.setSubTypes(types);

    // Application status.
    if (SharedUtils.isKieApp(kieContainer)) {
        KieAppStatus status = statusManager.getStatus(kieContainer.getImage());
        if (status == null) {
            status = statusManager.getStatus(kieContainer);
            statusManager.addStatus(kieContainer.getImage(), status);
        }
        kieContainer.setAppStatus(status != null ? status : KieAppStatus.NOT_EVALUATED);
    }
    
    return kieContainer;
}
 
开发者ID:kiegroup,项目名称:kie-docker-ci,代码行数:78,代码来源:KieDockerArtifactBuilder.java


注:本文中的com.github.dockerjava.api.model.ContainerPort.getPublicPort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。