Back to index

nordugrid-arc-nox  1.1.0~rc6
faults.cpp
Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #include <config.h>
00003 #endif
00004 
00005 #include "arex.h"
00006 #include "tools.h"
00007 
00008   /*
00009   NotAuthorizedFault
00010 
00011   NotAcceptingNewActivitiesFault
00012 
00013   UnsupportedFeatureFault
00014     Feature (string, unbounded)
00015 
00016   CantApplyOperationToCurrentStateFault
00017     ActivityStatus (ActivityStatusType)
00018     Message (xsd:string)
00019 
00020   OperationWillBeAppliedEventuallyFault
00021     ActivityStatus (ActivityStatusType)
00022     Message (xsd:string)
00023 
00024   UnknownActivityIdentifierFault
00025     Message (string)
00026 
00027   InvalidRequestMessageFaultType
00028     InvalidElement (string,unbounded)
00029     Message (string)
00030 
00031   */
00032 
00033 namespace ARex {
00034 
00035 static const std::string BES_FACTORY_FAULT_URL("http://schemas.ggf.org/bes/2006/08/bes-factory/BESFactoryPortType/Fault");
00036 
00037 static void SetFaultResponse(Arc::SOAPFault& fault) {
00038   // Fetch top element of SOAP message - should be better way
00039   Arc::XMLNode fault_node = fault;
00040   Arc::SOAPEnvelope res(fault_node.Parent().Parent()); // Fault->Body->Envelope
00041   Arc::WSAHeader(res).Action(BES_FACTORY_FAULT_URL);
00042 }
00043 
00044 void ARexService::GenericFault(Arc::SOAPFault& fault) {
00045   Arc::XMLNode fault_node = fault;
00046   Arc::SOAPEnvelope res(fault_node.Parent().Parent()); // Fault->Body->Envelope
00047   Arc::WSAHeader(res).Action("");
00048 }
00049 
00050 void ARexService::NotAuthorizedFault(Arc::XMLNode fault) {
00051   fault.Name("bes-factory:NotAuthorizedFault");
00052 }
00053 
00054 void ARexService::NotAuthorizedFault(Arc::SOAPFault& fault) {
00055   NotAuthorizedFault(fault.Detail(true).NewChild("dummy"));
00056   SetFaultResponse(fault);
00057 }
00058 
00059 void ARexService::NotAcceptingNewActivitiesFault(Arc::XMLNode fault) {
00060   fault.Name("bes-factory:NotAcceptingNewActivitiesFault");
00061   return;
00062 }
00063 
00064 void ARexService::NotAcceptingNewActivitiesFault(Arc::SOAPFault& fault) {
00065   NotAcceptingNewActivitiesFault(fault.Detail(true).NewChild("dummy"));
00066   SetFaultResponse(fault);
00067 }
00068 
00069 void ARexService::UnsupportedFeatureFault(Arc::XMLNode fault,const std::string& feature) {
00070   fault.Name("bes-factory:UnsupportedFeatureFault");
00071   if(!feature.empty()) fault.NewChild("bes-factory:Feature")=feature;
00072   return;
00073 }
00074 
00075 void ARexService::UnsupportedFeatureFault(Arc::SOAPFault& fault,const std::string& feature) {
00076   UnsupportedFeatureFault(fault.Detail(true).NewChild("dummy"),feature);
00077   SetFaultResponse(fault);
00078 }
00079 
00080 void ARexService::CantApplyOperationToCurrentStateFault(Arc::XMLNode fault,const std::string& gm_state,bool failed,const std::string& message) {
00081   fault.Name("bes-factory:CantApplyOperationToCurrentStateFault");
00082   addActivityStatus(fault,gm_state,"",failed);
00083   fault.NewChild("bes-factory:Message")=message;
00084   return;
00085 }
00086 
00087 void ARexService::CantApplyOperationToCurrentStateFault(Arc::SOAPFault& fault,const std::string& gm_state,bool failed,const std::string& message) {
00088   CantApplyOperationToCurrentStateFault(fault.Detail(true).NewChild("dummy"),gm_state,failed,message);
00089   SetFaultResponse(fault);
00090 }
00091 
00092 void ARexService::OperationWillBeAppliedEventuallyFault(Arc::XMLNode fault,const std::string& gm_state,bool failed,const std::string& message) {
00093   fault.Name("bes-factory:OperationWillBeAppliedEventuallyFault");
00094   addActivityStatus(fault,gm_state,"",failed);
00095   fault.NewChild("bes-factory:Message")=message;
00096   return;
00097 }
00098 
00099 void ARexService::OperationWillBeAppliedEventuallyFault(Arc::SOAPFault& fault,const std::string& gm_state,bool failed,const std::string& message) {
00100   OperationWillBeAppliedEventuallyFault(fault.Detail(true).NewChild("dummy"),gm_state,failed,message);
00101   SetFaultResponse(fault);
00102 }
00103 
00104 void ARexService::UnknownActivityIdentifierFault(Arc::XMLNode fault,const std::string& message) {
00105   fault.Name("bes-factory:UnknownActivityIdentifierFault");
00106   fault.NewChild("bes-factory:Message")=message;
00107   return;
00108 }
00109 
00110 void ARexService::UnknownActivityIdentifierFault(Arc::SOAPFault& fault,const std::string& message) {
00111   UnknownActivityIdentifierFault(fault.Detail(true).NewChild("dummy"),message);
00112   SetFaultResponse(fault);
00113 }
00114 
00115 void ARexService::InvalidRequestMessageFault(Arc::XMLNode fault,const std::string& element,const std::string& message) {
00116   fault.Name("bes-factory:InvalidRequestMessageFaultType");
00117   if(!element.empty()) fault.NewChild("bes-factory:InvalidElement")=element;
00118   fault.NewChild("bes-factory:Message")=message;
00119   return;
00120 }
00121 
00122 void ARexService::InvalidRequestMessageFault(Arc::SOAPFault& fault,const std::string& element,const std::string& message) {
00123   InvalidRequestMessageFault(fault.Detail(true).NewChild("dummy"),element,message);
00124   SetFaultResponse(fault);
00125 }
00126 
00127 
00128 }
00129