Package org.tinyradius.attribute

Examples of org.tinyradius.attribute.RadiusAttribute


   
    AttributeType type = dictionary.getAttributeTypeByName(typeName);
    if (type == null)
      throw new IllegalArgumentException("unknown attribute type '" + typeName + "'");

    RadiusAttribute attribute = RadiusAttribute.createRadiusAttribute(getDictionary(), type.getVendorId(), type.getTypeCode());
    attribute.setAttributeValue(value);
    addAttribute(attribute);
  }
View Full Code Here


    if (type < 1 || type > 255)
      throw new IllegalArgumentException("attribute type out of bounds");
   
    Iterator i = attributes.iterator();
    while (i.hasNext()) {
      RadiusAttribute attribute = (RadiusAttribute)i.next();
      if (attribute.getAttributeType() == type)
        i.remove();
    }
  }
View Full Code Here

  public void removeLastAttribute(int type) {
    List attrs = getAttributes(type);
    if (attrs == null || attrs.size() == 0)
      return;
   
    RadiusAttribute lastAttribute =
      (RadiusAttribute)attrs.get(attrs.size() - 1);
    removeAttribute(lastAttribute);
  }
View Full Code Here

    for (Iterator i = vsas.iterator(); i.hasNext();) {
      VendorSpecificAttribute vsa = (VendorSpecificAttribute)i.next();
     
      List sas = vsa.getSubAttributes();
      for (Iterator j = sas.iterator(); j.hasNext();) {
        RadiusAttribute attr = (RadiusAttribute)j.next();
        if (attr.getAttributeType() == typeCode &&
          attr.getVendorId() == vendorId)
          j.remove();
      }
      if (sas.size() == 0)
        // removed the last sub-attribute
        // --> remove the whole Vendor-Specific attribute
View Full Code Here

    if (attributeType < 1 || attributeType > 255)
      throw new IllegalArgumentException("attribute type out of bounds");

    LinkedList result = new LinkedList();
    for (Iterator i = attributes.iterator(); i.hasNext();) {
      RadiusAttribute a = (RadiusAttribute)i.next();
      if (attributeType == a.getAttributeType())
        result.add(a);
    }
    return result;
  }
View Full Code Here

    List vsas = getVendorAttributes(vendorId);
    for (Iterator i = vsas.iterator(); i.hasNext();) {
      VendorSpecificAttribute vsa = (VendorSpecificAttribute)i.next();
      List sas = vsa.getSubAttributes();
      for (Iterator j = sas.iterator(); j.hasNext();) {
        RadiusAttribute attr = (RadiusAttribute)j.next();
        if (attr.getAttributeType() == attributeType &&
          attr.getVendorId() == vendorId)
          result.add(attr);
      }
    }
   
    return result;
View Full Code Here

   * is no such attribute
   * @throws IllegalArgumentException if the type name is unknown
   * @throws RuntimeException attribute occurs multiple times
   */
  public String getAttributeValue(String type) {
    RadiusAttribute attr = getAttribute(type);
    if (attr == null)
      return null;
    else
      return attr.getAttributeValue();
  }
View Full Code Here

   * @return List with VendorSpecificAttribute objects, never null
   */
  public List getVendorAttributes(int vendorId) {
    LinkedList result = new LinkedList();
    for (Iterator i = attributes.iterator(); i.hasNext();) {
      RadiusAttribute a = (RadiusAttribute)i.next();
      if (a instanceof VendorSpecificAttribute) {
        VendorSpecificAttribute vsa = (VendorSpecificAttribute)a;
        if (vsa.getChildVendorId() == vendorId)
          result.add(vsa);
      }
View Full Code Here

    StringBuffer s = new StringBuffer();
    s.append(getPacketTypeName());
    s.append(", ID ");
    s.append(packetIdentifier);
    for (Iterator i = attributes.iterator(); i.hasNext();) {
      RadiusAttribute attr = (RadiusAttribute)i.next();
      s.append("\n");
      s.append(attr.toString());
    }
    return s.toString();
  }
View Full Code Here

   * @see DefaultDictionary
   */
  public void setDictionary(Dictionary dictionary) {
    this.dictionary = dictionary;
    for (Iterator i = attributes.iterator(); i.hasNext();) {
      RadiusAttribute attr = (RadiusAttribute)i.next();
      attr.setDictionary(dictionary);
    }
  }
View Full Code Here

TOP

Related Classes of org.tinyradius.attribute.RadiusAttribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.