Class 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, call getADRepository() 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:
MID
See Also:
  • Constructor Details

    • RepositoryServer

      public RepositoryServer(LicenseServer aLicenseServer, int pid, int procStatus, String vers, String host, String user, de.mid.innovator.srv.LicSrvGetSrvPrjListReplyTelegram.SrvConData srvConData, List<Model> modelLst)
      Also for JNI
      Parameters:
      aLicenseServer -
      pid -
      procStatus -
      vers -
      host -
      user -
      srvConData -
      modelLst -
  • Method Details

    • getLicenseServer

      public LicenseServer getLicenseServer()
      Gets the license server object which the repository server periodically contacts.
      Returns:
      the server's license server object
    • getName

      public String getName()
      Gets the name of the repository server (which is equal to the directory name where the server stores all data).
    • getFullName

      public 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 from SrvContext
      Specified by:
      getSrvConnection in interface SrvContext
      Returns:
      information needed to connect to a repository server
    • getLogin

      public SrvLogin getLogin()
      Implements the method from SrvContext
      Specified by:
      getLogin in interface SrvContext
      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
    • isSingleSignOn

      public boolean isSingleSignOn() throws InoNetException
      Throws:
      InoNetException
    • isVersionModel

      public boolean isVersionModel() throws InoNetException
      Throws:
      InoNetException
    • getStatus

      public EnumSet<ServerStatus> getStatus() throws InoNetException
      Throws:
      InoNetException
    • getModel

      public Model getModel(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 the refresh() method to synchronize this server object with the current state.
      Parameters:
      aModelName - the name of the Innovator model
      aModelType - the type of model
      Returns:
      a model object if found, otherwise null.
    • getExcellenceModel

      public ExcellenceModel getExcellenceModel(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 the refresh() method to synchronize this server object with the current state.
      Parameters:
      aModelName - the name of the Innovator eXcellence model
      aModelType - the type of eXcellence model
      Returns:
      a model object if found, otherwise null.
    • getModels

      public 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. Use refresh() 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:
    • getModels

      public List<Model> getModels()
      Gets the complete list of known models. The model list may not be synchronized. Use refresh() 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:
    • disconnect

      public void disconnect() throws InoNetException
      Disconnects from the repository server. The method should be called once for every call made to connect(). 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(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

      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:
    • modifyPassword

      public void modifyPassword(String oldPass, 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(String name, K_ADMODEL modelType, String newAdminPwd, String userCfg, String modelCfg, List<String> addOnList) throws InoNetException, SrvErrorException
      Creates a new Model in the actual repository server and refreshes the list of models.
      Parameters:
      name - the name of the new model
      modelType - the kind of model
      newAdminPwd - the administrator's password for the new model or null
      userCfg - the name of a valid user configuration or null
      modelCfg - the name of a valid model configuration or null
      addOnList - 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.
      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 interface SrvContext
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class InoServerProgram
    • getADRepository

      public ADRepository getADRepository()
      Gets the repository server proxy element.
      Returns:
      an ADRepository object, if connected to the server, otherwise null.
    • getCommandSequenceId

      public String getCommandSequenceId()
      Specified by:
      getCommandSequenceId in interface SrvContext
    • getCommandSequenceName

      public String getCommandSequenceName()
      Specified by:
      getCommandSequenceName in interface SrvContext
    • shutdown

      public void shutdown(boolean force)