Packagecom.pcbsys.nirvana.client
Classpublic class nChannel
InheritancenChannel Inheritance nStore Inheritance flash.events.EventDispatcher

This class is a Nirvana channel, offering the Nirvana channel related services it can only be made by calling the appropriate method in nSession



Public Methods
 MethodDefined By
  
addConnectionListener(listener:nChannelConnectionListener, connectionListenerAddedCB:Function):void
Adds a nChannelConnectionListener to this channel so that when new connections are made to this channel the listener is notified.
nChannel
  
addConnectionListenerCB(event:* = null):void
nChannel
  
addSubscriber(eventCB:nEventListener, startEID:Long, subscriptionCompleteCB:Function = null, selector:String):void
Registers the specified nEventListener as a subscriber to this channel.
nChannel
  
addSubscriberWithNamedObject(eventCB:nEventListener, subscriptionCompleteCB:Function, name:nNamedObject, autoAck:Boolean = false, listener:nNamedPriorityListener = null, selector:String):void
Registers the specified nEventListener as a named subscriber to this channel.
nChannel
 Inherited
Gets the attributes associated with this store
nStore
  
This method returns the channel attributes associated with this instance
nChannel
  
createNamedObject(createNamedObjectCB:Function, name:String, startEID:Long = null, persist:Boolean = false, clusterWide:Boolean = false, enablePriority:Boolean = false):void
Creates a named object on the channel with the given name and depending on the persistent flag informs the server to store the name and value to disk or not
nChannel
  
createRegisteredEvent(keyValue:Object, isTransactional:Boolean = false):nRegisteredEvent
Creates a new nRegisteredEvent bound to this channel using the keyValue as its unique id.
nChannel
  
deleteNamedObject(deleteNamedObjectCB:Function, value:nNamedObject):void
Removes all references for this name on the realm Server
nChannel
  
getNamedObject(namedObjectCB:Function, name:String):void
Gets a nNamedObject registered with this channel
nChannel
  
getNamedObjects(namedObjectsCB:Function):void
Gets an array of all known nNamedObjects registered with this channel
nChannel
  
isSubscribed():Boolean
Determines whether the underlying channel is currently being subscribed to
nChannel
  
lastEID(lastEIDCB:Function = null):void
Gets the last event id of this channel
nChannel
  
lastStoredEID(lastStoredEIDCB:Function = null):void
Gets the last event id of this channel
nChannel
  
name():String
[override] Gets the name of this channel
nChannel
  
Publishes the specified nConsumeEvent to this channel
nChannel
  
purgeEvent(purgeEvtCB:Function, startEID:Long, endEID:Long = null, selector:String = null):void
Purges a single event from this channel
nChannel
  
Removes all listeners from the channel
nChannel
  
Removes the connection listener from the avaliable list
nChannel
  
removeSubscriber(removeSubscriberCompleteCB:Function = null, eventCB:nEventListener = null):void
Unregister the specified nEventListener as a subscriber from this channel.
nChannel
  
type():int
Gets the type of this channel Currently supported types are: nChanneAttributes.MIXED_TYPE nChanneAttributes.SIMPLE_TYPE nChanneAttributes.PERSISTENT_TYPE nChanneAttributes.RELIABLE_TYPE nChanneAttributes.TRANSIENT_TYPE
nChannel
  
unbindNamedObject(unbindNamedObjectCB:Function, value:nNamedObject):void
Unbinds the named object from the current connection
nChannel
Public Constants
 ConstantDefined By
  nAckedEventString : String = nAckedEventString
[static] String used for nAckedEvent to be dispatched
nChannel
  nLastEIDEventString : String = nLastEIDEventString
[static] String used for nLastEIDEvents to be dispatched
nChannel
  nLastStoredEIDEventString : String = nLastStoredEIDEventString
[static] String used for nLastStoredEIDEvent to be dispatched
nChannel
  nNamedObjectCreatedEventString : String = nNamedObjectCreatedEventString
[static] String used for nNamedObjectCreatedEvent to be dispatched
nChannel
  nNamedObjectDeleteEventString : String = nNamedObjectDeleteEventString
[static] String used for nNamedObjectDeleteEvent to be dispatched
nChannel
  nNamedObjectEventString : String = nNamedObjectEventString
[static] String used for nNamedObjectEvent to be dispatched
nChannel
  nNamedObjectsEventString : String = nNamedObjectsEventString
