Java Doc for EventSource.java in  » Library » Apache-commons-configuration-1.4-src » org » apache » commons » configuration » event » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache commons configuration 1.4 src » org.apache.commons.configuration.event 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.configuration.event.EventSource

All known Subclasses:   org.apache.commons.configuration.AbstractConfiguration,
EventSource
public class EventSource (Code)

A base class for objects that can generate configuration events.

This class implements functionality for managing a set of event listeners that can be notified when an event occurs. It can be extended by configuration classes that support the event machanism. In this case these classes only need to call the fireEvent() method when an event is to be delivered to the registered listeners.

Adding and removing event listeners can happen concurrently to manipulations on a configuration that cause events. The operations are synchronized.

With the detailEvents property the number of detail events can be controlled. Some methods in configuration classes are implemented in a way that they call other methods that can generate their own events. One example is the setProperty() method that can be implemented as a combination of clearProperty() and addProperty(). With detailEvents set to true, all involved methods will generate events (i.e. listeners will receive property set events, property clear events, and property add events). If this mode is turned off (which is the default), detail events are suppressed, so only property set events will be received. Note that the number of received detail events may differ for different configuration implementations. org.apache.commons.configuration.HierarchicalConfiguration HierarchicalConfiguration for instance has a custom implementation of setProperty(), which does not generate any detail events.

In addition to "normal" events, error events are supported. Such events signal an internal problem that occurred during access of properties. For them a special listener interface exists: ConfigurationErrorListener . There is another set of methods dealing with event listeners of this type. The fireError() method can be used by derived classes to send notifications about errors to registered observers.


author:
   author:
   href="http://jakarta.apache.org/commons/configuration/team-list.html">Commons
author:
   Configuration team
version:
   $Id: EventSource.java 495918 2007-01-13 16:33:02Z oheger $
since:
   1.3



Constructor Summary
public  EventSource()
     Creates a new instance of EventSource.

Method Summary
public  voidaddConfigurationListener(ConfigurationListener l)
     Adds a configuration listener to this object.
public  voidaddErrorListener(ConfigurationErrorListener l)
     Adds a new configuration error listener to this object.
public  voidclearConfigurationListeners()
     Removes all registered configuration listeners.
public  voidclearErrorListeners()
     Removes all registered error listeners.
protected  Objectclone()
     Overrides the clone() method to correctly handle so far registered event listeners.
protected  ConfigurationErrorEventcreateErrorEvent(int type, String propName, Object propValue, Throwable ex)
     Creates a ConfigurationErrorEvent object based on the passed in parameters.
protected  ConfigurationEventcreateEvent(int type, String propName, Object propValue, boolean before)
     Creates a ConfigurationEvent object based on the passed in parameters.
protected  voidfireError(int type, String propName, Object propValue, Throwable ex)
     Creates an error event object and delivers it to all registered error listeners.
protected  voidfireEvent(int type, String propName, Object propValue, boolean before)
     Creates an event object and delivers it to all registered event listeners.
public  CollectiongetConfigurationListeners()
     Returns a collection with all configuration event listeners that are currently registered at this object.
public  CollectiongetErrorListeners()
     Returns a collection with all configuration error listeners that are currently registered at this object.
public  booleanisDetailEvents()
     Returns a flag whether detail events are enabled.
public  booleanremoveConfigurationListener(ConfigurationListener l)
     Removes the specified event listener so that it does not receive any further events caused by this object.
public  booleanremoveErrorListener(ConfigurationErrorListener l)
     Removes the specified error listener so that it does not receive any further events caused by this object.
public  voidsetDetailEvents(boolean enable)
     Determines whether detail events should be generated.


Constructor Detail
EventSource
public EventSource()(Code)
Creates a new instance of EventSource.




Method Detail
addConfigurationListener
public void addConfigurationListener(ConfigurationListener l)(Code)
Adds a configuration listener to this object.
Parameters:
  l - the listener to add



