qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject svn commit: r612593 - in /incubator/qpid/trunk/qpid/java: ./ client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/ client/example/src/main/java/org/apache/qpid/example/amqpexample/fannout/ client/example/src/main/java/org/apache/qpid...
Date Wed, 16 Jan 2008 22:21:18 GMT
Author: rajith
Date: Wed Jan 16 14:21:07 2008
New Revision: 612593

URL: http://svn.apache.org/viewvc?rev=612593&view=rev
Log:
Fixed various compilation errors

Added:
    incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/direct.properties
Removed:
    incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/fannout/
Modified:
    incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DirectProducer.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/Example.properties
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Connection.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/impl/ClientSession.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/impl/DemoClient.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/njms/ConnectionImpl.java
    incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java
    incubator/qpid/trunk/qpid/java/pom.xml

Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DirectProducer.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DirectProducer.java?rev=612593&r1=612592&r2=612593&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DirectProducer.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DirectProducer.java
Wed Jan 16 14:21:07 2008
@@ -1,18 +1,49 @@
 package org.apache.qpid.example.amqpexample.direct;
 
+import java.nio.ByteBuffer;
+
+import org.apache.qpidity.api.Message;
 import org.apache.qpidity.nclient.Client;
 import org.apache.qpidity.nclient.Connection;
 import org.apache.qpidity.nclient.Session;
+import org.apache.qpidity.nclient.util.MessageListener;
 import org.apache.qpidity.transport.DeliveryProperties;
 
-public class DirectProducer
+public class DirectProducer implements MessageListener
 {
-    /**
-     *  This sends 10 messages to the
-     *  amq.direct exchange using the
-     *  routing key as "routing_key"
-     *
-     */
+    boolean finish = false;
+
+    public void onMessage(Message m)
+    {
+        String data = null;
+
+        try
+        {
+            ByteBuffer buf = m.readData();
+            byte[] b = new byte[buf.remaining()];
+            buf.get(b);
+            data = new String(b);
+        }
+        catch(Exception e)
+        {
+            System.out.print("Error reading message");
+            e.printStackTrace();
+        }
+
+        System.out.println("Message: " + data);
+
+
+        if (data != null && data.equals("That's all, folks!"))
+        {
+            finish = true;
+        }
+    }
+
+    public boolean isFinished()
+    {
+        return finish;
+    }
+
     public static void main(String[] args)
     {
         // Create connection

Added: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/direct.properties
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/direct.properties?rev=612593&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/direct.properties
(added)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/direct/direct.properties
Wed Jan 16 14:21:07 2008
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory
+
+# use the following property to configure the default connector
+#java.naming.provider.url - ignored.
+
+# register some connection factories
+# connectionfactory.[jndiname] = [ConnectionURL]
+connectionfactory.local = qpid:password=pass;username=name@tcp:localhost:5672
+
+# Register an AMQP destination in JNDI
+#   NOTE: Qpid currently only supports direct,topics and headers
+# destination.[jniName] = [BindingURL]
+destination.directQueue = direct://amq.direct//message_queue?routingkey='routing_key'
\ No newline at end of file

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/Example.properties
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/Example.properties?rev=612593&r1=612592&r2=612593&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/Example.properties
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/Example.properties
Wed Jan 16 14:21:07 2008
@@ -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 @@
 #   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"

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java?rev=612593&r1=612592&r2=612593&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Client.java
Wed Jan 16 14:21:07 2008
@@ -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 @@
         {
             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 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 @@
                 details.getUserName(),
                 details.getPassword());
     }
+*/
 
     public void close() throws QpidException
     {

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Connection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Connection.java?rev=612593&r1=612592&r2=612593&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Connection.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Connection.java
Wed Jan 16 14:21:07 2008
@@ -18,7 +18,6 @@
  */
 package org.apache.qpidity.nclient;
 
-import org.apache.qpid.url.QpidURL;
 import org.apache.qpidity.QpidException;
 
 /**
@@ -28,23 +27,24 @@
 {
    /**
     * 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 @@
      *
      * @param exceptionListner The execptionListener
      */
-    
+
     public void setClosedListener(ClosedListener exceptionListner);
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java?rev=612593&r1=612592&r2=612593&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/JMSTestCase.java
Wed Jan 16 14:21:07 2008
@@ -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 @@
 
             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 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.receive();
+            javax.jms.TextMessage m = (javax.jms.TextMessage)cons.receiveNoWait();
 
-            if (m != null)
+            if (m == null)
             {
-               System.out.println("Message"  + m);
+               System.out.println("message is null");
             }
+            else
+            {
+               System.out.println("message is not null"  + m);
+            }
+
         }
         catch(Exception e)
         {
@@ -34,22 +69,4 @@
         }
     }
 
