flex.messaging.client
Class FlexClient

java.lang.Object
  extended by flex.messaging.util.TimeoutAbstractObject
      extended by flex.messaging.client.FlexClient
All Implemented Interfaces:
FlexSessionListener, MessageClientListener

public class FlexClient
extends TimeoutAbstractObject
implements FlexSessionListener, MessageClientListener

Represents a Flex client application instance on the server.


Nested Class Summary
 class FlexClient.AsyncPollWithTimeout
          Helper class for handling async poll requests.
 
Field Summary
static String FLEX_CLIENT_LOG_CATEGORY
          Log category for FlexClient related messages.
 
Method Summary
 void addClientAttributeListener(FlexClientAttributeListener listener)
          Adds a FlexClient attribute listener that will be notified when an attribute is added, removed or changed.
static void addClientCreatedListener(FlexClientListener listener)
          Adds a create listener that will be notified when new FlexClients are created.
 void addClientDestroyedListener(FlexClientListener listener)
          Adds a destroy listener that will be notified when the FlexClient is destroyed.
 Object getAttribute(String name)
          Returns the attribute bound to the specified name for the FlexClient, or null if no attribute is bound under the name.
 Enumeration getAttributeNames()
          Returns a snapshot of the names of all attributes bound to the FlexClient.
 List getFlexSessions()
          Returns a snapshot of the FlexSessions associated with the FlexClient when this method is invoked.
 String getId()
          Returns the unique Id for the FlexClient.
 long getLastUse()
          Override TimeoutAbstractObject.getLastUse() to make timeout dependent upon FlexClient inactivity but also upon the presence of an active push-enabled session, async or waited poll, or registered endpoint push handler (all of which indicate that a client has an active, open connection to the server).
 List getMessageClients()
          Returns a snapshot of the MessageClients (subscriptions) associated with the FlexClient when this method is invoked.
 int getSessionCount()
           
 int getSubscriptionCount()
           
 void invalidate()
          Invalidates the FlexClient.
 boolean isValid()
          Returns true if the FlexClient is valid; false if it has been invalidated.
 void removeAttribute(String name)
          Removes the attribute bound to the specified name for the FlexClient.
 void removeClientAttributeListener(FlexClientAttributeListener listener)
          Removes a FlexClient attribute listener.
static void removeClientCreatedListener(FlexClientListener listener)
          Removes a FlexClient created listener.
 void removeClientDestroyedListener(FlexClientListener listener)
          Removes a FlexClient destroyed listener.
 void setAttribute(String name, Object value)
          Binds an attribute value for the FlexClient under the specified name.
 
Methods inherited from class flex.messaging.util.TimeoutAbstractObject
cancelTimeout, getTimeoutFuture, getTimeoutManager, getTimeoutPeriod, getTimeoutTask, setLastUse, setTimeoutFuture, setTimeoutManager, setTimeoutPeriod, setTimeoutTask, updateLastUse
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface flex.messaging.FlexSessionListener
sessionCreated, sessionDestroyed
 
Methods inherited from interface flex.messaging.MessageClientListener
messageClientCreated, messageClientDestroyed
 

Field Detail

FLEX_CLIENT_LOG_CATEGORY

public static final String FLEX_CLIENT_LOG_CATEGORY
Log category for FlexClient related messages.

See Also:
Constant Field Values
Method Detail

addClientCreatedListener

public static void addClientCreatedListener(FlexClientListener listener)
Adds a create listener that will be notified when new FlexClients are created.

Parameters:
listener - The listener to add.
See Also:
FlexClientListener

removeClientCreatedListener

public static void removeClientCreatedListener(FlexClientListener listener)
Removes a FlexClient created listener.

Parameters:
listener - The listener to remove.
See Also:
FlexClientListener

addClientAttributeListener

public void addClientAttributeListener(FlexClientAttributeListener listener)
Adds a FlexClient attribute listener that will be notified when an attribute is added, removed or changed. If the attribute implements FlexClientBindingListener, it will be notified before any FlexClientAttributeListeners are notified.

Parameters:
listener - The listener to add.

addClientDestroyedListener

public void addClientDestroyedListener(FlexClientListener listener)
Adds a destroy listener that will be notified when the FlexClient is destroyed. Listeners are notified after all attributes have been unbound from the FlexClient and any FlexClientBindingListeners and FlexClientAttributeListeners have been notified.

Parameters:
listener - The listener to add.
See Also:
FlexClientListener

getAttribute

public Object getAttribute(String name)
Returns the attribute bound to the specified name for the FlexClient, or null if no attribute is bound under the name.

Parameters:
name - The name the attribute is bound to.
Returns:
The attribute bound to the specified name.

getAttributeNames

public Enumeration getAttributeNames()
Returns a snapshot of the names of all attributes bound to the FlexClient.

Returns:
A snapshot of the names of all attributes bound to the FlexClient.

getLastUse

public long getLastUse()
Override TimeoutAbstractObject.getLastUse() to make timeout dependent upon FlexClient inactivity but also upon the presence of an active push-enabled session, async or waited poll, or registered endpoint push handler (all of which indicate that a client has an active, open connection to the server).

Overrides:
getLastUse in class TimeoutAbstractObject
Returns:
The 'last use' timestamp for the FlexClient, which may be the current system time if the FlexClient has been idle but an open connection from the client to the server exists.

invalidate

public void invalidate()
Invalidates the FlexClient.


isValid

public boolean isValid()
Returns true if the FlexClient is valid; false if it has been invalidated.

Returns:
true if the FlexClient is valid; otherwise false.

getFlexSessions

public List getFlexSessions()
Returns a snapshot of the FlexSessions associated with the FlexClient when this method is invoked. This list is not guaranteed to remain consistent with the actual list of active FlexSessions associated with the FlexClient over time.

Returns:
A snapshot of the current list of FlexSessions associated with the FlexClient.

getSessionCount

public int getSessionCount()
Returns:
The number of sessions associated with this FlexClient.

getSubscriptionCount

public int getSubscriptionCount()
Returns:
The number of subscriptions associated with this FlexClient.

getMessageClients

public List getMessageClients()
Returns a snapshot of the MessageClients (subscriptions) associated with the FlexClient when this method is invoked. This list is not guaranteed to remain consistent with the actual list of active MessageClients associated with the FlexClient over time.

Returns:
A snapshot of the current list of MessageClients associated with the FlexClient.

getId

public String getId()
Returns the unique Id for the FlexClient.

Returns:
The unique Id for the FlexClient.

removeAttribute

public void removeAttribute(String name)
Removes the attribute bound to the specified name for the FlexClient.

Parameters:
name - The name of the attribute to remove.

removeClientAttributeListener

public void removeClientAttributeListener(FlexClientAttributeListener listener)
Removes a FlexClient attribute listener.

Parameters:
listener - The listener to remove.

removeClientDestroyedListener

public void removeClientDestroyedListener(FlexClientListener listener)
Removes a FlexClient destroyed listener.

Parameters:
listener - The listener to remove.
See Also:
FlexClientListener

setAttribute

public void setAttribute(String name,
                         Object value)
Binds an attribute value for the FlexClient under the specified name.

Parameters:
name - The name to bind the attribute under.
value - The value of the attribute.


Copyright © 2008 Adobe Systems Inc. All Rights Reserved.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/blazeds/1/javadoc/flex/messaging/client/FlexClient.html