User f564ccf382
03-10-2005 17:39:46
To whom it concerns,
I have written a plugin (My_logPlugin) which extends the logPPlugin class. In the licenses.dat file which is stored at /root/.chemaxon I added the following:
chemaxon.marvin.calculations.My_logPlugin=27071966
In my class My_logPlugin I havethe code
My_logPlugin x = new My_logPlugin();
System.out.println("License key for My_logPlugin is :");
System.out.println(x.getLicenseKey());
But, I get an empty string returned instead of 27071966.
Could you please advise me as to what I'm doing wrong? Do I need a specific license key from ChemAxon for each of my own Plugins?
Kind regards,
Miriam
ChemAxon fb166edcbd
03-10-2005 22:48:15
This below applies to the current Marvin release, it will be much simpler in the next release (4.0.2).
First of all: you set the plugin license key within the code by overriding
Code: |
plugin.getLicenseKey()
|
as written in
http://www.chemaxon.com/marvin/doc/dev/plugins.html
and users set the key in the licenses.dat file which will be checked against the hard-coded license key.
Unfortunately if you extend an existing plugin class then you cannot change its license key, since the method plugin.getLicenseKey() is declared final for safety reasons.
To validate a plugin you should call
Code: |
plugin.validate(<license key>);
|
It is only after this call that the
Code: |
plugin.getLicenseKey()
|
method returns the real license key instead of the empty string.
However, as I have mentioned, the current implementation makes it impossible to subclass a plugin and change its license key (this would be possible by overriding its
getLicenseKey() method which is final) - since in this case it would be possible to
subclass a plugin only to change its license key.
The good news is that I have changed this mechanism - from the next release (4.0.2)
you should only override the
Code: |
plugin.validate(<license key>)
|
by a simple string comparison with the real key - but this validate() is still declared final for safety (otherwise someone could just subclass the plugin and change its validate() method only). I will think about a solution for this problem.
In the meantime, if you want to write a custom logP plugin with a separate license key then unfortunately you should subclass CalculatorPlugin directly and implement the getLicenseKey() (or validate() from the next rellease()) as written in
http://www.chemaxon.com/marvin/doc/dev/plugins.html
Then you can write code like:
Code: |
My_logPlugin x = new My_logPlugin();
x.validate("27071966");
System.out.println("License key for My_logPlugin is :");
System.out.println(x.getLicenseKey());
|
Then you will get "27071966" instead of the empty string.
PS: I will ask the approximate date for the Marvin 4.0.2 tomorrow.
User f564ccf382
04-10-2005 15:40:19
Hi Nora,
Thanks for all your help on the license issue. I would like to be able to use the classes Mass and MolHandler. But, I can't find them. Would it be possible for you to send them to me?
Regards,
Miiram
ChemAxon fb166edcbd
04-10-2005 17:08:34
ChemAxon fb166edcbd
06-10-2005 10:52:55