summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-03-12 03:58:32 (EDT)
committerEike Stepper2007-03-12 03:58:32 (EDT)
commit24520f9acd9a10e79ddc99f56ec600e912347969 (patch)
tree070b5d2a72e0e6d5e9ab4d5ba2aec4acd0578f0e
parent6a5abbb4a6b5ee645d8cddf723edd1f1cfa77286 (diff)
downloadcdo-24520f9acd9a10e79ddc99f56ec600e912347969.zip
cdo-24520f9acd9a10e79ddc99f56ec600e912347969.tar.gz
cdo-24520f9acd9a10e79ddc99f56ec600e912347969.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java5
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEventAdapter.java65
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEventAdapter.java74
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/RegistryEventAdapter.java83
4 files changed, 222 insertions, 5 deletions
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java
index c6fd504..1a9e31f 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/transport/Connector.java
@@ -139,11 +139,6 @@ public abstract class Connector extends Lifecycle implements IConnector, IContai
this.userID = userID;
}
- public ConnectorLocation getLocation()
- {
- return null;
- }
-
public IConnectorCredentials getCredentials()
{
return credentials;
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEventAdapter.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEventAdapter.java
new file mode 100644
index 0000000..dc7cf99
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEventAdapter.java
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.container;
+
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IContainerEvent;
+import org.eclipse.net4j.util.container.IContainerEventVisitor;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+
+/**
+ * @author Eike Stepper
+ */
+public class ContainerEventAdapter implements IListener
+{
+ public final void notifyEvent(IEvent event)
+ {
+ if (event instanceof IContainerEvent)
+ {
+ IContainerEvent e = (IContainerEvent)event;
+ notifyContainerEvent(e);
+ }
+ else
+ {
+ notifyOtherEvent(event);
+ }
+ }
+
+ protected void notifyContainerEvent(IContainerEvent event)
+ {
+ final IContainer container = event.getContainer();
+ event.accept(new IContainerEventVisitor()
+ {
+ public void added(Object element)
+ {
+ onAdded(container, element);
+ }
+
+ public void removed(Object element)
+ {
+ onRemoved(container, element);
+ }
+ });
+ }
+
+ protected void notifyOtherEvent(IEvent event)
+ {
+ }
+
+ protected void onAdded(IContainer container, Object element)
+ {
+ }
+
+ protected void onRemoved(IContainer container, Object element)
+ {
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEventAdapter.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEventAdapter.java
new file mode 100644
index 0000000..3976a51
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/lifecycle/LifecycleEventAdapter.java
@@ -0,0 +1,74 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.lifecycle;
+
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
+
+/**
+ * @author Eike Stepper
+ */
+public class LifecycleEventAdapter implements IListener
+{
+ public final void notifyEvent(IEvent event)
+ {
+ if (event instanceof ILifecycleEvent)
+ {
+ ILifecycleEvent e = (ILifecycleEvent)event;
+ notifyLifecycleEvent(e);
+ }
+ else
+ {
+ notifyOtherEvent(event);
+ }
+ }
+
+ protected void notifyLifecycleEvent(ILifecycleEvent event)
+ {
+ switch (event.getKind())
+ {
+ case ABOUT_TO_ACTIVATE:
+ onAboutToActivate(event.getLifecycle());
+ break;
+ case ACTIVATED:
+ onActivated(event.getLifecycle());
+ break;
+ case ABOUT_TO_DEACTIVATE:
+ onAboutToDeactivate(event.getLifecycle());
+ break;
+ case DEACTIVATED:
+ onDeactivated(event.getLifecycle());
+ break;
+ }
+ }
+
+ protected void notifyOtherEvent(IEvent event)
+ {
+ }
+
+ protected void onAboutToActivate(ILifecycle lifecycle)
+ {
+ }
+
+ protected void onActivated(ILifecycle lifecycle)
+ {
+ }
+
+ protected void onAboutToDeactivate(ILifecycle lifecycle)
+ {
+ }
+
+ protected void onDeactivated(ILifecycle lifecycle)
+ {
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/RegistryEventAdapter.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/RegistryEventAdapter.java
new file mode 100644
index 0000000..0aa3afe
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/registry/RegistryEventAdapter.java
@@ -0,0 +1,83 @@
+/***************************************************************************
+ * Copyright (c) 2004-2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.internal.net4j.util.registry;
+
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IContainerEvent;
+import org.eclipse.net4j.util.container.IContainerEventVisitor;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.registry.IRegistry;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class RegistryEventAdapter implements IListener
+{
+ public final void notifyEvent(IEvent event)
+ {
+ if (event instanceof IContainerEvent)
+ {
+ IContainerEvent e = (IContainerEvent)event;
+ notifyContainerEvent(e);
+ }
+ else
+ {
+ notifyOtherEvent(event);
+ }
+ }
+
+ protected void notifyContainerEvent(IContainerEvent event)
+ {
+ IContainer container = event.getContainer();
+ if (container instanceof IRegistry)
+ {
+ notifyRegistryEvent(event);
+ }
+ else
+ {
+ notifyOtherEvent(event);
+ }
+ }
+
+ protected void notifyRegistryEvent(IContainerEvent event)
+ {
+ final IRegistry registry = (IRegistry)event.getContainer();
+ event.accept(new IContainerEventVisitor()
+ {
+ public void added(Object element)
+ {
+ Map.Entry entry = (Map.Entry)element;
+ onAdded(registry, entry.getKey(), entry.getValue());
+ }
+
+ public void removed(Object element)
+ {
+ Map.Entry entry = (Map.Entry)element;
+ onRemoved(registry, entry.getKey(), entry.getValue());
+ }
+ });
+ }
+
+ protected void notifyOtherEvent(IEvent event)
+ {
+ }
+
+ protected void onAdded(IRegistry registry, Object key, Object value)
+ {
+ }
+
+ protected void onRemoved(IRegistry registry, Object key, Object value)
+ {
+ }
+}