de.mid.innovator.srv
Class LicenseServer

java.lang.Object
  extended by de.mid.innovator.srv.LicenseServer
All Implemented Interfaces:
ILicensingService, INetworkInformationService

public class LicenseServer
extends Object
implements ILicensingService, INetworkInformationService

The class represents an Innovator license server that provides various information about running client and server programs. A license server acts as a name service to enable clients to find running servers. This means that one license server provides exactly one Innovator network which can be viewed with the Innovator client programs. An Innovator network consists of exactly one main license server and several project license servers (acting as clients to the main license server).

By default, all Innovator UNIX clients use the environment variable INOHOST to determine the Innovator network. On Windows platforms, the license server can be configured in the file inoenv.ini that can be found in the Windows system directory.

As the Innovator Java API uses pure Java code, it is 100% independent of this client configuration; this means that a Java process is free to talk to any license server that is available via TCP/IP connection.

Note: This class can be used to connect either to a project license server or to a main (enterprise) license server.

Author:
borschet

Nested Class Summary
static class LicenseServer.HostPortCombination
           
static class LicenseServer.License
           
 
Constructor Summary
LicenseServer()
          The default constructor that instantiates a license server object using the specific constructor with arguments (null,0)
LicenseServer(String lHost, int lPort)
          The constructor creates an instance that can be used to communicate with the Innovator license server.
 
Method Summary
 boolean canLogout(String repName, String mdlName)
           
 void connect()
          Deprecated. 
 void disconnect()
          Deprecated. 
 RepositoryServer findServer(String repName)
          Finds a specific running repository server.
 String getHost()
          Gets the license server's host name.
 String getHostId()
          Gets the host id.
 List<InoNetClient> getInnovatorClients()
          Returns a list of all known clients.
 int getLicenseCount(LicenseServer.License lic)
          Gets the total number of licenses of a given license type
 String getLicensee()
          Gets the licensee
 int getPort()
          Gets the license server's TCP/IP port.
 int getSerialNumber()
           
 List<RepositoryServer> getServerList()
          The method retrieves the complete list of repository servers known by this license server.
 EnumSet<ServerStatus> getServerStatus(String repName)
          The method returns a set of runtime status flags of the given repository server.
 InoUser getUser()
          Returns the info for the current system user.
 InoUser getUserInfo(String domain, String name)
          Deprecated. 
 List<InoUser> getUserList()
           
 List<LicSrvGetLoginListReplyTelegram.InoUserLogin> getUserLoginList()
           
 List<String> getUserRoleList(InoUser inoUser, String repName, String mdlName, K_ADMODEL mdlType)
           
 int getVersion()
          Retrieves the version of the license server.
 boolean isLicenseRegistered()
          Determines whether [is license registered]
 void lockLicense(LicenseServer.License license)
          Locks another license of given type.
 void registerLicense(String key)
          Registers a new obtained license.
 void registerProgram(InoProgram.Type progType)
           
 void sendLicenseFile(FileInputStream fs)
           
 void unregisterProgram()
           
 void updateConnection()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LicenseServer

public LicenseServer()
              throws InoNetException
The default constructor that instantiates a license server object using the specific constructor with arguments (null,0)

Throws:
InoNetException

LicenseServer

public LicenseServer(String lHost,
                     int lPort)
              throws InoNetException
The constructor creates an instance that can be used to communicate with the Innovator license server. A host and port can be entered if required to be used when connecting to or disconnecting from the license server.

Parameters:
lHost - optional; the host name as a TCP/IP host name String. If this argument is omitted, the value of the environment variable 'INOHOST' or the 'de.mid.innovator.inohost' system property is used.
lPort - optional; the port. It should be omitted if no host name is given.
Throws:
InoNetException
Method Detail

canLogout

public boolean canLogout(String repName,
                         String mdlName)

connect

@Deprecated
public void connect()
             throws InoNetException
Deprecated. 

Throws:
InoNetException

disconnect

@Deprecated
public void disconnect()
                throws InoNetException
Deprecated. 

Throws:
InoNetException

findServer

public RepositoryServer findServer(String repName)
                            throws InoNetException
Finds a specific running repository server.

Specified by:
findServer in interface INetworkInformationService
Parameters:
repName - the name of a repository server (without path or extension)
Returns:
an instance of RepositoryServer or null if no such server was found.
Throws:
InoNetException

getHost

public String getHost()
Gets the license server's host name.

Specified by:
getHost in interface INetworkInformationService
Returns:
host name as a String

getHostId

public String getHostId()
                 throws InoNetException
Description copied from interface: ILicensingService
Gets the host id.

