You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

194 lines
7.7 KiB

/*==================================================================================================
Copyright (c) 2007 UGS
Unpublished - All rights reserved
====================================================================================================
File description:
Filename: BusinessObjectRegistry.hxx
Module : metaframework
This is the interface class to handle all the business object registration
and module initializer registration.
====================================================================================================
Date Name Description of Change
$HISTORY$
==================================================================================================*/
#ifndef BUSINESSOBJECTREGISTRY_HXX
#define BUSINESSOBJECTREGISTRY_HXX
#include <unidefs.h>
#include <string>
#include <vector>
#include <tccore/FeatureKeyCheck.hxx>
#include <base_utils/ScopedPtr.hxx>
#include <base_utils/ScopedSmPtr.hxx>
#include <metaframework/CreateInput.hxx>
#include <metaframework/SaveAsInput.hxx>
#include <metaframework/ReviseInput.hxx>
#include <metaframework/RuntimeBusinessObject.hxx>
#include <tc/Fnd0BaseProvider.hxx>
#include <metaframework/libmetaframework_exports.h>
#define OPERATIONINPUT_CREATE "Create"
#define OPERATIONINPUT_REVISE "Revise"
#define OPERATIONINPUT_SAVEAS "SaveAs"
#define OPERATIONINPUT_DEEPCOPYDATA "DeepCopyData"
#define OPERATIONINPUT_ANY "OperationInput"
#define OPERATIONINPUT_BULKINPUT "BulkInput"
namespace Teamcenter
{
class OperationInput;
class CreateInput;
class SaveAsInput;
class ReviseInput;
class BulkInput;
class BulkData;
class BusinessObjectRegistry;
class RootObject;
class BusinessObject;
class RuntimeBusinessObject;
class BusinessObjectTagManager;
struct BusinessObjectRegEntry;
typedef RootObject* (*BusinessObjectConstructor)();
typedef int (*BusinessObjectInitializer)();
typedef int (*BusinessObjectPropFnRegister)();
}
class METAFRAMEWORK_API Teamcenter::BusinessObjectRegistry
{
public:
// get singleton object
static BusinessObjectRegistry& instance();
// given a object tag, get the object
virtual RootObject* getObject( tag_t objTag ) = 0;
// load the object
virtual BusinessObject* load( tag_t objTag ) = 0;
// regisiter business object constructor and initializer
virtual void initializeRegister( const std::string& name,
BusinessObjectConstructor ctr,
BusinessObjectInitializer initilaizer = 0,
BusinessObjectInitializer reinitilaizer = 0,
BusinessObjectInitializer uninitilaizer = 0 ) = 0;
// initialize a business object by name.
virtual int initialize( const std::string& boName ) = 0;
// delete the operation input object
virtual void deleteInputObject( OperationInput* input ) = 0;
// create a BusinessObject by name
virtual RootObject* createBusinessObject( const std::string& name ) = 0;
virtual BusinessObject* createBusinessObject( CreateInput* pCreateInput ) = 0;
virtual int createBusinessObjects( std::vector< Teamcenter::BulkInput* >* inputs, Teamcenter::BulkData* bd ) = 0;
virtual OperationInput* createInputObject( const std::string& strBOName, const std::string& strOperationInputName ) = 0;
//create a Shadow BusinessObject
virtual BusinessObject* createShadowBusinessObject( CreateInput* pCreateInput ) = 0;
//property related registration
virtual int initializePropertyFnRegister( const std::string& boName, BusinessObjectPropFnRegister propFnRegister ) = 0;
// load library
virtual void registerLoadedLibrary( const std::string& libName ) = 0;
//license registry handling
virtual int registerFeatureKey( const std::string& BOname, FeatureKeyCheck* authorFeatureKey, FeatureKeyCheck* consumerFeatureKey = NULL ) = 0;
virtual int getAuthorFeatureKey( BusinessObjectRegEntry* regEntry, FeatureKeyCheck** featureKey, bool& didCheckedLic, int& checkLicResult ) const = 0;
virtual int getConsumerFeatureKey( BusinessObjectRegEntry* regEntry, FeatureKeyCheck** featureKey, bool& didCheckedLic, int& checkLicResult ) const = 0;
virtual int updateAuthorFeatureKeyStatus( BusinessObjectRegEntry* regEntry, int checkLicResult ) = 0;
virtual int updateConsumerFeatureKeyStatus( BusinessObjectRegEntry* regEntry, int checkLicResult ) = 0;
virtual int checkAuthorLicense( const std::string& BOname, int& checkLicResult ) = 0;
virtual int checkConsumerLicense( const std::string& BOname, int& checkLicResult ) = 0;
// delete a BusinessObject
virtual void deleteObject( RootObject* obj ) = 0;
/**
Loads the libraries required by all extenders defined for the given business object
during extender object initialization.
*/
virtual void loadBusinessObjectExtenderLibrary( const std::string& boName ) = 0;
/**
Initializes all the extender objects for the type and operation.
*/
virtual void initializeExtenderBO( tag_t typeTag, int operationIdInteger ) = 0;
protected:
// constructor
BusinessObjectRegistry();
// destructor
virtual ~BusinessObjectRegistry();
};
namespace Teamcenter
{
template <> struct scoped_ptr_default_deallocator < CreateInput >
{
void operator()(CreateInput* bucket) { BusinessObjectRegistry::instance().deleteInputObject(bucket); }
};
template <> struct scoped_ptr_default_deallocator < SaveAsInput >
{
void operator()(SaveAsInput* bucket) { BusinessObjectRegistry::instance().deleteInputObject(bucket); }
};
template <> struct scoped_ptr_default_deallocator < ReviseInput >
{
void operator()(ReviseInput* bucket) { BusinessObjectRegistry::instance().deleteInputObject(bucket); }
};
template <> struct scoped_ptr_default_deallocator < RuntimeBusinessObject >
{
void operator()(RuntimeBusinessObject* bucket) { BusinessObjectRegistry::instance().deleteObject(bucket); }
};
template <> struct scoped_ptr_default_deallocator < Fnd0BaseProvider >
{
void operator()(Fnd0BaseProvider * bucket) { BusinessObjectRegistry::instance().deleteObject(bucket); }
};
template <> struct scoped_ptr_default_deallocator < OperationInput >
{
void operator()(OperationInput * bucket) { BusinessObjectRegistry::instance().deleteInputObject(bucket); }
};
template <> struct scoped_smptr_my_deallocator < CreateInput >
{
void operator() (CreateInput* bucket) { BusinessObjectRegistry::instance().deleteInputObject(bucket); }
};
template <> struct scoped_smptr_my_deallocator < SaveAsInput >
{
void operator() (SaveAsInput* bucket) { BusinessObjectRegistry::instance().deleteInputObject(bucket); }
};
template <> struct scoped_smptr_my_deallocator < ReviseInput >
{
void operator() (ReviseInput* bucket) { BusinessObjectRegistry::instance().deleteInputObject(bucket); }
};
template <> struct scoped_smptr_my_deallocator < RuntimeBusinessObject >
{
void operator() (RuntimeBusinessObject* bucket) { BusinessObjectRegistry::instance().deleteObject(bucket); }
};
template <> struct scoped_smptr_my_deallocator < Fnd0BaseProvider >
{
void operator() (Fnd0BaseProvider* bucket) { BusinessObjectRegistry::instance().deleteObject(bucket); }
};
template <> struct scoped_smptr_my_deallocator < OperationInput >
{
void operator() (OperationInput* bucket) { BusinessObjectRegistry::instance().deleteInputObject(bucket); }
};
}
#include <metaframework/libmetaframework_undef.h>
#endif //BUSINESSOBJECTREGISTRY__HXX