org.mule.transport.ajax.embedded
Class AjaxConnector

java.lang.Object
  extended by org.mule.transport.AbstractConnector
      extended by org.mule.transport.servlet.ServletConnector
          extended by org.mule.transport.ajax.container.AjaxServletConnector
              extended by org.mule.transport.ajax.embedded.AjaxConnector
All Implemented Interfaces:
ExceptionListener, EventListener, javax.resource.spi.work.WorkListener, MuleContextAware, Disposable, Initialisable, Lifecycle, Startable, Stoppable, NamedObject, Connectable, Connector

public class AjaxConnector
extends AjaxServletConnector

Creates an 'embedded' Ajax server using Jetty and allows Mule to receiver and send events to browsers. The browser will need to use the

mule.js
class to publish and subscribe events.


Nested Class Summary
 class AjaxConnector.BayeuxHolder
           
 
Field Summary
static String PROTOCOL
           
 
Fields inherited from class org.mule.transport.ajax.container.AjaxServletConnector
bayeux
 
Fields inherited from class org.mule.transport.servlet.ServletConnector
SERVLET, servletUrl
 
Fields inherited from class org.mule.transport.AbstractConnector
connected, createMultipleTransactedReceivers, DEFAULT_NUM_CONCURRENT_TX_RECEIVERS, dispatcherFactory, dispatchers, disposed, exceptionListener, initialised, initialStateStopped, logger, muleContext, name, numberOfConcurrentTransactedReceivers, receivers, requesterFactory, requesters, serviceDescriptor, serviceOverrides, sessionHandler, started, startOnConnect
 
Fields inherited from interface org.mule.api.transport.Connector
INT_VALUE_NOT_SET
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
AjaxConnector()
           
 
Method Summary
protected  org.mortbay.jetty.AbstractConnector createJettyConnector()
           
protected  org.mortbay.cometd.continuation.ContinuationCometdServlet createServletForConnector(org.mortbay.jetty.Connector connector, ImmutableEndpoint endpoint)
           
 void destroyReceiver(MessageReceiver receiver, ImmutableEndpoint endpoint)
           
protected  void doConnect()
          Template method where any connections should be made for the connector
protected  void doDisconnect()
          Template method where any connected resources used by the connector should be disconnected
protected  void doDispose()
          Template method to dispose any resources associated with this receiver.
protected  void doInitialise()
           
protected  void doStart()
          Template method to perform any work when starting the connectoe
protected  void doStop()
          Template method to perform any work when stopping the connectoe
 org.mortbay.jetty.Server getHttpServer()
           
 String getProtocol()
           
 AjaxConnector.BayeuxHolder registerBayeuxEndpoint(ImmutableEndpoint endpoint)
           
 MessageReceiver registerListener(Service service, InboundEndpoint endpoint)
          This creates a MessageReceiver associated with this endpoint and registers it with the connector
 void setDispatcherFactory(MessageDispatcherFactory dispatcherFactory)
          The dispatcher factory is used to create a message dispatcher of the current request
 
Methods inherited from class org.mule.transport.ajax.container.AjaxServletConnector
getBayeux, getFilters, getInterval, getLogLevel, getMaxInterval, getMultiFrameInterval, getRefsThreshold, getReplyToHandler, getTimeout, isDirectDeliver, isJsonCommented, isRequestAvailable, setBayeux, setDirectDeliver, setFilters, setInterval, setJsonCommented, setLogLevel, setMaxInterval, setMultiFrameInterval, setRefsThreshold, setRequestAvailable, setTimeout
 
Methods inherited from class org.mule.transport.servlet.ServletConnector
getReceiverKey, getReceivers, getServletUrl, setServletUrl
 
