A Data Provider Plugin has two classes.
One CDPDataProviderFactory and one CDPDataProvider. The host will instantiate the factory once (usually at startup), and use the factory to determine if a given modelKey is supported by the plugin or not.
The factory is only created once per process, and usually kept until the app/server closes.
The factory has two roles:
Provide information about the associated data provider and check if a modelKey is supported by the provider.
Create and destroy the associated data provider.
inline virtual ~CDPDataProviderFactory()
virtual bool getProviderInfo(CDPDataProviderInfo *info) = 0
Gets information about the provider produced by this factory.
Populate the info object with information relevant to your provider.
virtual bool isSupportedByProvider(const CDPString &modelKey) = 0
Checks if the given modelKey is supported by the data providers produced by this factory.
In this method you need to check if the incoming modelKey points to a resource that your provider can read.
Returns true if the modelKey is supported, false if it is not.
virtual CDPDataProvider *createProviderInstance() = 0
Creates and returns an instance of the data provider associated with this factory.
Creates and returns the new instance. The instance is managed by the host, but it will be deleted with the destroyProviderInstance() method to ensure that it is allocated and deleted with the same heap manager.
virtual void destroyProviderInstance(CDPDataProvider *instance) = 0
Destroys the given data provider.
This method will be called whenever the host is done with the use of the data provider. The provider passed to this method will always have been allocated with createProviderInstance() in the same factory. This is to ensure that it is allocated and deleted with the same heap manager.