TLicenseProvider

TLicenseProvider is an abstract base class that is derived by each of the framework implementations.

      class TLicenseProvider : public MCollectible, public MReferenceCounted {
      //    Copyright (C) 1995 Taligent, Inc. All rights reserved.
      public:
          //.................................................................
          //  destructor
          virtual         ~TLicenseProvider();
          
          //.................................................................
          //  MCollectible overrides.
          virtual Boolean IsEqual         (const MCollectible*) const;
          virtual TStream&operator>>=   (TStream& toWhere) const;
          virtual TStream&operator<<=     (TStream& fromWhere);
          
          //.................................................................
          //  TLicenseProvider specific operations.
          virtual void    GetProviderProduct(TLicenseProduct&
                                          theProviderProduct) const;
          virtual TLicenseProviderSession*
                          CreateSession   (const TLicenseProduct& prod) = 0;
          static void     GetProviderIterator(TDeleterFor<TIteratorOver<
                                          TLicenseProvider> >& iterator);
          void            FlattenForDistribution(TStream& stream) const;
          void            FlattenForDistribution(const TPathName& pathName)
                                                          const;
          
      protected:
          //.................................................................
          //  Constructors and restricted operations for abstract class.
                              TLicenseProvider();
                              TLicenseProvider(const TLicenseProduct&);
      
      };

Instantiation

TLicenseProvider is an abstract base class and cannot be instantiated. The license provider must supply a derived class implementation. To support the storage management within the Licensing framework, TLicenseProvider descends from both MCollectible and MReferenceCounted.

Member functions

GetProviderProduct returns a TLicenseProduct object that represents the license provider product. This function is called by the Licensing framework to query the TLicenseProvider derived class for its product information.

CreateSession is a pure virtual function that is called by the Licensing framework to create a TLicenseProviderSession derived class object to communicate with this license provider. Each license provider derived class is required to provide an implementation for this function. The implementation should create a dynamically allocated instance of its corresponding TLicenseProviderSession derived class. The Licensing framework adopts the object and assumes responsibility for the storage.

CreateSession is supplied by TLicenseProduct& identifying the licensed product that initiated the TLicenseUse::Check. This identification information is eventually used by the provider's session to look up the activation key on the provider's licensing server.

GetProviderIterator gets an iterator object that can be used to traverse the collection of TLicenseProvider objects. The collection is maintained in a TCollectionOf derivative that is an unordered set.

FlattenForDistribution is used at the development site of the licensing technology provider to create the filed TLicenseProvider object that must be distributed along with the provider's executable shared library. FlattenForDistribution eventually results in the global ::Flatten function being invoked on the object, which in turn calls the streaming function operator >>=.

The overloaded FlattenForDistribution function that takes a TPathName& is usually used. However, in some cases, you might not want to publish this provider by allowing the Licensing framework to place it in the standard location for filed objects; for example, the associated implementation might be unstable. In such a case, the variant that takes a TStream& can be used.

Deriving classes

All licensing server providers derive the TLicenseProvider abstract base class and provide an implementation for their class. The CreateSession function is a pure virtual function and must be implemented.

Concurrency

All threads are synchronized inside of the licensing framework so that the license provider need not worry about concurrency issues.

Resource use

The TLicenseProvider objects are loaded at initialization time through a call to LoadLicenseProviders. Once loaded the TLicenseProvider objects are never destroyed. Periodically, LoadLicenseProviders check the license directory for new flattened provider objects. These new objects are resurrected and added to the collection of providers.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker