com.businesslink.sgi.api.sef
Class SefClient

com.businesslink.sgi.api.sef.SefClient

public final class SefClient

Class used to send new Strategi Events. Method calls must be made in proper order or a SefEscape with error code EAPISEQ is thrown.


Constructor Summary
SefClient()
          Constructs and initializes a new event client.
 
Method Summary
 void close()
          Performs necessary event client cleanup.
static void enableCache(boolean ena)
          Enables or disables internal UserQueue object caching.
 void endEvent()
          Ends the current event.
protected  void finalize()
          Automatically calls the close method.
 java.io.InputStream getInputStream()
          Gets the input stream used to receive data from the event handler.
 java.io.InputStream getInputStream(int ccs)
          Gets the input stream used to receive data from the event handler.
 java.io.OutputStream getOutputStream()
          Gets the output stream used to send data to the event handler.
 java.io.OutputStream getOutputStream(int ccs)
          Gets the output stream used to send data to the event handler.
 java.util.Properties getProperties()
          Gets all properties associated with this event.
 java.lang.String getProperty(java.lang.String kwd)
          Gets the property value associated with the specified keyword in the event property list.
 java.lang.String getProperty(java.lang.String kwd, java.lang.String dftval)
          Gets the property value associated with the specified keyword in the event property list.
 java.io.Reader getReader()
          Gets the Reader used to receive data from the event handler.
 java.io.Writer getWriter()
          Gets the Writer used to send data to the event handler.
 boolean hasProperty(java.lang.String kwd)
          Determines if a property with the specified keyword is present in the event property list.
 void receiveResponse()
          Blocks until response data is available from the event handler.
 void sendProperty(java.lang.String kwd, java.lang.String val)
          Sends a property to the event handler.
 boolean setOption(java.lang.String kwd, java.lang.String val)
          Sets a particular event client option.
 void startEvent(java.lang.String hdlnam, java.lang.String opc)
          Starts a new event.
 long writeDataTo(java.io.OutputStream out)
          Writes all input data to the specified output stream.
 long writeDataTo(java.io.OutputStream out, int ccs)
          Writes all input data to the specified output stream, translating to the specified CCSID.
 long writeDataTo(java.io.Writer wtr)
          Writes all input data to the specified Writer.
 

Constructor Detail

SefClient

public SefClient()
Constructs and initializes a new event client.
Method Detail

close

public void close()
Performs necessary event client cleanup. Always call this method after using a SefClient object.

finalize

protected void finalize()
                 throws java.lang.Throwable
Automatically calls the close method.

setOption

public boolean setOption(java.lang.String kwd,
                         java.lang.String val)
Sets a particular event client option. Note that certain options do not take effect immediately if set during an event.

Supported option keywords:

Parameters:
kwd - keyword identifying the option to set.
val - value to set.
Returns:
true if the option was set successfully, false otherwise.

startEvent

public void startEvent(java.lang.String hdlnam,
                       java.lang.String opc)
Starts a new event.
Parameters:
hdlnam - name of the event handler to handle this event.
opc - the event opcode.

sendProperty

public void sendProperty(java.lang.String kwd,
                         java.lang.String val)
Sends a property to the event handler.
Parameters:
kwd - property keyword.
val - property value.

getOutputStream

public java.io.OutputStream getOutputStream()
Gets the output stream used to send data to the event handler.
Returns:
the event output stream.

getOutputStream

public java.io.OutputStream getOutputStream(int ccs)
Gets the output stream used to send data to the event handler. All output data is marked as being the specified CCSID, but no translation is done at this point.
Parameters:
ccs - CCSID used to mark this output stream.
Returns:
the event output stream.

getWriter

public java.io.Writer getWriter()
Gets the Writer used to send data to the event handler. All data is automatically sent as Unicode characters.
Returns:
the event Writer.

receiveResponse

public void receiveResponse()
Blocks until response data is available from the event handler. This method receives all response properties and prepares to receive data.

hasProperty

public boolean hasProperty(java.lang.String kwd)
Determines if a property with the specified keyword is present in the event property list.
Parameters:
kwd - property keyword.
Returns:
true if the property is present; false otherwise.

getProperty

public java.lang.String getProperty(java.lang.String kwd)
Gets the property value associated with the specified keyword in the event property list.
Parameters:
kwd - property keyword.
Returns:
the property value; null if the property is not found.

getProperty

public java.lang.String getProperty(java.lang.String kwd,
                                    java.lang.String dftval)
Gets the property value associated with the specified keyword in the event property list.
Parameters:
kwd - property keyword.
dftval - a default value.
Returns:
the property value or the specified default value if the property is not found.

getProperties

public java.util.Properties getProperties()
Gets all properties associated with this event.
Returns:
property object containing all event properties.

getInputStream

public java.io.InputStream getInputStream()
Gets the input stream used to receive data from the event handler. This input stream does no character translation.
Returns:
the event input stream.

getInputStream

public java.io.InputStream getInputStream(int ccs)
Gets the input stream used to receive data from the event handler. Whenever it is possible to do so, characters are translated to the specified CCSID.
Parameters:
ccs - the CCSID to receive data in.
Returns:
the event input stream.

getReader

public java.io.Reader getReader()
Gets the Reader used to receive data from the event handler.
Returns:
the event Reader.

writeDataTo

public long writeDataTo(java.io.OutputStream out)
Writes all input data to the specified output stream. No character translation of the input data is done during this process.
Parameters:
out - the output stream to write to.
Returns:
total number of bytes written.

writeDataTo

public long writeDataTo(java.io.OutputStream out,
                        int ccs)
Writes all input data to the specified output stream, translating to the specified CCSID.
Parameters:
out - the output stream to write to.
ccs - CCSID to translate input data to.
Returns:
total number of bytes written.

writeDataTo

public long writeDataTo(java.io.Writer wtr)
Writes all input data to the specified Writer.
Parameters:
wtr - the Writer to use for writing.
Returns:
total number of characters written.

endEvent

public void endEvent()
Ends the current event. Note that this method is allowed from any client state.

enableCache

public static void enableCache(boolean ena)
Enables or disables internal UserQueue object caching. When caching is enabled, internal UserQueue objects are cached upon SefClient.close(), so that when new SefClients are instantiated, cached UserQueue objects may be reused (improving SefClient instantiation speed).
Parameters:
ena - if true, enable object caching; if false, disable object caching.