public double getValue() { return Double.parseDouble(delegate.getValue()); } }
public int getValue() { return Integer.parseInt(delegate.getValue()); } }
@Override public String toString() { return getPropertyName()+(isAvailable()?"="+getValue():"(unset)"); } }
private static HostGeoLookup findHostGeoLookupImpl() throws InstantiationException, IllegalAccessException, ClassNotFoundException { String type = BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL.getValue(); if (type==null) { type = BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL_LEGACY.getValue(); if (type!=null && !warnedLegacy) { warnedLegacy = true; log.warn("Using deprecated host-geo-lookup property "+BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL_LEGACY+"; " + "set "+BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL+" instead"); } } /* utrace seems more accurate than geobytes, and it gives a report of how many tokens are left; * but maxmind if it's installed locally is even better (does not require remote lookup), * so use it if available */ if (type==null) { if (MaxMind2HostGeoLookup.getDatabaseReader()!=null) return new MaxMind2HostGeoLookup(); log.debug("Using Utrace remote for geo lookup because MaxMind2 is not available"); return new UtraceHostGeoLookup(); } if (type.isEmpty()) return null; return (HostGeoLookup) new ClassLoaderUtils(HostGeoInfo.class).loadClass(type).newInstance(); }
/** returns an IP address for localhost, * paying attention to system property * {@link BrooklynServiceAttributes#LOCALHOST_IP_ADDRESS} * if set to prevent default selection when needed, * otherwise finding the first bindable/reachable NIC from a system lookup which usually * prefers IPv4 then non-loopback devices (but use the system property if if needed) */ public static InetAddress getLocalhostInetAddress() { return TypeCoercions.coerce(JavaGroovyEquivalents.elvis(BrooklynServiceAttributes.LOCALHOST_IP_ADDRESS.getValue(), Networking.getLocalHost(true, false, true, true, 500)), InetAddress.class); } }
super.setUp(); origGeoLookupImpl = BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL.getValue(); HostGeoInfo.clearCachedLookup();