flex.messaging.endpoints
Class AbstractEndpoint

java.lang.Object
  extended by flex.management.ManageableComponent
      extended by flex.messaging.endpoints.AbstractEndpoint
All Implemented Interfaces:
Manageable, Endpoint, Endpoint2, FlexComponent, FlexConfigurable
Direct Known Subclasses:
BaseHTTPEndpoint

public abstract class AbstractEndpoint
extends ManageableComponent
implements Endpoint2

This is the default implementation of Endpoint, which provides a convenient base for behavior and associations common to all endpoints. These properties that show up in endpoint configuration are only used by the client, therefore they have to be set on the appropriate client classes: connect-timeout-seconds set on Channel.

See Also:
Endpoint

Field Summary
static String LOG_CATEGORY
          Log category for AbstractEndpoint.
 
Constructor Summary
AbstractEndpoint()
          Constructs an unmanaged AbstractEndpoint.
AbstractEndpoint(boolean enableManagement)
          Constructs an AbstractEndpoint with the indicated management.
 
Method Summary
 ConfigMap describeEndpoint()
          Returns a ConfigMap of endpoint properties that the client needs.
 String getClientType()
          Returns the corresponding client channel type for the endpoint.
 Class getFlexClientOutboundQueueProcessorClass()
          Returns the FlexClientOutboundQueueProcessorClass of the endpoint.
 ConfigMap getFlexClientOutboundQueueProcessorConfig()
          Returns the properties for the FlexClientOutboundQueueProcessor of the endpoint.
 MessageBroker getMessageBroker()
          Returns the MessageBroker of the AbstractEndpoint.
 double getMessagingVersion()
          Returns the highest messaging version currently available via this endpoint.
 int getPort()
          Returns the port of the url of the endpoint.
 SecurityConstraint getSecurityConstraint()
          Returns the SecurityConstraint of the Endpoint.
 SerializationContext getSerializationContext()
          Returns the SerializationContext of the endpoint.
 Server getServer()
          Returns the Server that the endpoint is using; null if no server has been assigned.
 TypeMarshaller getTypeMarshaller()
          Returns the TypeMarshaller of the endpoint.
 String getUrl()
          Returns the url of the endpoint.
 void initialize(String id, ConfigMap properties)
          Initializes the Endpoint with the properties.
 boolean isSecure()
          Determines whether the endpoint is secure or not.
 void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Default implementation of the Endpoint service method.
 Message serviceMessage(Message message)
          Typically invoked by subclasses, this method transforms decoded message data into the appropriate Message object and routes the Message to the endpoint's broker.
 void setClientType(String type)
          Sets the corresponding client channel type for the endpoint.
 void setFlexClientOutboundQueueProcessorClass(Class flexClientOutboundQueueProcessorClass)
          Sets the the FlexClientOutboundQueueProcessor of the endpoint.
 void setFlexClientOutboundQueueProcessorConfig(ConfigMap flexClientOutboundQueueProcessorConfig)
          Sets the properties for the FlexClientOutboundQueueProcessor of the endpoint.
 void setId(String id)
          Sets the id of the AbstractEndpoint.
 void setMessageBroker(MessageBroker broker)
          Sets the MessageBroker of the AbstractEndpoint.
 void setSecurityConstraint(SecurityConstraint securityConstraint)
          Sets the SecurityConstraint of the Endpoint.
 void setSerializationContext(SerializationContext serializationContext)
          Sets the SerializationContext of the endpoint.
 void setServer(Server server)
          Sets the Server that the endpoint will use.
 void setTypeMarshaller(TypeMarshaller typeMarshaller)
          Sets the TypeMarshaller of the endpoint.
 FlexClient setupFlexClient(Message message)
          Utility method that endpoint implementations (or associated classes) should invoke when they receive an incoming message from a client but before servicing it.
 FlexClient setupFlexClient(String id)
          Utility method that endpoint implementations (or associated classes) should invoke when they receive an incoming message from a client but before servicing it.
 void setUrl(String url)
          Sets the url of the endpoint.
 void start()
          Starts the endpoint if its associated MessageBroker is started, and if the endpoint is not already running.
 void stop()
          Stops the endpoint if it's running.
 
