Difference between revisions of "AnalyticaLicenseInfo"

 
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Function AnalyticaLicenseInfo =
+
[[Category:System Functions]]
 +
[[Category: Analytica installation and licenses]]
 +
[[Category:Doc Status D]] <!-- For Lumina use, do not change -->
  
 
Returns information about the current Analyica user license.
 
Returns information about the current Analyica user license.
  
== Declaration ==
+
== AnalyticaLicenseInfo(item)==
 +
Returns information about the license code that Analytica is using, according to the value of  the «item» parameter.
  
AnalyticaLicenseInfo( item : text )
+
[[Syntax]]:
 +
:[[AnalyticaLicenseInfo]](item: Text)
  
where item can any of the following values:
+
Possible values of «item»:
* "Expiration": 0 if the current license has no expiration date.  Otherwise, returns an integer date, which can be formatted in Date number format to view the expiration date.
+
:<code>"Expiration"</code>: If the license has no expiration date, it returns 0.  Otherwise, it returns the date. The date is an integer, which you can format to display as a date using the Number format dialog. If the license is being roamed, then the date that roaming expires is returned (and the license's expiration is not available).
* "PurchaserID": A number identifying the organization that the license was issued to.
+
:<code>"PurchaserID"</code>: A number identifying the organization that the license was issued to.
* "UserID": A number indicating the user license within the organization.
+
:<code>"UserID"</code>: A number indicating the user ID; usually, the sequence order in which licenses were issued to the organization.  
* "Optimizer": True (1) or false(0), indicating whether the current license includes optimizer.
+
:<code>"Optimizer"</code>: True (1) or false(0), indicating whether the license includes the Analytica Optimizer.
* "Beta": True or false, indicating whether this license is for beta-testing.
+
:<code>"Beta"</code>: True or false, indicating whether the license is for a beta-test release.
* "Educational": True or false, indicating whether the current license is for academic use only.
+
:<code>"Educational"</code>: True or false, indicating whether the license is for educational use only.
 +
:<code>"x64"</code>: True (1) if the license allows use of the 64-bit edition.
 +
::This may be set if you are using Analytica or ADE 32-bit from a license that allows 64-bit use.  To test whether you are actually using the 64-bit edition, see [[AnalyticaPlatform]].
  
== See also ==
+
These provide access to the Reprise license components for the current license.  The Reprise user-guide describes these in greater detail, for those who are interested.
 +
:<code>"RlmLicense"</code>: The RLM product license name
 +
:<code>"type"</code>: Reprise license type.  May be "beta", "eval", "demo", or a comma-separated list of these.
 +
:<code>"Customer"</code>
 +
:<code>"Contract"</code>
 +
:<code>"HoldTimeSeconds"</code>
 +
:<code>"HostId"</code>
 +
:<code>"IssuedDate"</code>
 +
:<code>"Issuer"</code>
 +
:<code>"MaxRoamDays"</code>
 +
:<code>"MaxShare"</code>
 +
:<code>"MinCheckoutSeconds"</code>
 +
:<code>"NamedUserMinHours"</code>
 +
:<code>"NamedUserCount"</code>
 +
:<code>"Options"</code>
 +
:<code>"Platforms"</code>
 +
:<code>"RoamingStatus"</code>: 1 if the license is being roamed, 0 otherwise.
 +
:<code>"RlmServer"</code> : The host name, or port@host, of the RLM server (if using centralized license).
 +
:<code>"Share"</code>
 +
:<code>"SoftLimit"</code>
 +
:<code>"StartDate"</code>
 +
:<code>"TimeZone"</code>
 +
:<code>"Version"</code>
 +
:<code>"RlmLicenseStatus"</code>
 +
:<code>"RlmStatus"</code>
 +
:<code>"RlmErrorText"</code>
 +
:<code>"GoodOnce"</code>: Returns True if the license has ever been used successfully (i.e., will always be true since you are using it).
 +
 
 +
Finally, there are these calls for obtaining a license object:
 +
:<code>"Checkout:name,ver"</code> : Checkout a product license from a reprise server. (see below)
 +
:<code>"AsObject"</code> : Returns the Analytica license as a license object.
 +
 
 +
These return a license object that displays as «License».  This object can be passed as the second parameter to [[AnalyticaLicenseInfo]], in which case the above items can be used to examine the internal information for that «License» object.
 +
 
 +
== Checking Out Licenses ==
 +
The [[AnalyticaLicenseInfo]] can also be used to check out a particular license.  Models could do this to require that a user has a certain license in order to use a particular functionality within the model.  (These licenses must be digitally signed with Lumina's ISV digital signature, which is something only Lumina can do).  As with Reprise licenses in general, these licenses can be node-locked to a specific computer, or can be served from an RLM server and can even be floating licenses.
 +
 
 +
The item value of "checkout:..." does this.  When the item is "checkout", the item text itself should contain the word "checkout" followed by a colon, followed by the license name.  For example, the following would check out a license for the product Financial_tools version 1.2 (or earlier):
 +
 
 +
:<code>AnalyticaLicenseInfo("checkout:Financial_tools,1.2")</code>
 +
 
 +
When this succeeds, it returns a license object, which displays as «License».  When it fails, it halts execution with an error message text returned from the Reprise license manager.  When searching for the license, it searches first for <code>*.lic</code> files in the [[CurrentModelFolder]](), which means you can install <code>*.lic</code> files in the same directory as the model.  If not there, it looks next in the Analytica install directory, and finally on any RLM server used by Analytica.  Any <code>*.lic</code> file can also specify an RLM host as well using the HOST keyword (see Reprise documentation).  The license remains checked out as long as the «License» object lives (e.g., is cached in the result of a variable).
 +
 
 +
If you don't want a hard error to result, but just want to test whether the checkout was successful, you can include a third parameter to <code>"checkout"</code>.  Using <code>"1"</code> will return [[Null]] on unsuccessful checkout, while using <code>"2"</code> will return the actual reprise error text, e.g.:
 +
 
 +
:<code>AnalyticaLicenseInfo("checkout:Financial_tools,1.2,1) &rarr; «null»</code>
 +
:<code>AnalyticaLicenseInfo("checkout:Financial_tools,1.2,2) &rarr; "License server does not support this product (-18)"</code>
  
* AnalyticaVersion
+
There is another mechanism for using a Reprise license to protect a model's intellectual property, separate from the use of this function.  See [[Model Licensing]].
* AnalyticaPlatform
 
* AnalyticaEdition
 
  
 
== Uses: ==
 
== Uses: ==
 +
=== Anti-piracy of Models ===
 +
You can use this function to ensure that selected user-defined functions run only with Analytica licenses issued to your organization, or for a selected client company.  Embed this line in the function:
 +
 +
:<code>IF AnalyticaLicenseInfo("PurchaserID")<>3197</code>
 +
:<code>then Error("This model is only licensed to run at Acme Inc.");</code>
 +
:<code>{ function body follows }</code>
  
=== Anti-piracy of Models ===
+
Where 3197 is the purchaser ID for your or your client's organization.  Use "Hide Definition" (from the enterprise edition) and distribute a locked copy of the model, so other users cannot view or modify this code.
  
I am a consulting company, and want to ensure that certain user-defined functions only run on Analytica copies owned by my client. Thus, I embed this line in the function:
+
==Suggestions==
 +
Suggest that options "Release", "Platform", and "Edition" be added as possible parameter values for AnalyticaLicenseInfo, replacing need for the system variables AnalyticaVersion, AnalyticaPlatform, and AnalyticaEdition. Also, if given no parameter AnalyticaLicenseInfo() will return a table containing all license info, indexed by names of info types listed above.
  
  if AnalyticaLicenseInfo("PurchaserID")<>3197 then Error("This model is only licensed to run at Acme Inc.");
+
==History==
  { function body follows }
+
Introduced in [[What's new in Analytica 4.0?|Analytica 4.0]].
  
Where 3197 is my clients' purchaser ID.  I then use "Hide Definition" (from the enterprise edition) and distribute a locked copy of the model.
+
== See also ==
 +
* [[Installation and licenses]]
 +
* [[AnalyticaVersion]]
 +
* [[AnalyticaPlatform]]
 +
* [[AnalyticaEdition]]
 +
* [[CurrentModelFolder]]
 +
* [[Model Licensing]]

Latest revision as of 00:24, 17 March 2018


Returns information about the current Analyica user license.

AnalyticaLicenseInfo(item)

Returns information about the license code that Analytica is using, according to the value of the «item» parameter.

Syntax:

AnalyticaLicenseInfo(item: Text)

Possible values of «item»:

"Expiration": If the license has no expiration date, it returns 0. Otherwise, it returns the date. The date is an integer, which you can format to display as a date using the Number format dialog. If the license is being roamed, then the date that roaming expires is returned (and the license's expiration is not available).
"PurchaserID": A number identifying the organization that the license was issued to.
"UserID": A number indicating the user ID; usually, the sequence order in which licenses were issued to the organization.
"Optimizer": True (1) or false(0), indicating whether the license includes the Analytica Optimizer.
"Beta": True or false, indicating whether the license is for a beta-test release.
"Educational": True or false, indicating whether the license is for educational use only.
"x64": True (1) if the license allows use of the 64-bit edition.
This may be set if you are using Analytica or ADE 32-bit from a license that allows 64-bit use. To test whether you are actually using the 64-bit edition, see AnalyticaPlatform.

These provide access to the Reprise license components for the current license. The Reprise user-guide describes these in greater detail, for those who are interested.

"RlmLicense": The RLM product license name
"type": Reprise license type. May be "beta", "eval", "demo", or a comma-separated list of these.
"Customer"
"Contract"
"HoldTimeSeconds"
"HostId"
"IssuedDate"
"Issuer"
"MaxRoamDays"
"MaxShare"
"MinCheckoutSeconds"
"NamedUserMinHours"
"NamedUserCount"
"Options"
"Platforms"
"RoamingStatus": 1 if the license is being roamed, 0 otherwise.
"RlmServer" : The host name, or port@host, of the RLM server (if using centralized license).
"Share"
"SoftLimit"
"StartDate"
"TimeZone"
"Version"
"RlmLicenseStatus"
"RlmStatus"
"RlmErrorText"
"GoodOnce": Returns True if the license has ever been used successfully (i.e., will always be true since you are using it).

Finally, there are these calls for obtaining a license object:

"Checkout:name,ver" : Checkout a product license from a reprise server. (see below)
"AsObject" : Returns the Analytica license as a license object.

These return a license object that displays as «License». This object can be passed as the second parameter to AnalyticaLicenseInfo, in which case the above items can be used to examine the internal information for that «License» object.

Checking Out Licenses

The AnalyticaLicenseInfo can also be used to check out a particular license. Models could do this to require that a user has a certain license in order to use a particular functionality within the model. (These licenses must be digitally signed with Lumina's ISV digital signature, which is something only Lumina can do). As with Reprise licenses in general, these licenses can be node-locked to a specific computer, or can be served from an RLM server and can even be floating licenses.

The item value of "checkout:..." does this. When the item is "checkout", the item text itself should contain the word "checkout" followed by a colon, followed by the license name. For example, the following would check out a license for the product Financial_tools version 1.2 (or earlier):

AnalyticaLicenseInfo("checkout:Financial_tools,1.2")

When this succeeds, it returns a license object, which displays as «License». When it fails, it halts execution with an error message text returned from the Reprise license manager. When searching for the license, it searches first for *.lic files in the CurrentModelFolder(), which means you can install *.lic files in the same directory as the model. If not there, it looks next in the Analytica install directory, and finally on any RLM server used by Analytica. Any *.lic file can also specify an RLM host as well using the HOST keyword (see Reprise documentation). The license remains checked out as long as the «License» object lives (e.g., is cached in the result of a variable).

If you don't want a hard error to result, but just want to test whether the checkout was successful, you can include a third parameter to "checkout". Using "1" will return Null on unsuccessful checkout, while using "2" will return the actual reprise error text, e.g.:

AnalyticaLicenseInfo("checkout:Financial_tools,1.2,1) → «null»
AnalyticaLicenseInfo("checkout:Financial_tools,1.2,2) → "License server does not support this product (-18)"

There is another mechanism for using a Reprise license to protect a model's intellectual property, separate from the use of this function. See Model Licensing.

Uses:

Anti-piracy of Models

You can use this function to ensure that selected user-defined functions run only with Analytica licenses issued to your organization, or for a selected client company. Embed this line in the function:

IF AnalyticaLicenseInfo("PurchaserID")<>3197
then Error("This model is only licensed to run at Acme Inc.");
{ function body follows }

Where 3197 is the purchaser ID for your or your client's organization. Use "Hide Definition" (from the enterprise edition) and distribute a locked copy of the model, so other users cannot view or modify this code.

Suggestions

Suggest that options "Release", "Platform", and "Edition" be added as possible parameter values for AnalyticaLicenseInfo, replacing need for the system variables AnalyticaVersion, AnalyticaPlatform, and AnalyticaEdition. Also, if given no parameter AnalyticaLicenseInfo() will return a table containing all license info, indexed by names of info types listed above.

History

Introduced in Analytica 4.0.

See also

Comments


You are not allowed to post comments.