[static] String used for nNamedObjectsEvent to be dispatched
nChannel
  nNamedObjectUnbindEventString : String = nNamedObjectUnbindEventString
[static] String used for nNamedObjectUnbindEvent to be dispatched
nChannel
  nPurgeEventString : String = nPurgeEventString
[static] String used for nPurgeEvent to be dispatched
nChannel
  nRemovedSubscriberEventString : String = nRemovedSubscriberEventString
[static] String used for nRemovedSubscriberEvent to be dispatched
nChannel
  nSubscribedEventString : String = nSubscribedEventString
[static] String used for nSubscribedEvent to be dispatched
nChannel
Method Detail
addConnectionListener()method
public function addConnectionListener(listener:nChannelConnectionListener, connectionListenerAddedCB:Function):void

Adds a nChannelConnectionListener to this channel so that when new connections are made to this channel the listener is notified. Only one nChannelConnectionListener can be added at a time.

Parameters
listener:nChannelConnectionListener — A nChannelConnectionListener
 
connectionListenerAddedCB:Function — The callback when the listener is added


Throws
nIllegalArgumentError — if a null listener is passed
 
nIOError — if a connection is in the process of completing
 
nSessionNotConnectedError — if you have been disconnected from the server
 
nSessionNotInitialisedError — if you have not initialised the session
addConnectionListenerCB()method 
public function addConnectionListenerCB(event:* = null):void

Parameters
event:* (default = null)

addSubscriber()method 
public function addSubscriber(eventCB:nEventListener, startEID:Long, subscriptionCompleteCB:Function = null, selector:String):void

Registers the specified nEventListener as a subscriber to this channel. The subscriber will receive all events contained in this channel.

Parameters
eventCB:nEventListener — the function callback for all events on the channel.
 
startEID:Long — a long specifying the subscription's start eid
 
subscriptionCompleteCB:Function (default = null) — the function callback when the subscription is complete. Set to null if you wish for an event to be dispatched, the event is called nSubscribedEvent the listener string is nSubscribedEventString
 
selector:String — a string specifying a filter to this subscription request if channelMultiplexing is not enabled


Throws
nSessionNotConnectedError — if you have been disconnected from the server
 
nStoreAlreadySubscribedError — if you area attempting to subscribe when a subscription already exists
 
nIllegalArgumentError — if a illegal parameter is passed see error for more details
 
nSessionNotInitialisedError — if you have not initialised the session
addSubscriberWithNamedObject()method 
public function addSubscriberWithNamedObject(eventCB:nEventListener, subscriptionCompleteCB:Function, name:nNamedObject, autoAck:Boolean = false, listener:nNamedPriorityListener = null, selector:String):void

Registers the specified nEventListener as a named subscriber to this channel. The subscriber will receive all events from the last acknowledged event for the name supplied If the name is new it will start from the END of the channel.

Parameters
eventCB:nEventListener — the function callback for all events on the channel
 
subscriptionCompleteCB:Function — the function callback when the subscription is complete, can return a nNameDoesNotExistError. Set to null if you wish for an event to be dispatched, the event is called nSubscribedEvent the listener string is nSubscribedEventString
 
name:nNamedObject — the nNamedObject to use for this subscription
 
autoAck:Boolean (default = false) — a string specifying a filter to this subscription request
 
listener:nNamedPriorityListener (default = null)
 
selector:String


Throws
nSessionNotConnectedError — if you have been disconnected from the server
 
nIllegalArgumentError — if a illegal parameter is passed see error for more details
 
nStoreAlreadySubscribedError — if you area attempting to subscribe when a subscription already exists
 
nSessionNotInitialisedError — if you have not initialised the session
channelAttributes()method 
public function channelAttributes():nChannelAttributes

This method returns the channel attributes associated with this instance

Returns
nChannelAttributes — nChannelAttributes the associated attributes
createNamedObject()method 
public function createNamedObject(createNamedObjectCB:Function, name:String, startEID:Long = null, persist:Boolean = false, clusterWide:Boolean = false, enablePriority:Boolean = false):void

Creates a named object on the channel with the given name and depending on the persistent flag informs the server to store the name and value to disk or not

Parameters
createNamedObjectCB:Function — the function that will be called upon completion of creating the named object can return nNameBoundError if the name already used. If you wish to have a event dispatched set this to null, the event to be delivered is a nNamedObjectCreatedEvent the listener string is nNamedObjectCreatedEventString
 
name:String — the name to create the object
 
startEID:Long (default = null) — event EID to start the named object from
 
