Hemi JavaScript Framework

Hemi.data.io

Description

The Data IO service is used to broker data requests with configured data providers. The built-in interchange format is loosely modelled on the Account Manager 4 Data and Group object model, but the implementation is open for any object type.

Class Index

static Hemi.data.io.DataIOProvider

version 3.1.9

This static class describes the interface an object must expose to provide data via the Data IO Service. A provider must be registered with the ObjectRegistry. The addServiceAPI method may be used to instrument this API for quick access to the service.

Index

Method Index

Methods

handle_io_open_request

A notification that a request has been opened.

Syntax

void handle_io_open_request( ioService, vSubj, ioRequest, ioResponse )

Parameters

handle_io_register

A notification that the provider was registered with the service.

Syntax

void handle_io_register( ioService )

Parameters

handle_io_request

A notification that a request should be processed.

Syntax

bComplete = handle_io_request( ioService, vSubj, IORequest, ioResponse )

Parameters

Returns

bComplete as boolean: Bit indicating that the request response was completed.

handle_io_unregister

A notification that the provider is being unregistered.

Syntax

void handle_io_unregister( ioService )

Parameters

handle_proxy_xml

When registered as a protocol proxy, matching URI requests made from the context of the registered bus are diverted to this provider. The provider implements the handle_proxy_xml method to compose a Data IO Request based on the URI pattern. NOTE: Only one provider may register for a particular protocol, regardless of bus type.

Syntax

oRequest = handle_proxy_xml( sPath, sId, bPost, vData, c, t, iBusType )

Parameters

Returns

oRequest as DataIORequest: Returns a Data IO Request based on the supplied input.

implement

Registers a specific implementation. The order of the invocation is: requestCatalog{Action}, requestAction{Action}. This method is injected onto a provider after registration. Method is virtual and can be overridden.

Syntax

void implement( sContext, sAction )

Parameters

requestTypeAction

The virtual method is invoked based on the combination of the implements method. Method is virtual and can be overridden.

Syntax

bHandled = requestTypeAction( oService, oSubject, oRequest, oResponse )

Parameters

Returns

bHandled as bit: Bit indicating the request was handled.

static Hemi.data.io.service

version 3.1.9

Static implementation of the hemi.app.module.serviceImpl class.

Hemi.data.io.serviceImpl

version 3.1.9

The Data IO service provides a bus to registered Data Providers. IORequest and IOSubject objects are used to convey a description of the request to the providers. Each provider may then determine whether and when to handled the request, and return results as an IOResponse.

Index

Object Index

Method Index

Message Index

Objects

Data

An object representing variable data.

Properties

Group

An object representing a group.

Properties

IOInstruction

Instructions relevent to the request.

Properties

IORequest

An object representing the subject of a request. This object is determined and set by the framework context. The parameters are modeled after the Core Web and Account ManagerCore Handler request processor.

Properties

IOResponse

An object representing the response to a request.

Properties

Methods

IOSubject

An object representing the subject of a request. This object is determined and set by the framework context.

Properties

Policy

Authorization policy affecting a particular object.

Properties

Methods

arrayToData

Returns an array of data objects.

Syntax

aData = arrayToData( aArray, oPolicy )

Parameters

Returns

aData as Array<Data>: An array of data objects.

arrayToGroup

Returns an array of group objects.

Syntax

aGroups = arrayToGroup( aArray, oPolicy, sParentPath )

Parameters

Returns

aGroups as Array<Group>: An array of group objects.

continueRequest

For asynchronous requests, continues processing the request transaction. The instance invoking this method may indicate that it completed processing its portion of the request, and therefore it should not receive a subsequent transaction processing callback.

Syntax

void continueRequest( ioRequest, oProvider, bComplete )

Parameters

createRequest

Constructs a request object from the specified parameters, opens a new request transaction, and returns a new request object, registered with the io service, prepared with a response, and ready for use.

Syntax

oReq = createRequest( oSubject, eBus, sApplication, sContext, sCatalog, sAction, sId, sName, bDetailsOnly, bAsync, bCache, oInstruction, fHandler )

