Back to index

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

Container, <Subjects, Actions, Objects, Contexts> tuple. More...

#include <ArcRequestItem.h>

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

List of all members.

Public Member Functions

 ArcRequestItem (Arc::XMLNode &node, AttributeFactory *attrfactory)
virtual ~ArcRequestItem ()
virtual SubList getSubjects () const
virtual void setSubjects (const SubList &sl)
virtual ResList getResources () const
virtual void setResources (const ResList &rl)
virtual ActList getActions () const
virtual void setActions (const ActList &actions)
virtual CtxList getContexts () const
virtual void setContexts (const CtxList &ctx)

Protected Attributes

SubList subjects
ResList actions
ActList resources
CtxList contexts

Private Member Functions

void removeSubjects ()
void removeResources ()
void removeActions ()
void removeContexts ()

Detailed Description

Container, <Subjects, Actions, Objects, Contexts> tuple.

Specified ArcRequestItem which can parse Arc request formate

Definition at line 11 of file ArcRequestItem.h.


Constructor & Destructor Documentation

Definition at line 12 of file ArcRequestItem.cpp.

                                                                           : RequestItem(node, attrfactory) {
  //Parse the XMLNode structure, and generate the RequestAttribute object
  XMLNode nd;

  //Parse the <Subject> part
  for ( int i=0;; i++ ){
    std::string type;
    nd = node["Subject"][i];
    if(!nd) break;

    if(!((std::string)(nd.Attribute("Type"))).empty())
      type = (std::string)(nd.Attribute("Type"));
 
    //if the "Subject" is like this: 
    //<Subject AttributeId="urn:arc:subject:dn" Type="X500DN">/O=NorduGrid/OU=UIO/CN=test</Subject>
    if(!(type.empty())&&(nd.Size()==0)){
      Subject sub;
      sub.push_back(new RequestAttribute(nd, attrfactory));
      subjects.push_back(sub);
    }
    //else if like this:
    /*  <Subject>
          <Attribute AttributeId="urn:arc:subject:voms-attribute" Type="xsd:string">administrator</Attribute>
          <Attribute AttributeId="urn:arc:subject:voms-attribute" Type="X500DN">/O=NorduGrid/OU=UIO/CN=admin</Attribute>
        </Subject> */
    else if((type.empty())&&(nd.Size()>0)){
      Subject sub;
      for(int j=0;;j++){
        XMLNode tnd = nd.Child(j);
        if(!tnd) break;
        sub.push_back(new RequestAttribute(tnd, attrfactory));
      }
      subjects.push_back(sub);
    }
    //else if like this:
    /*  <Subject Type="xsd:string">
          <Attribute AttributeId="urn:arc:subject:voms-attribute">administrator</Attribute>
          <Attribute AttributeId="urn:arc:subject:voms-attribute">/O=NorduGrid/OU=UIO/CN=admin</Attribute>
        </Subject> */
    else if(!(type.empty())&&(nd.Size()>0)){
      Subject sub;
      for(int j=0;;j++){
        XMLNode tnd = nd.Child(j);
        if(!tnd) break;
        std::string type_fullname = (nd.Attribute("Type")).Prefix();
        type_fullname = type_fullname + ":Type";
        XMLNode type_prop = tnd.NewAttribute(type_fullname.c_str());
        type_prop = type;
        sub.push_back(new RequestAttribute(tnd, attrfactory));
      }
      subjects.push_back(sub);
    }
    //else if like this: <Subject/>
    else if((type.empty()) && (nd.Size()==0) && (((std::string)nd).empty())) {}
    else {std::cerr <<"Error definition in RequestItem:Subject"<<std::endl;}
  }

  //Parse the <Resource>
  for ( int i=0;; i++ ){
    std::string type;
    nd = node["Resource"][i];
    if(!nd) break;
    if(!((std::string)(nd.Attribute("Type"))).empty())
      type = (std::string)(nd.Attribute("Type"));
    if(!(type.empty())&&(nd.Size()==0)){
      Resource res;
      res.push_back(new RequestAttribute(nd, attrfactory));
      resources.push_back(res);
    }
    else if((type.empty())&&(nd.Size()>0)){
      Resource res;
      for(int j=0;;j++){
        XMLNode tnd = nd.Child(j);
        if(!tnd) break;
        res.push_back(new RequestAttribute(tnd, attrfactory));
      }
      resources.push_back(res);
    }
    else if(!(type.empty())&&(nd.Size()>0)){
      Resource res;
      for(int j=0;;j++){
        XMLNode tnd = nd.Child(j);
        if(!tnd) break;
        std::string type_fullname = (nd.Attribute("Type")).Prefix();
        type_fullname = type_fullname + ":Type";
        XMLNode type_prop = tnd.NewAttribute(type_fullname.c_str());
        type_prop = type;
        res.push_back(new RequestAttribute(tnd, attrfactory));
      }
      resources.push_back(res);
    }
    else if((type.empty()) && (nd.Size()==0) && (((std::string)nd).empty())) {}
    else {std::cerr <<"Error definition in RequestItem:Resource"<<std::endl;}
  }

  //Parse the <Action> part
  for ( int i=0;; i++ ){
    std::string type;
    nd = node["Action"][i];
    if(!nd) break;
    if(!((std::string)(nd.Attribute("Type"))).empty())
      type = (std::string)(nd.Attribute("Type"));
    if(!(type.empty())&&(nd.Size()==0)){
      Action act;
      act.push_back(new RequestAttribute(nd, attrfactory));
      actions.push_back(act);
    }
    else if((type.empty())&&(nd.Size()>0)){
      Action act;
      for(int j=0;;j++){
        XMLNode tnd = nd.Child(j);
        if(!tnd) break;
        act.push_back(new RequestAttribute(tnd, attrfactory));
      }
      actions.push_back(act);
    }
    else if(!(type.empty())&&(nd.Size()>0)){
      Action act;
      for(int j=0;;j++){
        XMLNode tnd = nd.Child(j);
        if(!tnd) break;
        std::string type_fullname = (nd.Attribute("Type")).Prefix();
        type_fullname = type_fullname + ":Type";
        XMLNode type_prop = tnd.NewAttribute(type_fullname.c_str());
        type_prop = type;
        act.push_back(new RequestAttribute(tnd, attrfactory));
      }
      actions.push_back(act);
    }
    else if((type.empty()) && (nd.Size()==0) && (((std::string)nd).empty())) {}
    else {std::cerr <<"Error definition in RequestItem:Action"<<std::endl;}
  }

  //Parse the Context part
  for ( int i=0;; i++ ){
    std::string type;
    nd = node["Context"][i];
    if(!nd) break;
    if(!((std::string)(nd.Attribute("Type"))).empty())
      type = (std::string)(nd.Attribute("Type"));
    if(!(type.empty())&&(nd.Size()==0)){
      Context ctx;
      ctx.push_back(new RequestAttribute(nd, attrfactory));
      contexts.push_back(ctx);
    }
    else if((type.empty())&&(nd.Size()>0)){
      Context ctx;
      for(int j=0;;j++){
        XMLNode tnd = nd.Child(j);
        if(!tnd) break;
        ctx.push_back(new RequestAttribute(tnd, attrfactory));
      }
      contexts.push_back(ctx);
    }
    else if(!(type.empty())&&(nd.Size()>0)){
      Context ctx;
      for(int j=0;;j++){
        XMLNode tnd = nd.Child(j);
        if(!tnd) break;
        std::string type_fullname = (nd.Attribute("Type")).Prefix();
        type_fullname = type_fullname + ":Type";
        XMLNode type_prop = tnd.NewAttribute(type_fullname.c_str());
        type_prop = type;
        ctx.push_back(new RequestAttribute(tnd, attrfactory));
      }
      contexts.push_back(ctx);
    }
    else if((type.empty()) && (nd.Size()==0) && (((std::string)nd).empty())) {}
    else {std::cerr <<"Error definition in RequestItem:Context"<<std::endl;}
  }
}

