Class ServerPlugin

All Implemented Interfaces:
MBeanService, Runnable
Direct Known Subclasses:
FtpPlugin, SimplePlugin

public abstract class ServerPlugin extends PluginThread
The Class ServerPlugin.
  • Constructor Details

    • ServerPlugin

      public ServerPlugin(String ref, Map<String,String> params, Socket socket) throws IOException
      Instantiates a new server plugin.
      Parameters:
      ref - the ref
      params - the params
      socket - the socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • ServerPlugin

      public ServerPlugin(String ref, Map<String,String> params)
      Instantiates a new server plugin.
      Parameters:
      ref - the ref
      params - the params
  • Method Details

    • getSocket

      public Socket getSocket()
      Gets the socket.
      Returns:
      the socket
    • getInfo

      public String getInfo()
      Gets the info.
      Returns:
      the info
    • customizeSocket

      public void customizeSocket(Socket socket) throws IOException
      Customize socket.
      Parameters:
      socket - the socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • newInstance

      public abstract ThreadService.ConfigurableRunnable newInstance(String ref, Map<String,String> params, Socket socket) throws IOException
      Get instance of current class.
      Parameters:
      ref - the ref
      params - the params
      socket - the socket
      Returns:
      the configurable runnable
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • configurableRun

      public void configurableRun()
      Configurable run. Configurable run. Configurable run.
      Overrides:
      configurableRun in class PluginThread
    • addConnection

      public void addConnection(Socket socket, ServerPlugin info)
      Adds the connection.
      Parameters:
      socket - the socket
      info - the info
    • callerBack

      public void callerBack(boolean reset)
      Caller back. Caller back.
      Overrides:
      callerBack in class PluginThread
      Parameters:
      reset - the reset
    • callerGone

      public void callerGone()
      Caller gone. Caller gone.
      Overrides:
      callerGone in class PluginThread
    • releaseConnection

      public void releaseConnection(Socket socket, boolean close)
      Release connection.
      Parameters:
      socket - the socket
      close - the close
    • getHeader

      public String getHeader()
      Gets the header.
      Returns:
      the header
    • getPort

      public abstract int getPort()
      Gets the port.
      Returns:
      the port
    • getInetAddress

      public InetAddress getInetAddress()
      Gets the inet address.
      Returns:
      the inet address
    • getRemoteHost

      public String getRemoteHost()
      Gets the remote host.
      Returns:
      the remote host
    • getRemoteIP

      public String getRemoteIP()
      Gets the remote ip.
      Returns:
      the remote ip
    • isAvailable

      public boolean isAvailable()
      Checks if is available.
      Returns:
      true, if is available
    • setCloseOnExit

      public void setCloseOnExit(boolean close)
      Sets the close on exit.
      Parameters:
      close - the new close on exit
    • start

      public boolean start()
      Start. Start.
      Specified by:
      start in class PluginThread
      Returns:
      true, if successful
    • startConnection

      public abstract void startConnection(Socket socket) throws IOException
      Start connection.
      Parameters:
      socket - the socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • refuseConnection

      public abstract void refuseConnection(Socket socket, int connectionsCount) throws IOException
      Refuse connection.
      Parameters:
      socket - the socket
      connectionsCount - the connections count
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • stop

      public void stop()
      Stop. Stop.
      Specified by:
      stop in class PluginThread
    • getAttribute

      public Object getAttribute(String attributeName) throws AttributeNotFoundException, MBeanException
      Gets the attribute. Gets the attribute. Gets the attribute.
      Specified by:
      getAttribute in interface MBeanService
      Overrides:
      getAttribute in class PluginThread
      Parameters:
      attributeName - the attribute name
      Returns:
      the attribute
      Throws:
      AttributeNotFoundException - the attribute not found exception
      MBeanException - the MBean exception
    • getMBeanInfo

      public MBeanInfo getMBeanInfo()
      Gets the MBean info. Gets the MBean info. Gets the MBean info.
      Specified by:
      getMBeanInfo in interface MBeanService
      Overrides:
      getMBeanInfo in class PluginThread
      Returns:
      the MBean info
    • getServerPluginDescriptor

      public ecmwf.common.plugin.ServerPlugin.ServerPluginDescriptor getServerPluginDescriptor()
      Gets the server plugin descriptor.
      Returns:
      the server plugin descriptor
    • invoke

      public Object invoke(String operationName, Object[] params, String[] signature) throws NoSuchMethodException, MBeanException
      Invoke. Invoke. Invoke.
      Specified by:
      invoke in interface MBeanService
      Overrides:
      invoke in class PluginThread
      Parameters:
      operationName - the operation name
      params - the params
      signature - the signature
      Returns:
      the object
      Throws:
      NoSuchMethodException - the no such method exception
      MBeanException - the MBean exception