Graphene Implementation 1.0.0.CR3

org.jboss.arquillian.ajocado.command
Class CommandInterceptorProxyImpl

java.lang.Object
  extended by org.jboss.arquillian.ajocado.command.CommandInterceptorProxyImpl
All Implemented Interfaces:
InvocationHandler, CommandInterceptorProxy

public final class CommandInterceptorProxyImpl
extends Object
implements CommandInterceptorProxy, InvocationHandler

The proxy for command processor which instead of direct executing of given command triggers logic of all associated interceptors.

Version:
$Revision$
Author:
Lukas Fryc

Constructor Summary
CommandInterceptorProxyImpl(com.thoughtworks.selenium.CommandProcessor commandProcessor)
          Constructs new proxy with associated command processor
 
Method Summary
 com.thoughtworks.selenium.CommandProcessor getCommandProcessorProxy()
          Returns the command processor proxied with functionality of all associated interceptors.
 CommandInterceptorProxyImpl immutableCopy()
          Creates immutable copy of this command processor with all interceptors registered.
 Object invoke(Object proxy, Method method, Object[] args)
           Proxies all the request on associated command processor.
 void registerInterceptor(CommandInterceptor interceptor)
          Registers the interceptor, only one interceptor can be registered for given class of interceptor.
 CommandInterceptor unregisterInterceptor(CommandInterceptor interceptor)
          Removes and returns the interceptor instance, or null, if such instance isn't registered.
 Set<CommandInterceptor> unregisterInterceptorType(Class<? extends CommandInterceptor> type)
          Removes and returns all associated interceptors which of given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandInterceptorProxyImpl

public CommandInterceptorProxyImpl(com.thoughtworks.selenium.CommandProcessor commandProcessor)
Constructs new proxy with associated command processor

Parameters:
commandProcessor - to associate with this proxy
Method Detail

getCommandProcessorProxy

public com.thoughtworks.selenium.CommandProcessor getCommandProcessorProxy()
Returns the command processor proxied with functionality of all associated interceptors.

Returns:
the command processor proxied with functionality of all associated interceptors

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable

Proxies all the request on associated command processor.

In case of CommandProcessor.doCommand(String, String[]) method, it also executes all associated interceptors before performing the actual invocation of method.

Specified by:
invoke in interface InvocationHandler
Throws:
Throwable

registerInterceptor

public void registerInterceptor(CommandInterceptor interceptor)
Registers the interceptor, only one interceptor can be registered for given class of interceptor.

Specified by:
registerInterceptor in interface CommandInterceptorProxy
Parameters:
interceptor - the interceptor implementation

unregisterInterceptor

public CommandInterceptor unregisterInterceptor(CommandInterceptor interceptor)
Removes and returns the interceptor instance, or null, if such instance isn't registered.

Specified by:
unregisterInterceptor in interface CommandInterceptorProxy
Parameters:
interceptor - the instance of interceptor to remove
Returns:
removed interceptor or null, if such interceptor ins't registered

unregisterInterceptorType

public Set<CommandInterceptor> unregisterInterceptorType(Class<? extends CommandInterceptor> type)
Removes and returns all associated interceptors which of given type.

Specified by:
unregisterInterceptorType in interface CommandInterceptorProxy
Parameters:
type - of interceptors which we want to unregister from this command processor
Returns:
the removed interceptors

immutableCopy

public CommandInterceptorProxyImpl immutableCopy()
Creates immutable copy of this command processor with all interceptors registered.

Returns:
the immutable copy of this command processor

Graphene Implementation 1.0.0.CR3

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.