summaryrefslogtreecommitdiff
path: root/java/client/src
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2008-01-16 22:21:07 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2008-01-16 22:21:07 +0000
commit4b1efc5908b5a8c5a9bc274f7a8e8ff2d5ddccab (patch)
tree8ed105406708cde64ccc8d0d6f6dfb7163fed6fd /java/client/src
parent648f1a6384730ccf3183d3507663c849d98f19f0 (diff)
downloadqpid-python-4b1efc5908b5a8c5a9bc274f7a8e8ff2d5ddccab.tar.gz
Fixed various compilation errors
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@612593 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src')
-rw-r--r--java/client/src/main/java/org/apache/qpid/jndi/Example.properties5
-rw-r--r--java/client/src/main/java/org/apache/qpidity/nclient/Client.java28
-rw-r--r--java/client/src/main/java/org/apache/qpidity/nclient/Connection.java26
-rw-r--r--java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java59
-rw-r--r--java/client/src/main/java/org/apache/qpidity/nclient/Session.java14
-rw-r--r--java/client/src/main/java/org/apache/qpidity/nclient/impl/ClientSession.java2
-rw-r--r--java/client/src/main/java/org/apache/qpidity/nclient/impl/DemoClient.java1
-rw-r--r--java/client/src/main/java/org/apache/qpidity/njms/ConnectionImpl.java6
8 files changed, 92 insertions, 49 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/jndi/Example.properties b/java/client/src/main/java/org/apache/qpid/jndi/Example.properties
index c457e94cab..def53d8494 100644
--- a/java/client/src/main/java/org/apache/qpid/jndi/Example.properties
+++ b/java/client/src/main/java/org/apache/qpid/jndi/Example.properties
@@ -6,9 +6,9 @@
# 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
@@ -37,3 +37,4 @@ topic.ibmStocks = stocks.nyse.ibm
# NOTE: Qpid currently only supports direct,topics and headers
# destination.[jniName] = [BindingURL]
destination.direct = direct://amq.direct//directQueue
+destination.directQueue = direct://amq.direct//message_queue?routingkey="routing_key"
diff --git a/java/client/src/main/java/org/apache/qpidity/nclient/Client.java b/java/client/src/main/java/org/apache/qpidity/nclient/Client.java
index f6e7911078..4cca33f300 100644
--- a/java/client/src/main/java/org/apache/qpidity/nclient/Client.java
+++ b/java/client/src/main/java/org/apache/qpidity/nclient/Client.java
@@ -1,12 +1,14 @@
package org.apache.qpidity.nclient;
+import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
+import org.apache.qpid.client.url.URLParser_0_10;
+import org.apache.qpid.jms.BrokerDetails;
import org.apache.qpid.url.QpidURL;
-import org.apache.qpidity.BrokerDetails;
import org.apache.qpidity.ErrorCode;
import org.apache.qpidity.QpidException;
import org.apache.qpidity.nclient.impl.ClientSession;
@@ -82,6 +84,7 @@ public class Client implements org.apache.qpidity.nclient.Connection
{
System.out.println("using MINA");
_conn = MinaHandler.connect(host, port,connectionDelegate);
+ // _conn = NativeHandler.connect(host, port,connectionDelegate);
}
// XXX: hardcoded version numbers
@@ -101,12 +104,34 @@ public class Client implements org.apache.qpidity.nclient.Connection
}
}
+ public void connect(String url)throws QpidException
+ {
+ URLParser_0_10 parser = null;
+ try
+ {
+ parser = new URLParser_0_10(url);
+ }
+ catch(Exception e)
+ {
+ throw new QpidException("Error parsing the URL",ErrorCode.UNDEFINED,e);
+ }
+ List<BrokerDetails> brokers = parser.getAllBrokerDetails();
+ BrokerDetails brokerDetail = brokers.get(0);
+ connect(brokerDetail.getHost(), brokerDetail.getPort(), brokerDetail.getProperty("virtualhost"),
+ brokerDetail.getProperty("username")== null? "guest":brokerDetail.getProperty("username"),
+ brokerDetail.getProperty("password")== null? "guest":brokerDetail.getProperty("password"));
+ }
+
/*
* Until the dust settles with the URL disucssion
* I am not going to implement this.
*/
public void connect(QpidURL url) throws QpidException
{
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ /* {
// temp impl to tests
BrokerDetails details = url.getAllBrokerDetails().get(0);
connect(details.getHost(),
@@ -115,6 +140,7 @@ public class Client implements org.apache.qpidity.nclient.Connection
details.getUserName(),
details.getPassword());
}
+*/
public void close() throws QpidException
{
diff --git a/java/client/src/main/java/org/apache/qpidity/nclient/Connection.java b/java/client/src/main/java/org/apache/qpidity/nclient/Connection.java
index d486c86f33..95d2b07f31 100644
--- a/java/client/src/main/java/org/apache/qpidity/nclient/Connection.java
+++ b/java/client/src/main/java/org/apache/qpidity/nclient/Connection.java
@@ -18,7 +18,6 @@
*/
package org.apache.qpidity.nclient;
-import org.apache.qpid.url.QpidURL;
import org.apache.qpidity.QpidException;
/**
@@ -28,23 +27,24 @@ public interface Connection
{
/**
* Establish the connection using the given parameters
- *
+ *
* @param host
* @param port
* @param username
* @param password
* @throws QpidException
- */
+ */
public void connect(String host, int port,String virtualHost,String username, String password) throws QpidException;
-
- /**
- * 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(QpidURL url) throws QpidException;
-
+
+
+ /**
+ * Establish the connection with the broker identified by the URL.
+ *
+ * @param url The URL of the broker.
+ * @throws QpidException If the communication layer fails to connect with the broker.
+ */
+ public void connect(String url) throws QpidException;
+
/**
* Close this connection.
*
@@ -81,6 +81,6 @@ public interface Connection
*
* @param exceptionListner The execptionListener
*/
-
+
public void setClosedListener(ClosedListener exceptionListner);
}
diff --git a/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java b/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java
index cab5c82411..7eb482c26b 100644
--- a/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java
+++ b/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java
@@ -1,5 +1,8 @@
package org.apache.qpidity.nclient;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQQueue;
import org.apache.qpid.client.AMQTopic;
@@ -20,13 +23,45 @@ public class JMSTestCase
javax.jms.Destination dest = new AMQQueue(new AMQShortString("direct"),"test");
javax.jms.MessageConsumer cons = ssn.createConsumer(dest);
+ javax.jms.MessageProducer prod = ssn.createProducer(dest);
+
+ //javax.jms.TextMessage m = (javax.jms.TextMessage)cons.receive();
+ /* cons.setMessageListener(new MessageListener()
+ {
+ public void onMessage(Message m)
+ {
+ javax.jms.TextMessage m2 = (javax.jms.TextMessage)m;
+ try
+ {
+ System.out.println("m : " + m2.getText());
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ });*/
- javax.jms.TextMessage m = (javax.jms.TextMessage)cons.receive();
+ javax.jms.TextMessage msg = ssn.createTextMessage();
+ msg.setText("This is a test message");
+ msg.setBooleanProperty("targetMessage", false);
+ prod.send(msg);
- if (m != null)
+ msg.setBooleanProperty("targetMessage", true);
+ prod.send(msg);
+
+ javax.jms.TextMessage m = (javax.jms.TextMessage)cons.receiveNoWait();
+
+ if (m == null)
+ {
+ System.out.println("message is null");
+ }
+ else
{
- System.out.println("Message" + m);
+ System.out.println("message is not null" + m);
}
+
}
catch(Exception e)
{
@@ -34,22 +69,4 @@ public class JMSTestCase
}
}
- /* javax.jms.TextMessage msg = ssn.createTextMessage();
- msg.setText("This is a test message");
- msg.setBooleanProperty("targetMessage", false);
- prod.send(msg);
-
- msg.setBooleanProperty("targetMessage", true);
- prod.send(msg);
-
- javax.jms.TextMessage m = (javax.jms.TextMessage)cons.receiveNoWait();
-
- if (m == null)
- {
- System.out.println("message is null");
- }
- else
- {
- System.out.println("message is not null" + m);
- }*/
}
diff --git a/java/client/src/main/java/org/apache/qpidity/nclient/Session.java b/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
index 7328efc496..b3d3a7c12d 100644
--- a/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
+++ b/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
@@ -6,9 +6,9 @@
* 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
@@ -47,11 +47,11 @@ public interface Session
public static final short MESSAGE_FLOW_MODE_WINDOW = 1;
public static final short MESSAGE_FLOW_UNIT_MESSAGE = 0;
public static final short MESSAGE_FLOW_UNIT_BYTE = 1;
+ public static final long MESSAGE_FLOW_MAX_BYTES = 0xFFFFFFFF;
public static final short MESSAGE_REJECT_CODE_GENERIC = 0;
public static final short MESSAGE_REJECT_CODE_IMMEDIATE_DELIVERY_FAILED = 1;
public static final short MESSAGE_ACQUIRE_ANY_AVAILABLE_MESSAGE = 0;
public static final short MESSAGE_ACQUIRE_MESSAGES_IF_ALL_ARE_AVAILABLE = 1;
- public static final short MESSAGE_FLOW_MAX_BYTES=1000;
//------------------------------------------------------
// Session housekeeping methods
@@ -75,9 +75,9 @@ public interface Session
*/
public void sessionSuspend();
- //------------------------------------------------------
+ //------------------------------------------------------
// Messaging methods
- // Producer
+ // Producer
//------------------------------------------------------
/**
* Transfer the given
@@ -464,7 +464,7 @@ public interface Session
public void txRollback() throws IllegalStateException;
//---------------------------------------------
- // Queue methods
+ // Queue methods
//---------------------------------------------
/**
@@ -586,7 +586,7 @@ public interface Session
Map<String, Object> arguments);
// --------------------------------------
- // exhcange methods
+ // exhcange methods
// --------------------------------------
/**
diff --git a/java/client/src/main/java/org/apache/qpidity/nclient/impl/ClientSession.java b/java/client/src/main/java/org/apache/qpidity/nclient/impl/ClientSession.java
index d9434419da..0a25ea3961 100644
--- a/java/client/src/main/java/org/apache/qpidity/nclient/impl/ClientSession.java
+++ b/java/client/src/main/java/org/apache/qpidity/nclient/impl/ClientSession.java
@@ -44,7 +44,7 @@ public class ClientSession extends org.apache.qpidity.transport.Session implemen
}
private static long MAX_NOT_SYNC_DATA_LENGH;
- private static long MAX_NOT_FLUSH_DATA_LENGH;
+ private static long MAX_NOT_FLUSH_DATA_LENGH;
private Map<String,MessagePartListener> _messageListeners = new HashMap<String,MessagePartListener>();
private ClosedListener _exceptionListner;
private RangeSet _acquiredMessages;
diff --git a/java/client/src/main/java/org/apache/qpidity/nclient/impl/DemoClient.java b/java/client/src/main/java/org/apache/qpidity/nclient/impl/DemoClient.java
index 541d955cbd..96ec98a45a 100644
--- a/java/client/src/main/java/org/apache/qpidity/nclient/impl/DemoClient.java
+++ b/java/client/src/main/java/org/apache/qpidity/nclient/impl/DemoClient.java
@@ -83,7 +83,6 @@ public class DemoClient
ssn.data("Topic message");
ssn.header(new DeliveryProperties().setRoutingKey("stock.us.ibm"),new MessageProperties().setMessageId("456"));
ssn.endData();
- ssn.sync();
}
}
diff --git a/java/client/src/main/java/org/apache/qpidity/njms/ConnectionImpl.java b/java/client/src/main/java/org/apache/qpidity/njms/ConnectionImpl.java
index 6e90a2a4cd..de313e7bed 100644
--- a/java/client/src/main/java/org/apache/qpidity/njms/ConnectionImpl.java
+++ b/java/client/src/main/java/org/apache/qpidity/njms/ConnectionImpl.java
@@ -5,9 +5,9 @@
* 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
@@ -122,7 +122,7 @@ public class ConnectionImpl implements Connection
protected ConnectionImpl(QpidURL qpidURL) throws QpidException
{
_qpidConnection = Client.createConnection();
- _qpidConnection.connect(qpidURL);
+ //_qpidConnection.connect(qpidURL);
}
//---- Interface javax.njms.Connection ---//