Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.util.callback
Class CallbackDispatcher

    java.lang.Object
      org.hyperic.util.callback.CallbackDispatcher

    public class CallbackDispatcher

extends java.lang.Object

The CallbackDispatcher is able to generate listeners and callers for the Proxied Callback Pattern. This dispatcher holds onto the list of all the registered callers and listeners and facilities the communication between them. DevNote: Might be better to keep the collection of listeners as a list, ordered by the order of registration. Right now that information is lost. Alternatively we could just let the callback type handle the registered list of listeners.

Nested Class Summary
`static interface` | `CallbackDispatcher.MyInterface`

Constructor Summary
`CallbackDispatcher()`

Method Summary
`java.lang.Object` | `generateCaller(java.lang.Class iFace)` Generates a caller with the callback type of `CallbackType.RETURN_LAST`
`java.lang.Object` | `generateCaller(java.lang.Class iFace, CallbackType type)` Generates the 'caller' side of the caller/listener relationship.
`static void` | `main(java.lang.String[] args)`
`void` | `registerListener(java.lang.Class iFace, java.lang.Object o)` Register a listener for a given interface.
`void` | `unregisterListener(java.lang.Class iFace, java.lang.Object o)` Unregister a previously registered listener.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CallbackDispatcher

    public CallbackDispatcher()

Method Detail

### registerListener

    public void registerListener(java.lang.Class iFace,
                                 java.lang.Object o)

  Register a listener for a given interface. If the caller has not been registered, then an error will be thrown.

  Parameters:
    `iFace` - Interface to listen on. Must previously be registered via `generateCaller(Class)`
    `o` - Listener which will be invoked when any of the methods specified in 'iFace' is called. This object must implement 'iFace'.

### unregisterListener

    public void unregisterListener(java.lang.Class iFace,
                                   java.lang.Object o)

  Unregister a previously registered listener.

  See Also:
    `registerListener(Class, Object)`

### generateCaller

    public java.lang.Object generateCaller(java.lang.Class iFace)

  Generates a caller with the callback type of `CallbackType.RETURN_LAST`

  See Also:
    `generateCaller(Class, CallbackType)`

### generateCaller

    public java.lang.Object generateCaller(java.lang.Class iFace,
                                           CallbackType type)

  Generates the 'caller' side of the caller/listener relationship. When methods on the returned object are invoked, the listeners registered via `registerListener(Class, Object)` for the given interface will be executed. The execution of the callbacks, the order they are called, the exception handling, values returned etc. are all handled by the passed `CallbackType`.

  Parameters:
    `iFace` - Interface to generate the caller for
    `type` - Type specifying the way that the caller will process callbacks
  Returns:
    An object implementing the passed interface. The methods on this object will execute callbacks on registered listeners.

### main

    public static void main(java.lang.String[] args)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.