mx.data

# ManagedRemoteService - AS3 ADEP Data Services

Package | mx.data
Class | public dynamic class ManagedRemoteService
Inheritance | ManagedRemoteService AbstractService Proxy
Implements | IEventDispatcher
Subclasses | ManagedRemoteService

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

The ManagedRemoteService class gives you access to Remoting classes on a remote application server with the data management capabilities of LCDS.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | channelSet : ChannelSet Provides access to the ChannelSet used by the service. | AbstractService
|  | concurrency : String Value that indicates how to handle multiple calls to the same service. | ManagedRemoteService
|  | convertParametersHandler : Function An optional function, primarily intended for framework developers who need to install a function to get called with the parameters passed to each remote object invocation. | ManagedRemoteService
|  | convertResultHandler : Function An optional function, primarily intended for framework developers who need to install a hook to process the results of an operation before notifying the result handlers. | ManagedRemoteService
|  | destination : String [override] Provides access to the destination for the MessageAgent. | ManagedRemoteService
|  | managers : Array [override] Not supportted by Managed Remoting. | ManagedRemoteService
|  | operations : Object The Operations array is usually only set by the MXML compiler if you create a service using an MXML tag. | AbstractService
|  | requestTimeout : int Provides access to the request timeout in seconds for sent messages. | AbstractService
|  | showBusyCursor : Boolean If true, a busy cursor is displayed while a service is executing. | ManagedRemoteService
|  | throwItemPendingErrors : Boolean Set this property to false if you want to suppress item pending errors when lazily fetched or unpaged data is accessed. | ManagedRemoteService
|  | verifyEntityClasses : Boolean If true, verify that all managed entities are present. | ManagedRemoteService

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | ManagedRemoteService(destinationId:String = null) Creates a new ManagedRemoteService. | ManagedRemoteService
|  | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void [override] Add an event listener to the service. | ManagedRemoteService
|  | commitRequiredOn(item:Object):Boolean Indicates if there are pending changes for this particular object. | ManagedRemoteService
|  | disconnect():void Disconnects the service's network connection and removes any pending request responders. | AbstractService
|  | getOperation(name:String):AbstractOperation [override] Returns an Operation of the given name. | ManagedRemoteService
|  | initialize():void Called to initialize the service. | AbstractService
|  | initializeService():mx.rpc:AsyncToken Force initialization of the Managed Remote Service. | ManagedRemoteService
|  | logout():void [override] Log the user out of the destination for the service and releases all managed collections and items. | ManagedRemoteService
|  | releaseCollection(view:ListCollectionView, clear:Boolean = false, copyStillManagedItems:Boolean = true):void Releases the specified collection from management by the underlying DataService. | ManagedRemoteService
|  | releaseItem(item:IManaged, dontClearStillManagedItems:Boolean = true, copyStillManagedItems:Boolean = true):IManaged Releases the specified item from management by the underlying DataService. | ManagedRemoteService
|  | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void [override] Remove specified listener from the service. | ManagedRemoteService
|  | revertChanges(item:IManaged = null):Boolean This will undo any changes to the specified item and remove those changes from the cache. | ManagedRemoteService
|  | setCredentials(username:String, password:String, charset:String = null):void [override] Sets the credentials for the destination accessed by the service when using Managed Remoting on the server side. | ManagedRemoteService
|  | setPageSizeForOperation(operationName:String, pageSize:int):void Set the pageSize for the specified named operation. | ManagedRemoteService
|  | setRemoteCredentials(remoteUsername:String, remotePassword:String, charset:String = null):void [override] Sets the credentials for the third party of this Managed Remoting destination. | ManagedRemoteService
|  | toString():String Represents an instance of MangedRemoteService as a String, describing important properties such as the destination id and the set of channels assigned. | ManagedRemoteService

Events
Click for more information on events
Hide Inherited Events
Show Inherited Events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | conflict | The DataConflictEvent.CONFLICT event is dispatched when a conflict is detected between pending local changes and changes submitted by another client, or when changes submitted by this client conflict with those in the remote destination. | ManagedRemoteService
|  | fault | The DataServiceFaultEvent.FAULT event is dispatched when a service call fails due to an error. | ManagedRemoteService
|  | invoke | The invoke event is dispatched when a service Operation is invoked so long as an Error is not thrown before the Channel attempts to send the message. | AbstractService
|  | message | The MessageEvent.MESSAGE event is dispatched when the remote destination pushes a notification of a data operation. | ManagedRemoteService
|  | result | The ResultEvent.RESULT event is dispatched when a service call successfully returns. | ManagedRemoteService

Property Detail

### concurrency

property

