net.jradius.packet.attribute
Class AttributeFactory

java.lang.Object
  extended by net.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 int addToAttributeList(AttributeList list, long type, byte[] value)
           
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 long getTypeByName(java.lang.String aName)
          The the integer type of a RadiusAttribute by name
static java.util.LinkedHashMap getVendorMap()
           
static boolean loadAttributeDictionary(AttributeDictionary dict)
           
static boolean loadAttributeDictionary(java.lang.String className)
          Load an attribute dictionary
static void loadAttributesFromString(AttributeList list, java.lang.String src, java.lang.String delim, boolean beStrinct)
           
static RadiusAttribute newAttribute(AttributeDescription desc)
          Create a new RadiusAttribute based on a AttributeDescription
static RadiusAttribute newAttribute(long type, byte[] value)
          Creates a new RadiusAttribute
static RadiusAttribute newAttribute(long vendor, long 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
static AttributeList newAttributeList(long type, byte[] value)
           
 
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

loadAttributeDictionary

public static boolean loadAttributeDictionary(AttributeDictionary dict)

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,
                                            java.lang.String delim,
                                            boolean beStrinct)
                                     throws RadiusException
Throws:
RadiusException

newAttribute

public static RadiusAttribute newAttribute(long vendor,
                                           long 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(long 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

newAttributeList

public static AttributeList newAttributeList(long type,
                                             byte[] value)
Parameters:
type - The type of the attribute
value - The value of the attribute
Returns:
Returns the newly created AttributeList

addToAttributeList

public static int addToAttributeList(AttributeList list,
                                     long type,
                                     byte[] value)
Parameters:
list - The AttributeList to add to
type - The type of the attribute
value - The value of the attribute
Returns:
Returns how many attributes created

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 long 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 © 2008 JRadius Project, All Rights Reserved.