Here is the call graph for this function:

ArcRequestItem::~ArcRequestItem ( void  ) [virtual]

Definition at line 228 of file ArcRequestItem.cpp.

Here is the call graph for this function:


Member Function Documentation

ActList ArcRequestItem::getActions ( ) const [virtual]

Implements ArcSec::RequestItem.

Definition at line 253 of file ArcRequestItem.cpp.

                                          {
  return actions;
}
CtxList ArcRequestItem::getContexts ( ) const [virtual]

Implements ArcSec::RequestItem.

Definition at line 262 of file ArcRequestItem.cpp.

                                          {
  return contexts;
}

Implements ArcSec::RequestItem.

Definition at line 244 of file ArcRequestItem.cpp.

                                           {
  return resources;
}
SubList ArcRequestItem::getSubjects ( ) const [virtual]

Implements ArcSec::RequestItem.

Definition at line 235 of file ArcRequestItem.cpp.

                                          {
  return subjects;
}
void ArcRequestItem::removeActions ( ) [private]

Definition at line 206 of file ArcRequestItem.cpp.

                                   {
  while(!(actions.empty())){
    Action act = actions.back();
    while(!(act.empty())){
      delete act.back();
      act.pop_back();
    }
    actions.pop_back();
  }
}

Here is the caller graph for this function:

void ArcRequestItem::removeContexts ( ) [private]

Definition at line 217 of file ArcRequestItem.cpp.

                                    {
  while(!(contexts.empty())){
    Context ctx = contexts.back();
    while(!(ctx.empty())){
      delete ctx.back();
      ctx.pop_back();
    }
    contexts.pop_back();
  }
}

Here is the caller graph for this function:

void ArcRequestItem::removeResources ( ) [private]

Definition at line 195 of file ArcRequestItem.cpp.

                                     {
  while(!(resources.empty())){
    Resource res = resources.back();
    while(!(res.empty())){
      delete res.back();
      res.pop_back();
    }
    resources.pop_back();
  }
}

Here is the caller graph for this function:

void ArcRequestItem::removeSubjects ( ) [private]

Definition at line 184 of file ArcRequestItem.cpp.

                                    {
  while(!(subjects.empty())){
    Subject sub = subjects.back();
    while(!(sub.empty())){
      delete sub.back();
      sub.pop_back();
    }
    subjects.pop_back();
  }
}

Here is the caller graph for this function:

void ArcRequestItem::setActions ( const ActList actions) [virtual]

Implements ArcSec::RequestItem.

Definition at line 257 of file ArcRequestItem.cpp.

                                                 {
  removeActions();
  actions = al;
}

Here is the call graph for this function:

void ArcRequestItem::setContexts ( const CtxList ctx) [virtual]

Implements ArcSec::RequestItem.

Definition at line 266 of file ArcRequestItem.cpp.

                                                   {
  removeContexts();
  contexts = ctx;
}

Here is the call graph for this function:

void ArcRequestItem::setResources ( const ResList rl) [virtual]

Implements ArcSec::RequestItem.

Definition at line 248 of file ArcRequestItem.cpp.

                                                   {
  removeResources();
  resources = rl;
}

Here is the call graph for this function:

void ArcRequestItem::setSubjects ( const SubList sl) [virtual]

Implements ArcSec::RequestItem.

Definition at line 239 of file ArcRequestItem.cpp.

                                                  {
  removeSubjects();
  subjects = sl;
}

Here is the call graph for this function:


Member Data Documentation

ResList ArcSec::RequestItem::actions [protected, inherited]

Definition at line 113 of file RequestItem.h.

CtxList ArcSec::RequestItem::contexts [protected, inherited]

Definition at line 115 of file RequestItem.h.

ActList ArcSec::RequestItem::resources [protected, inherited]

Definition at line 114 of file RequestItem.h.

SubList ArcSec::RequestItem::subjects [protected, inherited]

Definition at line 109 of file RequestItem.h.


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