Symantec Management Platform (SMP) Community

 View Only
  • 1.  NS7 Custom Licensing

    Posted Mar 10, 2011 06:51 AM

    I am Trying to develop my own custom licensing model but I am unable to find an example online, I have followed instructions in the intergrating licensing article but unfortunately i still can not seem to get my solution to use my custom License.

    There was originally an example called Custom Licensing for NS7 on solutionSam but unfortunately it looks as if it has been removed.

    if possible could anyone point me in the right direction or send a small example to Paul.Nunn@protirus.com

    Thank You.



  • 2.  RE: NS7 Custom Licensing
    Best Answer

    Posted Mar 16, 2011 01:24 AM

    Please find the below additional information on custom licensing model.

     If a solution needs custom licensing , it will need to implement its own licensing policy, and inheriting from LicensingPolicy. A solution will have to override ConstructLicensingPolicyFromDetails in order to handle additional styles which must be defined to correspond with the new custom licensing. Call into the base to handle the default licensing policy styles.

     

    protected override Altiris.NS.Licensing.ILicensingPolicy ConstructLicensingPolicyFromDetails(Guid licensingPolicyId, string styleName, System.Xml.XPath.XPathNavigator licensingPolicyLoc)

            {

                if (styleName == "CustomInventoryBasedForInvSol")

                {

                    return new LicensingPolicyInventorySolution(licensingPolicyId, licensingPolicyLoc);

                }

                else

                {

                    return base.ConstructLicensingPolicyFromDetails(licensingPolicyId, styleName, licensingPolicyLoc);

                }

            }

     

    When a license check is required, the standard method is to obtain the instance of the licensing policy using LicensingPolicy.GetInstance(licensingPolicyGuid, solutionGuid) - the solutionGuid is needed so that when the licensing policy isn't currently cached we don't have to load up all the licensing policys for all products trying to find the one.

     

    Having acquired the licensing policy, the status should be checked, to ensure it is not either invalid or expired. The status may return either OK or Exceeded, which are both 'valid' states, the later being an indicator that the license has had its count reduced recently and so the current list of license uses exceeds the limit.

     

    The prefered model for checking licenses requires that you first filter the list of resources down to those which should have a license. The licensing policy does not provide a mechanism to do this, not even on the derived licensing policy types.

     

    Once the resources have been filtered as such, licensingPolicy.RequestLicense should be called for each resource. If a license has already been assigned to the requested resource, this function does nothing. If not and there are available licenses, the licenses in use will be updated (asynchronously) to correct the fact that the requested resource does not yet have a license. If there are no licenses available, an exception will be thrown.

     

     ILicensingPolicy policy = LicensingPolicy.GetInstance(licensingPolicyGuid, solutionGuid);

     if (policy == null)

     {

         // Handle the license not installed case

     }

     

     if (policy.Status == LicensePolicyStatus.Ok || policy.Status == LicensePolicyStatus.Exceeded)

     {

         try

         {

             // This will give a license use to this resource if one has not already been given and there are still license uses available.

             policy.RequestLicense(resourceGuid);

         }

         catch (LicenseExceededException)

         {

             // Handle the license exceeded case for the requested resource.

         }

     }

     else

     {

         // Handle the license expired or invalid case.

     }

     

    When displaying a page related to a resource it might be useful to display whether that resource is currently licensed. The IsInUseLicense method provides a mechanism for performing this check.

     

     ILicensingPolicy policy = LicensingPolicy.GetInstance(licensingPolicyGuid, solutionGuid);

     if (!policy.IsInUseLicense(resourceGuid))

     {

         // Report that the specified resource is currently not using a license.

     }

     else

     {

         // Report that the specified resource is currently using a license.

     }

     

    Please make sure that which type of licensing you required because there are 3 types of licensing 1. Server Based 2. Inventory Based and 3. Agent Based.

     

    Please refer the below links for the more detail.

     

    1. http://ali-mydev.altiris.com/Wiki/default.aspx/Altiris.NSCore/LicensingIntegration.html
    2. http://ali-mydev.altiris.com/Wiki/default.aspx/Altiris.NSCore/LicensingHierarchy.html
    3. http://ali-mydev.altiris.com/Wiki/default.aspx/Altiris.NSCore/Licensing%20Refactor.html


  • 3.  RE: NS7 Custom Licensing

    Posted Mar 24, 2011 05:54 AM

    Thanks for your reply,

     

    unfotunately I cannot access the links you have posted above could you possibly post them on here or make them public for me to view?

     

    Thanks

     

    Jonathan



  • 4.  RE: NS7 Custom Licensing

    Posted Mar 25, 2011 05:07 AM
      |   view attached

    Hi Jonathan,

     

    Please find the attachment [NS7CustomLicencing.doc] which contains the information from all the above mentioned links.

     

    Thanks,

    Dipak Jain

    Attachment(s)

    doc
    NS7CustomLicencing.doc   188 KB 1 version