`concurrency:String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Value that indicates how to handle multiple calls to the same service. The default value is multiple. The following values are permitted:

- multiple - Existing requests are not cancelled, and the developer is responsible for ensuring the consistency of returned data by carefully managing the event stream. This is the default.
- single - Making only one request at a time is allowed on the method; additional requests made while a request is outstanding are immediately faulted on the client and are not sent to the server.
- last - Making a request causes the client to ignore a result or fault for any current outstanding request. Only the result or fault for the most recent request will be dispatched on the client. This may simplify event handling in the client application, but care should be taken to only use this mode when results or faults for requests may be safely ignored.

Implementation
`public function get concurrency():String`
`public function set concurrency(value:String):void`

### convertParametersHandler

property

`public var convertParametersHandler:Function`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

An optional function, primarily intended for framework developers who need to install a function to get called with the parameters passed to each remote object invocation. The function takes an array of parameters and returns the potentially altered array. The function definition should look like: `function myParametersFunction(parameters:Array):Array`

### convertResultHandler

property

`public var convertResultHandler:Function`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

An optional function, primarily intended for framework developers who need to install a hook to process the results of an operation before notifying the result handlers. The function definition should look like: `function myConvertResultsFunction(result: operation:AbstractOperation):` It is passed the result just after the makeObjectsBindable conversion has been done but before the result event is created.

### destination

property

`destination:String`[override]

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Provides access to the destination for the MessageAgent. Changing the destination will disconnect the MessageAgent if it is currently connected.

Implementation
`override public function get destination():String`
`override public function set destination(value:String):void`

### managers

property

`managers:Array`[override]

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Not supportted by Managed Remoting.

Implementation
`override public function get managers():Array`
`override public function set managers(value:Array):void`

### showBusyCursor

property

`showBusyCursor:Boolean`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

If `true`, a busy cursor is displayed while a service is executing. The default value is `false`.

Implementation
`public function get showBusyCursor():Boolean`
`public function set showBusyCursor(value:Boolean):void`

### throwItemPendingErrors

property

`throwItemPendingErrors:Boolean`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Set this property to `false` if you want to suppress item pending errors when lazily fetched or unpaged data is accessed. Instead of throwing the error, null is returned for a property value or a `getItemAt()` call in an ArrayCollection.

The `size()` method returns 0 elements for a list for which the size has not yet been fetched from the server. When the element is returned from the server, the appropriate PropertyChangeEvent and CollectionEvent events are dispatched.

Implementation
`public function get throwItemPendingErrors():Boolean`
`public function set throwItemPendingErrors(value:Boolean):void`

### verifyEntityClasses

property

`verifyEntityClasses:Boolean`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

If `true`, verify that all managed entities are present. When the service is initialized each of the managed entities specified by the service are validated to ensure a class with the appropriate alias exists in the client. You may set this to `false` if your client does not use all of the managed entities of a service and you do not want to link classes you are not using in to your code. The default is `true`.

Implementation
`public function get verifyEntityClasses():Boolean`
`public function set verifyEntityClasses(value:Boolean):void`
Constructor Detail

### ManagedRemoteService

()
Constructor

`public function ManagedRemoteService(destinationId:String = null)`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Creates a new ManagedRemoteService.

Parameters

| `destinationId:String` (default = `null`)`` — [optional] Destination of the ManagedRemoteService

Method Detail

### addEventListener

()
method

`override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Add an event listener to the service.

Parameters

| `type:String` — The type of event.
| `listener:Function` — The listener function that processes the event. This function must accept an Event object as its only parameter and must return nothing.
| `useCapture:Boolean` (default = `false`)`` — Determines whether the listener works in the capture phase or the target and bubbling phases. If useCapture is set to true, the listener processes the event only during the capture phase and not in the target or bubbling phase. If useCapture is false, the listener processes the event only during the target or bubbling phase. To listen for the event in all three phases, call addEventListener twice, once with useCapture set to true, then again with useCapture set to false.
| `priority:int` (default = `0`)`` — The priority level of the event listener. The priority is designated by a signed 32-bit integer. The higher the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1. If two or more listeners share the same priority, they are processed in the order in which they were added. The default priority is 0.
| `useWeakReference:Boolean` (default = `false`)`` — Determines whether the reference to the listener is strong or weak. A strong reference (the default) prevents your listener from being garbage-collected. A weak reference does not.

### commitRequiredOn

()
method

`public function commitRequiredOn(item:Object):Boolean`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Indicates if there are pending changes for this particular object. If the ManagedRemoteService has not been initialized, either by invoking an operation or explicitly calling initialize(), this method will always return false.

Parameters

| `item:Object` — The object that might have changes.

Returns

| `Boolean` — `true` if the object has pending changes.

### getOperation

()
method

`override public function getOperation(name:String):AbstractOperation`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Returns an Operation of the given name. If the Operation wasn't created beforehand, a new `mx.rpc.remoting.Operation` is created during this call. Operations are usually accessible by simply naming them after the service variable (`myService.someOperation`), but if your Operation name happens to match a defined method on the service (like `setCredentials`), you can use this method to get the Operation instead.