Specified by:
getHostId in interface ILicensingService
Throws:
InoNetException

getInnovatorClients

public List<InoNetClient> getInnovatorClients()
                                       throws InoNetException
Returns a list of all known clients. The list contains every host that runs an Innovator application which has been registered at the current license server.

Specified by:
getInnovatorClients in interface INetworkInformationService
Returns:
A list of all Innovator network clients that are connected to the license server.
Throws:
InoNetException

getLicenseCount

public int getLicenseCount(LicenseServer.License lic)
                    throws InoNetException
Description copied from interface: ILicensingService
Gets the total number of licenses of a given license type. * The license. the number of licenses that can be used parallel

Specified by:
getLicenseCount in interface ILicensingService
Throws:
InoNetException

getLicensee

public String getLicensee()
                   throws InoNetException
Description copied from interface: ILicensingService
Gets the licensee. * a formatted string

Specified by:
getLicensee in interface ILicensingService
Throws:
InoNetException

getPort

public int getPort()
Gets the license server's TCP/IP port.

Specified by:
getPort in interface INetworkInformationService
Returns:
a port number

getSerialNumber

public int getSerialNumber()
                    throws InoNetException
Specified by:
getSerialNumber in interface ILicensingService
Throws:
InoNetException

getServerList

public List<RepositoryServer> getServerList()
                                     throws InoNetException
The method retrieves the complete list of repository servers known by this license server.

Specified by:
getServerList in interface INetworkInformationService
Returns:
a list of running server instances
Throws:
InoNetException
SrvErrorException

getServerStatus

public EnumSet<ServerStatus> getServerStatus(String repName)
                                      throws InoNetException
The method returns a set of runtime status flags of the given repository server.

Parameters:
repName - short name of a repository server
Returns:
the set of status values that can be checked with the members of the ServerStatus enumeration
Throws:
InoNetException

getUser

public InoUser getUser()
                throws InoNetException
Returns the info for the current system user.

Returns:
A list of all Innovator network clients that are connected to the license server.
Throws:
InoNetException

getUserInfo

@Deprecated
public InoUser getUserInfo(String domain,
                                      String name)
                    throws InoNetException
Deprecated. 

The method was removed for security reasons, please use getUser() to obtain your own login data or getUserList() to retrieve all possible users.

Throws:
InoNetException

getUserList

public List<InoUser> getUserList()
                          throws InoNetException
Throws:
InoNetException

getUserLoginList

public List<LicSrvGetLoginListReplyTelegram.InoUserLogin> getUserLoginList()
                                                                    throws InoNetException
Throws:
InoNetException

getUserRoleList

public List<String> getUserRoleList(InoUser inoUser,
                                    String repName,
                                    String mdlName,
                                    K_ADMODEL mdlType)
                             throws InoNetException
Throws:
InoNetException

getVersion

public int getVersion()
               throws InoNetException
Retrieves the version of the license server. The method explicitly sends a telegram to the license server to get the version number and caches its value for further calls.

Specified by:
getVersion in interface INetworkInformationService
Returns:
the license server version as an integer value
Throws:
InoNetException - for any network problems

isLicenseRegistered

public boolean isLicenseRegistered()
                            throws InoNetException
Description copied from interface: ILicensingService
Determines whether [is license registered]. * true if [is license registered]; otherwise, false.

Specified by:
isLicenseRegistered in interface ILicensingService
Throws:
InoNetException

lockLicense

public void lockLicense(LicenseServer.License license)
                 throws InoNetException
Description copied from interface: ILicensingService
Locks another license of given type. The type of the license to lock.

Specified by:
lockLicense in interface ILicensingService
Throws:
InoNetException

registerLicense

public void registerLicense(String key)
                     throws InoNetException
Description copied from interface: ILicensingService
Registers a new obtained license. The key.

Specified by:
registerLicense in interface ILicensingService
Throws:
InoNetException

registerProgram

public void registerProgram(InoProgram.Type progType)
                     throws InoNetException,
                            IllegalStateException
Specified by:
registerProgram in interface ILicensingService
Throws:
InoNetException
IllegalStateException

sendLicenseFile

public void sendLicenseFile(FileInputStream fs)
                     throws InoNetException,
                            IOException
Specified by:
sendLicenseFile in interface ILicensingService
Throws:
InoNetException
IOException

unregisterProgram

public void unregisterProgram()
                       throws InoNetException
Specified by:
unregisterProgram in interface ILicensingService
Throws:
InoNetException

updateConnection

public void updateConnection()
                      throws InoNetException,
                             IllegalStateException
Throws:
InoNetException
IllegalStateException