Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.net4j/src/org/eclipse/spi')
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Acceptor.java334
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/AcceptorFactory.java52
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ClientProtocolFactory.java54
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ConnectorFactory.java52
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalAcceptor.java44
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalBuffer.java50
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannel.java176
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannelMultiplexer.java78
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalConnector.java42
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Protocol.java354
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ServerProtocolFactory.java54
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/package-info.java30
12 files changed, 660 insertions, 660 deletions
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Acceptor.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Acceptor.java
index ee667662a7..31cf56d34d 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Acceptor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Acceptor.java
@@ -1,167 +1,167 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.net4j;
-
-import org.eclipse.net4j.ITransportConfig;
-import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.util.container.Container;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-import org.eclipse.net4j.util.security.INegotiator;
-
-import org.eclipse.internal.net4j.TransportConfig;
-import org.eclipse.internal.net4j.bundle.OM;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public abstract class Acceptor extends Container<IConnector> implements InternalAcceptor
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_ACCEPTOR, Acceptor.class);
-
- private ITransportConfig config;
-
- private transient IListener connectorListener = new LifecycleEventAdapter()
- {
- @Override
- protected void onDeactivated(ILifecycle lifecycle)
- {
- removeConnector((IConnector)lifecycle);
- }
- };
-
- private Set<IConnector> acceptedConnectors = new HashSet<IConnector>(0);
-
- public Acceptor()
- {
- }
-
- public synchronized ITransportConfig getConfig()
- {
- if (config == null)
- {
- config = new TransportConfig(this);
- }
-
- return config;
- }
-
- public synchronized void setConfig(ITransportConfig config)
- {
- this.config = Net4jUtil.copyTransportConfig(this, config);
- }
-
- public INegotiator getNegotiator()
- {
- return getConfig().getNegotiator();
- }
-
- public void setNegotiator(INegotiator negotiator)
- {
- getConfig().setNegotiator(negotiator);
- }
-
- public IConnector[] getAcceptedConnectors()
- {
- synchronized (acceptedConnectors)
- {
- return acceptedConnectors.toArray(new IConnector[acceptedConnectors.size()]);
- }
- }
-
- @Override
- public boolean isEmpty()
- {
- return acceptedConnectors.isEmpty();
- }
-
- public IConnector[] getElements()
- {
- return getAcceptedConnectors();
- }
-
- public void prepareConnector(InternalConnector connector)
- {
- connector.setConfig(getConfig());
- }
-
- public void addConnector(InternalConnector connector)
- {
- synchronized (acceptedConnectors)
- {
- acceptedConnectors.add(connector);
- }
-
- connector.addListener(connectorListener);
- if (TRACER.isEnabled())
- {
- TRACER.trace("Added connector " + connector); //$NON-NLS-1$
- }
-
- fireElementAddedEvent(connector);
- }
-
- public void removeConnector(IConnector connector)
- {
- connector.removeListener(connectorListener);
- synchronized (acceptedConnectors)
- {
- acceptedConnectors.remove(connector);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.trace("Removed connector " + connector); //$NON-NLS-1$
- }
-
- fireElementRemovedEvent(connector);
- }
-
- public void close()
- {
- LifecycleUtil.deactivate(this, OMLogger.Level.DEBUG);
- }
-
- public boolean isClosed()
- {
- return !isActive();
- }
-
- @Override
- protected void doBeforeActivate() throws Exception
- {
- super.doBeforeActivate();
- if (getConfig().getBufferProvider() == null)
- {
- throw new IllegalStateException("getConfig().getBufferProvider() == null"); //$NON-NLS-1$
- }
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- for (IConnector connector : getAcceptedConnectors())
- {
- connector.close();
- }
-
- super.doDeactivate();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.net4j;
+
+import org.eclipse.net4j.ITransportConfig;
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.util.container.Container;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.net4j.util.security.INegotiator;
+
+import org.eclipse.internal.net4j.TransportConfig;
+import org.eclipse.internal.net4j.bundle.OM;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public abstract class Acceptor extends Container<IConnector> implements InternalAcceptor
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_ACCEPTOR, Acceptor.class);
+
+ private ITransportConfig config;
+
+ private transient IListener connectorListener = new LifecycleEventAdapter()
+ {
+ @Override
+ protected void onDeactivated(ILifecycle lifecycle)
+ {
+ removeConnector((IConnector)lifecycle);
+ }
+ };
+
+ private Set<IConnector> acceptedConnectors = new HashSet<IConnector>(0);
+
+ public Acceptor()
+ {
+ }
+
+ public synchronized ITransportConfig getConfig()
+ {
+ if (config == null)
+ {
+ config = new TransportConfig(this);
+ }
+
+ return config;
+ }
+
+ public synchronized void setConfig(ITransportConfig config)
+ {
+ this.config = Net4jUtil.copyTransportConfig(this, config);
+ }
+
+ public INegotiator getNegotiator()
+ {
+ return getConfig().getNegotiator();
+ }
+
+ public void setNegotiator(INegotiator negotiator)
+ {
+ getConfig().setNegotiator(negotiator);
+ }
+
+ public IConnector[] getAcceptedConnectors()
+ {
+ synchronized (acceptedConnectors)
+ {
+ return acceptedConnectors.toArray(new IConnector[acceptedConnectors.size()]);
+ }
+ }
+
+ @Override
+ public boolean isEmpty()
+ {
+ return acceptedConnectors.isEmpty();
+ }
+
+ public IConnector[] getElements()
+ {
+ return getAcceptedConnectors();
+ }
+
+ public void prepareConnector(InternalConnector connector)
+ {
+ connector.setConfig(getConfig());
+ }
+
+ public void addConnector(InternalConnector connector)
+ {
+ synchronized (acceptedConnectors)
+ {
+ acceptedConnectors.add(connector);
+ }
+
+ connector.addListener(connectorListener);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Added connector " + connector); //$NON-NLS-1$
+ }
+
+ fireElementAddedEvent(connector);
+ }
+
+ public void removeConnector(IConnector connector)
+ {
+ connector.removeListener(connectorListener);
+ synchronized (acceptedConnectors)
+ {
+ acceptedConnectors.remove(connector);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Removed connector " + connector); //$NON-NLS-1$
+ }
+
+ fireElementRemovedEvent(connector);
+ }
+
+ public void close()
+ {
+ LifecycleUtil.deactivate(this, OMLogger.Level.DEBUG);
+ }
+
+ public boolean isClosed()
+ {
+ return !isActive();
+ }
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ if (getConfig().getBufferProvider() == null)
+ {
+ throw new IllegalStateException("getConfig().getBufferProvider() == null"); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ for (IConnector connector : getAcceptedConnectors())
+ {
+ connector.close();
+ }
+
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/AcceptorFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/AcceptorFactory.java
index 69db39c22e..6233ada1d2 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/AcceptorFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/AcceptorFactory.java
@@ -1,26 +1,26 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.net4j;
-
-import org.eclipse.net4j.util.factory.Factory;
-
-/**
- * @author Eike Stepper
- */
-public abstract class AcceptorFactory extends Factory
-{
- public static final String PRODUCT_GROUP = "org.eclipse.net4j.acceptors"; //$NON-NLS-1$
-
- public AcceptorFactory(String type)
- {
- super(PRODUCT_GROUP, type);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.net4j;
+
+import org.eclipse.net4j.util.factory.Factory;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AcceptorFactory extends Factory
+{
+ public static final String PRODUCT_GROUP = "org.eclipse.net4j.acceptors"; //$NON-NLS-1$
+
+ public AcceptorFactory(String type)
+ {
+ super(PRODUCT_GROUP, type);
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ClientProtocolFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ClientProtocolFactory.java
index 0111ab0cb0..18a314c862 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ClientProtocolFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ClientProtocolFactory.java
@@ -1,27 +1,27 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.net4j;
-
-import org.eclipse.net4j.util.factory.Factory;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public abstract class ClientProtocolFactory extends Factory
-{
- public static final String PRODUCT_GROUP = "org.eclipse.net4j.clientProtocols"; //$NON-NLS-1$
-
- public ClientProtocolFactory(String type)
- {
- super(PRODUCT_GROUP, type);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.net4j;
+
+import org.eclipse.net4j.util.factory.Factory;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public abstract class ClientProtocolFactory extends Factory
+{
+ public static final String PRODUCT_GROUP = "org.eclipse.net4j.clientProtocols"; //$NON-NLS-1$
+
+ public ClientProtocolFactory(String type)
+ {
+ super(PRODUCT_GROUP, type);
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ConnectorFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ConnectorFactory.java
index ae16c8861e..0efca2a96b 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ConnectorFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ConnectorFactory.java
@@ -1,26 +1,26 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.net4j;
-
-import org.eclipse.net4j.util.factory.Factory;
-
-/**
- * @author Eike Stepper
- */
-public abstract class ConnectorFactory extends Factory
-{
- public static final String PRODUCT_GROUP = "org.eclipse.net4j.connectors"; //$NON-NLS-1$
-
- public ConnectorFactory(String type)
- {
- super(PRODUCT_GROUP, type);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.net4j;
+
+import org.eclipse.net4j.util.factory.Factory;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ConnectorFactory extends Factory
+{
+ public static final String PRODUCT_GROUP = "org.eclipse.net4j.connectors"; //$NON-NLS-1$
+
+ public ConnectorFactory(String type)
+ {
+ super(PRODUCT_GROUP, type);
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalAcceptor.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalAcceptor.java
index 7fec99ef66..5459baff65 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalAcceptor.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalAcceptor.java
@@ -1,22 +1,22 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.net4j;
-
-import org.eclipse.net4j.ITransportConfigAware;
-import org.eclipse.net4j.acceptor.IAcceptor;
-import org.eclipse.net4j.util.security.INegotiatorAware;
-
-/**
- * @author Eike Stepper
- */
-public interface InternalAcceptor extends IAcceptor, ITransportConfigAware, INegotiatorAware
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.net4j;
+
+import org.eclipse.net4j.ITransportConfigAware;
+import org.eclipse.net4j.acceptor.IAcceptor;
+import org.eclipse.net4j.util.security.INegotiatorAware;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalAcceptor extends IAcceptor, ITransportConfigAware, INegotiatorAware
+{
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalBuffer.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalBuffer.java
index d73b527592..020c3d6218 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalBuffer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalBuffer.java
@@ -1,25 +1,25 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.net4j;
-
-import org.eclipse.net4j.buffer.IBuffer;
-import org.eclipse.net4j.buffer.IBufferProvider;
-
-/**
- * @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalBuffer extends IBuffer
-{
- public void setBufferProvider(IBufferProvider bufferProvider);
-
- public void dispose();
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.net4j;
+
+import org.eclipse.net4j.buffer.IBuffer;
+import org.eclipse.net4j.buffer.IBufferProvider;
+
+/**
+ * @author Eike Stepper
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface InternalBuffer extends IBuffer
+{
+ public void setBufferProvider(IBufferProvider bufferProvider);
+
+ public void dispose();
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannel.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannel.java
index 3ab8890941..da1e3248f3 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannel.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannel.java
@@ -1,88 +1,88 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.net4j;
-
-import org.eclipse.net4j.buffer.IBuffer;
-import org.eclipse.net4j.buffer.IBufferProvider;
-import org.eclipse.net4j.channel.IChannel;
-import org.eclipse.net4j.channel.IChannelMultiplexer;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
-import java.util.Queue;
-import java.util.concurrent.ExecutorService;
-
-/**
- * @author Eike Stepper
- */
-public interface InternalChannel extends IChannel, IBufferProvider, ILifecycle
-{
- /**
- * @since 2.0
- */
- public void setID(short id);
-
- /**
- * @since 2.0
- */
- public void setUserID(String userID);
-
- public ExecutorService getReceiveExecutor();
-
- public void setReceiveExecutor(ExecutorService receiveExecutor);
-
- /**
- * @since 2.0
- */
- public void setMultiplexer(IChannelMultiplexer channelMultiplexer);
-
- public void handleBufferFromMultiplexer(IBuffer buffer);
-
- /**
- * @since 3.0
- */
- public long getReceivedBuffers();
-
- /**
- * @since 3.0
- */
- public long getSentBuffers();
-
- public Queue<IBuffer> getSendQueue();
-
- /**
- * An {@link IEvent event} fired from a {@link InternalChannel channel} when a {@link IBuffer buffer} is enqueued or
- * dequeued.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
- public interface SendQueueEvent extends IEvent
- {
- public InternalChannel getSource();
-
- public Type getType();
-
- public int getQueueSize();
-
- /**
- * Enumerates the possible {@link InternalChannel#getSendQueue() send queue} {@link SendQueueEvent event} types.
- *
- * @author Eike Stepper
- */
- public enum Type
- {
- ENQUEUED, DEQUEUED
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.net4j;
+
+import org.eclipse.net4j.buffer.IBuffer;
+import org.eclipse.net4j.buffer.IBufferProvider;
+import org.eclipse.net4j.channel.IChannel;
+import org.eclipse.net4j.channel.IChannelMultiplexer;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+
+import java.util.Queue;
+import java.util.concurrent.ExecutorService;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalChannel extends IChannel, IBufferProvider, ILifecycle
+{
+ /**
+ * @since 2.0
+ */
+ public void setID(short id);
+
+ /**
+ * @since 2.0
+ */
+ public void setUserID(String userID);
+
+ public ExecutorService getReceiveExecutor();
+
+ public void setReceiveExecutor(ExecutorService receiveExecutor);
+
+ /**
+ * @since 2.0
+ */
+ public void setMultiplexer(IChannelMultiplexer channelMultiplexer);
+
+ public void handleBufferFromMultiplexer(IBuffer buffer);
+
+ /**
+ * @since 3.0
+ */
+ public long getReceivedBuffers();
+
+ /**
+ * @since 3.0
+ */
+ public long getSentBuffers();
+
+ public Queue<IBuffer> getSendQueue();
+
+ /**
+ * An {@link IEvent event} fired from a {@link InternalChannel channel} when a {@link IBuffer buffer} is enqueued or
+ * dequeued.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+ public interface SendQueueEvent extends IEvent
+ {
+ public InternalChannel getSource();
+
+ public Type getType();
+
+ public int getQueueSize();
+
+ /**
+ * Enumerates the possible {@link InternalChannel#getSendQueue() send queue} {@link SendQueueEvent event} types.
+ *
+ * @author Eike Stepper
+ */
+ public enum Type
+ {
+ ENQUEUED, DEQUEUED
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannelMultiplexer.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannelMultiplexer.java
index 1dfd554a3c..7385dbbc30 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannelMultiplexer.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalChannelMultiplexer.java
@@ -1,39 +1,39 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.net4j;
-
-import org.eclipse.net4j.ITransportConfigAware;
-import org.eclipse.net4j.buffer.IBufferProvider;
-import org.eclipse.net4j.channel.IChannel;
-import org.eclipse.net4j.channel.IChannelMultiplexer;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public interface InternalChannelMultiplexer extends IChannelMultiplexer, IBufferProvider, ITransportConfigAware
-{
- /**
- * @since 4.0
- */
- public static final short RESERVED_CHANNEL = 0;
-
- /**
- * Called by an {@link IChannel} each time a new buffer is available for multiplexing. This or another buffer can be
- * dequeued from the outputQueue of the {@link IChannel}.
- */
- public void multiplexChannel(InternalChannel channel);
-
- /**
- * @since 2.0
- */
- public void closeChannel(InternalChannel channel);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.net4j;
+
+import org.eclipse.net4j.ITransportConfigAware;
+import org.eclipse.net4j.buffer.IBufferProvider;
+import org.eclipse.net4j.channel.IChannel;
+import org.eclipse.net4j.channel.IChannelMultiplexer;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public interface InternalChannelMultiplexer extends IChannelMultiplexer, IBufferProvider, ITransportConfigAware
+{
+ /**
+ * @since 4.0
+ */
+ public static final short RESERVED_CHANNEL = 0;
+
+ /**
+ * Called by an {@link IChannel} each time a new buffer is available for multiplexing. This or another buffer can be
+ * dequeued from the outputQueue of the {@link IChannel}.
+ */
+ public void multiplexChannel(InternalChannel channel);
+
+ /**
+ * @since 2.0
+ */
+ public void closeChannel(InternalChannel channel);
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalConnector.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalConnector.java
index ec6ac8b6d5..1fb8dc4295 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalConnector.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/InternalConnector.java
@@ -1,21 +1,21 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.net4j;
-
-import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.util.security.INegotiatorAware;
-
-/**
- * @author Eike Stepper
- */
-public interface InternalConnector extends IConnector, INegotiatorAware, InternalChannelMultiplexer
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.net4j;
+
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.util.security.INegotiatorAware;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalConnector extends IConnector, INegotiatorAware, InternalChannelMultiplexer
+{
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Protocol.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Protocol.java
index a7a5afaf9b..46fde5dd08 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Protocol.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/Protocol.java
@@ -1,177 +1,177 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.net4j;
-
-import org.eclipse.net4j.buffer.IBufferProvider;
-import org.eclipse.net4j.channel.IChannel;
-import org.eclipse.net4j.protocol.IProtocol;
-import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.net4j.util.om.log.OMLogger;
-
-import java.util.concurrent.ExecutorService;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public abstract class Protocol<INFRA_STRUCTURE> extends Lifecycle implements IProtocol<INFRA_STRUCTURE>
-{
- private String type;
-
- private ExecutorService executorService;
-
- private IBufferProvider bufferProvider;
-
- private INFRA_STRUCTURE infraStructure;
-
- private IChannel channel;
-
- @ExcludeFromDump
- private transient IListener channelListener = new LifecycleEventAdapter()
- {
- @Override
- protected void onDeactivated(ILifecycle lifecycle)
- {
- handleChannelDeactivation();
- }
- };
-
- private String userID;
-
- public Protocol(String type)
- {
- this.type = type;
- }
-
- public final String getType()
- {
- return type;
- }
-
- public ExecutorService getExecutorService()
- {
- return executorService;
- }
-
- public void setExecutorService(ExecutorService executorService)
- {
- this.executorService = executorService;
- }
-
- public IBufferProvider getBufferProvider()
- {
- return bufferProvider;
- }
-
- public INFRA_STRUCTURE getInfraStructure()
- {
- return infraStructure;
- }
-
- public void setInfraStructure(INFRA_STRUCTURE infraStructure)
- {
- this.infraStructure = infraStructure;
- }
-
- /**
- * @since 2.0
- */
- public Location getLocation()
- {
- return channel.getLocation();
- }
-
- /**
- * @since 2.0
- */
- public boolean isClient()
- {
- return channel.isClient();
- }
-
- /**
- * @since 2.0
- */
- public boolean isServer()
- {
- return channel.isServer();
- }
-
- public IChannel getChannel()
- {
- return channel;
- }
-
- public void setChannel(IChannel newChannel)
- {
- if (channel != newChannel)
- {
- executorService = null;
- bufferProvider = null;
- if (channel != null)
- {
- channel.removeListener(channelListener);
- }
-
- channel = newChannel;
- if (channel != null)
- {
- channel.addListener(channelListener);
- executorService = ((InternalChannel)channel).getReceiveExecutor();
- bufferProvider = (InternalChannel)channel;
- }
- }
- }
-
- public String getUserID()
- {
- if (userID == null && channel != null)
- {
- return channel.getUserID();
- }
-
- return userID;
- }
-
- protected void setUserID(String userID)
- {
- this.userID = userID;
- }
-
- /**
- * @since 2.0
- */
- protected void handleChannelDeactivation()
- {
- LifecycleUtil.deactivate(this, OMLogger.Level.DEBUG);
- }
-
- @Override
- protected void doBeforeActivate() throws Exception
- {
- super.doBeforeActivate();
- checkState(channel, "channel"); //$NON-NLS-1$
- checkState(bufferProvider, "bufferProvider"); //$NON-NLS-1$
- checkState(executorService, "executorService"); //$NON-NLS-1$
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- setChannel(null);
- super.doDeactivate();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.net4j;
+
+import org.eclipse.net4j.buffer.IBufferProvider;
+import org.eclipse.net4j.channel.IChannel;
+import org.eclipse.net4j.protocol.IProtocol;
+import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.log.OMLogger;
+
+import java.util.concurrent.ExecutorService;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public abstract class Protocol<INFRA_STRUCTURE> extends Lifecycle implements IProtocol<INFRA_STRUCTURE>
+{
+ private String type;
+
+ private ExecutorService executorService;
+
+ private IBufferProvider bufferProvider;
+
+ private INFRA_STRUCTURE infraStructure;
+
+ private IChannel channel;
+
+ @ExcludeFromDump
+ private transient IListener channelListener = new LifecycleEventAdapter()
+ {
+ @Override
+ protected void onDeactivated(ILifecycle lifecycle)
+ {
+ handleChannelDeactivation();
+ }
+ };
+
+ private String userID;
+
+ public Protocol(String type)
+ {
+ this.type = type;
+ }
+
+ public final String getType()
+ {
+ return type;
+ }
+
+ public ExecutorService getExecutorService()
+ {
+ return executorService;
+ }
+
+ public void setExecutorService(ExecutorService executorService)
+ {
+ this.executorService = executorService;
+ }
+
+ public IBufferProvider getBufferProvider()
+ {
+ return bufferProvider;
+ }
+
+ public INFRA_STRUCTURE getInfraStructure()
+ {
+ return infraStructure;
+ }
+
+ public void setInfraStructure(INFRA_STRUCTURE infraStructure)
+ {
+ this.infraStructure = infraStructure;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public Location getLocation()
+ {
+ return channel.getLocation();
+ }
+
+ /**
+ * @since 2.0
+ */
+ public boolean isClient()
+ {
+ return channel.isClient();
+ }
+
+ /**
+ * @since 2.0
+ */
+ public boolean isServer()
+ {
+ return channel.isServer();
+ }
+
+ public IChannel getChannel()
+ {
+ return channel;
+ }
+
+ public void setChannel(IChannel newChannel)
+ {
+ if (channel != newChannel)
+ {
+ executorService = null;
+ bufferProvider = null;
+ if (channel != null)
+ {
+ channel.removeListener(channelListener);
+ }
+
+ channel = newChannel;
+ if (channel != null)
+ {
+ channel.addListener(channelListener);
+ executorService = ((InternalChannel)channel).getReceiveExecutor();
+ bufferProvider = (InternalChannel)channel;
+ }
+ }
+ }
+
+ public String getUserID()
+ {
+ if (userID == null && channel != null)
+ {
+ return channel.getUserID();
+ }
+
+ return userID;
+ }
+
+ protected void setUserID(String userID)
+ {
+ this.userID = userID;
+ }
+
+ /**
+ * @since 2.0
+ */
+ protected void handleChannelDeactivation()
+ {
+ LifecycleUtil.deactivate(this, OMLogger.Level.DEBUG);
+ }
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ checkState(channel, "channel"); //$NON-NLS-1$
+ checkState(bufferProvider, "bufferProvider"); //$NON-NLS-1$
+ checkState(executorService, "executorService"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ setChannel(null);
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ServerProtocolFactory.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ServerProtocolFactory.java
index a721e9d776..245d02fca5 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ServerProtocolFactory.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/ServerProtocolFactory.java
@@ -1,27 +1,27 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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.spi.net4j;
-
-import org.eclipse.net4j.util.factory.Factory;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public abstract class ServerProtocolFactory extends Factory
-{
- public static final String PRODUCT_GROUP = "org.eclipse.net4j.serverProtocols"; //$NON-NLS-1$
-
- public ServerProtocolFactory(String type)
- {
- super(PRODUCT_GROUP, type);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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.spi.net4j;
+
+import org.eclipse.net4j.util.factory.Factory;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public abstract class ServerProtocolFactory extends Factory
+{
+ public static final String PRODUCT_GROUP = "org.eclipse.net4j.serverProtocols"; //$NON-NLS-1$
+
+ public ServerProtocolFactory(String type)
+ {
+ super(PRODUCT_GROUP, type);
+ }
+}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/package-info.java b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/package-info.java
index 15a3a41f9e..e697088561 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/package-info.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/spi/net4j/package-info.java
@@ -1,15 +1,15 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * 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
- */
-
-/**
- * Server service provider interfaces and useful base implementations for the Net4j transport layer.
- */
-package org.eclipse.spi.net4j;
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * 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
+ */
+
+/**
+ * Server service provider interfaces and useful base implementations for the Net4j transport layer.
+ */
+package org.eclipse.spi.net4j;

Back to the top