Home arrow static arrow Java Programming [Archive] - How to control access to a class/function?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - How to control access to a class/function?
This topic has 9 replies on 1 page.

Posts:536
Registered: 6/29/03
How to control access to a class/function?  
Jul 30, 2004 6:32 AM



 
Hello, everyone!

I am writing a set of library level functions, so called SDK, for developers to use. Now I am meeting with a trouble, that is I only want licensed developers to use some specific public classes/public functions, in other words, I only want licensed Java client modules to have the ability to invoke some specific public classes/public functions, but as everyone knows, a public class/public function can be accessed by any external modules.

So how to confine the access of public classes/public functions so that only licensed developers can use my SDK to develop their applications? Any sample source codes or tutorials/papers can I make a reference?

Thanks in advance,
George

 

Posts:1,695
Registered: 1/13/04
Re: How to control access to a class/function?  
Jul 30, 2004 6:55 AM (reply 1 of 9)



 
If your SDK is good, no need to confine any access to it. Just write a good commercial license, make it appear in the SDK files and in the code,
and sell your SDK with this license agreement. Offer support and good prices for new versions to already 'licensed' users.

If your libraries are good, and the price reasonable, serious developers will buy them. My idea is that anyway, the others wouldn't buy it and would just
find a way (and there is ALWAYS one) to use it freely.

I did myself the buying effort for the excellent [url=http://www.japisoft.com/formula/]JFormula API[/url] - perhaps you could contact JAPISoft to obtain information about how to achieve your goals.

Regards.
 

Posts:536
Registered: 6/29/03
Re: How to control access to a class/function?  
Jul 30, 2004 11:20 PM (reply 2 of 9)



 
Thanks for your reply, Franck_Lefevre buddy!

I will follow your ideas. And I am still searching some valid source codes or tutorials which can achieve my goal.

Have a nice weekend,
George

 

Posts:536
Registered: 6/29/03
Re: How to control access to a class/function?  
Jul 31, 2004 8:19 PM (reply 3 of 9)



 
Can anyone help?

George

 

Posts:80
Registered: 12/7/98
Re: How to control access to a class/function?  
Aug 1, 2004 4:30 PM (reply 4 of 9)



 
You can implement some sort of license managed class loader.

At best it's a moderate deterrant, but if you're just trying to deter the casual software thief it might well work.

Like what you are doing, look around for some API's. Some of them offer nifty ways to "lock" a license to a particular host or operating environment, but since this is java most of these things can be easily spoofed....

Ahhh... I remember the 1980's when this was as simple as purchasing a box of dongles and coding a few lines in VB....
 

Posts:536
Registered: 6/29/03
Re: How to control access to a class/function?  
Aug 1, 2004 7:57 PM (reply 5 of 9)



 
Thanks, vikingsteve buddy!

Your idea is great! I am not familiar with this field. So can you introduce some APIs that I can make a reference? I really do not know what key words can be used to search and any tips about this kind of APIs.

Best regards,
George

 

Posts:648
Registered: 6/26/00
Re: How to control access to a class/function?  
Aug 1, 2004 8:44 PM (reply 6 of 9)



 
Many ways:
The first come in to mind, defined a parent class (ex. LicensedObject). In the constructor of it, do your license checking. If it failed, throw up an exception.
Then extend all of your classes require the license to this parent object.

Not to say this is unbreakable, just the most obvious programming way.

--
 

Posts:536
Registered: 6/29/03
Re: How to control access to a class/function?  
Aug 2, 2004 1:43 AM (reply 7 of 9)



 
Thanks, lichudang buddy!

I am not very familiar with licensing related APIs, can you introduce me some materials dealing with how to check license in a normal way?

Best regards,
George

 

Posts:426
Registered: 11/1/00
Re: How to control access to a class/function?  
Aug 2, 2004 4:46 PM (reply 8 of 9)



 
One person suggested a class loader customized. This makes great sense.

Otherwise, employ the Factory pattern and define all your working interfaces and ensure that users obtain separate implementations of said interfaces depending on some key or such that is passed to the Factory. This of course doesn't prevent things, but included with encryption at the class level and the custom class loader idea above, would deter most but the super savvy knowing how to intercept the system class loader and get the class definitions at runtime.
 

Posts:536
Registered: 6/29/03
Re: How to control access to a class/function?  
Aug 2, 2004 6:37 PM (reply 9 of 9)



 
Thanks, jensenje buddy!

I am very interested in your method. Are there any tutorials or sample codes that I can make a reference?

Best regards,
George

 
This topic has 9 replies on 1 page.