-    /* 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);
-    }*/
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Session.java?rev=612593&r1=612592&r2=612593&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/Session.java
Wed Jan 16 14:21:07 2008
@@ -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 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 void sessionSuspend();
 
-    //------------------------------------------------------ 
+    //------------------------------------------------------
     //                 Messaging methods
-    //                   Producer           
+    //                   Producer
     //------------------------------------------------------
     /**
      * Transfer the given
@@ -464,7 +464,7 @@
     public void txRollback() throws IllegalStateException;
 
     //---------------------------------------------
-    //            Queue methods 
+    //            Queue methods
     //---------------------------------------------
 
     /**
@@ -586,7 +586,7 @@
                                                    Map<String, Object> arguments);
 
     // --------------------------------------
-    //              exhcange methods 
+    //              exhcange methods
     // --------------------------------------
 
     /**

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/impl/ClientSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/impl/ClientSession.java?rev=612593&r1=612592&r2=612593&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/impl/ClientSession.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/impl/ClientSession.java
Wed Jan 16 14:21:07 2008
@@ -44,7 +44,7 @@
     }
 
     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;

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/impl/DemoClient.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/impl/DemoClient.java?rev=612593&r1=612592&r2=612593&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/impl/DemoClient.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/nclient/impl/DemoClient.java
Wed Jan 16 14:21:07 2008
@@ -83,7 +83,6 @@
         ssn.data("Topic message");
         ssn.header(new DeliveryProperties().setRoutingKey("stock.us.ibm"),new MessageProperties().setMessageId("456"));
         ssn.endData();
-        ssn.sync();
     }
 
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/njms/ConnectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/njms/ConnectionImpl.java?rev=612593&r1=612592&r2=612593&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/njms/ConnectionImpl.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpidity/njms/ConnectionImpl.java
Wed Jan 16 14:21:07 2008
@@ -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 @@
     protected ConnectionImpl(QpidURL qpidURL) throws QpidException
     {
         _qpidConnection = Client.createConnection();
-        _qpidConnection.connect(qpidURL);
+        //_qpidConnection.connect(qpidURL);
     }
 
     //---- Interface javax.njms.Connection ---//

Modified: incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java?rev=612593&r1=612592&r2=612593&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/client/perf/MessageConsumerTest.java
Wed Jan 16 14:21:07 2008
@@ -40,11 +40,7 @@
        Destination dest = Boolean.getBoolean("useQueue")? new AMQQueue(_connection,_destination)
: new AMQTopic(_connection,_destination);
        _session = _connection.createSession(_transacted, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer _consumer = _session.createConsumer(dest);
-        if(!_synchronous)
-       {
-           _consumer.setMessageListener(this);
-       }
-
+        _consumer.setMessageListener(this);
        _startTime = System.currentTimeMillis();
        if(Boolean.getBoolean("collect_stats"))
        {

Modified: incubator/qpid/trunk/qpid/java/pom.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/pom.xml?rev=612593&r1=612592&r2=612593&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/pom.xml (original)
+++ incubator/qpid/trunk/qpid/java/pom.xml Wed Jan 16 14:21:07 2008
@@ -503,12 +503,12 @@
             <dependency>
                 <groupId>org.apache.mina</groupId>
                 <artifactId>mina-core</artifactId>
-                <version>1.1.5</version>
+                <version>1.0.0</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.mina</groupId>
                 <artifactId>mina-filter-ssl</artifactId>
-                <version>1.1.5</version>
+                <version>1.0.0</version>
             </dependency>
        <!--     
             <dependency>



Mime
View raw message