Class SCServer

java.lang.Object
org.serviceconnector.api.srv.SCServer

public class SCServer extends Object
The Class SCServer. Server to a SC.
  • Constructor Details

    • SCServer

      public SCServer(String scHost, int scPort, int listenerPort)
      Instantiates a new SC server.
      Parameters:
      scHost - the SC host
      scPort - the SC port
      listenerPort - the listener port
    • SCServer

      public SCServer(String scHost, int scPort, int listenerPort, ConnectionType connectionType)
      Instantiates a new SC server.
      Parameters:
      scHost - the SC host
      scPort - the SC port
      listenerPort - the listener port
      connectionType - the connection type
    • SCServer

      public SCServer(String scHost, int scPort, List<String> networkInterfaces, int listenerPort, ConnectionType connectionType)
      Instantiates a new SC server.
      Parameters:
      scHost - the SC host
      scPort - the SC port
      networkInterfaces - the network interfaces
      listenerPort - the listener port
      connectionType - the connection type
  • Method Details

    • getConnectionType

      public ConnectionType getConnectionType()
      Gets the connection type.
      Returns:
      the connection type
    • getSCHost

      public String getSCHost()
      Gets the SC host.
      Returns:
      the SC host
    • getSCPort

      public int getSCPort()
      Gets the SC port.
      Returns:
      the SC port
    • getListenerPort

      public int getListenerPort()
      Gets the listener port.
      Returns:
      the listener port
    • getListenerInterfaces

      public List<String> getListenerInterfaces()
      Gets the listener interfaces.
      Returns:
      the listener interfaces
    • setImmediateConnect

      public void setImmediateConnect(boolean immediateConnect) throws SCServiceException
      Sets the immediate connect. Affects connecting behavior from SC. If immediateConnect is set SC establishes connection to server at the time registerServer is received.
      Parameters:
      immediateConnect - immediate connect
      Throws:
      SCServiceException - listener is already started
    • isImmediateConnect

      public boolean isImmediateConnect()
      Checks if is immediate connect flag is set.
      Returns:
      true, if is immediate connect
    • isListening

      public boolean isListening()
      Checks if server is listening.
      Returns:
      true, if is listening
    • getKeepAliveIntervalSeconds

      public int getKeepAliveIntervalSeconds()
      Gets the keep alive interval seconds.
      Returns:
      the keep alive interval seconds
    • setKeepAliveIntervalSeconds

      public void setKeepAliveIntervalSeconds(int keepAliveIntervalSeconds) throws SCServiceException
      Sets the keep alive interval in seconds. Interval in seconds between two subsequent keepAlive requests (KRQ). The keepAlive message is solely used to refresh the firewall timeout on the network path. KeepAlive message is only sent on an idle connection. The value = 0 means no keep alive messages will be sent.
      Parameters:
      keepAliveIntervalSeconds - Example: 360
      Throws:
      SCServiceException - listener is already started
    • setKeepAliveTimeoutSeconds

      public void setKeepAliveTimeoutSeconds(int keepAliveTimeoutSeconds) throws SCMPValidatorException, SCServiceException
      Sets the keep alive timeout in seconds. Time in seconds a keep alive request waits to be confirmed. If no confirmation is received single connection gets closed.
      Parameters:
      keepAliveTimeoutSeconds - time to wait for completion of a keep alive request Example: 10
      Throws:
      SCMPValidatorException - keepAliveTimeoutSeconds > 1 and < 3600
      SCServiceException - listener is already started
    • getKeepAliveTimeoutSeconds

      public int getKeepAliveTimeoutSeconds()
      Gets the keep alive timeout seconds.
      Returns:
      the keep alive timeout seconds
    • setTCPKeepAliveInitiator

      public void setTCPKeepAliveInitiator(boolean tcpKeepAliveInitiator) throws SCServiceException
      Sets the TCP keep alive. True to enable sending of TCP keep alive on initiated connections (if underlying OS properly configures keep alive). False to disable sending.
      Parameters:
      tcpKeepAliveInitiator - the new TCP keep alive
      Throws:
      SCServiceException - called method after attach
    • getTCPKeepAliveInitiator

      public Boolean getTCPKeepAliveInitiator()
      Gets the TCP keep alive setting for initiated connections.
      Returns:
      the TCP keep alive TRUE - TCP keep alive is enabled FALSE - TCP keep alive is disabled
    • setTCPKeepAliveListener

      public void setTCPKeepAliveListener(boolean tcpKeepAliveListener) throws SCServiceException
      Sets the TCP keep alive. True to enable sending of TCP keep alive on incoming connections (if underlying OS properly configures keep alive). False to disable sending.
      Parameters:
      tcpKeepAliveListener - the new TCP keep alive
      Throws:
      SCServiceException - called method after attach
    • getTCPKeepAliveListener

      public Boolean getTCPKeepAliveListener()
      Gets the TCP keep alive setting for incoming connections.
      Returns:
      the TCP keep alive TRUE - TCP keep alive is enabled FALSE - TCP keep alive is disabled
    • setCheckRegistrationTimeoutSeconds

      public void setCheckRegistrationTimeoutSeconds(int checkRegistrationTimeoutSeconds) throws SCMPValidatorException, SCServiceException
      Sets the check registration timeout in seconds. Time in seconds a check registration request waits to be confirmed. If no confirmation is received server for specific service is dead.
      Parameters:
      checkRegistrationTimeoutSeconds - time to wait for completion of a check registration request Example: 10
      Throws:
      SCMPValidatorException - checkRegistrationTimeoutSeconds > 1 and < 3600
      SCServiceException - listener is already started
    • getCheckRegistrationTimeoutSeconds

      public int getCheckRegistrationTimeoutSeconds()
      Gets the check registration timeout seconds.
      Returns:
      the check registration timeout seconds
    • setCheckRegistrationIntervalSeconds

      public void setCheckRegistrationIntervalSeconds(int checkRegistrationIntervalSeconds) throws SCServiceException
      Sets the check registration interval in seconds. Interval in seconds between two subsequent check registration requests (CRG). The check registration message is used to refresh the server timeout on the SC. If the SC no check registration message receives within the interval the server gets destroyed. The value = 0 means no observation will be active on SC. Check registration message can be sent any time to verify SC is alive and Server is registered properly.
      Parameters:
      checkRegistrationIntervalSeconds - Example: 360
      Throws:
      SCServiceException - listener is already started
    • getCheckRegistrationIntervalSeconds

      public int getCheckRegistrationIntervalSeconds()
      Gets the check registration interval seconds.
      Returns:
      the check registration interval seconds
    • startListener

      public void startListener() throws SCServiceException, SCMPValidatorException
      Start listener.
      Throws:
      SCServiceException - listener is already started
      SC host not set
      ConnectionType not set
      starting listener fails
      SCMPValidatorException - scPort Number > 1 and < 65535
      listenerPort Number > 1 and < 65535
      SC port and listener port are the same
      bind to interface failed
    • stopListener

      public void stopListener()
      StopListener. Stop listening and clean up.
    • destroy

      public void destroy()
      Destroy server. Destroys server and releases all resources. No more communication to SC is possible after calling destroy. Deregister servers and stop listener before calling destroy.
    • newSessionServer

      public SCSessionServer newSessionServer(String serviceName) throws SCServiceException, SCMPValidatorException
      New session server.
      Parameters:
      serviceName - the service name
      Returns:
      the SC session server
      Throws:
      SCServiceException - server not listening
      SCMPValidatorException - service name not set
    • newPublishServer

      public SCPublishServer newPublishServer(String serviceName) throws SCServiceException, SCMPValidatorException
      New publish server.
      Parameters:
      serviceName - the service name
      Returns:
      the SC publish server
      Throws:
      SCServiceException - server not listening
      SCMPValidatorException - service name not set