You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2006/09/20 00:07:25 UTC
svn commit: r447994 [35/46] - in /incubator/qpid/trunk/qpid: ./ cpp/
cpp/bin/ cpp/broker/ cpp/broker/inc/ cpp/broker/src/ cpp/broker/test/
cpp/client/ cpp/client/inc/ cpp/client/src/ cpp/client/test/ cpp/common/
cpp/common/concurrent/ cpp/common/concur...
Propchange: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/RecordingBroker.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/RecordingBrokerFactory.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/RecordingBrokerFactory.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/RecordingBrokerFactory.java (added)
+++ incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/RecordingBrokerFactory.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,26 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.server.cluster;
+
+class RecordingBrokerFactory implements BrokerFactory
+{
+ public Broker create(MemberHandle handle)
+ {
+ return new RecordingBroker(handle.getHost(), handle.getPort());
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/RecordingBrokerFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/SimpleClusterTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/SimpleClusterTest.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/SimpleClusterTest.java (added)
+++ incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/SimpleClusterTest.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.server.cluster;
+
+import org.junit.Test;
+import org.apache.qpid.AMQException;
+import org.apache.qpid.url.URLSyntaxException;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQSession;
+
+import javax.jms.JMSException;
+
+public class SimpleClusterTest
+{
+ @Test
+ public void declareExchange() throws AMQException, JMSException, URLSyntaxException
+ {
+ AMQConnection con = new AMQConnection("localhost:9000", "guest", "guest", "test", "/test");
+ AMQSession session = (AMQSession) con.createSession(false, AMQSession.NO_ACKNOWLEDGE);
+ System.out.println("Session created");
+ session.declareExchange("my_exchange", "direct");
+ System.out.println("Exchange declared");
+ con.close();
+ System.out.println("Connection closed");
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/SimpleClusterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/SimpleMemberHandleTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/SimpleMemberHandleTest.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/SimpleMemberHandleTest.java (added)
+++ incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/SimpleMemberHandleTest.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,59 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.server.cluster;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+
+public class SimpleMemberHandleTest
+{
+ @Test
+ public void matches()
+ {
+ assertMatch(new SimpleMemberHandle("localhost", 8888), new SimpleMemberHandle("localhost", 8888));
+ assertNoMatch(new SimpleMemberHandle("localhost", 8889), new SimpleMemberHandle("localhost", 8888));
+ assertNoMatch(new SimpleMemberHandle("localhost", 8888), new SimpleMemberHandle("localhost2", 8888));
+ }
+
+
+ @Test
+ public void resolve()
+ {
+ assertEquivalent(new SimpleMemberHandle("WGLAIBD8XGR0J:9000"), new SimpleMemberHandle("localhost:9000"));
+ }
+
+ private void assertEquivalent(MemberHandle a, MemberHandle b)
+ {
+ String msg = a + " is not equivalent to " + b;
+ a = SimpleMemberHandle.resolve(a);
+ b = SimpleMemberHandle.resolve(b);
+ msg += "(" + a + " does not match " + b + ")";
+ assertTrue(msg, a.matches(b));
+ }
+
+ private void assertMatch(MemberHandle a, MemberHandle b)
+ {
+ assertTrue(a + " does not match " + b, a.matches(b));
+ }
+
+ private void assertNoMatch(MemberHandle a, MemberHandle b)
+ {
+ assertFalse(a + " matches " + b, a.matches(b));
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/SimpleMemberHandleTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestBroker.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestBroker.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestBroker.java (added)
+++ incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestBroker.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,67 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.server.cluster;
+
+import org.apache.qpid.AMQException;
+import org.apache.qpid.framing.AMQDataBlock;
+import org.apache.qpid.framing.AMQFrame;
+import org.apache.qpid.framing.AMQMethodBody;
+
+import java.io.IOException;
+
+class TestBroker extends Broker
+{
+ TestBroker(String host, int port)
+ {
+ super(host, port);
+ }
+
+ boolean connect() throws IOException, InterruptedException
+ {
+ return true;
+ }
+
+ void connectAsynch(Iterable<AMQMethodBody> msgs)
+ {
+ replay(msgs);
+ }
+
+ void replay(Iterable<AMQMethodBody> msgs)
+ {
+ try
+ {
+ for (AMQMethodBody b : msgs)
+ {
+ send(new AMQFrame(0, b));
+ }
+ }
+ catch (AMQException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ Broker connectToCluster() throws IOException, InterruptedException
+ {
+ return this;
+ }
+
+ public void send(AMQDataBlock data) throws AMQException
+ {
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestBroker.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestBrokerFactory.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestBrokerFactory.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestBrokerFactory.java (added)
+++ incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestBrokerFactory.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,26 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.server.cluster;
+
+class TestBrokerFactory implements BrokerFactory
+{
+ public Broker create(MemberHandle handle)
+ {
+ return new TestBroker(handle.getHost(), handle.getPort());
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestBrokerFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestReplayManager.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestReplayManager.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestReplayManager.java (added)
+++ incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestReplayManager.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,44 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.server.cluster;
+
+import org.apache.qpid.framing.AMQMethodBody;
+import org.apache.qpid.server.cluster.replay.ReplayManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+class TestReplayManager implements ReplayManager
+{
+ private final List<AMQMethodBody> _msgs;
+
+ TestReplayManager()
+ {
+ this(new ArrayList<AMQMethodBody>());
+ }
+
+ TestReplayManager(List<AMQMethodBody> msgs)
+ {
+ _msgs = msgs;
+ }
+
+ public List<AMQMethodBody> replay(boolean isLeader)
+ {
+ return _msgs;
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestReplayManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestSession.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestSession.java (added)
+++ incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestSession.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,261 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.server.cluster;
+
+import org.apache.mina.common.*;
+
+import java.net.SocketAddress;
+import java.util.Set;
+
+class TestSession implements IoSession
+{
+ public IoService getService()
+ {
+ return null; //TODO
+ }
+
+ public IoHandler getHandler()
+ {
+ return null; //TODO
+ }
+
+ public IoSessionConfig getConfig()
+ {
+ return null; //TODO
+ }
+
+ public IoFilterChain getFilterChain()
+ {
+ return null; //TODO
+ }
+
+ public WriteFuture write(Object message)
+ {
+ return null; //TODO
+ }
+
+ public CloseFuture close()
+ {
+ return null; //TODO
+ }
+
+ public Object getAttachment()
+ {
+ return null; //TODO
+ }
+
+ public Object setAttachment(Object attachment)
+ {
+ return null; //TODO
+ }
+
+ public Object getAttribute(String key)
+ {
+ return null; //TODO
+ }
+
+ public Object setAttribute(String key, Object value)
+ {
+ return null; //TODO
+ }
+
+ public Object setAttribute(String key)
+ {
+ return null; //TODO
+ }
+
+ public Object removeAttribute(String key)
+ {
+ return null; //TODO
+ }
+
+ public boolean containsAttribute(String key)
+ {
+ return false; //TODO
+ }
+
+ public Set getAttributeKeys()
+ {
+ return null; //TODO
+ }
+
+ public TransportType getTransportType()
+ {
+ return null; //TODO
+ }
+
+ public boolean isConnected()
+ {
+ return false; //TODO
+ }
+
+ public boolean isClosing()
+ {
+ return false; //TODO
+ }
+
+ public CloseFuture getCloseFuture()
+ {
+ return null; //TODO
+ }
+
+ public SocketAddress getRemoteAddress()
+ {
+ return null; //TODO
+ }
+
+ public SocketAddress getLocalAddress()
+ {
+ return null; //TODO
+ }
+
+ public SocketAddress getServiceAddress()
+ {
+ return null; //TODO
+ }
+
+ public int getIdleTime(IdleStatus status)
+ {
+ return 0; //TODO
+ }
+
+ public long getIdleTimeInMillis(IdleStatus status)
+ {
+ return 0; //TODO
+ }
+
+ public void setIdleTime(IdleStatus status, int idleTime)
+ {
+ //TODO
+ }
+
+ public int getWriteTimeout()
+ {
+ return 0; //TODO
+ }
+
+ public long getWriteTimeoutInMillis()
+ {
+ return 0; //TODO
+ }
+
+ public void setWriteTimeout(int writeTimeout)
+ {
+ //TODO
+ }
+
+ public TrafficMask getTrafficMask()
+ {
+ return null; //TODO
+ }
+
+ public void setTrafficMask(TrafficMask trafficMask)
+ {
+ //TODO
+ }
+
+ public void suspendRead()
+ {
+ //TODO
+ }
+
+ public void suspendWrite()
+ {
+ //TODO
+ }
+
+ public void resumeRead()
+ {
+ //TODO
+ }
+
+ public void resumeWrite()
+ {
+ //TODO
+ }
+
+ public long getReadBytes()
+ {
+ return 0; //TODO
+ }
+
+ public long getWrittenBytes()
+ {
+ return 0; //TODO
+ }
+
+ public long getReadMessages()
+ {
+ return 0;
+ }
+
+ public long getWrittenMessages()
+ {
+ return 0;
+ }
+
+ public long getWrittenWriteRequests()
+ {
+ return 0; //TODO
+ }
+
+ public int getScheduledWriteRequests()
+ {
+ return 0; //TODO
+ }
+
+ public int getScheduledWriteBytes()
+ {
+ return 0; //TODO
+ }
+
+ public long getCreationTime()
+ {
+ return 0; //TODO
+ }
+
+ public long getLastIoTime()
+ {
+ return 0; //TODO
+ }
+
+ public long getLastReadTime()
+ {
+ return 0; //TODO
+ }
+
+ public long getLastWriteTime()
+ {
+ return 0; //TODO
+ }
+
+ public boolean isIdle(IdleStatus status)
+ {
+ return false; //TODO
+ }
+
+ public int getIdleCount(IdleStatus status)
+ {
+ return 0; //TODO
+ }
+
+ public long getLastIdleTime(IdleStatus status)
+ {
+ return 0; //TODO
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/cluster/test/org/apache/qpid/server/cluster/TestSession.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common.xml?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common.xml (added)
+++ incubator/qpid/trunk/qpid/java/common.xml Tue Sep 19 15:06:50 2006
@@ -0,0 +1,72 @@
+<!--
+ -
+ - Copyright (c) 2006 The Apache Software Foundation
+ -
+ - Licensed under the Apache License, Version 2.0 (the "License");
+ - you may not use this file except in compliance with the License.
+ - You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing, software
+ - distributed under the License is distributed on an "AS IS" BASIS,
+ - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ - See the License for the specific language governing permissions and
+ - limitations under the License.
+ -
+ -->
+<project name="common">
+
+ <dirname property="project.root" file="${ant.file.common}"/>
+ <property name="project.name" value="qpid"/>
+ <property name="project.version" value="0.9"/>
+ <property name="project.namever" value="${project.name}-${project.version}"/>
+ <property name="client.namever" value="${project.name}-client-${project.version}"/>
+ <property name="build.dir" value="${project.root}/build"/>
+ <!-- <property name="amqp.xml" location="${project.root}/../specs/amqp-8.0.xml"/> -->
+
+ <property name="classes.dir" value="classes"/>
+ <property name="src.dir" value="src"/>
+ <property name="lib.dir" value="lib"/>
+ <property name="doc.dir" value="doc"/>
+ <property name="etc.dir" value="etc"/>
+ <property name="bin.dir" value="bin"/>
+ <property name="src.bin" value="${bin.dir}"/>
+ <property name="launcher.sfx" value="-launch.jar"/>
+
+ <property name="dist.root" value="${build.dir}/dist"/>
+ <property name="dist.dir" value="${dist.root}/${project.namever}"/>
+ <property name="dist.client.dir" value="${dist.dir}/client"/>
+ <property name="dist.bin" value="${dist.dir}/${bin.dir}"/>
+ <property name="dist.lib" value="${dist.dir}/${lib.dir}"/>
+ <property name="dist.doc" value="${dist.dir}/${doc.dir}"/>
+ <property name="dist.etc" value="${dist.dir}/${etc.dir}"/>
+
+ <property name="build.zip" value="${build.dir}/${project.namever}.zip"/>
+ <property name="build.tar" value="${build.dir}/${project.namever}.tar"/>
+ <property name="build.tgz" value="${build.dir}/${project.namever}.tar.gz"/>
+ <property name="build.bz2" value="${build.dir}/${project.namever}.tar.bz2"/>
+
+ <property name="client.zip" value="${build.dir}/${client.namever}.zip"/>
+ <property name="client.tar" value="${build.dir}/${client.namever}.tar"/>
+ <property name="client.tgz" value="${build.dir}/${client.namever}.tar.gz"/>
+ <property name="client.bz2" value="${build.dir}/${client.namever}.tar.bz2"/>
+
+ <property name="java.target" value="1.5"/>
+ <property name="java.source" value="1.5"/>
+
+ <property name="tasks.dir" value="${project.root}/tasks"/>
+ <property name="tasks.classes" value="${tasks.dir}/classes"/>
+ <property name="tasks.src" value="${tasks.dir}/src"/>
+
+ <mkdir dir="${tasks.classes}"/>
+ <javac srcdir="${tasks.src}" destdir="${tasks.classes}"
+ classpath="${java.class.path}"/>
+ <taskdef name="map" classname="org.apache.qpid.tasks.Map"
+ classpath="${tasks.classes}"/>
+
+ <target name="clean-tasks">
+ <delete dir="${tasks.classes}"/>
+ </target>
+
+</project>
Propchange: incubator/qpid/trunk/qpid/java/common.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/bin/qpid-run
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/bin/qpid-run?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/bin/qpid-run (added)
+++ incubator/qpid/trunk/qpid/java/common/bin/qpid-run Tue Sep 19 15:06:50 2006
@@ -0,0 +1,176 @@
+#!/bin/bash
+#
+# Copyright (c) 2006 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+die() {
+ if [[ $1 = -usage ]]; then
+ shift
+ usage=true
+ else
+ usage=false
+ fi
+ echo "$@"
+ $usage && echo
+ $usage && usage
+ exit 1
+}
+
+if [ -z "$QPID_HOME" ]; then
+ die "QPID_HOME must be set"
+fi
+
+program=$(basename $0)
+sourced=${BASH_SOURCE[0]}
+if [[ -z ${sourced:-''} ]]; then
+ sourced=$(which qpid-run) || ${QPID_HOME}/bin/qpid-run
+fi
+
+usage() {
+ echo Usage: $program ... "[-run:<option>]" ...
+ echo
+ echo Options:
+ egrep -B 1 "^\s*#USAGE: " ${sourced} |\
+ sed "s/#USAGE:/ /" |\
+ sed "s/-run:\(.*\))/-run:\1/" |\
+ sed "s/-run:\(.*\)=\*/-run:\1=<value>/" |\
+ sed "s/^--$//"
+}
+
+cygwin=false
+if [[ "$(uname -a | fgrep Cygwin)" != "" ]]; then
+ cygwin=true
+fi
+
+export EXTERNAL_CLASSPATH=$CLASSPATH
+unset CLASSPATH
+
+conf=$QPID_HOME/etc/$program.conf
+if [ ! -e $conf ]; then
+ conf=$QPID_HOME/etc/$(basename ${sourced}).conf
+fi
+
+if [ -r $conf ]; then
+ . $conf
+else
+ die "unable to source $conf"
+fi
+
+declare -a RUN_ARGS JAVA_ARGS
+for arg in "$@"; do
+ if [[ $arg == -run:* ]]; then
+ RUN_ARGS[${#RUN_ARGS[@]}]="$arg"
+ else
+ JAVA_ARGS[${#JAVA_ARGS[@]}]="$arg"
+ fi
+done
+
+# this defines the default behavior, it may be modified during option
+# processing below
+DISPATCH() {
+ if $debug; then
+ echo "CLASSPATH=${CLASSPATH}"
+ echo "${COMMAND[@]}"
+ fi
+
+ exec "${COMMAND[@]}"
+}
+
+exclusive() {
+ if [ -z "$PREVIOUS_ARGS" ]; then
+ PREVIOUS_ARGS=$1
+ else
+ PREVIOUS_ARGS+=", $1"
+ DISPATCH() {
+ die -usage "you must choose one of: $PREVIOUS_ARGS"
+ }
+ fi
+}
+
+debug=false
+
+for arg in "${RUN_ARGS[@]}"; do
+ case $arg in
+ -run:debug)
+#USAGE: print the classpath and command before running it
+ debug=true
+ ;;
+ -run:jpda)
+#USAGE: adds debugging options to the java command, use
+#USAGE: JDPA_TRANSPORT and JPDA_ADDRESS to customize the debugging
+#USAGE: behavior and use JPDA_OPTS to override it entirely
+ if [ -z "$JPDA_OPTS" ]; then
+ JPDA_OPTS="-Xdebug -Xrunjdwp:transport=${JPDA_TRANSPORT:-dt_socket},address=${JPDA_ADDRESS:-8000},server=y,suspend=n"
+ fi
+ QPID_OPTS+=" ${JPDA_OPTS}"
+ ;;
+ -run:external-classpath=*)
+#USAGE: controls how the CLASSPATH environment variable is used by
+#USAGE: this script, value can be one of ignore (the default), first,
+#USAGE: last, and only
+ case $arg in
+ *=ignore)
+ # do nothing
+ ;;
+ *=first)
+ CLASSPATH=$EXTERNAL_CLASSPATH:$CLASSPATH
+ ;;
+ *=last)
+ CLASSPATH=$CLASSPATH:$EXTERNAL_CLASSPATH
+ ;;
+ *=only)
+ CLASSPATH=$EXTERNAL_CLASSPATH
+ ;;
+ *)
+ die -usage $(echo $arg | sed "s/=/: invalid value '/")\'
+ ;;
+ esac
+ ;;
+ -run:print-classpath)
+#USAGE: print the classpath
+ DISPATCH() {
+ echo $CLASSPATH
+ }
+ exclusive $arg
+ ;;
+ -run:print-command)
+#USAGE: print the command
+ DISPATCH() {
+ echo "${COMMAND[@]}"
+ }
+ exclusive $arg
+ ;;
+ -run:help)
+#USAGE: print this message
+ DISPATCH() {
+ usage
+ }
+ exclusive $arg
+ ;;
+ *)
+ die -usage "unrecognized -run option '$arg'"
+ ;;
+ esac
+done
+
+if $cygwin; then
+ QPID_HOME=$(cygpath -w $QPID_HOME)
+ CLASSPATH=$(cygpath -w -p $CLASSPATH)
+ JAVA=$(cygpath -u $JAVA)
+fi
+
+COMMAND=($JAVA $JAVA_VM $JAVA_MEM -DQPID_HOME=$QPID_HOME $JAVA_OPTS $QPID_OPTS "${JAVA_ARGS[@]}")
+
+DISPATCH
Added: incubator/qpid/trunk/qpid/java/common/build-module.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/build-module.xml?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/build-module.xml (added)
+++ incubator/qpid/trunk/qpid/java/common/build-module.xml Tue Sep 19 15:06:50 2006
@@ -0,0 +1,129 @@
+<!--
+ -
+ - Copyright (c) 2006 The Apache Software Foundation
+ -
+ - Licensed under the Apache License, Version 2.0 (the "License");
+ - you may not use this file except in compliance with the License.
+ - You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing, software
+ - distributed under the License is distributed on an "AS IS" BASIS,
+ - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ - See the License for the specific language governing permissions and
+ - limitations under the License.
+ -
+ -->
+<project name="AMQ Common" default="build">
+
+ <import file="../module.xml"/>
+
+ <property name="cluster.asl" value="resources/cluster.asl"/>
+ <property name="stylesheet" value="stylesheets/framing.xsl"/>
+ <property name="registry_stylesheet" value="stylesheets/registry.xsl"/>
+ <property name="registry_template" value="resources/registry.template"/>
+ <property name="saxon.jar" value="lib/saxon/saxon8.jar"/>
+ <property name="generated.package" value="org/apache/qpid/framing"/>
+ <property name="generated.dir" value="${module.precompiled}/${generated.package}"/>
+ <property name="proto_version" value="${generated.dir}/ProtocolVersionList.java"/>
+
+ <macrodef name="saxon">
+ <attribute name="out"/>
+ <attribute name="src"/>
+ <attribute name="xsl"/>
+ <element name="args" implicit="true" optional="true"/>
+ <sequential>
+ <java jar="${saxon.jar}" fork="true">
+ <arg value="-o"/>
+ <arg value="@{out}"/>
+ <arg value="@{src}"/>
+ <arg value="@{xsl}"/>
+ <args/>
+ </java>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="amqp">
+ <attribute name="ver"/>
+ <sequential>
+ <!-- Check for the existence of the AMQP specification file -->
+ <property name="amqpspecfile-@{ver}" value="${project.root}/../specs/amqp-@{ver}.xml"/>
+ <available file="${project.root}/../specs/amqp-@{ver}.xml"
+ property="amqpspecfile.present-@{ver}"/>
+ <fail unless="amqpspecfile.present-@{ver}"
+ message="ERROR: AMQP specification file ${project.root}/../specs/amqp-@{ver}.xml not found."/>
+
+ <!-- Read in the file as a set of properties; extract the amqp version -->
+ <xmlproperty prefix="@{ver}" file="${project.root}/../specs/amqp-@{ver}.xml"/>
+ <echo>Found AMQP specification file "${project.root}/../specs/amqp-@{ver}.xml"; major=${@{ver}.amqp(major)} minor=${@{ver}.amqp(minor)}</echo>
+
+ <!-- Add the version to the ProtocolVersionList.java file -->
+ <replaceregexp file="${proto_version}" match=" // !VER!"
+ replace=",${line.separator} {${@{ver}.amqp(major)}, ${@{ver}.amqp(minor)}} // !VER!"
+ flags="s" byline="true"/>
+ <replaceregexp file="${proto_version}" match=" // !VER1!"
+ replace="{${@{ver}.amqp(major)}, ${@{ver}.amqp(minor)}} // !VER!"
+ flags="s" byline="true"/>
+
+ <!-- Create directory; generate from specification file -->
+ <mkdir dir="${generated.dir}_${@{ver}.amqp(major)}_${@{ver}.amqp(minor)}"/>
+ <saxon out="${generated.dir}_${@{ver}.amqp(major)}_${@{ver}.amqp(minor)}/results.out"
+ src="${project.root}/../specs/amqp-@{ver}.xml"
+ xsl="${stylesheet}">
+ <arg value="major=${@{ver}.amqp(major)}"/>
+ <arg value="minor=${@{ver}.amqp(minor)}"/>
+ <arg value="registry_name=MainRegistry"/>
+ </saxon>
+ <!-- -->
+ <saxon out="${generated.dir}_${@{ver}.amqp(major)}_${@{ver}.amqp(minor)}/cluster.out"
+ src="${cluster.asl}"
+ xsl="${stylesheet}">
+ <arg value="major=${@{ver}.amqp(major)}"/>
+ <arg value="minor=${@{ver}.amqp(minor)}"/>
+ <arg value="registry_name=ClusterRegistry"/>
+ </saxon>
+ <saxon out="${generated.dir}_${@{ver}.amqp(major)}_${@{ver}.amqp(minor)}/registry.out"
+ src="${registry_template}"
+ xsl="${registry_stylesheet}">
+ <arg value="major=${@{ver}.amqp(major)}"/>
+ <arg value="minor=${@{ver}.amqp(minor)}"/>
+ </saxon>
+ </sequential>
+ </macrodef>
+
+<!-- <uptodate property="generated" targetfile="${generated.dir}/results.out"
+ srcfile="${amqp.xml}"/> -->
+
+<!-- <target name="generate" unless="generated"> -->
+ <target name="generate">
+ <mkdir dir="${generated.dir}"/>
+ <copy file="resources/ProtocolVersionList.java" tofile="${proto_version}"
+ overwrite="true"/>
+ <!--
+ NOTE: Set the AMQP version numbers to be supported in this build here.
+ The last version in this list will be the version returned when a protocol
+ ProtocolInitiation NAK frame is returned by the broker. Usually this is the
+ highest or most recent version.
+ -->
+ <!-- <amqp ver="0.8"/>
+ <amqp ver="0.9"/>
+ <amqp ver="0.10"/> -->
+ <amqp ver="8.0"/>
+
+<!-- <saxon out="${generated.dir}/results.out" src="${amqp.xml}"
+ xsl="${stylesheet}">
+ <arg value="asl_base=${asl.base}"/>
+ <arg value="registry_name=MainRegistry"/>
+ </saxon>
+ <saxon out="${generated.dir}/cluster.out" src="${cluster.asl}"
+ xsl="${stylesheet}">
+ <arg value="registry_name=ClusterRegistry"/>
+ </saxon>
+ <saxon out="${generated.dir}/registry.out" src="${registry_template}"
+ xsl="${registry_stylesheet}"/> -->
+ </target>
+
+ <target name="precompile" depends="generate"/>
+
+</project>
Propchange: incubator/qpid/trunk/qpid/java/common/build-module.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/build-old.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/build-old.xml?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/build-old.xml (added)
+++ incubator/qpid/trunk/qpid/java/common/build-old.xml Tue Sep 19 15:06:50 2006
@@ -0,0 +1,98 @@
+<!--
+ -
+ - Copyright (c) 2006 The Apache Software Foundation
+ -
+ - Licensed under the Apache License, Version 2.0 (the "License");
+ - you may not use this file except in compliance with the License.
+ - You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing, software
+ - distributed under the License is distributed on an "AS IS" BASIS,
+ - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ - See the License for the specific language governing permissions and
+ - limitations under the License.
+ -
+ -->
+<project name="AMQ Java Framing Layer" default="build">
+ <property name="amq.home" value="../.."/>
+ <path id="amq.home.path">
+ <pathelement location="${amq.home}"/>
+ </path>
+
+ <pathconvert targetos="unix" property="amq.home.fixed" refid="amq.home.path"/>
+
+ <property name="amq.asl" value="${amq.home.fixed}/specs/amqp.xml"/>
+ <property name="cluster.asl" value="resources/cluster.asl"/>
+
+ <property name="stylesheet" value="stylesheets/framing.xsl"/>
+ <property name="registry_stylesheet" value="stylesheets/registry.xsl"/>
+ <property name="registry_template" value="resources/registry.template"/>
+ <property name="saxon.jar" value="lib/saxon/saxon8.jar"/>
+ <property name="generated.src" value="generated/java/org.apache.qpid/framing"/>
+ <property name="static.src" value="src"/>
+ <property name="resources" value="resources"/>
+ <property name="base.lib" value="lib"/>
+
+ <path id="project.classpath">
+ <fileset dir="${base.lib}">
+ <include name="**/*.jar"/>
+ </fileset>
+ </path>
+
+ <target name="prepare">
+ <mkdir dir="classes"/>
+ </target>
+
+ <target name="build" depends="regenerate, compile" description="re-generates and compiles static and generated source after cleaning">
+ </target>
+
+ <target name="compile" depends="prepare" description="compiles static and generated source">
+ <javac destdir="classes" debug="true" deprecation="true" source="1.5">
+ <src path="${generated.src}"/>
+ <src path="${static.src}"/>
+ <classpath refid="project.classpath"/>
+ </javac>
+ </target>
+
+ <target name="regenerate" depends="clean, generate" description="generates code">
+ </target>
+
+ <target name="check-generate">
+ <uptodate property="generateNotRequired" targetfile="${generated.src}/results.out" srcfile="${amq.asl}"/>
+ </target>
+
+ <target name="generate" depends="check-generate" unless="${generateNotRequired}" description="generates code">
+ <mkdir dir="${generated.src}"/>
+ <java jar="${saxon.jar}" fork="true">
+ <arg value="-o"/>
+ <arg value="${generated.src}/results.out"/>
+ <arg value="${amq.asl}"/>
+ <arg value="${stylesheet}"/>
+ <arg value="asl_base=${asl.base}"/>
+ <arg value="registry_name=MainRegistry"/>
+ </java>
+ <java jar="${saxon.jar}" fork="true">
+ <arg value="-o"/>
+ <arg value="${generated.src}/cluster.out"/>
+ <arg value="${cluster.asl}"/>
+ <arg value="${stylesheet}"/>
+ <arg value="registry_name=ClusterRegistry"/>
+ </java>
+ <java jar="${saxon.jar}" fork="true">
+ <arg value="-o"/>
+ <arg value="${generated.src}/registry.out"/>
+ <arg value="${registry_template}"/>
+ <arg value="${registry_stylesheet}"/>
+ </java>
+ </target>
+
+ <target name="clean" depends="prepare" description="deletes any products of the compile and generate tasks">
+ <delete quiet="true">
+ <fileset dir="classes" includes="**/*"/>
+ <fileset dir="${generated.src}" includes="**/*"/>
+ </delete>
+ <mkdir dir="${generated.src}"/>
+ </target>
+</project>
Propchange: incubator/qpid/trunk/qpid/java/common/build-old.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/etc/qpid-run.conf
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/etc/qpid-run.conf?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/etc/qpid-run.conf (added)
+++ incubator/qpid/trunk/qpid/java/common/etc/qpid-run.conf Tue Sep 19 15:06:50 2006
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2006 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+BLAZE_LIBS=$(find ${BLAZE_HOME}/lib -name "*.jar" -print | sed -e :a -e '$!N;s/\n/:/;ta' -e 'P;D')
+
+export JAVA=java \
+ JAVA_VM=-server \
+ JAVA_MEM=-Xmx1024m \
+ CLASSPATH=$BLAZE_LIBS
Added: incubator/qpid/trunk/qpid/java/common/etc/qpid-run.conf.dev
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/etc/qpid-run.conf.dev?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/etc/qpid-run.conf.dev (added)
+++ incubator/qpid/trunk/qpid/java/common/etc/qpid-run.conf.dev Tue Sep 19 15:06:50 2006
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2006 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+QPID_LIBS=$(find ${QPID_HOME} -type d -name "classes" -print | sed -e :a -e '$!N;s/\n/:/;ta' -e 'P;D')
+QPID_LIBS=${QPID_LIBS}:$(find $(dirname ${QPID_HOME}) -name "*.jar" -print | sed -e :a -e '$!N;s/\n/:/;ta' -e 'P;D')
+
+export JAVA=java \
+ JAVA_VM=-server \
+ JAVA_MEM=-Xmx1024m \
+ CLASSPATH=$QPID_LIBS
Added: incubator/qpid/trunk/qpid/java/common/lib/commons-cli/commons-cli-1.0.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/commons-cli/commons-cli-1.0.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/commons-cli/commons-cli-1.0.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/commons-collections/commons-collections-3.1.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/commons-collections/commons-collections-3.1.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/commons-collections/commons-collections-3.1.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/commons-configuration/commons-configuration-1.2.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/commons-configuration/commons-configuration-1.2.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/commons-configuration/commons-configuration-1.2.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/commons-lang/commons-lang-2.1.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/commons-lang/commons-lang-2.1.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/commons-lang/commons-lang-2.1.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/commons-logging/commons-logging-api.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/commons-logging/commons-logging-api.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/commons-logging/commons-logging-api.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/commons-logging/commons-logging.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/commons-logging/commons-logging.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/commons-logging/commons-logging.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/junit/junit-4.0.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/junit/junit-4.0.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/junit/junit-4.0.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/junit/junit.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/junit/junit.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/junit/junit.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/logging-log4j/log4j-1.2.13.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/logging-log4j/log4j-1.2.13.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/logging-log4j/log4j-1.2.13.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/mina/mina-core-0.9.5-SNAPSHOT.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/mina/mina-core-0.9.5-SNAPSHOT.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/mina/mina-core-0.9.5-SNAPSHOT.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/mina/mina-filter-ssl-0.9.5-SNAPSHOT.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/mina/mina-filter-ssl-0.9.5-SNAPSHOT.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/mina/mina-filter-ssl-0.9.5-SNAPSHOT.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/saxon/saxon8.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/saxon/saxon8.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/saxon/saxon8.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/lib/slf4j/slf4j-simple.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/lib/slf4j/slf4j-simple.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/lib/slf4j/slf4j-simple.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/readme.txt
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/readme.txt?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/readme.txt (added)
+++ incubator/qpid/trunk/qpid/java/common/readme.txt Tue Sep 19 15:06:50 2006
@@ -0,0 +1,4 @@
+AMQP Common Java API
+
+Common generated functionality for AMQP Java client and broker. See the
+readme in the client and broker directories.
Propchange: incubator/qpid/trunk/qpid/java/common/readme.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/resources/ProtocolVersionList.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/resources/ProtocolVersionList.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/resources/ProtocolVersionList.java (added)
+++ incubator/qpid/trunk/qpid/java/common/resources/ProtocolVersionList.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * This class is autogenerated, do not modify.
+ */
+
+package org.apache.qpid.framing;
+
+/**
+ * NOTE: Don't remove the line containing the token VER or VER1 - these are
+ * markers for code generation.
+ */
+
+public interface ProtocolVersionList
+{
+ public final int PROTOCOL_MAJOR = 0;
+ public final int PROTOCOL_MINOR = 1;
+ public final byte pv[][] = {
+ // !VER1!
+ };
+}
Propchange: incubator/qpid/trunk/qpid/java/common/resources/ProtocolVersionList.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/resources/cluster.asl
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/resources/cluster.asl?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/resources/cluster.asl (added)
+++ incubator/qpid/trunk/qpid/java/common/resources/cluster.asl Tue Sep 19 15:06:50 2006
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<!--
+ -
+ - Copyright (c) 2006 The Apache Software Foundation
+ -
+ - Licensed under the Apache License, Version 2.0 (the "License");
+ - you may not use this file except in compliance with the License.
+ - You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing, software
+ - distributed under the License is distributed on an "AS IS" BASIS,
+ - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ - See the License for the specific language governing permissions and
+ - limitations under the License.
+ -
+ -->
+
+<amqp major="8" minor="0" port="5672" comment="AMQ protocol 0.80">
+
+<class name = "cluster" index = "101">
+
+<doc>
+ An extension that allows brokers to communicate in order to
+ provide a clustered service to clients.
+</doc>
+
+<method name = "join">
+ <field name = "broker" type = "shortstr" />
+</method>
+
+<method name = "membership">
+ <field name = "members" type = "longstr" />
+</method>
+
+<method name = "synch">
+</method>
+
+<method name = "leave">
+ <field name = "broker" type = "shortstr" />
+</method>
+
+<method name = "suspect">
+ <field name = "broker" type = "shortstr" />
+</method>
+
+<method name = "ping">
+ <field name = "broker" type = "shortstr" />
+ <field name = "load" type = "long" />
+ <field name = "response required" type = "bit" />
+</method>
+
+</class>
+
+</amqp>
Propchange: incubator/qpid/trunk/qpid/java/common/resources/cluster.asl
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/resources/org/apache/qpid/ssl/qpid.cert
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/resources/org/apache/qpid/ssl/qpid.cert?view=auto&rev=447994
==============================================================================
Binary file - no diff available.
Propchange: incubator/qpid/trunk/qpid/java/common/resources/org/apache/qpid/ssl/qpid.cert
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/qpid/trunk/qpid/java/common/resources/registry.template
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/resources/registry.template?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/resources/registry.template (added)
+++ incubator/qpid/trunk/qpid/java/common/resources/registry.template Tue Sep 19 15:06:50 2006
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+ -
+ - Copyright (c) 2006 The Apache Software Foundation
+ -
+ - Licensed under the Apache License, Version 2.0 (the "License");
+ - you may not use this file except in compliance with the License.
+ - You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing, software
+ - distributed under the License is distributed on an "AS IS" BASIS,
+ - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ - See the License for the specific language governing permissions and
+ - limitations under the License.
+ -
+ -->
+<registries>
+ <registry name="MainRegistry"/>
+ <registry name="ClusterRegistry"/>
+</registries>
Propchange: incubator/qpid/trunk/qpid/java/common/resources/registry.template
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQChannelClosedException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQChannelClosedException.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQChannelClosedException.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQChannelClosedException.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,31 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid;
+
+/**
+ * AMQ channel closed exception.
+ */
+public class AMQChannelClosedException extends AMQException
+{
+ public AMQChannelClosedException(int errorCode, String msg)
+ {
+ super(errorCode, msg);
+ }
+}
+
+
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQChannelClosedException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQChannelException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQChannelException.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQChannelException.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQChannelException.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,46 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid;
+
+import org.apache.qpid.framing.ChannelCloseBody;
+import org.apache.qpid.framing.AMQFrame;
+
+public class AMQChannelException extends AMQException
+{
+ private final int _classId;
+ private final int _methodId;
+
+ public AMQChannelException(int errorCode, String msg, int classId, int methodId, Throwable t)
+ {
+ super(errorCode, msg, t);
+ _classId = classId;
+ _methodId = methodId;
+ }
+
+ public AMQChannelException(int errorCode, String msg, int classId, int methodId)
+ {
+ super(errorCode, msg);
+ _classId = classId;
+ _methodId = methodId;
+ }
+
+ public AMQFrame getCloseFrame(int channel)
+ {
+ return ChannelCloseBody.createAMQFrame(channel, getErrorCode(), getMessage(), _classId, _methodId);
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQChannelException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQConnectionClosedException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQConnectionClosedException.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQConnectionClosedException.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQConnectionClosedException.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,31 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid;
+
+/**
+ * AMQ channel closed exception.
+ */
+public class AMQConnectionClosedException extends AMQException
+{
+ public AMQConnectionClosedException(int errorCode, String msg)
+ {
+ super(errorCode, msg);
+ }
+}
+
+
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQConnectionClosedException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQConnectionException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQConnectionException.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQConnectionException.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQConnectionException.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,27 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.qpid;
+
+public class AMQConnectionException extends AMQException
+{
+ public AMQConnectionException(String message)
+ {
+ super(message);
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQConnectionException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQDisconnectedException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQDisconnectedException.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQDisconnectedException.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQDisconnectedException.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,31 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid;
+
+/**
+ * AMQ disconnected exception.
+ */
+public class AMQDisconnectedException extends AMQException
+{
+ public AMQDisconnectedException(String msg)
+ {
+ super(msg);
+ }
+}
+
+
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQDisconnectedException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQException.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQException.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQException.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,74 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Generic AMQ exception.
+ */
+public class AMQException extends Exception
+{
+ private int _errorCode;
+
+ public AMQException(String message)
+ {
+ super(message);
+ }
+
+ public AMQException(String msg, Throwable t)
+ {
+ super(msg, t);
+ }
+
+ public AMQException(int errorCode, String msg, Throwable t)
+ {
+ super(msg + " [error code " + errorCode + ']', t);
+ _errorCode = errorCode;
+ }
+
+ public AMQException(int errorCode, String msg)
+ {
+ super(msg + " [error code " + errorCode + ']');
+ _errorCode = errorCode;
+ }
+
+ public AMQException(Logger logger, String msg, Throwable t)
+ {
+ this(msg, t);
+ logger.error(getMessage(), this);
+ }
+
+ public AMQException(Logger logger, String msg)
+ {
+ this(msg);
+ logger.error(getMessage(), this);
+ }
+
+ public AMQException(Logger logger, int errorCode, String msg)
+ {
+ this(errorCode, msg);
+ logger.error(getMessage(), this);
+ }
+
+ public int getErrorCode()
+ {
+ return _errorCode;
+ }
+
+}
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQUndeliveredException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQUndeliveredException.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQUndeliveredException.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQUndeliveredException.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,41 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid;
+
+/**
+ * Generic AMQ exception.
+ */
+public class AMQUndeliveredException extends AMQException
+{
+ private Object _bounced;
+
+ public AMQUndeliveredException(int errorCode, String msg, Object bounced)
+ {
+ super(errorCode, msg);
+
+ _bounced = bounced;
+ }
+
+ public Object getUndeliveredMessage()
+ {
+ return _bounced;
+ }
+
+}
+
+
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQUndeliveredException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQUnresolvedAddressException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQUnresolvedAddressException.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQUnresolvedAddressException.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQUnresolvedAddressException.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,26 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid;
+
+public class AMQUnresolvedAddressException extends AMQException
+{
+ public AMQUnresolvedAddressException(String message)
+ {
+ super(message);
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/AMQUnresolvedAddressException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/Reader.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/Reader.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/Reader.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/Reader.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,98 @@
+/*
+ * @(#) $Id: SocketSessionImpl.java 398039 2006-04-28 23:36:27Z proyal $
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.bio;
+
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoHandler;
+
+import java.io.IOException;
+import java.nio.channels.ByteChannel;
+import java.nio.channels.ClosedByInterruptException;
+
+class Reader implements Runnable
+{
+ private final IoHandler handler;
+ private final SocketSessionImpl session;
+ private final ByteChannel channel;
+ private volatile boolean stopped;
+
+ Reader(IoHandler handler, SocketSessionImpl session)
+ {
+ this.handler = handler;
+ this.session = session;
+ channel = session.getChannel();
+ }
+
+ void stop()
+ {
+ stopped = true;
+ }
+
+ public void run()
+ {
+ while (!stopped)
+ {
+ try
+ {
+ ByteBuffer buffer = ByteBuffer.allocate(session.getReadBufferSize());
+ int read = channel.read(buffer.buf());
+ if(read > 0)
+ {
+ buffer.flip();
+ ((SocketFilterChain) session.getFilterChain()).messageReceived(session, buffer);
+ }
+ else
+ {
+ stopped = true;
+ }
+ }
+ catch (ClosedByInterruptException e)
+ {
+ stopped = true;
+ }
+ catch (IOException e)
+ {
+ if (!stopped)
+ {
+ signalException(e);
+ session.close();
+ }
+ }
+ catch (Exception e)
+ {
+ if (!stopped)
+ {
+ signalException(e);
+ }
+ }
+ }
+ }
+
+ private void signalException(Exception e)
+ {
+ try
+ {
+ handler.exceptionCaught(session, e);
+ }
+ catch (Exception e2)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/Reader.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/Sequence.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/Sequence.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/Sequence.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/Sequence.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,29 @@
+/*
+ * @(#) $Id: SocketSessionImpl.java 398039 2006-04-28 23:36:27Z proyal $
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.bio;
+
+class Sequence
+{
+ private int nextId = 0;
+
+ synchronized int nextId()
+ {
+ return nextId++;
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/Sequence.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/SimpleSocketChannel.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/SimpleSocketChannel.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/SimpleSocketChannel.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/SimpleSocketChannel.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,82 @@
+/*
+ * @(#) $Id: SocketSessionImpl.java 398039 2006-04-28 23:36:27Z proyal $
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.bio;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.nio.ByteBuffer;
+import java.nio.channels.ByteChannel;
+
+/**
+ * A simpler alternative to the non-blocking enabled SocketChannel for
+ * use with blocking io only. Not threadsafe.
+ */
+class SimpleSocketChannel implements ByteChannel
+{
+ private final Socket socket;
+ private final OutputStream out;
+ private final InputStream in;
+ private final byte[] buffer = new byte[2048];
+
+ SimpleSocketChannel(Socket socket) throws IOException
+ {
+ this.socket = socket;
+ out = socket.getOutputStream();
+ in = socket.getInputStream();
+ }
+
+ Socket socket()
+ {
+ return socket;
+ }
+
+ public int read(ByteBuffer dst) throws IOException
+ {
+ if (dst == null)
+ {
+ throw new NullPointerException("Null buffer passed into read");
+ }
+ int read = in.read(buffer, 0, Math.min(buffer.length, dst.limit() - dst.position()));
+ if (read > 0)
+ {
+ dst.put(buffer, 0, read);
+ }
+ return read;
+ }
+
+ public int write(ByteBuffer dst) throws IOException
+ {
+ byte[] data = new byte[dst.remaining()];
+ dst.get(data);
+ out.write(data);
+ return data.length;
+ }
+
+ public boolean isOpen()
+ {
+ return socket.isConnected();
+ }
+
+ public void close() throws IOException
+ {
+ socket.close();
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/SimpleSocketChannel.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/SocketAcceptor.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/SocketAcceptor.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/SocketAcceptor.java (added)
+++ incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/SocketAcceptor.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,277 @@
+/*
+ * @(#) $Id: SocketAcceptor.java 389042 2006-03-27 07:49:41Z trustin $
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.qpid.bio;
+
+import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoServiceConfig;
+import org.apache.mina.common.support.BaseIoAcceptor;
+import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
+import org.apache.mina.transport.socket.nio.SocketSessionConfig;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.nio.channels.ByteChannel;
+import java.nio.channels.ServerSocketChannel;
+import java.util.*;
+
+/**
+ */
+public class SocketAcceptor extends BaseIoAcceptor
+{
+ private static final Sequence acceptorSeq = new Sequence();
+
+ private final int id = acceptorSeq.nextId();
+ private final String threadName = "SocketAcceptor-" + id;
+ private final IoServiceConfig defaultConfig = new SocketAcceptorConfig();
+ private final Map services = new HashMap();//SocketAddress => SocketBinding
+
+ public SocketAcceptor()
+ {
+ }
+
+ /**
+ * Binds to the specified <code>address</code> and handles incoming connections with the specified
+ * <code>handler</code>. Backlog value is configured to the value of <code>backlog</code> property.
+ *
+ * @throws IOException if failed to bind
+ */
+ public void bind(SocketAddress address, IoHandler handler, IoServiceConfig config) throws IOException
+ {
+ if (address == null)
+ {
+ throw new NullPointerException("address");
+ }
+
+ if (handler == null)
+ {
+ throw new NullPointerException("handler");
+ }
+
+ if (!(address instanceof InetSocketAddress))
+ {
+ throw new IllegalArgumentException("Unexpected address type: " + address.getClass());
+ }
+
+ if (((InetSocketAddress) address).getPort() == 0)
+ {
+ throw new IllegalArgumentException("Unsupported port number: 0");
+ }
+
+ if (config == null)
+ {
+ config = getDefaultConfig();
+ }
+
+ SocketBinding service = new SocketBinding(address, handler, config);
+ synchronized (services)
+ {
+ services.put(address, service);
+ }
+ service.start();
+ }
+
+ public Set getManagedSessions(SocketAddress address)
+ {
+ if (address == null)
+ {
+ throw new NullPointerException("address");
+ }
+
+ SocketBinding service = (SocketBinding) services.get(address);
+
+ if (service == null)
+ {
+ throw new IllegalArgumentException("Address not bound: " + address);
+ }
+
+ return Collections.unmodifiableSet(new HashSet(service.sessions));
+ }
+
+ public void unbind(SocketAddress address)
+ {
+ if (address == null)
+ {
+ throw new NullPointerException("address");
+ }
+
+ SocketBinding service;
+ synchronized (services)
+ {
+ service = (SocketBinding) services.remove(address);
+ }
+
+ if (service == null)
+ {
+ throw new IllegalArgumentException("Address not bound: " + address);
+ }
+
+ try
+ {
+ service.unbind();
+ }
+ catch (IOException e)
+ {
+ //TODO: handle properly
+ e.printStackTrace();
+ }
+ }
+
+ public void unbindAll()
+ {
+ synchronized (services)
+ {
+ for (Iterator i = services.entrySet().iterator(); i.hasNext();)
+ {
+ SocketBinding service = (SocketBinding) i.next();
+ try
+ {
+ service.unbind();
+ }
+ catch (IOException e)
+ {
+ //TODO: handle properly
+ e.printStackTrace();
+ }
+ i.remove();
+ }
+ }
+ }
+
+ public boolean isBound(SocketAddress address)
+ {
+ synchronized (services)
+ {
+ return services.containsKey(address);
+ }
+ }
+
+ public Set getBoundAddresses()
+ {
+ throw new UnsupportedOperationException("getBoundAddresses() not supported by blocking IO Acceptor");
+ }
+
+ public IoServiceConfig getDefaultConfig()
+ {
+ return defaultConfig;
+ }
+
+ private class SocketBinding implements Runnable
+ {
+ private final SocketAddress address;
+ private final ServerSocketChannel service;
+ //private final ServerSocket service;
+ private final IoServiceConfig config;
+ private final IoHandler handler;
+ private final List sessions = new ArrayList();
+ private volatile boolean stopped = false;
+ private Thread runner;
+
+ SocketBinding(SocketAddress address, IoHandler handler, IoServiceConfig config) throws IOException
+ {
+ this.address = address;
+ this.handler = handler;
+ this.config = config;
+
+ service = ServerSocketChannel.open();
+ service.socket().bind(address);
+
+ //service = new ServerSocket();
+ //service.bind(address);
+ }
+
+ void unbind() throws IOException
+ {
+ stopped = true;
+ //shutdown all sessions
+ for (Iterator i = sessions.iterator(); i.hasNext();)
+ {
+ ((SocketSessionImpl) i.next()).close();
+ i.remove();
+ }
+
+ //close server socket
+ service.close();
+ if (runner != null)
+ {
+ try
+ {
+ runner.join();
+ }
+ catch (InterruptedException e)
+ {
+ //ignore and return
+ System.err.println("Warning: interrupted on unbind(" + address + ")");
+ }
+ }
+ }
+
+ void start()
+ {
+ runner = new Thread(this);
+ runner.start();
+ }
+
+ public void run()
+ {
+ while (!stopped)
+ {
+ try
+ {
+ accept();
+ }
+ catch (Exception e)
+ {
+ //handle this better...
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void accept() throws Exception
+ {
+ //accept(new SimpleSocketChannel(service.accept()));
+ accept(service.accept());
+ }
+
+ private void accept(ByteChannel channel) throws Exception
+ {
+ //SocketChannel channel;
+ //start session
+ SocketSessionImpl session = new SocketSessionImpl(SocketAcceptor.this,
+ (SocketSessionConfig) defaultConfig.getSessionConfig(),
+ handler,
+ channel,
+ address);
+ //signal start etc...
+ sessions.add(session);
+
+ //TODO
+ //need to set up filter chains somehow... (this is copied from connector...)
+ getFilterChainBuilder().buildFilterChain(session.getFilterChain());
+ config.getFilterChainBuilder().buildFilterChain(session.getFilterChain());
+ config.getThreadModel().buildFilterChain(session.getFilterChain());
+ ((SocketFilterChain) session.getFilterChain()).sessionCreated(session);
+
+ session.start();
+ //not sure if this will work... socket is already opened before the created callback is called...
+ ((SocketFilterChain) session.getFilterChain()).sessionOpened(session);
+ }
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/bio/SocketAcceptor.java
------------------------------------------------------------------------------
svn:eol-style = native