Parameters

| `name:String` — Name of the Operation.

Returns

| `AbstractOperation` — Operation that executes for this name.

### initializeService

()
method

`public function initializeService():mx.rpc:AsyncToken`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Force initialization of the Managed Remote Service. Generates a ResultEvent on success and a DataServiceFaultEvent on failure. Note: do not use the initialize() function as it does not set up the ManagedRemoteService.

Returns

| `mx.rpc:AsyncToken`

### logout

()
method

`override public function logout():void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Log the user out of the destination for the service and releases all managed collections and items. Any Data Services associated with the Managed Remote service also have logout() called.

### releaseCollection

()
method

`public function releaseCollection(view:ListCollectionView, clear:Boolean = false, copyStillManagedItems:Boolean = true):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Releases the specified collection from management by the underlying DataService. (see DataService.releaseCollection() for further notes)

Parameters

| `view:ListCollectionView` — ListCollectionView reference that should no longer receive remote updates.
| `clear:Boolean` (default = `false`)`` — Boolean indicating if the all items should be removed from the list. In addition no copies will be made of any item.
| `copyStillManagedItems:Boolean` (default = `true`)`` — Boolean if there are other managed references to items in this collection, this parameter controls whether copies of those items are made so that after this call you are guaranteed that there are no longer any managed items in the collection. Specifying both clear and this option as false will result in the fastest way to release managed references.

### releaseItem

()
method

`public function releaseItem(item:IManaged, dontClearStillManagedItems:Boolean = true, copyStillManagedItems:Boolean = true):IManaged`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Releases the specified item from management by the underlying DataService. (see DataService.releaseItem() for further notes)

Parameters

| `item:IManaged` — IManaged reference to the item to be released.
| `dontClearStillManagedItems:Boolean` (default = `true`)`` — Boolean indicating whether to copy (true) or clear (false) items should the item be still managed by another collection or reference after this release.
| `copyStillManagedItems:Boolean` (default = `true`)`` — Boolean indicating if we should make copies of the items which are still managed in the graph of objects. Passing a value of false will leave the object graph unchanged even if some objects in the graph are still managed through other references.

Returns

| `IManaged` — Reference to the released item. This reference may be a copy of the item specified if copyStillManagedItems is true and dontClearStillManagedItems is true and the item is still being referenced. This can occur if more than one call to `ManagedRemoteService.yourGetItemHere()` for this same item is made, or if this item is referenced by a collection returned from a call to `ManagedRemoteService.yourFillMethodHere()`.

### removeEventListener

()
method

`override public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Remove specified listener from the service.

Parameters

| `type:String` — The type of event.
| `listener:Function` — The listener object to remove.
| `useCapture:Boolean` (default = `false`)`` — Specifies whether the listener was registered for the capture phase or the target and bubbling phases. If the listener was registered for both the capture phase and the target and bubbling phases, two calls to removeEventListener() are required to remove both, one call with useCapture() set to true, and another call with useCapture() set to false.

### revertChanges

()
method

`public function revertChanges(item:IManaged = null):Boolean`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

This will undo any changes to the specified item and remove those changes from the cache. If the item specified doesn't have any changes this method will return false. If the item specified does have changes it will revert them and return true. If the ManagedRemoteService has not been initialized, either by invoking an operation or explicitly calling initialize(), this method will always return false.

Parameters

| `item:IManaged` (default = `null`)`` — IManaged reference to revert changes for

Returns

| `Boolean` — Boolean indicating if the changes to the specified item where reverted.

### setCredentials

()
method

`override public function setCredentials(username:String, password:String, charset:String = null):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Sets the credentials for the destination accessed by the service when using Managed Remoting on the server side. The credentials are applied to all services connected over the same ChannelSet.

Parameters

| `username:String` — The username for the destination.
| `password:String` — The password for the destination.
| `charset:String` (default = `null`)`` — The character set encoding to use while encoding the credentials. The default is null, which implies the legacy charset of ISO-Latin-1. The only other supported charset is "UTF-8".

### setPageSizeForOperation

()
method

