com.sagestudio.jh2n
Class jh2n

java.lang.Object
  extended bycom.sagestudio.jh2n.jh2n

public class jh2n
extends java.lang.Object

JH2N - A java host to name server converter. A java replacement/enhancement of the perl program of the same name. It does operate in a slightly different manner then the original h2n, as this version was written to support the many virtual domains found at an ISP. The -d option is not meaningfull, as this h2n assumes that every domain found in the host file is to have SOA records built. This version takes many of the same arguments as the original h2n. To make jh2n work properly, first create an instance, passing any command line args as a string array. Next use the readHostFile method to have it read the input file and build all the internal structures Next use the writeFiles method to get it to create the named.boot file, as well as all the db resource record files.

Version:
0.95 02/21/2003
Author:
Craig Nelson

Field Summary
 java.lang.String copyright
           
 java.lang.String copyrightdate
           
 java.lang.String jh2nversion
           
 
Constructor Summary
jh2n()
           
jh2n(java.lang.String[] args)
          Constructors
 
Method Summary
static void main(java.lang.String[] args)
          Main method is used to allow this class to run stand-alone
 java.lang.String printAliases()
          prints all the entries in the hostHash
 void printFooter(java.io.PrintWriter printout, java.lang.String domain)
          prints the $INCLUDE directive at the bottom of the db files
 void printGNUGPL()
           
 void printHeader(java.io.PrintWriter printout, java.lang.String domain)
          Used to write the SOA and NS records to the db files Note that the serial number is generated using the current date/time in the form YYYYmmDDnn where nn is a unique number incremented every 15 minutes
 java.lang.String printHosts()
          prints all the entries in the hostHash
 boolean testForDomain(java.lang.String junk)
          tests to see if a given domain is supposed to be processed returns false if its in the list of ignored domains
 boolean testForNetwork(java.lang.String junk)
          tests to see if a given network is in the list of accepted networks
 boolean testNetworkAddress(java.lang.String address)
           
 void writeBoot(java.lang.String outfile, java.lang.String primaryServer, boolean savefile)
          writeBoot creates the named.boot file parameters are the output file boolean indicating primary or secondary String indicating a folder to prepend to the files, if the string is null, then don't save the files if the string is empty, then don't prepend anything if the string contains something, then prepend the filenames with the string (note that the string should only be passwd for secondary files, not primaries)
 void writeDomainList(java.lang.String outfile)
           
 void writeHostPrefixList(java.lang.String prefix, java.lang.String outfile)
          write the list of hosts with passed prefix but that are on a controlled network!
 void writeRR(java.lang.String domain)
           
 void writeRRAll()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jh2nversion

public java.lang.String jh2nversion

copyrightdate

public java.lang.String copyrightdate

copyright

public java.lang.String copyright
Constructor Detail

jh2n

public jh2n(java.lang.String[] args)
Constructors


jh2n

public jh2n()
Method Detail

main

public static void main(java.lang.String[] args)
Main method is used to allow this class to run stand-alone


writeBoot

public void writeBoot(java.lang.String outfile,
                      java.lang.String primaryServer,
                      boolean savefile)
writeBoot creates the named.boot file parameters are the output file boolean indicating primary or secondary String indicating a folder to prepend to the files, if the string is null, then don't save the files if the string is empty, then don't prepend anything if the string contains something, then prepend the filenames with the string (note that the string should only be passwd for secondary files, not primaries)


testForNetwork

public boolean testForNetwork(java.lang.String junk)
tests to see if a given network is in the list of accepted networks


testForDomain

public boolean testForDomain(java.lang.String junk)
tests to see if a given domain is supposed to be processed returns false if its in the list of ignored domains


testNetworkAddress

public boolean testNetworkAddress(java.lang.String address)

writeRRAll

public void writeRRAll()

writeRR

public void writeRR(java.lang.String domain)

writeDomainList

public void writeDomainList(java.lang.String outfile)

writeHostPrefixList

public void writeHostPrefixList(java.lang.String prefix,
                                java.lang.String outfile)
write the list of hosts with passed prefix but that are on a controlled network!


printHeader

public void printHeader(java.io.PrintWriter printout,
                        java.lang.String domain)
Used to write the SOA and NS records to the db files Note that the serial number is generated using the current date/time in the form YYYYmmDDnn where nn is a unique number incremented every 15 minutes


printFooter

public void printFooter(java.io.PrintWriter printout,
                        java.lang.String domain)
prints the $INCLUDE directive at the bottom of the db files


printHosts

public java.lang.String printHosts()
prints all the entries in the hostHash


printAliases

public java.lang.String printAliases()
prints all the entries in the hostHash


printGNUGPL

public void printGNUGPL()