Package | mx.data |
Class | public class RPCDataServiceAdapter |
Inheritance | RPCDataServiceAdapter DataServiceAdapter Object |
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
The trickiest thing about how this service works is that we want to take over the existing service's invocation so that user code is minimally impacted by the addition of data management. The service call works the same way, same events and tokens are fired only the result must be managed. To make this work, the RPCDataServiceAdapter associated a ManagedOperation with a regular RPC service operation. The operation's "operationManager" property is set and during initialization time and the end-user's call is redirected to a proxy method in this class (e.g. queryProxy). This generates the corresponding data management call and returns the managed token to the end user so they get the result of the managed operation.
order is: user calls service method calls service delegates to operationManager - ManagedOpertion.xxProxy methods calls managerOperation kicks off DMS op --> DataManager.xx calls DMS op calls adapter to do the op --> DataServiceAdapter.invoke calls: RPCDataServiceAdapter invokes the service operation and sets the "raw" lastResult returns: adapter's result comes back in and is converted to DMS Result Message - RPCDataServiceResult.xxResult returns: data manager processes result - updates managed object --> DataListRequestResponder/CommitResponder returns: service is updated to lastResult from the operation returns: user's result event is called
Property | Defined By | ||
---|---|---|---|
asyncRequest : AsyncRequest [override] [read-only]
An abstract method which returns an AsyncRequest that is used to handle
all DataService operations. | RPCDataServiceAdapter | ||
connected : Boolean [read-only]
Returns true when this service adapter is connected to its source. | DataServiceAdapter | ||
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
dataManagerRegistry : Object [static]
Static map from destination name to data manager for that destination. | RPCDataServiceAdapter | ||
dataStore : DataStore
Contains an object of type mx.data.DataStore. | DataServiceAdapter | ||
destination : String
Name of destination for this data service adapter. | RPCDataServiceAdapter | ||
serializeAssociations : Boolean [override] [read-only]
This controls whether or not DMS wraps the items into a serialization
descriptor which excludes the associations. | RPCDataServiceAdapter | ||
throwUnhandledFaults : Boolean [override] [read-only]
Returns false because this data manager does not throw an error
if there is a fault with no listeners on the data manager. | RPCDataServiceAdapter |
Method | Defined By | ||
---|---|---|---|
This method is called by the RPCDataServiceAdapter when it needs to perform the createItem operation. | RPCDataServiceAdapter | ||
This is called by the RPCDataServiceAdapter when the management layer wants to delete an item
from the server. | RPCDataServiceAdapter | ||
executeQuery(dataManager:RPCDataManager, queryName:String, includeSpecifier:PropertySpecifier, queryArgs:Array):mx.rpc:AsyncToken
Called when the adapter needs to execute a named query. | RPCDataServiceAdapter | ||
Returns an array of property names that conflict between the client's version of an item and
the server's version. | RPCDataServiceAdapter | ||
[override]
Finds the data manager for a specified destination. | RPCDataServiceAdapter | ||
Looks up an associated data service adapter. | DataServiceAdapter | ||
getItem(dataManager:RPCDataManager, identity:Object, defaultValue:Object = null, includeSpecifier:PropertySpecifier = null):mx.rpc:AsyncToken
Called to retrieve an individual item by identity from the adapter. | RPCDataServiceAdapter | ||
getItems(dataManager:RPCDataManager, ids:Array, includeSpecifier:PropertySpecifier):mx.rpc:AsyncToken
Adapter method called when a list of items for a specific destination need to be fetched. | RPCDataServiceAdapter | ||
This gets called after we've finished processing a fault of a create, update, delete, or update collection
operation. | RPCDataServiceAdapter | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
pageQuery(dataManager:RPCDataManager, queryName:String, queryArgs:Array, startIndex:int, numItems:int):mx.rpc:AsyncToken
Perform a query for a single page of a client side query. | RPCDataServiceAdapter | ||
Simulate an event from the server that corresponds to an item delete. | RPCDataServiceAdapter | ||
postItemUpdate(dataManager:RPCDataManager, item:Object, origItem:Object = null, changes:Array = null):void
Simulate an event from the server that corresponds to an item update or creation. | RPCDataServiceAdapter | ||
Low-level method used by the DataManager to processes a data message. | RPCDataServiceAdapter | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
This gets called when we get a fault that might be a conflict from the server. | RPCDataServiceAdapter | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
updateCollection(dataManager:RPCDataManager, mq:ManagedQuery, ucmsg:UpdateCollectionMessage):mx.rpc:AsyncToken
This is called when a collection managed by a query (not an association) has items
added to the collection or removed from the collection. | RPCDataServiceAdapter | ||
updateItem(dataManager:RPCDataManager, item:Object, origItem:Object, changes:Array):mx.rpc:AsyncToken
This method is called by the RPCDataServiceAdapter to perform a specific updateItem operation. | RPCDataServiceAdapter | ||
Returns the primitive value of the specified object. | Object |
Method | Defined By | ||
---|---|---|---|
This method gets called after a fault which might determine a conflict. | RPCDataServiceAdapter | ||
internalGetItem(dataManager:RPCDataManager, identity:Object, defaultValue:Object = null, includeSpecifier:PropertySpecifier = null):mx.rpc:AsyncToken
This method actually performs the getItem operation but the result handler will not be used to update
the managed result. | RPCDataServiceAdapter | ||
Fault responder for RPCDataService operations. | RPCDataServiceAdapter | ||
Success responder for RPCDataService operations. | RPCDataServiceAdapter |
asyncRequest | property |
asyncRequest:AsyncRequest
[read-only] [override] Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
An abstract method which returns an AsyncRequest that is used to handle all DataService operations. By overriding the AsyncRequest.invoke method you can intercept managed requests. The AsyncRequest class also exposes the various methods for determining if the service is connected or disconnected.
Implementation
override public function get asyncRequest():AsyncRequest
dataManagerRegistry | property |
public static var dataManagerRegistry:Object
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Static map from destination name to data manager for that destination.
destination | property |
public var destination:String
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Name of destination for this data service adapter.
serializeAssociations | property |
serializeAssociations:Boolean
[read-only] [override] Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
This controls whether or not DMS wraps the items into a serialization descriptor which excludes the associations. The MessagingDataServiceAdapter will use this approach for sending associations - not used in the RPCDataServiceAdapter.
Implementation
override public function get serializeAssociations():Boolean
throwUnhandledFaults | property |
throwUnhandledFaults:Boolean
[read-only] [override] Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns false because this data manager does not throw an error if there is a fault with no listeners on the data manager. For RPC servies, those errors are proxied to listeners on the service and so throwing the error is not appropriate.
Implementation
override public function get throwUnhandledFaults():Boolean
checkForConflict | () | method |
protected function checkForConflict(resultEvent:ResultEvent, token:mx.rpc:AsyncToken):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
This method gets called after a fault which might determine a conflict.
In the fault handler for that fault, issue a getItem()
call to retrieve the server's current
version of the item.
One reason you might want to override this method is if you need to take action after no conflict is detected.
Parameters
resultEvent:ResultEvent — The event object from the getItem() call.
| |
token:mx.rpc:AsyncToken — Contains a cause property which is the original DataMessage for the change.
This method can call Conflicts.raiseConflict() when there is a conflict, or it can
do nothing if it determines there is no conflict.
|
createItem | () | method |
public function createItem(dataManager:RPCDataManager, item:Object):mx.rpc:AsyncToken
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
This method is called by the RPCDataServiceAdapter when it needs to perform the createItem operation. The default implementation is to invoke the managed operation registered for the createItem operation using the item as the first parameter. If you need to invoke more than one service or change the parameter signature for this operation, you can extend the RPCDataServiceAdapter and override this createItem method.
Parameters
dataManager:RPCDataManager — manager in control of the create operation to be invoked.
| |
item:Object — item to be created.
|
mx.rpc:AsyncToken — You can use this token to register one or more callback functions to receive result or
fault events from this create operation. This token is also returned in the call property of
the ResultEvent.RESULT or in the FaultEvent.FAULT .
Custom data can be attached to this object and inspected later during the event handling phase.
|
deleteItem | () | method |
public function deleteItem(dataManager:RPCDataManager, item:Object):mx.rpc:AsyncToken
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
This is called by the RPCDataServiceAdapter when the management layer wants to delete an item from the server. The item to be deleted is provided as an argument. The default implementation of this method looks for a ManagedOperation of type="delete". That method is called with the item to be deleted, or the id of the item to be deleted if the parameters of the ManagedOperation is set to "id".
Parameters
dataManager:RPCDataManager — manager in control of the delete operation to be invoked.
| |
item:Object — item to be deleted.
|
mx.rpc:AsyncToken — You can use this token to register one or more callback functions to receive result or
fault events from this delete operation. This token is also returned in the call property of
the ResultEvent.RESULT or in the FaultEvent.FAULT .
Custom data can be attached to this object and inspected later during the event handling phase.
|
executeQuery | () | method |
public function executeQuery(dataManager:RPCDataManager, queryName:String, includeSpecifier:PropertySpecifier, queryArgs:Array):mx.rpc:AsyncToken
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Called when the adapter needs to execute a named query. If paging is enabled, this will fetch the first page in the collection.
Parameters
dataManager:RPCDataManager — manager in control of the query operation to be invoked.
| |
queryName:String — query name
| |
includeSpecifier:PropertySpecifier — set of properties to be retrieved.
| |
queryArgs:Array — arguments to the query operation invocation.
|
mx.rpc:AsyncToken — You can use this token to register one or more callback functions to receive result or
fault events from this query operation. This token is also returned in the call property of
the ResultEvent.RESULT or in the FaultEvent.FAULT .
Custom data can be attached to this object and inspected later during the event handling phase.
|
getConflictingProperties | () | method |
public function getConflictingProperties(dmgr:RPCDataManager, cause:DataMessage, serverObject:Object):Array
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Returns an array of property names that conflict between the client's version of an item and the server's version. Returns null if there are no conflicts.
Parameters
dmgr:RPCDataManager — associated data manager.
| |
cause:DataMessage — data message whose processing may have triggered a conflict.
| |
serverObject:Object — the server's version of the item.
|
Array — an array of property names that conflict between the client's version of an item and
the server's version. Returns null if there are no conflicts.
|
getDataManager | () | method |
override public function getDataManager(destination:String):DataManager
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Finds the data manager for a specified destination.
Parameters
destination:String — The destination.
|
DataManager — The DataManager object for the destination.
|
getItem | () | method |
public function getItem(dataManager:RPCDataManager, identity:Object, defaultValue:Object = null, includeSpecifier:PropertySpecifier = null):mx.rpc:AsyncToken
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Called to retrieve an individual item by identity from the adapter. The includeSpecifier parameter specifies the set of properties requested.
Parameters
dataManager:RPCDataManager — associated data manager.
| |
identity:Object — identity of the item to be retrieved.
| |
defaultValue:Object (default = null ) — [optional] An instance of the type with the
default values that should be created if it doesn't exist.
| |
includeSpecifier:PropertySpecifier (default = null ) — [optional] set of properties to be retrieved.
|
mx.rpc:AsyncToken — AsyncToken bind to the result property of the AsyncToken to retrieve the
result. Otherwise, you can listen for the result property change event, add one or more
responders to the token and add additional information as dynamic properties of the
token to keep track of the results of the operation.
|
getItems | () | method |
public function getItems(dataManager:RPCDataManager, ids:Array, includeSpecifier:PropertySpecifier):mx.rpc:AsyncToken
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Adapter method called when a list of items for a specific destination need to be fetched. The PropertySpecifier indicates the minimum set of properties needed. The default implementation of this method is to call the getItem method repeatedly. If your server can perform this operation more efficiently it may improve some operations to implement this method.
Parameters
dataManager:RPCDataManager — associated data manager.
| |
ids:Array — array of identities for the items to be retrieved.
| |
includeSpecifier:PropertySpecifier — [optional] set of properties to be retrieved.
|
mx.rpc:AsyncToken — AsyncToken bind to the result property of the AsyncToken to retrieve the
result. Otherwise, you can listen for the result property change event, add one or more
responders to the token and add additional information as dynamic properties of the
token to keep track of the results of the operation.
|
handleFault | () | method |
public function handleFault(errMsg:ErrorMessage, cause:DataMessage):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
This gets called after we've finished processing a fault of a create, update, delete, or update collection operation. It is an adapter's chance to customize logic associated with the error handling and check for conflicts. The default implementation implements the RPCDataManager conflictMode feature. When it gets a fault for an UPDATE or DELETE operation, it compares the current server version against the original version of the updated/deleted object. If the server version is different, we raise that as a conflict. This assumes that the faulting change has already been put back into the uncommitted batch of changes.
Parameters
errMsg:ErrorMessage — The description of the error.
| |
cause:DataMessage — The operation that caused the error.
|
internalGetItem | () | method |
protected function internalGetItem(dataManager:RPCDataManager, identity:Object, defaultValue:Object = null, includeSpecifier:PropertySpecifier = null):mx.rpc:AsyncToken
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
This method actually performs the getItem operation but the result handler will not be used to update the managed result. This method is used by the default getItem implementation to invoke the operation. When conflict detection is enabled, after a fault is received for an update or delete operation, this method is called to retrieve the current server version of the object so we can see if the fault was an indication a conflict and to get the current server version so we can resolve that conflict.
Parameters
dataManager:RPCDataManager — associated data manager.
| |
identity:Object — identity of the item to be retrieved.
| |
defaultValue:Object (default = null ) — [optional] An instance of the type with the
default values that should be created if it doesn't exist.
| |
includeSpecifier:PropertySpecifier (default = null ) — [optional] set of properties to be retrieved.
|
mx.rpc:AsyncToken — AsyncToken bind to the result property of the AsyncToken to retrieve the
result. Otherwise, you can listen for the result property change event, add one or more
responders to the token and add additional information as dynamic properties of the
token to keep track of the results of the operation.
|
pageQuery | () | method |
public function pageQuery(dataManager:RPCDataManager, queryName:String, queryArgs:Array, startIndex:int, numItems:int):mx.rpc:AsyncToken
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Perform a query for a single page of a client side query. This method is called when pagingEnabled is set on a ManagedQuery. The client code will invoke the query as normal with just the usual query parameters. The management layer will insert the startIndex and numItems parameters before it makes the call.
Parameters
dataManager:RPCDataManager — manager in control of the query operation to be invoked.
| |
queryName:String — query name.
| |
queryArgs:Array — arguments to the query operation invocation.
| |
startIndex:int — start index for the page to be retrieved.
| |
numItems:int — size of page.
|
mx.rpc:AsyncToken — You can use this token to register one or more callback functions to receive result or
fault events from this query operation. This token is also returned in the call property of
the ResultEvent.RESULT or in the FaultEvent.FAULT .
Custom data can be attached to this object and inspected later during the event handling phase.
|
postItemDeletion | () | method |
public function postItemDeletion(dataManager:RPCDataManager, identity:Object):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3.1 |
Runtime Versions: | Flash Player 9, AIR 1.5 |
Simulate an event from the server that corresponds to an item delete. This is useful to notify LCDS that something has been deleted on the server.
Parameters
dataManager:RPCDataManager — associated data manager.
| |
identity:Object — the identity of the deleted item.
|
postItemUpdate | () | method |
public function postItemUpdate(dataManager:RPCDataManager, item:Object, origItem:Object = null, changes:Array = null):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3.1 |
Runtime Versions: | Flash Player 9, AIR 1.5 |
Simulate an event from the server that corresponds to an item update or creation. This is useful to notify LCDS that something has changed on the server.
Parameters
dataManager:RPCDataManager — the associated data manager.
| |
item:Object — the updated item.
| |
origItem:Object (default = null ) — the original item.
| |
changes:Array (default = null ) — names of properties that are changed.
|
processDataMessage | () | method |
public function processDataMessage(msg:IMessage, responder:IResponder):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Low-level method used by the DataManager to processes a data message. It converts the data message into calls to the adpater interface so typically you can override one of those operations.
Parameters
msg:IMessage — message to be processed.
| |
responder:IResponder — responder to be called back when the message processing completes.
|
rpcAdapterFault | () | method |
protected function rpcAdapterFault(ev:FaultEvent, token:mx.rpc:AsyncToken):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Fault responder for RPCDataService operations. Handles faults by building appropriate error message and propagating it up the token's responder chain.
Parameters
ev:FaultEvent — fault event received from the server.
| |
token:mx.rpc:AsyncToken — token associated with the invocation.
|
sendResultEvent | () | method |
protected function sendResultEvent(token:mx.rpc:AsyncToken, msg:IMessage):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
Success responder for RPCDataService operations. Wraps the received message in a message event and propagates it up the token's responder chain.
Parameters
token:mx.rpc:AsyncToken — token associated with the invocation.
| |
msg:IMessage — result message received from the server
|
startCheckForConflict | () | method |
public function startCheckForConflict(dmgr:RPCDataManager, cause:DataMessage, errMsg:ErrorMessage = null):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
This gets called when we get a fault that might be a conflict from the server. We'll try to get the current values for the item which is in conflict and then compare them to the original item in the change we tried to apply. If there are differences, that is a conflict which we'll raise.
Parameters
dmgr:RPCDataManager — the data manager associated with this adapter's destination.
| |
cause:DataMessage — original data message that may have potentially caused a conflict.
| |
errMsg:ErrorMessage (default = null ) — the error message describing the fault associated with the conflict.
|
updateCollection | () | method |
public function updateCollection(dataManager:RPCDataManager, mq:ManagedQuery, ucmsg:UpdateCollectionMessage):mx.rpc:AsyncToken
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
This is called when a collection managed by a query (not an association) has items added to the collection or removed from the collection. There is a single message with a list of individual changes. Often you do not need to override this method as those changes are not needed to persist changes made on the client.
If you are implementing associations such as a many-to-many relationship using queries, it may be helpful though to add/remove a row during these operations.
The RPCDataServiceAdapter implementation maps these to individual add and remove calls.
Parameters
dataManager:RPCDataManager — The data manager associated with this adapter's destination.
| |
mq:ManagedQuery — the managed query for which items have been added or removed.
| |
ucmsg:UpdateCollectionMessage — update collection message detailing the items that have been added or removed
|
mx.rpc:AsyncToken — AsyncToken reference to the token that will identify this
operation in a result or fault event dispatched from this service.
|
updateItem | () | method |
public function updateItem(dataManager:RPCDataManager, item:Object, origItem:Object, changes:Array):mx.rpc:AsyncToken
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
This method is called by the RPCDataServiceAdapter to perform a specific updateItem operation. It is given the new version of the item, the original version of that item before it was modified on this client and the list of properties which are changed. The default implementation looks for a ManagedOperation of type="update" and calls that. The managed operation should at least take the new version of the item as a parameter. If it additionally declares parameters with the special names "origItem" and "changes" those parameters will be provided as well to the remote service.
Parameters
dataManager:RPCDataManager — The data manager.
| |
item:Object — The new version of the item.
| |
origItem:Object — The original item.
| |
changes:Array — list of properties which to change.
|
mx.rpc:AsyncToken — AsyncToken reference to the token that will identify this
operation in a result or fault event dispatched from this service.
|
Thu Dec 6 2018, 01:12 PM -08:00