Package de.mid.innovator.srv
Class RepositoryServer
- java.lang.Object
-
- de.mid.innovator.client.InoProgram
-
- de.mid.innovator.srv.InoServerProgram
-
- de.mid.innovator.srv.RepositoryServer
-
- All Implemented Interfaces:
SrvContext
public class RepositoryServer extends InoServerProgram implements SrvContext
This class represents the Innovator repository server. A repository server recognizes its own license server and keeps an up-to-date list of the models contained in it. Note: an instance of this class is different from the server proxy element of the ADRepository type. To obtain this instance, callgetADRepository()
if connected to the server.A repository server extends a general purpose server program class that provides different kinds of data through the license server requests. The implementation of the interface SrvContext is needed to realize a uniform way to call helper methods, either using a connected server instance or an object of the class model.
- Author:
- borschet
- See Also:
ADRepository
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.mid.innovator.client.InoProgram
InoProgram.Type
-
-
Constructor Summary
Constructors Constructor Description RepositoryServer(LicenseServer aLicenseServer, int pid, int procStatus, java.lang.String vers, java.lang.String host, java.lang.String user, de.mid.innovator.srv.LicSrvGetSrvPrjListReplyTelegram.SrvConData srvConData, java.util.List<Model> modelLst)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect()
Connects to a running Innovator repository server if not yet connected.Model
createModel(java.lang.String name, K_ADMODEL modelType, java.lang.String newAdminPwd, java.lang.String userCfg, java.lang.String modelCfg, java.util.List<java.lang.String> addOnList)
Creates a newModel
in the actual repository server and refreshes the list of models.void
disconnect()
Disconnects from the repository server.boolean
equals(SrvContext obj)
Compares this server object to an SrvContext implementer.ADRepository
getADRepository()
Gets the repository server proxy element.java.lang.String
getCommandSequenceId()
java.lang.String
getCommandSequenceName()
ExcellenceModel
getExcellenceModel(java.lang.String aModelName, K_ADMODEL aModelType)
Gets a model with the given name and type from the list of currently known models.java.lang.String
getFullName()
Gets the name of the repository server (which is equal to the directory name where the server stores all data).LicenseServer
getLicenseServer()
Gets the license server object which the repository server periodically contacts.SrvLogin
getLogin()
Implements the method fromSrvContext
Model
getModel(java.lang.String aModelName, K_ADMODEL aModelType)
Gets a model with the given name and type from the list of currently known models.java.util.List<Model>
getModels()
Gets the complete list of known models.java.util.List<Model>
getModels(K_ADMODEL aModelType)
Searches the list of currently known models in this server for models of the given type.java.lang.String
getName()
Gets the name of the repository server (which is equal to the directory name where the server stores all data).SrvConnection
getSrvConnection()
Implements the method fromSrvContext
java.util.EnumSet<ServerStatus>
getStatus()
boolean
hasLogin()
Checks whether a previous successful administrator login was performed.void
logout()
Logs out from the repository server if still logged-in, otherwise nothing will be done.void
modifyPassword(java.lang.String oldPass, java.lang.String newPass)
Modifies the repository server's administration password.void
refresh()
Synchronizes this server object's model list with the actual state known by the license server.void
repositoryAdminLogin(java.lang.String pwd)
Authenticates the user credentials for administration purposes; this is carried out by the repository server.void
shutdown(boolean force)
java.lang.String
toString()
boolean
userHasAdminPrivileges()
boolean
userHasVersionPrivileges()
-
Methods inherited from class de.mid.innovator.srv.InoServerProgram
getStatusFlags
-
Methods inherited from class de.mid.innovator.client.InoProgram
getHost, getPid, getProgramType, getUser, getVers
-
-
-
-
Constructor Detail
-
RepositoryServer
public RepositoryServer(LicenseServer aLicenseServer, int pid, int procStatus, java.lang.String vers, java.lang.String host, java.lang.String user, de.mid.innovator.srv.LicSrvGetSrvPrjListReplyTelegram.SrvConData srvConData, java.util.List<Model> modelLst)
-
-
Method Detail
-
getLicenseServer
public LicenseServer getLicenseServer()
Gets the license server object which the repository server periodically contacts.- Returns:
- the server's license server object
-
getName
public java.lang.String getName()
Gets the name of the repository server (which is equal to the directory name where the server stores all data).
-
getFullName
public java.lang.String getFullName()
Gets the name of the repository server (which is equal to the directory name where the server stores all data).
-
getSrvConnection
public SrvConnection getSrvConnection()
Implements the method fromSrvContext
- Specified by:
getSrvConnection
in interfaceSrvContext
- Returns:
- information needed to connect to a repository server
-
getLogin
public SrvLogin getLogin()
Implements the method fromSrvContext
- Specified by:
getLogin
in interfaceSrvContext
- Returns:
- the current login or null if not logged-in
-
hasLogin
public boolean hasLogin()
Checks whether a previous successful administrator login was performed.- Returns:
- true, if there is an ADLogin to be queried with
getLogin()
, otherwise false
-
getStatus
public java.util.EnumSet<ServerStatus> getStatus() throws InoNetException
- Throws:
InoNetException
-
getModel
public Model getModel(java.lang.String aModelName, K_ADMODEL aModelType)
Gets a model with the given name and type from the list of currently known models. This is done without any server communication and may not be up-to-date. Use therefresh()
method to synchronize this server object with the current state.- Parameters:
aModelName
- the name of the Innovator modelaModelType
- the type of model- Returns:
- a model object if found, otherwise null.
-
getExcellenceModel
public ExcellenceModel getExcellenceModel(java.lang.String aModelName, K_ADMODEL aModelType)
Gets a model with the given name and type from the list of currently known models. This is done without any server communication and may not be up-to-date. Use therefresh()
method to synchronize this server object with the current state.- Parameters:
aModelName
- the name of the Innovator eXcellence modelaModelType
- the type of eXcellence model- Returns:
- a model object if found, otherwise null.
-
getModels
public java.util.List<Model> getModels(K_ADMODEL aModelType)
Searches the list of currently known models in this server for models of the given type. The model list may not be synchronized. Userefresh()
to keep it up-to-date.- Parameters:
aModelType
- the type of model- Returns:
- a list of models or an empty list if none are found
- See Also:
getModel(String, K_ADMODEL)
-
getModels
public java.util.List<Model> getModels()
Gets the complete list of known models. The model list may not be synchronized. Userefresh()
to keep it up-to-date.- Returns:
- a list of model objects or an empty list if this server has no models
-
refresh
public void refresh() throws InoNetException
Synchronizes this server object's model list with the actual state known by the license server. The Innovator license server needs to be communicated with to get the correct data.- Throws:
InoNetException
- if a network error occurs.
-
connect
public void connect() throws InoNetException
Connects to a running Innovator repository server if not yet connected. As a side effect, the repository server proxy object is received; this provides direct server access. The service is carried out by a contained object of the SrvConnection type that handles all TCP/IP network information.- Throws:
InoNetException
- if a network error occurs.- See Also:
SrvConnection
-
disconnect
public void disconnect() throws InoNetException
Disconnects from the repository server. The method should be called once for every call made toconnect()
. This enables the repository server to finish the corresponding connection.- Throws:
InoNetException
- if a network error occurs.
-
userHasAdminPrivileges
public boolean userHasAdminPrivileges() throws InoNetException
- Throws:
InoNetException
-
userHasVersionPrivileges
public boolean userHasVersionPrivileges() throws InoNetException
- Throws:
InoNetException
-
repositoryAdminLogin
public void repositoryAdminLogin(java.lang.String pwd) throws InoNetException, SrvErrorException
Authenticates the user credentials for administration purposes; this is carried out by the repository server.- Parameters:
pwd
- the repository server's administration password- Throws:
InoNetException
- if a network error occurs.SrvErrorException
- if invalid data has been sent to this server.- See Also:
logout()
-
logout
public void logout() throws InoNetException, SrvErrorException
Logs out from the repository server if still logged-in, otherwise nothing will be done.- Throws:
InoNetException
- if a network error occurs.SrvErrorException
- if invalid data has been sent to this server.- See Also:
repositoryAdminLogin(String)
-
modifyPassword
public void modifyPassword(java.lang.String oldPass, java.lang.String newPass) throws InoNetException, SrvErrorException
Modifies the repository server's administration password.- Parameters:
oldPass
- old password (plain text)newPass
- new password (plain text)- Throws:
InoNetException
- if a network error occurs.SrvErrorException
- if invalid data has been sent to this server.
-
createModel
public Model createModel(java.lang.String name, K_ADMODEL modelType, java.lang.String newAdminPwd, java.lang.String userCfg, java.lang.String modelCfg, java.util.List<java.lang.String> addOnList) throws InoNetException, SrvErrorException
Creates a newModel
in the actual repository server and refreshes the list of models.- Parameters:
name
- the name of the new modelmodelType
- the kind of modelnewAdminPwd
- the administrator's password for the new model or nulluserCfg
- the name of a valid user configuration or nullmodelCfg
- the name of a valid model configuration or nulladdOnList
- a list of add-ons which need to be loaded or null- Returns:
- the created model object
- Throws:
InoNetException
- if a network error occurs.SrvErrorException
- if invalid data has been sent to this server.java.lang.IllegalArgumentException
- if the given model type is different to K_ADMODEL.UML
-
equals
public boolean equals(SrvContext obj)
Compares this server object to an SrvContext implementer. If the object to be compared with is an instance of the RepositoryServer class, the two server instances are declared to be equal if they point to the same Innovator server. Otherwise the objects are not equal.This method implements
SrvContext.equals(SrvContext)
- Specified by:
equals
in interfaceSrvContext
- See Also:
SrvContext
,Model.equals(SrvContext)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classInoServerProgram
-
getADRepository
public ADRepository getADRepository()
Gets the repository server proxy element.- Returns:
- an ADRepository object, if connected to the server, otherwise null.
-
getCommandSequenceId
public java.lang.String getCommandSequenceId()
- Specified by:
getCommandSequenceId
in interfaceSrvContext
-
getCommandSequenceName
public java.lang.String getCommandSequenceName()
- Specified by:
getCommandSequenceName
in interfaceSrvContext
-
shutdown
public void shutdown(boolean force)
-
-