Class ServerCommand
java.lang.Object
ch.autumo.beetroot.server.message.AbstractMessage
ch.autumo.beetroot.server.message.ServerCommand
- Direct Known Subclasses:
DeleteRequest, DownloadRequest, UploadRequest
Secure server command.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDispatcher ID for internal server-commandsprotected static StringServer host; set by the message itself.protected static intServer port; set by the message itself.Fields inherited from class AbstractMessage
domain, ENCRYPT, entity, fileId, id, INTERNAL_MSG_PART_SEPARATOR, INTERNAL_MSG_PART_SEPARATOR_REGEXP, LOG, message, MSG_PART_SEPARATOR, MSG_PART_SEPARATOR_REGEXP, objectModifier and TypeFieldDescriptionprotected StringTransport domain name.protected static final booleanEncrypt client-server-com?protected StringTransport entity name.protected StringTransport file ID.protected longTransport entity ID.static final Stringinternal message part separatorstatic final Stringinternal message part separator regular expressionprotected static final org.slf4j.LoggerLogger.protected StringTransport message.static final Stringmessage part separatorstatic final Stringmessage part separator regular expressionprotected SerializableAdditional transport object. -
Constructor Summary
ConstructorsConstructorDescriptionServerCommand(String dispatcherId, String command) Constructor.ServerCommand(String dispatcherId, String command, String fileId) Constructor.ServerCommand(String dispatcherId, String command, String entity, long id) Constructor.ServerCommand(String dispatcherId, String command, String entity, long id, String domain) Constructor.ServerCommand(String dispatcherId, String command, String fileId, String domain) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidForce message over sockets; so web tunneling will be ignore.Get command.Get dispatcher idDispatcher.getHost()Server host; set by message itself.Get JSON representation; this includes all set information including the additional object if set.getMode()'sockets|web' - 'web' for tunneling, 'web' is not working for internal server commands.intgetPort()Server port; set by message itself.Server name; set by message itself.intTimeout for sending a server command client-side.Get transfer string; this includes all set information including the additional object is set.booleanIs message forced over sockets?static ServerCommandCreate a new server command out of transfer string.static ServerCommandCreate a new server command out of JSON transfer string.protected static voidreInit()Initialize configuration.Methods inherited from class AbstractMessage
contains, deserializeObject, getData, getDataLength, getDomain, getEntity, getFileId, getId, getJSONObject, getMessageIntValue, getMessageValue, getObject, serializeObject, setEntity, setObjectModifier and TypeMethodDescriptionbooleanChecks if this key is contained in a paired transport message.protected voiddeserializeObject(String serializedObject) Deserialize this object with FasterXML/Jackson.byte[]getData()Get transfer data; this includes all set information including an object.intGet transfer data length.Get a domain associated with this message or null.Get entity associated with this message or null.File ID if this message is used to transport file information.longgetId()Get entity ID associated with this message or null.org.json.JSONObjectReturn a JSON object or null; null means the object hold by this message represents another object type, but it is always serializable.intgetMessageIntValue(String key) Helper method for accessing paired transport message values.getMessageValue(String key) Helper method for accessing paired transport message values.Get serializable transport object hold by this message or null.protected StringSerialize this object with FasterXML/Jackson.voidSet an entity associated with this message.voidsetObject(Serializable object) Set any serializable object, usually a JSON string is meaningful for transport.
-
Field Details
-
DISPATCHER_ID_INTERNAL
Dispatcher ID for internal server-commands- See Also:
-
host
Server host; set by the message itself. -
port
protected static int portServer port; set by the message itself.
-
-
Constructor Details
-
ServerCommand
Constructor.- Parameters:
dispatcherId- dispatcher IDDispatchercommand- server command
-
ServerCommand
Constructor.- Parameters:
dispatcherId- dispatcher IDDispatchercommand- server commandfileId- unique file ID
-
ServerCommand
Constructor.- Parameters:
dispatcherId- dispatcher IDDispatchercommand- server commandfileId- unique file IDdomain- domain
-
ServerCommand
Constructor.- Parameters:
dispatcherId- dispatcher IDDispatchercommand- server commandentity- entity nameid- unique id
-
ServerCommand
Constructor.- Parameters:
dispatcherId- dispatcher IDDispatchercommand- server commandentity- entity nameid- unique iddomain- domain name
-
-
Method Details
-
reInit
protected static void reInit()Initialize configuration. -
getDispatcherId
-
getTimeout
public int getTimeout()Timeout for sending a server command client-side.- Returns:
- timeout
-
getMode
'sockets|web' - 'web' for tunneling, 'web' is not working for internal server commands.- Returns:
- mode
-
getHost
-
getPort
public int getPort()Server port; set by message itself.- Returns:
- server port
-
getServerName
-
getCommand
-
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
Description copied from class:AbstractMessageGet transfer string; this includes all set information including the additional object is set.- Specified by:
getTransferStringin classAbstractMessage- Returns:
- transfer string
- Throws:
IOException- IO exception
-
parse
Create a new server command out of transfer string.- Parameters:
transferString- transfer string- Returns:
- parsed server command
- Throws:
IOException- IO exception
-
getJsonTransferString
Description copied from class:AbstractMessageGet JSON representation; this includes all set information including the additional object if set.- Specified by:
getJsonTransferStringin classAbstractMessage- Returns:
- transfer JSON string
- Throws:
IOException- IO exception
-
parseJson
Create a new server command out of JSON transfer string.- Parameters:
transferString- JSON transferString transfer string- Returns:
- parsed server command
- Throws:
IOException- IO exception
-