au.com.hardlight.lm
Class Manager

java.lang.Object
  |
  +--au.com.hardlight.lm.Manager

public final class Manager
extends java.lang.Object

This package attempts to allow only as many application instances to run as there are licence keys. It will not allow the same key to be used multiple times on the same machine.

This is probably not useful for standalone apps, but makes licencing per Web Context possible in servlet environments etc, even if its the same application.

It may not work on all platforms and it may not reliably work across multiple simultaneous different JVM's

its aim is to keep the honest users honest.

This package can be used pretty much in conjunction with any licencing tool.

it does not attempt to manage or verify licences as such, but rather to monitor the number of times a single licence is used simultaneously on any given machine.

Useage Overview

import au.com.hardlight.lm;

Manager mn=new Manager("licence.key");
mn.getLicenceStatus();

test if current licence is valid.
if (mn.getStrLicenced().equals(mn.getLicenceStatus())) { YAY };

mn.verify();
mn.Close();//free's current licence slot
mn=null;//this will also free current licence slot but only when gc cleans it up.

Author:
Jason Eacott

Constructor Summary
Manager(java.lang.String keyname)
           
Manager(java.lang.String keyname, int maxInstanceCount)
           
Manager(java.lang.String keyname, java.lang.String NameSpace)
           
Manager(java.lang.String keyname, java.lang.String NameSpace, int maxInstanceCount)
           
 
Method Summary
 java.lang.Object clone()
           
 void close()
          Close this object
Has an immediate effect, and should be called before destruction.
free's the slot for this licence key.
 java.lang.String getLicenceKey()
           
 java.lang.String getLicenceStatus()
           
 java.lang.String getNameSpace()
           
 java.lang.String getStrLicenced()
           
 java.lang.String getStrUnlicenced()
           
 java.lang.String verify()
           verifies and returns the current licenceStatus.
if licenseStatus is currently "unlicenced" then this method will reaquire a licence slot if it can.
use getLicenceStatus() if you just want to check current status.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Manager

public Manager(java.lang.String keyname)
        throws java.lang.Exception
Parameters:
keyname - any unique String, but should be different for each legally run copy of an application.
Throws:
java.lang.Exception

Manager

public Manager(java.lang.String keyname,
               int maxInstanceCount)
        throws java.lang.Exception
Parameters:
keyname - any unique String, but should be different for each legally run copy of an application.
maxInstanceCount - sets the maximum number of simultaneous allowances for this key.
Throws:
java.lang.Exception

Manager

public Manager(java.lang.String keyname,
               java.lang.String NameSpace)
        throws java.lang.Exception
Parameters:
keyname - any unique String, but should be different for each legally run copy of an application.
NameSpace -
Throws:
java.lang.Exception

Manager

public Manager(java.lang.String keyname,
               java.lang.String NameSpace,
               int maxInstanceCount)
        throws java.lang.Exception
Parameters:
keyname - any unique String, but should be different for each legally run copy of an application.
NameSpace -
maxInstanceCount - sets the maximum number of simultaneous allowances for this key.
Throws:
java.lang.Exception
Method Detail

getLicenceKey

public final java.lang.String getLicenceKey()
Returns:
Returns a clone of the LicenceKey String.

getLicenceStatus

public final java.lang.String getLicenceStatus()
Returns:
Returns the licenceStatus.

getStrLicenced

public final java.lang.String getStrLicenced()
Returns:
Returns the String representing a valid Licence. eg 'licenced'

getStrUnlicenced

public final java.lang.String getStrUnlicenced()
Returns:
Returns the String representing an invalid Licence. eg 'unlicenced'

getNameSpace

public final java.lang.String getNameSpace()
Returns:
Returns the current nameSpace.

close

public final void close()
Close this object
Has an immediate effect, and should be called before destruction.
free's the slot for this licence key.


verify

public final java.lang.String verify()

verifies and returns the current licenceStatus.
if licenseStatus is currently "unlicenced" then this method will reaquire a licence slot if it can.
use getLicenceStatus() if you just want to check current status.

if you use this method AFTER you have called Close() (which is legal) you should call Close() again.

See Also:
getLicenceStatus(), close()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
java.lang.CloneNotSupportedException