You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by bl...@apache.org on 2004/09/21 14:33:52 UTC

cvs commit: xml-security/c/src/xkms/impl XKMSCompoundRequestImpl.cpp XKMSCompoundRequestImpl.hpp XKMSCompoundResultImpl.cpp XKMSCompoundResultImpl.hpp XKMSMessageFactoryImpl.cpp XKMSMessageFactoryImpl.hpp XKMSResultTypeImpl.cpp

blautenb    2004/09/21 05:33:52

  Modified:    c/Projects/VC6.0/xsec/xsec_lib xsec_lib.dsp
               c/src/framework XSECW32Config.hpp
               c/src/tools/xklient xklient.cpp
               c/src/xkms XKMSConstants.cpp XKMSConstants.hpp
                        XKMSMessageAbstractType.hpp XKMSMessageFactory.hpp
               c/src/xkms/impl XKMSMessageFactoryImpl.cpp
                        XKMSMessageFactoryImpl.hpp XKMSResultTypeImpl.cpp
  Added:       c/src/xkms XKMSCompoundRequest.hpp XKMSCompoundResult.hpp
               c/src/xkms/impl XKMSCompoundRequestImpl.cpp
                        XKMSCompoundRequestImpl.hpp
                        XKMSCompoundResultImpl.cpp
                        XKMSCompoundResultImpl.hpp
  Log:
  Implement CompoundRequest and CompoundResult messages
  
  Revision  Changes    Path
  1.36      +32 -8     xml-security/c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp
  
  Index: xsec_lib.dsp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- xsec_lib.dsp	6 Aug 2004 11:41:12 -0000	1.35
  +++ xsec_lib.dsp	21 Sep 2004 12:33:52 -0000	1.36
  @@ -1080,6 +1080,22 @@
   # PROP Default_Filter ""
   # Begin Source File
   
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSCompoundRequestImpl.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSCompoundRequestImpl.hpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSCompoundResultImpl.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSCompoundResultImpl.hpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\..\..\..\src\xkms\impl\XKMSKeyBindingAbstractTypeImpl.cpp
   # End Source File
   # Begin Source File
  @@ -1152,6 +1168,14 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSResponseMechanismImpl.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\impl\XKMSResponseMechanismImpl.hpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\..\..\..\src\xkms\impl\XKMSResultImpl.cpp
   # End Source File
   # Begin Source File
  @@ -1209,6 +1233,14 @@
   # End Group
   # Begin Source File
   
  +SOURCE=..\..\..\..\src\xkms\XKMSCompoundRequest.hpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xkms\XKMSCompoundResult.hpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\..\..\..\src\xkms\XKMSConstants.cpp
   # End Source File
   # Begin Source File
  @@ -1284,13 +1316,5 @@
   SOURCE=..\..\..\..\src\xkms\XKMSValidateResult.hpp
   # End Source File
   # End Group
  -# Begin Source File
  -
  -SOURCE=..\..\..\..\src\xkms\impl\XKMSResponseMechanismImpl.cpp
  -# End Source File
  -# Begin Source File
  -
  -SOURCE=..\..\..\..\src\xkms\impl\XKMSResponseMechanismImpl.hpp
  -# End Source File
   # End Target
   # End Project
  
  
  
  1.20      +10 -1     xml-security/c/src/framework/XSECW32Config.hpp
  
  Index: XSECW32Config.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/framework/XSECW32Config.hpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- XSECW32Config.hpp	14 Mar 2004 03:50:24 -0000	1.19
  +++ XSECW32Config.hpp	21 Sep 2004 12:33:52 -0000	1.20
  @@ -70,6 +70,15 @@
   
   /* #define XSEC_NO_XALAN */
   
  +#if !defined (XSEC_NO_XALAN)
  +
  +#	include <xalanc/Include/XalanVersion.hpp>
  +
  +#	if (_XALAN_VERSION_ <= 10800)
  +#		define XSEC_XSLEXCEPTION_RETURNS_DOMSTRING	1
  +#	endif
  +#endif
  +
   /*
    * Define presence of cryptographic providers
    */
  
  
  
  1.15      +192 -63   xml-security/c/src/tools/xklient/xklient.cpp
  
  Index: xklient.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/tools/xklient/xklient.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- xklient.cpp	7 Aug 2004 12:23:34 -0000	1.14
  +++ xklient.cpp	21 Sep 2004 12:33:52 -0000	1.15
  @@ -38,6 +38,8 @@
   #include <xsec/utils/XSECDOMUtils.hpp>
   #include <xsec/enc/XSECKeyInfoResolverDefault.hpp>
   
  +#include <xsec/xkms/XKMSCompoundRequest.hpp>
  +#include <xsec/xkms/XKMSCompoundResult.hpp>
   #include <xsec/xkms/XKMSMessageAbstractType.hpp>
   #include <xsec/xkms/XKMSLocateRequest.hpp>
   #include <xsec/xkms/XKMSLocateResult.hpp>
  @@ -370,7 +372,7 @@
   
   }
   
  -XKMSMessageAbstractType * createLocateRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int paramCount) {
  +XKMSMessageAbstractType * createLocateRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int &paramCount, XKMSCompoundRequest * cr = NULL) {
   
   	if (paramCount >= argc || 
   		(stricmp(argv[paramCount], "--help") == 0) ||
  @@ -383,10 +385,13 @@
   	/* First create the basic request */
   	XKMSMessageFactory * factory = 
   		prov.getXKMSMessageFactory();
  -	XKMSLocateRequest * lr = 
  -		factory->createLocateRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
  +	XKMSLocateRequest * lr; 
  +	if (cr == NULL)
  +		lr = factory->createLocateRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
  +	else
  +		lr = cr->createLocateRequest(MAKE_UNICODE_STRING(argv[paramCount++]));
   
  -	while (paramCount < argc) {
  +	while (paramCount < argc && stricmp(argv[paramCount], "--") != 0) {
   
   		if (stricmp(argv[paramCount], "--add-cert") == 0 || stricmp(argv[paramCount], "-a") == 0) {
   			if (++paramCount >= argc) {
  @@ -621,7 +626,7 @@
   
   }
   
  -XKMSMessageAbstractType * createValidateRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int paramCount) {
  +XKMSMessageAbstractType * createValidateRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int &paramCount, XKMSCompoundRequest * cr = NULL) {
   
   	if (paramCount >= argc || 
   		(stricmp(argv[paramCount], "--help") == 0) ||
  @@ -634,10 +639,14 @@
   	/* First create the basic request */
   	XKMSMessageFactory * factory = 
   		prov.getXKMSMessageFactory();
  -	XKMSValidateRequest * vr = 
  -		factory->createValidateRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
  +	XKMSValidateRequest * vr;
   
  -	while (paramCount < argc) {
  +	if (cr == NULL)
  +		vr = factory->createValidateRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
  +	else
  +		vr = cr->createValidateRequest(MAKE_UNICODE_STRING(argv[paramCount++]));
  +
  +	while (paramCount < argc && stricmp(argv[paramCount], "--") != 0) {
   
   		if (stricmp(argv[paramCount], "--add-cert") == 0 || stricmp(argv[paramCount], "-a") == 0) {
   			if (++paramCount >= argc) {
  @@ -849,6 +858,75 @@
   }
   
   // --------------------------------------------------------------------------------
  +//           Create a CompoundRequest
  +// --------------------------------------------------------------------------------
  +
  +void printCompoundRequestUsage(void) {
  +
  +	cerr << "\nUsage CompoundRequest [--help|-h] <service URI> <LocateRequest|ValidateRequest> .... [-- LocateRequest|ValidateRequest]*\n";
  +	cerr << "   --help/-h                : print this screen and exit\n\n";
  +
  +}
  +
  +XKMSMessageAbstractType * createCompoundRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int paramCount) {
  +
  +	if (paramCount >= argc || 
  +		(stricmp(argv[paramCount], "--help") == 0) ||
  +		(stricmp(argv[paramCount], "-h") == 0)) {
  +
  +		printCompoundRequestUsage();
  +		return NULL;
  +	}
  +
  +	/* First create the basic request */
  +	XKMSMessageFactory * factory = 
  +		prov.getXKMSMessageFactory();
  +	XKMSCompoundRequest * cr = 
  +		factory->createCompoundRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
  +
  +	while (paramCount < argc) {
  +
  +		if ((stricmp(argv[paramCount], "LocateRequest") == 0) ||
  +			(stricmp(argv[paramCount], "lr") == 0)) {
  +
  +			paramCount++;
  +			XKMSLocateRequest * r = 
  +				dynamic_cast<XKMSLocateRequest *> (createLocateRequest(prov, NULL, argc, argv, paramCount, cr));
  +
  +			if (r == NULL) {
  +				delete cr;
  +				return NULL;
  +			}
  +
  +		}
  +		else if ((stricmp(argv[paramCount], "ValidateRequest") == 0) ||
  +			(stricmp(argv[paramCount], "vr") == 0)) {
  +
  +			paramCount++;
  +			XKMSValidateRequest * r = 
  +				dynamic_cast<XKMSValidateRequest *> (createValidateRequest(prov, NULL, argc, argv, paramCount, cr));
  +
  +			if (r == NULL) {
  +				delete cr;
  +				return NULL;
  +			}
  +		}
  +
  +		else {
  +			printCompoundRequestUsage();
  +			delete cr;
  +			(*doc)->release();
  +			return NULL;
  +		}
  +
  +		if (paramCount < argc && stricmp(argv[paramCount], "--") == 0)
  +			paramCount++;
  +	}
  +
  +	return cr;
  +}
  +
  +// --------------------------------------------------------------------------------
   //           MsgDump
   // --------------------------------------------------------------------------------
   
  @@ -1200,86 +1278,118 @@
   	return 0;
   }
   
  -int doParsedMsgDump(DOMDocument * doc) {
  +int doMsgDump(XKMSMessageAbstractType * msg) {
   
  -	// Get an XKMS Message Factory
  -	XSECProvider prov;
  -	XKMSMessageFactory * factory = prov.getXKMSMessageFactory();
  -	int errorsOccured;
  +	if (msg->isSigned()) {
   
  -	try {
  +		cout << "Message is signed.  Checking signature ... ";
  +		try {
   
  -		XKMSMessageAbstractType * msg =
  -			factory->newMessageFromDOM(doc->getDocumentElement());
  +			XSECKeyInfoResolverDefault theKeyInfoResolver;
  +			DSIGSignature * sig = msg->getSignature();
   
  -		if (msg == NULL) {
  -			cerr << "Unable to create XKMS msg from parsed DOM\n" << endl;
  -			return 2;
  +			// The only way we can verify is using keys read directly from the KeyInfo list,
  +			// so we add a KeyInfoResolverDefault to the Signature.
  +
  +			sig->setKeyInfoResolver(&theKeyInfoResolver);
  +
  +			if (sig->verify())
  +				cout << "OK!" << endl;
  +			else
  +				cout << "Bad!" << endl;
  +
  +		}
  +	
  +		catch (XSECException &e) {
  +			cout << "Bad!.  Caught exception : " << endl;
  +			char * msg = XMLString::transcode(e.getMsg());
  +			cout << msg << endl;
  +			XMLString::release(&msg);
   		}
  +	}
   
  -		Janitor <XKMSMessageAbstractType> j_msg(msg);
  +	int i;
   
  -		if (msg->isSigned()) {
  +	switch (msg->getMessageType()) {
   
  -			cout << "Message is signed.  Checking signature ... ";
  -			try {
  +	case XKMSMessageAbstractType::CompoundRequest :
   
  -				XSECKeyInfoResolverDefault theKeyInfoResolver;
  -				DSIGSignature * sig = msg->getSignature();
  +		cout << "Compound Request\n\n";
   
  -				// The only way we can verify is using keys read directly from the KeyInfo list,
  -				// so we add a KeyInfoResolverDefault to the Signature.
  +		for (i = 0 ; i < (dynamic_cast<XKMSCompoundRequest *>(msg))->getRequestListSize(); ++i) {
   
  -				sig->setKeyInfoResolver(&theKeyInfoResolver);
  +			cout << "Message " << i << endl;
  +			doMsgDump((dynamic_cast<XKMSCompoundRequest *>(msg))->getRequestListItem(i));
   
  -				if (sig->verify())
  -					cout << "OK!" << endl;
  -				else
  -					cout << "Bad!" << endl;
  +		}
  +		break;
  +	
  +	case XKMSMessageAbstractType::CompoundResult :
  +
  +		cout << "Compound Result\n\n";
  +
  +		for (i = 0 ; i < (dynamic_cast<XKMSCompoundResult *>(msg))->getResultListSize(); ++i) {
  +
  +			cout << "Message " << i << endl;
  +			doMsgDump((dynamic_cast<XKMSCompoundResult *>(msg))->getResultListItem(i));
   
  -			}
  -		
  -			catch (XSECException &e) {
  -				cout << "Bad!.  Caught exception : " << endl;
  -				char * msg = XMLString::transcode(e.getMsg());
  -				cout << msg << endl;
  -				XMLString::release(&msg);
  -			}
   		}
  +		break;
  +	
  +	case XKMSMessageAbstractType::LocateRequest :
   
  -		switch (msg->getMessageType()) {
  +		doLocateRequestDump(dynamic_cast<XKMSLocateRequest *>(msg));
  +		break;
   
  -		case XKMSMessageAbstractType::LocateRequest :
  +	case XKMSMessageAbstractType::LocateResult :
   
  -			doLocateRequestDump(dynamic_cast<XKMSLocateRequest *>(msg));
  -			break;
  +		doLocateResultDump(dynamic_cast<XKMSLocateResult *>(msg));
  +		break;
   
  -		case XKMSMessageAbstractType::LocateResult :
  +	case XKMSMessageAbstractType::Result :
   
  -			doLocateResultDump(dynamic_cast<XKMSLocateResult *>(msg));
  -			break;
  +		doResultDump(dynamic_cast<XKMSResult *>(msg));
  +		break;
   
  -		case XKMSMessageAbstractType::Result :
  +	case XKMSMessageAbstractType::ValidateRequest :
   
  -			doResultDump(dynamic_cast<XKMSResult *>(msg));
  -			break;
  +		doValidateRequestDump(dynamic_cast<XKMSValidateRequest *>(msg));
  +		break;
   
  -		case XKMSMessageAbstractType::ValidateRequest :
  +	case XKMSMessageAbstractType::ValidateResult :
   
  -			doValidateRequestDump(dynamic_cast<XKMSValidateRequest *>(msg));
  -			break;
  +		doValidateResultDump(dynamic_cast<XKMSValidateResult *>(msg));
  +		break;
   
  -		case XKMSMessageAbstractType::ValidateResult :
  +	default :
   
  -			doValidateResultDump(dynamic_cast<XKMSValidateResult *>(msg));
  -			break;
  +		cout << "Unknown message type!" << endl;
  +
  +	}
  +
  +	return 0;
  +}
  +
  +int doParsedMsgDump(DOMDocument * doc) {
  +
  +	// Get an XKMS Message Factory
  +	XSECProvider prov;
  +	XKMSMessageFactory * factory = prov.getXKMSMessageFactory();
  +	int errorsOccured;
   
  -		default :
  +	try {
   
  -			cout << "Unknown message type!" << endl;
  +		XKMSMessageAbstractType * msg =
  +			factory->newMessageFromDOM(doc->getDocumentElement());
   
  +		if (msg == NULL) {
  +			cerr << "Unable to create XKMS msg from parsed DOM\n" << endl;
  +			return 2;
   		}
   
  +		Janitor <XKMSMessageAbstractType> j_msg(msg);
  +
  +		return doMsgDump(msg);
   
   	}
   
  @@ -1346,7 +1456,8 @@
   	if ((stricmp(argv[paramCount], "LocateRequest") == 0) ||
   		(stricmp(argv[paramCount], "lr") == 0)) {
   
  -		msg = createLocateRequest(prov, &doc, argc, argv, paramCount + 1);
  +		paramCount++;
  +		msg = createLocateRequest(prov, &doc, argc, argv, paramCount);
   		if (msg == NULL) {
   			return -1;
   		}
  @@ -1376,7 +1487,7 @@
   
   void printDoRequestUsage(void) {
   
  -	cerr << "\nUsage request [options] {LocateRequest|ValidateRequest} [msg specific options]\n";
  +	cerr << "\nUsage request [options] {CompoundRequest|LocateRequest|ValidateRequest} [msg specific options]\n";
   	cerr << "   --help/-h       : Print this screen and exit\n";
   	cerr << "   --two-phase/-t  : Indicate Two-Phase support in the request message\n\n";
   
  @@ -1408,8 +1519,9 @@
   		if ((stricmp(argv[paramCount], "LocateRequest") == 0) ||
   			(stricmp(argv[paramCount], "lr") == 0)) {
   
  +			paramCount++;
   			XKMSLocateRequest * r = 
  -				dynamic_cast<XKMSLocateRequest *> (createLocateRequest(prov, &doc, argc, argv, paramCount + 1));
  +				dynamic_cast<XKMSLocateRequest *> (createLocateRequest(prov, &doc, argc, argv, paramCount));
   
   			if (r == NULL) {
   				return -1;
  @@ -1425,8 +1537,25 @@
   		else if ((stricmp(argv[paramCount], "ValidateRequest") == 0) ||
   			(stricmp(argv[paramCount], "vr") == 0)) {
   
  +			paramCount++;
   			XKMSValidateRequest * r = 
  -				dynamic_cast<XKMSValidateRequest *> (createValidateRequest(prov, &doc, argc, argv, paramCount + 1));
  +				dynamic_cast<XKMSValidateRequest *> (createValidateRequest(prov, &doc, argc, argv, paramCount));
  +
  +			if (r == NULL) {
  +				return -1;
  +			}
  +			if (twoPhase)
  +				r->appendResponseMechanismItem(XKMSConstants::s_tagRepresent);
  +
  +			msg = r;
  +			parmsDone = true;
  +
  +		}
  +		else if ((stricmp(argv[paramCount], "CompoundRequest") == 0) ||
  +			(stricmp(argv[paramCount], "cr") == 0)) {
  +
  +			XKMSCompoundRequest * r = 
  +				dynamic_cast<XKMSCompoundRequest *> (createCompoundRequest(prov, &doc, argc, argv, paramCount + 1));
   
   			if (r == NULL) {
   				return -1;
  
  
  
  1.10      +40 -1     xml-security/c/src/xkms/XKMSConstants.cpp
  
  Index: XKMSConstants.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/XKMSConstants.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XKMSConstants.cpp	5 Sep 2004 12:35:17 -0000	1.9
  +++ XKMSConstants.cpp	21 Sep 2004 12:33:52 -0000	1.10
  @@ -55,6 +55,45 @@
   	chNull
   };
   
  +const XMLCh XKMSConstants::s_tagCompoundRequest[] = {
  +
  +	chLatin_C,
  +	chLatin_o,
  +	chLatin_m,
  +	chLatin_p,
  +	chLatin_o,
  +	chLatin_u,
  +	chLatin_n,
  +	chLatin_d,
  +	chLatin_R,
  +	chLatin_e,
  +	chLatin_q,
  +	chLatin_u,
  +	chLatin_e,
  +	chLatin_s,
  +	chLatin_t,
  +	chNull
  +};
  +
  +const XMLCh XKMSConstants::s_tagCompoundResult[] = {
  +
  +	chLatin_C,
  +	chLatin_o,
  +	chLatin_m,
  +	chLatin_p,
  +	chLatin_o,
  +	chLatin_u,
  +	chLatin_n,
  +	chLatin_d,
  +	chLatin_R,
  +	chLatin_e,
  +	chLatin_s,
  +	chLatin_u,
  +	chLatin_l,
  +	chLatin_t,
  +	chNull
  +};
  +
   const XMLCh XKMSConstants::s_tagEncryption[] = {
   
   	chLatin_E,
  
  
  
  1.12      +3 -1      xml-security/c/src/xkms/XKMSConstants.hpp
  
  Index: XKMSConstants.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/XKMSConstants.hpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XKMSConstants.hpp	5 Sep 2004 12:35:17 -0000	1.11
  +++ XKMSConstants.hpp	21 Sep 2004 12:33:52 -0000	1.12
  @@ -52,6 +52,8 @@
   
   	// Tags - note all are UTF-16, but not marked as such
   	static const XMLCh s_tagApplication[];
  +	static const XMLCh s_tagCompoundRequest[];
  +	static const XMLCh s_tagCompoundResult[];
   	static const XMLCh s_tagEncryption[];
   	static const XMLCh s_tagExchange[];
   	static const XMLCh s_tagId[];
  
  
  
  1.6       +3 -1      xml-security/c/src/xkms/XKMSMessageAbstractType.hpp
  
  Index: XKMSMessageAbstractType.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/XKMSMessageAbstractType.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XKMSMessageAbstractType.hpp	6 Aug 2004 11:41:12 -0000	1.5
  +++ XKMSMessageAbstractType.hpp	21 Sep 2004 12:33:52 -0000	1.6
  @@ -96,6 +96,8 @@
   	enum messageType {
   
   		None,					/** A default value that indicates something hasn't been set */
  +		CompoundRequest,		/** A CompoundRequest message - holding multiple requests */
  +		CompoundResult,			/** A CompoundResult message - holding multiple results */
   		LocateRequest,			/** A LocateRequest message */
   		LocateResult,			/** A LocateResult message */
   		ValidateRequest,		/** A ValidateRequest message */
  
  
  
  1.6       +89 -1     xml-security/c/src/xkms/XKMSMessageFactory.hpp
  
  Index: XKMSMessageFactory.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/XKMSMessageFactory.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XKMSMessageFactory.hpp	24 Jul 2004 12:23:00 -0000	1.5
  +++ XKMSMessageFactory.hpp	21 Sep 2004 12:33:52 -0000	1.6
  @@ -33,6 +33,8 @@
   #include <xsec/xkms/XKMSResultType.hpp>
   
   class DSIGSignature;
  +class XKMSCompoundRequest;
  +class XKMSCompoundResult;
   class XKMSLocateRequest;
   class XKMSLocateResult;
   class XKMSRequestAbstractType;
  @@ -104,6 +106,47 @@
   	//@{
   
   	/**
  +	 * \brief Create a new \<CompoundRequest\> message.
  +	 * 
  +	 * Generates a new CompoundRequest message from scratch, building the DOM
  +	 * as it goes.
  +	 *
  +	 * @param service URI
  +	 * @param doc Document to create the DOM structure within.  The caller
  +	 * will need to embed the DOM structure at the appropriate place in the
  +	 * document (using a call to getElement to find the top level element)
  +	 * @param id Value to set in the Id field.  If NULL, the library will
  +	 * generate a new Unique Id value.
  +	 * @returns the new XKMSCompoundRequest structure
  +	 */
  +
  +	virtual XKMSCompoundRequest * createCompoundRequest(
  +		const XMLCh * service,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
  +		const XMLCh * id = NULL) = 0;
  +		
  +	/**
  +	 * \brief Create a new \<CompoundRequest\> message and surrounding document
  +	 * 
  +	 * Generates a new CompoundRequest message from scratch, building the DOM
  +	 * as it goes.
  +	 *
  +	 * @param service URI
  +	 * @param doc Will be used to return the newly created document element in.
  +	 * @param id Value to set in the Id field.  If NULL, the library will
  +	 * generate a new Unique Id value.
  +	 * @returns the new XKMSCompoundRequest structure
  +	 * @note Like all the xsec library functions, the document is owned by
  +	 * the calling application.  Deleteing the CompoundRequest object will not
  +	 * delete the DOM document as well.
  +	 */
  +
  +	virtual XKMSCompoundRequest * createCompoundRequest(
  +		const XMLCh * service,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
  +		const XMLCh * id = NULL) = 0;
  +
  +	/**
   	 * \brief Create a new \<LocateRequest\> message.
   	 * 
   	 * Generates a new LocateRequest message from scratch, building the DOM
  @@ -270,6 +313,51 @@
   
   	virtual XKMSValidateResult * createValidateResult(
   		XKMSValidateRequest * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  +		const XMLCh * id = NULL) = 0;
  +
  +	/**
  +	 * \brief Create a new \<CompoundResult\> message.
  +	 * 
  +	 * Generates a new CompoundResult message from scratch, building the DOM
  +	 * as it goes.  The response will be based on a input CompoundRequest message
  +	 * which is used to provide Id etc.
  +	 *
  +	 * @param request Request to base response on
  +	 * @param doc Will be used to return the newly created document element in.
  +	 * @param id Value to set in the Id field.  If NULL, the library will
  +	 * generate a new Unique Id value.
  +	 * @returns the new XKMSLocateResponse structure
  +	 */
  +
  +	virtual XKMSCompoundResult * createCompoundResult(
  +		XKMSCompoundRequest * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  +		const XMLCh * id = NULL) = 0;
  +
  +	/**
  +	 * \brief Create a new \<CompoundResult\> message and surrounding document
  +	 * 
  +	 * Generates a new CompoundResult message from scratch, building the DOM
  +	 * as it goes.  The response will be based on a input ValidateRequest message
  +	 * which is used to provide Id etc.
  +	 *
  +	 * @param request Request to base response on
  +	 * @param doc Will be used to return the newly created document element in.
  +	 * @param id Value to set in the Id field.  If NULL, the library will
  +	 * generate a new Unique Id value.
  +	 * @returns the new XKMSCompoundResponse structure
  +	 * @note Like all the xsec library functions, the document is owned by
  +	 * the calling application.  Deleteing the ValidateRequest object will not
  +	 * delete the DOM document as well.
  +	 */
  +
  +	virtual XKMSCompoundResult * createCompoundResult(
  +		XKMSCompoundRequest * request,
   		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
   		XKMSResultType::ResultMajor rmaj,
   		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  
  
  
  1.1                  xml-security/c/src/xkms/XKMSCompoundRequest.hpp
  
  Index: XKMSCompoundRequest.hpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSCompoundRequest := Interface for CompoundRequest Messages
   *
   * $Id: XKMSCompoundRequest.hpp,v 1.1 2004/09/21 12:33:52 blautenb Exp $
   *
   */
  
  #ifndef XKMSCOMPOUNDREQUEST_INCLUDE
  #define XKMSCOMPOUNDREQUEST_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/xkms/XKMSRequestAbstractType.hpp>
  
  class XKMSLocateRequest;
  class XKMSValidateRequest;
  
  /**
   * @ingroup xkms
   * @{
   */
  
  /**
   * @brief Interface definition for the CompoundRequest elements
   *
   * The \<CompoundRequest\> is used to merge a number of separate requests
   * into a single message.  It is a very simple type - simply a holding
   * Request that has all the sub-requests held within it.
   *
   * The schema definition for CompoundRequest is as follows :
   *
   * \verbatim
     <!-- CompoundRequest -->
     <element name="CompoundRequest" type="xkms:CompoundRequestType"/>
     <complexType name="CompoundRequestType">
        <complexContent>
           <extension base="xkms:RequestAbstractType">
              <choice maxOccurs="unbounded">
                 <element ref="xkms:LocateRequest"/>
                 <element ref="xkms:ValidateRequest"/>
                 <element ref="xkms:RegisterRequest"/>
                 <element ref="xkms:ReissueRequest"/>
                 <element ref="xkms:RecoverRequest"/>
                 <element ref="xkms:RevokeRequest"/>
              </choice>
           </extension>
        </complexContent>
     </complexType>
     <!-- /CompoundRequest -->
  \endverbatim
   */
  
  class XKMSCompoundRequest : virtual public XKMSRequestAbstractType {
  
  	/** @name Constructors and Destructors */
  	//@{
  
  protected:
  
  	XKMSCompoundRequest() {};
  
  public:
  
  	virtual ~XKMSCompoundRequest() {};
  
  	/** @name Getter Interface Methods */
  	//@{
  
  	/**
  	 * \brief Return the element at the base of the message
  	 */
  
  	virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
  
  	/**
  	 * \brief Obtain the number of requests within the compound request
  	 *
  	 * This class holds a list of requests that can be accessed using the
  	 * getRequestListItem method.  This method allows an application to determine
  	 * how many request items there are.
  	 *
  	 * @returns The size of the request list
  	 */
  
  	virtual int getRequestListSize(void) = 0;
  
  	/**
  	 * \brief Obtain a request item
  	 * 
  	 * Obtain a particular request from the list of requests held in this
  	 * compound object
  	 *
  	 * @returns The nominated item
  	 */
  	 
  	 virtual XKMSRequestAbstractType * getRequestListItem(int item) = 0;
  
  	//@}
  
  	/** @name Setter Interface Methods */
  	//@{
  
  	/** \brief Add a LocateRequest item
  	 *
  	 * Appends a LocateRequest to the CompoundRequest object and returns the newly
  	 * created object
  	 *
  	 * @param service URI
  	 * @param id Value to set in the Id field.  If NULL, the library will
  	 * generate a new Unique Id value.
  	 * @returns the new XKMSLocateRequest structure
  	 */
  
  	virtual XKMSLocateRequest * createLocateRequest(
  		const XMLCh * service,
  		const XMLCh * id = NULL) = 0;
  
  	/** \brief Add a ValidateRequest item
  	 *
  	 * Appends a ValidateRequest to the CompoundRequest object and returns the newly
  	 * created object
  	 *
  	 * @param service URI
  	 * @param id Value to set in the Id field.  If NULL, the library will
  	 * generate a new Unique Id value.
  	 * @returns the new XKMSValidateRequest structure
  	 */
  
  	virtual XKMSValidateRequest * createValidateRequest(
  		const XMLCh * service,
  		const XMLCh * id = NULL) = 0;
  	 
  	 //@}
  
  private:
  
  	// Unimplemented
  	XKMSCompoundRequest(const XKMSCompoundRequest &);
  	XKMSCompoundRequest & operator = (const XKMSCompoundRequest &);
  
  };
  
  #endif /* XKMSCOMPOUNDREQUEST_INCLUDE */
  
  
  
  1.1                  xml-security/c/src/xkms/XKMSCompoundResult.hpp
  
  Index: XKMSCompoundResult.hpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSCompoundResult := Interface for CompoundResult Messages
   *
   * $Id: XKMSCompoundResult.hpp,v 1.1 2004/09/21 12:33:52 blautenb Exp $
   *
   */
  
  #ifndef XKMSCOMPOUNDRESULT_INCLUDE
  #define XKMSCOMPOUNDRESULT_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/xkms/XKMSResultType.hpp>
  
  class XKMSLocateResult;
  class XKMSLocateRequest;
  class XKMSValidateResult;
  class XKMSValidateRequest;
  class XKMSResult;
  class XKMSRequestAbstractType;
  
  /**
   * @ingroup xkms
   * @{
   */
  
  /**
   * @brief Interface definition for the CompoundResult elements
   *
   * The \<CompoundResult\> is used to merge a number of separate requests
   * into a single message.  It is a very simple type - simply a holding
   * Result that has all the sub-Results held within it.
   *
   * The schema definition for CompoundResult is as follows :
   *
   * \verbatim
     <!-- CompoundResult -->
     <element name="CompoundResult" type="xkms:CompoundResultType"/>
     <complexType name="CompoundResultType">
        <complexContent>
           <extension base="xkms:ResultType">
              <choice minOccurs="0" maxOccurs="unbounded">
                 <element ref="xkms:LocateResult"/>
                 <element ref="xkms:ValidateResult"/>
                 <element ref="xkms:RegisterResult"/>
                 <element ref="xkms:ReissueResult"/>
                 <element ref="xkms:RecoverResult"/>
                 <element ref="xkms:RevokeResult"/>
              </choice>
           </extension>
        </complexContent>
     </complexType>
     <!-- /CompoundResult -->
  \endverbatim
   */
  
  class XKMSCompoundResult : virtual public XKMSResultType {
  
  	/** @name Constructors and Destructors */
  	//@{
  
  protected:
  
  	XKMSCompoundResult() {};
  
  public:
  
  	virtual ~XKMSCompoundResult() {};
  
  	/** @name Getter Interface Methods */
  	//@{
  
  	/**
  	 * \brief Return the element at the base of the message
  	 */
  
  	virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
  
  	/**
  	 * \brief Obtain the number of results within the compound result
  	 *
  	 * This class holds a list of results that can be accessed using the
  	 * getResultListItem method.  This method allows an application to determine
  	 * how many result items there are.
  	 *
  	 * @returns The size of the Result list
  	 */
  
  	virtual int getResultListSize(void) = 0;
  
  	/**
  	 * \brief Obtain a Result item
  	 * 
  	 * Obtain a particular Result from the list of Results held in this
  	 * compound object
  	 *
  	 * @returns The nominated item
  	 */
  	 
  	 virtual XKMSResultType * getResultListItem(int item) = 0;
  
  	//@}
  
  	/** @name Setter Interface Methods */
  	//@{
  
  	/**
  	 * \brief Create a new \<LocateResult\> message.
  	 * 
  	 * Generates a new LocateResult message from scratch, building the DOM
  	 * as it goes.  The response will be based on a input LocateRequest message
  	 * which is used to provide Id etc.
  	 *
  	 * @param request Request to base response on
  	 * @param id Value to set in the Id field.  If NULL, the library will
  	 * generate a new Unique Id value.
  	 * @returns the new XKMSLocateResponse structure
  	 */
  
  	virtual XKMSLocateResult * createLocateResult(
  		XKMSLocateRequest * request,
  		XKMSResultType::ResultMajor rmaj,
  		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  		const XMLCh * id = NULL) = 0;
  
  	/**
  	 * \brief Create a new \<ValidateResult\> message.
  	 * 
  	 * Generates a new ValidateResult message from scratch, building the DOM
  	 * as it goes.  The response will be based on a input ValidateRequest message
  	 * which is used to provide Id etc.
  	 *
  	 * @param request Request to base response on
  	 * @param id Value to set in the Id field.  If NULL, the library will
  	 * generate a new Unique Id value.
  	 * @returns the new XKMSLocateResponse structure
  	 */
  
  	virtual XKMSValidateResult * createValidateResult(
  		XKMSValidateRequest * request,
  		XKMSResultType::ResultMajor rmaj,
  		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  		const XMLCh * id = NULL) = 0;
  
  	/**
  	 * \brief Create a new \<Result\> message.
  	 * 
  	 * Generates a new Result message from scratch, building the DOM
  	 * as it goes.  The response will be based on an input Request message
  	 * which is used to provide Id etc.
  	 *
  	 * @param request Request to base response on
  	 * @param id Value to set in the Id field.  If NULL, the library will
  	 * generate a new Unique Id value.
  	 * @returns the new XKMSResult structure
  	 */
  
  	virtual XKMSResult * createResult(
  		XKMSRequestAbstractType * request,
  		XKMSResultType::ResultMajor rmaj,
  		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  		const XMLCh * id = NULL) = 0;
  	 
  	 //@}
  
  private:
  
  	// Unimplemented
  	XKMSCompoundResult(const XKMSCompoundResult &);
  	XKMSCompoundResult & operator = (const XKMSCompoundResult &);
  
  };
  
  #endif /* XKMSCOMPOUNDRESULT_INCLUDE */
  
  
  
  1.8       +123 -1    xml-security/c/src/xkms/impl/XKMSMessageFactoryImpl.cpp
  
  Index: XKMSMessageFactoryImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/impl/XKMSMessageFactoryImpl.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XKMSMessageFactoryImpl.cpp	7 Aug 2004 12:23:35 -0000	1.7
  +++ XKMSMessageFactoryImpl.cpp	21 Sep 2004 12:33:52 -0000	1.8
  @@ -32,6 +32,8 @@
   #include <xercesc/dom/DOM.hpp>
   #include <xercesc/util/Janitor.hpp>
   
  +#include "XKMSCompoundRequestImpl.hpp"
  +#include "XKMSCompoundResultImpl.hpp"
   #include "XKMSMessageFactoryImpl.hpp"
   #include "XKMSLocateRequestImpl.hpp"
   #include "XKMSLocateResultImpl.hpp"
  @@ -67,6 +69,10 @@
   void XKMSMessageFactoryImpl::copyRequestToResult(XKMSRequestAbstractType * req, 
   												 XKMSResultType * res) {
   
  +
  +	/* Set the requestId */
  +	res->setRequestId(req->getId());
  +
   	/* Copy any Opaque Data */
   
   	int i;
  @@ -140,6 +146,30 @@
   	// See if this is a known element
   	const XMLCh * name = getXKMSLocalName(elt);
   
  +	if (strEquals(name, XKMSConstants::s_tagCompoundRequest)) {
  +
  +		// This is a <CompoundRequest> message
  +		XKMSCompoundRequestImpl * ret;
  +		XSECnew(ret, XKMSCompoundRequestImpl(new XSECEnv(*mp_env), elt));
  +
  +		ret->load();
  +
  +		return ret;
  +
  +	}
  +
  +	if (strEquals(name, XKMSConstants::s_tagCompoundResult)) {
  +
  +		// This is a <CompoundResult> message
  +		XKMSCompoundResultImpl * ret;
  +		XSECnew(ret, XKMSCompoundResultImpl(new XSECEnv(*mp_env), elt));
  +
  +		ret->load();
  +
  +		return ret;
  +
  +	}
  +
   	if (strEquals(name, XKMSConstants::s_tagLocateRequest)) {
   
   		// This is a <LocateRequest> message
  @@ -215,6 +245,44 @@
   //           Construction from scratch
   // --------------------------------------------------------------------------------
   
  +XKMSCompoundRequest * XKMSMessageFactoryImpl::createCompoundRequest(
  +		const XMLCh * service,
  +		DOMDocument * doc,
  +		const XMLCh * id) {
  +
  +	XKMSCompoundRequestImpl * cri;
  +
  +	XSECEnv * tenv;
  +	XSECnew(tenv, XSECEnv(*mp_env));
  +	tenv->setParentDocument(doc);
  +
  +	XSECnew(cri, XKMSCompoundRequestImpl(tenv));
  +	cri->createBlankCompoundRequest(service, id);
  +
  +	return cri;
  +
  +}
  +
  +XKMSCompoundRequest * XKMSMessageFactoryImpl::createCompoundRequest(
  +		const XMLCh * service,
  +		DOMDocument **doc,
  +		const XMLCh * id) {
  +
  +	// Create a document to put the element in
  +
  +	XMLCh tempStr[100];
  +	XMLString::transcode("Core", tempStr, 99);    
  +	DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
  +
  +	*doc = impl->createDocument();
  +
  +	// Embed the new structure in the document
  +	XKMSCompoundRequest * cri = createCompoundRequest(service, *doc, id);
  +	(*doc)->appendChild(cri->getElement());
  +
  +	return cri;
  +}
  +	
   XKMSLocateRequest * XKMSMessageFactoryImpl::createLocateRequest(
   		const XMLCh * service,
   		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
  @@ -431,6 +499,50 @@
   	return vr;
   }
   
  +XKMSCompoundResult * XKMSMessageFactoryImpl::createCompoundResult(
  +		XKMSCompoundRequest * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin,
  +		const XMLCh * id) {
  +
  +	XKMSCompoundResultImpl * cri;
  +
  +	XSECEnv * tenv;
  +	XSECnew(tenv, XSECEnv(*mp_env));
  +	tenv->setParentDocument(doc);
  +
  +	XSECnew(cri, XKMSCompoundResultImpl(tenv));
  +	cri->createBlankCompoundResult(request->getService(), id, rmaj, rmin);
  +
  +	copyRequestToResult(request, (XKMSResultTypeImpl*) cri);
  +
  +	return cri;
  +
  +}
  +
  +XKMSCompoundResult * XKMSMessageFactoryImpl::createCompoundResult(
  +		XKMSCompoundRequest * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin,
  +		const XMLCh * id) {
  +
  +	// Create a document to put the element in
  +
  +	XMLCh tempStr[100];
  +	XMLString::transcode("Core", tempStr, 99);    
  +	DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
  +
  +	*doc = impl->createDocument();
  +
  +	// Embed the new structure in the document
  +	XKMSCompoundResult * cr = createCompoundResult(request, *doc, rmaj, rmin, id);
  +	(*doc)->appendChild(cr->getElement());
  +
  +	return cr;
  +}
  +
   // --------------------------------------------------------------------------------
   //           Message Conversions
   // --------------------------------------------------------------------------------
  @@ -448,6 +560,11 @@
   		return vr;
   
   	}
  +	if (msg->getMessageType() == XKMSMessageAbstractType::CompoundRequest) {
  +		XKMSCompoundRequest * cr = dynamic_cast<XKMSCompoundRequest*>(msg);
  +		return cr;
  +
  +	}
   	return NULL;
   }
   
  @@ -461,6 +578,11 @@
   	if (msg->getMessageType() == XKMSMessageAbstractType::ValidateResult) {
   		XKMSValidateResult * vr = dynamic_cast<XKMSValidateResult*>(msg);
   		return vr;
  +
  +	}
  +	if (msg->getMessageType() == XKMSMessageAbstractType::CompoundResult) {
  +		XKMSCompoundResult * cr = dynamic_cast<XKMSCompoundResult*>(msg);
  +		return cr;
   
   	}
   	return NULL;
  
  
  
  1.8       +27 -1     xml-security/c/src/xkms/impl/XKMSMessageFactoryImpl.hpp
  
  Index: XKMSMessageFactoryImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/impl/XKMSMessageFactoryImpl.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XKMSMessageFactoryImpl.hpp	6 Aug 2004 11:41:13 -0000	1.7
  +++ XKMSMessageFactoryImpl.hpp	21 Sep 2004 12:33:52 -0000	1.8
  @@ -32,10 +32,14 @@
   #include <xsec/xkms/XKMSMessageFactory.hpp>
   
   class XSECProvider;
  +class XKMSCompoundRequest;
  +class XKMSCompoundResult;
   class XSECEnv;
   
   class XKMSMessageFactoryImpl : public XKMSMessageFactory {
   
  +protected:
  +
   	XKMSMessageFactoryImpl(void);
   
   public:
  @@ -64,6 +68,14 @@
   		const XMLCh * service,
   		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
   		const XMLCh * id = NULL);
  +	virtual XKMSCompoundRequest * createCompoundRequest(
  +		const XMLCh * service,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
  +		const XMLCh * id = NULL);
  +	virtual XKMSCompoundRequest * createCompoundRequest(
  +		const XMLCh * service,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
  +		const XMLCh * id = NULL);
   	virtual XKMSLocateResult * createLocateResult(
   		XKMSLocateRequest * request,
   		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
  @@ -100,6 +112,18 @@
   		XKMSResultType::ResultMajor rmaj,
   		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
   		const XMLCh * id = NULL);
  +	virtual XKMSCompoundResult * createCompoundResult(
  +		XKMSCompoundRequest * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  +		const XMLCh * id = NULL);
  +	virtual XKMSCompoundResult * createCompoundResult(
  +		XKMSCompoundRequest * request,
  +		XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
  +		XKMSResultType::ResultMajor rmaj,
  +		XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
  +		const XMLCh * id = NULL);
   
   	/* Conversions */
   	virtual XKMSRequestAbstractType * toRequestAbstractType(XKMSMessageAbstractType *msg);
  @@ -116,6 +140,8 @@
   
   
   	friend class XSECProvider;
  +	friend class XKMSCompoundRequestImpl;
  +	friend class XKMSCompoundResultImpl;
   
   private:
   
  
  
  
  1.4       +17 -2     xml-security/c/src/xkms/impl/XKMSResultTypeImpl.cpp
  
  Index: XKMSResultTypeImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/xkms/impl/XKMSResultTypeImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XKMSResultTypeImpl.cpp	7 Aug 2004 12:23:35 -0000	1.3
  +++ XKMSResultTypeImpl.cpp	21 Sep 2004 12:33:52 -0000	1.4
  @@ -271,7 +271,22 @@
   
   void XKMSResultTypeImpl::setResultMajor(ResultMajor) {}
   void XKMSResultTypeImpl::setResultMinor(ResultMinor) {}
  -void XKMSResultTypeImpl::setRequestId(const XMLCh * id) {}
  +
  +void XKMSResultTypeImpl::setRequestId(const XMLCh * id) {
  +
  +	if (mp_messageAbstractTypeElement == NULL) {
  +
  +		// Attempt update when not initialised
  +		throw XSECException(XSECException::MessageAbstractTypeError,
  +			"XKMSResultType::setRequestId - called on non-initialised structure");
  +
  +	}
  +
  +	mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagRequestId, id);
  +	mp_requestIdAttr = 
  +		mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagRequestId);
  +
  +}
   
   void XKMSResultTypeImpl::setRequestSignatureValue(const XMLCh * value) {
   
  
  
  
  1.1                  xml-security/c/src/xkms/impl/XKMSCompoundRequestImpl.cpp
  
  Index: XKMSCompoundRequestImpl.cpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSCompoundRequestImpl := Implementation of CompoundRequest Messages
   *
   * $Id: XKMSCompoundRequestImpl.cpp,v 1.1 2004/09/21 12:33:52 blautenb Exp $
   *
   */
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/framework/XSECError.hpp>
  #include <xsec/framework/XSECEnv.hpp>
  #include <xsec/utils/XSECDOMUtils.hpp>
  #include <xsec/xkms/XKMSConstants.hpp>
  
  #include "XKMSCompoundRequestImpl.hpp"
  #include "XKMSLocateRequestImpl.hpp"
  #include "XKMSValidateRequestImpl.hpp"
  
  #include <xercesc/dom/DOM.hpp>
  
  XERCES_CPP_NAMESPACE_USE
  
  // --------------------------------------------------------------------------------
  //           Construct/Destruct
  // --------------------------------------------------------------------------------
  
  XKMSCompoundRequestImpl::XKMSCompoundRequestImpl(
  		const XSECEnv * env) :
  XKMSRequestAbstractTypeImpl(env) {
  
  }
  
  XKMSCompoundRequestImpl::XKMSCompoundRequestImpl(
  		const XSECEnv * env, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
  XKMSRequestAbstractTypeImpl(env, node) {
  
  }
  
  XKMSCompoundRequestImpl::~XKMSCompoundRequestImpl() {
  
  	RequestListVectorType::iterator i;
  
  	for (i = m_requestList.begin() ; i < m_requestList.end(); i++) {
  
  		delete (*i);
  
  	}
  
  
  }
  
  
  // --------------------------------------------------------------------------------
  //           Load from DOM
  // --------------------------------------------------------------------------------
  
  // Load elements
  void XKMSCompoundRequestImpl::load() {
  
  	if (mp_messageAbstractTypeElement == NULL) {
  
  		// Attempt to load an empty element
  		throw XSECException(XSECException::XKMSError,
  			"XKMSCompoundRequest::load - called on empty DOM");
  
  	}
  
  	if (!strEquals(getXKMSLocalName(mp_messageAbstractTypeElement), 
  									XKMSConstants::s_tagCompoundRequest)) {
  	
  		throw XSECException(XSECException::XKMSError,
  			"XKMSCompoundRequest::load - called incorrect node");
  	
  	}
  
  	// Load the base message
  	XKMSRequestAbstractTypeImpl::load();
  
  	// Now find all Request elements
  	DOMElement * e = findFirstElementChild(mp_messageAbstractTypeElement);
  
  	while (e != NULL) {
  
  		if (strEquals(getXKMSLocalName(e), XKMSConstants::s_tagLocateRequest) ||
  			strEquals(getXKMSLocalName(e), XKMSConstants::s_tagValidateRequest)) {
  
  			// Have a legitimate request to load
  			XKMSMessageAbstractType * m = m_factory.newMessageFromDOM(e);
  			m_requestList.push_back(dynamic_cast<XKMSRequestAbstractTypeImpl *>(m));
  
  		}
  
  		e = findNextElementChild(e);
  
  	}
  	
  
  }
  
  // --------------------------------------------------------------------------------
  //           Create a blank one
  // --------------------------------------------------------------------------------
  DOMElement * XKMSCompoundRequestImpl::createBlankCompoundRequest(
  		const XMLCh * service,
  		const XMLCh * id) {
  
  	return XKMSRequestAbstractTypeImpl::createBlankMessageAbstractType(
  		XKMSConstants::s_tagCompoundRequest, service, id);
  
  }
  
  // --------------------------------------------------------------------------------
  //           Get interface methods
  // --------------------------------------------------------------------------------
  
  XKMSMessageAbstractType::messageType XKMSCompoundRequestImpl::getMessageType(void) {
  
  	return XKMSMessageAbstractType::CompoundRequest;
  
  }
  
  int XKMSCompoundRequestImpl::getRequestListSize(void) {
  
  	return m_requestList.size();
  
  }
  
  XKMSRequestAbstractType * XKMSCompoundRequestImpl::getRequestListItem(int item) {
  
  	if (item < 0 || item >= m_requestList.size()) {
  
  		throw XSECException(XSECException::XKMSError,
  			"XKMSCompoundRequest::getRequestListItem - item out of range");
  	}
  
  	return m_requestList[item];
  
  
  }
  
  // --------------------------------------------------------------------------------
  //           Setter methods
  // --------------------------------------------------------------------------------
  
  XKMSLocateRequest * XKMSCompoundRequestImpl::createLocateRequest(
  		const XMLCh * service,
  		const XMLCh * id) {
  
  	XKMSLocateRequest * r = m_factory.createLocateRequest(service, mp_env->getParentDocument(), id);
  	m_requestList.push_back(dynamic_cast<XKMSRequestAbstractTypeImpl*>(r));
  
  	mp_messageAbstractTypeElement->appendChild(r->getElement());
  	mp_env->doPrettyPrint(mp_messageAbstractTypeElement);
  
  	return r;
  
  }
  
  XKMSValidateRequest * XKMSCompoundRequestImpl::createValidateRequest(
  		const XMLCh * service,
  		const XMLCh * id) {
  
  	XKMSValidateRequest * r = m_factory.createValidateRequest(service, mp_env->getParentDocument(), id);
  	m_requestList.push_back(dynamic_cast<XKMSRequestAbstractTypeImpl*>(r));
  
  	mp_messageAbstractTypeElement->appendChild(r->getElement());
  	mp_env->doPrettyPrint(mp_messageAbstractTypeElement);
  
  	return r;
  }
  
  
  
  
  1.1                  xml-security/c/src/xkms/impl/XKMSCompoundRequestImpl.hpp
  
  Index: XKMSCompoundRequestImpl.hpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSCompoundRequestImpl := Implementation of CompoundRequest Messages
   *
   * $Id: XKMSCompoundRequestImpl.hpp,v 1.1 2004/09/21 12:33:52 blautenb Exp $
   *
   */
  
  #ifndef XKMSCOMPOUNDREQUESTIMPL_INCLUDE
  #define XKMSCOMPOUNDREQUESTIMPL_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/xkms/XKMSCompoundRequest.hpp>
  
  #include "XKMSRequestAbstractTypeImpl.hpp"
  #include "XKMSMessageFactoryImpl.hpp"
  
  class XKMSQueryKeyRequestImpl;
  
  class XKMSCompoundRequestImpl : public XKMSRequestAbstractTypeImpl, public XKMSCompoundRequest {
  
  public:
  
  	XKMSCompoundRequestImpl(
  		const XSECEnv * env
  	);
  
  	XKMSCompoundRequestImpl(
  		const XSECEnv * env, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
  	);
  
  	virtual ~XKMSCompoundRequestImpl();
  
  	// Load elements
  	void load();
  
  	// Creation
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * 
  		createBlankCompoundRequest(
  		const XMLCh * service,
  		const XMLCh * id = NULL);
  
  	// Getter methods
  
  	virtual int getRequestListSize(void);
  	virtual XKMSRequestAbstractType * getRequestListItem(int item);
  
  	/* Implemented from MessageAbstractType */
  	virtual messageType getMessageType(void);
  
  	// Setter Methods
  
  	virtual XKMSLocateRequest * createLocateRequest(
  		const XMLCh * service,
  		const XMLCh * id = NULL);
  
  	virtual XKMSValidateRequest * createValidateRequest(
  		const XMLCh * service,
  		const XMLCh * id = NULL);
  
  	/* Forced inheritance from XKMSMessageAbstractTypeImpl */
  	XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
  
  	/* Forced inheritance from RequestAbstractType */
  	XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
  
  private:
  
  #if defined(XSEC_NO_NAMESPACES)
  	typedef vector<XKMSRequestAbstractTypeImpl *>		RequestListVectorType;
  #else
  	typedef std::vector<XKMSRequestAbstractTypeImpl *>	RequestListVectorType;
  #endif
  
  	RequestListVectorType	m_requestList;
  
  	/* Used to consume and produce messages in the list */
  	XKMSMessageFactoryImpl	m_factory;
  
  	// Unimplemented
  	XKMSCompoundRequestImpl(const XKMSCompoundRequestImpl &);
  	XKMSCompoundRequestImpl & operator = (const XKMSCompoundRequestImpl &);
  
  };
  
  #endif /* XKMSCOMPOUNDREQUESTIMPL_INCLUDE */
  
  
  
  1.1                  xml-security/c/src/xkms/impl/XKMSCompoundResultImpl.cpp
  
  Index: XKMSCompoundResultImpl.cpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSCompoundResultImpl := Implementation of CompoundResult Messages
   *
   * $Id: XKMSCompoundResultImpl.cpp,v 1.1 2004/09/21 12:33:52 blautenb Exp $
   *
   */
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/framework/XSECError.hpp>
  #include <xsec/framework/XSECEnv.hpp>
  #include <xsec/utils/XSECDOMUtils.hpp>
  #include <xsec/xkms/XKMSConstants.hpp>
  
  #include "XKMSCompoundResultImpl.hpp"
  #include "XKMSLocateResultImpl.hpp"
  #include "XKMSValidateResultImpl.hpp"
  #include "XKMSResultImpl.hpp"
  
  #include <xercesc/dom/DOM.hpp>
  
  XERCES_CPP_NAMESPACE_USE
  
  // --------------------------------------------------------------------------------
  //           Construct/Destruct
  // --------------------------------------------------------------------------------
  
  XKMSCompoundResultImpl::XKMSCompoundResultImpl(
  		const XSECEnv * env) :
  XKMSResultTypeImpl(env) {
  
  }
  
  XKMSCompoundResultImpl::XKMSCompoundResultImpl(
  		const XSECEnv * env, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
  XKMSResultTypeImpl(env, node) {
  
  }
  
  XKMSCompoundResultImpl::~XKMSCompoundResultImpl() {
  
  	ResultListVectorType::iterator i;
  
  	for (i = m_resultList.begin() ; i < m_resultList.end(); i++) {
  
  		delete (*i);
  
  	}
  
  
  }
  
  
  // --------------------------------------------------------------------------------
  //           Load from DOM
  // --------------------------------------------------------------------------------
  
  // Load elements
  void XKMSCompoundResultImpl::load() {
  
  	if (mp_messageAbstractTypeElement == NULL) {
  
  		// Attempt to load an empty element
  		throw XSECException(XSECException::XKMSError,
  			"XKMSCompoundResult::load - called on empty DOM");
  
  	}
  
  	if (!strEquals(getXKMSLocalName(mp_messageAbstractTypeElement), 
  									XKMSConstants::s_tagCompoundResult)) {
  	
  		throw XSECException(XSECException::XKMSError,
  			"XKMSCompoundResult::load - called incorrect node");
  	
  	}
  
  	// Load the base message
  	XKMSResultTypeImpl::load();
  
  	// Now find all Result elements
  	DOMElement * e = findFirstElementChild(mp_messageAbstractTypeElement);
  
  	while (e != NULL) {
  
  		if (strEquals(getXKMSLocalName(e), XKMSConstants::s_tagLocateResult) ||
  			strEquals(getXKMSLocalName(e), XKMSConstants::s_tagValidateResult)) {
  
  			// Have a legitimate Result to load
  			XKMSMessageAbstractType * m = m_factory.newMessageFromDOM(e);
  			m_resultList.push_back(dynamic_cast<XKMSResultTypeImpl *>(m));
  
  		}
  
  		e = findNextElementChild(e);
  
  	}
  	
  
  }
  
  // --------------------------------------------------------------------------------
  //           Create a blank one
  // --------------------------------------------------------------------------------
  DOMElement * XKMSCompoundResultImpl::createBlankCompoundResult(
  		const XMLCh * service,
  		const XMLCh * id,
  		ResultMajor rmaj,
  		ResultMinor rmin) {
  
  	return XKMSResultTypeImpl::createBlankResultType(
  		XKMSConstants::s_tagCompoundResult, service, id, rmaj, rmin);
  
  }
  
  // --------------------------------------------------------------------------------
  //           Get interface methods
  // --------------------------------------------------------------------------------
  
  XKMSMessageAbstractType::messageType XKMSCompoundResultImpl::getMessageType(void) {
  
  	return XKMSMessageAbstractType::CompoundResult;
  
  }
  
  int XKMSCompoundResultImpl::getResultListSize(void) {
  
  	return m_resultList.size();
  
  }
  
  XKMSResultType * XKMSCompoundResultImpl::getResultListItem(int item) {
  
  	if (item < 0 || item >= m_resultList.size()) {
  
  		throw XSECException(XSECException::XKMSError,
  			"XKMSCompoundResult::getResultListItem - item out of range");
  	}
  
  	return m_resultList[item];
  
  
  }
  
  // --------------------------------------------------------------------------------
  //           Setter methods
  // --------------------------------------------------------------------------------
  
  XKMSLocateResult * XKMSCompoundResultImpl::createLocateResult(
  		XKMSLocateRequest * request,
  		ResultMajor rmaj,
  		ResultMinor rmin,
  		const XMLCh * id) {
  
  	XKMSLocateResult * r = m_factory.createLocateResult(request, mp_env->getParentDocument(), rmaj, rmin, id);
  	m_resultList.push_back(dynamic_cast<XKMSResultTypeImpl*>(r));
  
  	mp_messageAbstractTypeElement->appendChild(r->getElement());
  	mp_env->doPrettyPrint(mp_messageAbstractTypeElement);
  
  	return r;
  
  }
  
  XKMSValidateResult * XKMSCompoundResultImpl::createValidateResult(
  		XKMSValidateRequest * request,
  		ResultMajor rmaj,
  		ResultMinor rmin,
  		const XMLCh * id) {
  
  	XKMSValidateResult * r = m_factory.createValidateResult(request, mp_env->getParentDocument(), rmaj, rmin, id);
  	m_resultList.push_back(dynamic_cast<XKMSResultTypeImpl*>(r));
  
  	mp_messageAbstractTypeElement->appendChild(r->getElement());
  	mp_env->doPrettyPrint(mp_messageAbstractTypeElement);
  
  	return r;
  
  }
  
  
  XKMSResult * XKMSCompoundResultImpl::createResult(
  		XKMSRequestAbstractType * request,
  		ResultMajor rmaj,
  		ResultMinor rmin,
  		const XMLCh * id) {
  
  	XKMSResult * r = m_factory.createResult(request, mp_env->getParentDocument(), rmaj, rmin, id);
  	m_resultList.push_back(dynamic_cast<XKMSResultTypeImpl*>(r));
  
  	mp_messageAbstractTypeElement->appendChild(r->getElement());
  	mp_env->doPrettyPrint(mp_messageAbstractTypeElement);
  
  	return r;
  
  }
  
  
  
  
  1.1                  xml-security/c/src/xkms/impl/XKMSCompoundResultImpl.hpp
  
  Index: XKMSCompoundResultImpl.hpp
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * imitations under the License.
   */
  
  /*
   * XSEC
   *
   * XKMSCompoundResultImpl := Implementation of CompoundResult Messages
   *
   * $Id: XKMSCompoundResultImpl.hpp,v 1.1 2004/09/21 12:33:52 blautenb Exp $
   *
   */
  
  #ifndef XKMSCOMPOUNDRESULTIMPL_INCLUDE
  #define XKMSCOMPOUNDRESULTIMPL_INCLUDE
  
  // XSEC Includes
  
  #include <xsec/framework/XSECDefs.hpp>
  #include <xsec/xkms/XKMSCompoundResult.hpp>
  
  #include "XKMSResultTypeImpl.hpp"
  #include "XKMSMessageFactoryImpl.hpp"
  
  class XKMSCompoundResultImpl : public XKMSResultTypeImpl, public XKMSCompoundResult {
  
  public:
  
  	XKMSCompoundResultImpl(
  		const XSECEnv * env
  	);
  
  	XKMSCompoundResultImpl(
  		const XSECEnv * env, 
  		XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
  	);
  
  	virtual ~XKMSCompoundResultImpl();
  
  	// Load elements
  	void load();
  
  	// Creation
  	XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * 
  		createBlankCompoundResult(
  		const XMLCh * service,
  		const XMLCh * id,
  		ResultMajor rmaj,
  		ResultMinor rmin);
  
  	// Getter methods
  
  	virtual int getResultListSize(void);
  	virtual XKMSResultType * getResultListItem(int item);
  
  	// Setter Methods
  
  	virtual XKMSLocateResult * createLocateResult(
  		XKMSLocateRequest * request,
  		ResultMajor rmaj,
  		ResultMinor rmin = XKMSResultTypeImpl::NoneMinor,
  		const XMLCh * id = NULL);
  	virtual XKMSValidateResult * createValidateResult(
  		XKMSValidateRequest * request,
  		ResultMajor rmaj,
  		ResultMinor rmin = XKMSResultTypeImpl::NoneMinor,
  		const XMLCh * id = NULL);
  	virtual XKMSResult * createResult(
  		XKMSRequestAbstractType * request,
  		ResultMajor rmaj,
  		ResultMinor rmin = XKMSResultTypeImpl::NoneMinor,
  		const XMLCh * id = NULL);
  
  	/* Implemented from MessageAbstractType */
  	virtual messageType getMessageType(void);
  
  	/* Forced inheritance from XKMSMessageAbstractTypeImpl */
  	XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
  
  	/* Forced inheritance from XKMSResultTypeImpl */
  	XKMS_RESULTTYPE_IMPL_METHODS
  
  private:
  
  #if defined(XSEC_NO_NAMESPACES)
  	typedef vector<XKMSResultTypeImpl *>		ResultListVectorType;
  #else
  	typedef std::vector<XKMSResultTypeImpl *>	ResultListVectorType;
  #endif
  
  	ResultListVectorType	m_resultList;
  
  	/* Used to consume and produce messages in the list */
  	XKMSMessageFactoryImpl	m_factory;
  
  	// Unimplemented
  	XKMSCompoundResultImpl(const XKMSCompoundResultImpl &);
  	XKMSCompoundResultImpl & operator = (const XKMSCompoundResultImpl &);
  
  };
  
  #endif /* XKMSCOMPOUNDRESULTIMPL_INCLUDE */