com.esri.tracking.connector
Class Connector

java.lang.Object
  extended by com.esri.tracking.connector.Connector
All Implemented Interfaces:
com.esri.tracking.connector.SocketEventListener

public final class Connector
extends java.lang.Object
implements com.esri.tracking.connector.SocketEventListener

The main class used to connect to the Tracking Server.


Constructor Summary
Connector()
          Creates a new Tracking Server connection with no ConnectorListener and default connection properties.
Connector(ConnectorListener listener)
          Creates a new Tracking Server connection using default properties and registers listener for notification of new messages in the Tracking Server message queue.\
Connector(java.util.Properties props, ConnectorListener listener)
          Creates a new Tracking Server connection using properties specified by props and registers listener for notification of new messages in the Tracking Server message queue.
 
Method Summary
 void addConnectorEventListener(ConnectorListener listener)
          Register a listener for ConnectorEvents
 void authenticateAsync(java.lang.String username, java.lang.String password)
           
 void connectAsync(java.lang.String remoteHostname, java.lang.Integer port)
           
 void disconnectAsync(java.lang.Boolean preserveSession)
           
 void getActionListAsync()
           
 void getAuxiliaryDataAsync(java.lang.String serviceName)
           
 boolean getGatewayStatisticsAsync(java.util.List<GatewayStatisticsType> statisticTypes)
           
 MessageFormatManager getMessageFormatManager()
          Once the messge definitions are retrieved from Tracking Server, the MessageFormatManager is constructed, and can be easily used to retrieve the list of Tracking Services, plus the field and meta-data about the message formats for each Tracking Service.
 java.lang.String getPassword()
           
 int getPort()
           
 java.lang.String getRemoteHostname()
           
 void getServiceDefinitionAsync()
           
 java.lang.String[] getServiceNames()
           
 java.util.List<java.lang.String> getSubscribeServiceNames()
           
 void getSymbolFromIdAsync(java.lang.String symbolID, int imgSize, java.lang.Boolean isMOLESymbol)
           
 void getSymbolFromXMLAsync(java.lang.String xmlRequest, java.lang.Boolean isMOLESymbol)
           
 java.util.List<java.lang.String> getUnsubscribeServiceNames()
           
 java.lang.String getUsername()
           
 boolean isConnected()
          Returns the Connector's connection status
 boolean isLoggedIn()
           
 void onConnectResponse(SocketConnectEvent e)
           
 void onDisconnectResponse(SocketDisconnectEvent e)
           
 void onExceptionReceived(SocketExceptionEvent e)
           
 void onMessageReceived(SocketMessageEvent e)
          onMessage is the event handler that processes all incoming messages.
 void removeConnorEventListener(ConnectorListener listener)
          Remove a listener for ConnectorEvents
 boolean setAOIForServiceAsync(java.lang.String serviceName, TmsEnvelope aoiEnvelope, SetAOIType aoiType)
           
 void setPassword(java.lang.String password)
           
 void setPort(int port)
           
 void setRemoteHostname(java.lang.String remoteHostname)
           
 void setUsername(java.lang.String username)
           
 void subscribeToServiceAsync(java.lang.String serviceName)
           
 void subscribeToServiceListAsync(java.util.List<java.lang.String> serviceNames)
           
 void unsubscribeToServiceAsync(java.lang.String serviceName)
           
 void unsubscribeToServiceListAsync(java.util.List<java.lang.String> serviceNames)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Connector

public Connector()
Creates a new Tracking Server connection with no ConnectorListener and default connection properties. Use this constructor for "command-only" connections.


Connector

public Connector(ConnectorListener listener)
Creates a new Tracking Server connection using default properties and registers listener for notification of new messages in the Tracking Server message queue.\

Parameters:
listener - MessageListener the implementation of MessageListener to notify when a new message enters the Tracking Server queue

Connector

public Connector(java.util.Properties props,
                 ConnectorListener listener)
Creates a new Tracking Server connection using properties specified by props and registers listener for notification of new messages in the Tracking Server message queue.

Parameters:
props - Properties Tracking Server connection such as host and port
listener - MessageListener implementation to notify when a new message enters the Tracking Server queue
Method Detail

addConnectorEventListener

public void addConnectorEventListener(ConnectorListener listener)
Register a listener for ConnectorEvents


authenticateAsync

public void authenticateAsync(java.lang.String username,
                              java.lang.String password)
                       throws java.lang.Exception
Throws:
java.lang.Exception

connectAsync

public void connectAsync(java.lang.String remoteHostname,
                         java.lang.Integer port)
                  throws TrackingConnectionException
Throws:
TrackingConnectionException

disconnectAsync

public void disconnectAsync(java.lang.Boolean preserveSession)

getActionListAsync

public void getActionListAsync()
                        throws java.lang.Exception
Throws:
java.lang.Exception

getAuxiliaryDataAsync

public void getAuxiliaryDataAsync(java.lang.String serviceName)
                           throws java.lang.Exception
Throws:
java.lang.Exception

getGatewayStatisticsAsync

public boolean getGatewayStatisticsAsync(java.util.List<GatewayStatisticsType> statisticTypes)
                                  throws java.lang.Exception
Parameters:
statisticTypes -
Throws:
java.lang.Exception

getMessageFormatManager

public MessageFormatManager getMessageFormatManager()
                                             throws TrackingConnectionException,
                                                    TrackingLoginException
Once the messge definitions are retrieved from Tracking Server, the MessageFormatManager is constructed, and can be easily used to retrieve the list of Tracking Services, plus the field and meta-data about the message formats for each Tracking Service. If message definition information has not yet been retrieved, this method blocks until it is available or until a 60 second timeout period has elapsed. Returns null if request for message definition information timed out.

Returns:
MessageFormatManager
Throws:
TrackingLoginException
TrackingConnectionException

getPassword

public java.lang.String getPassword()
Returns:
password

getPort

public int getPort()
Returns:
the port

getRemoteHostname

public java.lang.String getRemoteHostname()
Returns:
the remoteHostname

getServiceDefinitionAsync

public void getServiceDefinitionAsync()
                               throws java.lang.Exception
Throws:
java.lang.Exception

getServiceNames

public java.lang.String[] getServiceNames()

getSubscribeServiceNames

public java.util.List<java.lang.String> getSubscribeServiceNames()

getSymbolFromIdAsync

public void getSymbolFromIdAsync(java.lang.String symbolID,
                                 int imgSize,
                                 java.lang.Boolean isMOLESymbol)
                          throws java.lang.Exception
Throws:
java.lang.Exception

getSymbolFromXMLAsync

public void getSymbolFromXMLAsync(java.lang.String xmlRequest,
                                  java.lang.Boolean isMOLESymbol)
                           throws java.lang.Exception
Throws:
java.lang.Exception

getUnsubscribeServiceNames

public java.util.List<java.lang.String> getUnsubscribeServiceNames()

getUsername

public java.lang.String getUsername()
Returns:
the username

isConnected

public boolean isConnected()
Returns the Connector's connection status

Returns:
true if Connector has established a socket connection to Tracking Server's Gateway , false otherwise

isLoggedIn

public boolean isLoggedIn()

onConnectResponse

public void onConnectResponse(SocketConnectEvent e)
Specified by:
onConnectResponse in interface com.esri.tracking.connector.SocketEventListener

onDisconnectResponse

public void onDisconnectResponse(SocketDisconnectEvent e)
Specified by:
onDisconnectResponse in interface com.esri.tracking.connector.SocketEventListener

onExceptionReceived

public void onExceptionReceived(SocketExceptionEvent e)
Specified by:
onExceptionReceived in interface com.esri.tracking.connector.SocketEventListener

onMessageReceived

public void onMessageReceived(SocketMessageEvent e)
Description copied from interface: com.esri.tracking.connector.SocketEventListener
onMessage is the event handler that processes all incoming messages. Your implementation of this interface gives you access to each message on the queue for customized processing.

Specified by:
onMessageReceived in interface com.esri.tracking.connector.SocketEventListener

removeConnorEventListener

public void removeConnorEventListener(ConnectorListener listener)
Remove a listener for ConnectorEvents


setAOIForServiceAsync

public boolean setAOIForServiceAsync(java.lang.String serviceName,
                                     TmsEnvelope aoiEnvelope,
                                     SetAOIType aoiType)
                              throws java.lang.Exception
Parameters:
serviceName -
aoiEnvelope -
aoiType -
Throws:
java.lang.Exception

setPassword

public void setPassword(java.lang.String password)
Parameters:
password -

setPort

public void setPort(int port)
Parameters:
port -

setRemoteHostname

public void setRemoteHostname(java.lang.String remoteHostname)
Parameters:
remoteHostname -

setUsername

public void setUsername(java.lang.String username)
Parameters:
username - the username to set

subscribeToServiceAsync

public void subscribeToServiceAsync(java.lang.String serviceName)
                             throws java.lang.Exception
Throws:
java.lang.Exception

subscribeToServiceListAsync

public void subscribeToServiceListAsync(java.util.List<java.lang.String> serviceNames)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

unsubscribeToServiceAsync

public void unsubscribeToServiceAsync(java.lang.String serviceName)
                               throws java.lang.Exception
Throws:
java.lang.Exception

unsubscribeToServiceListAsync

public void unsubscribeToServiceListAsync(java.util.List<java.lang.String> serviceNames)
                                   throws java.lang.Exception
Throws:
java.lang.Exception