com.sun.enterprise.connectors.work.context
Class WorkContextHandler

java.lang.Object
  extended by com.sun.enterprise.connectors.work.context.WorkContextHandler
All Implemented Interfaces:
WorkContextHandler

@Service
@Scoped(value=org.jvnet.hk2.component.PerLookup.class)
public class WorkContextHandler
extends java.lang.Object
implements WorkContextHandler

Handles work contexts submitted as part of the work instance

Since:
GlassFish v3
Author:
Jagadish Ramu

Constructor Summary
WorkContextHandler()
           
WorkContextHandler(ConnectorRuntime runtime, java.lang.String raName, java.lang.ClassLoader cl)
           
 
Method Summary
 boolean canContainerHandleContext(java.lang.String contextClassName)
          checks whether the container can handle the contextClass in question.
static void debug(java.lang.String message)
           
static ExecutionContext getExecutionContext(Work work)
          
 void init(java.lang.String raName, java.lang.ClassLoader cl)
          
 boolean isContextSupported(boolean strict, java.lang.String workContextClassName)
          indicates whether the provided workContextClass is supported by the container
 boolean isContextSupported(java.lang.Class contextClass)
          
 void setupContext(ExecutionContext ec, WorkCoordinator wc, OneWork work)
          setup the work context or execution context for the work
 void validateWork(Work work, ExecutionContext ec)
          validate the submitted work
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkContextHandler

public WorkContextHandler()

WorkContextHandler

public WorkContextHandler(ConnectorRuntime runtime,
                          java.lang.String raName,
                          java.lang.ClassLoader cl)
Method Detail

init

public void init(java.lang.String raName,
                 java.lang.ClassLoader cl)

Specified by:
init in interface WorkContextHandler

isContextSupported

public boolean isContextSupported(boolean strict,
                                  java.lang.String workContextClassName)
indicates whether the provided workContextClass is supported by the container

Specified by:
isContextSupported in interface WorkContextHandler
Parameters:
strict - indicates whether the type-check need to be strict or not i.e., exact type or its super-class type
workContextClassName - work context class name
Returns:
boolean indicating whether the workContextClass is supported or not

canContainerHandleContext

public boolean canContainerHandleContext(java.lang.String contextClassName)
checks whether the container can handle the contextClass in question. If the exact class type is not supported, container will look for any of its super-class If any of the super-class is available, it is indicated as 'can handle'

Parameters:
contextClassName - work context class name
Returns:
boolean indicating whether the contextClass is supported or not

validateWork

public void validateWork(Work work,
                         ExecutionContext ec)
                  throws WorkCompletedException,
                         WorkRejectedException
validate the submitted work

Parameters:
work - work instance to be validated
ec - ExecutionContext
Throws:
WorkCompletedException - when a submitted context is not supported
WorkRejectedException - when validation fails

setupContext

public void setupContext(ExecutionContext ec,
                         WorkCoordinator wc,
                         OneWork work)
                  throws WorkCompletedException
setup the work context or execution context for the work

Parameters:
ec - ExecutionContext
wc - Work coordinator
Throws:
WorkCompletedException

debug

public static void debug(java.lang.String message)

getExecutionContext

public static ExecutionContext getExecutionContext(Work work)


isContextSupported

public boolean isContextSupported(java.lang.Class contextClass)



Copyright © 2012 GlassFish Community. All Rights Reserved.