Package org.platformlayer.ops.networks

Examples of org.platformlayer.ops.networks.NetworkPoint


  public String getCollectdServer() throws OpsException {
    Iterable<CollectdService> collectdServices = platformLayer.listItems(CollectdService.class);
    for (CollectdService collectdService : collectdServices) {
      // TODO: Use DNS name when it works

      NetworkPoint target = network.getNetworkPoint(collectdService);

      if (target != null) {
        NetworkPoint targetNetworkPoint = NetworkPoint.forTargetInContext();
        InetAddress address = target.findBestAddress(targetNetworkPoint, InetAddressChooser.preferIpv6());
        if (address != null) {
          return address.getHostAddress();
        }
      }
View Full Code Here


    }
  }

  private Machine waitForAddress(final Machine machine) throws OpsException {
    try {
      final NetworkPoint myNetworkPoint = NetworkPoint.forMe();

      List<InetAddress> addresses = machine.getNetworkPoint().findAddresses(myNetworkPoint);
      if (!addresses.isEmpty()) {
        return machine;
      }
View Full Code Here

  protected Map<String, String> getConfigurationProperties() throws OpsException {
    Map<String, String> properties = Maps.newHashMap();

    List<Link> modelLinks = getLinks();
    if (modelLinks != null && !modelLinks.isEmpty()) {
      NetworkPoint networkPoint = NetworkPoint.forTargetInContext();
      InetAddressChooser inetAddressChooser = NearestAddressChooser.build(networkPoint);
      SimpleLinkConsumer consumer = new SimpleLinkConsumer(getModel().getKey(), inetAddressChooser);

      properties.putAll(links.buildLinkTargetProperties(consumer, modelLinks));
    }
View Full Code Here

  }

  @Override
  public CasStore getCasStore() throws OpsException {
    // TODO: Getting the IP like this is evil
    NetworkPoint targetAddress;
    // if (host.getIpv6() != null) {
    // IpRange ipv6Range = IpV6Range.parse(host.getIpv6());
    // targetAddress = NetworkPoint.forPublicHostname(ipv6Range.getGatewayAddress());
    // } else {
    targetAddress = NetworkPoint.forPublicHostname(model.host);
View Full Code Here

    // proxies.add(address);
    // }
    //
    // {
    // By IP
    NetworkPoint networkPoint = network.findNetworkPoint(model);
    if (networkPoint == null) {
      log.info("Machine not found for cache; returning null URL");
      return null;
    }

    String address = "http://" + networkPoint.getBestAddress(forNetworkPoint) + ":3128/";
    return address;
  }
View Full Code Here

  @Inject
  PlatformLayerHelpers platformLayer;

  public OpsTarget toTarget(DirectHost host) throws OpsException {
    NetworkPoint address = NetworkPoint.forPublicHostname(host.host);
    Machine hostMachine = new OpaqueMachine(address);
    OpsTarget hostTarget = hostMachine.getTarget(service.getSshKey());
    return hostTarget;
  }
View Full Code Here

        continue;
      }

      HttpProxyController httpProxy = httpProxyProvider.get();

      NetworkPoint forNetworkPoint = NetworkPoint.forTarget(target);
      String url = httpProxy.getUrl(httpProxyProvider.getItem(), forNetworkPoint, uri);
      if (url == null) {
        log.info("Could not get URL for proxy: " + item);
      } else {
        proxies.add(url);
View Full Code Here

  protected Map<String, String> getConfigurationProperties() throws OpsException {
    Map<String, String> config = Maps.newHashMap();

    if (context.links != null) {
      NetworkPoint networkPoint = NetworkPoint.forTargetInContext();
      InetAddressChooser inetAddressChooser = NearestAddressChooser.build(networkPoint);
      SimpleLinkConsumer consumer = new SimpleLinkConsumer(consumerKey, inetAddressChooser);

      config.putAll(consumeHelper.buildLinkTargetProperties(consumer, context.links.getLinks()));
    }
View Full Code Here

        LateBound<IptablesFilterEntry> entry = new LateBound<IptablesFilterEntry>() {
          @Override
          public IptablesFilterEntry get() throws OpsException {
            ItemBase sourceItem = platformLayerHelpers.getItem(sourceItemKey);

            NetworkPoint targetNetworkPoint = NetworkPoint.forTargetInContext();

            boolean required = !OpsContext.isDelete();
            Machine sourceMachine = instanceHelpers.getMachine(sourceItem, required);
            if (sourceMachine == null) {
              // TODO: Store by key? Delete by key?
View Full Code Here

    }
    return connections;
  }

  public ThrowingProvider<String> findTunnelAddress(final PlatformLayerKey machineKey) {
    final NetworkPoint src = NetworkPoint.forPublicInternet();

    return new ThrowingProvider<String>() {

      @Override
      public String build() throws OpsException {
View Full Code Here

TOP

Related Classes of org.platformlayer.ops.networks.NetworkPoint

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.