public static Zone getInstanceExternalZone() {
   try {
     Name name = getExternalName();
     Name host = Name.fromString("root." + name.toString());
     Name admin =
         Name.fromString(
             Internets.localHostInetAddress().getCanonicalHostName() + "." + name.toString());
     Name target = Name.fromString(Internets.localHostInetAddress().getCanonicalHostName() + ".");
     long serial = 1;
     long refresh = 86400;
     long retry = ttl;
     long expires = 2419200;
     // This is the negative cache TTL
     long minimum = 600;
     Record soarec =
         new SOARecord(
             name, DClass.IN, ttl, host, admin, serial, refresh, retry, expires, minimum);
     long nsTTL = 604800;
     Record nsrec = new NSRecord(name, DClass.IN, nsTTL, target);
     return new TransientZone(name, new Record[] {soarec, nsrec});
   } catch (Exception e) {
     LOG.error(e, e);
     return null;
   }
 }
 public static ServiceConfiguration createBogus(
     final Class<? extends ComponentId> compIdClass, final Class<?> ownerType) {
   ComponentId compId = ComponentIds.lookup(compIdClass);
   return new EphemeralConfiguration(
       compId,
       compId.getPartition(),
       ownerType.getCanonicalName(),
       ServiceUris.internal(compId, Internets.localHostInetAddress(), ownerType.getSimpleName()));
 }
 public static Zone getPtrZone(Name queryName) {
   try {
     String nameString = queryName.toString();
     Name name;
     int index = nameString.indexOf(".in-addr.arpa.");
     if (index > 0) {
       String ipString = nameString.substring(0, index);
       String[] parts = ipString.split("\\.");
       // fix this for v6
       if (parts.length == 4) {
         nameString = nameString.substring(parts[0].length() + 1);
         name = new Name(nameString);
       } else {
         return null;
       }
     } else {
       return null;
     }
     long serial = 1;
     long refresh = 86400;
     long retry = ttl;
     long expires = 2419200;
     // This is the negative cache TTL
     long minimum = 600;
     Record soarec =
         new SOARecord(
             name,
             DClass.IN,
             ttl,
             name,
             Name.fromString("root." + name.toString()),
             serial,
             refresh,
             retry,
             expires,
             minimum);
     long nsTTL = 604800;
     Record nsrec =
         new NSRecord(
             name,
             DClass.IN,
             nsTTL,
             Name.fromString(Internets.localHostInetAddress().getCanonicalHostName() + "."));
     return new TransientZone(name, new Record[] {soarec, nsrec});
   } catch (Exception e) {
     LOG.error(e, e);
     return null;
   }
 }
 public static ServiceConfiguration createEphemeral(final ComponentId compId) {
   return createEphemeral(compId, Internets.localHostInetAddress());
 }