Methods inherited from class org.mule.transport.AbstractConnector
checkDisposed, connect, createReceiver, createScheduler, disconnect, dispatch, dispose, disposeDispatchers, disposeReceivers, disposeRequesters, disposeWorkManagers, doUnregisterListener, exceptionThrown, fireNotification, getConnectEventId, getConnectionDescription, getDefaultInboundTransformers, getDefaultOutboundTransformers, getDefaultResponseTransformers, getDispatcherFactory, getDispatcherThreadingProfile, getDispatcherWorkManager, getExceptionListener, getMaxDispatchersActive, getMaxRequestersActive, getMessageAdapter, getMessageAdapter, getMuleContext, getName, getNumberOfConcurrentTransactedReceivers, getOutputStream, getReceiver, getReceivers, getReceiverThreadingProfile, getReceiverWorkManager, getRequesterFactory, getRequesterThreadingProfile, getRequesterWorkManager, getRetryPolicyTemplate, getScheduler, getServiceDescriptor, getServiceOverrides, getSessionHandler, getSupportedProtocols, handleException, handleException, handleWorkException, initFromServiceDescriptor, initialise, initialiseFromUrl, initWorkManagers, isConnected, isCreateMultipleTransactedReceivers, isDisposed, isEnableMessageEvents, isInitialStateStopped, isResponseEnabled, isStarted, isSyncEnabled, isValidateConnections, lookupReceiver, registerSupportedProtocol, registerSupportedProtocolWithoutPrefix, request, request, send, setConnected, setCreateMultipleTransactedReceivers, setDispatcherThreadingProfile, setDynamicNotification, setExceptionListener, setInitialStateStopped, setMaxDispatchersActive, setMaxRequestersActive, setMuleContext, setName, setNumberOfConcurrentTransactedReceivers, setReceiverThreadingProfile, setRequesterFactory, setRequesterThreadingProfile, setRetryPolicyTemplate, setServiceOverrides, setSessionHandler, setSupportedProtocols, setupDispatchReturn, setupRequestReturn, setValidateConnections, shutdownScheduler, start, startAfterConnect, stop, supportsProtocol, toString, unregisterListener, unregisterSupportedProtocol, updateCachedNotificationHandler, validateConnection, workAccepted, workCompleted, workRejected, workStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROTOCOL

public static final String PROTOCOL
See Also:
Constant Field Values
Constructor Detail

AjaxConnector

public AjaxConnector()
Method Detail

getProtocol

public String getProtocol()
Specified by:
getProtocol in interface Connector
Overrides:
getProtocol in class AjaxServletConnector
Returns:
the primary protocol name for endpoints of this connector

doInitialise

protected void doInitialise()
                     throws InitialisationException
Overrides:
doInitialise in class ServletConnector
Throws:
InitialisationException

doDispose

protected void doDispose()
Template method to dispose any resources associated with this receiver. There is not need to dispose the connector as this is already done by the framework

Overrides:
doDispose in class ServletConnector

doStart

protected void doStart()
                throws MuleException
Description copied from class: AbstractConnector
Template method to perform any work when starting the connectoe

Overrides:
doStart in class ServletConnector
Throws:
MuleException - if the method fails

doStop

protected void doStop()
               throws MuleException
Description copied from class: AbstractConnector
Template method to perform any work when stopping the connectoe

Overrides:
doStop in class ServletConnector
Throws:
MuleException - if the method fails

doConnect

protected void doConnect()
                  throws Exception
Template method where any connections should be made for the connector

Overrides:
doConnect in class ServletConnector
Throws:
Exception

doDisconnect

protected void doDisconnect()
                     throws Exception
Template method where any connected resources used by the connector should be disconnected

Overrides:
doDisconnect in class ServletConnector
Throws:
Exception

registerListener

public MessageReceiver registerListener(Service service,
                                        InboundEndpoint endpoint)
                                 throws Exception
Description copied from interface: Connector
This creates a MessageReceiver associated with this endpoint and registers it with the connector

Specified by:
registerListener in interface Connector
Overrides:
registerListener in class AbstractConnector
Parameters:
service - the listening service
endpoint - the endpoint contains the listener endpointUri on which to listen on.
Throws:
Exception - if the MessageReceiver cannot be created or the Receiver cannot be registered

registerBayeuxEndpoint

public AjaxConnector.BayeuxHolder registerBayeuxEndpoint(ImmutableEndpoint endpoint)
                                                  throws MuleException
Throws:
MuleException

destroyReceiver

public void destroyReceiver(MessageReceiver receiver,
                            ImmutableEndpoint endpoint)
                     throws Exception
Overrides:
destroyReceiver in class AbstractConnector
Throws:
Exception

setDispatcherFactory

public void setDispatcherFactory(MessageDispatcherFactory dispatcherFactory)
Description copied from interface: Connector
The dispatcher factory is used to create a message dispatcher of the current request

Specified by:
setDispatcherFactory in interface Connector
Overrides:
setDispatcherFactory in class AbstractConnector
Parameters:
dispatcherFactory - The dispatcherFactory to set.

createJettyConnector

protected org.mortbay.jetty.AbstractConnector createJettyConnector()

getHttpServer

public org.mortbay.jetty.Server getHttpServer()

createServletForConnector

protected org.mortbay.cometd.continuation.ContinuationCometdServlet createServletForConnector(org.mortbay.jetty.Connector connector,
                                                                                              ImmutableEndpoint endpoint)
                                                                                       throws MuleException
Throws:
MuleException


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.