osnap.api.model
Enum CoreMessageCode

java.lang.Object
  extended by java.lang.Enum<CoreMessageCode>
      extended by osnap.api.model.CoreMessageCode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<CoreMessageCode>

public enum CoreMessageCode
extends java.lang.Enum<CoreMessageCode>
implements java.io.Serializable

The different types of CoreMessageCode that can be used by a CoreMessage


Enum Constant Summary
ALLOWED_CONNECT
          From Core to Module Core sends an ALLOWED_CONNECT code to the module if it has been accepted and is allowed to connect.
DENIED_CONNECT
          From Core to Module The module was denied connection to the core.
INVALID_CREDENTIALS
          From Core to Module The module was denied connection because of invalid login credentials.
LAST_ID
          From Module to Core The module sends a LAST_ID code to the Core to tell it the last message ID it read.
MSG_SENT
          From Module to Core MSG_SENT is sent from the module to the core when an answer from eJournal has been sent to the user.
NAME_DUPE
          From Core to Module The module was denied connection to the core because a module with that name already existed.
NEW_MODULE
          From Module to Core This is sent to the Core upon an initial connection attempt to let the core know the module wants to connect.
PING
          From Module to Core PING is sent every now and then from a module to the core to understand if the connection is still alive.
PONG
          From Core to Module PONG is sent from the Core to the module who invoked PING in the first place.
PULSE
          From Core to Module This is sent to all modules connected to the Core to check for new messages posted on the social network
STOP
          From Core to Module The module is requested to terminate.
 
Method Summary
static CoreMessageCode valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static CoreMessageCode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

PULSE

public static final CoreMessageCode PULSE
From Core to Module This is sent to all modules connected to the Core to check for new messages posted on the social network


ALLOWED_CONNECT

public static final CoreMessageCode ALLOWED_CONNECT
From Core to Module Core sends an ALLOWED_CONNECT code to the module if it has been accepted and is allowed to connect.


DENIED_CONNECT

public static final CoreMessageCode DENIED_CONNECT
From Core to Module The module was denied connection to the core.


NAME_DUPE

public static final CoreMessageCode NAME_DUPE
From Core to Module The module was denied connection to the core because a module with that name already existed.


INVALID_CREDENTIALS

public static final CoreMessageCode INVALID_CREDENTIALS
From Core to Module The module was denied connection because of invalid login credentials.


STOP

public static final CoreMessageCode STOP
From Core to Module The module is requested to terminate. All connections will be closed.


NEW_MODULE

public static final CoreMessageCode NEW_MODULE
From Module to Core This is sent to the Core upon an initial connection attempt to let the core know the module wants to connect. Example: MessageSender(new CoreMessage(CoreMessageCode.NEW_MODULE, username password, osnapUsername))


LAST_ID

public static final CoreMessageCode LAST_ID
From Module to Core The module sends a LAST_ID code to the Core to tell it the last message ID it read. This is to avoid duplicated messages.


MSG_SENT

public static final CoreMessageCode MSG_SENT
From Module to Core MSG_SENT is sent from the module to the core when an answer from eJournal has been sent to the user. Example: MessageSender(new CoreMessage(CoreMessageCode.MSG_SENT, lastID, osnapUsername))


PING

public static final CoreMessageCode PING
From Module to Core PING is sent every now and then from a module to the core to understand if the connection is still alive. Example: MessageSender(new CoreMessage(CoreMessageCode.PING, null, null))


PONG

public static final CoreMessageCode PONG
From Core to Module PONG is sent from the Core to the module who invoked PING in the first place. Example: MessageSender(new CoreMessage(CoreMessageCode.PONG, null, null))

Method Detail

values

public static CoreMessageCode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (CoreMessageCode c : CoreMessageCode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static CoreMessageCode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null