persist:Boolean (default = false) — flag to indicate to the server where to store it
 
clusterWide:Boolean (default = false) — flag to indicate if this named object is valid in the entire cluster
 
enablePriority:Boolean (default = false) — flag to indicate if multiple subscriptions will be prioritized on this object


Throws
nIllegalArgumentError — see the error for further information
 
nSessionNotConnectedError — The session is not currently connected to the server
 
nSessionNotInitialisedError — if you have not initialised the session
createRegisteredEvent()method 
public function createRegisteredEvent(keyValue:Object, isTransactional:Boolean = false):nRegisteredEvent

Creates a new nRegisteredEvent bound to this channel using the keyValue as its unique id.

Parameters
keyValue:Object — Unquie Id to use for the nRegisteredEvent
 
isTransactional:Boolean (default = false) — Indicates that all commits on the nRegistedEvent should use transactional symantics

Returns
nRegisteredEvent — nRegistedEvent

Throws
nIllegalArgumentError — if unable to create the nRegisteredEvent object
deleteNamedObject()method 
public function deleteNamedObject(deleteNamedObjectCB:Function, value:nNamedObject):void

Removes all references for this name on the realm Server

Parameters
deleteNamedObjectCB:Function — the named object to be deleted by the server
 
value:nNamedObject — the callback function when the delete has finished. If you wish to have a event dispatched set this to null, the event to be delivered is a nNamedObjectRequestEvent the listener string is nNamedObjectDeleteEventString


Throws
nSessionNotConnectedError — The session is not currently connected to the server
 
nSessionNotInitialisedError — if you have not initialised the session
 
nIllegalArgumentError — value cannot be null
getNamedObject()method 
public function getNamedObject(namedObjectCB:Function, name:String):void

Gets a nNamedObject registered with this channel

Parameters
namedObjectCB:Function — the function that will be called upon completion of getting the named object, must accepts as a parameter a nNamedObject If you wish to have a event dispatched set this to null, the event to be delivered is a nNamedObjectEvent the listener string is nNamedObjectEventString
 
name:String


Throws
nIllegalArgumentError — if a null name is passed
 
nSessionNotConnectedError — The session is not currently connected to the server
 
nSessionNotInitialisedError — if you have not initialised the session
getNamedObjects()method 
public function getNamedObjects(namedObjectsCB:Function):void

Gets an array of all known nNamedObjects registered with this channel

Parameters
namedObjectsCB:Function — the function that will be called upon completion of getting the named objects, must accepts as a parameter a Array of nNamedObject If you wish to have a event dispatched set this to null, the event to be delivered is a nNamedObjectsEvent the listener string is nNamedObjectsEventString


Throws
nSessionNotConnectedError — The session is not currently connected to the server
 
nSessionNotInitialisedError — if you have not initialised the session
isSubscribed()method 
public function isSubscribed():Boolean

Determines whether the underlying channel is currently being subscribed to

Returns
Boolean — true if the channel object is currently subscribed to
lastEID()method 
public function lastEID(lastEIDCB:Function = null):void

Gets the last event id of this channel

Parameters
lastEIDCB:Function (default = null) — a callback function with the last EID as a long. Set to null if you would like a event to be dispatched, the event will be a nLastEIDEvent the listener string is nLastEIDEventString.


Throws
nSessionNotConnectedError — if you have been disconnected from the server
 
nSessionNotInitialisedError — if you have not initialised the session
lastStoredEID()method 
public function lastStoredEID(lastStoredEIDCB:Function = null):void

Gets the last event id of this channel

Parameters
lastStoredEIDCB:Function (default = null) — a function for callback with a long specifying the last event id stored on this channel. Set to null if you would like a event to be dispatched, the event will be a nLastEIDEvent the listener string is nLastStoredEIDEventString.


Throws
nSessionNotConnectedError — if you have been disconnected from the server
 
nSessionNotInitialisedError — if you have not initialised the session
name()method 
override public function name():String

Gets the name of this channel

Returns
String — String specifying the name of this channel
publish()method 
public function publish(event:nConsumeEvent):void

Publishes the specified nConsumeEvent to this channel

Parameters
event:nConsumeEvent — the nConsumeEvent object to be published to this channel


Throws
nSessionNotConnectedError — if you have been disconnected from the server
 
nSessionNotInitialisedError — if you have not initialised the session
purgeEvent()method 
public function purgeEvent(purgeEvtCB:Function, startEID:Long, endEID:Long = null, selector:String = null):void