Methods inherited from class flex.management.ManageableComponent
getControl, getId, getParent, isManaged, isStarted, isValid, setControl, setManaged, setParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface flex.messaging.endpoints.Endpoint
getId, isStarted
 
Methods inherited from interface flex.management.Manageable
getControl, isManaged, setControl, setManaged
 

Field Detail

LOG_CATEGORY

public static final String LOG_CATEGORY
Log category for AbstractEndpoint.

See Also:
Constant Field Values
Constructor Detail

AbstractEndpoint

public AbstractEndpoint()
Constructs an unmanaged AbstractEndpoint.


AbstractEndpoint

public AbstractEndpoint(boolean enableManagement)
Constructs an AbstractEndpoint with the indicated management.

Parameters:
enableManagement - true if the AbstractEndpoint is manageable; otherwise false.
Method Detail

initialize

public void initialize(String id,
                       ConfigMap properties)
Initializes the Endpoint with the properties. If subclasses override, they must call super.initialize().

Specified by:
initialize in interface Endpoint
Specified by:
initialize in interface FlexConfigurable
Overrides:
initialize in class ManageableComponent
Parameters:
id - Id of the Endpoint.
properties - Properties for the Endpoint.

start

public void start()
Starts the endpoint if its associated MessageBroker is started, and if the endpoint is not already running. If subclasses override, they must call super.start().

Specified by:
start in interface Endpoint
Specified by:
start in interface FlexComponent
Overrides:
start in class ManageableComponent

stop

public void stop()
Stops the endpoint if it's running. If subclasses override, they must call super.stop().

Specified by:
stop in interface Endpoint
Specified by:
stop in interface FlexComponent
Overrides:
stop in class ManageableComponent

getClientType

public String getClientType()
Returns the corresponding client channel type for the endpoint.

Specified by:
getClientType in interface Endpoint
Returns:
The corresponding client channel type for the endpoint.

setClientType

public void setClientType(String type)
Sets the corresponding client channel type for the endpoint.

Specified by:
setClientType in interface Endpoint
Parameters:
type - The corresponding client channel type for the endpoint.

getFlexClientOutboundQueueProcessorClass

public Class getFlexClientOutboundQueueProcessorClass()
Returns the FlexClientOutboundQueueProcessorClass of the endpoint.

Returns:
The FlexClientOutboundQueueProcessorClass of the endpoint.

setFlexClientOutboundQueueProcessorClass

public void setFlexClientOutboundQueueProcessorClass(Class flexClientOutboundQueueProcessorClass)
Sets the the FlexClientOutboundQueueProcessor of the endpoint.

Parameters:
flexClientOutboundQueueProcessorClass -

getFlexClientOutboundQueueProcessorConfig

public ConfigMap getFlexClientOutboundQueueProcessorConfig()
Returns the properties for the FlexClientOutboundQueueProcessor of the endpoint.

Returns:
The properties for the FlexClientOutboundQueueProcessor of the endpoint.

setFlexClientOutboundQueueProcessorConfig

public void setFlexClientOutboundQueueProcessorConfig(ConfigMap flexClientOutboundQueueProcessorConfig)
Sets the properties for the FlexClientOutboundQueueProcessor of the endpoint.

Parameters:
flexClientOutboundQueueProcessorConfig -

setId

public void setId(String id)
Sets the id of the AbstractEndpoint. If the AbstractEndpoint has a MessageBroker assigned, it also updates the id in the MessageBroker.

Specified by:
setId in interface Endpoint
Overrides:
setId in class ManageableComponent
Parameters:
id - The id of the ManageableComponent.

getMessageBroker

public MessageBroker getMessageBroker()
Returns the MessageBroker of the AbstractEndpoint.

Specified by:
getMessageBroker in interface Endpoint
Returns:
MessageBroker of the AbstractEndpoint.

setMessageBroker

public void setMessageBroker(MessageBroker broker)
Sets the MessageBroker of the AbstractEndpoint. Removes the AbstractEndpoint from the old broker (if there was one) and adds to the list of endpoints in the new broker.

