You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ar...@apache.org on 2007/07/23 16:52:26 UTC
svn commit: r558756 - in
/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient:
./ exception/ qpidapi/
Author: arnaudsimon
Date: Mon Jul 23 07:52:23 2007
New Revision: 558756
URL: http://svn.apache.org/viewvc?view=rev&rev=558756
Log:
JAve Qpid API
Added:
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/FieldTable.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/exception/
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/exception/QpidException.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Connection.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/CreateReceiverOption.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareExchangeOption.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareQueueOption.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteExchangeOption.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteQueueOption.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DtxSession.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Message.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageListener.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageReceiver.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageSender.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Resource.java (with props)
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Session.java (with props)
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/FieldTable.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/FieldTable.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/FieldTable.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/FieldTable.java Mon Jul 23 07:52:23 2007
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ * Created by Arnaud Simon
+ * Date: 23-Jul-2007
+ * Time: 09:47:32
+ */
+public interface FieldTable
+{
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/FieldTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/exception/QpidException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/exception/QpidException.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/exception/QpidException.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/exception/QpidException.java Mon Jul 23 07:52:23 2007
@@ -0,0 +1,48 @@
+/* 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.exception;
+
+/**
+ * Created by Arnaud Simon
+ * Date: 20-Jul-2007
+ * Time: 10:56:55
+ */
+public class QpidException extends Exception
+{
+ /**
+ * This exception error code.
+ * <p> This error code is used for internationalisation purpose.
+ * <p> This error code is set from the AMQP ones.
+ * <TODO> So we may want to use the AMQP error code directly.
+ */
+ String _errorCode;
+
+ /**
+ * Constructor for a Qpid Exception.
+ * <p> This is the only provided constructor and the parameters have to be set to null when
+ * they are unknown.
+ * @param message A description of the reason of this exception .
+ * @param errorCode A string specifyin the error code of this exception.
+ * @param cause The linked Execption.
+ */
+ public QpidException(String message, String errorCode, Throwable cause)
+ {
+ super(message, cause);
+ _errorCode = errorCode;
+ }
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/exception/QpidException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Connection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Connection.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Connection.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Connection.java Mon Jul 23 07:52:23 2007
@@ -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.
+ * <p/>
+ * 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.
+ * <p> 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.
+ * <p> A Dtx Session must be used when resources have to be manipulated as
+ * part of a global transaction.
+ * <p> 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;
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Connection.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/CreateReceiverOption.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/CreateReceiverOption.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/CreateReceiverOption.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/CreateReceiverOption.java Mon Jul 23 07:52:23 2007
@@ -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;
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/CreateReceiverOption.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareExchangeOption.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareExchangeOption.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareExchangeOption.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareExchangeOption.java Mon Jul 23 07:52:23 2007
@@ -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;
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareExchangeOption.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareQueueOption.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareQueueOption.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareQueueOption.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareQueueOption.java Mon Jul 23 07:52:23 2007
@@ -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;
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeclareQueueOption.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteExchangeOption.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteExchangeOption.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteExchangeOption.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteExchangeOption.java Mon Jul 23 07:52:23 2007
@@ -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;
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteExchangeOption.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteQueueOption.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteQueueOption.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteQueueOption.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteQueueOption.java Mon Jul 23 07:52:23 2007
@@ -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;
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DeleteQueueOption.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DtxSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DtxSession.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DtxSession.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DtxSession.java Mon Jul 23 07:52:23 2007
@@ -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 sessions 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;
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/DtxSession.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Message.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Message.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Message.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Message.java Mon Jul 23 07:52:23 2007
@@ -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.
+ * <p/>
+ * 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
+ * <p> 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.
+ * <p>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.
+ * <p> 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.
+ * <p> 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;
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Message.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageListener.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageListener.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageListener.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageListener.java Mon Jul 23 07:52:23 2007
@@ -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);
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageReceiver.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageReceiver.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageReceiver.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageReceiver.java Mon Jul 23 07:52:23 2007
@@ -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
+ *
+ * <p/>
+ * 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<CreateReceiverOption> getOptions();
+
+ /**
+ * Receive a message form this receiver queue.
+ * <p> 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.
+ * <p> 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 receivers MessageListener.
+ * Setting the message listener to null is the equivalent of un-setting the message
+ * listener for this receiver.
+ * <p> 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;
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageReceiver.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageSender.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageSender.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageSender.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageSender.java Mon Jul 23 07:52:23 2007
@@ -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.
+ * <p/>
+ * 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;
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/MessageSender.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Resource.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Resource.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Resource.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Resource.java Mon Jul 23 07:52:23 2007
@@ -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();
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Resource.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Session.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Session.java?view=auto&rev=558756
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Session.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Session.java Mon Jul 23 07:52:23 2007
@@ -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.
+ * <p> 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.
+ * <p/>
+ * 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.
+ * <p> see available options: {@link CreateReceiverOption}
+ * <p> When non of the options are set then the receiver is created with:
+ * <ul>
+ * <li> no_local = false
+ * <li> non exclusive
+ * <li> pre-acquire mode
+ * <li> no confirmation
+ * </ul>
+ *
+ * @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.
+ * <p> 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
+ * <p> see available options: {@link DeclareQueueOption}
+ * <p> When non of the options are set then the receiver is created with:
+ * <ul>
+ * <li> auto_delete = false
+ * <li> non-durable
+ * <li> non-exccusive
+ * <li> nowait = false
+ * <li> not passive
+ * </ul>
+ *
+ * @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.
+ * <p> see available options: {@link DeleteQueueOption}
+ * <p> 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.
+ * <p> see available options: {@link DeclareExchangeOption}
+ * <p> When non of the options are set then the exchange is declared with:
+ * <ul>
+ * <li> auto_delete = false
+ * <li> non-durable
+ * <li> internal = false
+ * <li> nowait = false
+ * <li> not passive
+ * </ul>
+ *
+ * @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.
+ * <p> see available options: {@link DeclareExchangeOption}
+ * <p> 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?
+}
Propchange: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/qpidapi/Session.java
------------------------------------------------------------------------------
svn:eol-style = native