Purges a single event from this channel

Parameters
purgeEvtCB:Function — the callback function when the event/s are purged. Set to null if you wish to have a event dispatched, the event is a nPurgeEvent and the listener string is nPurgeEventString
 
startEID:Long — a long specifying the start event id of events to be purged from the channel
 
endEID:Long (default = null) — a long specifying the end event id of events to be purged from the channel, if you only wish to purge one event you do not need to set this.
 
selector:String (default = null) — a string specifying a filter to this subscription request


Throws
nSessionNotConnectedError — if you have been disconnected from the server
 
nSessionNotInitialisedError — if you have not initialised the session
removeAllConnectionListeners()method 
public function removeAllConnectionListeners():void

Removes all listeners from the channel

removeConnectionListener()method 
public function removeConnectionListener(listener:nChannelConnectionListener):void

Removes the connection listener from the avaliable list

Parameters
listener:nChannelConnectionListener — the listener to remove

removeSubscriber()method 
public function removeSubscriber(removeSubscriberCompleteCB:Function = null, eventCB:nEventListener = null):void

Unregister the specified nEventListener as a subscriber from this channel. The subscriber will not receive any more events.

Parameters
removeSubscriberCompleteCB:Function (default = null) — the callback function when subscription removal is complete , can return an nUserNotSubscribedError. Set to null if you would like a event to be dispatched, the event will be a nRemovedSubscriberEvent and the listener string is nRemovedSubscriberEventString
 
eventCB:nEventListener (default = null) — the nEventListener to remove, only used if channelMultiplexing is enabled


Throws
nSessionNotConnectedError — if you have been disconnected from the server
 
nSessionNotInitialisedError — if you have not initialised the session
 
nIllegalArgumentError — if channelMultiplexing is enabled and a nEventListener is not given
type()method 
public function type():int

Gets the type of this channel

Currently supported types are:

Returns
int — an int specifying the channel's type, which will be equal to one of :

See also

unbindNamedObject()method 
public function unbindNamedObject(unbindNamedObjectCB:Function, value:nNamedObject):void

Unbinds the named object from the current connection

Parameters
unbindNamedObjectCB:Function — the named object to be unbound
 
value:nNamedObject — the callback when the unbind operation is complete. If you wish to have a event dispatched set this to null, the event to be delivered is a nNamedObjectRequestEvent the listener string is nNamedObjectUnbindEventString


Throws
nSessionNotConnectedError — The session is not currently connected to the server
 
nSessionNotInitialisedError — if you have not initialised the session
 
nIllegalArgumentError — value cannot be null
Constant Detail
nAckedEventStringConstant
public static const nAckedEventString:String = nAckedEventString

String used for nAckedEvent to be dispatched

nLastEIDEventStringConstant 
public static const nLastEIDEventString:String = nLastEIDEventString

String used for nLastEIDEvents to be dispatched

nLastStoredEIDEventStringConstant 
public static const nLastStoredEIDEventString:String = nLastStoredEIDEventString

String used for nLastStoredEIDEvent to be dispatched

nNamedObjectCreatedEventStringConstant 
public static const nNamedObjectCreatedEventString:String = nNamedObjectCreatedEventString

String used for nNamedObjectCreatedEvent to be dispatched

nNamedObjectDeleteEventStringConstant 
public static const nNamedObjectDeleteEventString:String = nNamedObjectDeleteEventString

String used for nNamedObjectDeleteEvent to be dispatched

nNamedObjectEventStringConstant 
public static const nNamedObjectEventString:String = nNamedObjectEventString

String used for nNamedObjectEvent to be dispatched

nNamedObjectsEventStringConstant 
public static const nNamedObjectsEventString:String = nNamedObjectsEventString

String used for nNamedObjectsEvent to be dispatched

nNamedObjectUnbindEventStringConstant 
public static const nNamedObjectUnbindEventString:String = nNamedObjectUnbindEventString

String used for nNamedObjectUnbindEvent to be dispatched

nPurgeEventStringConstant 
public static const nPurgeEventString:String = nPurgeEventString

String used for nPurgeEvent to be dispatched

nRemovedSubscriberEventStringConstant 
public static const nRemovedSubscriberEventString:String = nRemovedSubscriberEventString

String used for nRemovedSubscriberEvent to be dispatched

nSubscribedEventStringConstant 
public static const nSubscribedEventString:String = nSubscribedEventString

String used for nSubscribedEvent to be dispatched