Class ServerCommand

java.lang.Object
ch.autumo.beetroot.server.message.AbstractMessage
ch.autumo.beetroot.server.message.ServerCommand
Direct Known Subclasses:
DeleteRequest, DownloadRequest, UploadRequest

public class ServerCommand extends AbstractMessage
Secure server command.
  • Field Details

    • DISPATCHER_ID_INTERNAL

      public static final String DISPATCHER_ID_INTERNAL
      Dispatcher ID for internal server-commands
      See Also:
    • host

      protected static String host
    • port

      protected static int port
  • Constructor Details

    • ServerCommand

      public ServerCommand(String dispatcherId, String command)
      Constructor.
      Parameters:
      dispatcherId - dispatcher ID Dispatcher
      command - server command
    • ServerCommand

      public ServerCommand(String dispatcherId, String command, String fileId)
      Constructor.
      Parameters:
      dispatcherId - dispatcher ID Dispatcher
      command - server command
      fileId - unique file ID
    • ServerCommand

      public ServerCommand(String dispatcherId, String command, String fileId, String domain)
      Constructor.
      Parameters:
      dispatcherId - dispatcher ID Dispatcher
      command - server command
      fileId - unique file ID
      domain - domain
    • ServerCommand

      public ServerCommand(String dispatcherId, String command, String entity, long id)
      Constructor.
      Parameters:
      dispatcherId - dispatcher ID Dispatcher
      command - server command
      entity - entity name
      id - unique id
    • ServerCommand

      public ServerCommand(String dispatcherId, String command, String entity, long id, String domain)
      Constructor.
      Parameters:
      dispatcherId - dispatcher ID Dispatcher
      command - server command
      entity - entity name
      id - unique id
      domain - domain name
  • Method Details

    • reInit

      protected static void reInit()
      Initialize configuration.
    • getDispatcherId

      public String getDispatcherId()
      Get dispatcher id Dispatcher.
      Returns:
      dispatcher id
    • getTimeout

      public int getTimeout()
      Timeout for sending a server command client-side.
      Returns:
      timeout
    • getMode

      public String getMode()
      'sockets|web' - 'web' for tunneling, 'web' is not working for internal server commands.
      Returns:
      mode
    • getHost

      public String getHost()
      Server host; set by message itself.
      Returns:
      server host
    • getPort

      public int getPort()
      Server port; set by message itself.
      Returns:
      server port
    • getServerName

      public String getServerName()
      Server name; set by message itself.
      Returns:
      server name
    • getCommand

      public String getCommand()
      Get command.
      Returns:
      command
    • forceSockets

      public void forceSockets()
      Force message over sockets; so web tunneling will be ignore.
    • isForceSockets

      public boolean isForceSockets()
      Is message forced over sockets?
      Returns:
      true, if message is forced over sockets
    • getTransferString

      public String getTransferString() throws IOException
      Description copied from class: AbstractMessage
      Get transfer string; this includes all set information including the additional object is set.
      Specified by:
      getTransferString in class AbstractMessage
      Returns:
      transfer string
      Throws:
      IOException - IO exception
    • parse

      public static ServerCommand parse(String transferString) throws IOException
      Create a new server command out of transfer string.
      Parameters:
      transferString - transfer string
      Returns:
      parsed server command
      Throws:
      IOException - IO exception
    • getJsonTransferString

      public String getJsonTransferString() throws IOException
      Description copied from class: AbstractMessage
      Get JSON representation; this includes all set information including the additional object if set.
      Specified by:
      getJsonTransferString in class AbstractMessage
      Returns:
      transfer JSON string
      Throws:
      IOException - IO exception
    • parseJson

      public static ServerCommand parseJson(String transferString) throws IOException
      Create a new server command out of JSON transfer string.
      Parameters:
      transferString - JSON transferString transfer string
      Returns:
      parsed server command
      Throws:
      IOException - IO exception