net.sf.jradius.packet.attribute
Class AttributeFactory

java.lang.Object
  extended by net.sf.jradius.packet.attribute.AttributeFactory

public final class AttributeFactory
extends java.lang.Object

The Attribute Factor. This factor builds the RADIUS attributes based on configured dictionaries.

Author:
David Bird

Nested Class Summary
static class AttributeFactory.VendorValue
           
 
Constructor Summary
AttributeFactory()
           
 
Method Summary
static RadiusAttribute attributeFromString(java.lang.String src)
          Parses a string to create a RadiusAttribute.
static java.util.LinkedHashMap getAttributeMap()
           
static java.util.LinkedHashMap getAttributeNameMap()
           
static int getTypeByName(java.lang.String aName)
          The the integer type of a RadiusAttribute by name
static java.util.LinkedHashMap getVendorMap()
           
static boolean loadAttributeDictionary(java.lang.String className)
          Load an attribute dictionary
static void loadAttributesFromString(AttributeList list, java.lang.String src, boolean beStrinct)
           
static RadiusAttribute newAttribute(AttributeDescription desc)
          Create a new RadiusAttribute based on a AttributeDescription
static RadiusAttribute newAttribute(int type, byte[] value)
          Creates a new RadiusAttribute
static RadiusAttribute newAttribute(int vendor, int type, byte[] value, int op)
          Creates a new RadiusAttribute
static RadiusAttribute newAttribute(java.lang.String aName)
          Create a RadiusAttribute by name
static RadiusAttribute newAttribute(java.lang.String aName, java.lang.String aValue, java.lang.String aOp)
          Creates a new RadiusAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeFactory

public AttributeFactory()
Method Detail

loadAttributeDictionary

public static boolean loadAttributeDictionary(java.lang.String className)
Load an attribute dictionary

Parameters:
className - Name of the Java Class derived from AttributeDictionary
Returns:
Returns true if loading of dictionary was successful

attributeFromString

public static RadiusAttribute attributeFromString(java.lang.String src)
                                           throws RadiusException,
                                                  UnknownAttributeException
Parses a string to create a RadiusAttribute. Will either return the attribute, or throw an Exception.

Parameters:
src - The source String
Returns:
Returns the RadiusAttribute parsed from String
Throws:
RadiusException
UnknownAttributeException

loadAttributesFromString

public static void loadAttributesFromString(AttributeList list,
                                            java.lang.String src,
                                            boolean beStrinct)
                                     throws RadiusException
Throws:
RadiusException

newAttribute

public static RadiusAttribute newAttribute(int vendor,
                                           int type,
                                           byte[] value,
                                           int op)
Creates a new RadiusAttribute

Parameters:
vendor - The VendorID of the attribute (if one)
type - The Attribute Type
value - The Attribute Value
op - The Attribute Operator
Returns:
Returns the newly created RadiusAttribute

newAttribute

public static RadiusAttribute newAttribute(int type,
                                           byte[] value)
Creates a new RadiusAttribute

Parameters:
type - The type of the attribute
value - The value of the attribute
Returns:
Returns the newly created RadiusAttribute

newAttribute

public static RadiusAttribute newAttribute(java.lang.String aName)
                                    throws UnknownAttributeException
Create a RadiusAttribute by name

Parameters:
aName - The name of the attribute to create
Returns:
Returns the newly created RadiusAttribute
Throws:
UnknownAttributeException

newAttribute

public static RadiusAttribute newAttribute(AttributeDescription desc)
                                    throws UnknownAttributeException
Create a new RadiusAttribute based on a AttributeDescription

Parameters:
desc - The RadiusDescription
Returns:
Returns the newly created RadiusAttribute
Throws:
UnknownAttributeException

newAttribute

public static RadiusAttribute newAttribute(java.lang.String aName,
                                           java.lang.String aValue,
                                           java.lang.String aOp)
                                    throws UnknownAttributeException
Creates a new RadiusAttribute

Parameters:
aName - The name of the attribute to create
aValue - The value of the attribute
aOp - The "operator" of the attribute
Returns:
Returns the newly created RadiusAttribute
Throws:
UnknownAttributeException

getTypeByName

public static int getTypeByName(java.lang.String aName)
                         throws UnknownAttributeException
The the integer type of a RadiusAttribute by name

Parameters:
aName - The name of the attribute
Returns:
Returns the integer type of the attribute
Throws:
UnknownAttributeException

getAttributeMap

public static java.util.LinkedHashMap getAttributeMap()
Returns:
Returns the attributeMap.

getAttributeNameMap

public static java.util.LinkedHashMap getAttributeNameMap()
Returns:
Returns the attributeNameMap.

getVendorMap

public static java.util.LinkedHashMap getVendorMap()
Returns:
Returns the vendorMap.


Copyright © 2006 The JRadius Project, All Rights Reserved.