Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Protected Attributes | Private Member Functions
ArcSec::XACMLAttributeFactory Class Reference

Attribute factory class for XACML specified attributes. More...

#include <XACMLAttributeFactory.h>

Inheritance diagram for ArcSec::XACMLAttributeFactory:
Inheritance graph
[legend]
Collaboration diagram for ArcSec::XACMLAttributeFactory:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 XACMLAttributeFactory ()
virtual ~XACMLAttributeFactory ()
virtual AttributeValuecreateValue (const Arc::XMLNode &node, const std::string &type)
 creat a AttributeValue according to the value in the XML node and the type; It should be the caller to release the AttributeValue Object

Protected Attributes

AttrProxyMap apmap

Private Member Functions

void initDatatypes ()

Detailed Description

Attribute factory class for XACML specified attributes.

Definition at line 13 of file XACMLAttributeFactory.h.


Constructor & Destructor Documentation

Definition at line 40 of file XACMLAttributeFactory.cpp.

                                            {
  initDatatypes();
}

Definition at line 78 of file XACMLAttributeFactory.cpp.

                                             {
  AttrProxyMap::iterator it;
  for(it = apmap.begin(); it != apmap.end(); it = apmap.begin()){
    AttributeProxy* attrproxy = (*it).second;
    apmap.erase(it);
    if(attrproxy) delete attrproxy;
  }
}

Member Function Documentation

AttributeValue * ArcSec::XACMLAttributeFactory::createValue ( const Arc::XMLNode node,
const std::string &  type 
) [virtual]

creat a AttributeValue according to the value in the XML node and the type; It should be the caller to release the AttributeValue Object

Implements ArcSec::AttributeFactory.

Definition at line 44 of file XACMLAttributeFactory.cpp.

                                                                                            {
  AttrProxyMap::iterator it;
  if((it=apmap.find(type)) != apmap.end())
    return ((*it).second)->getAttribute(node);
#if 0
  // This may look like hack, but generic attribute needs special treatment
  std::string value;
  if((bool)(const_cast<XMLNode&>(node).Child())) {
    value = (std::string)(const_cast<XMLNode&>(node).Child());
  //<Attribute AttributeId="" DataType=""><AttributeValue>abc</AttributeValue></Attribute>
  } else {
    value = (std::string)node; 
  }
  //<AttributeValue DataType="">abc</AttributeValue>

  std::size_t start;
  start = value.find_first_not_of(" \n\r\t");
  value = value.substr(start);
  std::size_t end;
  end = value.find_last_not_of(" \n\r\t");
  value = value.substr(0, end+1);

  GenericAttribute* attr = new GenericAttribute(value,
            (std::string)(const_cast<XMLNode&>(node).Attribute("AttributeId")));
  attr->setType(type);
  return attr;
#endif

  //For generic attributes, treat them as string
  if((it=apmap.find("string")) != apmap.end())
    return ((*it).second)->getAttribute(node);
  return NULL;
}

Here is the call graph for this function:

TODO: other datatype.............

Definition at line 24 of file XACMLAttributeFactory.cpp.

                                         {
  //Some XACML specified attribute types
  apmap.insert(std::pair<std::string, AttributeProxy*>(StringAttribute::getIdentifier(), new XACMLAttributeProxy<StringAttribute>));
  apmap.insert(std::pair<std::string, AttributeProxy*>(DateTimeAttribute::getIdentifier(), new XACMLAttributeProxy<DateTimeAttribute>));
  apmap.insert(std::pair<std::string, AttributeProxy*>(DateAttribute::getIdentifier(), new XACMLAttributeProxy<DateAttribute>));
  apmap.insert(std::pair<std::string, AttributeProxy*>(TimeAttribute::getIdentifier(), new XACMLAttributeProxy<TimeAttribute>));
  apmap.insert(std::pair<std::string, AttributeProxy*>(DurationAttribute::getIdentifier(), new XACMLAttributeProxy<DurationAttribute>));
  apmap.insert(std::pair<std::string, AttributeProxy*>(PeriodAttribute::getIdentifier(), new XACMLAttributeProxy<PeriodAttribute>));
  apmap.insert(std::pair<std::string, AttributeProxy*>(X500NameAttribute::getIdentifier(), new XACMLAttributeProxy<X500NameAttribute>));
  apmap.insert(std::pair<std::string, AttributeProxy*>(AnyURIAttribute::getIdentifier(), new XACMLAttributeProxy<AnyURIAttribute>));
  apmap.insert(std::pair<std::string, AttributeProxy*>(GenericAttribute::getIdentifier(), new XACMLAttributeProxy<GenericAttribute>));

}

Member Data Documentation

Definition at line 25 of file AttributeFactory.h.


The documentation for this class was generated from the following files: