javax.microedition.ipdr
Interface ExporterManager


public interface ExporterManager

The ExporterManager interface implementation which is the entry point to the ETA implementation.

ExporterManager receives the configuration interface (ExporterConfig) as an input and uses it to configure itself. This step is mandatory before "open" is invoked. ETA exposes the "send request" and "send response" services via the ExporterManager interface as well.

Version:
1.0
Author:
Shai Gotlib
See Also:
javax.microedition.configuration.ExporterConfig

Method Summary
 void cancelRequest(byte sessionId, long requestId)
          Requests to cancel request according to its ID.
 void close()
          Disconnects all existing connections, shuts down the listening socket Waits for all the threads to finish.
 TemplateConfig getTemplate(byte sessionId, short templateId)
          Returns a template configuration.
 void open()
          Executes the exporter.
 void sendData(byte sessionId, short templateId, java.util.Hashtable data)
          Sends a data message.
 long sendMessage(byte sessionId, short templateId, java.util.Hashtable data)
          Sends a "message" message.
 long sendRequest(byte sessionId, short templateId, java.util.Hashtable data, java.lang.Object param)
          Sends a request message.
 void sendResponse(long requestId, byte sessionId, boolean success, short templateId, java.util.Hashtable data)
          Sends a response message.
 void setConfiguration(ExporterConfig configuration)
          Sets the exporter configuration.
 void setConnectionControllerFactory(ConnectionControllerFactory connectionControllerFactory)
          The application sets connection controller The application supplies its own implementation for ConnectionControllerFactory interface as parameter to the function setConnectionControllerFactory.
 void setStateMachineListenerInFactory(StateMachineListenerInFactory listenerFactory)
          The application sets listeners for incoming messages.
 void setStateMachineListenerOutFactory(StateMachineListenerOutFactory listenerFactory)
          The application sets listeners for outgoing messages.
 void setTemplateNegotiatorFactory(TemplateNegotiatorFactory templateNegotiatorFactory)
          The application sets template negotiator.
 

Method Detail

open

public void open()
          throws InvalidApplicationStateException,
                 java.lang.SecurityException
Executes the exporter. Spawns collector handlers, listening socket, discovery handler (if required). It also reloads the exporter to its last state and reloads the unsent events.

Returns:
void
Throws:
InvalidApplicationStateException
java.lang.SecurityException
See Also:
close()

close

public void close()
Disconnects all existing connections, shuts down the listening socket Waits for all the threads to finish. It is also supposed to save the expoter state (current configuration and unsent events per Session). The ETA implementer must ensure that close() is activated whenever the ExporterManager is finalized.

Returns:
void
See Also:
open()

cancelRequest

public void cancelRequest(byte sessionId,
                          long requestId)
Requests to cancel request according to its ID. The request will be canceled and won't be sent (or resent if it already hasn't been sent)

Parameters:
sessionId - the session id
requestId - the request id
Returns:
void

setConfiguration

public void setConfiguration(ExporterConfig configuration)
                      throws InvalidApplicationStateException
Sets the exporter configuration. The configuration must be set before open() is being activated. Between open() and close() activations, setConfiguration is not allowed and will throw an InvalidApplicationStateException exception

Parameters:
configuration - the exporter configuration
Returns:
void
Throws:
InvalidApplicationStateException
See Also:
InvalidApplicationStateException, ExporterConfig, open(), close()

sendData

public void sendData(byte sessionId,
                     short templateId,
                     java.util.Hashtable data)
Sends a data message.

Parameters:
sessionId - the session id
templateId - the template id
data - an Hashtable with all the attributes names as keys and their values The type of the values is according to the data template.
Returns:
void

sendRequest

public long sendRequest(byte sessionId,
                        short templateId,
                        java.util.Hashtable data,
                        java.lang.Object param)
Sends a request message. sends request message and response or the acknowladge that is expected

Parameters:
sessionId - the session id
templateId - the template id
data - an Hashtable with all the attributes names as keys and their values The type of the values is according to the data template.
param - parameter that will be sent as a part of the notifyResponse
Returns:
long the request id
See Also:
StateMachineListenerIn, StateMachineListenerOut

sendMessage

public long sendMessage(byte sessionId,
                        short templateId,
                        java.util.Hashtable data)
Sends a "message" message. send a message that no response or acknowladge is expected

Parameters:
sessionId - the session id
templateId - the template id
data - an Hashtable with all the attributes names as keys and its values The type of the values is according to the data template.
Returns:
long the message id
See Also:
StateMachineListenerIn, StateMachineListenerOut

sendResponse

public void sendResponse(long requestId,
                         byte sessionId,
                         boolean success,
                         short templateId,
                         java.util.Hashtable data)
Sends a response message.

Parameters:
requestId - the request id
sessionId - the session id
success - true if the response denote success
templateId - the template id
data - an Hashtable with all the attributes names as keys and its values The type of the values is according to the data template.
Returns:
void

getTemplate

public TemplateConfig getTemplate(byte sessionId,
                                  short templateId)
Returns a template configuration.

Parameters:
sessionId - the session id
templateId - the template id
Returns:
TemplateConfig the template configuration
See Also:
TemplateConfig

setStateMachineListenerInFactory

public void setStateMachineListenerInFactory(StateMachineListenerInFactory listenerFactory)
                                      throws InvalidApplicationStateException
The application sets listeners for incoming messages. It supplies its own implementation for StateMachineListenerInFactory interface. The ETA implementer MUST instantiate and use at least one StateMachineListenerIn object per thread. Two threads MUST NOT share the same StateMachineListenerIn object. If it is invoked, it MUST be done before open method is invoked (or after close is invoked). Invoking setStateMachineListenerInFactory after open was invoked will cause the ETA implementation to throw InvalidApplicationStateException exception The ETA implementer MUST instantiate and use at least one StateMachineListenerIn object per thread. Two threads MUST NOT share the same StateMachineListenerIn object.

Returns:
void
Throws:
InvalidApplicationStateException - whenever exporter open and yet didn't closed
See Also:
StateMachineListenerIn

setStateMachineListenerOutFactory

public void setStateMachineListenerOutFactory(StateMachineListenerOutFactory listenerFactory)
                                       throws InvalidApplicationStateException
The application sets listeners for outgoing messages. It supplies its own implementation for StateMachineListenerOutFactory interface. The ETA implementer MUST instantiate and use at least one StateMachineListenerOut object per thread. Two threads MUST NOT share the same StateMachineListenerOut object. If it is invoked, it MUST be done before open method is invoked (or after close is invoked). Invoking setStateMachineListenerOutFactory after open was invoked will cause the ETA implementation to throw InvalidApplicationStateException exception.

Returns:
void
Throws:
InvalidApplicationStateException - whenever exporter open and yet didn't closed
See Also:
StateMachineListenerOut

setTemplateNegotiatorFactory

public void setTemplateNegotiatorFactory(TemplateNegotiatorFactory templateNegotiatorFactory)
                                  throws InvalidApplicationStateException
The application sets template negotiator. The application supplies its own implementation for TemplateNegotiatorFactory interface as parameter to the function setTemplateNegotiatorFactory. The ETA implementer MUST instantiate and use at least one TemplateNegotiator object per thread. Two threads MUST NOT share the same TemplateNegotiator object. If it is invoked, it MUST be done before open method is invoked (or after close is invoked). Invoking setTemplateNegotiatorFactory after open was invoked will cause the ETA implementation to throw InvalidApplicationStateException exception. If the application did not invoked the setTemplateNegotiatorFactory or set null as parameter then the ETA implementation will response to "modify template" always with the t emplates as defined by the configuration (ExporterConfig).

Parameters:
templateNegotiatorFactory - the template negotiator factory
Returns:
void
Throws:
InvalidApplicationStateException - whenever exporter open and yet didn't closed
See Also:
TemplateNegotiator

setConnectionControllerFactory

public void setConnectionControllerFactory(ConnectionControllerFactory connectionControllerFactory)
                                    throws InvalidApplicationStateException
The application sets connection controller The application supplies its own implementation for ConnectionControllerFactory interface as parameter to the function setConnectionControllerFactory. The ETA implementer MUST instantiate and use at least one ConnectionController object per thread. Two threads MUST NOT share the same ConnectionController object. If it is invoked, it MUST be done before open method is invoked (or after close is invoked). Invoking setConnectionControllerFactory after open was invoked will cause the ETA implementation to throw InvalidApplicationStateException exception. If the application did not invoked the setConnectionControllerFactory or set null as parameter then the ETA implementation will treat it as all the functions always return true.

Parameters:
connectionControllerFactory - the onnection controller factory
Returns:
void
Throws:
InvalidApplicationStateException - whenever exporter open and yet didn't closed
See Also:
ConnectionController