TLicense ProviderSession

TLicenseProviderSession is an abstract base class that models the association between a TLicenseUse and a license provider. A TLicenseProviderSession derived class object is constructed by calling TLicenseProvider::CreateSession.

      class TLicenseProviderSession: public MReferenceCounted {
      //    Copyright (C) 1995 Taligent, Inc. All rights reserved.
      public:
          //.................................................................
          //  Destructor.
          virtual         ~TLicenseProviderSession()
      
          //.................................................................
          //  TLicenseProviderSession specific operations.
          virtual void    GetNumberOfUnits(TLicenseUnit& target) const;
          virtual void    ConsumeUnits    (TLicenseUnit unitsToConsume);
          virtual void    Allocate        (TLicenseUnit unitsRequested,
                                          TCollectionOf<TProviderOperation>&
                                              operations) = 0;
          virtual void    ExecuteOperations(
                                          TCollectionOf<TProviderOperation>&
                                              operations);
      protected:
          //.................................................................
          //  Constructors and restricted operations for abstract class.
                          TLicenseProviderSession();
          virtual void    SetNumberOfUnits(const TLicenseUnit& units);
      
      private:
      };

Instantiation

The
TLicenseProviderSession is an abstract base class and cannot be instantiated. The license provider must supply a derived class implementation.

Member functions

GetNumberOfUnits gets the number of licensing units available in the session. This function is called by the Licensing framework to evaluate whether it is time to allocate additional units to the session.

ConsumeUnits consumes a number of licensing units. This function is called by the Licensing framework to inform the session that a number of units have been consumed by the licensed product.

Allocate is called by the Licensing framework to request licensing units from the license provider. The number of units requested is supplied by the Licensing framework, along with a collection containing TProviderOperation objects that the product requires the license provider to execute. For more information about provider operations, see Chapter 2, "Client API," and "Provider operation mechanism" on page 154.

The TLicenseProviderSession derived class must call SetNumberOfUnits to update the number of licensing units available to the session after Allocate succeeds. Allocate returns a value of Void and should throw a TLicenseException for all error conditions. For more information about licensing exceptions, see "Licensing exceptions" on page 162.

SetNumberOfUnits sets the number of licensing units available to the session. This function is called by the TLicenseProviderSession derived class to update the number of available licensing units as a result of an Allocate call.

ExecuteOperations is called by the Licensing framework to forward a set of operations from the licensed product for the license provider to execute. TLicenseUse::ExecuteOperations simply forwards these operations on to the provider's session. The session should execute as many of the operations as possible.

If the license provider does not want to support provider-specific extensions or out-of-band execution of standard operations, it can simply not implement the ExecuteOperations member function in its derived class of TLicenseProviderSession.

NOTE In the current release, the only such operation is the TBasicChallenge.

Deriving classes

All license providers must derive this abstract base class and provide an implementation for their class. The Allocate function is a pure virtual function that must be implemented.

Concurrency

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

Resource use

TLicenseProviderSession objects are created through a call to their associated TLicenseProvider::CreateSession function. The storage associated with an instance of TLicenseProviderSession becomes the responsibility of the caller.


[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