AXL Software

com.theorem.radserver3.dictionary.util
Class GenerateJavaDictionary

Object
  extended byGenerateJavaDictionary

public class GenerateJavaDictionary
extends Object

Class to generate an AXL Radius Vendor dictionary .java file from a dictionary file.

This class is used to generate a dictionary file containing vendor specific information suitable for your server.

This may be used in a class or run from the command line with a properties file. The default properties file is 'GenerateJavaDictionary.propeties'.

If the DefaultDictionary.java is overwritten it will be automatically picked up by the client or server if in the class path. If a new dictionary is created you can incorporate it into the system by invoking BD.addDictionary(new MyDictionary()); where MyDictionary is substituted with the name of the dictionary you've built. This will be added to any other dictionaries present.

Example:

public static void main(String a[])
{
        // Set up the path to the main dictionary file that includes other
        // dictionary files. This uses the dictionary file as distributed.
        String dictFile = "/usr/local/share/freeradius/dictionary";
        try {
                // This will the directory where the dictionary file will be written.
                // In this case it's the current directory.
                String destinationPath = ".";

                // The package for the dictionary file. This will becom the Java
                // package statement name.
                String packageName = "com.mycompany.radius";

                // This is the location of the RADIUSDictionary class in your AXL  RADIUS Server/Clientdistribution.
                // You can use the wildcard or the explicit name. This example uses the wild card.
                String importClassName = "com.axlradius.radserver4.dictionary.*";

                // This is the class name and the name of the Java file.
                // In this example class will be "com.mycompany.radius.MyDictionary"
                // the file will be placed in "/java/com/mycompany/radius/MyDictionary.java"
                String className = "MyDictionary";

                GenerateJavaDictionary gjd = new GenerateJavaDictionary(
                                dictFile,
                                destinationPath,
                                packageName,
                                importClassName,
                                className);
                gjd.writeJavaDictionary();
        } catch (Exception e) {
                e.printStackTrace();
        }
}
 

Since:
3.34

Field Summary
static String DEFAULT_PROPERTIES
          Default properties file.
 
Constructor Summary
GenerateJavaDictionary(String dictionaryPath, String destinationPath, String packageName, String importClassName, String className)
          Constructor to generate Java code to include RADIUS dictionaries in packages.
 
Method Summary
static void main(String[] a)
          Generate a dictionary file from the command line.
 void writeJavaDictionary()
          Write the java dictionary file.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROPERTIES

public static final String DEFAULT_PROPERTIES
Default properties file.

See Also:
Constant Field Values
Constructor Detail

GenerateJavaDictionary

public GenerateJavaDictionary(String dictionaryPath,
                              String destinationPath,
                              String packageName,
                              String importClassName,
                              String className)
Constructor to generate Java code to include RADIUS dictionaries in packages.

Parameters:
dictionaryPath - Path to FreeRadius dictionary. The dictionary should be configured to include only the vendor dictionary files you'll require.
destinationPath - Path to the RADIUSDictionary java that will be written. For example /java/com/company/server/dictionary.
packageName - Package for the resulting Java code - for example "com.company.server.dictionary".
importClassName - This is the location of the RADIUSDictionary class in your distribution. For example you could use either "com.theorem.radserver3.dictionary.*" or "com.axlradius.radserver4.dictionary.RADIUSDictionary".
className - This is the class name you want to generate. For example it could be "LocalDictionary".
Method Detail

main

public static void main(String[] a)
Generate a dictionary file from the command line.

Usage: GenerateJavaDictionary [properties file -optional] The default properties file is


writeJavaDictionary

public void writeJavaDictionary()
                         throws IOException
Write the java dictionary file.

Throws:
IOException - if there's a problem writing.

AXL Software

Submit a bug report or feature request

Copyright 1998-2010 AXL Software PO Box 97, Viola, Delaware 19979, U.S.A. All Rights Reserved.