You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2003/07/02 06:54:23 UTC

cvs commit: xml-axis/c/src/engine AxisEngine.cpp Axis.cpp HandlerChain.h HandlerChain.cpp HandlerPool.cpp HandlerLoader.cpp

damitha     2003/07/01 21:54:23

  Modified:    c/src/engine AxisEngine.cpp Axis.cpp HandlerChain.h
                        HandlerChain.cpp HandlerPool.cpp HandlerLoader.cpp
  Log:
  in AxisEngine.cpp I made changes in HandlerPool::LoadHandlerChain(WSDDHandlerList *pHandlerList)
  method.
  In HandlerChain.h I make changes in
  private:
    list<Handler*> m_HandlerList;
    list<Handler*>::iterator m_itCurrHandler;
  Initially it was BasicHandler, not Handler
  
  also in
  int AddHandler(Handler* pHandler);
  Initially it was BasicHandler, not Handler
  
  In all these files I added
  #include "../common/Debug.h"
  
  So that DEBUG(X) OR DEBUG(X,Y) can be called
  
  Revision  Changes    Path
  1.2       +31 -65    xml-axis/c/src/engine/AxisEngine.cpp
  
  Index: AxisEngine.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/AxisEngine.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AxisEngine.cpp	25 Jun 2003 05:13:45 -0000	1.1
  +++ AxisEngine.cpp	2 Jul 2003 04:54:22 -0000	1.2
  @@ -72,8 +72,6 @@
   #include "../soap/URIMapping.h"
   #include "../common/Debug.h"
   
  -
  -DEBUG_INCLUDE;
   #ifdef WIN32
   #define WSDDFILEPATH "C:/Apache/Axis/server.wsdd"
   #else //For linux
  @@ -93,10 +91,6 @@
   	m_pHandlerPool = new HandlerPool();
   	m_pWebService = NULL;
     
  -
  -#if defined( DEBUG)
  -DEBUG_ONE_PARA_LEVEL("Created DeployedServiceInfo No problem ..........");
  -#endif
     //printf("Done WSDD\n");
   }
   
  @@ -116,9 +110,7 @@
   	{
   		try
   		{
  -#if defined( DEBUG)
  -DEBUG_ONE_PARA_LEVEL("GetAxisEngine********************");
  -#endif
  +      DEBUG1("AxisEngine::GetAxisEngine()");
   			XMLPlatformUtils::Initialize();
   			m_pObject = new AxisEngine();
   			if (!m_pObject) return NULL;
  @@ -140,6 +132,9 @@
   
   int AxisEngine::Process(soapstream* soap) 
   {
  +  
  +  DEBUG1("AxisEngine::Process");
  +  
   	MessageData* pMsg = NULL;
   	MemBufInputSource* pSoapInput = NULL;
   	WSDDHandlerList* pHandlerList = NULL;
  @@ -161,9 +156,9 @@
   
   		string service = "Maths";//getheader(soap, SOAPACTIONHEADER);
   
  -#if defined( DEBUG)         
  -DEBUG_TWO_PARA_LEVEL("service name is :",service.c_str())  
  -#endif    
  +    
  +      DEBUG2("string service = Maths :",service.c_str());
  +     
   		if (service.empty()) 
   		{
   			pMsg->m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_SOAPACTIONEMPTY));
  @@ -175,14 +170,8 @@
   			break; //do .. while(0)
   		}
   
  -#if defined( DEBUG)     
  -DEBUG_ONE_PARA_LEVEL("Before SetService***************");
  -#endif
       pMsg->SetService(pService);
  -
  -#if defined( DEBUG)     
  -DEBUG_ONE_PARA_LEVEL("After SetService***************");
  -#endif    
  +   
   		//Deserialize
   		//---------START XERCES SAX2 SPCIFIC CODE---------//
   		pSoapInput = new MemBufInputSource((const unsigned char*)soap->so.http.ip_soap, soap->so.http.ip_soapcount,"bufferid",false); 
  @@ -218,40 +207,25 @@
   		if (pSm) 
   		{
   			string method = pSm->getMethodName();
  -
  -#if defined( DEBUG)       
  -DEBUG_TWO_PARA_LEVEL("method name is :", method.c_str());     
  -#endif      
  +      
  +      DEBUG2("pSm->getMethodName(); :", method.c_str());
  +          
   			if (!method.empty())
  -			{
  -
  -#if defined( DEBUG)         
  -DEBUG_ONE_PARA_LEVEL("method is not empty");    
  -#endif        
  +			{        
   				//this is done here when we use SAX parser
   				//if we use XML pull parser this check is done within the invoke method of the wrapper class
   				if (pService->IsAllowedMethod(method))
  -				{
  -
  -#if defined( DEBUG)           
  -DEBUG_ONE_PARA_LEVEL("method is allowed*****************");         
  -#endif          
  +				{          
   					//load actual web service handler
  -
  -#if defined( DEBUG)           
  -DEBUG_ONE_PARA_LEVEL("before loading web service");          
  -#endif          
  +         
   					m_pWebService = m_pHandlerPool->LoadWebService(pService);
   
  -#if defined( DEBUG)           
  -DEBUG_ONE_PARA_LEVEL("web service is loaded**********************");          
  -#endif          
  +          #if defined( DEBUG)
  +            ("after m_pHandlerPool->LoadWebService(pService);");
  +          #endif         
   					if (!m_pWebService)
   					{
  -
  -#if defined( DEBUG)             
  -DEBUG_ONE_PARA_LEVEL("web service is empty*************************");         
  -#endif            
  +            
   						pMsg->m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_COULDNOTLOADSRV));
   						//Error couldnot load web service
   						break; //do .. while(0)
  @@ -272,36 +246,23 @@
   			}
   		}
   		//create any service specific handlers
  -
  -#if defined( DEBUG)     
  -DEBUG_ONE_PARA_LEVEL("before getting handlers*********************");     
  -#endif    
  +    
   		pHandlerList = pService->GetRequestFlowHandlers();
   
  -#if defined( DEBUG)     
  -DEBUG_ONE_PARA_LEVEL("after calling request handlers list***************");     
  -#endif    
  +    DEBUG1("after pService->GetRequestFlowHandlers();");
  +       
   		if (pHandlerList)
   		{
  -
  -#if defined( DEBUG)       
  -DEBUG_ONE_PARA_LEVEL("after getting request handlers list**************");       
  -#endif      
  +      
   			if(SUCCESS != m_pHandlerPool->LoadServiceRequestFlowHandlers(pHandlerList))
   			{        
   				pMsg->m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_COULDNOTLOADHDL));
   				break; //do .. while(0)
   			}
   		}
  -
  -#if defined( DEBUG)     
  -DEBUG_ONE_PARA_LEVEL("before getting response handlers****************");     
  -#endif    
  +    
   		pHandlerList = pService->GetResponseFlowHandlers();
  -
  -#if defined( DEBUG)     
  -DEBUG_ONE_PARA_LEVEL("after getting response handlers****************");     
  -#endif    
  +    
   		if (pHandlerList)
   		{
   			if(SUCCESS != m_pHandlerPool->LoadServiceResponseFlowHandlers(pHandlerList))
  @@ -380,7 +341,8 @@
   			{
   				pMsg->m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_HANDLERFAILED));
   				break; //do .. while (0)
  -			}		
  +			}
  +      DEBUG1("if(SUCCESS == pChain->Invoke(pMsg))");
   		}
   		level++; //AE_SERH
   		//call actual web service handler
  @@ -390,6 +352,7 @@
   				pMsg->m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_WEBSERVICEFAILED));
   				break;
   			}
  +         
   		level++; //AE_SERV
   	}
   	while(0);
  @@ -406,6 +369,7 @@
   		if (pChain)
   		{
   			pChain->Invoke(pMsg);
  +      
   		}
   		//no break;
   	case AE_GLH: //web service specific handlers have failed
  @@ -425,7 +389,7 @@
   		//no break;
   	case AE_START: ;//transport handlers have failed
   	};
  -
  +  DEBUG1("end axisengine process()");
   	return ret;
   }
   
  @@ -441,6 +405,8 @@
   	URIMapping::Initialize();
   	SoapFault::initialize();
     
  +  DEBUG1("AxisEngine::Initialize()");
  +      
   	if (SUCCESS != m_pWSDD->LoadWSDD(str)) return FAIL;
     
   	//Load Global Handlers to the pool if configured any
  
  
  
  1.2       +2 -0      xml-axis/c/src/engine/Axis.cpp
  
  Index: Axis.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/Axis.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Axis.cpp	25 Jun 2003 05:13:45 -0000	1.1
  +++ Axis.cpp	2 Jul 2003 04:54:22 -0000	1.2
  @@ -1,4 +1,5 @@
   #include "AxisEngine.h"
  +#include "../common/Debug.h"
   
   unsigned char chEBuf[1024];
   
  @@ -10,6 +11,7 @@
   	if (engine)
   	{
   		ret = engine->Process(str);
  +    DEBUG1("ret = engine->Process(str);");
   	}
   	//str->op_soap = chEBuf;
   	return ret;
  
  
  
  1.2       +4 -3      xml-axis/c/src/engine/HandlerChain.h
  
  Index: HandlerChain.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/HandlerChain.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HandlerChain.h	25 Jun 2003 05:13:45 -0000	1.1
  +++ HandlerChain.h	2 Jul 2003 04:54:23 -0000	1.2
  @@ -73,6 +73,7 @@
   #endif // _MSC_VER > 1000
   
   #include "../common/BasicHandler.h"
  +#include "../common/Handler.h"
   #include <list>
   
   using namespace std;
  @@ -80,7 +81,7 @@
   class HandlerChain : public BasicHandler  
   {
   public:
  -	int AddHandler(BasicHandler* pHandler);
  +	int AddHandler(Handler* pHandler);
   	HandlerChain();
   	virtual ~HandlerChain();
   
  @@ -88,8 +89,8 @@
   	void OnFault(MessageData* pMsg);
   
   private:
  -	list<BasicHandler*> m_HandlerList;
  -	list<BasicHandler*>::iterator m_itCurrHandler;
  +	list<Handler*> m_HandlerList;
  +  list<Handler*>::iterator m_itCurrHandler;
   };
   
   #endif // !defined(AFX_HANDLERCHAIN_H__675E51BF_2FD7_4860_B3DE_F8B5A978EB99__INCLUDED_)
  
  
  
  1.2       +6 -1      xml-axis/c/src/engine/HandlerChain.cpp
  
  Index: HandlerChain.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/HandlerChain.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HandlerChain.cpp	25 Jun 2003 05:13:45 -0000	1.1
  +++ HandlerChain.cpp	2 Jul 2003 04:54:23 -0000	1.2
  @@ -66,6 +66,7 @@
   //////////////////////////////////////////////////////////////////////
   
   #include "HandlerChain.h"
  +#include "../common/Debug.h"
   
   //////////////////////////////////////////////////////////////////////
   // Construction/Destruction
  @@ -83,12 +84,16 @@
   
   int HandlerChain::Invoke(MessageData* pMsg)
   {
  +  
  +  DEBUG1("HandlerChain::Invoke(MessageData* pMsg)");
  +  
   	m_itCurrHandler = m_HandlerList.begin();
   	while (m_itCurrHandler != m_HandlerList.end())
   	{
   		if (SUCCESS == (*m_itCurrHandler)->Invoke(pMsg))
   		{
   			m_itCurrHandler++;
  +      DEBUG1("if (SUCCESS == (*m_itCurrHandler)->Invoke(pMsg))");
   		}
   		else
   		{
  @@ -108,7 +113,7 @@
   	}
   }
   
  -int HandlerChain::AddHandler(BasicHandler *pHandler)
  +int HandlerChain::AddHandler(Handler *pHandler)
   {
   	m_HandlerList.push_back(pHandler);
   
  
  
  
  1.2       +14 -16    xml-axis/c/src/engine/HandlerPool.cpp
  
  Index: HandlerPool.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/HandlerPool.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HandlerPool.cpp	25 Jun 2003 05:13:45 -0000	1.1
  +++ HandlerPool.cpp	2 Jul 2003 04:54:23 -0000	1.2
  @@ -72,8 +72,6 @@
   //////////////////////////////////////////////////////////////////////
   #include "../common/Debug.h"
   
  -DEBUG_INCLUDE
  -
   HandlerPool::HandlerPool()
   {
   	m_pGReqFChain = NULL;
  @@ -128,22 +126,12 @@
   	LoadedHandler* pLh = NULL;
   	if (pHandlerInfo) 
   	{
  -
  -#if defined( DEBUG)     
  -DEBUG_ONE_PARA_LEVEL("before loaded handler*********************");
  -#endif
       
   		pLh = new LoadedHandler(pHandlerInfo->GetLibName(), RTLD_LAZY);
   
  -#if defined( DEBUG)     
  -DEBUG_ONE_PARA_LEVEL("after loaded handler**********************");
  -#endif
   		if (SUCCESS == pLh->m_DL->Initialize())
   		{
   
  -#if defined( DEBUG)       
  -DEBUG_ONE_PARA_LEVEL("loaded handler initialized******************");
  -#endif
   			BasicHandler* pBh = pLh->m_DL->GetHandler();
         //BasicHandler* pBh = NULL;
   			if (pBh) 
  @@ -290,14 +278,24 @@
   	HandlerChain* pHc = NULL;
   	if (pHandlerList && !pHandlerList->empty()) {
   		pHc = new HandlerChain();
  -		BasicHandler* pBh = NULL;;
  +		//BasicHandler* pBh = NULL;;
  +    Handler* pH = NULL;
   		for (WSDDHandlerList::iterator it=pHandlerList->begin();
   		it != pHandlerList->end(); it++)
   		{
  -			if ((pBh = LoadHandler(*it)) != NULL)
  +			//if ((pBh = LoadHandler(*it)) != NULL)
  +      BasicHandler *pBh = LoadHandler(*it);
  +      if (pBh)
   			{
  -				nLoaded++;
  -				pHc->AddHandler(pBh);
  +        pH = dynamic_cast<Handler*>(pBh);
  +        if (pH)
  +			  {
  +          
  +          DEBUG1("if (pH)");
  +          pH->SetOptionList((*it)->GetOptionList());
  +				  nLoaded++;
  +				  pHc->AddHandler(pH);
  +        }
   			}
   		}
   		if (0!=nLoaded) 
  
  
  
  1.2       +10 -21    xml-axis/c/src/engine/HandlerLoader.cpp
  
  Index: HandlerLoader.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/engine/HandlerLoader.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HandlerLoader.cpp	25 Jun 2003 05:13:45 -0000	1.1
  +++ HandlerLoader.cpp	2 Jul 2003 04:54:23 -0000	1.2
  @@ -64,8 +64,6 @@
   #include "HandlerLoader.h"
   #include <stdio.h>
   #include "../common/Debug.h"
  - 
  -DEBUG_INCLUDE
   
   HandlerLoader::HandlerLoader(string &sFile, int nOptions)
   {
  @@ -86,16 +84,11 @@
   int HandlerLoader::Initialize()
   {
   	if (0 == m_Handler)
  -	{
  -#if defined( DEBUG)    
  -DEBUG_ONE_PARA_LEVEL("before LoadLib**************");
  -#endif     
  -    
  +	{    
  +    DEBUG1("if (0 == m_Handler):HandlerLoader::Initialize()");
  +            
   		if (LoadLib())
  -		{
  -#if defined( DEBUG)        
  -DEBUG_ONE_PARA_LEVEL("after LoadLib******************");       
  -#endif      
  +		{      
   			printf("LoadLib success\n");
   			m_Create = GetCreate();
   			m_Delete = GetDelete();
  @@ -138,21 +131,17 @@
   
   int HandlerLoader::LoadLib()
   {
  -#if defined( DEBUG)
  -DEBUG_TWO_PARA_LEVEL("in LoadLib Lib is :", m_sLib.c_str());
  -#endif   
  -	
  +  
  +  DEBUG2("in HandlerLoader::LoadLib(), Lib is :", m_sLib.c_str());
  +   	
   #ifdef WIN32
   	m_Handler = LoadLibrary(m_sLib.c_str());
   #else //Linux
  -#if defined( DEBUG)  
  -DEBUG_TWO_PARA_LEVEL("dlopen not success :", m_sLib.c_str());
  -#endif
     
   	m_Handler = dlopen(m_sLib.c_str(), m_nLoadOptions);
  -#if defined( DEBUG)    
  -DEBUG_ONE_PARA_LEVEL("after dlopen******************");
  -#endif   
  +  
  +  DEBUG1("after m_Handler = dlopen(m_sLib.c_str(), m_nLoadOptions);");
  +   
     
         	if (!m_Handler)
   	{