Class SrvConnection


  • public class SrvConnection
    extends InoNet
    The class represents a connection to the Innovator repository server. You can connect to a model which that repository server recognizes after instantiation; this is done so that you can call Innovator Java API commands. The class encapsulates the connection data returned by the license server (or the login).
    Since:
    17.12.2004
    Author:
    borschet
    See Also:
    LicenseServer.findServer(String)
    • Constructor Summary

      Constructors 
      Constructor Description
      SrvConnection​(de.mid.innovator.srv.LicSrvGetSrvPrjListReplyTelegram.SrvConData srvConData)  
      SrvConnection​(java.net.InetSocketAddress ipAddr, java.lang.String ipAddrStr, java.lang.String repName)
      Creates a connection to the repository server if the IP address and connection port are known.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void connect()
      Connects the SrvConnection with the repository server and initializes the communication between Java client and repository server.
      void disconnect()
      Disconnects the SrvConnection from the repository server; no more commands can be called.
      boolean equals​(java.lang.Object obj)  
      SrvCachePool getCachePool()  
      java.lang.String getRepName()  
      boolean isConnected()
      Checks if the SrvConnection is connected to the repository server.
      de.mid.innovator.srv2api.impl.SrvDataTelegram SendAndReceive​(SrvContext ctx, de.mid.innovator.srv2api.impl.SrvDataTelegram tel)  
      void setRepName​(java.lang.String repName)  
      de.mid.innovator.srv2api.impl.SrvParamBlock Srv2SendAndReceive​(SrvContext ctx, de.mid.innovator.srv2api.impl.SrvDataTelegram.DataTelType type, de.mid.innovator.srv2api.impl.SrvDataTelegram.DataTelTab telTab, de.mid.innovator.srv2api.impl.SrvParamBlock pb, de.mid.innovator.srv2api.impl.SrvTelegram.TelFlag... flagLst)
      Constructs a telegram of the given type using the parameter block and sends it to the repository server.
      • Methods inherited from class java.lang.Object

        clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SrvConnection

        public SrvConnection​(java.net.InetSocketAddress ipAddr,
                             java.lang.String ipAddrStr,
                             java.lang.String repName)
                      throws java.lang.IllegalArgumentException,
                             java.net.UnknownHostException
        Creates a connection to the repository server if the IP address and connection port are known. The license server should normally ask for this information.
        Parameters:
        ipAddr - TCP/IP address with port
        ipAddrStr - alternative ip number as string to be used, if the fqdn cannot be resolved
        repName - the name of the repository server
        Throws:
        java.lang.IllegalArgumentException
        java.net.UnknownHostException
        See Also:
        LicenseServer.findServer(String)
      • SrvConnection

        public SrvConnection​(de.mid.innovator.srv.LicSrvGetSrvPrjListReplyTelegram.SrvConData srvConData)
                      throws java.lang.IllegalArgumentException,
                             java.net.UnknownHostException
        Throws:
        java.lang.IllegalArgumentException
        java.net.UnknownHostException
    • Method Detail

      • getRepName

        public java.lang.String getRepName()
      • setRepName

        public void setRepName​(java.lang.String repName)
      • connect

        public void connect()
                     throws InoNetException
        Connects the SrvConnection with the repository server and initializes the communication between Java client and repository server. The repository server creates a connection process (or a thread with a connection process). All telegrams are sent to this process. For every successful connect a disconnect should be called if it is not needed anymore.
        Overrides:
        connect in class InoNet
        Throws:
        InoNetException
        See Also:
        disconnect()
      • disconnect

        public void disconnect()
                        throws InoNetException
        Disconnects the SrvConnection from the repository server; no more commands can be called. The repository server deletes all information belonging to the Java client and removes corresponding threads, frees memory etc. You need to call this method when exiting a Java program to end the connection.
        Overrides:
        disconnect in class InoNet
        Throws:
        InoNetException
        See Also:
        connect()
      • isConnected

        public boolean isConnected()
        Checks if the SrvConnection is connected to the repository server.
        Overrides:
        isConnected in class InoNet
        Returns:
        true, if connected, otherwise false
      • Srv2SendAndReceive

        public de.mid.innovator.srv2api.impl.SrvParamBlock Srv2SendAndReceive​(SrvContext ctx,
                                                                              de.mid.innovator.srv2api.impl.SrvDataTelegram.DataTelType type,
                                                                              de.mid.innovator.srv2api.impl.SrvDataTelegram.DataTelTab telTab,
                                                                              de.mid.innovator.srv2api.impl.SrvParamBlock pb,
                                                                              de.mid.innovator.srv2api.impl.SrvTelegram.TelFlag... flagLst)
                                                                       throws InoNetException,
                                                                              SrvErrorException
        Constructs a telegram of the given type using the parameter block and sends it to the repository server. The parameter block is given back to the returned telegram if the receive was successful.
        Parameters:
        type - telegram's type
        telTab - server's telegram dispatcher table
        pb - input parameter block
        Returns:
        The returned telegram's parameter block
        Throws:
        InoNetException
        SrvErrorException
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object