`public function setPageSizeForOperation(operationName:String, pageSize:int):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Set the pageSize for the specified named operation. It may also be set by accessing the operation directly. Operations are dynamic properties of the service and are therefore not accessible within IDE's

service.operationname.pageSize

Parameters

| `operationName:String` — The name of the operation.
| `pageSize:int` — page size to set.

### setRemoteCredentials

()
method

`override public function setRemoteCredentials(remoteUsername:String, remotePassword:String, charset:String = null):void`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Sets the credentials for the third party of this Managed Remoting destination.

Parameters

| `remoteUsername:String` — The username to pass to the remote endpoint
| `remotePassword:String` — The password to pass to the remote endpoint
| `charset:String` (default = `null`)`` — The character set encoding to use while encoding the remote credentials. The default is null, which implies the legacy charset of ISO-Latin-1. The only other supported charset is "UTF-8".

### toString

()
method

`public function toString():String`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

Represents an instance of MangedRemoteService as a String, describing important properties such as the destination id and the set of channels assigned.

Returns

| `String` — Returns a String representing an instance of a RemoteObject.

Event Detail

### conflict

Event

Event Object Type: `mx.data.events.DataConflictEvent`
property DataConflictEvent.type = `mx.data.events.DataConflictEvent.CONFLICT`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

The `DataConflictEvent.CONFLICT` event is dispatched when a conflict is detected between pending local changes and changes submitted by another client, or when changes submitted by this client conflict with those in the remote destination. Each ManagedRemoteService instance sends conflict events only for items of this particular destination.

The `CONFLICT` constant defines the value of the `type` property of the event object for a `conflict` event.

The properties of the event object have the following values:

Property | Value
--- | ---
`bubbles` | false
`cancelable` | false
`currentTarget` | The Object that defines the event listener that handles the event. For example, if you use `myButton.addEventListener()` to register an event listener, myButton is the value of the `currentTarget`.
`conflict` | The Conflict object that holds the conflict that occurred.
`message` | The Message associated with this event.
`target` | The Object that dispatched the event; it is not always the Object listening for the event. Use the `currentTarget` property to always access the Object listening for the event.

### fault

Event

Event Object Type: `mx.data.events.DataServiceFaultEvent`
property DataServiceFaultEvent.type = `mx.data.events.DataServiceFaultEvent.FAULT`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

The `DataServiceFaultEvent.FAULT` event is dispatched when a service call fails due to an error.

The `FAULT` constant defines the value of the `type` property of the event object for a `fault` event.

The properties of the event object have the following values:

Property | Value
--- | ---
`bubbles` | false
`cancelable` | true, calling preventDefault() from the associated token's responder.fault method will prevent the service or operation from dispatching this event
`currentTarget` | The Object that defines the event listener that handles the event. For example, if you use `myButton.addEventListener()` to register an event listener, myButton is the value of the `currentTarget`.
`fault` | The Fault object that holds the conflict that occurred.
`item` | The item that generated the fault.
`identity` | The identity of of the item that generated the fault.
`message` | The Message associated with this event.
`token` | The token that represents the call to the method. Used in the asynchronous completion token pattern.
`target` | The Object that dispatched the event; it is not always the Object listening for the event. Use the `currentTarget` property to always access the Object listening for the event.

### message

Event

Event Object Type: `mx.messaging.events.MessageEvent`
property MessageEvent.type = `mx.messaging.events.MessageEvent.MESSAGE`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

The `MessageEvent.MESSAGE` event is dispatched when the remote destination pushes a notification of a data operation. For example, when data is updated in the remote destination an update operation is sent to all clients listening, this operation is converted to a message event on this DataService instance.

The MESSAGE event type; dispatched upon receipt of a message.

The value of this constant is `"message"`.

The properties of the event object have the following values:

Property | Value
--- | ---
`bubbles` | false
`cancelable` | false
`currentTarget` | The Object that defines the event listener that handles the event. For example, if you use `myButton.addEventListener()` to register an event listener, myButton is the value of the `currentTarget`.
`message` | The message associated with this event.
`target` | The Object that dispatched the event; it is not always the Object listening for the event. Use the `currentTarget` property to always access the Object listening for the event.

### result

Event

Event Object Type: `mx.rpc.events.ResultEvent`
property ResultEvent.type = `mx.rpc.events.ResultEvent.RESULT`

Language Version: | ActionScript 3.0

Product Version: | Adobe Digital Enterprise Platform Data Services for Java EE 4.6

Runtime Versions: | Flash Player 10.2, AIR 2.6

The `ResultEvent.RESULT` event is dispatched when a service call successfully returns. For example a call to the `fill()` method dispatches this event if the call is successful.

The RESULT event type.

The properties of the event object have the following values:

Property | Value
--- | ---
`bubbles` | false
`cancelable` | true, preventDefault() from the associated token's responder.result method will prevent the service or operation from dispatching this event
`currentTarget` | The Object that defines the event listener that handles the event. For example, if you use `myButton.addEventListener()` to register an event listener, myButton is the value of the `currentTarget`.
`message` | The Message associated with this event.
`target` | The Object that dispatched the event; it is not always the Object listening for the event. Use the `currentTarget` property to always access the Object listening for the event.
`result` | Result that the RPC call returns.
`token` | The token that represents the indiviudal call to the method. Used in the asynchronous completion token pattern.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00