//%2005////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation, The Open Group.
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; VERITAS Software Corporation; The Open Group.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//==============================================================================
//
// Author: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
//
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
//                  (carolann_graves@hp.com)
//
//%/////////////////////////////////////////////////////////////////////////////

#ifndef Pegasus_CIMMessageDeserializer_h
#define Pegasus_CIMMessageDeserializer_h

#include <Pegasus/Common/Config.h>
#include <Pegasus/Common/CIMMessage.h>
#include <Pegasus/Common/XmlParser.h>

PEGASUS_NAMESPACE_BEGIN

/**
    CIMMessageDeserializer provides a mechanism to convert a stream of bytes
    generated by the CIMMessageSerializer class into a CIMMessage object.
    For additional information, please see the CIMMessageSerializer
    description.
 */
class PEGASUS_COMMON_LINKAGE CIMMessageDeserializer
{
public:

    static CIMMessage* deserialize(char* buffer);

private:

    static CIMRequestMessage* _deserializeCIMRequestMessage(
        XmlParser& parser,
        Uint32 type);

    static CIMResponseMessage* _deserializeCIMResponseMessage(
        XmlParser& parser,
        Uint32 type);

    //
    // Utility Methods
    //

    static void _deserializeUserInfo(
        XmlParser& parser,
        String& authType,
        String& userName);

    static void _deserializeQueueIdStack(
        XmlParser& parser,
        QueueIdStack& queueIdStack);

    static void _deserializeOperationContext(
        XmlParser& parser,
        OperationContext& operationContext);

    static void _deserializeContentLanguages(
        XmlParser& parser,
        ContentLanguages& contentLanguages);

    static void _deserializeAcceptLanguages(
        XmlParser& parser,
        AcceptLanguages& acceptLanguages);

    static void _deserializeCIMException(
        XmlParser& parser,
        CIMException& cimException);

    static void _deserializeCIMPropertyList(
        XmlParser& parser,
        CIMPropertyList& propertyList);

    static Boolean _deserializeCIMObjectPath(
        XmlParser& parser,
        CIMObjectPath& cimObjectPath);

    static Boolean _deserializeCIMInstance(
        XmlParser& parser,
        CIMInstance& cimInstance);

    static void _deserializeCIMNamespaceName(
        XmlParser& parser,
        CIMNamespaceName& cimNamespaceName);

    static Boolean _deserializeCIMName(
        XmlParser& parser,
        CIMName& cimName);

    static Boolean _deserializeCIMObject(
        XmlParser& parser,
        CIMObject& object);

    //
    //
    // CIM Request Messages
    //
    //

    //
    // CIMOperationRequestMessages
    //

    static CIMGetInstanceRequestMessage*
        _deserializeCIMGetInstanceRequestMessage(XmlParser& parser);

    static CIMDeleteInstanceRequestMessage*
        _deserializeCIMDeleteInstanceRequestMessage(XmlParser& parser);

    static CIMCreateInstanceRequestMessage*
        _deserializeCIMCreateInstanceRequestMessage(XmlParser& parser);

    static CIMModifyInstanceRequestMessage*
        _deserializeCIMModifyInstanceRequestMessage(XmlParser& parser);

    static CIMEnumerateInstancesRequestMessage*
        _deserializeCIMEnumerateInstancesRequestMessage(XmlParser& parser);

    static CIMEnumerateInstanceNamesRequestMessage*
        _deserializeCIMEnumerateInstanceNamesRequestMessage(XmlParser& parser);

    static CIMExecQueryRequestMessage*
        _deserializeCIMExecQueryRequestMessage(XmlParser& parser);

    static CIMAssociatorsRequestMessage*
        _deserializeCIMAssociatorsRequestMessage(XmlParser& parser);

    static CIMAssociatorNamesRequestMessage*
        _deserializeCIMAssociatorNamesRequestMessage(XmlParser& parser);

    static CIMReferencesRequestMessage*
        _deserializeCIMReferencesRequestMessage(XmlParser& parser);

    static CIMReferenceNamesRequestMessage*
        _deserializeCIMReferenceNamesRequestMessage(XmlParser& parser);

    static CIMGetPropertyRequestMessage*
        _deserializeCIMGetPropertyRequestMessage(XmlParser& parser);

    static CIMSetPropertyRequestMessage*
        _deserializeCIMSetPropertyRequestMessage(XmlParser& parser);

    static CIMInvokeMethodRequestMessage*
        _deserializeCIMInvokeMethodRequestMessage(XmlParser& parser);

    static CIMInitializeProviderRequestMessage*
        _deserializeCIMInitializeProviderRequestMessage(XmlParser& parser);

    static CIMInitializeProviderAgentRequestMessage*
        _deserializeCIMInitializeProviderAgentRequestMessage(XmlParser& parser);

    //
    // CIMIndicationRequestMessages
    //

    static CIMCreateSubscriptionRequestMessage*
        _deserializeCIMCreateSubscriptionRequestMessage(XmlParser& parser);

    static CIMModifySubscriptionRequestMessage*
        _deserializeCIMModifySubscriptionRequestMessage(XmlParser& parser);