Specified by:
setMessageBroker in interface Endpoint
Parameters:
broker - MessageBroker of the AbstractEndpoint.

getMessagingVersion

public double getMessagingVersion()
Description copied from interface: Endpoint
Returns the highest messaging version currently available via this endpoint.

Specified by:
getMessagingVersion in interface Endpoint
Returns:
the highest messaging version currently available via this endpoint.

getPort

public int getPort()
Returns the port of the url of the endpoint. A return value of 0 denotes no port in channel url.

Specified by:
getPort in interface Endpoint
Returns:
The port of the url of the endpoint or 0 if url does not contain a port number.

isSecure

public boolean isSecure()
Determines whether the endpoint is secure or not.

Specified by:
isSecure in interface Endpoint
Returns:
false by default.

getServer

public Server getServer()
Returns the Server that the endpoint is using; null if no server has been assigned.

Specified by:
getServer in interface Endpoint2

setServer

public void setServer(Server server)
Sets the Server that the endpoint will use.

Specified by:
setServer in interface Endpoint2

getSecurityConstraint

public SecurityConstraint getSecurityConstraint()
Returns the SecurityConstraint of the Endpoint.

Specified by:
getSecurityConstraint in interface Endpoint
Returns:
The SecurityConstraint of the Endpoint.

setSecurityConstraint

public void setSecurityConstraint(SecurityConstraint securityConstraint)
Sets the SecurityConstraint of the Endpoint.

Specified by:
setSecurityConstraint in interface Endpoint
Parameters:
securityConstraint -

getSerializationContext

public SerializationContext getSerializationContext()
Returns the SerializationContext of the endpoint.

Returns:
The SerializationContext of the endpoint.

setSerializationContext

public void setSerializationContext(SerializationContext serializationContext)
Sets the SerializationContext of the endpoint.

Parameters:
serializationContext -

getTypeMarshaller

public TypeMarshaller getTypeMarshaller()
Returns the TypeMarshaller of the endpoint.

Returns:
The TypeMarshaller of the endpoint.

setTypeMarshaller

public void setTypeMarshaller(TypeMarshaller typeMarshaller)
Sets the TypeMarshaller of the endpoint.

Parameters:
typeMarshaller -

getUrl

public String getUrl()
Returns the url of the endpoint.

Specified by:
getUrl in interface Endpoint
Returns:
The url of the endpoint.

setUrl

public void setUrl(String url)
Sets the url of the endpoint.

Specified by:
setUrl in interface Endpoint
Parameters:
url -

describeEndpoint

public ConfigMap describeEndpoint()
Returns a ConfigMap of endpoint properties that the client needs. By default, it returns a ConfigMap of endpoint id under "id" key, endpoint client type under "type" key and endpoint url under "uri" key. It also positive connectTimeoutSecond under "connect-timeout-seconds" key, Subclasses should add additional properties to super.describeDestination, or return null if they don't want their properties to be sent to the client.

Specified by:
describeEndpoint in interface Endpoint

service

public void service(javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse res)
Default implementation of the Endpoint service method. Subclasses should call super.service before their custom code.

Specified by:
service in interface Endpoint

serviceMessage

public Message serviceMessage(Message message)
Typically invoked by subclasses, this method transforms decoded message data into the appropriate Message object and routes the Message to the endpoint's broker.


setupFlexClient

public FlexClient setupFlexClient(Message message)
Utility method that endpoint implementations (or associated classes) should invoke when they receive an incoming message from a client but before servicing it. This method looks up or creates the proper FlexClient instance based upon the client the message came from and places it in the FlexContext.

Parameters:
message - The incoming message to process.
Returns:
The FlexClient or null if the message did not contain a FlexClient id value.

setupFlexClient

public FlexClient setupFlexClient(String id)
Utility method that endpoint implementations (or associated classes) should invoke when they receive an incoming message from a client but before servicing it. This method looks up or creates the proper FlexClient instance based upon the FlexClient id value received from the client. It also associates this FlexClient instance with the current FlexSession.

Parameters:
id - The FlexClient id value from the client.
Returns:
The FlexClient or null if the provided id was null.


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/endpoints/AbstractEndpoint.html