summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2006-11-08 05:58:55 (EST)
committerEike Stepper2006-11-08 05:58:55 (EST)
commit7d3b2c1714e3d279bd545f85168439051a2ccce1 (patch)
tree2204ab07beba3f147fe8a4098b754edafde6107e
parented95adc33de57bac57f1df2972618a30ac1357a8 (diff)
downloadcdo-7d3b2c1714e3d279bd545f85168439051a2ccce1.zip
cdo-7d3b2c1714e3d279bd545f85168439051a2ccce1.tar.gz
cdo-7d3b2c1714e3d279bd545f85168439051a2ccce1.tar.bz2
Refactored listeners
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OSGiBundle.java1
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OSGiPlatform.java1
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/tcp/TCPAcceptor.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java1
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractCachingRegistry.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractRegistry.java10
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/DelegatingRegistry.java9
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistry.java22
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryListener.java18
10 files changed, 37 insertions, 35 deletions
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OSGiBundle.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OSGiBundle.java
index ce33622..ee92561 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OSGiBundle.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OSGiBundle.java
@@ -13,7 +13,6 @@ package org.eclipse.internal.net4j.bundle;
import org.eclipse.net4j.util.IOUtil;
import org.eclipse.core.runtime.FileLocator;
-
import org.osgi.framework.BundleContext;
import java.io.IOException;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OSGiPlatform.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OSGiPlatform.java
index 8cf2b11..b6c445e 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OSGiPlatform.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/bundle/OSGiPlatform.java
@@ -14,7 +14,6 @@ import org.eclipse.net4j.util.om.OMBundle;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.service.debug.DebugOptions;
-
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java
index 2634313..a556b86 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/tcp/TCPAcceptorImpl.java
@@ -170,12 +170,12 @@ public class TCPAcceptorImpl extends AbstractLifecycle implements TCPAcceptor, B
return result.toArray(new TCPConnector[result.size()]);
}
- public void addListener(TCPAcceptorListener listener)
+ public void addAcceptorListener(TCPAcceptorListener listener)
{
listeners.add(listener);
}
- public void removeListener(TCPAcceptorListener listener)
+ public void removeAcceptorListener(TCPAcceptorListener listener)
{
listeners.remove(listener);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/tcp/TCPAcceptor.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/tcp/TCPAcceptor.java
index fb9cb79..0290559 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/tcp/TCPAcceptor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/tcp/TCPAcceptor.java
@@ -34,9 +34,9 @@ public interface TCPAcceptor
public void setProtocolFactoryRegistry(IRegistry<String, ProtocolFactory> protocolFactoryRegistry);
- public void addListener(TCPAcceptorListener listener);
+ public void addAcceptorListener(TCPAcceptorListener listener);
- public void removeListener(TCPAcceptorListener listener);
+ public void removeAcceptorListener(TCPAcceptorListener listener);
public ExecutorService getReceiveExecutor();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java
index fcd09a3..6cf0f94 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java
@@ -17,7 +17,6 @@ import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.internal.net4j.bundle.Net4j;
import org.eclipse.internal.net4j.bundle.OSGiBundle;
-
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogService;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractCachingRegistry.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractCachingRegistry.java
index dd06014..b985886 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractCachingRegistry.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractCachingRegistry.java
@@ -10,8 +10,8 @@
**************************************************************************/
package org.eclipse.net4j.util.registry;
-import org.eclipse.net4j.util.registry.IRegistry.Listener.EventType;
import org.eclipse.net4j.util.registry.IRegistryElement.Descriptor;
+import org.eclipse.net4j.util.registry.IRegistryListener.EventType;
import java.util.HashSet;
import java.util.Map;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractRegistry.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractRegistry.java
index b212bd1..c9715ab 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractRegistry.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/AbstractRegistry.java
@@ -11,8 +11,8 @@
package org.eclipse.net4j.util.registry;
import org.eclipse.net4j.util.om.trace.ContextTracer;
-import org.eclipse.net4j.util.registry.IRegistry.Listener.EventType;
import org.eclipse.net4j.util.registry.IRegistryElement.Descriptor;
+import org.eclipse.net4j.util.registry.IRegistryListener.EventType;
import org.eclipse.internal.net4j.bundle.Net4j;
@@ -39,7 +39,7 @@ public abstract class AbstractRegistry<ID, E extends IRegistryElement<ID>> imple
/**
* Don't initialize lazily to circumvent synchronization!
*/
- private Queue<Listener> listeners = new ConcurrentLinkedQueue();
+ private Queue<IRegistryListener> listeners = new ConcurrentLinkedQueue();
protected AbstractRegistry()
{
@@ -102,12 +102,12 @@ public abstract class AbstractRegistry<ID, E extends IRegistryElement<ID>> imple
return elements;
}
- public void addListener(IRegistry.Listener<ID, E> listener)
+ public void addRegistryListener(IRegistryListener<ID, E> listener)
{
listeners.add(listener);
}
- public void removeListener(IRegistry.Listener<ID, E> listener)
+ public void removeRegistryListener(IRegistryListener<ID, E> listener)
{
listeners.remove(listener);
}
@@ -119,7 +119,7 @@ public abstract class AbstractRegistry<ID, E extends IRegistryElement<ID>> imple
protected void fireRegistryEvent(EventType eventType, E element)
{
- for (Listener listener : listeners)
+ for (IRegistryListener listener : listeners)
{
try
{
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/DelegatingRegistry.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/DelegatingRegistry.java
index 9676232..5c66592 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/DelegatingRegistry.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/DelegatingRegistry.java
@@ -10,7 +10,8 @@
**************************************************************************/
package org.eclipse.net4j.util.registry;
-import org.eclipse.net4j.util.registry.IRegistry.Listener.EventType;
+
+import org.eclipse.net4j.util.registry.IRegistryListener.EventType;
import java.util.Set;
@@ -21,7 +22,7 @@ public class DelegatingRegistry<ID, E extends IRegistryElement<ID>> extends Abst
{
private IRegistry<ID, E> delegate;
- private Listener<ID, E> delegateListener = new Listener<ID, E>()
+ private IRegistryListener<ID, E> delegateListener = new IRegistryListener<ID, E>()
{
public void notifyRegistryEvent(IRegistry<ID, E> registry, EventType eventType, E element)
{
@@ -38,7 +39,7 @@ public class DelegatingRegistry<ID, E extends IRegistryElement<ID>> extends Abst
{
super(resolving);
this.delegate = delegate;
- delegate.addListener(delegateListener);
+ delegate.addRegistryListener(delegateListener);
}
public IRegistry<ID, E> getDelegate()
@@ -69,7 +70,7 @@ public class DelegatingRegistry<ID, E extends IRegistryElement<ID>> extends Abst
@Override
public void dispose()
{
- delegate.removeListener(delegateListener);
+ delegate.removeRegistryListener(delegateListener);
}
protected void delegatedRegister(E element)
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistry.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistry.java
index 86a36a9..17051af 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistry.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistry.java
@@ -10,9 +10,11 @@
**************************************************************************/
package org.eclipse.net4j.util.registry;
+
import java.util.Collection;
import java.util.Set;
+
/**
* Implementation note: {@link Object#equals(Object)} and
* {@link Object#hashCode()} are based on pointer equality.
@@ -46,25 +48,9 @@ public interface IRegistry<ID, E extends IRegistryElement<ID>>
public Collection<E> getElements(boolean resolve);
- public void addListener(Listener<ID, E> listener);
+ public void addRegistryListener(IRegistryListener<ID, E> listener);
- public void removeListener(Listener<ID, E> listener);
+ public void removeRegistryListener(IRegistryListener<ID, E> listener);
public void dispose();
-
- /**
- * @author Eike Stepper
- */
- public interface Listener<ID, E extends IRegistryElement<ID>>
- {
- public void notifyRegistryEvent(IRegistry<ID, E> registry, EventType eventType, E element);
-
- /**
- * @author Eike Stepper
- */
- public enum EventType
- {
- REGISTERED, DEREGISTERING, RESOLVED
- }
- }
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryListener.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryListener.java
new file mode 100644
index 0000000..a268d93
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/registry/IRegistryListener.java
@@ -0,0 +1,18 @@
+package org.eclipse.net4j.util.registry;
+
+
+/**
+ * @author Eike Stepper
+ */
+public interface IRegistryListener<ID, E extends IRegistryElement<ID>>
+{
+ public void notifyRegistryEvent(IRegistry<ID, E> registry, IRegistryListener.EventType eventType, E element);
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum EventType
+ {
+ REGISTERED, DEREGISTERING, RESOLVED
+ }
+} \ No newline at end of file