org.openpermis.editor.policy
Class MacAdapter.EventHandlerAdapter

java.lang.Object
  extended by org.openpermis.editor.policy.MacAdapter.EventHandlerAdapter
All Implemented Interfaces:
InvocationHandler
Enclosing class:
MacAdapter

public static class MacAdapter.EventHandlerAdapter
extends Object
implements InvocationHandler

Adapter for EAWT event handlers.

Since:
0.1.0

Field Summary
private  Action action
          The action to invoke.
private  String signature
          The signature of the method proxied.
 
Constructor Summary
MacAdapter.EventHandlerAdapter(String signature, Action action)
          Creates an event handler adapter that calls an action on invocation.
 
Method Summary
private  boolean checkSignature(Method method, Object[] args)
          Checks if the invocation method and arguments match those of the event handler proxied.
protected  Object getEventSource(Object appleEvent)
          Derives the action event source from the specified apple event.
 String getSignature()
          Returns the signature of the event this proxy handles.
 Object invoke(Object proxy, Method method, Object[] args)
          Invokes the action that proxies this EAWT event handler and sets the event handled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

action

private final Action action
The action to invoke.

Since:
0.1.0

signature

private final String signature
The signature of the method proxied.

Since:
0.1.0
Constructor Detail

MacAdapter.EventHandlerAdapter

public MacAdapter.EventHandlerAdapter(String signature,
                                      Action action)
Creates an event handler adapter that calls an action on invocation.

Parameters:
action - the action to call if a method is invoked.
signature - the signature of the method invoked.
Since:
0.1.0
Method Detail

getSignature

public String getSignature()
Returns the signature of the event this proxy handles.

Returns:
the signature of the event this proxy handles.
Since:
0.1.0

checkSignature

private boolean checkSignature(Method method,
                               Object[] args)
Checks if the invocation method and arguments match those of the event handler proxied.

Parameters:
method - the method to invoke.
args - the arguments of the invocation.
Returns:
true if the signature matches the event handler proxied, false otherwise.
Since:
0.1.0

getEventSource

protected Object getEventSource(Object appleEvent)
Derives the action event source from the specified apple event.

Parameters:
appleEvent - the apple event object received at the handler.
Returns:
the action event source to use when invoking the target action.
Since:
0.1.0

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Invokes the action that proxies this EAWT event handler and sets the event handled.

Specified by:
invoke in interface InvocationHandler
Parameters:
proxy - the proxy instance that the method was invoked on, ignored.
method - the method instance corresponding to the interface method invoked on the proxy instance, checked against the signature.
args - an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, checked for a single event object.
Returns:
null always.
Throws:
Throwable
Since:
0.1.0


PERMIS Role Based Access Control 0.4.0 (Build 15)
2009/05/20 08:15:22
Copyright (c) 2002-2007 Ergon Informatik AG