Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 1933 invoked from network); 3 Jun 2005 08:13:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Jun 2005 08:13:16 -0000 Received: (qmail 96931 invoked by uid 500); 3 Jun 2005 08:13:13 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 96797 invoked by uid 500); 3 Jun 2005 08:13:12 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 96660 invoked by uid 99); 3 Jun 2005 08:13:11 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 03 Jun 2005 01:13:03 -0700 Received: (qmail 1711 invoked by uid 65534); 3 Jun 2005 08:12:53 -0000 Message-ID: <20050603081253.1706.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r179743 [1/2] - in /webservices/axis/trunk/java/modules/samples/src/sample: ./ amazon/ amazon/amazonSimpleQueueService/ amazon/amazonSimpleQueueService/util/ google/ google/search/ Date: Fri, 03 Jun 2005 08:12:50 -0000 To: axis-cvs@ws.apache.org From: ajith@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ajith Date: Fri Jun 3 01:12:48 2005 New Revision: 179743 URL: http://svn.apache.org/viewcvs?rev=3D179743&view=3Drev Log: Adding the samples, the google search and the amazon queue Added: webservices/axis/trunk/java/modules/samples/src/sample/ webservices/axis/trunk/java/modules/samples/src/sample/amazon/ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/AmazonSimpleQueueServiceIn.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/AmazonSimpleQueueServiceOut.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/CreateQueue.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/DeleteQueue.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/Enqueue.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/ListMyQueues.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/ListenersIn.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/ListenersOut.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/Read.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/RunGUICQ.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/RunGUIRQ.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/key.properties webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/QueueManager.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableCreateQueue.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableDeleteQueue.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableListMyQueues.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableReadQueue.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueCreateQueueCallbackHandler.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueDeleteQueueCallbackHandler.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueEnqueueCallbackHandler.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueListMyQueuesCallbackHandler.java webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueReadCallbackHandler.java webservices/axis/trunk/java/modules/samples/src/sample/google/ webservices/axis/trunk/java/modules/samples/src/sample/google/search/ webservices/axis/trunk/java/modules/samples/src/sample/google/search/As= ynchronousClient.java webservices/axis/trunk/java/modules/samples/src/sample/google/search/Cl= ientCallbackHandler.java webservices/axis/trunk/java/modules/samples/src/sample/google/search/Cl= ientUtil.java webservices/axis/trunk/java/modules/samples/src/sample/google/search/GU= IHandler.java webservices/axis/trunk/java/modules/samples/src/sample/google/search/Li= nkFollower.java webservices/axis/trunk/java/modules/samples/src/sample/google/search/ke= y=2Eproperties Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/AmazonSimpleQueueServiceIn.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/AmazonSimpleQueueServiceIn.j= ava?rev=3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/AmazonSimpleQueueServiceIn.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/AmazonSimpleQueueServiceIn.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,77 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService; + +import javax.swing.*; +import java.awt.*; + +/** + * GUI which handles the IN operations of the queue + * @author Saminda Abeyruwan + * + */ +public class AmazonSimpleQueueServiceIn extends JFrame{ + JTextField createQueue; + JTextField queueCode; + JTextField enqueue; + JTextArea resuts; + public AmazonSimpleQueueServiceIn(){ + this.setBounds(200,200,450,500); + this.setTitle("Amazon Simple Queue WS - In"); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.guiInit(); + } + private void guiInit(){ + getContentPane().setLayout(new GridBagLayout()); + GridBagConstraints cons =3D new GridBagConstraints(); + cons.fill =3D GridBagConstraints.BOTH; + JLabel lable1 =3D new JLabel("Create Queue"); + cons.insets =3D new Insets(5,5,5,5); + this.add(lable1,cons,0,0,1,1); + JLabel lable2 =3D new JLabel("Queue Code"); + this.add(lable2, cons, 1,0,1,1); + cons.weightx =3D 100; + createQueue =3D new JTextField("Test Queue LSF2"); + this.add(createQueue,cons,0,1,1,1); + queueCode =3D new JTextField(); + queueCode.setEditable(false); + this.add(queueCode,cons,1,1,1,1); + JLabel lable3 =3D new JLabel("Enqueue"); + this.add(lable3,cons,0,2,1,1); + enqueue =3D new JTextField(); + enqueue.setEditable(false); + this.add(enqueue,cons,0,3,2,1); + JLabel label4 =3D new JLabel("Results"); + this.add(label4,cons,0,5,1,1); + cons.weighty =3D 100; + resuts =3D new JTextArea(); + resuts.setEditable(false); + resuts.setLineWrap(true); + resuts.setWrapStyleWord(true); + JScrollPane resultpane =3D new JScrollPane(resuts); + this.add(resultpane,cons,0,6,2,2); + createQueue.addKeyListener(new ListenersIn(createQueue,queueCode,e= nqueue,resuts)); + enqueue.addKeyListener(new ListenersIn(createQueue,queueCode,enque= ue,resuts)); + } + private void add(Component c, GridBagConstraints cons, int x, int y, i= nt w, int h){ + cons.gridx =3D x; + cons.gridy =3D y; + cons.gridheight =3D h; + cons.gridwidth =3D w; + this.getContentPane().add(c,cons); + } + +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/AmazonSimpleQueueServiceOut.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/AmazonSimpleQueueServiceOut.= java?rev=3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/AmazonSimpleQueueServiceOut.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/AmazonSimpleQueueServiceOut.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,96 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService; + +import javax.swing.*; +import java.awt.*; + +/** + * GUI class which handles the OUT operations of the queue + * + * @author Saminda Abeyruwan + */ +public class AmazonSimpleQueueServiceOut extends JFrame { + JTextField createQueue; + JTextField queueCode; + JTextField read; + JTextArea resuts; + JButton loadButton; + JButton deleteButton; + + public AmazonSimpleQueueServiceOut() { + this.setBounds(200, 200, 450, 500); + this.setTitle("Amazon Simple Queue WS - Out"); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.guiInit(); + } + + private void guiInit() { + getContentPane().setLayout(new GridBagLayout()); + GridBagConstraints cons =3D new GridBagConstraints(); + cons.fill =3D GridBagConstraints.BOTH; + cons.insets =3D new Insets(5, 5, 5, 5); + cons.weightx =3D 100; + JLabel label0 =3D new JLabel("Enter Queue Name"); + this.add(label0, cons, 0, 0, 1, 1); + JLabel lable1 =3D new JLabel("Queue Code"); + this.add(lable1, cons, 1, 0, 1, 1); + createQueue =3D new JTextField(); + createQueue.setEditable(false); + this.add(createQueue, cons, 0, 1, 1, 1); + queueCode =3D new JTextField(); + queueCode.setEditable(false); + this.add(queueCode, cons, 1, 1, 1, 1); + JLabel lable2 =3D new JLabel("Read"); + this.add(lable2, cons, 0, 2, 1, 1); + read =3D new JTextField(); + read.setEditable(false); + this.add(read, cons, 0, 3, 2, 1); + JLabel label3 =3D new JLabel("Results"); + this.add(label3, cons, 0, 4, 1, 1); + resuts =3D new JTextArea(); + resuts.setEditable(false); + JScrollPane resultPane =3D new JScrollPane(resuts); + cons.weighty =3D 100; + this.add(resultPane, cons, 0, 5, 2, 1); + JPanel buttonPannel =3D new JPanel(); + loadButton =3D new JButton("Load Queue"); + loadButton.setActionCommand("1"); + deleteButton =3D new JButton("Delete Queue"); + deleteButton.setActionCommand("2"); + buttonPannel.add(loadButton); + buttonPannel.add(deleteButton); + cons.weightx =3D 0; + cons.weighty =3D 0; + this.add(buttonPannel, cons, 0, 6, 2, 1); + this.createQueue.addKeyListener(new ListenersOut(this.createQueue,= this.queueCode, + this.read, this.resuts, this.loadButton, this.deleteButton= )); + this.loadButton.addActionListener(new ListenersOut(this.createQueu= e, this.queueCode, + this.read, this.resuts, this.loadButton, this.deleteButton= )); + this.resuts.addMouseMotionListener(new ListenersOut(this.createQue= ue, this.queueCode, + this.read, this.resuts, this.loadButton, this.deleteButton= )); + this.deleteButton.addActionListener(new ListenersOut(this.createQu= eue, this.queueCode, + this.read, this.resuts, this.loadButton, this.deleteButton= )); + } + + private void add(Component c, GridBagConstraints cons, int x, int y, i= nt w, int h) { + cons.gridx =3D x; + cons.gridy =3D y; + cons.gridheight =3D h; + cons.gridwidth =3D w; + this.getContentPane().add(c, cons); + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/CreateQueue.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/CreateQueue.java?rev=3D17974= 3&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/CreateQueue.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/CreateQueue.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,45 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService; + +import org.apache.axis.om.*; +import org.apache.axis.soap.SOAPFactory; + +/** + * This will create the OMElement needed to be used in invokeNonBlocking()= method + * + * @author Saminda Abeyruwan + */ +public class CreateQueue { + public static OMElement creatQueueElement(String createQueueElement, S= tring key) { + SOAPFactory factory =3D OMAbstractFactory.getSOAP11Factory(); + OMNamespace opN =3D factory.createOMNamespace( + "http://webservices.amazon.com/AWSSimpleQueueService/2005-= 01-01", "nsQ"); + OMElement createQueue =3D factory.createOMElement("CreateQueue", o= pN); + OMElement subID =3D factory.createOMElement("SubscriptionId", opN)= ; + OMElement request =3D factory.createOMElement("Request", opN); + OMElement queueName =3D factory.createOMElement("QueueName", opN); + OMElement readLockTimeOutSeconds =3D factory.createOMElement("Read= LockTimeoutSeconds", opN); + request.addChild(queueName); + request.addChild(readLockTimeOutSeconds); + subID.addChild(factory.createText(key)); + queueName.addChild(factory.createText(createQueueElement)); + readLockTimeOutSeconds.addChild(factory.createText("10")); + createQueue.addChild(subID); + createQueue.addChild(request); + return createQueue; + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/DeleteQueue.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/DeleteQueue.java?rev=3D17974= 3&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/DeleteQueue.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/DeleteQueue.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,47 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService; + +import org.apache.axis.om.OMElement; +import org.apache.axis.om.OMAbstractFactory; +import org.apache.axis.om.OMNamespace; +import org.apache.axis.soap.SOAPFactory; + +/** + * This will create the OMElement needed to be used in invokeNonBlocking()= method + * + * @author Saminda Abeyruwan + */ +public class DeleteQueue { + public static OMElement deleteQueueElement(String deleteQueueName, Str= ing key) { + SOAPFactory factory =3D OMAbstractFactory.getSOAP11Factory(); + OMNamespace opN =3D factory.createOMNamespace( + "http://webservices.amazon.com/AWSSimpleQueueService/2005-= 01-01", "nsQ"); + OMElement enque =3D factory.createOMElement("DeleteQueue", opN); + OMElement subID =3D factory.createOMElement("SubscriptionId", opN)= ; + OMElement request =3D factory.createOMElement("Request", opN); + OMElement queueName =3D factory.createOMElement("QueueName", opN); + //OMElement queueID =3D factory.createOMElement("QueueId",opN); + request.addChild(queueName); + //request.addChild(queueID); + subID.addChild(factory.createText(key)); + queueName.addChild(factory.createText(deleteQueueName)); + //queueID.addChild(factory.createText(queueIden)); + enque.addChild(subID); + enque.addChild(request); + return enque; + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/Enqueue.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/Enqueue.java?rev=3D179743&vi= ew=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/Enqueue.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/Enqueue.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,50 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService; + +import org.apache.axis.om.*; +import org.apache.axis.soap.SOAPFactory; + +/** + * This will create the OMElement needed to be used in invokeNonBlocking()= method + * + * @author Saminda Abeyruwan + */ +public class Enqueue { + public static OMElement enqueueElement(String queueEntyBody, String qu= eueIden, String key) { + SOAPFactory factory =3D OMAbstractFactory.getSOAP11Factory(); + OMNamespace opN =3D factory.createOMNamespace( + "http://webservices.amazon.com/AWSSimpleQueueService/2005-= 01-01", "nsQ"); + OMElement enque =3D factory.createOMElement("Enqueue", opN); + OMElement subID =3D factory.createOMElement("SubscriptionId", opN)= ; + OMElement request =3D factory.createOMElement("Request", opN); + //OMElement queueName =3D factory.createOMElement("QueueName",opN)= ; + OMElement queueID =3D factory.createOMElement("QueueId", opN); + OMElement queueEntryBodies =3D factory.createOMElement("QueueEntry= Bodies", opN); + OMElement queueEntryBody1 =3D factory.createOMElement("QueueEntryB= ody", opN); + queueEntryBodies.addChild(queueEntryBody1); + //request.addChild(queueName); + request.addChild(queueID); + request.addChild(queueEntryBodies); + subID.addChild(factory.createText(key)); + //queueName.addChild(factory.createText("Test Queue LSF ")); + queueID.addChild(factory.createText(queueIden)); + queueEntryBody1.addChild(factory.createText(queueEntyBody)); + enque.addChild(subID); + enque.addChild(request); + return enque; + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/ListMyQueues.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/ListMyQueues.java?rev=3D1797= 43&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/ListMyQueues.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/ListMyQueues.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,40 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService; + +import org.apache.axis.om.*; +import org.apache.axis.soap.SOAPFactory; + +/** + * This will create the OMElement needed to be used in invokeNonBlocking()= method + * + * @author Saminda Abeyruwan + */ +public class ListMyQueues { + public static OMElement queueListElement(String key) { + SOAPFactory factory =3D OMAbstractFactory.getSOAP11Factory(); + OMNamespace opN =3D factory.createOMNamespace( + "http://webservices.amazon.com/AWSSimpleQueueService/2005-= 01-01", + "nsQ"); + OMElement listMyQueues =3D factory.createOMElement("ListMyQueues",= opN); + OMElement subID =3D factory.createOMElement("SubscriptionId", opN)= ; + OMElement request =3D factory.createOMElement("Request", opN); + subID.addChild(factory.createText(key)); + listMyQueues.addChild(subID); + listMyQueues.addChild(request); + return listMyQueues; + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/ListenersIn.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/ListenersIn.java?rev=3D17974= 3&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/ListenersIn.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/ListenersIn.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,62 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService; + +import sample.amazon.amazonSimpleQueueService.util.RunnableCreateQueue; +import sample.amazon.amazonSimpleQueueService.util.RunnableCreateQueue; + +import javax.swing.*; +import java.awt.event.KeyListener; +import java.awt.event.KeyEvent; + +/** + * Listeners for relevent Components in the IN operation + * + * @author Saminda Abeyruwan + */ +public class ListenersIn implements KeyListener { + JTextField createQueue; + JTextArea result; + JTextField queueCode; + JTextField enqueue; + RunnableCreateQueue runnable; + + public ListenersIn(JTextField createQueue, JTextField queueCode, JText= Field enqueue, + JTextArea result) { + this.queueCode =3D queueCode; + this.createQueue =3D createQueue; + this.enqueue =3D enqueue; + this.result =3D result; + } + + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() =3D=3D KeyEvent.VK_ENTER) { + runnable =3D + new RunnableCreateQueue(this.createQueue, this.queueCo= de, this.enqueue, + this.result); + Thread tread =3D new Thread(runnable); + tread.start(); + } + } + + public void keyReleased(KeyEvent e) { + + } + + public void keyTyped(KeyEvent e) { + + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/ListenersOut.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/ListenersOut.java?rev=3D1797= 43&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/ListenersOut.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/ListenersOut.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,97 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService; + +import sample.amazon.amazonSimpleQueueService.util.RunnableListMyQueues; +import sample.amazon.amazonSimpleQueueService.util.RunnableReadQueue; +import sample.amazon.amazonSimpleQueueService.util.RunnableDeleteQueue; +import sample.amazon.amazonSimpleQueueService.util.RunnableListMyQueues; +import sample.amazon.amazonSimpleQueueService.util.RunnableReadQueue; + +import javax.swing.*; +import java.awt.event.*; + +/** + * This will create the OMElement needed to be used in invokeNonBlocking()= method + * + * @author Saminda Abeyruwan + */ +public class ListenersOut implements KeyListener, ActionListener, MouseMot= ionListener { + JTextField createQueue; + JTextArea result; + JTextField queueCode; + JTextField read; + JButton buttonLoad; + JButton buttonDelete; + Runnable runableCodeListMyQueues; + Runnable runnableCodeDequeue; + + public ListenersOut(JTextField createQueue, JTextField queueCode, JTex= tField read, + JTextArea result, JButton buttonLoad, JButton butt= onDelete) { + this.queueCode =3D queueCode; + this.createQueue =3D createQueue; + this.read =3D read; + this.result =3D result; + this.buttonLoad =3D buttonLoad; + this.buttonDelete =3D buttonDelete; + } + + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() =3D=3D KeyEvent.VK_ENTER) { + this.result.setText(""); + this.createQueue.setEditable(false); + this.runableCodeListMyQueues =3D new RunnableReadQueue(this.cr= eateQueue, + this.queueCode, this.read, this.result); + Thread thread =3D new Thread(this.runableCodeListMyQueues); + thread.start(); + } + } + + public void keyReleased(KeyEvent e) { + //To change body of implemented methods use File | Settings | File= Templates. + } + + public void keyTyped(KeyEvent e) { + //To change body of implemented methods use File | Settings | File= Templates. + } + + public void actionPerformed(ActionEvent e) { + if (e.getActionCommand().equals("1")) { + this.runableCodeListMyQueues =3D new RunnableListMyQueues(this= .createQueue, this.queueCode, this.read, + this.result, this.buttonLoad); + Thread thread1 =3D new Thread(this.runableCodeListMyQueues); + thread1.start(); + this.createQueue.setEditable(true); + this.buttonLoad.setText("Running.."); + } + if (e.getActionCommand().equals("2")) { + this.buttonDelete.setText("Running"); + this.runnableCodeDequeue =3D new RunnableDeleteQueue(this.crea= teQueue, this.queueCode, this.read, + this.result, this.buttonDelete); + Thread thread2 =3D new Thread(this.runnableCodeDequeue); + thread2.start(); + } + } + + public void mouseDragged(MouseEvent e) { + String selectedText =3D this.result.getSelectedText(); + this.createQueue.setText(selectedText); + } + + public void mouseMoved(MouseEvent e) { + //To change body of implemented methods use File | Settings | File= Templates. + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/Read.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/Read.java?rev=3D179743&view= =3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/Read.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/Read.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,49 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService; + +import org.apache.axis.om.*; +import org.apache.axis.soap.SOAPFactory; + +/** + * This will create the OMElement needed to be used in invokeNonBlocking()= method + * Reading from a give queue is done according to queue name. QueueId can = also used. =20 + * + * @author Saminda Abeyruwan + */ +public class Read { + public static OMElement read(String requiredQueueName,String key) { + SOAPFactory factory =3D OMAbstractFactory.getSOAP11Factory(); + OMNamespace opN =3D factory.createOMNamespace( + "http://webservices.amazon.com/AWSSimpleQueueService/2005-= 01-01", "nsQ"); + OMElement read =3D factory.createOMElement("Read", opN); + OMElement subID =3D factory.createOMElement("SubscriptionId", opN)= ; + OMElement request =3D factory.createOMElement("Request", opN); + OMElement queueName =3D factory.createOMElement("QueueName", opN); + //OMElement queueID =3D factory.createOMElement("QueueId",opN); + OMElement readCount =3D factory.createOMElement("ReadCount", opN); + request.addChild(queueName); + //request.addChild(queueID); + request.addChild(readCount); + subID.addChild(factory.createText(key)); + queueName.addChild(factory.createText(requiredQueueName)); + //queueID.addChild(factory.createText(queueIden)); + readCount.addChild(factory.createText("25")); + read.addChild(subID); + read.addChild(request); + return read; + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/RunGUICQ.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/RunGUICQ.java?rev=3D179743&v= iew=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/RunGUICQ.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/RunGUICQ.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,28 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService; + +import sample.amazon.amazonSimpleQueueService.AmazonSimpleQueueServiceIn; + +/** + * @author Saminda Abeyruwan + */ +public class RunGUICQ { + public static void main(String[] args) { + AmazonSimpleQueueServiceIn queue =3D new AmazonSimpleQueueServiceI= n(); + queue.show(); + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/RunGUIRQ.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/RunGUIRQ.java?rev=3D179743&v= iew=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/RunGUIRQ.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/RunGUIRQ.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,28 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService; + +import sample.amazon.amazonSimpleQueueService.AmazonSimpleQueueServiceOut; + +/** + * @author Saminda Abeyruwan + */ +public class RunGUIRQ { + public static void main(String[] args) { + AmazonSimpleQueueServiceOut frame =3D new AmazonSimpleQueueService= Out(); + frame.show(); + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/key.properties URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/key.properties?rev=3D179743&= view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/key.properties (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/key.properties Fri Jun 3 01:12:48 2005 @@ -0,0 +1,4 @@ +# This is the subcription Id for the Amazon Simple Queue Web Service +# When a user need to run the sample through a new subcription Id=20 +# simply changed this value of the key/value pair.=20 +key=3D0HPJJ4GJDSG2TZ2C8X02 \ No newline at end of file Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/util/QueueManager.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/util/QueueManager.java?rev= =3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/QueueManager.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/QueueManager.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,47 @@ +package sample.amazon.amazonSimpleQueueService.util; + +import java.io.InputStream; +import java.util.Properties; + +/* + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed 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. + * + *=20 + */ +public class QueueManager { + + protected String getKeyFromPropertyFile() { + + + + Class clazz =3D new Object().getClass(); + InputStream stream =3D clazz.getResourceAsStream("/sample/amazon/a= mazonSimpleQueueService/key.properties"); + String key =3D null; + +// String userDir =3D System.getProperty("user.dir"); + +// String keyPathName =3D userDir + File.separator + "modules" + Fi= le.separator + "sample" +// + File.separator +// + "properties"; + Properties properties =3D new Properties(); + try { + properties.load(stream); + key =3D properties.getProperty("key"); + } catch (Exception e) { + e.printStackTrace(); + } + return key; + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/util/RunnableCreateQueue.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/util/RunnableCreateQueue.jav= a?rev=3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableCreateQueue.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableCreateQueue.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,89 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService.util; + +import org.apache.axis.om.OMElement; +import org.apache.axis.clientapi.Call; +import org.apache.axis.clientapi.Callback; +import org.apache.axis.addressing.EndpointReference; +import org.apache.axis.addressing.AddressingConstants; +import org.apache.axis.engine.AxisFault; +import org.apache.axis.Constants; + +import javax.swing.*; + +import sample.amazon.amazonSimpleQueueService.CreateQueue; +import sample.amazon.amazonSimpleQueueService.Enqueue; +import sample.amazon.amazonSimpleQueueService.CreateQueue; + +import java.io.File; +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.Properties; + +/** + * This will create the Excutable code which runs seperately of GUI intera= tions + * + * @author Saminda Abeyruwan + */ +public class RunnableCreateQueue extends QueueManager implements Runnable = { + JTextField createQueue; + JTextArea result; + JTextField queueCode; + JTextField enqueue; + + public RunnableCreateQueue(JTextField createQueue, JTextField queueCod= e, JTextField enqueue, + JTextArea result) { + this.createQueue =3D createQueue; + this.queueCode =3D queueCode; + this.enqueue =3D enqueue; + this.result =3D result; + } + + public void run() { + if (this.createQueue.isEditable()) { + OMElement createQueueElement =3D CreateQueue.creatQueueElement= ( + this.createQueue.getText(),getKeyFromPropertyFile()); + this.axis2EngineRuns("CreateQueue", createQueueElement, + new SimpleQueueCreateQueueCallbackHandler(this.createQ= ueue, this.queueCode, + this.enqueue, this.result)); + } + if (this.enqueue.isEditable()) { + OMElement enqueueElement =3D Enqueue.enqueueElement(this.enque= ue.getText(), + this.queueCode.getText(),getKeyFromPropertyFile()); + this.axis2EngineRuns("Enqueue", enqueueElement, new SimpleQueu= eEnqueueCallbackHandler( + this.createQueue, this.queueCode, this.enqueue, this.r= esult)); + } + } + + private void axis2EngineRuns(String operation, OMElement element, + Callback specificCallbackObject) { + //endpoint uri is hard coded.... + String url =3D "http://webservices.amazon.com/onca/soap?Service=3D= AWSSimpleQueueService"; + try { + Call call =3D new Call(); + call.setTo(new EndpointReference(AddressingConstants.WSA_TO, u= rl)); + call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRAN= SPORT_HTTP, false); + call.invokeNonBlocking(operation, element, specificCallbackObj= ect); + } catch (AxisFault axisFault) { + axisFault.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/util/RunnableDeleteQueue.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/util/RunnableDeleteQueue.jav= a?rev=3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableDeleteQueue.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableDeleteQueue.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,79 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService.util; + +import org.apache.axis.om.OMElement; +import org.apache.axis.clientapi.Callback; +import org.apache.axis.clientapi.Call; +import org.apache.axis.addressing.EndpointReference; +import org.apache.axis.addressing.AddressingConstants; +import org.apache.axis.Constants; +import org.apache.axis.engine.AxisFault; + +import javax.swing.*; + +import sample.amazon.amazonSimpleQueueService.DeleteQueue; +import sample.amazon.amazonSimpleQueueService.DeleteQueue; + +import java.io.File; +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.util.Properties; + +/** + * This will create the Excutable code which runs seperately of GUI intera= tions + * + * @author Saminda Abeyruwan + */ +public class RunnableDeleteQueue extends QueueManager implements Runnable = { + JTextField createQueue; + JTextArea result; + JTextField queueCode; + JTextField read; + JButton button; + + public RunnableDeleteQueue(JTextField createQueue, JTextField queueCod= e, JTextField read, + JTextArea result, JButton button) { + this.createQueue =3D createQueue; + this.queueCode =3D queueCode; + this.read =3D read; + this.result =3D result; + this.button =3D button; + } + + public void run() { + OMElement deleteQueueElement =3D DeleteQueue.deleteQueueElement(th= is.createQueue.getText(),getKeyFromPropertyFile()); + this.axis2EngineRuns("DeleteQueue", deleteQueueElement, + new SimpleQueueDeleteQueueCallbackHandler(this.result, thi= s=2Ebutton)); + } + + private void axis2EngineRuns(String operation, OMElement element, + Callback specificCallbackObject) { + //endpoint uri is hard coded.... + String url =3D "http://webservices.amazon.com/onca/soap?Service=3D= AWSSimpleQueueService"; + try { + Call call =3D new Call(); + call.setTo(new EndpointReference(AddressingConstants.WSA_TO, u= rl)); + call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRAN= SPORT_HTTP, false); + call.invokeNonBlocking(operation, element, specificCallbackObj= ect); + } catch (AxisFault axisFault) { + axisFault.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + =20 +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/util/RunnableListMyQueues.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/util/RunnableListMyQueues.ja= va?rev=3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableListMyQueues.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableListMyQueues.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,79 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService.util; + +import javax.swing.*; + +import org.apache.axis.om.OMElement; +import org.apache.axis.clientapi.Callback; +import org.apache.axis.clientapi.Call; +import org.apache.axis.addressing.EndpointReference; +import org.apache.axis.addressing.AddressingConstants; +import org.apache.axis.engine.AxisFault; +import org.apache.axis.Constants; +import sample.amazon.amazonSimpleQueueService.ListMyQueues; +import sample.amazon.amazonSimpleQueueService.ListMyQueues; + +import java.io.File; +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.util.Properties; + +/** + * This will create the Excutable code which runs seperately of GUI intera= tions + * + * @author Saminda Abeyruwan + */ +public class RunnableListMyQueues extends QueueManager implements Runnable= { + JTextField createQueue; + JTextArea result; + JTextField queueCode; + JTextField read; + JButton button; + + public RunnableListMyQueues(JTextField createQueue, JTextField queueCo= de, JTextField read, + JTextArea result, JButton button) { + this.createQueue =3D createQueue; + this.queueCode =3D queueCode; + this.read =3D read; + this.result =3D result; + this.button =3D button; + } + + public void run() { + OMElement listMyQueuesElement =3D ListMyQueues.queueListElement(ge= tKeyFromPropertyFile()); + this.axis2EngineRuns("ListMyQueues", listMyQueuesElement, + new SimpleQueueListMyQueuesCallbackHandler(this.createQueu= e, this.queueCode, + this.read, this.result, this.button)); + } + + private void axis2EngineRuns(String operation, OMElement element, + Callback specificCallbackObject) { + //endpoint uri is hard coded.... + String url =3D "http://webservices.amazon.com/onca/soap?Service=3D= AWSSimpleQueueService"; + try { + Call call =3D new Call(); + call.setTo(new EndpointReference(AddressingConstants.WSA_TO, u= rl)); + call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRAN= SPORT_HTTP, false); + call.invokeNonBlocking(operation, element, specificCallbackObj= ect); + } catch (AxisFault axisFault) { + axisFault.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + =20 +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/util/RunnableReadQueue.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/util/RunnableReadQueue.java?= rev=3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableReadQueue.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/RunnableReadQueue.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,76 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService.util; + +import javax.swing.*; + +import org.apache.axis.om.OMElement; +import org.apache.axis.clientapi.Callback; +import org.apache.axis.clientapi.Call; +import org.apache.axis.addressing.EndpointReference; +import org.apache.axis.addressing.AddressingConstants; +import org.apache.axis.engine.AxisFault; +import org.apache.axis.Constants; +import sample.amazon.amazonSimpleQueueService.Read; +import sample.amazon.amazonSimpleQueueService.Read; + +import java.io.File; +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.util.Properties; + +/** + * This will create the Excutable code which runs seperately of GUI intera= tions + * + * @author Saminda Abeyruwan + */ +public class RunnableReadQueue extends QueueManager implements Runnable { + JTextField createQueue; + JTextArea result; + JTextField queueCode; + JTextField read; + + public RunnableReadQueue(JTextField createQueue, JTextField queueCode,= JTextField read, + JTextArea result) { + this.createQueue =3D createQueue; + this.queueCode =3D queueCode; + this.read =3D read; + this.result =3D result; + } + + public void run() { + OMElement readQueueElement =3D Read.read(this.createQueue.getText(= ),getKeyFromPropertyFile()); + this.axis2EngineRuns("Read", readQueueElement, + new SimpleQueueReadCallbackHandler(this.queueCode, this.re= sult)); + } + + private void axis2EngineRuns(String operation, OMElement element, + Callback specificCallbackObject) { + //endpoint uri is hard coded.... + String url =3D "http://webservices.amazon.com/onca/soap?Service=3D= AWSSimpleQueueService"; + try { + Call call =3D new Call(); + call.setTo(new EndpointReference(AddressingConstants.WSA_TO, u= rl)); + call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRAN= SPORT_HTTP, false); + call.invokeNonBlocking(operation, element, specificCallbackObj= ect); + } catch (AxisFault axisFault) { + axisFault.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + =20 +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/util/SimpleQueueCreateQueueCallbackHandler.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/util/SimpleQueueCreateQueueC= allbackHandler.java?rev=3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueCreateQueueCallbackHandler.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueCreateQueueCallbackHandler.java Fri Jun 3 = 01:12:48 2005 @@ -0,0 +1,101 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService.util; + +import org.apache.axis.clientapi.Callback; +import org.apache.axis.clientapi.AsyncResult; +import org.apache.axis.om.OMElement; +import org.apache.axis.om.OMNode; +import org.apache.axis.soap.SOAPBody; + +import javax.swing.*; +import java.util.Iterator; +/** + * Callback class which deals with the outcome of the operation + * + * @author Saminda Abeyruwan + */ +public class SimpleQueueCreateQueueCallbackHandler extends Callback { + private static String returnString =3D ""; + private JTextField createQueue; + private JTextArea result; + private JTextField queueCode; + private JTextField enqueue; + + public SimpleQueueCreateQueueCallbackHandler() { + }//defaultConstructor + + public SimpleQueueCreateQueueCallbackHandler(JTextField createQueue, J= TextField queueCode, + JTextField enqueue, JText= Area result) { + super(); + this.createQueue =3D createQueue; + this.queueCode =3D queueCode; + this.enqueue =3D enqueue; + this.result =3D result; + } + + public void onComplete(AsyncResult result) { + SOAPBody body =3D result.getResponseEnvelope().getBody(); + getResults(body); + } + + public void reportError(Exception e) { + + } + + private boolean getResults(OMElement element) { + Iterator iterator =3D element.getChildren(); + while (iterator.hasNext()) { + OMNode omNode =3D (OMNode) iterator.next(); + if (omNode.getType() =3D=3D OMNode.ELEMENT_NODE) { + OMElement omElement =3D (OMElement) omNode; + if ((omElement.getLocalName().equals("Status")) + || (omElement.getLocalName().equals("QueueId"))) { + this.getText(omElement); + } else { + getResults(omElement); + } + } + } + return false; + } + + public static String getReturnString() { + return returnString; + } + + private void getText(OMElement element) { + if (element.getLocalName().equals("Status")) { + this.result.setText(element.getText() + "......."); + if (element.getText().equals("Success")) { + this.enqueue.setEditable(true); + returnString =3D returnString + "Successfully Added the ne= w Queue.." + + "[" + this.createQueue.getText() + "]" + "\n"; + this.result.setText(returnString); + } + if (element.getText().equals("Warnings")) { + this.enqueue.setEditable(true); + this.createQueue.setEditable(false); + returnString =3D returnString + "Enque the existing queue.= ." + + "[" + this.createQueue.getText() + "]" + "..Allow = Enquring data"; + this.result.setText(returnString); + } + } + if (element.getLocalName().equals("QueueId")) { + this.queueCode.setText(element.getText()); + } + } +} \ No newline at end of file Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/util/SimpleQueueDeleteQueueCallbackHandler.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/util/SimpleQueueDeleteQueueC= allbackHandler.java?rev=3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueDeleteQueueCallbackHandler.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueDeleteQueueCallbackHandler.java Fri Jun 3 = 01:12:48 2005 @@ -0,0 +1,72 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService.util; + +import org.apache.axis.clientapi.AsyncResult; +import org.apache.axis.clientapi.Callback; +import org.apache.axis.soap.SOAPBody; +import org.apache.axis.om.OMElement; +import org.apache.axis.om.OMNode; + +import javax.swing.*; +import java.util.Iterator; +/** + * Callback class which deals with the outcome of the operation + * @author Saminda Abeyruwan + * + */ +public class SimpleQueueDeleteQueueCallbackHandler extends Callback { + private String returnString =3D ""; + JTextArea results; + JButton button; + public SimpleQueueDeleteQueueCallbackHandler(){}//defalut handler + public SimpleQueueDeleteQueueCallbackHandler(JTextArea results,JButton= button){ + super(); + this.results =3D results; + this.button =3D button; + } + public void onComplete(AsyncResult result) { + SOAPBody body =3D result.getResponseEnvelope().getBody(); + this.getQueueDeleteStatus(body); + this.button.setText("Delete Queue"); + } + public void reportError(Exception e) { + + } + private void getQueueDeleteStatus(OMElement element) { + Iterator iterator =3D element.getChildren(); + while (iterator.hasNext()) { + OMNode omNode =3D (OMNode) iterator.next(); + if (omNode.getType() =3D=3D OMNode.ELEMENT_NODE) { + OMElement omElement =3D (OMElement) omNode; + if (omElement.getLocalName().equals("Status")) { + this.readTheQueue(omElement); + }else{ + getQueueDeleteStatus(omElement); + } + } + } + } + private void readTheQueue(OMElement element) { + if (element.getText().equals("Errors")) { + returnString +=3D "Queue can't be deleted, it has to be dequeu= ed first" + "\n"; + } + else{ + returnString +=3D "Queue is deleted" + "\n"; + } + this.results.setText(returnString + "\n"); + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/util/SimpleQueueEnqueueCallbackHandler.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/util/SimpleQueueEnqueueCallb= ackHandler.java?rev=3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueEnqueueCallbackHandler.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueEnqueueCallbackHandler.java Fri Jun 3 01:1= 2:48 2005 @@ -0,0 +1,94 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService.util; + +import org.apache.axis.clientapi.Callback; +import org.apache.axis.clientapi.AsyncResult; +import org.apache.axis.soap.SOAPBody; +import org.apache.axis.om.OMElement; +import org.apache.axis.om.OMNode; + +import javax.swing.*; +import java.util.Iterator; + +/** + * Callback class which deals with the outcome of the operation + * + * @author Saminda Abeyruwan + */ +public class SimpleQueueEnqueueCallbackHandler extends Callback { + private static String returnString =3D ""; + private JTextField createQueue; + private JTextArea result; + private JTextField queueCode; + private JTextField enqueue; + + public SimpleQueueEnqueueCallbackHandler() { + }//defaultConstructor + + public SimpleQueueEnqueueCallbackHandler(JTextField createQueue, JText= Field queueCode, + JTextField enqueue, JTextArea= result) { + super(); + this.createQueue =3D createQueue; + this.queueCode =3D queueCode; + this.enqueue =3D enqueue; + this.result =3D result; + } + + public void onComplete(AsyncResult result) { + SOAPBody body =3D result.getResponseEnvelope().getBody(); + getResults(body); + } + + public void reportError(Exception e) { + + } + + private boolean getResults(OMElement element) { + Iterator iterator =3D element.getChildren(); + while (iterator.hasNext()) { + OMNode omNode =3D (OMNode) iterator.next(); + if (omNode.getType() =3D=3D OMNode.ELEMENT_NODE) { + OMElement omElement =3D (OMElement) omNode; + if (omElement.getLocalName().equals("Status")) { + this.getText(omElement); + } else { + getResults(omElement); + } + } + } + return false; + } + + public static String getReturnString() { + return returnString; + } + + private void getText(OMElement element) { + if (element.getLocalName().equals("Status")) { + this.result.setText(element.getText() + "......."); + if (element.getText().equals("Success")) { + returnString =3D returnString + "Successfully Enqueued.." = + + "[" + this.enqueue.getText() + "]" + "..Queue.." += "[" + + this.createQueue.getText() + + "]" + + "\n"; + this.result.setText(returnString); + this.enqueue.setText(""); + } + } + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/util/SimpleQueueListMyQueuesCallbackHandler.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/util/SimpleQueueListMyQueues= CallbackHandler.java?rev=3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueListMyQueuesCallbackHandler.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueListMyQueuesCallbackHandler.java Fri Jun 3= 01:12:48 2005 @@ -0,0 +1,96 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService.util; + +import org.apache.axis.clientapi.AsyncResult; +import org.apache.axis.clientapi.Callback; +import org.apache.axis.soap.SOAPBody; +import org.apache.axis.om.OMElement; +import org.apache.axis.om.OMNode; + +import javax.swing.*; +import java.util.Iterator; + +/** + * Callback class which deals with the outcome of the operation + * + * @author Saminda Abeyruwan + */ +public class SimpleQueueListMyQueuesCallbackHandler extends Callback { + private String returnString =3D "Listing Available Queues......\n"; + private JTextField createQueue; + private JTextArea result; + private JTextField queueCode; + private JTextField read; + private JButton button; + + public SimpleQueueListMyQueuesCallbackHandler() { + }//defaultConstructor + + public SimpleQueueListMyQueuesCallbackHandler(JTextField createQueue, = JTextField queueCode, + JTextField read, JTextAr= ea result, + JButton button) { + super(); + this.createQueue =3D createQueue; + this.queueCode =3D queueCode; + this.read =3D read; + this.result =3D result; + this.button =3D button; + } + + public void onComplete(AsyncResult result) { + SOAPBody body =3D result.getResponseEnvelope().getBody(); + getResults(body); + this.button.setText("Load Queue"); + } + + public void reportError(Exception e) { + + } + + private boolean getResults(OMElement element) { + Iterator iterator =3D element.getChildren(); + while (iterator.hasNext()) { + OMNode omNode =3D (OMNode) iterator.next(); + if (omNode.getType() =3D=3D OMNode.ELEMENT_NODE) { + OMElement omElement =3D (OMElement) omNode; + if ((omElement.getLocalName().equals("QueueId")) + || (omElement.getLocalName().equals("QueueName")))= { + + if (omElement.getLocalName().equals("QueueId")) { + this.getText(omElement); + } + if (omElement.getLocalName().equals("QueueName")) { + this.getText(omElement); + } + + } else { + getResults(omElement); + } + } + } + return false; + } + + public String getReturnString() { + return this.returnString; + } + + private void getText(OMElement element) { + returnString =3D returnString + element.getText() + "\n"; + this.result.setText(returnString); + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazon= SimpleQueueService/util/SimpleQueueReadCallbackHandler.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/amazon/amazonSimpleQueueService/util/SimpleQueueReadCallback= Handler.java?rev=3D179743&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueReadCallbackHandler.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSim= pleQueueService/util/SimpleQueueReadCallbackHandler.java Fri Jun 3 01:12:4= 8 2005 @@ -0,0 +1,65 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed 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 sample.amazon.amazonSimpleQueueService.util; + +import org.apache.axis.clientapi.Callback; +import org.apache.axis.clientapi.AsyncResult; +import org.apache.axis.om.OMElement; +import org.apache.axis.om.OMNode; +import org.apache.axis.soap.SOAPBody; +import javax.swing.*; +import java.util.Iterator; +/** + * Callback class which deals with the outcome of the operation + * @author Saminda Abeyruwan + * + */ +public class SimpleQueueReadCallbackHandler extends Callback { + private String returnString =3D ""; + JTextField queueCode; + JTextArea results; + public SimpleQueueReadCallbackHandler(){}//defalut handler + public SimpleQueueReadCallbackHandler(JTextField queueCode, JTextArea = results){ + super(); + this.queueCode =3D queueCode; + this.results =3D results; + } + public void onComplete(AsyncResult result) { + SOAPBody body =3D result.getResponseEnvelope().getBody(); + this.getQueueEntryBody(body); + } + public void reportError(Exception e) { + + } + private void getQueueEntryBody(OMElement element) { + Iterator iterator =3D element.getChildren(); + while (iterator.hasNext()) { + OMNode omNode =3D (OMNode) iterator.next(); + if (omNode.getType() =3D=3D OMNode.ELEMENT_NODE) { + OMElement omElement =3D (OMElement) omNode; + if (omElement.getLocalName().equals("QueueEntryBody")) { + this.readTheQueue(omElement); + }else{ + getQueueEntryBody(omElement); + } + } + } + } + private void readTheQueue(OMElement element) { + returnString =3D returnString + element.getText() + "\n"; + this.results.setText(returnString + "\n"); + } +} Added: webservices/axis/trunk/java/modules/samples/src/sample/google/search= /AsynchronousClient.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/google/search/AsynchronousClient.java?rev=3D179743&view=3Dau= to =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/google/search/As= ynchronousClient.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/google/search/As= ynchronousClient.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,148 @@ + +package sample.google.search; + +import org.apache.axis.Constants; +import org.apache.axis.addressing.AddressingConstants; +import org.apache.axis.addressing.EndpointReference; +import org.apache.axis.clientapi.Call; +import org.apache.axis.context.MessageContext; +import org.apache.axis.description.OperationDescription; +import org.apache.axis.engine.AxisFault; + +import javax.xml.namespace.QName; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Properties; + +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed 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. + */ + + +public class AsynchronousClient { + + /** + * Query parameter + */ + protected static String search =3D ""; + + /** + * Query parameters sent with the last request + */ + protected static String prevSearch =3D ""; + + /** + * Have to increase and set the start index when asking for more r= esults + */ + protected static int StartIndex =3D 0; + + /** + * License key + */ + protected static String key; + + /** properties file to store the license key*/ + protected static Properties prop; + + /** maximum results per page */ + protected static String maxResults =3D String.valueOf(2); + + /**when this is set, thread sends a new request */ + protected static boolean doSearch =3D false; + + + + + + public static void main(String[] args) { + + LinkFollower page =3D new LinkFollower(); + LinkFollower.showURL =3D false; + + + GUIHandler gui =3D new GUIHandler(); + System.out.println(search); + prop =3D new Properties(); + + Class clazz =3D new Object().getClass(); + InputStream stream =3D clazz.getResourceAsStream("/sample/google/s= earch/key.properties"); + + + + + try { + prop.load(stream); + key =3D prop.getProperty("Key"); + if (key=3D=3Dnull) { + gui.setKey(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + gui.buildFrame(); + Thread linkThread =3D new Thread(page); + Thread guiThread =3D new Thread(gui); + + guiThread.start(); + linkThread.start(); + guiThread.run(); + linkThread.run(); + + } + + public AsynchronousClient() { + + } + + + public static void sendMsg() throws AxisFault { + + search.trim(); + prevSearch =3D search; + Call call =3D new Call(); + URL url =3D null; + try { + url =3D new URL("http", "api.google.com", "/search/beta2"); + //url =3D new URL("http", "localhost",8080, "/search/beta2"); + } catch (MalformedURLException e) { + + e.printStackTrace(); + System.exit(0); + } + + call.setTo(new EndpointReference(AddressingConstants.WSA_TO, url.t= oString())); + + + MessageContext requestContext =3D ClientUtil.getMessageContext(); + try { + call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRAN= SPORT_HTTP, false); + QName opName =3D new QName("urn:GoogleSearch", "doGoogleSearch= "); + OperationDescription opdesc =3D new OperationDescription(opNam= e); + call.invokeNonBlocking(opdesc, requestContext, new ClientCallb= ackHandler()); + } catch (AxisFault e1) { + e1.printStackTrace(); + } + } + + +} + + + Added: webservices/axis/trunk/java/modules/samples/src/sample/google/search= /ClientCallbackHandler.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samp= les/src/sample/google/search/ClientCallbackHandler.java?rev=3D179743&view= =3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/modules/samples/src/sample/google/search/Cl= ientCallbackHandler.java (added) +++ webservices/axis/trunk/java/modules/samples/src/sample/google/search/Cl= ientCallbackHandler.java Fri Jun 3 01:12:48 2005 @@ -0,0 +1,175 @@ +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed 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 sample.google.search; + + +import org.apache.axis.clientapi.AsyncResult; +import org.apache.axis.clientapi.Callback; +import org.apache.axis.om.OMElement; +import org.apache.axis.om.OMNamespace; +import org.apache.axis.om.OMNode; +import org.apache.axis.soap.SOAPEnvelope; + +import javax.xml.stream.FactoryConfigurationError; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; +import java.util.Iterator; + +/** + * This class implements the onComplete method extended by call back + * recieves the Response + * process the soap with OM to extract the data + * Find the element and get the text from it + * + * @author Gayan Asanka (gayan@opensource.lk) + */ +public class ClientCallbackHandler extends Callback { + + /** + * HTML Header to desplay snippet text + */ + private String beginHTML =3D "Wow"; + + /** + * HTML footer + */ + private String endHTML =3D ""; + + /** + * Store the texts read by NavigationURL of soap + */ + private String snippet =3D beginHTML; + + /** + * Store the URLs read by snippet element of soap + */ + private String strURL; + + /** + * Store texts temperaly + */ + private String tempStr; + + /** + * method onComplete + * + * @param result + */ + public void onComplete(AsyncResult result) { + //System.out.println("Responce message received to the ClientCallb= ackHandler ..."); + AsyncResult myResult =3D result; + extractDetails(myResult); + } + + /** + * method extractDetails + * Go through the children of soap + * stores requres information in variables + * Call to desplay the results + * + * @param result + */ + private void extractDetails(AsyncResult result) { + Iterator iterator,iterator2; + OMNode node; + OMElement body, operation, elem; + SOAPEnvelope resEnvelope; + + try { + XMLStreamWriter writer =3D XMLOutputFactory.newInstance().crea= teXMLStreamWriter( + System.out); + result.getResponseEnvelope().serialize(writer); + //part.serialize(writer,false); + writer.flush(); + + } catch (XMLStreamException e) { + // System.out.println("Error occured after responce is received= "); + e.printStackTrace(); + } catch (FactoryConfigurationError e) { + //System.out.println("Error occured after responce is received= "); + e.printStackTrace(); + } + resEnvelope =3D result.getResponseEnvelope(); + body =3D resEnvelope.getBody(); + operation =3D body.getFirstElement(); + + String opLocalName =3D operation.getLocalName(); + if (opLocalName.equals("Fault")) { + //System.out.println("A Fault message recieved, Check your Lic= ence key"); + snippet =3D + snippet + + "A Fault message recieved, Check your Licence key. Els= e you have reached the" + + " daily limit of 1000 requests"; + } else { + OMElement part =3D operation.getFirstElement(); + + iterator =3D part.getChildren(); + while (iterator.hasNext()) { + node =3D (OMNode) iterator.next(); + if (node.getType() =3D=3D OMNode.ELEMENT_NODE) { + elem =3D (OMElement) node; + String str =3D elem.getLocalName(); + //System.out.println(str); + if (str.equals("resultElements")) { + //System.out.println("Got the Result Elements"); + Iterator iterator0 =3D elem.getChildren(); + while (iterator0.hasNext()) { + node =3D (OMNode) iterator0.next(); + if (node.getType() =3D=3D OMNode.ELEMENT_NODE)= { + elem =3D (OMElement) node; + if (elem.getLocalName().equals("item")) { + iterator2 =3D elem.getChildren(); + while (iterator2.hasNext()) { + node =3D (OMNode) iterator2.next()= ; + if (node.getType() =3D=3D OMNode.E= LEMENT_NODE) { + elem =3D (OMElement) node; + String str3 =3D elem.getLocalN= ame(); + System.out.println(str3); + if (elem.getLocalName().equals= ("snippet")) { + //System.out.println("Got = the snippet"); + tempStr =3D elem.getText()= ; + + //System.out.println(tempS= tr); + snippet =3D snippet + temp= Str; + } + + if (elem.getLocalName().equals= ("URL")) { + //System.out.println("Got = the URL"); + strURL =3D elem.getText(); + } + } + } + } + snippet =3D snippet + "
URL:-" + strURL + + "

"; + } + } + } + } + } + } + snippet =3D snippet + endHTML; + //System.out.println(snippet); + + GUIHandler.showResults(snippet); + } + + public void reportError(Exception e) { + //System.out.println("Error occured after responce is received3"); + e.printStackTrace(); + } +} \ No newline at end of file