Class InnovatorBatchLoginDefault
- java.lang.Object
-
- de.mid.innovator.ui.InnovatorBatchLoginDefault
-
public class InnovatorBatchLoginDefault extends java.lang.Object
The class realizes a uniform method which logs a user into a model when starting an application from the command line (batch).The class uses command line arguments to collect the information needed to perform a successful login. The arguments must be given in the form "key=value" (no spaces before or after the equals sign are allowed, see
Property
). The class is used byInnovatorApplicationDefault
which means that every application that extends InnovatorApplicationDefault can be run from the command line using the following arguments:Table for command line arguments Key Default value Description de.mid.innovator.inohost The INOHOST environment variable value Determines the Innovator license server name and port to be used, e.g. de.mid.innovator.inohost=inoserver.9000
de.mid.innovator.server No default value! This argument is required. This option determines the name of the repository server to work with. de.mid.innovator.model (Empty) Sets the name of the Innovator model to login to. If no model is given, the class will not try to perform a user login to a model but will attempt to perform an administration login with the repository server. de.mid.innovator.modelType INOX Sets the Innovator model type. The values must be valid members of the enumeration K_ADMODEL
.de.mid.innovator.login.noLogin Default value is false. This option prevents the class from logging-in. Neither server login nor model login is performed. If this option is set to true
, all arguments concerning login information are obsolete.de.mid.innovator.login.user The current user name that is registered with the VM. You can enter a valid Innovator user name which the requested repository server recognizes. de.mid.innovator.login.asAdmin Default value is false. Tries to login as model or repository administrator. If this value is true, the above given user name is used for information purposes only. An administrator login is restricted to one display at a time. This means that all further administrator login requests are discarded until the administrator has been logged-out of a different display. de.mid.innovator.login.type Default value is User. Performs a user login, guest login or group login. The values must be valid members of the K_LOGINKIND
enumeration.de.mid.innovator.login.pwd (Empty) Specifies your password as a clear text string value. de.mid.innovator.login.role If empty, the server tries to use the role from a former login. Uses the given role performing a login. - Author:
- borschet
-
-
Constructor Summary
Constructors Constructor Description InnovatorBatchLoginDefault()
The default constructor which creates its own (private) PropertyProvider.InnovatorBatchLoginDefault(PropertyProvider propProvider)
Creates a BatchLoginDefault object which uses the given PropertyProvider.InnovatorBatchLoginDefault(java.lang.String[] args)
Creates a BatchLoginDefault instance with its own (private) PropertyProvider and initializes it with the command line arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getInoHost()
Gets the INOHOST string which determines the license server's IP name and its listener port separated by a colon.Model
getModel()
Gets the model object that can be determined by the given properties.RepositoryServer
getRepositoryServer()
Gets the RepositoryServer object from the values given in the command line.boolean
login()
Performs a login according to the given properties.
-
-
-
Constructor Detail
-
InnovatorBatchLoginDefault
public InnovatorBatchLoginDefault()
The default constructor which creates its own (private) PropertyProvider.
-
InnovatorBatchLoginDefault
public InnovatorBatchLoginDefault(java.lang.String[] args) throws UnknownArgumentException
Creates a BatchLoginDefault instance with its own (private) PropertyProvider and initializes it with the command line arguments. The arguments are checked against the known arguments and if any arguments exist that are not in the above list of properties, an UnknownArgumentException is thrown.- Parameters:
args
- The command line arguments from the main method.- Throws:
UnknownArgumentException
-
InnovatorBatchLoginDefault
public InnovatorBatchLoginDefault(PropertyProvider propProvider)
Creates a BatchLoginDefault object which uses the given PropertyProvider. The method adds the property and returns without checking its input arguments. Initialization of the PropertyProvider is the caller's responsibility.- Parameters:
propProvider
- an uninitialized PropertyProvider object
-
-
Method Detail
-
getRepositoryServer
public RepositoryServer getRepositoryServer() throws InoNlsException
Gets the RepositoryServer object from the values given in the command line. If necessary, the instance is created and all information required is queried from the license server or other properties.- Returns:
- a repository server object
- Throws:
InoNlsException
-
getModel
public Model getModel() throws InoNlsException
Gets the model object that can be determined by the given properties. If necessary, the instance is created during the first call.- Returns:
- an instance of the Model class
- Throws:
InoNlsException
-
getInoHost
public java.lang.String getInoHost() throws InoNetException, InvalidArgumentException
Gets the INOHOST string which determines the license server's IP name and its listener port separated by a colon. This value should be equal to the environment variable INOHOST (Unix) or the INOHOST entry in the inoenv.ini file (Windows).- Returns:
- a string (such as inohost.mid.de.9000)
- Throws:
InoNetException
InvalidArgumentException
-
login
public boolean login() throws InoNlsException
Performs a login according to the given properties. If a model was specified, a model login will be performed. If this is not the case, an administrator login is carried out for the repository server. In this case,getModel()
will return null. After this method is successfully called, either a repository login or a model login can be obtained. UseModel.getLogin()
to get the model login orRepositoryServer.getLogin()
to get the repository login.If a user is already logged-in to a model, e.g. with other Innovator clients, the method performs a re-login: This means that it fetches all data that is needed to access the server and uses the same authorization. The method returns false, which indicates that you should not log this user out; if this was not the case case, other applications would run into trouble.
This is not how you should try to log-in as administrator.
- Returns:
- true, if a login was performed; false, if the user has already logged-in
- Throws:
InoNlsException
-
-