org.atmosphere.cpr
Class DefaultCometSupportResolver

java.lang.Object
  extended by org.atmosphere.cpr.DefaultCometSupportResolver
All Implemented Interfaces:
CometSupportResolver

public class DefaultCometSupportResolver
extends Object
implements CometSupportResolver

This is the default implementation of @link {CometSupportResolver}

Author:
Viktor Klang

Field Summary
static String GLASSFISH_V2
           
static String GRIZZLY
           
static String JBOSS_5
           
static String JBOSSWEB
           
static String JETTY
           
static String JETTY_7
           
static Logger logger
           
static String SERVLET_30
           
static String TOMCAT
           
static String WEBLOGIC
           
 
Constructor Summary
DefaultCometSupportResolver(AtmosphereServlet.AtmosphereConfig config)
           
 
Method Summary
 CometSupport defaultCometSupport(boolean preferBlocking)
          This method is used to determine the default CometSupport if all else fails
 List<Class<? extends CometSupport>> detectContainersPresent()
          Returns a list of comet support by containers available on the classpath
 CometSupport newCometSupport(Class<? extends CometSupport> targetClass)
          Given a Class of something that extends CometSupport, it tries to return an instance of that class The class has to have a visible constructor with the signature (@link {AtmosphereConfig})
 CometSupport newCometSupport(String targetClassFQN)
           
 CometSupport resolve(boolean useNativeIfPossible, boolean defaultToBlocking)
          This method is the general interface to the outside world
protected  CometSupport resolveMultipleNativeSupportConflict(List<Class<? extends CometSupport>> available)
          This method is called if there are more than one potential native container in scope
protected  CometSupport resolveNativeCometSupport(List<Class<? extends CometSupport>> available)
          This method is called to determine which native comet support to the used
protected  boolean testClassExists(String testClass)
          Convenience method that tests if a class with the given FQN is present on the classpath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVLET_30

public static final String SERVLET_30
See Also:
Constant Field Values

GLASSFISH_V2

public static final String GLASSFISH_V2
See Also:
Constant Field Values

TOMCAT

public static final String TOMCAT
See Also:
Constant Field Values

JBOSS_5

public static final String JBOSS_5
See Also:
Constant Field Values

JETTY

public static final String JETTY
See Also:
Constant Field Values

JETTY_7

public static final String JETTY_7
See Also:
Constant Field Values

GRIZZLY

public static final String GRIZZLY
See Also:
Constant Field Values

WEBLOGIC

public static final String WEBLOGIC
See Also:
Constant Field Values

JBOSSWEB

public static final String JBOSSWEB
See Also:
Constant Field Values

logger

public static final Logger logger
Constructor Detail

DefaultCometSupportResolver

public DefaultCometSupportResolver(AtmosphereServlet.AtmosphereConfig config)
Method Detail

testClassExists

protected boolean testClassExists(String testClass)
Convenience method that tests if a class with the given FQN is present on the classpath

Parameters:
testClass -
Returns:
true if the class is present

detectContainersPresent

public List<Class<? extends CometSupport>> detectContainersPresent()
Returns a list of comet support by containers available on the classpath

Returns:

defaultCometSupport

public CometSupport defaultCometSupport(boolean preferBlocking)
This method is used to determine the default CometSupport if all else fails

Parameters:
preferBlocking -
Returns:

newCometSupport

public CometSupport newCometSupport(Class<? extends CometSupport> targetClass)
Given a Class of something that extends CometSupport, it tries to return an instance of that class The class has to have a visible constructor with the signature (@link {AtmosphereConfig})

Parameters:
targetClass -
Returns:
an instance of the specified class

newCometSupport

public CometSupport newCometSupport(String targetClassFQN)

resolve

public CometSupport resolve(boolean useNativeIfPossible,
                            boolean defaultToBlocking)
This method is the general interface to the outside world

Specified by:
resolve in interface CometSupportResolver
Parameters:
useNativeIfPossible - - should the resolver try to use a native container comet support if present?
defaultToBlocking - - should the resolver default to blocking IO comet support?
Returns:
an instance of CometSupport

resolveNativeCometSupport

protected CometSupport resolveNativeCometSupport(List<Class<? extends CometSupport>> available)
This method is called to determine which native comet support to the used

Parameters:
available -
Returns:
null if no native container is present

resolveMultipleNativeSupportConflict

protected CometSupport resolveMultipleNativeSupportConflict(List<Class<? extends CometSupport>> available)
This method is called if there are more than one potential native container in scope

Returns:
null if it cannot resolve the conflict, this will cause defaultCometSupport to be used


Copyright © 2010 SUN Microsystems. All Rights Reserved.