systemic.sif.sbpframework.subscriber
Class SBPBaseSubscriber

java.lang.Object
  extended by systemic.sif.sifcommon.BaseInfo
      extended by systemic.sif.sifcommon.subscriber.BaseSubscriber
          extended by systemic.sif.sbpframework.subscriber.SyncSubscriber
              extended by systemic.sif.sbpframework.subscriber.SBPBaseSubscriber
All Implemented Interfaces:
java.lang.Runnable, openadk.library.QueryResults, openadk.library.Subscriber

public abstract class SBPBaseSubscriber
extends SyncSubscriber

This class implements some of the functionality defined in the Australian SBP. This are all infrastructure level functions and include: Start-up Sync Control through a DB and a dependent Object cache. For details please refer to the SBP Agent Framework Developer's Guide.

Note:

Subscribers that are part of the SBP must extend this SBPBaseSubscriber. If your agent deals with other SIF objects than the ones defined in the SBP then you should extends the SBPNoDOCSubscriber class for these objects and not this class. If you use this class for any other SIF objects than defined in the SBP the behaviour is unknown, most likely will cause your agent to crash.

Author:
Joerg Huber

Constructor Summary
SBPBaseSubscriber(java.lang.String subscriberID, openadk.library.ElementDef dtd)
          Default constructor
 
Method Summary
abstract  boolean doesObjectExistInTargetSystem(java.lang.String sifObjectName, java.util.List<SIFObjectKey> keyValues, openadk.library.SIFDataObject sifObject)
          This method needs to be implemented by the actual subscriber developer.
 void processObjectsWithoutDependencies()
          Should be called every so often.
 void requestDependentObjects()
          Sends a SIF Query for all dependent objects that are in the cache for this subscriber and application.
 
Methods inherited from class systemic.sif.sbpframework.subscriber.SyncSubscriber
sync
 
Methods inherited from class systemic.sif.sifcommon.subscriber.BaseSubscriber
debugOnEvent, debugOnQueryResults, finalise, getQueryResultsOptions, getSubscriptionOptions, onEvent, onQueryPending, onQueryResults, processEvent, processResponse, provision, reportSIFError, run, setQueryResultsOptions, setSubscriptionOptions, shutdownSubscriber, startConsumers
 
Methods inherited from class systemic.sif.sifcommon.BaseInfo
getAgentConfig, getAgentID, getAgentProperties, getAgentProperty, getApplicationID, getDtd, getFrameworkProperties, getId, getMappings, getZoneByID, getZones, isValidZone, setAgentConfig, setAgentID, setAgentProperties, setApplicationID, setDtd, setFrameworkProperties, setId, setMappings, setZones
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SBPBaseSubscriber

public SBPBaseSubscriber(java.lang.String subscriberID,
                         openadk.library.ElementDef dtd)
                  throws java.lang.IllegalArgumentException
Default constructor

Initialises the subscriber and also checks if the object this subscriber is responsible for is supported by the DOC. If not then a IllegalArgumentException is raised and the error is logged.

Parameters:
subscriberID - The unique ID of the subscriber (ie. StudentPersonalSubscriber).
dtd - The dtd for which this subscriber is responsible for.
Throws:
java.lang.IllegalArgumentException
Method Detail

doesObjectExistInTargetSystem

public abstract boolean doesObjectExistInTargetSystem(java.lang.String sifObjectName,
                                                      java.util.List<SIFObjectKey> keyValues,
                                                      openadk.library.SIFDataObject sifObject)
This method needs to be implemented by the actual subscriber developer. It shall check if the dependent object given by the sifObjectName parameter and the key given by the keyValues does exist in the target system. If it exists then TRUE must be returned if it doesn't exist then FALSE must be returned.

If the DOC is enabled and this method returns TRUE for the given sifObjectName and keyValues then the SIF Object given by the sifObject parameter will be cached and its dependent objects will automatically be requested by an appropriate subscriber (which can be a subscriber in another agent).

The keyValues holds the primary key (name as xpath and value) of the dependent SIF Object. In most cases this is a SIF refId, but in some cases can be something else. The keyValues parameter is a list of key values in case the primary key is made up of a compound key. The list will be in the correct order as defined by the SIF specification.

The parameter sifObjectName and keyValues are extracted from the sifObject. The sifObject is provided for convenience. There might be the need to get other information out of the sifObject parameter to implement this method successfully and therefore the availability of this parameter.

Example of parameters: StudentSchoolEnrollment D3E34B359D75101A8C3D00AA001A1652 A4E33E359D99101A8C3D00AA001BB76E 01 .....

For the above example object the 'sifObject' parameter would be StudentSchoolEnrollment object. The 'doesObjectExistInTargetSystem()' method would be called twice for the above object by the SBPBaseSubscriber because there are 2 dependent objects:

- The Student with RefId=D3E34B359D75101A8C3D00AA001A1652

- The School with RefId=A4E33E359D99101A8C3D00AA001BB76E

The sifObjectName and keyValues parameters for the two calls would be:

1st Call (Student): sifObjectName=StudentPersonal

keyValues[0].xpathToKey=@RefId, keyValues[0].keyValue=D3E34B359D75101A8C3D00AA001A1652

2nd Call (School) : sifObjectName=SchoolInfo

keyValues[0].xpathToKey=@RefId, keyValues[0].keyValue=A4E33E359D99101A8C3D00AA001BB76E

Parameters:
sifObjectName - Name of the dependent SIF Object (i.e. StudentPersonal, SchoolInfo etc).
keyValues - List of key values. Name of Key is an xpath into the dependent SIF Object, value is the actual value of key as extracted from the sifObject parameter.
sifObject - The SIF Object as delivered from the ZIS.
Returns:
See description

requestDependentObjects

public void requestDependentObjects()
Sends a SIF Query for all dependent objects that are in the cache for this subscriber and application. This will iterate through all zones of this agent to ensure that all dependent objects that have been received from various zones are requested.

This method must only run if this subscriber is responsible for a SIF Object that has other SIF objects with a dependency on this object. For example the StudentPersonal is such an object because a number of other SIF objects depend upon the StudentPersonal such as the StudentSchoolEnrollment, StudentContactRelationship etc.


processObjectsWithoutDependencies

public void processObjectsWithoutDependencies()
Should be called every so often. This method will check if there are cached objects that have no dependencies any more. If so the object can be processed by this subscriber and then removed from the cache. This process is only required for objects that have dependencies such as StaffAssignment. For objects without dependencies such as StudentPersonal there is no need to run this method.