Package org.platformlayer

Examples of org.platformlayer.InetAddressChooser


    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


  InstanceHelpers instances;

  public URI buildUri(NetworkPoint src, String scheme, ItemBase model, int port) throws OpsException {
    Machine machine = instances.getMachine(model);

    InetAddressChooser chooser = InetAddressChooser.preferIpv6();
    InetAddress address = machine.getNetworkPoint().getBestAddress(src, chooser);

    String host = InetAddresses.toAddrString(address);

    URI uri;
View Full Code Here

  @Override
  public Map<String, String> buildLinkTargetConfiguration(LinkConsumer consumer) throws OpsException {
    ItemBase serverItem = platformLayer.getItem(model.server);
    DatabaseServer databaseServer = providers.toInterface(serverItem, DatabaseServer.class);

    InetAddressChooser inetAddressChooser = consumer.getInetAddressChooser();

    return databaseServer.buildTargetConfiguration(model.username, model.password, model.databaseName,
        inetAddressChooser);
  }
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

  @Override
  public Map<String, String> buildLinkTargetConfiguration(LinkConsumer consumer) throws OpsException {
    ItemBase serverItem = platformLayer.getItem(model.server);
    DatabaseServer databaseServer = providers.toInterface(serverItem, DatabaseServer.class);

    InetAddressChooser inetAddressChooser = consumer.getInetAddressChooser();

    return databaseServer.buildTargetConfiguration(model.username, model.password, model.databaseName,
        inetAddressChooser);
  }
View Full Code Here

  @Override
  public Map<String, String> buildLinkTargetConfiguration(LinkConsumer consumer) throws OpsException {
    ItemBase serverItem = platformLayer.getItem(model.server);
    DatabaseServer databaseServer = providers.toInterface(serverItem, DatabaseServer.class);

    InetAddressChooser inetAddressChooser = consumer.getInetAddressChooser();

    return databaseServer.buildTargetConfiguration(model.username, model.password, model.databaseName,
        inetAddressChooser);
  }
View Full Code Here

      OpsProvider<TagChanges> tagChanges = new OpsProvider<TagChanges>() {
        @Override
        public TagChanges get() throws OpsException {
          RawInstance instance = platformLayerClient.getItem(model.instance, RawInstance.class);

          InetAddressChooser chooser = InetAddressChooser.preferIpv4();
          InetAddress publicAddress = chooser.choose(Tag.NETWORK_ADDRESS.find(instance.getTags()));

          if (publicAddress == null) {
            throw new OpsException("Cannot find address for instance: " + model.instance);
          }
View Full Code Here

    return address;
  }

  public String getBestAddress(NetworkPoint src) throws OpsException {
    InetAddressChooser chooser;
    if (!src.isPublicAddress()) {
      chooser = InetAddressChooser.preferIpv6();
    } else {
      chooser = InetAddressChooser.preferIpv4();
    }
View Full Code Here

TOP

Related Classes of org.platformlayer.InetAddressChooser

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.