Author: oheger
Date: Sun Jul 13 20:08:56 2014
New Revision: 1610303
URL: http://svn.apache.org/r1610303
Log:
Removed obsolete methods from EventSource and BaseEventSource.
Modified:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/BaseEventSource.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/EventSource.java
Modified:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java?rev=1610303&r1=1610302&r2=1610303&view=diff
==============================================================================
---
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java
(original)
+++
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/ConfigurationUtils.java
Sun Jul 13 20:08:56 2014
@@ -26,7 +26,6 @@ import java.lang.reflect.Proxy;
import java.util.Iterator;
import org.apache.commons.configuration.event.ConfigurationErrorEvent;
-import org.apache.commons.configuration.event.ConfigurationErrorListener;
import org.apache.commons.configuration.event.Event;
import org.apache.commons.configuration.event.EventListener;
import org.apache.commons.configuration.event.EventSource;
@@ -76,17 +75,6 @@ public final class ConfigurationUtils
{
@Override
- public void addErrorListener(ConfigurationErrorListener l)
- {
- }
-
- @Override
- public boolean removeErrorListener(ConfigurationErrorListener l)
- {
- return false;
- }
-
- @Override
public <T extends Event> void addEventListener(EventType<T> eventType,
EventListener<? super T> listener)
{
Modified:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/BaseEventSource.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/BaseEventSource.java?rev=1610303&r1=1610302&r2=1610303&view=diff
==============================================================================
---
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/BaseEventSource.java
(original)
+++
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/BaseEventSource.java
Sun Jul 13 20:08:56 2014
@@ -16,13 +16,10 @@
*/
package org.apache.commons.configuration.event;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
/**
* <p>
@@ -32,48 +29,43 @@ import java.util.concurrent.CopyOnWriteA
* 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 mechanism. In this case these
- * classes only need to call the {@code fireEvent()} method when an event
- * is to be delivered to the registered listeners.
+ * classes only need to call the {@code fireEvent()} method when an event is to
+ * be delivered to the registered listeners.
* </p>
* <p>
* Adding and removing event listeners can happen concurrently to manipulations
* on a configuration that cause events. The operations are synchronized.
* </p>
* <p>
- * With the {@code detailEvents} property the number of detail events can
- * be controlled. Some methods in configuration classes are implemented in a
way
+ * With the {@code 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 {@code setProperty()} method that can be implemented as a
- * combination of {@code clearProperty()} and {@code addProperty()}.
- * With {@code detailEvents} set to <b>true</b>, 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.
- * {@link org.apache.commons.configuration.BaseHierarchicalConfiguration
BaseHierarchicalConfiguration}
- * for instance has a custom implementation of {@code setProperty()},
- * which does not generate any detail events.
+ * is the {@code setProperty()} method that can be implemented as a combination
+ * of {@code clearProperty()} and {@code addProperty()}. With
+ * {@code detailEvents} set to <b>true</b>, 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.
+ * {@link org.apache.commons.configuration.BaseHierarchicalConfiguration
+ * BaseHierarchicalConfiguration} for instance has a custom implementation of
+ * {@code setProperty()}, which does not generate any detail events.
* </p>
* <p>
* 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:
- * {@link ConfigurationErrorListener}. There is another set of
- * methods dealing with event listeners of this type. The
+ * They are handled via the regular {@link EventListener} interface, but there
+ * are special event types defined by {@link ConfigurationErrorEvent}. The
* {@code fireError()} method can be used by derived classes to send
* notifications about errors to registered observers.
* </p>
*
- * @author <a
href="http://commons.apache.org/configuration/team-list.html">Commons
Configuration team</a>
* @version $Id$
* @since 1.3
*/
public class BaseEventSource implements EventSource
{
- /** A collection for the registered error listeners.*/
- private Collection<ConfigurationErrorListener> errorListeners;
-
/** The list for managing registered event listeners. */
private EventListenerList eventListeners;
@@ -161,19 +153,6 @@ public class BaseEventSource implements
}
@Override
- public void addErrorListener(ConfigurationErrorListener l)
- {
- checkListener(l);
- errorListeners.add(l);
- }
-
- @Override
- public boolean removeErrorListener(ConfigurationErrorListener l)
- {
- return errorListeners.remove(l);
- }
-
- @Override
public <T extends Event> void addEventListener(EventType<T> eventType,
EventListener<? super T> listener)
{
@@ -210,22 +189,6 @@ public class BaseEventSource implements
}
/**
- * Returns a collection with all configuration error listeners that are
- * currently registered at this object.
- *
- * @return a collection with the registered
- * {@code ConfigurationErrorListener}s (this collection is a
- * snapshot of the currently registered listeners; it cannot be
manipulated)
- * @since 1.4
- * @deprecated Use getEventListeners() for events of type error evnet
- */
- @Deprecated
- public Collection<ConfigurationErrorListener> getErrorListeners()
- {
- return Collections.unmodifiableCollection(new
ArrayList<ConfigurationErrorListener>(errorListeners));
- }
-
- /**
* Copies all event listener registrations maintained by this object to the
* specified {@code BaseEventSource} object.
*
@@ -293,32 +256,6 @@ public class BaseEventSource implements
/**
* Creates an error event object and delivers it to all registered error
- * listeners.
- *
- * @param type the event's type
- * @param propName the name of the affected property (can be <b>null</b>)
- * @param propValue the value of the affected property (can be <b>null</b>)
- * @param ex the {@code Throwable} object that caused this error event
- * @since 1.4
- * @deprecated Error events are now treated as regular events
- */
- @Deprecated
- protected void fireError(int type, String propName, Object propValue,
Throwable ex)
- {
- Iterator<ConfigurationErrorListener> it = errorListeners.iterator();
- if (it.hasNext())
- {
- ConfigurationErrorEvent event =
- createErrorEvent(type, propName, propValue, ex);
- while (it.hasNext())
- {
- it.next().configurationError(event);
- }
- }
- }
-
- /**
- * Creates an error event object and delivers it to all registered error
* listeners of a matching type.
*
* @param eventType the event's type
@@ -348,26 +285,6 @@ public class BaseEventSource implements
}
/**
- * Creates a {@code ConfigurationErrorEvent} object based on the
- * passed in parameters. This is called by {@code fireError()} if it
- * decides that an event needs to be generated.
- *
- * @param type the event's type
- * @param propName the name of the affected property (can be <b>null</b>)
- * @param propValue the value of the affected property (can be <b>null</b>)
- * @param ex the {@code Throwable} object that caused this error
- * event
- * @return the event object
- * @since 1.4
- * @deprecated Use the method expecting an EventType
- */
- @Deprecated
- protected ConfigurationErrorEvent createErrorEvent(int type, String
propName, Object propValue, Throwable ex)
- {
- return new ConfigurationErrorEvent(this, type, propName, propValue,
ex);
- }
-
- /**
* Creates a {@code ConfigurationErrorEvent} object based on the passed in
* parameters. This is called by {@code fireError()} if it decides that an
* event needs to be generated.
@@ -406,26 +323,10 @@ public class BaseEventSource implements
}
/**
- * Checks whether the specified event listener is not <b>null</b>. If this
- * is the case, an {@code IllegalArgumentException} exception is thrown.
- *
- * @param l the listener to be checked
- * @throws IllegalArgumentException if the listener is <b>null</b>
- */
- private static void checkListener(Object l)
- {
- if (l == null)
- {
- throw new IllegalArgumentException("Listener must not be null!");
- }
- }
-
- /**
* Initializes the collections for storing registered event listeners.
*/
private void initListeners()
{
- errorListeners = new
CopyOnWriteArrayList<ConfigurationErrorListener>();
eventListeners = new EventListenerList();
}
Modified:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/EventSource.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/EventSource.java?rev=1610303&r1=1610302&r2=1610303&view=diff
==============================================================================
---
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/EventSource.java
(original)
+++
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/event/EventSource.java
Sun Jul 13 20:08:56 2014
@@ -32,28 +32,6 @@ package org.apache.commons.configuration
*/
public interface EventSource
{
- /**
- * Adds a new configuration error listener to this object. This listener
- * will then be notified about internal problems.
- *
- * @param l the listener to register (must not be <b>null</b>)
- * @since 1.4
- * @deprecated Use {@code addEventListener()}
- */
- @Deprecated
- void addErrorListener(ConfigurationErrorListener l);
-
- /**
- * Removes the specified error listener so that it does not receive any
- * further events caused by this object.
- *
- * @param l the listener to remove
- * @return a flag whether the listener could be found and removed
- * @since 1.4
- * @deprecated Use {@code removeEventListener()}
- */
- @Deprecated
- boolean removeErrorListener(ConfigurationErrorListener l);
/**
* Adds an event listener for the specified event type. This listener is