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:
    borschet
    See Also:
    ADRepository
    • 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)  
    • 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).
      • 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
      • 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 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​(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 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 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. 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:
        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. 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:
        SrvConnection
      • 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.
      • 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()
      • 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 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.
        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 interface SrvContext
        See Also:
        SrvContext, Model.equals(SrvContext)
      • getADRepository

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

        public void shutdown​(boolean force)