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 classLicenseServer.HostPortCombinationstatic classLicenseServer.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 booleancanLogout(java.lang.String repName, java.lang.String mdlName)LicSrvUserChkMdlAdminReplyTelegram.SsoMdlUserDatachkMdlAdmin(InoUser user, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType)Returns a flag if repository admin login is allowed.LicSrvUserChkRepAdminReplyTelegram.SsoUserDatachkVersAdmin(InoUser user, java.lang.String repName, java.lang.String mdlName, K_ADMODEL mdlType)Returns a flag if repository admin login is allowed.LicSrvUserChkMdlAdminReplyTelegram.SsoMdlUserDatachkVersMdlAdmin(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.RepositoryServerfindServer(java.lang.String repName)Finds a specific running repository server.java.lang.StringgetHost()Gets the license server's host name.java.lang.StringgetHostId()Gets the host id.java.util.List<InoNetClient>getInnovatorClients()Returns a list of all known clients.java.lang.StringgetInohost()intgetLicenseCount(LicenseServer.License lic)Gets the total number of licenses of a given license type.java.lang.StringgetLicensee()Gets the licensee.java.lang.StringgetMainInohost()intgetPort()Gets the license server's TCP/IP port.intgetSerialNumber()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.InoUsergetUser()Returns the info for the current system user.java.lang.StringgetUserJWT()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)intgetVersion()Retrieves the version of the license server.booleanhasEnvironRight(InoUser user)Returns a flag if configuration of environments is allowed.booleanisLicenseRegistered()Determines whether [is license registered].voidlockLicense(LicenseServer.License license)Locks another license of given type.voidregisterLicense(java.lang.String key)Registers a new obtained license.voidregisterProgram(InoProgram.Type progType)voidsendLicenseFile(java.io.FileInputStream fs)static voidsetProgramType(InoProgram.Type type)voidunregisterProgram()voidupdateConnection()
-
-
-
Constructor Detail
-
LicenseServer
public LicenseServer() throws InoNetExceptionThe 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 InoNetExceptionThe 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:
getHostin interfaceINetworkInformationService- Returns:
- host name as a String
-
getPort
public int getPort()
Gets the license server's TCP/IP port.- Specified by:
getPortin interfaceINetworkInformationService- Returns:
- a port number
-
getVersion
public int getVersion() throws InoNetExceptionRetrieves 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:
getVersionin interfaceINetworkInformationService- Returns:
- the license server version as an integer value
- Throws:
InoNetException- for any network problems
-
getSerialNumber
public int getSerialNumber() throws InoNetException- Specified by:
getSerialNumberin interfaceILicensingService- Throws:
InoNetException
-
registerProgram
public void registerProgram(InoProgram.Type progType) throws InoNetException, java.lang.IllegalStateException
- Specified by:
registerProgramin interfaceILicensingService- Throws:
InoNetExceptionjava.lang.IllegalStateException
-
unregisterProgram
public void unregisterProgram() throws InoNetException- Specified by:
unregisterProgramin interfaceILicensingService- Throws:
InoNetException
-
updateConnection
public void updateConnection() throws InoNetException, java.lang.IllegalStateException- Throws:
InoNetExceptionjava.lang.IllegalStateException
-
lockLicense
public void lockLicense(LicenseServer.License license) throws InoNetException
Description copied from interface:ILicensingServiceLocks another license of given type.- Specified by:
lockLicensein 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:
findServerin interfaceINetworkInformationService- Parameters:
repName- the name of a repository server (without path or extension)- Returns:
- an instance of
RepositoryServeror 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:
getServerListin 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
ServerStatusenumeration - 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:
getInnovatorClientsin 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 InoNetExceptionDescription copied from interface:ILicensingServiceGets the host id.- Specified by:
getHostIdin 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 InoNetExceptionDescription copied from interface:ILicensingServiceGets the licensee.- Specified by:
getLicenseein interfaceILicensingService- Returns:
- a formatted string
- Throws:
InoNetException
-
canLogout
public boolean canLogout(java.lang.String repName, java.lang.String mdlName)
-
isLicenseRegistered
public boolean isLicenseRegistered() throws InoNetExceptionDescription copied from interface:ILicensingServiceDetermines whether [is license registered].- Specified by:
isLicenseRegisteredin interfaceILicensingService- Returns:
- true if [is license registered]; otherwise false
- Throws:
InoNetException
-
registerLicense
public void registerLicense(java.lang.String key) throws InoNetExceptionDescription copied from interface:ILicensingServiceRegisters a new obtained license.- Specified by:
registerLicensein interfaceILicensingService- Parameters:
key- The key.- Throws:
InoNetException
-
sendLicenseFile
public void sendLicenseFile(java.io.FileInputStream fs) throws InoNetException, java.io.IOException- Specified by:
sendLicenseFilein interfaceILicensingService- Throws:
InoNetExceptionjava.io.IOException
-
getLicenseCount
public int getLicenseCount(LicenseServer.License lic) throws InoNetException
Description copied from interface:ILicensingServiceGets the total number of licenses of a given license type.- Specified by:
getLicenseCountin interfaceILicensingService- Parameters:
lic- The license.- Returns:
- the number of licenses that can be used parallel
- Throws:
InoNetException
-
-