Package de.mid.innovator.srv
Class LicenseServer
- java.lang.Object
-
- de.mid.innovator.srv.LicenseServer
-
- All Implemented Interfaces:
ILicensingService
,INetworkInformationService
public class LicenseServer extends java.lang.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
Nested Classes Modifier and Type Class Description static class
LicenseServer.HostPortCombination
static class
LicenseServer.License
-
Constructor Summary
Constructors Constructor Description LicenseServer()
The default constructor that instantiates a license server object using the specific constructor with arguments (null,0)LicenseServer(java.lang.String lHost, int lPort)
The constructor creates an instance that can be used to communicate with the Innovator license server.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canLogout(java.lang.String repName, java.lang.String mdlName)
LicSrvUserChkMdlAdminReplyTelegram.SsoMdlUserData
chkMdlAdmin(InoUser user, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType)
Returns a flag if repository admin login is allowed.LicSrvUserChkRepAdminReplyTelegram.SsoUserData
chkVersAdmin(InoUser user, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType)
Returns a flag if repository admin login is allowed.LicSrvUserChkMdlAdminReplyTelegram.SsoMdlUserData
chkVersMdlAdmin(InoUser user, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType, java.lang.String versName)
Returns a flag if repository admin login is allowed.RepositoryServer
findServer(java.lang.String repName)
Finds a specific running repository server.java.lang.String
getHost()
Gets the license server's host name.java.lang.String
getHostId()
Gets the host id.java.util.List<InoNetClient>
getInnovatorClients()
Returns a list of all known clients.java.lang.String
getInohost()
int
getLicenseCount(LicenseServer.License lic)
Gets the total number of licenses of a given license type.java.lang.String
getLicensee()
Gets the licensee.java.lang.String
getMainInohost()
int
getPort()
Gets the license server's TCP/IP port.int
getSerialNumber()
java.util.List<RepositoryServer>
getServerList()
The method retrieves the complete list of repository servers known by this license server.java.util.EnumSet<ServerStatus>
getServerStatus(java.lang.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.java.lang.String
getUserJWT()
java.util.List<InoUser>
getUserList()
java.util.List<de.mid.innovator.srv.LicSrvGetLoginListReplyTelegram.InoUserLogin>
getUserLoginList()
java.util.List<java.lang.String>
getUserRoleList(InoUser inoUser, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType)
java.util.List<java.lang.String>
getUserVersRoleList(InoUser inoUser, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType, java.lang.String versName)
int
getVersion()
Retrieves the version of the license server.boolean
hasEnvironRight(InoUser user)
Returns a flag if configuration of environments is allowed.boolean
isLicenseRegistered()
Determines whether [is license registered].void
lockLicense(LicenseServer.License license)
Locks another license of given type.void
registerLicense(java.lang.String key)
Registers a new obtained license.void
registerProgram(InoProgram.Type progType)
void
sendLicenseFile(java.io.FileInputStream fs)
static void
setProgramType(InoProgram.Type type)
void
unregisterProgram()
void
updateConnection()
-
-
-
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(java.lang.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
-
setProgramType
public static void setProgramType(InoProgram.Type type)
-
getHost
public java.lang.String getHost()
Gets the license server's host name.- Specified by:
getHost
in interfaceINetworkInformationService
- Returns:
- host name as a String
-
getPort
public int getPort()
Gets the license server's TCP/IP port.- Specified by:
getPort
in interfaceINetworkInformationService
- Returns:
- a port number
-
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 interfaceINetworkInformationService
- Returns:
- the license server version as an integer value
- Throws:
InoNetException
- for any network problems
-
getSerialNumber
public int getSerialNumber() throws InoNetException
- Specified by:
getSerialNumber
in interfaceILicensingService
- Throws:
InoNetException
-
registerProgram
public void registerProgram(InoProgram.Type progType) throws InoNetException, java.lang.IllegalStateException
- Specified by:
registerProgram
in interfaceILicensingService
- Throws:
InoNetException
java.lang.IllegalStateException
-
unregisterProgram
public void unregisterProgram() throws InoNetException
- Specified by:
unregisterProgram
in interfaceILicensingService
- Throws:
InoNetException
-
updateConnection
public void updateConnection() throws InoNetException, java.lang.IllegalStateException
- Throws:
InoNetException
java.lang.IllegalStateException
-
lockLicense
public void lockLicense(LicenseServer.License license) throws InoNetException
Description copied from interface:ILicensingService
Locks another license of given type.- Specified by:
lockLicense
in interfaceILicensingService
- Parameters:
license
- The type of the license to lock.- Throws:
InoNetException
-
findServer
public RepositoryServer findServer(java.lang.String repName) throws InoNetException
Finds a specific running repository server.- Specified by:
findServer
in interfaceINetworkInformationService
- 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
-
getServerList
public java.util.List<RepositoryServer> getServerList() throws InoNetException
The method retrieves the complete list of repository servers known by this license server.- Specified by:
getServerList
in interfaceINetworkInformationService
- Returns:
- a list of running server instances
- Throws:
InoNetException
-
getServerStatus
public java.util.EnumSet<ServerStatus> getServerStatus(java.lang.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
-
getInnovatorClients
public java.util.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 interfaceINetworkInformationService
- Returns:
- A list of all Innovator network clients that are connected to the license server.
- 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
-
getUserJWT
public java.lang.String getUserJWT() throws InoNetException
- Throws:
InoNetException
-
getUserList
public java.util.List<InoUser> getUserList() throws InoNetException
- Throws:
InoNetException
-
getUserLoginList
public java.util.List<de.mid.innovator.srv.LicSrvGetLoginListReplyTelegram.InoUserLogin> getUserLoginList() throws InoNetException
- Throws:
InoNetException
-
getUserRoleList
public java.util.List<java.lang.String> getUserRoleList(InoUser inoUser, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType) throws InoNetException
- Throws:
InoNetException
-
getUserVersRoleList
public java.util.List<java.lang.String> getUserVersRoleList(InoUser inoUser, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType, java.lang.String versName) throws InoNetException
- Throws:
InoNetException
-
chkMdlAdmin
public LicSrvUserChkMdlAdminReplyTelegram.SsoMdlUserData chkMdlAdmin(InoUser user, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType) throws InoNetException
Returns a flag if repository admin login is allowed. The information has to be used for the connect- Returns:
- A list of all Innovator network clients that are connected to the license server.
- Throws:
InoNetException
-
chkVersMdlAdmin
public LicSrvUserChkMdlAdminReplyTelegram.SsoMdlUserData chkVersMdlAdmin(InoUser user, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType, java.lang.String versName) throws InoNetException
Returns a flag if repository admin login is allowed. The information has to be used for the connect- Returns:
- A list of all Innovator network clients that are connected to the license server.
- Throws:
InoNetException
-
chkVersAdmin
public LicSrvUserChkRepAdminReplyTelegram.SsoUserData chkVersAdmin(InoUser user, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType) throws InoNetException
Returns a flag if repository admin login is allowed. The information has to be used for the connect- Returns:
- A list of all Innovator network clients that are connected to the license server.
- Throws:
InoNetException
-
hasEnvironRight
public boolean hasEnvironRight(InoUser user) throws InoNetException
Returns a flag if configuration of environments is allowed.- Returns:
- Has the right to configure environments.
- Throws:
InoNetException
-
getHostId
public java.lang.String getHostId() throws InoNetException
Description copied from interface:ILicensingService
Gets the host id.- Specified by:
getHostId
in interfaceILicensingService
- Throws:
InoNetException
-
getMainInohost
public java.lang.String getMainInohost() throws InoNetException
- Throws:
InoNetException
-
getInohost
public java.lang.String getInohost() throws InoNetException
- Throws:
InoNetException
-
getLicensee
public java.lang.String getLicensee() throws InoNetException
Description copied from interface:ILicensingService
Gets the licensee.- Specified by:
getLicensee
in interfaceILicensingService
- Returns:
- a formatted string
- Throws:
InoNetException
-
canLogout
public boolean canLogout(java.lang.String repName, java.lang.String mdlName)
-
isLicenseRegistered
public boolean isLicenseRegistered() throws InoNetException
Description copied from interface:ILicensingService
Determines whether [is license registered].- Specified by:
isLicenseRegistered
in interfaceILicensingService
- Returns:
- true if [is license registered]; otherwise false
- Throws:
InoNetException
-
registerLicense
public void registerLicense(java.lang.String key) throws InoNetException
Description copied from interface:ILicensingService
Registers a new obtained license.- Specified by:
registerLicense
in interfaceILicensingService
- Parameters:
key
- The key.- Throws:
InoNetException
-
sendLicenseFile
public void sendLicenseFile(java.io.FileInputStream fs) throws InoNetException, java.io.IOException
- Specified by:
sendLicenseFile
in interfaceILicensingService
- Throws:
InoNetException
java.io.IOException
-
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.- Specified by:
getLicenseCount
in interfaceILicensingService
- Parameters:
lic
- The license.- Returns:
- the number of licenses that can be used parallel
- Throws:
InoNetException
-
-