addErrorListener
public void addErrorListener(ConfigurationErrorListener l)(Code)
Adds a new configuration error listener to this object. This listener will then be notified about internal problems.
Parameters:
  l - the listener to register (must not be null)
since:
   1.4



clearConfigurationListeners
public void clearConfigurationListeners()(Code)
Removes all registered configuration listeners.



clearErrorListeners
public void clearErrorListeners()(Code)
Removes all registered error listeners.
since:
   1.4



clone
protected Object clone() throws CloneNotSupportedException(Code)
Overrides the clone() method to correctly handle so far registered event listeners. This implementation ensures that the clone will have empty event listener lists, i.e. the listeners registered at an EventSource object will not be copied. the cloned object
throws:
  CloneNotSupportedException - if cloning is not allowed
since:
   1.4



createErrorEvent
protected ConfigurationErrorEvent createErrorEvent(int type, String propName, Object propValue, Throwable ex)(Code)
Creates a ConfigurationErrorEvent object based on the passed in parameters. This is called by fireError() if it decides that an event needs to be generated.
Parameters:
  type - the event's type
Parameters:
  propName - the name of the affected property (can be null)
Parameters:
  propValue - the value of the affected property (can be null)
Parameters:
  ex - the Throwable object that caused this errorevent the event object
since:
   1.4



createEvent
protected ConfigurationEvent createEvent(int type, String propName, Object propValue, boolean before)(Code)
Creates a ConfigurationEvent object based on the passed in parameters. This is called by fireEvent() if it decides that an event needs to be generated.
Parameters:
  type - the event's type
Parameters:
  propName - the name of the affected property (can be null)
Parameters:
  propValue - the value of the affected property (can be null)
Parameters:
  before - the before update flag the newly created event object



fireError
protected void fireError(int type, String propName, Object propValue, Throwable ex)(Code)
Creates an error event object and delivers it to all registered error listeners.
Parameters:
  type - the event's type
Parameters:
  propName - the name of the affected property (can be null)
Parameters:
  propValue - the value of the affected property (can be null)
Parameters:
  ex - the Throwable object that caused this errorevent
since:
   1.4



fireEvent
protected void fireEvent(int type, String propName, Object propValue, boolean before)(Code)
Creates an event object and delivers it to all registered event listeners. The method will check first if sending an event is allowed (making use of the detailEvents property), and if listeners are registered.
Parameters:
  type - the event's type
Parameters:
  propName - the name of the affected property (can be null)
Parameters:
  propValue - the value of the affected property (can be null)
Parameters:
  before - the before update flag



getConfigurationListeners
public Collection getConfigurationListeners()(Code)
Returns a collection with all configuration event listeners that are currently registered at this object. a collection with the registeredConfigurationListeners (this collection is a snapshotof the currently registered listeners; manipulating it has no effecton this event source object)



getErrorListeners
public Collection getErrorListeners()(Code)
Returns a collection with all configuration error listeners that are currently registered at this object. a collection with the registeredConfigurationErrorListeners (this collection is asnapshot of the currently registered listeners; it cannot be manipulated)
since:
   1.4



isDetailEvents
public boolean isDetailEvents()(Code)
Returns a flag whether detail events are enabled. a flag if detail events are generated



removeConfigurationListener
public boolean removeConfigurationListener(ConfigurationListener l)(Code)
Removes the specified event listener so that it does not receive any further events caused by this object.
Parameters:
  l - the listener to be removed a flag whether the event listener was found



removeErrorListener
public boolean removeErrorListener(ConfigurationErrorListener l)(Code)
Removes the specified error listener so that it does not receive any further events caused by this object.
Parameters:
  l - the listener to remove a flag whether the listener could be found and removed
since:
   1.4



setDetailEvents
public void setDetailEvents(boolean enable)(Code)
Determines whether detail events should be generated. If enabled, some methods can generate multiple update events. Note that this method records the number of calls, i.e. if for instance setDetailEvents(false) was called three times, you will have to invoke the method as often to enable the details.
Parameters:
  enable - a flag if detail events should be enabled or disabled



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.