alt.jiapi.event
Class EventProducer

java.lang.Object
  extended by alt.jiapi.event.EventProducer
Direct Known Subclasses:
ExceptionEventProducer, FieldEventProducer, FieldInterceptor, FieldInterceptor2, InvocationInterceptor, MethodEventProducer

public class EventProducer
extends java.lang.Object

Base class for event producers.

Version:
$Revision: 1.9 $ $Date: 2004/03/22 09:04:17 $
Author:
Mika Riekkinen, Joni Suominen

Constructor Summary
EventProducer()
          Empty constructor.
EventProducer(java.lang.String resolution)
          This constructor will set up resolution to given value.
EventProducer(java.lang.String[] resolutions)
          This constructor will set up resolution to given values.
 
Method Summary
 java.lang.String[] getResolutions()
          Get the resolutions of this EventProducer.
 boolean isProtected(JiapiEvent je)
          Checks whether a given JiapiEvent is in protected mode.
 boolean isProtected(java.lang.Object sourceObject)
          Checks whether a given sourceObject is in protected mode.
 boolean match(java.lang.String s)
          Matches a given String into resolution String this EventProducer has.
 void protect(JiapiEvent je)
          This method protects application from entering into recursive event loop.
 void release(JiapiEvent je)
          This method releases EventProducer so, that it is able to produce more events for the sourceObject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventProducer

public EventProducer()
Empty constructor. This constructor will set up resolution to its default value "*".


EventProducer

public EventProducer(java.lang.String resolution)
This constructor will set up resolution to given value.

Parameters:
resolution - A resolution that is to be used.

EventProducer

public EventProducer(java.lang.String[] resolutions)
This constructor will set up resolution to given values.

Parameters:
resolution - A resolutions that is to be used.
Method Detail

getResolutions

public java.lang.String[] getResolutions()
Get the resolutions of this EventProducer.

Returns:
An array of Strings. Each String represents one resolution String, that is used in matching.

isProtected

public boolean isProtected(JiapiEvent je)
Checks whether a given JiapiEvent is in protected mode. if JiapiEvent is in protected mode, that event should not be fired.

Parameters:
je - JiapiEvent to check

isProtected

public boolean isProtected(java.lang.Object sourceObject)
Checks whether a given sourceObject is in protected mode. if sourceObject is in protected mode, corresponding JiapiEvent should not be fired.

Parameters:
sourceObject - sourceObject to check

match

public boolean match(java.lang.String s)
Matches a given String into resolution String this EventProducer has. If at least one resolution matches, a true is returned.


protect

public void protect(JiapiEvent je)
This method protects application from entering into recursive event loop. This situation may occur, if a method has been instrumented, and instrumentation produces an event. If that method is called, directly or indirectly, with the aid of JiapiEvent, application will enter to an endless event loop, eventually crashing Virtual Machine.

Calling this method prevents EventProducer from producing further events for the same sourceObject. This protection mechanism allows applications to call methods of sourceObject and targetObject without worrying about event loops.

To enable events again, one will have to release EventProducer with method release.

See Also:
release(JiapiEvent), JiapiEvent.protect()

release

public void release(JiapiEvent je)
This method releases EventProducer so, that it is able to produce more events for the sourceObject.

See Also:
protect(JiapiEvent), JiapiEvent.release()


Copyright © 2001. Documenation generated August 26 2011.