Parameters

Returns

oReq as IORequest: A request object.

endRequest

Specified for, and invoked as, the transaction packet handler for transactions opened for requests. Method is virtual and can be overridden.

Syntax

void endRequest( oService, oPacket )

Parameters

getBusName

Returns the name of the specified bus type.

Syntax

sBusName = getBusName( iBus )

Parameters

Returns

sBusName as String: The name of the specified of bus type.

getBusType

Returns the enumeration of bus types.

Syntax

eBus = getBusType( )

Returns

eBus as Enum<BusType>: The enumeration of bus types.

getList

Opens a catalog request, where the requestName is 'catalog',

Syntax

oResp = getList( eBus, sApplication, sContext, sCatalog, sRequest, bAsync, fHandler )

Parameters

Returns

oResp as IOResponse: The response object created for the request.

getSubject

Returns the current IOSubject. This is assumed to be updated by any session handling mechanism (E.G.: Refer component.session.xml for implementation when used with Core Web 4 project).

Syntax

oSub = getSubject( )

Returns

oSub as IOSubject: The current IOSubject.

handle_io_response

A notification that a response was created for a pending request. Method is virtual and can be overridden.

Syntax

void handle_io_response( ioService, vSubj, ioRequest, ioResponse )

Parameters

isRegistered

Determines whether an object is registered as a provider.

Syntax

bRegistered = isRegistered( oObject )

Parameters

Returns

bRegistered as bit: Bit indicating whether the provider is registered.

mapSession

Maps the Core Session component data to the DataIO subject.

Syntax

void mapSession( oSession )

Parameters

newData

Returns a new data object.

Syntax

oData = newData( )

Returns

oData as Data: A new data object.

newGroup

Returns a new group object.

Syntax

alist = newGroup( )

Returns

alist as Data: A new group object.

newIOInstruction

Returns a new request object.

Syntax

oInst = newIOInstruction( bPaginate, iStartRecord, iRecordCount, sOrder, sGroup )

Parameters

Returns

oInst as IOInstruction: A new set of request instructions.

newIORequest

Returns a new request object.

Syntax

oReq = newIORequest( eBus, sApplication, sContext, sCatalog, sAction, sId, sName, bDetailsOnly, bAsync, bCache, oInstruction )

Parameters

Returns

oReq as IORequest: A new request object.

newIOResponse

Returns a new response object.

Syntax

oReq = newIOResponse( vReq, fHandler )

Parameters

Returns

oReq as IOResponse: A new response object.

newPolicy

Returns a new policy object.

Syntax

oPolicy = newPolicy( )

Returns

oPolicy as Policy: A new policy object.

openRequest

Opens a new request transaction, and returns a new request object, registered with the io service, prepared with a response, and ready for use.

Syntax

oReq = openRequest( oSubject, IORequest, fHandler )

Parameters

Returns

oReq as IORequest: A request object.

register

Registers a Data IO Provider.

Syntax

bRegistered = register( oProvider, sBusType, sProviderName, sProtocolProxy )

Parameters

Returns

bRegistered as bit: Bit indicating whether the provider was registered.

unregister

Unregisteres a provider from the Data IO service.

Syntax

bRegistered = unregister( oProvider, bPointer )

Parameters

Returns

bRegistered as bit: Bit indicating whether the provider was unregistered.

updateSubject

Notifies subscribers to onupdatesubject message that the subject was updated. Method is virtual and can be overridden.

Syntax

void updateSubject( )

Messages

onupdatesubject

Message published to all subscribers when the default subject for the service has been updated.

Syntax

// User-specified script to subscribe to message
org.cote.js.message.MessageService.subscribe("onupdatesubject",_handle_message);
// Internal: how the message is published to subscribers
org.cote.js.message.MessageService.publish("onupdatesubject" , o );
// User-specified script to handle the message subscription
function _handle_message("onupdatesubject" , o ){
// message handler code
}

Parameters