/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Generates a file containing JFlex macros to accept valid ASCII TLDs
* (top level domains), for inclusion in JFlex grammars that can accept
* domain names.
* <p/>
* The IANA Root Zone Database is queried via HTTP from URL cmdline arg #0, the
* response is parsed, and the results are written out to a file containing
* a JFlex macro that will accept all valid ASCII-only TLDs, including punycode
* forms of internationalized TLDs (output file cmdline arg #1).
*/
public class GenerateJflexTLDMacros {
+ "<ZoneFileURL> <JFlexOutputFile>");
}
}
= "/*" + NL
+ " * Copyright 2001-2005 The Apache Software Foundation." + NL
+ " *" + NL
+ " * Licensed under the Apache License, Version 2.0 (the \"License\");" + NL
+ " * you may not use this file except in compliance with the License." + NL
+ " * You may obtain a copy of the License at" + NL
+ " *" + NL
+ " *" + NL
+ " * Unless required by applicable law or agreed to in writing, software" + NL
+ " * distributed under the License is distributed on an \"AS IS\" BASIS," + NL
+ " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." + NL
+ " * See the License for the specific language governing permissions and" + NL
+ " * limitations under the License." + NL
throws Exception {
}
/**
* Downloads the IANA Root Zone Database, extracts the ASCII TLDs, then
* writes a JFlex macro accepting any of them case-insensitively out to
* the specified output file.
*
* @throws IOException if there is a problem either downloading the database
* or writing out the output file.
*/
+ outputFile + "'.");
}
/**
* Downloads the IANA Root Zone Database.
* @return downcased sorted set of ASCII TLDs
* @throws java.io.IOException if there is a problem downloading the database
*/
connection.setUseCaches(false);
try {
} else {
}
}
}
} finally {
}
return TLDs;
}
/**
* Writes a file containing a JFlex macro that will accept any of the given
* TLDs case-insensitively.
*
* @param ASCIITLDs The downcased sorted set of top level domains to accept
* @throws IOException if there is an error writing the output file
*/
try {
if (tldFileLastModified > 0L) {
}
boolean isFirst = true;
if (isFirst) {
isFirst = false;
} else {
}
}
} finally {
}
}
/**
* Returns a regex that will accept the given ASCII TLD case-insensitively.
*
* @param ASCIITLD The ASCII TLD to generate a regex for
* @return a regex that will accept the given ASCII TLD case-insensitively
*/
} else {
}
}
}
}