SIX Java API - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

SIX Java API

Description:

... the SixHandler (instead of SixEventHandler) and implements java.util.Observer. ... E.g. News text such as information from Nyhetsbyr n Direkt. ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 24
Provided by: rolfbr1
Category:
Tags: api | six | and | java | news | observer

less

Transcript and Presenter's Notes

Title: SIX Java API


1
SIX Java API
  • An API for the SIXP Server

2
Overview
3
Objectives
  • Handles the communication
  • Interprets the SIXP protocol
  • Converts SIXP messages into Java classes and vice
    versa
  • Passes responses as Java classes to the user
  • Asynchronous communication

4
Commands
Requests
Responses
  • Login
  • Logout
  • Get
  • Subscribe
  • Get Field Set
  • Unsubscribe
  • Create
  • Put
  • Delete
  • Login
  • Logout
  • Data
  • --
  • Get Field Set
  • Unsubscribe
  • Create
  • Put
  • Delete
  • Exception

5
Asynchronous response requires some kind of
identification
  • The response itself, e.g. Login
  • Usage of Cookies
  • Subscription Id (only for Subscribe)

6
Usage of Cookies
7
Usage of Subscription Id
8
Sending request to the Server
  • SixEventHandler.send( SixRequest )
  • SixHandler.send( SixRequest )

9
Receive response from the Server
  • The user implements the interface
    SixResponseListener and receives data through the
    processXXXResponse() methods.

SixResponseListener
User Appl
processXXXResponse()
SIXP Server
SixEventHandler
send()
10
Receive response from the Server
  • The user extends the helper class
    SixResponseAdapter and overrides actual
    processXXXResponse()
  • SixResponseAdapter implements SixResponseListener
    with null action

public class MyReceiver extends
sixapi.SixResponseAdapter void
processDataResponse( SixDataRes res )
...
11
Receive response from the Server
  • The user uses the SixHandler (instead of
    SixEventHandler) and implements
    java.util.Observer.
  • All data is received through the update()
    method.

java.util.Observer
User Appl
update()
SIXP Server
SixHandler
send()
12
Kind of data response
Text data
E.g. News text such as information from
Nyhetsbyrån Direkt. java.io.BufferedReader r
response.getTextStream() String line while ( (
line r.readLine() ) ! null )
System.out.println( line )
Table data
E.g. financial information such as equities and
derivatives.
13
Table data
  • SixGetReq and SixSubscribeReq request the SIXP
    Server to send a complete table
  • SixSubscribeReq also requests the SIXP Server to
    send table updates
  • Tables and table updates are received as
    SixDataRes objects
  • Table updates are smaller tables only containing
    affected records (rows) and fields (columns)
  • Reading a table data (two ways)

Loop through all records get record data
loop through all fields get field data
Call traverse() and get a callback for each field
14
Table data
A table can logically be described as a
multi-linked list
15
Table data (Record)
  • Record id
  • Update kind
  • REC_NEW
  • REC_CHANGED
  • REC_DELETED
  • REC_UNCHANGED
  • REC_FULL
  • Number of fields

16
Table data (Field)
  • Field id
  • Field Type
  • FT_BOOL (Boolean) FT_FLOAT (Double)
  • FT_BYTE (Integer) FT_STRING (String)
  • FT_WORD (Integer) FT_TIMESTAMP (SixTimeStamp)
  • FT_DWORD (Long) FT_SYMBOL (Integer)
  • FT_SHORT (Long) FT_LINK (String)
  • FT_LONG (Long)
  • Data
  • Object

17
Field set information
The Field Set information is a table with fixed
format that describes the fields available in
another table. The field set response is a
kind of SixDataRes response. A record in the
field set corresponds to a field in the table it
describes. In the Java API, the API handles the
field set table data internally and offers
methods to get information for each record.
  • name
  • flags (key, sort, updateable, ...)
  • key order (used if key field)
  • sort order (used if more than one sort field)
  • field type
  • field length (in bytes)

18
Error Handling
  • Error when calling API methods
  • Error detected within the API
  • Error detected in the SIXP Server

19
Error when calling the API
Errors detected by the API when calling a method
is normally thrown as a SixException (subclass
of java.lang.Exception). Example try
sixEventHandler.send( request ) catch (
sixapi.SixException err )
System.out.println( Error err )
20
Receiving error response
Errors detected within the API or in the SIXP
Server are passed back to the user as an error
response. In processErrorResponse(), if using
SixEventHandler In update(), if using
SixHandler Example public void
processErrorResponse( SixException response
) System.out.println( Error response
)
21
Differences from old APIs, e.g. NT API
  • Data is delivered as application data, e.g.
    SixDataRes, and not as plain byte stream data
  • No need for reading missing data from temporary
    disk files
  • Changes in the protocol does normally not affect
    the application
  • ...

22
FAQ
Q What is included in the Java API? A Java
class files (sixapi.zip) and Documention
(javadocs.zip)
Q How do I get the Java API? A Visit
http//www2.six.se/java.htm or http//sixtrader.si
x.se
Q What do I need more? A Communication link to
a SIXP Server. Contact SIX for more
information.
23
System.exit( 0 )
Write a Comment
User Comments (0)
About PowerShow.com