    static CIMDeleteSubscriptionRequestMessage*
        _deserializeCIMDeleteSubscriptionRequestMessage(XmlParser& parser);

    //
    // Generic CIMRequestMessages
    //

    static CIMExportIndicationRequestMessage*
        _deserializeCIMExportIndicationRequestMessage(XmlParser& parser);

    static CIMProcessIndicationRequestMessage*
        _deserializeCIMProcessIndicationRequestMessage(XmlParser& parser);

    static CIMDisableModuleRequestMessage*
        _deserializeCIMDisableModuleRequestMessage(XmlParser& parser);

    static CIMEnableModuleRequestMessage*
        _deserializeCIMEnableModuleRequestMessage(XmlParser& parser);

    static CIMStopAllProvidersRequestMessage*
        _deserializeCIMStopAllProvidersRequestMessage(XmlParser& parser);

    static CIMNotifyConfigChangeRequestMessage*
        _deserializeCIMNotifyConfigChangeRequestMessage(XmlParser& parser);

    static CIMSubscriptionInitCompleteRequestMessage*
        _deserializeCIMSubscriptionInitCompleteRequestMessage
            (XmlParser& parser);

    //
    //
    // CIM Response Messages
    //
    //

    //
    // CIM Operation Response Messages
    //

    static CIMGetInstanceResponseMessage*
        _deserializeCIMGetInstanceResponseMessage(XmlParser& parser);

    static CIMDeleteInstanceResponseMessage*
        _deserializeCIMDeleteInstanceResponseMessage(XmlParser& parser);

    static CIMCreateInstanceResponseMessage*
        _deserializeCIMCreateInstanceResponseMessage(XmlParser& parser);

    static CIMModifyInstanceResponseMessage*
        _deserializeCIMModifyInstanceResponseMessage(XmlParser& parser);

    static CIMEnumerateInstancesResponseMessage*
        _deserializeCIMEnumerateInstancesResponseMessage(XmlParser& parser);

    static CIMEnumerateInstanceNamesResponseMessage*
        _deserializeCIMEnumerateInstanceNamesResponseMessage(XmlParser& parser);

    static CIMExecQueryResponseMessage*
        _deserializeCIMExecQueryResponseMessage(XmlParser& parser);

    static CIMAssociatorsResponseMessage*
        _deserializeCIMAssociatorsResponseMessage(XmlParser& parser);

    static CIMAssociatorNamesResponseMessage*
        _deserializeCIMAssociatorNamesResponseMessage(XmlParser& parser);

    static CIMReferencesResponseMessage*
        _deserializeCIMReferencesResponseMessage(XmlParser& parser);

    static CIMReferenceNamesResponseMessage*
        _deserializeCIMReferenceNamesResponseMessage(XmlParser& parser);

    static CIMGetPropertyResponseMessage*
        _deserializeCIMGetPropertyResponseMessage(XmlParser& parser);

    static CIMSetPropertyResponseMessage*
        _deserializeCIMSetPropertyResponseMessage(XmlParser& parser);

    static CIMInvokeMethodResponseMessage*
        _deserializeCIMInvokeMethodResponseMessage(XmlParser& parser);

    static CIMInitializeProviderResponseMessage*
        _deserializeCIMInitializeProviderResponseMessage(XmlParser& parser);

    static CIMInitializeProviderAgentResponseMessage*
        _deserializeCIMInitializeProviderAgentResponseMessage(
            XmlParser& parser);

    //
    // CIM Indication Response Messages
    //

    static CIMCreateSubscriptionResponseMessage*
        _deserializeCIMCreateSubscriptionResponseMessage(XmlParser& parser);

    static CIMModifySubscriptionResponseMessage*
        _deserializeCIMModifySubscriptionResponseMessage(XmlParser& parser);

    static CIMDeleteSubscriptionResponseMessage*
        _deserializeCIMDeleteSubscriptionResponseMessage(XmlParser& parser);

    //
    // Generic CIMResponseMessages
    //

    static CIMExportIndicationResponseMessage*
        _deserializeCIMExportIndicationResponseMessage(XmlParser& parser);

    static CIMProcessIndicationResponseMessage*
        _deserializeCIMProcessIndicationResponseMessage(XmlParser& parser);

    static CIMDisableModuleResponseMessage*
        _deserializeCIMDisableModuleResponseMessage(XmlParser& parser);

    static CIMEnableModuleResponseMessage*
        _deserializeCIMEnableModuleResponseMessage(XmlParser& parser);

    static CIMStopAllProvidersResponseMessage*
        _deserializeCIMStopAllProvidersResponseMessage(XmlParser& parser);

    static CIMNotifyConfigChangeResponseMessage*
        _deserializeCIMNotifyConfigChangeResponseMessage(XmlParser& parser);

    static CIMSubscriptionInitCompleteResponseMessage*
        _deserializeCIMSubscriptionInitCompleteResponseMessage
            (XmlParser& parser);

};

PEGASUS_NAMESPACE_END

#endif /* Pegasus_CIMMessageDeserializer_h */
