summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2008-10-22 23:56:53 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2008-10-22 23:56:53 +0000
commit72f8b9b08b609985601927c9d90f83d5765af687 (patch)
tree1461b04772beaf119c63e5c3bc75cf654d88c51e /java
parent2eef956d0930b426ba916058b1b30001d1007d6c (diff)
downloadqpid-python-72f8b9b08b609985601927c9d90f83d5765af687.tar.gz
Clean up of code that is no longer being used.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@707226 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/impl/Constants.java78
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/impl/DemoClient.java112
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/interop/BasicInteropTest.java174
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/util/FileMessage.java117
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/util/ReadOnlyMessage.java59
-rw-r--r--java/client/src/main/java/org/apache/qpid/nclient/util/StreamingMessage.java89
6 files changed, 0 insertions, 629 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/impl/Constants.java b/java/client/src/main/java/org/apache/qpid/nclient/impl/Constants.java
deleted file mode 100644
index f689e9abde..0000000000
--- a/java/client/src/main/java/org/apache/qpid/nclient/impl/Constants.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.nclient.impl;
-
-/**
- * This class holds all the 0.10 client constants which value can be set
- * through properties.
- */
-public class Constants
-{
- static
- {
-
- String max="message_size_before_sync";// KB's
- try
- {
- MAX_NOT_SYNC_DATA_LENGH=new Long(System.getProperties().getProperty(max, "200000000"));
- }
- catch (NumberFormatException e)
- {
- // use default size
- MAX_NOT_SYNC_DATA_LENGH=200000000;
- }
- String flush="message_size_before_flush";
- try
- {
- MAX_NOT_FLUSH_DATA_LENGH=new Long(System.getProperties().getProperty(flush, "2000000"));
- }
- catch (NumberFormatException e)
- {
- // use default size
- MAX_NOT_FLUSH_DATA_LENGH=20000000;
- }
- }
-
- /**
- * The total message size in KBs that can be transferted before
- * client and broker are synchronized.
- * A sync will result in the client library releasing the sent messages
- * from memory. (messages are kept
- * in memory so client can reconnect to a broker in the event of a failure)
- * <p>
- * Property name: message_size_before_sync
- * <p>
- * Default value: 200000000
- */
- public static long MAX_NOT_SYNC_DATA_LENGH;
- /**
- * The total message size in KBs that can be transferted before
- * messages are flushed.
- * When a flush returns all messages have reached the broker.
- * <p>
- * Property name: message_size_before_flush
- * <p>
- * Default value: 200000000
- */
- public static long MAX_NOT_FLUSH_DATA_LENGH;
-
-}
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/impl/DemoClient.java b/java/client/src/main/java/org/apache/qpid/nclient/impl/DemoClient.java
deleted file mode 100644
index a1dc48fcda..0000000000
--- a/java/client/src/main/java/org/apache/qpid/nclient/impl/DemoClient.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.apache.qpid.nclient.impl;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
- */
-
-
-import org.apache.qpid.ErrorCode;
-import org.apache.qpid.api.Message;
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.Header;
-import org.apache.qpid.transport.MessageAcceptMode;
-import org.apache.qpid.transport.MessageAcquireMode;
-import org.apache.qpid.transport.MessageProperties;
-import org.apache.qpid.transport.MessageTransfer;
-import org.apache.qpid.transport.Connection;
-import org.apache.qpid.transport.Session;
-import org.apache.qpid.transport.SessionException;
-import org.apache.qpid.transport.SessionListener;
-
-import java.nio.ByteBuffer;
-import java.util.UUID;
-
-public class DemoClient
-{
- public static class DemoListener implements SessionListener
- {
- public void opened(Session ssn) {}
-
- public void exception(Session ssn, SessionException exc)
- {
- System.out.println(exc);
- }
-
- public void message(Session ssn, MessageTransfer m)
- {
- System.out.println("\n================== Received Msg ==================");
- System.out.println("Message Id : " + m.getHeader().get(MessageProperties.class).getMessageId());
- System.out.println(m.toString());
- System.out.println("================== End Msg ==================\n");
- }
-
- public void closed(Session ssn) {}
- }
-
- public static final void main(String[] args)
- {
- Connection conn = new Connection();
- conn.connect("0.0.0.0", 5672, "test", "guest", "guest");
-
- Session ssn = conn.createSession(50000);
- ssn.setSessionListener(new DemoListener());
- ssn.queueDeclare("queue1", null, null);
- ssn.exchangeBind("queue1", "amq.direct", "queue1",null);
- ssn.sync();
-
- ssn.messageSubscribe("queue1", "myDest", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- null, 0, null);
-
- // queue
- ssn.messageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- new Header(new DeliveryProperties().setRoutingKey("queue1"),
- new MessageProperties().setMessageId(UUID.randomUUID())),
- ByteBuffer.wrap("this is the data".getBytes()));
-
- //reject
- ssn.messageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- new Header(new DeliveryProperties().setRoutingKey("stocks")),
- ByteBuffer.wrap("this should be rejected".getBytes()));
- ssn.sync();
-
- // topic subs
- ssn.messageSubscribe("topic1", "myDest2", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- null, 0, null);
- ssn.messageSubscribe("topic2", "myDest3", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- null, 0, null);
- ssn.messageSubscribe("topic3", "myDest4", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- null, 0, null);
- ssn.sync();
-
- ssn.queueDeclare("topic1", null, null);
- ssn.exchangeBind("topic1", "amq.topic", "stock.*",null);
- ssn.queueDeclare("topic2", null, null);
- ssn.exchangeBind("topic2", "amq.topic", "stock.us.*",null);
- ssn.queueDeclare("topic3", null, null);
- ssn.exchangeBind("topic3", "amq.topic", "stock.us.rh",null);
- ssn.sync();
-
- // topic
- ssn.messageTransfer("amq.topic", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- new Header(new DeliveryProperties().setRoutingKey("stock.us.ibm"),
- new MessageProperties().setMessageId(UUID.randomUUID())),
- ByteBuffer.wrap("Topic message".getBytes()));
- }
-
-}
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/interop/BasicInteropTest.java b/java/client/src/main/java/org/apache/qpid/nclient/interop/BasicInteropTest.java
deleted file mode 100644
index 6c6cc308e9..0000000000
--- a/java/client/src/main/java/org/apache/qpid/nclient/interop/BasicInteropTest.java
+++ /dev/null
@@ -1,174 +0,0 @@
-package org.apache.qpid.nclient.interop;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
- */
-
-
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.qpid.ErrorCode;
-import org.apache.qpid.QpidException;
-import org.apache.qpid.api.Message;
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.Header;
-import org.apache.qpid.transport.MessageAcceptMode;
-import org.apache.qpid.transport.MessageAcquireMode;
-import org.apache.qpid.transport.MessageCreditUnit;
-import org.apache.qpid.transport.MessageFlowMode;
-import org.apache.qpid.transport.MessageProperties;
-import org.apache.qpid.transport.MessageTransfer;
-import org.apache.qpid.transport.Connection;
-import org.apache.qpid.transport.Session;
-import org.apache.qpid.transport.SessionException;
-import org.apache.qpid.transport.SessionListener;
-
-public class BasicInteropTest implements SessionListener
-{
-
- private Session session;
- private Connection conn;
- private String host;
-
- public BasicInteropTest(String host)
- {
- this.host = host;
- }
-
- public void close() throws QpidException
- {
- conn.close();
- }
-
- public void testCreateConnection(){
- System.out.println("------- Creating connection--------");
- conn = new Connection();
- try{
- conn.connect(host, 5672, "test", "guest", "guest");
- }catch(Exception e){
- System.out.println("------- Error Creating connection--------");
- e.printStackTrace();
- System.exit(1);
- }
- System.out.println("------- Connection created Suscessfully --------");
- }
-
- public void testCreateSession(){
- System.out.println("------- Creating session --------");
- session = conn.createSession(0);
- System.out.println("------- Session created sucessfully --------");
- }
-
- public void testExchange(){
- System.out.println("------- Creating an exchange --------");
- session.exchangeDeclare("test", "direct", "", null);
- session.sync();
- System.out.println("------- Exchange created --------");
- }
-
- public void testQueue(){
- System.out.println("------- Creating a queue --------");
- session.queueDeclare("testQueue", "", null);
- session.sync();
- System.out.println("------- Queue created --------");
-
- System.out.println("------- Binding a queue --------");
- session.exchangeBind("testQueue", "test", "testKey", null);
- session.sync();
- System.out.println("------- Queue bound --------");
- }
-
- public void testSendMessage(){
- System.out.println("------- Sending a message --------");
- Map<String,Object> props = new HashMap<String,Object>();
- props.put("name", "rajith");
- props.put("age", 10);
- props.put("spf", 8.5);
- session.messageTransfer("test", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
- new Header(new DeliveryProperties().setRoutingKey("testKey"),
- new MessageProperties().setApplicationHeaders(props)),
- ByteBuffer.wrap("TestMessage".getBytes()));
-
- session.sync();
- System.out.println("------- Message sent --------");
- }
-
- public void testSubscribe()
- {
- System.out.println("------- Sending a subscribe --------");
- session.setSessionListener(this);
- session.messageSubscribe("testQueue", "myDest",
- MessageAcceptMode.EXPLICIT,
- MessageAcquireMode.PRE_ACQUIRED,
- null, 0, null);
-
- System.out.println("------- Setting Credit mode --------");
- session.messageSetFlowMode("myDest", MessageFlowMode.WINDOW);
- System.out.println("------- Setting Credit --------");
- session.messageFlow("myDest", MessageCreditUnit.MESSAGE, 1);
- session.messageFlow("myDest", MessageCreditUnit.BYTE, -1);
- }
-
- public void opened(Session ssn) {}
-
- public void message(Session ssn, MessageTransfer xfr)
- {
- System.out.println("--------Message Received--------");
- System.out.println(xfr.toString());
- System.out.println("--------/Message Received--------");
- ssn.processed(xfr);
- ssn.flushProcessed();
- }
-
- public void testMessageFlush()
- {
- session.messageFlush("myDest");
- session.sync();
- }
-
- public void exception(Session ssn, SessionException exc)
- {
- System.out.println("------- Broker Notified an error --------");
- System.out.println("------- " + exc + " --------");
- System.out.println("------- /Broker Notified an error --------");
- }
-
- public void closed(Session ssn) {}
-
- public static void main(String[] args) throws QpidException
- {
- String host = "0.0.0.0";
- if (args.length>0)
- {
- host = args[0];
- }
-
- BasicInteropTest t = new BasicInteropTest(host);
- t.testCreateConnection();
- t.testCreateSession();
- t.testExchange();
- t.testQueue();
- t.testSubscribe();
- t.testSendMessage();
- t.testMessageFlush();
- t.close();
- }
-}
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/util/FileMessage.java b/java/client/src/main/java/org/apache/qpid/nclient/util/FileMessage.java
deleted file mode 100644
index 6727b41929..0000000000
--- a/java/client/src/main/java/org/apache/qpid/nclient/util/FileMessage.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.apache.qpid.nclient.util;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
- */
-
-
-import java.io.EOFException;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.MappedByteBuffer;
-import java.nio.channels.FileChannel;
-
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.MessageProperties;
-import org.apache.qpid.transport.Header;
-import org.apache.qpid.api.Message;
-
-/**
- * FileMessage provides pull style semantics for
- * larges messages backed by a disk.
- * Instead of loading all data into memeory it uses
- * FileChannel to map regions of the file into memeory
- * at a time.
- *
- * The write methods are not supported.
- *
- * From the standpoint of performance it is generally
- * only worth mapping relatively large files into memory.
- *
- * FileMessage msg = new FileMessage(in,delProps,msgProps);
- * session.messageTransfer(dest,msg,0,0);
- *
- * The messageTransfer method will read the file in chunks
- * and stream it.
- *
- */
-public class FileMessage extends ReadOnlyMessage implements Message
-{
- private FileChannel _fileChannel;
- private int _chunkSize;
- private long _fileSize;
- private long _pos = 0;
-
- public FileMessage(FileInputStream in,int chunkSize,DeliveryProperties deliveryProperties,MessageProperties messageProperties)throws IOException
- {
- _messageProperties = messageProperties;
- _deliveryProperties = deliveryProperties;
-
- _fileChannel = in.getChannel();
- _chunkSize = chunkSize;
- _fileSize = _fileChannel.size();
-
- if (_fileSize <= _chunkSize)
- {
- _chunkSize = (int)_fileSize;
- }
- }
-
- public void setHeader(Header header) {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public Header getHeader() {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public void readData(byte[] target) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- public ByteBuffer readData() throws IOException
- {
- if (_pos == _fileSize)
- {
- throw new EOFException();
- }
-
- if (_pos + _chunkSize > _fileSize)
- {
- _chunkSize = (int)(_fileSize - _pos);
- }
- MappedByteBuffer bb = _fileChannel.map(FileChannel.MapMode.READ_ONLY, _pos, _chunkSize);
- _pos += _chunkSize;
- return bb;
- }
-
- /**
- * This message is used by an application user to
- * provide data to the client library using pull style
- * semantics. Since the message is not transfered yet, it
- * does not have a transfer id. Hence this method is not
- * applicable to this implementation.
- */
- public int getMessageTransferId()
- {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/util/ReadOnlyMessage.java b/java/client/src/main/java/org/apache/qpid/nclient/util/ReadOnlyMessage.java
deleted file mode 100644
index 478e3e4a56..0000000000
--- a/java/client/src/main/java/org/apache/qpid/nclient/util/ReadOnlyMessage.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.apache.qpid.nclient.util;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
- */
-
-
-import java.nio.ByteBuffer;
-
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.MessageProperties;
-import org.apache.qpid.api.Message;
-
-public abstract class ReadOnlyMessage implements Message
-{
- MessageProperties _messageProperties;
- DeliveryProperties _deliveryProperties;
-
- public void appendData(byte[] src)
- {
- throw new UnsupportedOperationException("This Message is read only after the initial source");
- }
-
- public void appendData(ByteBuffer src)
- {
- throw new UnsupportedOperationException("This Message is read only after the initial source");
- }
-
- public DeliveryProperties getDeliveryProperties()
- {
- return _deliveryProperties;
- }
-
- public MessageProperties getMessageProperties()
- {
- return _messageProperties;
- }
-
- public void clearData()
- {
- throw new UnsupportedOperationException("This Message is read only after the initial source, cannot clear data");
- }
-}
diff --git a/java/client/src/main/java/org/apache/qpid/nclient/util/StreamingMessage.java b/java/client/src/main/java/org/apache/qpid/nclient/util/StreamingMessage.java
deleted file mode 100644
index 54fa67ebc5..0000000000
--- a/java/client/src/main/java/org/apache/qpid/nclient/util/StreamingMessage.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.apache.qpid.nclient.util;
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
- */
-
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.channels.SocketChannel;
-
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.MessageProperties;
-import org.apache.qpid.transport.Header;
-import org.apache.qpid.api.Message;
-
-public class StreamingMessage extends ReadOnlyMessage implements Message
-{
- SocketChannel _socChannel;
- private int _chunkSize;
- private ByteBuffer _readBuf;
-
- public Header getHeader() {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public void setHeader(Header header) {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public StreamingMessage(SocketChannel in,int chunkSize,DeliveryProperties deliveryProperties,MessageProperties messageProperties)throws IOException
- {
- _messageProperties = messageProperties;
- _deliveryProperties = deliveryProperties;
-
- _socChannel = in;
- _chunkSize = chunkSize;
- _readBuf = ByteBuffer.allocate(_chunkSize);
- }
-
- public void readData(byte[] target) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- public ByteBuffer readData() throws IOException
- {
- if(_socChannel.isConnected() && _socChannel.isOpen())
- {
- _readBuf.clear();
- _socChannel.read(_readBuf);
- }
- else
- {
- throw new EOFException("The underlying socket/channel has closed");
- }
-
- return _readBuf.duplicate();
- }
-
- /**
- * This message is used by an application user to
- * provide data to the client library using pull style
- * semantics. Since the message is not transfered yet, it
- * does not have a transfer id. Hence this method is not
- * applicable to this implementation.
- */
- public int getMessageTransferId()
- {
- throw new UnsupportedOperationException();
- }
-}