How the connector works
This section describes how the different parts of the
connector process a business object:
-
Upon startup of the connector, the
connector's Agent class performs the following initialization
(Init) processes:
- Retrieves configuration properties.
- Fetches the Username and Password, and Environment from the connector configuration file.
- Creates a OneWorld connector object.
- Logs in to the OneWorld server using the Login method and parameters using the Username and Password as fetched above. This method returns a SessionID.
- Creates an instance of the OneWorld interface object.
- Adds the connector, OneWorldInterface, and SessionID to the connection pool.
- The OneWorld business object handler reads the verb ASI and
translates it into a sequence of callable functions or child objects.
- If the business object has a child business object of type ACCESS_LEVEL and the Username attribute within this child business object is populated
and has a value that is different from what is used by the adapter,
then the business object handler opens a new connection using the
values of the Username and Password attributes specified for the ACCESS_LEVEL business object. All such business objects must have both Username and Password attributes populated.
- If the connection creation fails because the application is
down, the business object handler returns APPRESPONSETIMEOUT.
- If the connection creation fails because the Username/Password is wrong, then the business object handler logs an error
and returns a FAIL status.
- If the business object does not have a child business object
of type ACCESS_LEVEL, or the value for the Username attribute in this business object is null or has the same value as specified for the adapter Username, then it fetches a connection form the available connection
pool. The following steps represent what would happen in the connection
pool when the business object handler requests an available connection:
- The business object handler checks to see if there are available
connections in the pool.
- If yes, it checks for the validity of the connection. If it
is not valid it attempts to recreate the connection.
- If the connection creation fails, it returns APPRESPONSETIMEOUT status.
- The business object handler removes the connection from the
available list and adds it to the busy list.
- If the connection is not available and the maximum number of
connections is less than the pool size, then it opens a new connection
and adds it to the connection pool's busy list. If opening
a new connection returns a failure, the adapter returns APPRESPONSETIMEOUT.
- If no connections are available and the maximum limit of the
pool size has been reached, then the doVerbFor thread waits until a connection becomes available.
- If the business object is of type BFN, then the adapter performs the following actions:
- The adapter starts a transaction using the BeginTransaction method of the OneWorld class OneWorldInterface.
- If the business object maps to an interface class and if the
verb ASI is blank, the adapter finds the first method attribute
or the first child object that is populated in the business object
and executes. it.
- If the verb ASI is populated, the adapter calls InvokeMethods, which loops through all the methods specified in the verb
ASI.
- If the business object maps to a business function, Invoker
executes the business function that maps to the business object.
If there are child business objects that are not of type ACCESS_LEVEL, the business object handler loops through them and executes
the business functions corresponding to them in the order in which
they are defined in the top-level business object.
- Invoker constructs the arguments based on the attributes defined
in the business object and then invokes the method on OneWorld Java
objects using reflection APIs.
- If the execution of the complete business object succeeds, the
business object handler commits the transaction using the Commit method on object OneWOrldInterface and returns a VALCHANGED status.
- If the business object is of type XMLList, then the adapter performs the following actions:
- The adapter creates an XML document with the values and format
as specified in the business object.
- The adapter sends the document to OneWorld using XML List APIs.
- In the event of a failure, the adapter logs an error code and
reason in the response document. It also logs errors in the log
file with the return status of FAIL if there is a problem with the request document.
- When the adapter sends the XML document to OneWorld successfully,
the values from the response document are updated in the business
object.
- If the business object has child business objects that are not
of type ACCESS_LEVEL, the handler repeats the above steps for each child business
object.
- If the adapter processes the entire business object successfully,
the status is set to VALCHANGED.
- Releases the connection to the connection pool.
- Returns VALCHANGED upon successful execution of the business functions.
- Returns FAIL if the business object is of type BFN and maps to the Interface class and the verb ASI is blank and no attributes are populated.
- Returns FAIL if processing fails.
- The ConnectionEventStore class performs the following for subscription delivery:
- When the connector encounters an event, it
- creates a business object of the type specified by the event,
- sets the key and non-key values for the business object (using
the object key specified in the event table),
- sets the verb as Execute if the business object is of type business function,
- sets the verb as Retrieve if the business object is of type interface.
- After it retrieves the business object, the connector sends
it to the integration broker with the verb specified in the event.
- Terminates (Terminate) by closing all the connections from the connection pool.
