public class

MessageProcessor

extends Object
java.lang.Object
   ↳ com.esri.core.symbol.advanced.MessageProcessor

Class Overview

A MessageProcessor allows you to process a Message from external resources. For example, display a military symbol by passing a 2525C message to a MessageProcesor. Each MessageProcessor comes with a SymbolDictionary.DictionaryType, which dictates message format understood by MessageProcessor, e.g. a message needs to have one or more properties from 'wkid', ''sic', '_Type', '_Action' and '_Control_Points' in order to be successfully processed by a 2525C MessageProcessor. Each dictionary type is backed by a resource bundle which includes dictionary data file and message type files. The path to the resource files needs to be specified when a MessageProcessor object is initialized. A MessageProcessor is bound to a MessageGroupLayer, which is used to display, update and remove MultiLayerSymbol associated with the message. The MessageGroupLayer has to be added into MapView, otherwise MessageProcessor will fail to process the message.

Creates a MessageProcessor object:

     MapView map = new MapView(this); 
     try {   
       MessageGroupLayer mgroupLayer= new MessageGroupLayer(DictionaryType.MIL2525C);
       map.addLayer(mgroupLayer);
       MessageProcessor processor = mgroupLayer.getMessageProcessor();
     catch(FileNotFoundException ex) {
        ex.printStackTrace();
     }
     
     
     
    
   
Creates a Message object, then process it:
     
      Message message = new Message();
      UUID uuid = UUID.randomUUID();
      message.setID(uuid.toString());
      message.setProperty("_Type", "position_report");
      message.setProperty("_Action", "update");
      message.setProperty("_Control_Points", "7846271.25206,4091857.83028");
      message.setProperty("sic", "SFGPUCRRL--E---");
      message.setProperty("_WKID", "3857");
      message.setProperty("UniqueDesignation", "Mad dog");
      processor.processMessage(message);
   

Summary

Constants
String DEFAULT_DICTIONARY_FOLDER
Public Constructors
MessageProcessor(SymbolDictionary.DictionaryType type, GroupLayer groupLayer)
This constructor is deprecated. No replacement.
MessageProcessor(SymbolDictionary.DictionaryType type, MessageGroupLayer mgroupLayer)
Constructs a MessageProcesor object using specified SymbolDictionary.DictionaryType and GroupLayer.
MessageProcessor(SymbolDictionary.DictionaryType type, GroupLayer groupLayer, String symbolDictionaryPath)
This constructor is deprecated. No replacement.
MessageProcessor(SymbolDictionary.DictionaryType type, MessageGroupLayer mgroupLayer, String symbolDictionaryPath)
Constructs a MessageProcesor object using specified SymbolDictionary.DictionaryType, MessageGroupLayer and resource bundle path.
Public Methods
Message createMessageFrom(String messageID)
Creates a Message from an existing message ID.
Message createMessageFrom(Graphic graphic)
Creates a Message from a Graphic object.
SpatialReference getDefaultMessageSpatialReference()
Gets the default message spatial reference.
SymbolDictionary.DictionaryType getDictionaryType()
Gets the dictionary type.
Graphic getGraphic(String messageID)
Retrieves the graphic which originates from the message with specified id.
String[] getMessageTypesSupported()
Gets the message types supported.
SymbolDictionary getSymbolDictionary()
Gets the SymbolDictionary instance.
boolean processMessage(Message message)
Processes the message which conforms to the format dictated by the dictionary type.
void setDefaultMessageSpatialReference(SpatialReference sr)
Sets the default message spatial reference.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

protected static final String DEFAULT_DICTIONARY_FOLDER

Constant Value: "/sdcard/ArcGIS/SymbolDictionary/"

Public Constructors

public MessageProcessor (SymbolDictionary.DictionaryType type, GroupLayer groupLayer)

This constructor is deprecated.
No replacement.

Constructs a MessageProcesor object using specified SymbolDictionary.DictionaryType and GroupLayer. Default path(/sdcard/ArcGIS/SymbolDictionary) to the resource bundle is used

Parameters
type processor type. Only Mil252C is supported for now.
groupLayer GroupLayer which displays symbols.
Throws
FileNotFoundException the file not found exception

public MessageProcessor (SymbolDictionary.DictionaryType type, MessageGroupLayer mgroupLayer)

Constructs a MessageProcesor object using specified SymbolDictionary.DictionaryType and GroupLayer. Default path(/sdcard/ArcGIS/SymbolDictionary) to the resource bundle is used

Parameters
type processor type. Only Mil252C is supported for now.
mgroupLayer MessageGroupLayer which displays symbols.
Throws
FileNotFoundException the file not found exception

public MessageProcessor (SymbolDictionary.DictionaryType type, GroupLayer groupLayer, String symbolDictionaryPath)

This constructor is deprecated.
No replacement.

Constructs a MessageProcesor object using specified SymbolDictionary.DictionaryType, GroupLayer and resource bundle path.

Parameters
type processor type. Only Mil2525C is supported for now.
groupLayer GroupLayer which displays symbols
symbolDictionaryPath path to the symbol dictionary source bundle directory.
Throws
FileNotFoundException the file not found exception

public MessageProcessor (SymbolDictionary.DictionaryType type, MessageGroupLayer mgroupLayer, String symbolDictionaryPath)

Constructs a MessageProcesor object using specified SymbolDictionary.DictionaryType, MessageGroupLayer and resource bundle path.

Parameters
type processor type. Only Mil2525C is supported for now.
mgroupLayer MessageGroupLayer which displays symbols
symbolDictionaryPath path to the symbol dictionary source bundle directory.
Throws
FileNotFoundException the file not found exception

Public Methods

public Message createMessageFrom (String messageID)

Creates a Message from an existing message ID. The message ID is used previously to create or update a graphic. The returned message has the same attributes as the previous message with specified message ID except that '_Action' property is empty.

Parameters
messageID message ID
Returns
  • a Message object with attributes from previous message with same message id.

public Message createMessageFrom (Graphic graphic)

Creates a Message from a Graphic object. The message gets populated with properties understood by the message processor. If the specified graphic is created from previous message, the returned message is the same as the previous one except that '_Action' property is empty.

Parameters
graphic a Graphic object.
Returns
  • a Message object populated with attributes/geometry from the specified graphic.

public SpatialReference getDefaultMessageSpatialReference ()

Gets the default message spatial reference. Message spatial reference is used by control points inside the message. Usually a WKID or WKT property indicates the message spatial reference. If WKID or WKT property is omitted, this default message spatial reference is treated as the message spatial reference. If default message spatial reference is not set, it will be the same as the map's spatial reference.

Returns
  • the default spatial reference.

public SymbolDictionary.DictionaryType getDictionaryType ()

Gets the dictionary type. The dictionary type is associated with a resource bundle, which includes dictionary data file and message type configuration files. Only Mil2525C dictionary type is available for now.

Returns
  • the mType the processor type.

public Graphic getGraphic (String messageID)

Retrieves the graphic which originates from the message with specified id.

Parameters
messageID message id.
Returns
  • a Graphic object populated with the properties of message of specified id.

public String[] getMessageTypesSupported ()

Gets the message types supported. A message requires a type property which describes how message is processed. The message type is defined in the resource bundle as a configuration file in JSON format. A message type contains properties like type name, layer name and renderer.

a sample message type file:

 {
 "type": "position_report",
 "layerName": "position_reports",
 "renderer":
 {
 "type"           : "dictionary",
 "description"    : "postion report",
 "dictionaryType" : "2525C",
 "field"          : "sic"
 }
 }
 
 

Returns
  • the message types supported

public SymbolDictionary getSymbolDictionary ()

Gets the SymbolDictionary instance.

Returns
  • symbol dictionary.

public boolean processMessage (Message message)

Processes the message which conforms to the format dictated by the dictionary type. MessageProcessor uses message properties to create, update, delete or otherwise change the state of the graphic(geometry and attributes). MessageProcessor determines which message properties should be persisted on graphic as attributes.

Parameters
message A Message object
Returns
  • true if the message is processed successfully.

public void setDefaultMessageSpatialReference (SpatialReference sr)

Sets the default message spatial reference. Message spatial reference is used by control points inside the message. Usually a WKID or WKT property indicates the message spatial reference. If WKID or WKT property is omitted, this default message spatial reference is treated as the message spatial reference. If default message spatial reference is not set, it will be the same as the map's spatial reference.

Parameters
sr the default message spatial reference to set.