axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject cvs commit: ws-axis/c/src/wsdd Makefile.am WSDDDeployment.cpp WSDDDocument.cpp
Date Tue, 02 Dec 2003 11:38:50 GMT
damitha     2003/12/02 03:38:50

  Modified:    c/src/wsdd Tag: CWrapperSupport Makefile.am
                        WSDDDeployment.cpp WSDDDocument.cpp
  Log:
  made necessary changes to adapt the code for expat parser(using arabica sax wrapper)
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.4.4.1   +2 -2      ws-axis/c/src/wsdd/Makefile.am
  
  Index: Makefile.am
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdd/Makefile.am,v
  retrieving revision 1.4
  retrieving revision 1.4.4.1
  diff -u -r1.4 -r1.4.4.1
  --- Makefile.am	12 Sep 2003 09:29:21 -0000	1.4
  +++ Makefile.am	2 Dec 2003 11:38:50 -0000	1.4.4.1
  @@ -1,5 +1,5 @@
   noinst_LTLIBRARIES = libwsdd.la
  -AM_CPPFLAGS = -Wshadow -Wall -pedantic -ansi
  +AM_CPPFLAGS = -Wall
   libwsdd_la_SOURCES = WSDDDeployment.cpp \
                   WSDDHandler.cpp \
                   WSDDService.cpp \
  @@ -7,5 +7,5 @@
                   WSDDDocument.cpp \
   		WSDDKeywords.cpp
   
  -libwsdd_la_LIBADD = -L$(AXISCPP_HOME)/lib/xerces-c -lxerces-c
  +libwsdd_la_LIBADD = -L$(AXISCPP_HOME)/lib/arabica -lArabica
   INCLUDES = -I$(AXISCPP_HOME)/include
  
  
  
  1.18.4.2  +5 -2      ws-axis/c/src/wsdd/WSDDDeployment.cpp
  
  Index: WSDDDeployment.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdd/WSDDDeployment.cpp,v
  retrieving revision 1.18.4.1
  retrieving revision 1.18.4.2
  diff -u -r1.18.4.1 -r1.18.4.2
  --- WSDDDeployment.cpp	21 Nov 2003 12:48:12 -0000	1.18.4.1
  +++ WSDDDeployment.cpp	2 Dec 2003 11:38:50 -0000	1.18.4.2
  @@ -144,8 +144,11 @@
   int WSDDDeployment::LoadWSDD(const AxisChar* sWSDD)
   {
   	m_sWSDDPath = string(sWSDD);
  -	WSDDDocument doc;
  -	if (AXIS_SUCCESS != doc.GetDeployment(sWSDD, this))
  +
  +	WSDDDocument* doc = new WSDDDocument();
  +	if (SUCCESS != doc->GetDeployment(sWSDD, this))
  +
  +
   	{
   		return AXIS_FAIL;
   	}
  
  
  
  1.23.4.2  +103 -58   ws-axis/c/src/wsdd/WSDDDocument.cpp
  
  Index: WSDDDocument.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdd/WSDDDocument.cpp,v
  retrieving revision 1.23.4.1
  retrieving revision 1.23.4.2
  diff -u -r1.23.4.1 -r1.23.4.2
  --- WSDDDocument.cpp	21 Nov 2003 12:48:12 -0000	1.23.4.1
  +++ WSDDDocument.cpp	2 Dec 2003 11:38:50 -0000	1.23.4.2
  @@ -67,6 +67,9 @@
   #include <string>
   #include <axis/common/AxisTrace.h>
   
  +
  +#define __XTRC(x) x
  +
   WSDDDocument::WSDDDocument()
   {
   	m_lev0 = WSDD_UNKNOWN;
  @@ -97,13 +100,52 @@
   //	AXISTRACE1("inside ParseDocument\n");
   	try
   	{
  -		SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
  -		parser->setContentHandler(this);
  -		parser->setErrorHandler(this);     
  +		//SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
  +        
  +        SAX::XMLReader<std::string> parser;
  +        SAX::FeatureNames<std::string> fNames;
  +        SAX::PropertyNames<std::string> pNames;
  +        try
  +        {
  +            parser.setFeature(fNames.external_general, true);
  +            parser.setFeature(fNames.validation, true);
  +            parser.setFeature(fNames.namespaces, true);
  +            parser.setFeature(fNames.namespace_prefixes, true);
  +    	}
  +      	catch(SAX::SAXException& e)
  +        {
  +            std::cerr << e.what() << std::endl;
  +    	}
  +
  +    	parser.setContentHandler(*this);
  +    	parser.setDTDHandler(*this);
  +    	parser.setErrorHandler(*this);
  +    	parser.setEntityResolver(*this);
  +
  +    	try
  +        {
  +            parser.setProperty(pNames.declHandler, static_cast<SAX::DeclHandler&>(*this));
  +            parser.setProperty(pNames.lexicalHandler, static_cast<SAX::LexicalHandler&>(*this));
  +        }
  +    	catch(SAX::SAXException& e)
  +        {
  +            std::cout << e.what() << std::endl;
  +        } // catch
  +
  +        string strDocPath(sWSDD);
  +        SAX::InputSource Input(strDocPath);
  +        parser.parse(Input);
  +        
  +
  +        
  +		//parser->setContentHandler(this);
  +		//parser->setErrorHandler(this);     
   		//AXISTRACE1("BEFORE parser->parse(sWSDD);");
  -		parser->parse(sWSDD);   
  -		delete parser;
  -		if (m_bFatalError || m_bError) return AXIS_FAIL;
  +
  +		//parser->parse(sWSDD);
  +   
  +		//delete parser;
  +
   	}
   	catch (...)
   	{
  @@ -112,11 +154,11 @@
   	return AXIS_SUCCESS;
   }
   
  -void  WSDDDocument::endElement (const XMLCh *const uri, const XMLCh *const localname, const
XMLCh *const qname)
  +void  WSDDDocument::endElement (const std::string& uri, const std::string& localname,
const std::string& qname)
   {
   	AxisXMLString sLname = __XTRC(localname);
   	const AxisXMLCh* lname = sLname.c_str();
  -	if (!XMLString::equals(lname, kw_param)) //just neglect endElement of parameter
  +	if (0 != strcmp(lname, kw_param)) //just neglect endElement of parameter
   	{
   		if (m_lev1 == WSDD_UNKNOWN) //not inside a requestFlow or responseFlow elements
   		{
  @@ -129,7 +171,7 @@
   				m_lev0 = WSDD_DEPLOYMENT;
   				break;
   			case WSDD_SERVICE:
  -				if (XMLString::equals(lname, kw_srv))
  +				if (0 == strcmp(lname, kw_srv))
   				{
   					//add service object to Deployment object
   					m_pDeployment->AddService(m_pService);
  @@ -158,7 +200,7 @@
   		}
   		else // inside a requestFlow or responseFlow elements
   		{
  -			if(XMLString::equals(lname, kw_hdl))
  +			if(0 == strcmp(lname, kw_hdl))
   			{
   				m_lev2 = WSDD_UNKNOWN;
   				//add handler in m_pHandler to the corresponding container.
  @@ -185,11 +227,11 @@
   					default: ; //this cannot happen ?? 
   				}
   			}
  -			else if(XMLString::equals(lname, kw_rqf))
  +			else if(0 == strcmp(lname, kw_rqf))
   			{  
   				m_lev1 = WSDD_UNKNOWN;
   			}
  -			else if(XMLString::equals(lname, kw_rsf))
  +			else if(0 == strcmp(lname, kw_rsf))
   			{  
   				m_lev1 = WSDD_UNKNOWN;
   			}						
  @@ -197,7 +239,7 @@
   	}
   }
   
  -void WSDDDocument::ProcessAttributes(WSDDLevels ElementType, const Attributes &attrs)
  +void WSDDDocument::ProcessAttributes(WSDDLevels ElementType, const AttributesT &attrs)
   {
   	AxisXMLString sLocal;
   	AxisXMLString sValue;
  @@ -212,15 +254,15 @@
   		switch(ElementType)
   		{
   		case WSDD_SERVICE: //add this attribute to current service object
  -			if (XMLString::equals(local, kw_name))
  +			if (0 == strcmp(local, kw_name))
   			{
   				m_pService->SetServiceName(value);
   			}
  -			else if (XMLString::equals(local, kw_prv))
  +			else if (0 == strcmp(local, kw_prv))
   			{
   				m_pService->SetProvider(value);
   			}
  -			else if (XMLString::equals(local, kw_desc))
  +			else if (0 == strcmp(local, kw_desc))
   			{
   				m_pService->SetDescription(value);
   			}
  @@ -230,11 +272,11 @@
   			}
   			break;
   		case WSDD_HANDLER: //add this attribute to current handler object
  -			if (XMLString::equals(local, kw_name))
  +			if (0 == strcmp(local, kw_name))
   			{
   				//usefull ? ignore for now .. //TODO
   			}
  -			else if (XMLString::equals(local, kw_type))
  +			else if (0 == strcmp(local, kw_type))
   			{
   				//we get the libname for the hanlder here ???
   				m_pHandler->SetLibName(value);
  @@ -248,7 +290,7 @@
   					m_pHandler->SetLibId((*m_pLibNameIdMap)[value]);
   				}
   			}
  -			else if (XMLString::equals(local, kw_desc))
  +			else if (0 == strcmp(local, kw_desc))
   			{
   				m_pHandler->SetDescription(value);
   			}
  @@ -259,7 +301,7 @@
   			break;
   		case WSDD_REQFLOW:
   		case WSDD_RESFLOW:
  -			if (XMLString::equals(local, kw_name))
  +			if (0 == strcmp(local, kw_name))
   			{
   				//usefull ? ignore for now .. //TODO
   			}
  @@ -269,12 +311,12 @@
   			}
   			break;
   		case WSDD_TRANSPORT:
  -			if (XMLString::equals(local, kw_name))
  +			if (0 == strcmp(local, kw_name))
   			{
   				//get tranport type
  -				if (XMLString::equals(value, kw_http))
  +				if (0 == strcmp(value, kw_http))
   					m_CurTrType = APTHTTP;
  -				else if (XMLString::equals(value, kw_smtp))
  +				else if (0 == strcmp(value, kw_smtp))
   					m_CurTrType = APTSMTP;
   				else
   				{
  @@ -291,7 +333,7 @@
   	}
   }
   
  -void WSDDDocument::GetParameters(WSDDLevels ElementType, const Attributes &attrs)
  +void WSDDDocument::GetParameters(WSDDLevels ElementType, const AttributesT &attrs)
   {
   	AxisXMLString sName, sValue, sType;
   	const AxisXMLCh *name, *value, *type;
  @@ -301,15 +343,15 @@
   	{
   		Localname = __XTRC(attrs.getLocalName(i));
   		Value = __XTRC(attrs.getValue(i));
  -		if (XMLString::equals(Localname.c_str(), kw_name))
  +		if (0 == strcmp(Localname.c_str(), kw_name))
   		{
   			sName = Value.c_str();
   		}
  -		else if (XMLString::equals(Localname.c_str(), kw_value))
  +		else if (0 == strcmp(Localname.c_str(), kw_value))
   		{
   			sValue = Value.c_str();
   		}
  -		else if (XMLString::equals(Localname.c_str(), kw_type))
  +		else if (0 == strcmp(Localname.c_str(), kw_type))
   		{
   			sType = Value.c_str();
   		}
  @@ -325,11 +367,11 @@
   		//TODO
   		break;
   	case WSDD_SERVICE:
  -		if (XMLString::equals(name, kw_am))
  +		if (0 == strcmp(name, kw_am))
   		{
   			AddAllowedMethodsToService(value);
   		}
  -		else if(XMLString::equals(name, kw_cn))
  +		else if(0 == strcmp(name, kw_cn))
   		{
   			m_pService->SetLibName(value);
   			if (m_pLibNameIdMap->find(value) != m_pLibNameIdMap->end()) //libray name already
in the map
  @@ -342,11 +384,11 @@
   				m_pService->SetLibId((*m_pLibNameIdMap)[value]);
   			}
   		}
  -		else if (XMLString::equals(name, kw_scope))
  +		else if (0 == strcmp(name, kw_scope))
   		{
   			m_pService->SetScope(value);
   		}
  -		else if (XMLString::equals(name, kw_ar))
  +		else if (0 == strcmp(name, kw_ar))
   		{
   			AddAllowedRolesToService(value);
   		}
  @@ -356,7 +398,7 @@
   		}
   		break;
   	case WSDD_HANDLER:
  -		if (XMLString::equals(name, kw_scope))
  +		if (0 == strcmp(name, kw_scope))
   		{
   			m_pHandler->SetScope(value);
   		}
  @@ -402,7 +444,8 @@
   	}
   }
   
  -void WSDDDocument::startElement(const XMLCh *const uri,	const XMLCh *const localname, const
XMLCh *const qname,	const Attributes &attrs)
  +
  +void WSDDDocument::startElement(const std::string& uri,	const std::string& localname,
const std::string& qname,	const AttributesT &attrs)
   {
   	AxisXMLString sLname = __XTRC(localname);
   	const AxisXMLCh* lname = sLname.c_str();
  @@ -412,38 +455,38 @@
   		switch(m_lev0)
   		{
   		case WSDD_UNKNOWN:
  -			if(XMLString::equals(lname, kw_depl))
  +			if(0 == strcmp(lname, kw_depl))
   			{  
   				m_lev0 = WSDD_DEPLOYMENT;
   				m_pDeployment->SetDeploymentType(DT_DEPLOYMENT);
   			}
  -			else if(XMLString::equals(lname, kw_undepl))
  +			else if(0 == strcmp(lname, kw_undepl))
   			{  
   				m_lev0 = WSDD_DEPLOYMENT;
   				m_pDeployment->SetDeploymentType(DT_UNDEPLOYMENT);
   			}
   			break;
   		case WSDD_DEPLOYMENT:
  -			if(XMLString::equals(lname, kw_glconf))
  +			if(0 == strcmp(lname, kw_glconf))
   			{  
   				m_lev0 = WSDD_GLOBCONF;
   				//nothing to get
   			}
  -			else if(XMLString::equals(lname, kw_srv))
  +			else if(0 == strcmp(lname, kw_srv))
   			{  
   				m_lev0 = WSDD_SERVICE;
   				m_pService = new WSDDService();
   				//get service name and proider if any
   				ProcessAttributes(WSDD_SERVICE, attrs);
   			}
  -			else if(XMLString::equals(lname, kw_hdl))
  +			else if(0 == strcmp(lname, kw_hdl))
   			{  
   				m_lev0 = WSDD_HANDLER;
   				m_pHandler = new WSDDHandler();
   				ProcessAttributes(WSDD_HANDLER, attrs);
   				//get handler name and type if any
   			}
  -			else if(XMLString::equals(lname, kw_tr))
  +			else if(0 == strcmp(lname, kw_tr))
   			{  
   				m_lev0 = WSDD_TRANSPORT;
   				ProcessAttributes(WSDD_TRANSPORT, attrs);
  @@ -454,16 +497,16 @@
   			}
   			break;
   		case WSDD_GLOBCONF:
  -			if(XMLString::equals(lname, kw_param))
  +			if(0 == strcmp(lname, kw_param))
   			{  
   				GetParameters(WSDD_GLOBCONF, attrs);
   			}
  -			else if(XMLString::equals(lname, kw_rqf))
  +			else if(0 == strcmp(lname, kw_rqf))
   			{  
   				m_lev1 = WSDD_REQFLOW;
   				ProcessAttributes(WSDD_REQFLOW, attrs);
   			}
  -			else if(XMLString::equals(lname, kw_rsf))
  +			else if(0 == strcmp(lname, kw_rsf))
   			{  
   				m_lev1 = WSDD_RESFLOW;
   				ProcessAttributes(WSDD_RESFLOW, attrs);
  @@ -474,16 +517,16 @@
   			}
   		break; 
   		case WSDD_SERVICE:
  -			if(XMLString::equals(lname, kw_param))
  +			if(0 == strcmp(lname, kw_param))
   			{  
   				GetParameters(WSDD_SERVICE, attrs);
   			}
  -			else if(XMLString::equals(lname, kw_rqf))
  +			else if(0 == strcmp(lname, kw_rqf))
   			{  
   				m_lev1 = WSDD_REQFLOW;
   				ProcessAttributes(WSDD_REQFLOW, attrs);
   			}
  -			else if(XMLString::equals(lname, kw_rsf))
  +			else if(0 == strcmp(lname, kw_rsf))
   			{  
   				m_lev1 = WSDD_RESFLOW;
   				ProcessAttributes(WSDD_RESFLOW, attrs);
  @@ -494,19 +537,19 @@
   			}
   		break;
   		case WSDD_HANDLER:
  -			if(XMLString::equals(lname, kw_param))
  +			if(0 == strcmp(lname, kw_param))
   			{  
   				GetParameters(WSDD_HANDLER, attrs);
   			}
   
   		break;
   		case WSDD_TRANSPORT:
  -			if(XMLString::equals(lname, kw_rqf))
  +			if(0 == strcmp(lname, kw_rqf))
   			{  
   				m_lev1 = WSDD_REQFLOW;
   				ProcessAttributes(WSDD_REQFLOW, attrs);
   			}
  -			else if(XMLString::equals(lname, kw_rsf))
  +			else if(0 == strcmp(lname, kw_rsf))
   			{  
   				m_lev1 = WSDD_RESFLOW;
   				ProcessAttributes(WSDD_RESFLOW, attrs);
  @@ -517,19 +560,19 @@
   	}
   	else // inside a requestFlow or responseFlow elements
   	{
  -		if(XMLString::equals(lname, kw_param))
  +		if(0 == strcmp(lname, kw_param))
   		{  
   			GetParameters(m_lev2, attrs); //must be parameters of a handler or a chain
   		}
   
  -		else if(XMLString::equals(lname, kw_hdl))
  +		else if(0 == strcmp(lname, kw_hdl))
   		{  
   			m_lev2 = WSDD_HANDLER;
   			m_pHandler = new WSDDHandler();
   			ProcessAttributes(WSDD_HANDLER, attrs);
   			//get handler name and type if any
   		}
  -		else if(XMLString::equals(lname, kw_chain))
  +		else if(0 == strcmp(lname, kw_chain))
   		{
   
   		}
  @@ -541,39 +584,41 @@
   	}
   }
   
  -void WSDDDocument::startPrefixMapping(const XMLCh* const prefix, const XMLCh* const uri)
  +void WSDDDocument::startPrefixMapping(const std::string& prefix, const std::string&
uri)
   {
   	m_NsStack[__XTRC(prefix)] = __XTRC(uri); //I think the same prifix cannot repeat ???
   }
   
  -void WSDDDocument::endPrefixMapping(const XMLCh* const prefix)
  +void WSDDDocument::endPrefixMapping(const std::string& prefix)
   {
   //	string sPrifix = prefix;
   	m_NsStack.erase(__XTRC(prefix)); //I think the same prifix cannot repeat ???
   }
   
  -void  WSDDDocument::characters (const XMLCh *const chars, const unsigned int length)
  +void  WSDDDocument::characters (const std::string& chars, const unsigned int length)
   {
   	//cout<<"==="<<XMLString::transcode(chars)<<"==="<<endl;
   }
   
  -const AxisChar* WSDDDocument::__XTRC(const XMLCh *pChar)
  +/*const AxisChar* WSDDDocument::__XTRC(const XMLCh *pChar)
   {
   	if (true == (XMLString::transcode(pChar, m_Buffer, TRANSCODE_BUFFER_SIZE-1)))
   		return m_Buffer;
   	else 
   		return ""; 
   }
  +*/
   
  -void WSDDDocument::warning(const SAXParseException& exception)
  +void WSDDDocument::warning(const SAX::SAXParseException& exception)
   {
   }
  -void WSDDDocument::error(const SAXParseException& exception)
  +void WSDDDocument::error(const SAX::SAXParseException& exception)
   {
   	m_bError = true;
   }
  -void WSDDDocument::fatalError(const SAXParseException& exception)
  +void WSDDDocument::fatalError(const SAX::SAXParseException& exception)
   {
   	m_bFatalError = true;
   }
  +
   
  
  
  

Mime
View raw message