summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-03-11 04:35:44 (EDT)
committerEike Stepper2007-03-11 04:35:44 (EDT)
commit92c905206a0dca713f5457a50e77f2edfe3e84e8 (patch)
tree156db06056dd1044be8ac3402966e40b3d7a3c61
parent52d7b2a67acac6dad7b4fbafec553b63d3dd41c9 (diff)
downloadcdo-92c905206a0dca713f5457a50e77f2edfe3e84e8.zip
cdo-92c905206a0dca713f5457a50e77f2edfe3e84e8.tar.gz
cdo-92c905206a0dca713f5457a50e77f2edfe3e84e8.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.net4j/.classpath2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java28
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/SingleDeltaContainerEvent.java78
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductFactory.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleAdapter.java)23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductGroup.java10
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java4
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEvent.java7
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Activator.java26
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Deactivator.java26
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleListener.java23
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java21
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductFactory.java (renamed from plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IFactory.java)2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductGroup.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/ProductUtil.java8
14 files changed, 138 insertions, 122 deletions
diff --git a/plugins/org.eclipse.net4j/.classpath b/plugins/org.eclipse.net4j/.classpath
index 3381f58..ec568ce 100644
--- a/plugins/org.eclipse.net4j/.classpath
+++ b/plugins/org.eclipse.net4j/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry excluding="org/eclipse/internal/net4j/component/InactiveException.java|org/eclipse/net4j/transport/ChannelMultiplexer.java|org/eclipse/net4j/util/registry/delegating/AbstractCachingRegistry.java|org/eclipse/net4j/util/registry/delegating/DelegatingRegistry.java|org/eclipse/net4j/util/registry/delegating/HashCacheRegistry.java|org/eclipse/net4j/transport/tcp/TCPConnector.java|org/eclipse/internal/net4j/transport/ClientProtocolFactoryRegistry.java|org/eclipse/internal/net4j/transport/ServerProtocolFactoryRegistry.java|org/eclipse/net4j/util/registry/IRegistryListener.java|org/eclipse/net4j/util/lifecycle/LifecycleListener.java|org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java|org/eclipse/net4j/util/lifecycle/LifecycleAdapter.java|org/eclipse/net4j/util/registry/IRegistryDelta.java|org/eclipse/net4j/util/registry/IRegistryEvent.java|org/eclipse/net4j/util/registry/IRegistryEventVisitor.java" kind="src" path="src"/>
+ <classpathentry excluding="org/eclipse/internal/net4j/component/InactiveException.java|org/eclipse/net4j/transport/ChannelMultiplexer.java|org/eclipse/net4j/util/registry/delegating/AbstractCachingRegistry.java|org/eclipse/net4j/util/registry/delegating/DelegatingRegistry.java|org/eclipse/net4j/util/registry/delegating/HashCacheRegistry.java|org/eclipse/net4j/transport/tcp/TCPConnector.java|org/eclipse/internal/net4j/transport/ClientProtocolFactoryRegistry.java|org/eclipse/internal/net4j/transport/ServerProtocolFactoryRegistry.java|org/eclipse/net4j/util/registry/IRegistryListener.java|org/eclipse/net4j/util/lifecycle/LifecycleListener.java|org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java|org/eclipse/net4j/util/lifecycle/LifecycleAdapter.java|org/eclipse/net4j/util/registry/IRegistryDelta.java|org/eclipse/net4j/util/registry/IRegistryEvent.java|org/eclipse/net4j/util/registry/IRegistryEventVisitor.java|org/eclipse/net4j/util/lifecycle/Activator.java|org/eclipse/net4j/util/lifecycle/Deactivator.java" kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java
index 6e8c360..3d0bed6 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/ContainerEvent.java
@@ -24,15 +24,15 @@ public class ContainerEvent<E> extends Event implements IContainerEvent<E>
private List<IContainerDelta<E>> deltas;
- public ContainerEvent(IContainer<E> registry)
+ public ContainerEvent(IContainer<E> container)
{
- super(registry);
+ super(container);
deltas = new ArrayList();
}
- public ContainerEvent(IContainer<E> registry, List<IContainerDelta<E>> deltas)
+ public ContainerEvent(IContainer<E> container, List<IContainerDelta<E>> deltas)
{
- super(registry);
+ super(container);
this.deltas = deltas;
}
@@ -46,6 +46,26 @@ public class ContainerEvent<E> extends Event implements IContainerEvent<E>
return deltas.toArray(new IContainerDelta[deltas.size()]);
}
+ public IContainerDelta<E> getDelta() throws IllegalStateException
+ {
+ if (deltas.size() != 1)
+ {
+ throw new IllegalStateException("deltas.size() != 1");
+ }
+
+ return deltas.get(0);
+ }
+
+ public E getDeltaElement() throws IllegalStateException
+ {
+ return getDelta().getElement();
+ }
+
+ public Kind getDeltaKind() throws IllegalStateException
+ {
+ return getDelta().getKind();
+ }
+
public boolean isEmpty()
{
return deltas.isEmpty();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/SingleDeltaContainerEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/SingleDeltaContainerEvent.java
new file mode 100644
index 0000000..4eb9c59
--- /dev/null
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/container/SingleDeltaContainerEvent.java
@@ -0,0 +1,78 @@
+package org.eclipse.internal.net4j.util.container;
+
+import static org.eclipse.net4j.util.container.IContainerDelta.Kind.ADDED;
+import static org.eclipse.net4j.util.container.IContainerDelta.Kind.REMOVED;
+
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.IContainerEvent;
+import org.eclipse.net4j.util.container.IContainerEventVisitor;
+import org.eclipse.net4j.util.container.IContainerDelta.Kind;
+import org.eclipse.net4j.util.container.IContainerEventVisitor.Filtered;
+
+import org.eclipse.internal.net4j.util.event.Event;
+
+/**
+ * @author Eike Stepper
+ */
+public class SingleDeltaContainerEvent<E> extends Event implements IContainerEvent<E>
+{
+ private static final long serialVersionUID = 1L;
+
+ private IContainerDelta<E>[] deltas;
+
+ public SingleDeltaContainerEvent(IContainer<E> container, E element, Kind kind)
+ {
+ super(container);
+ deltas = new IContainerDelta[] { new ContainerDelta(element, kind) };
+ }
+
+ public IContainer<E> getContainer()
+ {
+ return (IContainer<E>)getSource();
+ }
+
+ public IContainerDelta<E>[] getDeltas()
+ {
+ return deltas;
+ }
+
+ public IContainerDelta<E> getDelta() throws IllegalStateException
+ {
+ return deltas[0];
+ }
+
+ public E getDeltaElement() throws IllegalStateException
+ {
+ return deltas[0].getElement();
+ }
+
+ public Kind getDeltaKind() throws IllegalStateException
+ {
+ return deltas[0].getKind();
+ }
+
+ public void accept(IContainerEventVisitor<E> visitor)
+ {
+ E element = deltas[0].getElement();
+
+ boolean filtered = true;
+ if (visitor instanceof Filtered)
+ {
+ filtered = ((Filtered)visitor).filter(element);
+ }
+
+ if (filtered)
+ {
+ switch (deltas[0].getKind())
+ {
+ case ADDED:
+ visitor.added(element);
+ break;
+ case REMOVED:
+ visitor.removed(element);
+ break;
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleAdapter.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductFactory.java
index a09611a..9995e5b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleAdapter.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductFactory.java
@@ -8,26 +8,33 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.net4j.util.lifecycle;
+package org.eclipse.internal.net4j.util.product;
+
+import org.eclipse.net4j.util.product.IProduct;
+import org.eclipse.net4j.util.product.IProductFactory;
/**
* @author Eike Stepper
*/
-public abstract class LifecycleAdapter implements LifecycleListener
+public abstract class ProductFactory<PRODUCT extends IProduct> implements IProductFactory<PRODUCT>
{
- protected LifecycleAdapter()
- {
- }
+ private String productGroupID;
+
+ private String type;
- public void notifyLifecycleAboutToActivate(LifecycleNotifier notifier)
+ public ProductFactory(String productGroupID, String type)
{
+ this.productGroupID = productGroupID;
+ this.type = type;
}
- public void notifyLifecycleActivated(LifecycleNotifier notifier)
+ public String getProductGroupID()
{
+ return productGroupID;
}
- public void notifyLifecycleDeactivating(LifecycleNotifier notifier)
+ public String getType()
{
+ return type;
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductGroup.java b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductGroup.java
index 716e85a..8d641f7 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductGroup.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/internal/net4j/util/product/ProductGroup.java
@@ -10,8 +10,8 @@
**************************************************************************/
package org.eclipse.internal.net4j.util.product;
-import org.eclipse.net4j.util.product.IFactory;
import org.eclipse.net4j.util.product.IProduct;
+import org.eclipse.net4j.util.product.IProductFactory;
import org.eclipse.net4j.util.product.IProductGroup;
import org.eclipse.net4j.util.registry.IRegistry;
@@ -24,7 +24,7 @@ public class ProductGroup<PRODUCT extends IProduct> implements IProductGroup<PRO
{
private String id;
- private IRegistry<String, IFactory<PRODUCT>> factoryRegistry = new HashMapRegistry();
+ private IRegistry<String, IProductFactory<PRODUCT>> factoryRegistry = new HashMapRegistry();
public ProductGroup(String id)
{
@@ -36,17 +36,17 @@ public class ProductGroup<PRODUCT extends IProduct> implements IProductGroup<PRO
return id;
}
- public IRegistry<String, IFactory<PRODUCT>> getFactoryRegistry()
+ public IRegistry<String, IProductFactory<PRODUCT>> getFactoryRegistry()
{
return factoryRegistry;
}
- public void addFactory(IFactory<PRODUCT> factory)
+ public void addFactory(IProductFactory<PRODUCT> factory)
{
factoryRegistry.put(factory.getType(), factory);
}
- public void removeFactory(IFactory<PRODUCT> factory)
+ public void removeFactory(IProductFactory<PRODUCT> factory)
{
factoryRegistry.remove(factory.getType());
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java
index 5ab782a..87e9fb0 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/transport/IBuffer.java
@@ -73,9 +73,9 @@ import java.nio.channels.SocketChannel;
* </pre>
*
* @see IBufferProvider
- * @see IChannel#sendBuffer(Buffer)
+ * @see IChannel#sendBuffer(IBuffer)
* @see IChannel#setReceiveHandler(IBufferHandler)
- * @see IBufferHandler#handleBuffer(Buffer)
+ * @see IBufferHandler#handleBuffer(IBuffer)
* @author Eike Stepper
*/
public interface IBuffer
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEvent.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEvent.java
index aa52c11..74889fa 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEvent.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/container/IContainerEvent.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.util.container;
+import org.eclipse.net4j.util.container.IContainerDelta.Kind;
import org.eclipse.net4j.util.event.IEvent;
/**
@@ -21,5 +22,11 @@ public interface IContainerEvent<E> extends IEvent
public IContainerDelta<E>[] getDeltas();
+ public IContainerDelta<E> getDelta() throws IllegalStateException;
+
+ public E getDeltaElement() throws IllegalStateException;
+
+ public Kind getDeltaKind() throws IllegalStateException;
+
public void accept(IContainerEventVisitor<E> visitor);
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Activator.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Activator.java
deleted file mode 100644
index 4668b75..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Activator.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/***************************************************************************
- * 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.net4j.util.lifecycle;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @author Eike Stepper
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface Activator
-{
- boolean propagate() default true;
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Deactivator.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Deactivator.java
deleted file mode 100644
index 4e79ac5..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/Deactivator.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/***************************************************************************
- * 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.net4j.util.lifecycle;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @author Eike Stepper
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface Deactivator
-{
- boolean propagate() default true;
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleListener.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleListener.java
deleted file mode 100644
index c770369..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleListener.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/***************************************************************************
- * 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.net4j.util.lifecycle;
-
-/**
- * @author Eike Stepper
- */
-public interface LifecycleListener
-{
- public void notifyLifecycleAboutToActivate(LifecycleNotifier notifier);
-
- public void notifyLifecycleActivated(LifecycleNotifier notifier);
-
- public void notifyLifecycleDeactivating(LifecycleNotifier notifier);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java
deleted file mode 100644
index 60c592f..0000000
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/lifecycle/LifecycleNotifier.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/***************************************************************************
- * 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.net4j.util.lifecycle;
-
-/**
- * @author Eike Stepper
- */
-public interface LifecycleNotifier extends ILifecycle.Introspection
-{
- public void addLifecycleListener(LifecycleListener listener);
-
- public void removeLifecycleListener(LifecycleListener listener);
-}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductFactory.java
index 22bc4ea..5f6fa40 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductFactory.java
@@ -13,7 +13,7 @@ package org.eclipse.net4j.util.product;
/**
* @author Eike Stepper
*/
-public interface IFactory<PRODUCT extends IProduct>
+public interface IProductFactory<PRODUCT extends IProduct>
{
public String getProductGroupID();
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductGroup.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductGroup.java
index f7a3e30..1be815b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductGroup.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/IProductGroup.java
@@ -19,5 +19,5 @@ public interface IProductGroup<PRODUCT extends IProduct>
{
public String getID();
- public IRegistry<String, IFactory<PRODUCT>> getFactoryRegistry();
+ public IRegistry<String, IProductFactory<PRODUCT>> getFactoryRegistry();
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/ProductUtil.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/ProductUtil.java
index f4f8d1e..87f5ed3 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/ProductUtil.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/util/product/ProductUtil.java
@@ -60,14 +60,14 @@ public final class ProductUtil
return null;
}
- IRegistry<String, IFactory> factoryRegistry = productGroup.getFactoryRegistry();
- IFactory factory = factoryRegistry.get(factoryType);
- if (factory == null)
+ IRegistry<String, IProductFactory> factoryRegistry = productGroup.getFactoryRegistry();
+ IProductFactory productFactory = factoryRegistry.get(factoryType);
+ if (productFactory == null)
{
return null;
}
- IProduct product = factory.create(description);
+ IProduct product = productFactory.create(description);
return product;
}
}