(file) Return to EmbeddedServer.h CVS log (file) (dir) Up to [Pegasus] / pegasus / vxworks / cimserver

File: [Pegasus] / pegasus / vxworks / cimserver / Attic / EmbeddedServer.h (download)
Revision: 1.1.2.2, Thu Jul 17 18:46:23 2008 UTC (15 years, 11 months ago) by mike
Branch: TASK-PEP305_VXWORKS-branch
CVS Tags: TASK-PEP305_VXWORKS-2008-10-23
Changes since 1.1.2.1: +10 -81 lines
PEP#: 305
TITLE: VxWorks Port

DESCRIPTION: Ongoing VxWorks porting

//%2006////////////////////////////////////////////////////////////////////////
//
// 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.
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; Symantec 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.
//
//==============================================================================
//
//%/////////////////////////////////////////////////////////////////////////////

#ifndef Pegasus_EmbeddedServer_h
#define Pegasus_EmbeddedServer_h

#include <Pegasus/Common/Config.h>
#include <Pegasus/Common/String.h>
#include <Pegasus/Common/CIMName.h>

PEGASUS_NAMESPACE_BEGIN

typedef class CIMProvider* (*PegasusCreateProviderEntryPoint)(const String&);

/** This module defines a class EmbeddedServer that provides functions for
    defining the setup of embedded servers where the providers are statically
    defined and the pegasus memory-resident CIM repository is used.
    See PEP 305 and the embeddedsystembuild readmes for more detailed
    information.
*/
class EmbeddedServer
{
public:

    static const Uint32 INSTANCE_PROVIDER_TYPE;
    static const Uint32 ASSOCIATION_PROVIDER_TYPE;
    static const Uint32 INDICATION_PROVIDER_TYPE;
    static const Uint32 METHOD_PROVIDER_TYPE;
    static const Uint32 INSTANCE_QUERY_PROVIDER_TYPE;

    /** Constructor.
    */
    EmbeddedServer();

    /** Destructor.
    */
    virtual ~EmbeddedServer();

    /** This method is called once the repository is initialized. Provider
        modules should be registered from this function.
    */
    virtual void initialize();

    /** Load the repository. The derived class may optionally override and
        implement this function; otherwise, this function takes no action.
        The #data# parameter must point to memory obtained with malloc()
        and will be passed to free() after it is consumed.
        @param data array of bytes representing the repository.
    */
    virtual void loadRepository(Array<Uint8>& data);

    /** Save the repository. The derived class may optionally override and
        implement this function; otherwise, this function takes no action.
        @param data array of bytes representing the repository.
    */
    virtual void saveRepository(const Array<Uint8>& data);

    /** Put a record into the log. The derived class may optionally override
        and implement this function; otherwise, this function takes no action.
        @param type log type (1=TRACE, 2=STANDARD, 3=AUDIT, 4=ERROR, 5=DEBUG).
        @param system name of system performing log.
        @param level log level (1=TRACE, 2=INFO, 3=WARNING, 4=SEVERE, 5=FATAL).
        @param message the localized log message.
    */
    virtual void putLog(
        int type,
        const char* system,
        int level,
        const char* message);

    /** Authenticate the given user. This implementation returns true (allows
        any user to access the server). The derived class should override this
        function.
    */
    virtual bool authenticate(const char* user, const char* password);

    /** Add a namespace to the meta-repository.
        @param nameSpace pointer to generated namespace to be added.
        @return true if successful.
    */
    Boolean addNameSpace(const struct SchemaNameSpace* nameSpace);

    /** Shortcut for registering a PG_ProviderModule instance, a PG_Provider
        instance, and a PG_ProviderCapabilities instance for the special
        case in which there is one provider per module (a "singleton provider").
    */
    Boolean registerProvider(
        const Array<CIMNamespaceName>& nameSpaces,
        const CIMName& className,
        Uint32 providerTypes);

    /** Register the provider entry point for the given Pegasus provider.
    */
    Boolean registerPegasusProviderEntryPoint(
        const String& location,
        class CIMProvider* (*entryPoint)(const String&));

    /** Register the PegasusCreateProvider function.
    */
    Boolean registerPegasusCreateProviderEntryPoint(
        PegasusCreateProviderEntryPoint entryPoint);

    /** Register an SLP service.
    */
    bool registerSLPService(unsigned short port, bool https);

    /** Run the cimserver. This function returns when the server is shut down.
        @param argc
        @param argv
        @return false if server generated an exception.
    */
    Boolean run(int argc, char** argv);


private:

    EmbeddedServer(const EmbeddedServer&);
    EmbeddedServer& operator=(const EmbeddedServer&);

    // Create PG_ProviderModule instance.
    Boolean _create_PG_ProviderModule(
        const String& moduleName,
        const String& location);

    // Create PG_Provider instance.
    Boolean _create_PG_Provider(
        const String& moduleName,
        const String& providerName);

    // Create PG_ProviderCapabilities instance.
    Boolean _create_PG_ProviderCapabilities(
        const String& moduleName,
        const String& providerName,
        const String& capabilityId,
        const CIMName& className,
        const Array<CIMNamespaceName>& nameSpaces,
        Uint32 providerTypes);

    // Opaque implementation state data.
    char _opaque[128];
    friend struct EmbeddedServerRep;

    // Whether the "StaticProviderModule" PG_ProviderModule instances has been
    // created.
    bool _createdStaticProviderModule;
};

PEGASUS_NAMESPACE_END

#endif // Pegasus_EmbeddedServer_h

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2