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 voidconnect()Connects to a running Innovator repository server if not yet connected.ModelcreateModel(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 newModelin the actual repository server and refreshes the list of models.voiddisconnect()Disconnects from the repository server.booleanequals(SrvContext obj)Compares this server object to an SrvContext implementer.ADRepositorygetADRepository()Gets the repository server proxy element.java.lang.StringgetCommandSequenceId()java.lang.StringgetCommandSequenceName()ExcellenceModelgetExcellenceModel(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.StringgetFullName()Gets the name of the repository server (which is equal to the directory name where the server stores all data).LicenseServergetLicenseServer()Gets the license server object which the repository server periodically contacts.SrvLogingetLogin()Implements the method fromSrvContextModelgetModel(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.StringgetName()Gets the name of the repository server (which is equal to the directory name where the server stores all data).SrvConnectiongetSrvConnection()Implements the method fromSrvContextjava.util.EnumSet<ServerStatus>getStatus()booleanhasLogin()Checks whether a previous successful administrator login was performed.voidlogout()Logs out from the repository server if still logged-in, otherwise nothing will be done.voidmodifyPassword(java.lang.String oldPass, java.lang.String newPass)Modifies the repository server's administration password.voidrefresh()Synchronizes this server object's model list with the actual state known by the license server.voidrepositoryAdminLogin(java.lang.String pwd)Authenticates the user credentials for administration purposes; this is carried out by the repository server.voidshutdown(boolean force)java.lang.StringtoString()booleanuserHasAdminPrivileges()booleanuserHasVersionPrivileges()-
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:
getSrvConnectionin interfaceSrvContext- Returns:
- information needed to connect to a repository server
-
getLogin
public SrvLogin getLogin()
Implements the method fromSrvContext- Specified by:
getLoginin 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 InoNetExceptionSynchronizes 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 InoNetExceptionConnects 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 InoNetExceptionDisconnects 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, SrvErrorExceptionAuthenticates 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, SrvErrorExceptionLogs 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, SrvErrorExceptionModifies 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 newModelin 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:
equalsin interfaceSrvContext- See Also:
SrvContext,Model.equals(SrvContext)
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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:
getCommandSequenceIdin interfaceSrvContext
-
getCommandSequenceName
public java.lang.String getCommandSequenceName()
- Specified by:
getCommandSequenceNamein interfaceSrvContext
-
shutdown
public void shutdown(boolean force)
-
-