From 7e4d3a26342e99f79bf6416d6167df3508a77887 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Tue, 24 Jul 2007 22:40:10 +0000 Subject: changed package name from qpidapi to api git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@559245 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/qpid/nclient/api/Connection.java | 81 +++++++ .../qpid/nclient/api/CreateReceiverOption.java | 16 ++ .../qpid/nclient/api/DeclareExchangeOption.java | 17 ++ .../qpid/nclient/api/DeclareQueueOption.java | 17 ++ .../qpid/nclient/api/DeleteExchangeOption.java | 12 + .../apache/qpid/nclient/api/DeleteQueueOption.java | 13 ++ .../org/apache/qpid/nclient/api/DtxSession.java | 43 ++++ .../java/org/apache/qpid/nclient/api/Message.java | 126 +++++++++++ .../apache/qpid/nclient/api/MessageListener.java | 36 +++ .../apache/qpid/nclient/api/MessageReceiver.java | 95 ++++++++ .../org/apache/qpid/nclient/api/MessageSender.java | 44 ++++ .../java/org/apache/qpid/nclient/api/Resource.java | 54 +++++ .../java/org/apache/qpid/nclient/api/Session.java | 247 +++++++++++++++++++++ .../apache/qpid/nclient/qpidapi/Connection.java | 81 ------- .../qpid/nclient/qpidapi/CreateReceiverOption.java | 16 -- .../nclient/qpidapi/DeclareExchangeOption.java | 17 -- .../qpid/nclient/qpidapi/DeclareQueueOption.java | 17 -- .../qpid/nclient/qpidapi/DeleteExchangeOption.java | 12 - .../qpid/nclient/qpidapi/DeleteQueueOption.java | 13 -- .../apache/qpid/nclient/qpidapi/DtxSession.java | 43 ---- .../org/apache/qpid/nclient/qpidapi/Message.java | 126 ----------- .../qpid/nclient/qpidapi/MessageListener.java | 36 --- .../qpid/nclient/qpidapi/MessageReceiver.java | 95 -------- .../apache/qpid/nclient/qpidapi/MessageSender.java | 44 ---- .../org/apache/qpid/nclient/qpidapi/Resource.java | 54 ----- .../org/apache/qpid/nclient/qpidapi/Session.java | 247 --------------------- 26 files changed, 801 insertions(+), 801 deletions(-) create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/Connection.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/CreateReceiverOption.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/DeclareExchangeOption.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/DeclareQueueOption.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/DeleteExchangeOption.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/DeleteQueueOption.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/DtxSession.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/Message.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/MessageListener.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/MessageReceiver.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/MessageSender.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/Resource.java create mode 100644 java/client/src/main/java/org/apache/qpid/nclient/api/Session.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Connection.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/CreateReceiverOption.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareExchangeOption.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareQueueOption.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteExchangeOption.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteQueueOption.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DtxSession.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Message.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageListener.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageReceiver.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageSender.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Resource.java delete mode 100644 java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Session.java (limited to 'java') diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/Connection.java b/java/client/src/main/java/org/apache/qpid/nclient/api/Connection.java new file mode 100644 index 0000000000..fd59b95c0f --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/Connection.java @@ -0,0 +1,81 @@ +/* + * 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.qpidapi; + +import org.apache.qpid.nclient.exception.QpidException; + +import java.net.URL; + +/** + * This represents a physical connection to a broker. + *

+ * Created by Arnaud Simon + * Date: 20-Jul-2007 + * Time: 09:34:15 + */ +public interface Connection +{ + /** + * Establish the connection with the broker identified by the provided URL. + * + * @param url The URL of the broker. + * @throws QpidException If the communication layer fails to connect with the broker. + */ + public void connect(URL url) + throws + QpidException; + + /** + * Close this connection. + * + * @throws QpidException if the communication layer fails to close the connection. + */ + public void close() + throws + QpidException; + + + /** + * Create a session for this connection. + *

The retuned session is suspended + * (i.e. this session is not attached with an underlying channel) + * + * @param expiryInSeconds Expiry time expressed in seconds, if the value is <= 0 then the session does not expire. + * @return A Newly created (suspended) session. + * @throws QpidException If the connection fails to create a session due to some internal error. + */ + public Session createSession(int expiryInSeconds) + throws + QpidException; + + /** + * Create a DtxSession for this connection. + *

A Dtx Session must be used when resources have to be manipulated as + * part of a global transaction. + *

The retuned DtxSession is suspended + * (i.e. this session is not attached with an underlying channel) + * + * @param expiryInSeconds Expiry time expressed in seconds, if the value is <= 0 then the session does not expire. + * @return A Newly created (suspended) DtxSession. + * @throws QpidException If the connection fails to create a DtxSession due to some internal error. + */ + public DtxSession createDTXSession(int expiryInSeconds) + throws + QpidException; +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/CreateReceiverOption.java b/java/client/src/main/java/org/apache/qpid/nclient/api/CreateReceiverOption.java new file mode 100644 index 0000000000..4d8315c33b --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/CreateReceiverOption.java @@ -0,0 +1,16 @@ +package org.apache.qpid.nclient.qpidapi; + +/** + * Enumeration of the options available when creating a receiver + * + * Created by Arnaud Simon + * Date: 20-Jul-2007 + * Time: 09:43:31 + */ +public enum CreateReceiverOption +{ + NO_LOCAL, + EXCLUSIVE, + NO_ACQUIRE, + CONFIRME; +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/DeclareExchangeOption.java b/java/client/src/main/java/org/apache/qpid/nclient/api/DeclareExchangeOption.java new file mode 100644 index 0000000000..8674792252 --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/DeclareExchangeOption.java @@ -0,0 +1,17 @@ +package org.apache.qpid.nclient.qpidapi; + +/** + * Enumeration of the options available when declaring an exchange + * + * Created by Arnaud Simon + * Date: 20-Jul-2007 + * Time: 09:44:52 + */ +public enum DeclareExchangeOption +{ + AUTO_DELETE, + DURABLE, + INTERNAL, + NOWAIT, + PASSIVE; +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/DeclareQueueOption.java b/java/client/src/main/java/org/apache/qpid/nclient/api/DeclareQueueOption.java new file mode 100644 index 0000000000..e5b80b00df --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/DeclareQueueOption.java @@ -0,0 +1,17 @@ +package org.apache.qpid.nclient.qpidapi; + +/** + * Enumeration of the options available when declaring a queue + * + * Created by Arnaud Simon + * Date: 23-Jul-2007 + * Time: 09:44:36 + */ +public enum DeclareQueueOption +{ + AUTO_DELETE, + DURABLE, + EXCLUSIVE, + NOWAIT, + PASSIVE; +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/DeleteExchangeOption.java b/java/client/src/main/java/org/apache/qpid/nclient/api/DeleteExchangeOption.java new file mode 100644 index 0000000000..188d665c8c --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/DeleteExchangeOption.java @@ -0,0 +1,12 @@ +package org.apache.qpid.nclient.qpidapi; + +/** + * Created by Arnaud Simon + * Date: 23-Jul-2007 + * Time: 12:55:55 + */ +public enum DeleteExchangeOption +{ + IF_UNUSED, + NOWAIT; +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/DeleteQueueOption.java b/java/client/src/main/java/org/apache/qpid/nclient/api/DeleteQueueOption.java new file mode 100644 index 0000000000..0062218a70 --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/DeleteQueueOption.java @@ -0,0 +1,13 @@ +package org.apache.qpid.nclient.qpidapi; + +/** + * Created by Arnaud Simon + * Date: 23-Jul-2007 + * Time: 12:44:43 + */ +public enum DeleteQueueOption +{ + IF_EMPTY, + IF_UNUSED, + NO_WAIT; +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/DtxSession.java b/java/client/src/main/java/org/apache/qpid/nclient/api/DtxSession.java new file mode 100644 index 0000000000..c361fdcf82 --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/DtxSession.java @@ -0,0 +1,43 @@ +/* + * 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.qpidapi; + +import org.apache.qpid.nclient.exception.QpidException; + +/** + * This session’s resources are control under the scope of a distributed transaction. + * + * Created by Arnaud Simon + * Date: 20-Jul-2007 + * Time: 09:39:11 + */ +public interface DtxSession extends Session +{ + + /** + * Get the XA resource associated with this session. + * + * @return this session XA resource. + * @throws QpidException If the session fails to retrieve its associated XA resource + * due to some error. + */ + public javax.transaction.xa.XAResource getDTXResource() + throws + QpidException; +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/Message.java b/java/client/src/main/java/org/apache/qpid/nclient/api/Message.java new file mode 100644 index 0000000000..6974d0cae2 --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/Message.java @@ -0,0 +1,126 @@ +/* + * 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.qpidapi; + + +import org.apache.qpid.nclient.FieldTable; +import org.apache.qpid.nclient.exception.QpidException; + +import java.nio.ByteBuffer; + +/** + * A message is sent and received by resources. It is composed of a set of header and a payload. + *

+ * Created by Arnaud Simon + * Date: 20-Jul-2007 + * Time: 09:40:49 + */ +public interface Message +{ + /** + * Get this message auto-allocated messageID. + * + * @return This message ID. + */ + public long getMessageID(); + + /** + * Set this message headers + *

Previous headers are reset. + * + * @param headers The message headers as a field table. + * @see FieldTable + */ + public void setHeaders(FieldTable headers); + + /** + * Access to this message headers. + * + * @return This message headers as a field table. + */ + public FieldTable getHeaders(); + + /** + * Set this message payload. + * + * @param buffer This message payload. + */ + public void setBody(ByteBuffer buffer); + + /** + * Access this message body. + * + * @return The payload of this message. + */ + public ByteBuffer getBody(); + + /** + * Acknowledge the receipt of this message. + *

The message must have been previously acquired either by receiving it in + * pre-acquire mode or by explicitly acquiring it. + * + * @throws QpidException If the acknowledgement of the message fails due to some error. + * @throws IllegalStateException If this messages is not acquired. + */ + public void acknowledge() + throws + QpidException, + IllegalStateException; + + /** + * Acknowledge the receipt of an acquired messages which IDs are within + * the interval [this.messageID, message.messageID] + * + * @param message The last message to be acknowledged. + * @throws QpidException If the acknowledgement of this set of messages fails due to some error. + * @throws IllegalStateException If some messages are not acquired. + */ + public void acknowledge(Message message) + throws + QpidException, + IllegalStateException; + + /** + * Reject a previously acquired message. + *

A rejected message will not be delivered to any receiver + * and may be either discarded or moved to the broker dead letter queue. + * + * @throws QpidException If this message cannot be rejected dus to some error + * @throws IllegalStateException If this message is not acquired. + */ + public void reject() + throws + QpidException, + IllegalStateException; + + /** + * Try to acquire this message hence releasing it form the queue. This means that once acknowledged, + * this message will not be delivered to any other receiver. + *

As this message may have been consumed by another receiver, message acquisition can fail. + * The outcome of the acquisition is returned as a Boolean. + * + * @return True if the message is successfully acquired, False otherwise. + * @throws QpidException If this message cannot be acquired dus to some error + * @throws IllegalStateException If this message has already been acquired. + */ + public boolean acquire() + throws + QpidException, + IllegalStateException; +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/MessageListener.java b/java/client/src/main/java/org/apache/qpid/nclient/api/MessageListener.java new file mode 100644 index 0000000000..d607d0a3c2 --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/MessageListener.java @@ -0,0 +1,36 @@ +/* + * 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.qpidapi; + +/** + * MessageListeners are used to asynchronously receive messages. + * + * Created by Arnaud Simon + * Date: 2o-Jul-2007 + * Time: 09:42:52 + */ +public interface MessageListener +{ + /** + * Deliver a message to the listener. + * + * @param message The message delivered to the listner. + */ + public void onMessage(Message message); +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/MessageReceiver.java b/java/client/src/main/java/org/apache/qpid/nclient/api/MessageReceiver.java new file mode 100644 index 0000000000..6592857b2e --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/MessageReceiver.java @@ -0,0 +1,95 @@ +/* + * 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.qpidapi; + +import org.apache.qpid.nclient.exception.QpidException; + +import java.util.Set; + +/** + * Used to receive messages from a queue + * + *

+ * Created by Arnaud Simon + * Date: 20-Jul-2007 + * Time: 09:42:37 + */ +public interface MessageReceiver extends Resource +{ + /** + * Get this receiver options. + * + * @return This receiver set of options. + */ + public Set getOptions(); + + /** + * Receive a message form this receiver queue. + *

If the timeout is less or equal than 0 then this operation is blocking. + * Otherwise it blocks until a message arrives, the timeout expires, or this receiver is closed. + *

To receive messages, a receiver must be started. + * + * @param timeout The timeout value (in milliseconds). + * @return A message or null if timeout expires or this receiver is concurrently closed. + * @throws QpidException If this receiver fails to receive a message due to some error. + * @throws IllegalStateException If this receiver is closed, not started or a MessageListener is set. + */ + public Message receive(long timeout) + throws + QpidException, + IllegalStateException; + + /** + * Stop the delivery of messages to this receiver. + * + * @throws QpidException If this receiver fails to be stopped due to some error. + * @throws IllegalStateException If this receiver is closed or already stopped. + */ + public void stop() + throws + QpidException, + IllegalStateException; + + /** + * Start the delivery of messages to this receiver. + * + * @throws QpidException If this receiver fails to be started due to some error. + * @throws IllegalStateException If this receiver is closed or already started. + */ + public void start() + throws + QpidException, + IllegalStateException; + + /** + * Set the receiver’s MessageListener. + * Setting the message listener to null is the equivalent of un-setting the message + * listener for this receiver. + *

Once a message listener is set, a receiver cannot receive messages through its + * receive method. + * + * @param listener The message listner. + * @throws QpidException If this receiver fails to set the message listner due to some error. + * @throws IllegalStateException If this receiver is closed. + */ + public void setAsynchronous(MessageListener listener) + throws + QpidException, + IllegalStateException; +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/MessageSender.java b/java/client/src/main/java/org/apache/qpid/nclient/api/MessageSender.java new file mode 100644 index 0000000000..545c06e67e --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/MessageSender.java @@ -0,0 +1,44 @@ +/* + * 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.qpidapi; + +import org.apache.qpid.nclient.exception.QpidException; + +/** + * A sender is used to send message to its queue. + *

+ * Created by Arnaud Simon + * Date: 22-Jul-2007 + * Time: 09:41:58 + */ +public interface MessageSender extends Resource +{ + + /** + * Sends a message to this sender queue. + * + * @param message The message to be sent + * @throws QpidException If the sender fails to send the message due to some error. + * @throws IllegalStateException If this sender was closed or its session suspended. + */ + public void send(Message message) + throws + QpidException, + IllegalStateException; +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/Resource.java b/java/client/src/main/java/org/apache/qpid/nclient/api/Resource.java new file mode 100644 index 0000000000..29965e0045 --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/Resource.java @@ -0,0 +1,54 @@ +/* + * 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.qpidapi; + +import org.apache.qpid.nclient.exception.QpidException; + +/** + * A Resource is associated with a session and can be independently closed. + * + * Created by Arnaud Simon + * Date: 21-Jul-2007 + * Time: 09:41:30 + */ +public interface Resource +{ + + /** + * Close this resource. + * + * @throws QpidException If the session fails to close this resource due to some error + */ + public void close() throws + QpidException; + + /** + * Get this resource session. + * + * @return This resource's session. + */ + public Session getSession(); + + /** + * Get the queue name to which this resource is tied. + * + * @return The queue name of this resource. + */ + public String getQueueNAme(); +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/api/Session.java b/java/client/src/main/java/org/apache/qpid/nclient/api/Session.java new file mode 100644 index 0000000000..31b11134ba --- /dev/null +++ b/java/client/src/main/java/org/apache/qpid/nclient/api/Session.java @@ -0,0 +1,247 @@ +/* + * 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.qpidapi; + +import org.apache.qpid.nclient.exception.QpidException; + +/** + * A session is associated with a connection. + *

When created a Session is not attached with an underlying channel. Unsuspended a Session is + * equivalent to attaching a communication channel that can be used to communicate with the broker. + *

+ * Created by Arnaud Simon + * Date: 20-Jul-2007 + * Time: 09:36:24 + */ +public interface Session +{ + /** + * Close this session and any associated resources. + * + * @throws QpidException If the communication layer fails to close this session or if an internal error happens + * when closing this session resources. . + */ + public void close() + throws + QpidException; + + /** + * Suspend this session resulting in interrupting the traffic with the broker. + * When a session is suspend any operation of this session and of the associated resources is unavailable. + * + * @throws QpidException If the communication layer fails to suspend this session + */ + public void suspend() + throws + QpidException; + + /** + * Unsuspended a Session is equivalent to attaching a communication channel that can be used to + * communicate with the broker. All the operations of this session and of the associated resources + * are made available. + * + * @throws QpidException If the communication layer fails to unsuspend this session + */ + public void unsuspend() + throws + QpidException; + + /** + * Create a message sender for sending messages to queue queueName. + * + * @param queueName The queue this sender is sending messages. + * @return A sender for queue queueName + * @throws QpidException If the session fails to create the sended due to some error + */ + public MessageSender createSender(String queueName) + throws + QpidException; + //Todo: Do we need to define more specific exception like queue name not valid? + + /** + * Create a message receiver for receiving messages from queue queueName. + *

see available options: {@link CreateReceiverOption} + *

When non of the options are set then the receiver is created with: + *

+ * + * @param queueName The queue this receiver is receiving messages from. + * @param options Set of Options. + * @return A receiver for queue queueName. + * @throws QpidException If the session fails to create the receiver due to some error. + * @see CreateReceiverOption + */ + public MessageReceiver createReceiver(String queueName, CreateReceiverOption... options) + throws + QpidException; + //Todo: Do we need to define more specific exceptions like queue name not valid? + + /** + * Commit the receipt and the delivery of all messages exchanged by this session resources. + * + * @throws QpidException If the session fails to commit due to some error. + * @throws IllegalStateException If this session is not transacted. + */ + public void commit() + throws + QpidException, + IllegalStateException; + + /** + * Rollback the receipt and the delivery of all messages exchanged by this session resources. + * + * @throws QpidException If the session fails to rollback due to some error. + * @throws IllegalStateException If this session is not transacted. + */ + public void rollback() + throws + QpidException, + IllegalStateException; + + /** + * Set this session as transacted. + *

This operation is irreversible. + * + * @throws QpidException If the session fail to be transacted due to some error. + * @throws IllegalStateException If this session is already transacted. + */ + public void setTransacted() + throws + QpidException, + IllegalStateException; + + /** + * Declare a queue of name queueName + *

see available options: {@link DeclareQueueOption} + *

When non of the options are set then the receiver is created with: + *

+ * + * @param queueName The name of the delcared queue. + * @param options Set of Options. + * @throws QpidException If the session fails to declare the queue due to some error. + * @see DeclareQueueOption + */ + public void declareQueue(String queueName, DeclareQueueOption... options) + throws + QpidException; + //Todo: Do we need to define more specific exceptions like queue name already exist? + + /** + * Bind a queue with an exchange. + * + * @param queueName The queue to be bound. + * @param exchangeName The exchange name. + * @param routingKey The routing key. + * @param nowait nowait + * @throws QpidException If the session fails to bind the queue due to some error. + */ + public void bindQueue(String queueName, String exchangeName, String routingKey, boolean nowait) + throws + QpidException; + //Todo: Do we need to define more specific exceptions like exchange does not exist? + + /** + * Unbind a queue from an exchange. + * + * @param queueName The queue to be unbound. + * @param exchangeName The exchange name. + * @param routingKey The routing key. + * @throws QpidException If the session fails to unbind the queue due to some error. + */ + public void unbindQueue(String queueName, String exchangeName, String routingKey) + throws + QpidException; + //Todo: Do we need to define more specific exceptions like exchange does not exist? + + /** + * Purge a queue. i.e. delete all enqueued messages + * TODO: Define the exact semantic i.e. are message sent to a dead letter queue? + * + * @param queueName The queue to be purged + * @param nowait nowait + * @throws QpidException If the session fails to purge the queue due to some error. + */ + public void purgeQueue(String queueName, boolean nowait) + throws + QpidException; + + /** + * Delet a queue. + *

see available options: {@link DeleteQueueOption} + *

When non of the options are set then The queue is immediately deleted even + * if it still contains messages or if ti is used by another resource. + * + * @param queueName The name of the queue to be deleted + * @param options Set of options + * @throws QpidException If the session fails to delete the queue due to some error. + * @see DeleteQueueOption + */ + public void deleteQueue(String queueName, DeleteQueueOption options) + throws + QpidException; + + /** + * Declare an exchange. + *

see available options: {@link DeclareExchangeOption} + *

When non of the options are set then the exchange is declared with: + *

+ * + * @param exchangeName The exchange name. + * @param exchangeClass The fully qualified name of the exchange class. + * @param options Set of options. + * @throws QpidException If the session fails to declare the exchange due to some error. + * @see DeclareExchangeOption + */ + public void declareExchange(String exchangeName, String exchangeClass, DeclareExchangeOption... options) + throws + QpidException; + //Todo: Do we need to define more specific exceptions like exchange already exist? + + /** + * Delete an exchange. + *

see available options: {@link DeclareExchangeOption} + *

When non of the options are set then the exchange + * Immediately deleted even if it is used by another resources. + * + * @param exchangeName The name of exchange to be deleted. + * @param options Set of options. + * @throws QpidException If the session fails to delete the exchange due to some error. + * @see DeleteExchangeOption + */ + public void deleteExchange(String exchangeName, DeleteExchangeOption... options) + throws + QpidException; + //Todo: Do we need to define more specific exceptions like exchange does not exist? +} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Connection.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Connection.java deleted file mode 100644 index fd59b95c0f..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Connection.java +++ /dev/null @@ -1,81 +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.qpidapi; - -import org.apache.qpid.nclient.exception.QpidException; - -import java.net.URL; - -/** - * This represents a physical connection to a broker. - *

- * Created by Arnaud Simon - * Date: 20-Jul-2007 - * Time: 09:34:15 - */ -public interface Connection -{ - /** - * Establish the connection with the broker identified by the provided URL. - * - * @param url The URL of the broker. - * @throws QpidException If the communication layer fails to connect with the broker. - */ - public void connect(URL url) - throws - QpidException; - - /** - * Close this connection. - * - * @throws QpidException if the communication layer fails to close the connection. - */ - public void close() - throws - QpidException; - - - /** - * Create a session for this connection. - *

The retuned session is suspended - * (i.e. this session is not attached with an underlying channel) - * - * @param expiryInSeconds Expiry time expressed in seconds, if the value is <= 0 then the session does not expire. - * @return A Newly created (suspended) session. - * @throws QpidException If the connection fails to create a session due to some internal error. - */ - public Session createSession(int expiryInSeconds) - throws - QpidException; - - /** - * Create a DtxSession for this connection. - *

A Dtx Session must be used when resources have to be manipulated as - * part of a global transaction. - *

The retuned DtxSession is suspended - * (i.e. this session is not attached with an underlying channel) - * - * @param expiryInSeconds Expiry time expressed in seconds, if the value is <= 0 then the session does not expire. - * @return A Newly created (suspended) DtxSession. - * @throws QpidException If the connection fails to create a DtxSession due to some internal error. - */ - public DtxSession createDTXSession(int expiryInSeconds) - throws - QpidException; -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/CreateReceiverOption.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/CreateReceiverOption.java deleted file mode 100644 index 4d8315c33b..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/CreateReceiverOption.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.apache.qpid.nclient.qpidapi; - -/** - * Enumeration of the options available when creating a receiver - * - * Created by Arnaud Simon - * Date: 20-Jul-2007 - * Time: 09:43:31 - */ -public enum CreateReceiverOption -{ - NO_LOCAL, - EXCLUSIVE, - NO_ACQUIRE, - CONFIRME; -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareExchangeOption.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareExchangeOption.java deleted file mode 100644 index 8674792252..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareExchangeOption.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.apache.qpid.nclient.qpidapi; - -/** - * Enumeration of the options available when declaring an exchange - * - * Created by Arnaud Simon - * Date: 20-Jul-2007 - * Time: 09:44:52 - */ -public enum DeclareExchangeOption -{ - AUTO_DELETE, - DURABLE, - INTERNAL, - NOWAIT, - PASSIVE; -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareQueueOption.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareQueueOption.java deleted file mode 100644 index e5b80b00df..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareQueueOption.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.apache.qpid.nclient.qpidapi; - -/** - * Enumeration of the options available when declaring a queue - * - * Created by Arnaud Simon - * Date: 23-Jul-2007 - * Time: 09:44:36 - */ -public enum DeclareQueueOption -{ - AUTO_DELETE, - DURABLE, - EXCLUSIVE, - NOWAIT, - PASSIVE; -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteExchangeOption.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteExchangeOption.java deleted file mode 100644 index 188d665c8c..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteExchangeOption.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.apache.qpid.nclient.qpidapi; - -/** - * Created by Arnaud Simon - * Date: 23-Jul-2007 - * Time: 12:55:55 - */ -public enum DeleteExchangeOption -{ - IF_UNUSED, - NOWAIT; -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteQueueOption.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteQueueOption.java deleted file mode 100644 index 0062218a70..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteQueueOption.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.apache.qpid.nclient.qpidapi; - -/** - * Created by Arnaud Simon - * Date: 23-Jul-2007 - * Time: 12:44:43 - */ -public enum DeleteQueueOption -{ - IF_EMPTY, - IF_UNUSED, - NO_WAIT; -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DtxSession.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DtxSession.java deleted file mode 100644 index c361fdcf82..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DtxSession.java +++ /dev/null @@ -1,43 +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.qpidapi; - -import org.apache.qpid.nclient.exception.QpidException; - -/** - * This session’s resources are control under the scope of a distributed transaction. - * - * Created by Arnaud Simon - * Date: 20-Jul-2007 - * Time: 09:39:11 - */ -public interface DtxSession extends Session -{ - - /** - * Get the XA resource associated with this session. - * - * @return this session XA resource. - * @throws QpidException If the session fails to retrieve its associated XA resource - * due to some error. - */ - public javax.transaction.xa.XAResource getDTXResource() - throws - QpidException; -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Message.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Message.java deleted file mode 100644 index 6974d0cae2..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Message.java +++ /dev/null @@ -1,126 +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.qpidapi; - - -import org.apache.qpid.nclient.FieldTable; -import org.apache.qpid.nclient.exception.QpidException; - -import java.nio.ByteBuffer; - -/** - * A message is sent and received by resources. It is composed of a set of header and a payload. - *

- * Created by Arnaud Simon - * Date: 20-Jul-2007 - * Time: 09:40:49 - */ -public interface Message -{ - /** - * Get this message auto-allocated messageID. - * - * @return This message ID. - */ - public long getMessageID(); - - /** - * Set this message headers - *

Previous headers are reset. - * - * @param headers The message headers as a field table. - * @see FieldTable - */ - public void setHeaders(FieldTable headers); - - /** - * Access to this message headers. - * - * @return This message headers as a field table. - */ - public FieldTable getHeaders(); - - /** - * Set this message payload. - * - * @param buffer This message payload. - */ - public void setBody(ByteBuffer buffer); - - /** - * Access this message body. - * - * @return The payload of this message. - */ - public ByteBuffer getBody(); - - /** - * Acknowledge the receipt of this message. - *

The message must have been previously acquired either by receiving it in - * pre-acquire mode or by explicitly acquiring it. - * - * @throws QpidException If the acknowledgement of the message fails due to some error. - * @throws IllegalStateException If this messages is not acquired. - */ - public void acknowledge() - throws - QpidException, - IllegalStateException; - - /** - * Acknowledge the receipt of an acquired messages which IDs are within - * the interval [this.messageID, message.messageID] - * - * @param message The last message to be acknowledged. - * @throws QpidException If the acknowledgement of this set of messages fails due to some error. - * @throws IllegalStateException If some messages are not acquired. - */ - public void acknowledge(Message message) - throws - QpidException, - IllegalStateException; - - /** - * Reject a previously acquired message. - *

A rejected message will not be delivered to any receiver - * and may be either discarded or moved to the broker dead letter queue. - * - * @throws QpidException If this message cannot be rejected dus to some error - * @throws IllegalStateException If this message is not acquired. - */ - public void reject() - throws - QpidException, - IllegalStateException; - - /** - * Try to acquire this message hence releasing it form the queue. This means that once acknowledged, - * this message will not be delivered to any other receiver. - *

As this message may have been consumed by another receiver, message acquisition can fail. - * The outcome of the acquisition is returned as a Boolean. - * - * @return True if the message is successfully acquired, False otherwise. - * @throws QpidException If this message cannot be acquired dus to some error - * @throws IllegalStateException If this message has already been acquired. - */ - public boolean acquire() - throws - QpidException, - IllegalStateException; -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageListener.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageListener.java deleted file mode 100644 index d607d0a3c2..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageListener.java +++ /dev/null @@ -1,36 +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.qpidapi; - -/** - * MessageListeners are used to asynchronously receive messages. - * - * Created by Arnaud Simon - * Date: 2o-Jul-2007 - * Time: 09:42:52 - */ -public interface MessageListener -{ - /** - * Deliver a message to the listener. - * - * @param message The message delivered to the listner. - */ - public void onMessage(Message message); -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageReceiver.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageReceiver.java deleted file mode 100644 index 6592857b2e..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageReceiver.java +++ /dev/null @@ -1,95 +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.qpidapi; - -import org.apache.qpid.nclient.exception.QpidException; - -import java.util.Set; - -/** - * Used to receive messages from a queue - * - *

- * Created by Arnaud Simon - * Date: 20-Jul-2007 - * Time: 09:42:37 - */ -public interface MessageReceiver extends Resource -{ - /** - * Get this receiver options. - * - * @return This receiver set of options. - */ - public Set getOptions(); - - /** - * Receive a message form this receiver queue. - *

If the timeout is less or equal than 0 then this operation is blocking. - * Otherwise it blocks until a message arrives, the timeout expires, or this receiver is closed. - *

To receive messages, a receiver must be started. - * - * @param timeout The timeout value (in milliseconds). - * @return A message or null if timeout expires or this receiver is concurrently closed. - * @throws QpidException If this receiver fails to receive a message due to some error. - * @throws IllegalStateException If this receiver is closed, not started or a MessageListener is set. - */ - public Message receive(long timeout) - throws - QpidException, - IllegalStateException; - - /** - * Stop the delivery of messages to this receiver. - * - * @throws QpidException If this receiver fails to be stopped due to some error. - * @throws IllegalStateException If this receiver is closed or already stopped. - */ - public void stop() - throws - QpidException, - IllegalStateException; - - /** - * Start the delivery of messages to this receiver. - * - * @throws QpidException If this receiver fails to be started due to some error. - * @throws IllegalStateException If this receiver is closed or already started. - */ - public void start() - throws - QpidException, - IllegalStateException; - - /** - * Set the receiver’s MessageListener. - * Setting the message listener to null is the equivalent of un-setting the message - * listener for this receiver. - *

Once a message listener is set, a receiver cannot receive messages through its - * receive method. - * - * @param listener The message listner. - * @throws QpidException If this receiver fails to set the message listner due to some error. - * @throws IllegalStateException If this receiver is closed. - */ - public void setAsynchronous(MessageListener listener) - throws - QpidException, - IllegalStateException; -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageSender.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageSender.java deleted file mode 100644 index 545c06e67e..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageSender.java +++ /dev/null @@ -1,44 +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.qpidapi; - -import org.apache.qpid.nclient.exception.QpidException; - -/** - * A sender is used to send message to its queue. - *

- * Created by Arnaud Simon - * Date: 22-Jul-2007 - * Time: 09:41:58 - */ -public interface MessageSender extends Resource -{ - - /** - * Sends a message to this sender queue. - * - * @param message The message to be sent - * @throws QpidException If the sender fails to send the message due to some error. - * @throws IllegalStateException If this sender was closed or its session suspended. - */ - public void send(Message message) - throws - QpidException, - IllegalStateException; -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Resource.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Resource.java deleted file mode 100644 index 29965e0045..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Resource.java +++ /dev/null @@ -1,54 +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.qpidapi; - -import org.apache.qpid.nclient.exception.QpidException; - -/** - * A Resource is associated with a session and can be independently closed. - * - * Created by Arnaud Simon - * Date: 21-Jul-2007 - * Time: 09:41:30 - */ -public interface Resource -{ - - /** - * Close this resource. - * - * @throws QpidException If the session fails to close this resource due to some error - */ - public void close() throws - QpidException; - - /** - * Get this resource session. - * - * @return This resource's session. - */ - public Session getSession(); - - /** - * Get the queue name to which this resource is tied. - * - * @return The queue name of this resource. - */ - public String getQueueNAme(); -} diff --git a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Session.java b/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Session.java deleted file mode 100644 index 31b11134ba..0000000000 --- a/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Session.java +++ /dev/null @@ -1,247 +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.qpidapi; - -import org.apache.qpid.nclient.exception.QpidException; - -/** - * A session is associated with a connection. - *

When created a Session is not attached with an underlying channel. Unsuspended a Session is - * equivalent to attaching a communication channel that can be used to communicate with the broker. - *

- * Created by Arnaud Simon - * Date: 20-Jul-2007 - * Time: 09:36:24 - */ -public interface Session -{ - /** - * Close this session and any associated resources. - * - * @throws QpidException If the communication layer fails to close this session or if an internal error happens - * when closing this session resources. . - */ - public void close() - throws - QpidException; - - /** - * Suspend this session resulting in interrupting the traffic with the broker. - * When a session is suspend any operation of this session and of the associated resources is unavailable. - * - * @throws QpidException If the communication layer fails to suspend this session - */ - public void suspend() - throws - QpidException; - - /** - * Unsuspended a Session is equivalent to attaching a communication channel that can be used to - * communicate with the broker. All the operations of this session and of the associated resources - * are made available. - * - * @throws QpidException If the communication layer fails to unsuspend this session - */ - public void unsuspend() - throws - QpidException; - - /** - * Create a message sender for sending messages to queue queueName. - * - * @param queueName The queue this sender is sending messages. - * @return A sender for queue queueName - * @throws QpidException If the session fails to create the sended due to some error - */ - public MessageSender createSender(String queueName) - throws - QpidException; - //Todo: Do we need to define more specific exception like queue name not valid? - - /** - * Create a message receiver for receiving messages from queue queueName. - *

see available options: {@link CreateReceiverOption} - *

When non of the options are set then the receiver is created with: - *

- * - * @param queueName The queue this receiver is receiving messages from. - * @param options Set of Options. - * @return A receiver for queue queueName. - * @throws QpidException If the session fails to create the receiver due to some error. - * @see CreateReceiverOption - */ - public MessageReceiver createReceiver(String queueName, CreateReceiverOption... options) - throws - QpidException; - //Todo: Do we need to define more specific exceptions like queue name not valid? - - /** - * Commit the receipt and the delivery of all messages exchanged by this session resources. - * - * @throws QpidException If the session fails to commit due to some error. - * @throws IllegalStateException If this session is not transacted. - */ - public void commit() - throws - QpidException, - IllegalStateException; - - /** - * Rollback the receipt and the delivery of all messages exchanged by this session resources. - * - * @throws QpidException If the session fails to rollback due to some error. - * @throws IllegalStateException If this session is not transacted. - */ - public void rollback() - throws - QpidException, - IllegalStateException; - - /** - * Set this session as transacted. - *

This operation is irreversible. - * - * @throws QpidException If the session fail to be transacted due to some error. - * @throws IllegalStateException If this session is already transacted. - */ - public void setTransacted() - throws - QpidException, - IllegalStateException; - - /** - * Declare a queue of name queueName - *

see available options: {@link DeclareQueueOption} - *

When non of the options are set then the receiver is created with: - *

- * - * @param queueName The name of the delcared queue. - * @param options Set of Options. - * @throws QpidException If the session fails to declare the queue due to some error. - * @see DeclareQueueOption - */ - public void declareQueue(String queueName, DeclareQueueOption... options) - throws - QpidException; - //Todo: Do we need to define more specific exceptions like queue name already exist? - - /** - * Bind a queue with an exchange. - * - * @param queueName The queue to be bound. - * @param exchangeName The exchange name. - * @param routingKey The routing key. - * @param nowait nowait - * @throws QpidException If the session fails to bind the queue due to some error. - */ - public void bindQueue(String queueName, String exchangeName, String routingKey, boolean nowait) - throws - QpidException; - //Todo: Do we need to define more specific exceptions like exchange does not exist? - - /** - * Unbind a queue from an exchange. - * - * @param queueName The queue to be unbound. - * @param exchangeName The exchange name. - * @param routingKey The routing key. - * @throws QpidException If the session fails to unbind the queue due to some error. - */ - public void unbindQueue(String queueName, String exchangeName, String routingKey) - throws - QpidException; - //Todo: Do we need to define more specific exceptions like exchange does not exist? - - /** - * Purge a queue. i.e. delete all enqueued messages - * TODO: Define the exact semantic i.e. are message sent to a dead letter queue? - * - * @param queueName The queue to be purged - * @param nowait nowait - * @throws QpidException If the session fails to purge the queue due to some error. - */ - public void purgeQueue(String queueName, boolean nowait) - throws - QpidException; - - /** - * Delet a queue. - *

see available options: {@link DeleteQueueOption} - *

When non of the options are set then The queue is immediately deleted even - * if it still contains messages or if ti is used by another resource. - * - * @param queueName The name of the queue to be deleted - * @param options Set of options - * @throws QpidException If the session fails to delete the queue due to some error. - * @see DeleteQueueOption - */ - public void deleteQueue(String queueName, DeleteQueueOption options) - throws - QpidException; - - /** - * Declare an exchange. - *

see available options: {@link DeclareExchangeOption} - *

When non of the options are set then the exchange is declared with: - *

- * - * @param exchangeName The exchange name. - * @param exchangeClass The fully qualified name of the exchange class. - * @param options Set of options. - * @throws QpidException If the session fails to declare the exchange due to some error. - * @see DeclareExchangeOption - */ - public void declareExchange(String exchangeName, String exchangeClass, DeclareExchangeOption... options) - throws - QpidException; - //Todo: Do we need to define more specific exceptions like exchange already exist? - - /** - * Delete an exchange. - *

see available options: {@link DeclareExchangeOption} - *

When non of the options are set then the exchange - * Immediately deleted even if it is used by another resources. - * - * @param exchangeName The name of exchange to be deleted. - * @param options Set of options. - * @throws QpidException If the session fails to delete the exchange due to some error. - * @see DeleteExchangeOption - */ - public void deleteExchange(String exchangeName, DeleteExchangeOption... options) - throws - QpidException; - //Todo: Do we need to define more specific exceptions like exchange does not exist? -} -- cgit v1.2.1