You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2008/11/03 22:07:21 UTC

svn commit: r710158 [19/20] - in /webservices/commons/trunk/modules/transport: ./ modules/base/ modules/base/src/main/java/org/apache/axis2/format/ modules/base/src/main/java/org/apache/axis2/transport/base/ modules/base/src/main/java/org/apache/axis2/...

Modified: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/jms/MockEchoEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/jms/MockEchoEndpoint.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/jms/MockEchoEndpoint.java (original)
+++ webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/jms/MockEchoEndpoint.java Mon Nov  3 13:07:13 2008
@@ -1,100 +1,100 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.axis2.transport.jms;
-
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.apache.axis2.transport.base.BaseConstants;
-import org.apache.axis2.transport.testkit.endpoint.InOutEndpoint;
-import org.apache.axis2.transport.testkit.endpoint.InOutEndpointSupport;
-import org.apache.axis2.transport.testkit.name.Name;
-import org.apache.axis2.transport.testkit.tests.Setup;
-import org.apache.axis2.transport.testkit.tests.TearDown;
-import org.apache.axis2.transport.testkit.tests.Transient;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-@Name("mock")
-public class MockEchoEndpoint extends InOutEndpointSupport implements InOutEndpoint, ExceptionListener {
-    static Log log = LogFactory.getLog(MockEchoEndpoint.class);
-    
-    private @Transient Connection connection;
-    private @Transient Connection replyConnection;
-    
-    @Setup @SuppressWarnings("unused")
-    private void setUp(JMSTestEnvironment env, JMSRequestResponseChannel channel) throws Exception {
-        Destination destination = channel.getDestination();
-        Destination replyDestination = channel.getReplyDestination();
-        connection = env.getConnectionFactory().createConnection();
-        connection.setExceptionListener(this);
-        connection.start();
-        replyConnection = env.getConnectionFactory().createConnection();
-        replyConnection.setExceptionListener(this);
-        final Session replySession = replyConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        final MessageProducer producer = replySession.createProducer(replyDestination);
-        MessageConsumer consumer = connection.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(destination);
-        consumer.setMessageListener(new MessageListener() {
-            public void onMessage(Message message) {
-                try {
-                    log.info("Message received: ID = " + message.getJMSMessageID());
-                    Message reply;
-                    if (message instanceof BytesMessage) {
-                        reply = replySession.createBytesMessage();
-                        IOUtils.copy(new BytesMessageInputStream((BytesMessage)message), new BytesMessageOutputStream((BytesMessage)reply));
-                    } else if (message instanceof TextMessage) {
-                        reply = replySession.createTextMessage();
-                        ((TextMessage)reply).setText(((TextMessage)message).getText());
-                    } else {
-                        // TODO
-                        throw new UnsupportedOperationException("Unsupported message type");
-                    }
-                    reply.setJMSCorrelationID(message.getJMSMessageID());
-                    reply.setStringProperty(BaseConstants.CONTENT_TYPE, message.getStringProperty(BaseConstants.CONTENT_TYPE));
-                    producer.send(reply);
-                    log.info("Message sent: ID = " + reply.getJMSMessageID());
-                } catch (Throwable ex) {
-                    fireEndpointError(ex);
-                }
-            }
-        });
-    }
-    
-    @TearDown @SuppressWarnings("unused")
-    private void tearDown() throws Exception {
-        connection.close();
-        replyConnection.close();
-    }
-
-    public void onException(JMSException ex) {
-        log.error("Exception received by JMS exception listener", ex);
-        fireEndpointError(ex);
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.axis2.transport.jms;
+
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import org.apache.axis2.transport.base.BaseConstants;
+import org.apache.axis2.transport.testkit.endpoint.InOutEndpoint;
+import org.apache.axis2.transport.testkit.endpoint.InOutEndpointSupport;
+import org.apache.axis2.transport.testkit.name.Name;
+import org.apache.axis2.transport.testkit.tests.Setup;
+import org.apache.axis2.transport.testkit.tests.TearDown;
+import org.apache.axis2.transport.testkit.tests.Transient;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+@Name("mock")
+public class MockEchoEndpoint extends InOutEndpointSupport implements InOutEndpoint, ExceptionListener {
+    static Log log = LogFactory.getLog(MockEchoEndpoint.class);
+    
+    private @Transient Connection connection;
+    private @Transient Connection replyConnection;
+    
+    @Setup @SuppressWarnings("unused")
+    private void setUp(JMSTestEnvironment env, JMSRequestResponseChannel channel) throws Exception {
+        Destination destination = channel.getDestination();
+        Destination replyDestination = channel.getReplyDestination();
+        connection = env.getConnectionFactory().createConnection();
+        connection.setExceptionListener(this);
+        connection.start();
+        replyConnection = env.getConnectionFactory().createConnection();
+        replyConnection.setExceptionListener(this);
+        final Session replySession = replyConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        final MessageProducer producer = replySession.createProducer(replyDestination);
+        MessageConsumer consumer = connection.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(destination);
+        consumer.setMessageListener(new MessageListener() {
+            public void onMessage(Message message) {
+                try {
+                    log.info("Message received: ID = " + message.getJMSMessageID());
+                    Message reply;
+                    if (message instanceof BytesMessage) {
+                        reply = replySession.createBytesMessage();
+                        IOUtils.copy(new BytesMessageInputStream((BytesMessage)message), new BytesMessageOutputStream((BytesMessage)reply));
+                    } else if (message instanceof TextMessage) {
+                        reply = replySession.createTextMessage();
+                        ((TextMessage)reply).setText(((TextMessage)message).getText());
+                    } else {
+                        // TODO
+                        throw new UnsupportedOperationException("Unsupported message type");
+                    }
+                    reply.setJMSCorrelationID(message.getJMSMessageID());
+                    reply.setStringProperty(BaseConstants.CONTENT_TYPE, message.getStringProperty(BaseConstants.CONTENT_TYPE));
+                    producer.send(reply);
+                    log.info("Message sent: ID = " + reply.getJMSMessageID());
+                } catch (Throwable ex) {
+                    fireEndpointError(ex);
+                }
+            }
+        });
+    }
+    
+    @TearDown @SuppressWarnings("unused")
+    private void tearDown() throws Exception {
+        connection.close();
+        replyConnection.close();
+    }
+
+    public void onException(JMSException ex) {
+        log.error("Exception received by JMS exception listener", ex);
+        fireEndpointError(ex);
+    }
+}

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/jms/MockEchoEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/jms/QpidTestEnvironment.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/jms/QpidTestEnvironment.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/jms/QpidTestEnvironment.java (original)
+++ webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/jms/QpidTestEnvironment.java Mon Nov  3 13:07:13 2008
@@ -1,77 +1,77 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.axis2.transport.jms;
-
-import javax.jms.Destination;
-import javax.jms.Queue;
-import javax.jms.Topic;
-
-import org.apache.axis2.transport.testkit.name.Name;
-import org.apache.axis2.transport.testkit.tests.Setup;
-import org.apache.axis2.transport.testkit.tests.TearDown;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.client.AMQConnectionFactory;
-import org.apache.qpid.client.AMQDestination;
-import org.apache.qpid.client.AMQQueue;
-import org.apache.qpid.client.AMQTopic;
-import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-@Name("qpid")
-public class QpidTestEnvironment extends JMSTestEnvironment {
-    private VirtualHost virtualHost;
-    
-    @Setup @SuppressWarnings("unused")
-    private void setUp() throws Exception {
-        TransportConnection.createVMBroker(1);
-        // null means the default virtual host
-        virtualHost = ApplicationRegistry.getInstance(1).getVirtualHostRegistry().getVirtualHost(null);
-    }
-
-    @TearDown @SuppressWarnings("unused")
-    private void tearDown() throws Exception {
-        TransportConnection.killVMBroker(1);
-    }
-
-    @Override
-    protected AMQConnectionFactory createConnectionFactory() throws Exception {
-        return new AMQConnectionFactory("vm://:1", "guest", "guest", "fred", "test");
-    }
-
-    @Override
-    public Queue createQueue(String name) throws AMQException {
-        QpidUtil.createQueue(virtualHost, ExchangeDefaults.DIRECT_EXCHANGE_NAME, name);
-        return new AMQQueue(ExchangeDefaults.DIRECT_EXCHANGE_NAME, name);
-    }
-
-    @Override
-    public Topic createTopic(String name) throws AMQException {
-        QpidUtil.createQueue(virtualHost, ExchangeDefaults.TOPIC_EXCHANGE_NAME, name);
-        return new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_NAME, name);
-    }
-
-    @Override
-    public void deleteDestination(Destination destination) throws Exception {
-        QpidUtil.deleteQueue(virtualHost, ((AMQDestination)destination).getDestinationName().asString());
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.axis2.transport.jms;
+
+import javax.jms.Destination;
+import javax.jms.Queue;
+import javax.jms.Topic;
+
+import org.apache.axis2.transport.testkit.name.Name;
+import org.apache.axis2.transport.testkit.tests.Setup;
+import org.apache.axis2.transport.testkit.tests.TearDown;
+import org.apache.qpid.AMQException;
+import org.apache.qpid.client.AMQConnectionFactory;
+import org.apache.qpid.client.AMQDestination;
+import org.apache.qpid.client.AMQQueue;
+import org.apache.qpid.client.AMQTopic;
+import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.exchange.ExchangeDefaults;
+import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.virtualhost.VirtualHost;
+
+@Name("qpid")
+public class QpidTestEnvironment extends JMSTestEnvironment {
+    private VirtualHost virtualHost;
+    
+    @Setup @SuppressWarnings("unused")
+    private void setUp() throws Exception {
+        TransportConnection.createVMBroker(1);
+        // null means the default virtual host
+        virtualHost = ApplicationRegistry.getInstance(1).getVirtualHostRegistry().getVirtualHost(null);
+    }
+
+    @TearDown @SuppressWarnings("unused")
+    private void tearDown() throws Exception {
+        TransportConnection.killVMBroker(1);
+    }
+
+    @Override
+    protected AMQConnectionFactory createConnectionFactory() throws Exception {
+        return new AMQConnectionFactory("vm://:1", "guest", "guest", "fred", "test");
+    }
+
+    @Override
+    public Queue createQueue(String name) throws AMQException {
+        QpidUtil.createQueue(virtualHost, ExchangeDefaults.DIRECT_EXCHANGE_NAME, name);
+        return new AMQQueue(ExchangeDefaults.DIRECT_EXCHANGE_NAME, name);
+    }
+
+    @Override
+    public Topic createTopic(String name) throws AMQException {
+        QpidUtil.createQueue(virtualHost, ExchangeDefaults.TOPIC_EXCHANGE_NAME, name);
+        return new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_NAME, name);
+    }
+
+    @Override
+    public void deleteDestination(Destination destination) throws Exception {
+        QpidUtil.deleteQueue(virtualHost, ((AMQDestination)destination).getDestinationName().asString());
+    }
+}

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/jms/QpidTestEnvironment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/jms/QpidUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/FlatLayout.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/GreenMailTestEnvironment.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/GreenMailTestEnvironment.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/GreenMailTestEnvironment.java (original)
+++ webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/GreenMailTestEnvironment.java Mon Nov  3 13:07:13 2008
@@ -1,154 +1,154 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.axis2.transport.mail;
-
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import javax.mail.Flags;
-
-import org.apache.axis2.transport.testkit.name.Key;
-import org.apache.axis2.transport.testkit.name.Name;
-import org.apache.axis2.transport.testkit.tests.Setup;
-import org.apache.axis2.transport.testkit.tests.TearDown;
-import org.apache.axis2.transport.testkit.tests.Transient;
-import org.apache.axis2.transport.testkit.util.LogManager;
-import org.apache.axis2.transport.testkit.util.ServerUtil;
-import org.apache.axis2.transport.testkit.util.tcpmon.Tunnel;
-
-import com.icegreen.greenmail.store.FolderListener;
-import com.icegreen.greenmail.store.MailFolder;
-import com.icegreen.greenmail.store.StoredMessage;
-import com.icegreen.greenmail.user.GreenMailUser;
-import com.icegreen.greenmail.util.GreenMail;
-import com.icegreen.greenmail.util.ServerSetup;
-
-@Name("greenmail")
-public class GreenMailTestEnvironment extends MailTestEnvironment {
-    private static final ServerSetup SMTP =
-            new ServerSetup(7025, "127.0.0.1", ServerSetup.PROTOCOL_SMTP);
-    
-    private static final ServerSetup POP3 =
-            new ServerSetup(7110, "127.0.0.1", ServerSetup.PROTOCOL_POP3);
-    
-    private static final ServerSetup IMAP =
-            new ServerSetup(7143, "127.0.0.1", ServerSetup.PROTOCOL_IMAP);
-    
-    private final String protocol;
-    private final ServerSetup storeServerSetup;
-    private @Transient LogManager logManager;
-    private @Transient GreenMail greenMail;
-    private @Transient Tunnel smtpTunnel;
-    private int accountNumber;
-    private @Transient List<Account> unallocatedAccounts;
-
-    public GreenMailTestEnvironment(String protocol) {
-        this.protocol = protocol;
-        if (protocol.equals("pop3")) {
-            storeServerSetup = POP3;
-        } else if (protocol.equals("imap")) {
-            storeServerSetup = IMAP;
-        } else {
-            throw new IllegalArgumentException();
-        }
-    }
-
-    @Setup @SuppressWarnings("unused")
-    private void setUp(LogManager logManager) throws Exception {
-        this.logManager = logManager;
-        greenMail = new GreenMail(new ServerSetup[] { SMTP, storeServerSetup });
-        greenMail.start();
-        smtpTunnel = new Tunnel(new InetSocketAddress("127.0.0.1", 7025));
-        smtpTunnel.start();
-        unallocatedAccounts = new LinkedList<Account>();
-        ServerUtil.waitForServer(SMTP.getPort());
-        ServerUtil.waitForServer(storeServerSetup.getPort());
-    }
-
-    @TearDown @SuppressWarnings("unused")
-    private void tearDown() throws Exception {
-        greenMail.stop();
-        accountNumber = 1;
-    }
-    
-    @Override
-    @Key("protocol")
-    public String getProtocol() {
-        return protocol;
-    }
-    
-    @Override
-    public Account allocateAccount() throws Exception {
-        if (unallocatedAccounts.isEmpty()) {
-            String login = "test" + accountNumber++;
-            GreenMailUser user = greenMail.setUser(login + "@localhost", login, "password");
-            final MailFolder inbox = greenMail.getManagers().getImapHostManager().getInbox(user);
-            inbox.addListener(new FolderListener() {
-                public void added(int msn) {
-                    StoredMessage storedMessage = (StoredMessage)inbox.getMessages().get(msn-1);
-                    try {
-                        OutputStream out = logManager.createLog("greenmail");
-                        try {
-                            storedMessage.getMimeMessage().writeTo(out);
-                        } finally {
-                            out.close();
-                        }
-                    } catch (Exception ex) {
-                        ex.printStackTrace();
-                    }
-                }
-
-                public void expunged(int msn) {}
-                public void flagsUpdated(int msn, Flags flags, Long uid) {}
-                public void mailboxDeleted() {}
-            });
-            return new Account(user.getEmail(), user.getLogin(), user.getPassword());
-        } else {
-            return unallocatedAccounts.remove(0);
-        }
-    }
-
-    @Override
-    public void freeAccount(Account account) {
-        unallocatedAccounts.add(account);
-    }
-
-    @Override
-    public Map<String,String> getInProperties(Account account) {
-        Map<String,String> props = new HashMap<String,String>();
-        props.put("mail." + protocol + ".host", "localhost");
-        props.put("mail." + protocol + ".port", String.valueOf(storeServerSetup.getPort()));
-        props.put("mail." + protocol + ".user", account.getLogin());
-        props.put("mail." + protocol + ".password", account.getPassword());
-        return props;
-    }
-    
-    @Override
-    public Map<String,String> getOutProperties() {
-        Map<String,String> props = new HashMap<String,String>();
-        props.put("mail.smtp.host", "localhost");
-        props.put("mail.smtp.port", String.valueOf(smtpTunnel.getPort()));
-        return props;
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.axis2.transport.mail;
+
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.mail.Flags;
+
+import org.apache.axis2.transport.testkit.name.Key;
+import org.apache.axis2.transport.testkit.name.Name;
+import org.apache.axis2.transport.testkit.tests.Setup;
+import org.apache.axis2.transport.testkit.tests.TearDown;
+import org.apache.axis2.transport.testkit.tests.Transient;
+import org.apache.axis2.transport.testkit.util.LogManager;
+import org.apache.axis2.transport.testkit.util.ServerUtil;
+import org.apache.axis2.transport.testkit.util.tcpmon.Tunnel;
+
+import com.icegreen.greenmail.store.FolderListener;
+import com.icegreen.greenmail.store.MailFolder;
+import com.icegreen.greenmail.store.StoredMessage;
+import com.icegreen.greenmail.user.GreenMailUser;
+import com.icegreen.greenmail.util.GreenMail;
+import com.icegreen.greenmail.util.ServerSetup;
+
+@Name("greenmail")
+public class GreenMailTestEnvironment extends MailTestEnvironment {
+    private static final ServerSetup SMTP =
+            new ServerSetup(7025, "127.0.0.1", ServerSetup.PROTOCOL_SMTP);
+    
+    private static final ServerSetup POP3 =
+            new ServerSetup(7110, "127.0.0.1", ServerSetup.PROTOCOL_POP3);
+    
+    private static final ServerSetup IMAP =
+            new ServerSetup(7143, "127.0.0.1", ServerSetup.PROTOCOL_IMAP);
+    
+    private final String protocol;
+    private final ServerSetup storeServerSetup;
+    private @Transient LogManager logManager;
+    private @Transient GreenMail greenMail;
+    private @Transient Tunnel smtpTunnel;
+    private int accountNumber;
+    private @Transient List<Account> unallocatedAccounts;
+
+    public GreenMailTestEnvironment(String protocol) {
+        this.protocol = protocol;
+        if (protocol.equals("pop3")) {
+            storeServerSetup = POP3;
+        } else if (protocol.equals("imap")) {
+            storeServerSetup = IMAP;
+        } else {
+            throw new IllegalArgumentException();
+        }
+    }
+
+    @Setup @SuppressWarnings("unused")
+    private void setUp(LogManager logManager) throws Exception {
+        this.logManager = logManager;
+        greenMail = new GreenMail(new ServerSetup[] { SMTP, storeServerSetup });
+        greenMail.start();
+        smtpTunnel = new Tunnel(new InetSocketAddress("127.0.0.1", 7025));
+        smtpTunnel.start();
+        unallocatedAccounts = new LinkedList<Account>();
+        ServerUtil.waitForServer(SMTP.getPort());
+        ServerUtil.waitForServer(storeServerSetup.getPort());
+    }
+
+    @TearDown @SuppressWarnings("unused")
+    private void tearDown() throws Exception {
+        greenMail.stop();
+        accountNumber = 1;
+    }
+    
+    @Override
+    @Key("protocol")
+    public String getProtocol() {
+        return protocol;
+    }
+    
+    @Override
+    public Account allocateAccount() throws Exception {
+        if (unallocatedAccounts.isEmpty()) {
+            String login = "test" + accountNumber++;
+            GreenMailUser user = greenMail.setUser(login + "@localhost", login, "password");
+            final MailFolder inbox = greenMail.getManagers().getImapHostManager().getInbox(user);
+            inbox.addListener(new FolderListener() {
+                public void added(int msn) {
+                    StoredMessage storedMessage = (StoredMessage)inbox.getMessages().get(msn-1);
+                    try {
+                        OutputStream out = logManager.createLog("greenmail");
+                        try {
+                            storedMessage.getMimeMessage().writeTo(out);
+                        } finally {
+                            out.close();
+                        }
+                    } catch (Exception ex) {
+                        ex.printStackTrace();
+                    }
+                }
+
+                public void expunged(int msn) {}
+                public void flagsUpdated(int msn, Flags flags, Long uid) {}
+                public void mailboxDeleted() {}
+            });
+            return new Account(user.getEmail(), user.getLogin(), user.getPassword());
+        } else {
+            return unallocatedAccounts.remove(0);
+        }
+    }
+
+    @Override
+    public void freeAccount(Account account) {
+        unallocatedAccounts.add(account);
+    }
+
+    @Override
+    public Map<String,String> getInProperties(Account account) {
+        Map<String,String> props = new HashMap<String,String>();
+        props.put("mail." + protocol + ".host", "localhost");
+        props.put("mail." + protocol + ".port", String.valueOf(storeServerSetup.getPort()));
+        props.put("mail." + protocol + ".user", account.getLogin());
+        props.put("mail." + protocol + ".password", account.getPassword());
+        return props;
+    }
+    
+    @Override
+    public Map<String,String> getOutProperties() {
+        Map<String,String> props = new HashMap<String,String>();
+        props.put("mail.smtp.host", "localhost");
+        props.put("mail.smtp.port", String.valueOf(smtpTunnel.getPort()));
+        return props;
+    }
+}

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/GreenMailTestEnvironment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/LogAspect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailAsyncClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailAxisTestClientConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailAxisTestClientConfigurator.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailAxisTestClientConfigurator.java (original)
+++ webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailAxisTestClientConfigurator.java Mon Nov  3 13:07:13 2008
@@ -1,42 +1,42 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.axis2.transport.mail;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.transport.testkit.axis2.client.AxisTestClientConfigurator;
-import org.apache.axis2.transport.testkit.name.Key;
-
-public class MailAxisTestClientConfigurator implements AxisTestClientConfigurator {
-    private final String transportFormat;
-    
-    public MailAxisTestClientConfigurator(String transportFormat) {
-        this.transportFormat = transportFormat;
-    }
-
-    @Key("layout")
-    public String getTransportFormat() {
-        return MailConstants.TRANSPORT_FORMAT_MP.equals(transportFormat) ? "multipart" : "flat";
-    }
-
-    public void setupRequestMessageContext(MessageContext msgContext) throws AxisFault {
-        msgContext.setProperty(MailConstants.TRANSPORT_MAIL_FORMAT, transportFormat);
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.axis2.transport.mail;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.testkit.axis2.client.AxisTestClientConfigurator;
+import org.apache.axis2.transport.testkit.name.Key;
+
+public class MailAxisTestClientConfigurator implements AxisTestClientConfigurator {
+    private final String transportFormat;
+    
+    public MailAxisTestClientConfigurator(String transportFormat) {
+        this.transportFormat = transportFormat;
+    }
+
+    @Key("layout")
+    public String getTransportFormat() {
+        return MailConstants.TRANSPORT_FORMAT_MP.equals(transportFormat) ? "multipart" : "flat";
+    }
+
+    public void setupRequestMessageContext(MessageContext msgContext) throws AxisFault {
+        msgContext.setProperty(MailConstants.TRANSPORT_MAIL_FORMAT, transportFormat);
+    }
+}

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailAxisTestClientConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailChannel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailMessageContextValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailRequestResponseClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailTestEnvironment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MailTransportTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MessageLayout.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/MultipartLayout.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/mail/ResponseListenerConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/udp/UDPTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/java/org/apache/axis2/transport/udp/UtilsUDPServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/tests/src/test/resources/META-INF/aop.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/transport/modules/udp/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/udp/pom.xml?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/udp/pom.xml (original)
+++ webservices/commons/trunk/modules/transport/modules/udp/pom.xml Mon Nov  3 13:07:13 2008
@@ -1,70 +1,70 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ 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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.axis2</groupId>
-        <artifactId>axis2-transport</artifactId>
-        <version>SNAPSHOT</version>
-        <relativePath>../parent/pom.xml</relativePath>
-    </parent>
-    <artifactId>axis2-transport-udp</artifactId>
-    <name>Apache Axis2 - Transport - UDP</name>
-    <description>UDP transport for Axis2</description>
-    <packaging>bundle</packaging>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <version>1.4.0</version>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Bundle-Version>1.0</Bundle-Version>
-                        <Bundle-Name>${pom.artifactId}</Bundle-Name>
-                        <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
-                        <Bundle-Description>${pom.description}</Bundle-Description>
-                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
-                        <Export-Package>
-                            org.apache.axis2.transport.udp.*;-split-package:=merge-last,
-                        </Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.axis2</groupId>
-            <artifactId>axis2-transport-base</artifactId>
-            <version>${transport.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-        </dependency>
-    </dependencies>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.axis2</groupId>
+        <artifactId>axis2-transport</artifactId>
+        <version>SNAPSHOT</version>
+        <relativePath>../parent/pom.xml</relativePath>
+    </parent>
+    <artifactId>axis2-transport-udp</artifactId>
+    <name>Apache Axis2 - Transport - UDP</name>
+    <description>UDP transport for Axis2</description>
+    <packaging>bundle</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>1.4.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Version>1.0</Bundle-Version>
+                        <Bundle-Name>${pom.artifactId}</Bundle-Name>
+                        <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+                        <Bundle-Description>${pom.description}</Bundle-Description>
+                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <Export-Package>
+                            org.apache.axis2.transport.udp.*;-split-package:=merge-last,
+                        </Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-transport-base</artifactId>
+            <version>${transport.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+        </dependency>
+    </dependencies>
+</project>

Propchange: webservices/commons/trunk/modules/transport/modules/udp/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/udp/src/main/java/org/apache/axis2/transport/udp/Endpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/udp/src/main/java/org/apache/axis2/transport/udp/IODispatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/udp/src/main/java/org/apache/axis2/transport/udp/UDPConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/udp/src/main/java/org/apache/axis2/transport/udp/UDPListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/udp/src/main/java/org/apache/axis2/transport/udp/UDPOutTransportInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/udp/src/main/java/org/apache/axis2/transport/udp/UDPSender.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/udp/src/main/java/org/apache/axis2/transport/udp/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/transport/modules/xmpp/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/xmpp/pom.xml?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/xmpp/pom.xml (original)
+++ webservices/commons/trunk/modules/transport/modules/xmpp/pom.xml Mon Nov  3 13:07:13 2008
@@ -1,111 +1,111 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ 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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.axis2</groupId>
-        <artifactId>axis2-transport</artifactId>
-        <version>SNAPSHOT</version>
-        <relativePath>../parent/pom.xml</relativePath>
-    </parent>
-    <artifactId>axis2-transport-xmpp</artifactId>
-    <name>Apache Axis2 - Transport - XMPP</name>
-    <description>This inclues all the available transports in Axis2 </description>
-    <packaging>bundle</packaging>
-
-    <build>
-        <sourceDirectory>src</sourceDirectory>
-        <testSourceDirectory>test</testSourceDirectory>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <version>1.4.0</version>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Bundle-Version>1.0</Bundle-Version>
-                        <Bundle-Name>${pom.artifactId}</Bundle-Name>
-                        <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
-                        <Bundle-Description>${pom.description}</Bundle-Description>
-                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
-                        <Export-Package>
-                            org.apache.axis2.transport.xmpp.*;-split-package:=merge-last,
-                        </Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-        <resources>
-            <resource>
-                <directory>conf</directory>
-                <excludes>
-                    <exclude>**/*.properties</exclude>
-                </excludes>
-                <filtering>false</filtering>
-            </resource>
-            <resource>
-                <directory>src</directory>
-                <excludes>
-                    <exclude>**/*.java</exclude>
-                </excludes>
-            </resource>
-        </resources>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-        </dependency>
-
-        <!-- Smack Jabber client libraries to be included -->
-        <dependency>
-            <groupId>org.igniterealtime</groupId>
-            <artifactId>smack</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.axis2</groupId>
+        <artifactId>axis2-transport</artifactId>
+        <version>SNAPSHOT</version>
+        <relativePath>../parent/pom.xml</relativePath>
+    </parent>
+    <artifactId>axis2-transport-xmpp</artifactId>
+    <name>Apache Axis2 - Transport - XMPP</name>
+    <description>This inclues all the available transports in Axis2 </description>
+    <packaging>bundle</packaging>
+
+    <build>
+        <sourceDirectory>src</sourceDirectory>
+        <testSourceDirectory>test</testSourceDirectory>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>1.4.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Version>1.0</Bundle-Version>
+                        <Bundle-Name>${pom.artifactId}</Bundle-Name>
+                        <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+                        <Bundle-Description>${pom.description}</Bundle-Description>
+                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <Export-Package>
+                            org.apache.axis2.transport.xmpp.*;-split-package:=merge-last,
+                        </Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+        <resources>
+            <resource>
+                <directory>conf</directory>
+                <excludes>
+                    <exclude>**/*.properties</exclude>
+                </excludes>
+                <filtering>false</filtering>
+            </resource>
+            <resource>
+                <directory>src</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </resource>
+        </resources>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+        </dependency>
+
+        <!-- Smack Jabber client libraries to be included -->
+        <dependency>
+            <groupId>org.igniterealtime</groupId>
+            <artifactId>smack</artifactId>
         </dependency>
         <dependency>
             <groupId>org.igniterealtime</groupId>
             <artifactId>smackx</artifactId>
-        </dependency>        
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-        </dependency>
-    </dependencies>
-    <repositories>
-        <repository>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>always</updatePolicy>
-            </releases>
-            <snapshots>
-                <enabled>true</enabled>
-                <updatePolicy>never</updatePolicy>
-            </snapshots>
-            <id>apache-ws-snapshots2</id>
-            <name>Apache ws.zones - 2</name>
-            <url>http://ws.zones.apache.org/repository2</url>
-        </repository>
-    </repositories>
-</project>
+        </dependency>        
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+        </dependency>
+    </dependencies>
+    <repositories>
+        <repository>
+            <releases>
+                <enabled>true</enabled>
+                <updatePolicy>always</updatePolicy>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+            </snapshots>
+            <id>apache-ws-snapshots2</id>
+            <name>Apache ws.zones - 2</name>
+            <url>http://ws.zones.apache.org/repository2</url>
+        </repository>
+    </repositories>
+</project>

Propchange: webservices/commons/trunk/modules/transport/modules/xmpp/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/XMPPListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/XMPPSender.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/XMPPSender.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/XMPPSender.java (original)
+++ webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/XMPPSender.java Mon Nov  3 13:07:13 2008
@@ -1,286 +1,286 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.transport.xmpp;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.description.WSDL2Constants;
-import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.axis2.transport.OutTransportInfo;
-import org.apache.axis2.transport.TransportSender;
-import org.apache.axis2.transport.xmpp.util.XMPPClientSidePacketListener;
-import org.apache.axis2.transport.xmpp.util.XMPPConnectionFactory;
-import org.apache.axis2.transport.xmpp.util.XMPPConstants;
-import org.apache.axis2.transport.xmpp.util.XMPPOutTransportInfo;
-import org.apache.axis2.transport.xmpp.util.XMPPServerCredentials;
-import org.apache.axis2.transport.xmpp.util.XMPPUtils;
-import org.apache.axis2.util.Utils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jivesoftware.smack.Chat;
-import org.jivesoftware.smack.ChatManager;
-import org.jivesoftware.smack.XMPPConnection;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.filter.PacketFilter;
-import org.jivesoftware.smack.filter.PacketTypeFilter;
-import org.jivesoftware.smack.packet.Message;
-import org.apache.axis2.description.AxisOperation;
-
-public class XMPPSender extends AbstractHandler implements TransportSender {
-	Log log = null;
-    XMPPConnectionFactory connectionFactory;
-    XMPPServerCredentials serverCredentials;    
-	
-    public XMPPSender() {
-        log = LogFactory.getLog(XMPPSender.class);
-    }
-    
-	public void cleanup(MessageContext msgContext) throws AxisFault {	
-	}
-
-    /**
-     * Initialize the transport sender by reading pre-defined connection factories for
-     * outgoing messages. These will create sessions (one per each destination dealt with)
-     * to be used when messages are being sent.
-     * @param confContext the configuration context
-     * @param transportOut the transport sender definition from axis2.xml
-     * @throws AxisFault on error
-     */	
-	public void init(ConfigurationContext confContext,
-			TransportOutDescription transportOut) throws AxisFault {
-		//if connection details are available from axis configuration
-		//use those & connect to jabber server(s)
-		serverCredentials = new XMPPServerCredentials();
-		getConnectionDetailsFromAxisConfiguration(transportOut);		
-		connectionFactory = new XMPPConnectionFactory();
-		connectionFactory.connect(serverCredentials);		
-	}
-
-	/**
-	 * Extract connection details from Client options
-	 * @param msgCtx
-	 */
-	private void connectUsingClientOptions(MessageContext msgCtx) throws AxisFault{		
-		getConnectionDetailsFromClientOptions(msgCtx);
-		connectionFactory = new XMPPConnectionFactory();
-		connectionFactory.connect(serverCredentials);
-	}
-	
-	public void stop() {}
-
-	public InvocationResponse invoke(MessageContext msgContext)
-			throws AxisFault {
-        String targetAddress = (String) msgContext.getProperty(
-                Constants.Configuration.TRANSPORT_URL);
-            if (targetAddress != null) {
-                sendMessage(msgContext, targetAddress, null);
-            } else if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
-                targetAddress = msgContext.getTo().getAddress();
-
-                if (!msgContext.getTo().hasNoneAddress()) {
-                    sendMessage(msgContext, targetAddress, null);
-                } else {
-                    //Don't send the message.
-                    return InvocationResponse.CONTINUE;
-                }
-            } else if (msgContext.isServerSide()) {
-                // get the out transport info for server side when target EPR is unknown
-                sendMessage(msgContext, null,
-                    (OutTransportInfo) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO));
-            }
-            return InvocationResponse.CONTINUE;
-	}
-
-    /**
-     * Send the given message over XMPP transport
-     *
-     * @param msgCtx the axis2 message context
-     * @throws AxisFault on error
-     */
-    public void sendMessage(MessageContext msgCtx, String targetAddress,
-        OutTransportInfo outTransportInfo) throws AxisFault {
-		XMPPConnection xmppConnection = null;
-		XMPPOutTransportInfo xmppOutTransportInfo = null;
-		
-		//if on client side,create connection to xmpp server
-		if(!msgCtx.isServerSide()){
-			connectUsingClientOptions(msgCtx);
-		}
-		
-		Message message = new Message();
-		Options options = msgCtx.getOptions();    	
-    	String serviceName = XMPPUtils.getServiceName(targetAddress);    	
-    	
-		if (targetAddress != null) {
-			xmppOutTransportInfo = new XMPPOutTransportInfo(targetAddress);
-			xmppOutTransportInfo.setConnectionFactory(connectionFactory);
-		} else if (msgCtx.getTo() != null &&
-				!msgCtx.getTo().hasAnonymousAddress()) {
-			//TODO 
-		} else if (msgCtx.isServerSide()) {
-			xmppOutTransportInfo = (XMPPOutTransportInfo)
-			msgCtx.getProperty(Constants.OUT_TRANSPORT_INFO);
-		}
-    	
-		xmppConnection = xmppOutTransportInfo.getConnectionFactory().getXmppConnection();    
-		
-		if(msgCtx.isServerSide()){
-			message.setProperty(XMPPConstants.IS_SERVER_SIDE, new Boolean(false));
-			message.setProperty(XMPPConstants.IN_REPLY_TO, xmppOutTransportInfo.getInReplyTo());
-		}else{			
-			message.setProperty(XMPPConstants.IS_SERVER_SIDE,new Boolean(true));
-			message.setProperty(XMPPConstants.SERVICE_NAME, serviceName);
-			String action = options.getAction();
-			if (action == null) {
-				AxisOperation axisOperation = msgCtx.getAxisOperation();
-				if (axisOperation != null) {
-					action = axisOperation.getSoapAction();
-				}
-			}
-			if (action != null) {
-				message.setProperty(XMPPConstants.ACTION, action);
-			}
-		}		
-    	if(xmppConnection == null){
-    		handleException("Connection to XMPP Server is not established.");    		
-    	}
-		
-		//initialize the chat manager using connection
-		ChatManager chatManager = xmppConnection.getChatManager();
-		Chat chat = chatManager.createChat(xmppOutTransportInfo.getDestinationAccount(), null);		
-		
-		try 
-		{
-			OMElement msgElement = msgCtx.getEnvelope();
-			//if (msgCtx.isDoingREST()) {
-			//	msgElement = msgCtx.getEnvelope().getBody().getFirstElement();
-			//}
-			boolean waitForResponse =
-				msgCtx.getOperationContext() != null &&
-				WSDL2Constants.MEP_URI_OUT_IN.equals(
-						msgCtx.getOperationContext().getAxisOperation().getMessageExchangePattern());
-			
-			
-			String soapMessage = msgElement.toString();
-			//int endOfXMLDeclaration = soapMessage.indexOf("?>");
-			//String modifiedSOAPMessage = soapMessage.substring(endOfXMLDeclaration+2);
-			message.setBody(soapMessage);	
-			
-			XMPPClientSidePacketListener xmppClientSidePacketListener = null;
-			if(waitForResponse && !msgCtx.isServerSide()){
-				PacketFilter filter = new PacketTypeFilter(message.getClass());				
-				xmppClientSidePacketListener = new XMPPClientSidePacketListener(msgCtx);
-				xmppConnection.addPacketListener(xmppClientSidePacketListener,filter);
-			}			
-
-			chat.sendMessage(message);
-			log.debug("Sent message :"+message.toXML());
-
-			//If this is on client side, wait for the response from server.
-			//Is this the best way to do this?
-			if(waitForResponse && !msgCtx.isServerSide()){
-				//TODO : need to add a timeout
-				while(! xmppClientSidePacketListener.isResponseReceived()){
-					try {
-						Thread.sleep(1000);
-					} catch (InterruptedException e) {
-						log.debug("Sleep interrupted",e);
-					}		
-				}
-				xmppConnection.disconnect();
-			}
-
-		} catch (XMPPException e) {
-			log.error("Error occurred while sending the message : "+message.toXML(),e);
-			handleException("Error occurred while sending the message : "+message.toXML(),e);
-		}finally{
-			if(!msgCtx.isServerSide()){
-				xmppConnection.disconnect();
-			}
-		}
-    }	
-    
-    
-    /**
-     * Extract connection details from axis2.xml's transportsender section
-     * @param serverCredentials
-     * @param transportOut
-     */
-    private void getConnectionDetailsFromAxisConfiguration(TransportOutDescription transportOut){
-    	if(transportOut != null){
-			Parameter serverUrl = transportOut.getParameter(XMPPConstants.XMPP_SERVER_URL);
-			if (serverUrl != null) {
-				serverCredentials.setServerUrl(Utils.getParameterValue(serverUrl));
-			}
-			
-			Parameter userName = transportOut.getParameter(XMPPConstants.XMPP_SERVER_USERNAME);
-			if (userName != null) {
-				serverCredentials.setAccountName(Utils.getParameterValue(userName));
-			}
-		
-			Parameter password = transportOut.getParameter(XMPPConstants.XMPP_SERVER_PASSWORD);
-			if (password != null) {
-				serverCredentials.setPassword(Utils.getParameterValue(password));
-			}
-
-			Parameter serverType = transportOut.getParameter(XMPPConstants.XMPP_SERVER_TYPE);			
-			if (serverType != null) {
-				serverCredentials.setServerType(Utils.getParameterValue(serverType));
-			}			
-		}
-	}
-	
-	/**
-	 * Extract connection details from client options
-	 * @param serverCredentials
-	 * @param msgContext
-	 */
-    private void getConnectionDetailsFromClientOptions(MessageContext msgContext){
-    	Options clientOptions = msgContext.getOptions();
-
-		if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_USERNAME) != null){
-			serverCredentials.setAccountName((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_USERNAME));
-		}
-		if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_PASSWORD) != null){
-			serverCredentials.setPassword((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_PASSWORD));
-		}
-		if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_URL) != null){
-			serverCredentials.setServerUrl((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_URL));
-		}
-		if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_TYPE) != null){
-			serverCredentials.setServerType((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_TYPE));
-		}		
-	}  
-	
-    private void handleException(String msg, Exception e) throws AxisFault {
-        log.error(msg, e);
-        throw new AxisFault(msg, e);
-    }
-    private void handleException(String msg) throws AxisFault {
-        log.error(msg);
-        throw new AxisFault(msg);
-    }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.xmpp;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.transport.OutTransportInfo;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.axis2.transport.xmpp.util.XMPPClientSidePacketListener;
+import org.apache.axis2.transport.xmpp.util.XMPPConnectionFactory;
+import org.apache.axis2.transport.xmpp.util.XMPPConstants;
+import org.apache.axis2.transport.xmpp.util.XMPPOutTransportInfo;
+import org.apache.axis2.transport.xmpp.util.XMPPServerCredentials;
+import org.apache.axis2.transport.xmpp.util.XMPPUtils;
+import org.apache.axis2.util.Utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jivesoftware.smack.Chat;
+import org.jivesoftware.smack.ChatManager;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.filter.PacketFilter;
+import org.jivesoftware.smack.filter.PacketTypeFilter;
+import org.jivesoftware.smack.packet.Message;
+import org.apache.axis2.description.AxisOperation;
+
+public class XMPPSender extends AbstractHandler implements TransportSender {
+	Log log = null;
+    XMPPConnectionFactory connectionFactory;
+    XMPPServerCredentials serverCredentials;    
+	
+    public XMPPSender() {
+        log = LogFactory.getLog(XMPPSender.class);
+    }
+    
+	public void cleanup(MessageContext msgContext) throws AxisFault {	
+	}
+
+    /**
+     * Initialize the transport sender by reading pre-defined connection factories for
+     * outgoing messages. These will create sessions (one per each destination dealt with)
+     * to be used when messages are being sent.
+     * @param confContext the configuration context
+     * @param transportOut the transport sender definition from axis2.xml
+     * @throws AxisFault on error
+     */	
+	public void init(ConfigurationContext confContext,
+			TransportOutDescription transportOut) throws AxisFault {
+		//if connection details are available from axis configuration
+		//use those & connect to jabber server(s)
+		serverCredentials = new XMPPServerCredentials();
+		getConnectionDetailsFromAxisConfiguration(transportOut);		
+		connectionFactory = new XMPPConnectionFactory();
+		connectionFactory.connect(serverCredentials);		
+	}
+
+	/**
+	 * Extract connection details from Client options
+	 * @param msgCtx
+	 */
+	private void connectUsingClientOptions(MessageContext msgCtx) throws AxisFault{		
+		getConnectionDetailsFromClientOptions(msgCtx);
+		connectionFactory = new XMPPConnectionFactory();
+		connectionFactory.connect(serverCredentials);
+	}
+	
+	public void stop() {}
+
+	public InvocationResponse invoke(MessageContext msgContext)
+			throws AxisFault {
+        String targetAddress = (String) msgContext.getProperty(
+                Constants.Configuration.TRANSPORT_URL);
+            if (targetAddress != null) {
+                sendMessage(msgContext, targetAddress, null);
+            } else if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
+                targetAddress = msgContext.getTo().getAddress();
+
+                if (!msgContext.getTo().hasNoneAddress()) {
+                    sendMessage(msgContext, targetAddress, null);
+                } else {
+                    //Don't send the message.
+                    return InvocationResponse.CONTINUE;
+                }
+            } else if (msgContext.isServerSide()) {
+                // get the out transport info for server side when target EPR is unknown
+                sendMessage(msgContext, null,
+                    (OutTransportInfo) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO));
+            }
+            return InvocationResponse.CONTINUE;
+	}
+
+    /**
+     * Send the given message over XMPP transport
+     *
+     * @param msgCtx the axis2 message context
+     * @throws AxisFault on error
+     */
+    public void sendMessage(MessageContext msgCtx, String targetAddress,
+        OutTransportInfo outTransportInfo) throws AxisFault {
+		XMPPConnection xmppConnection = null;
+		XMPPOutTransportInfo xmppOutTransportInfo = null;
+		
+		//if on client side,create connection to xmpp server
+		if(!msgCtx.isServerSide()){
+			connectUsingClientOptions(msgCtx);
+		}
+		
+		Message message = new Message();
+		Options options = msgCtx.getOptions();    	
+    	String serviceName = XMPPUtils.getServiceName(targetAddress);    	
+    	
+		if (targetAddress != null) {
+			xmppOutTransportInfo = new XMPPOutTransportInfo(targetAddress);
+			xmppOutTransportInfo.setConnectionFactory(connectionFactory);
+		} else if (msgCtx.getTo() != null &&
+				!msgCtx.getTo().hasAnonymousAddress()) {
+			//TODO 
+		} else if (msgCtx.isServerSide()) {
+			xmppOutTransportInfo = (XMPPOutTransportInfo)
+			msgCtx.getProperty(Constants.OUT_TRANSPORT_INFO);
+		}
+    	
+		xmppConnection = xmppOutTransportInfo.getConnectionFactory().getXmppConnection();    
+		
+		if(msgCtx.isServerSide()){
+			message.setProperty(XMPPConstants.IS_SERVER_SIDE, new Boolean(false));
+			message.setProperty(XMPPConstants.IN_REPLY_TO, xmppOutTransportInfo.getInReplyTo());
+		}else{			
+			message.setProperty(XMPPConstants.IS_SERVER_SIDE,new Boolean(true));
+			message.setProperty(XMPPConstants.SERVICE_NAME, serviceName);
+			String action = options.getAction();
+			if (action == null) {
+				AxisOperation axisOperation = msgCtx.getAxisOperation();
+				if (axisOperation != null) {
+					action = axisOperation.getSoapAction();
+				}
+			}
+			if (action != null) {
+				message.setProperty(XMPPConstants.ACTION, action);
+			}
+		}		
+    	if(xmppConnection == null){
+    		handleException("Connection to XMPP Server is not established.");    		
+    	}
+		
+		//initialize the chat manager using connection
+		ChatManager chatManager = xmppConnection.getChatManager();
+		Chat chat = chatManager.createChat(xmppOutTransportInfo.getDestinationAccount(), null);		
+		
+		try 
+		{
+			OMElement msgElement = msgCtx.getEnvelope();
+			//if (msgCtx.isDoingREST()) {
+			//	msgElement = msgCtx.getEnvelope().getBody().getFirstElement();
+			//}
+			boolean waitForResponse =
+				msgCtx.getOperationContext() != null &&
+				WSDL2Constants.MEP_URI_OUT_IN.equals(
+						msgCtx.getOperationContext().getAxisOperation().getMessageExchangePattern());
+			
+			
+			String soapMessage = msgElement.toString();
+			//int endOfXMLDeclaration = soapMessage.indexOf("?>");
+			//String modifiedSOAPMessage = soapMessage.substring(endOfXMLDeclaration+2);
+			message.setBody(soapMessage);	
+			
+			XMPPClientSidePacketListener xmppClientSidePacketListener = null;
+			if(waitForResponse && !msgCtx.isServerSide()){
+				PacketFilter filter = new PacketTypeFilter(message.getClass());				
+				xmppClientSidePacketListener = new XMPPClientSidePacketListener(msgCtx);
+				xmppConnection.addPacketListener(xmppClientSidePacketListener,filter);
+			}			
+
+			chat.sendMessage(message);
+			log.debug("Sent message :"+message.toXML());
+
+			//If this is on client side, wait for the response from server.
+			//Is this the best way to do this?
+			if(waitForResponse && !msgCtx.isServerSide()){
+				//TODO : need to add a timeout
+				while(! xmppClientSidePacketListener.isResponseReceived()){
+					try {
+						Thread.sleep(1000);
+					} catch (InterruptedException e) {
+						log.debug("Sleep interrupted",e);
+					}		
+				}
+				xmppConnection.disconnect();
+			}
+
+		} catch (XMPPException e) {
+			log.error("Error occurred while sending the message : "+message.toXML(),e);
+			handleException("Error occurred while sending the message : "+message.toXML(),e);
+		}finally{
+			if(!msgCtx.isServerSide()){
+				xmppConnection.disconnect();
+			}
+		}
+    }	
+    
+    
+    /**
+     * Extract connection details from axis2.xml's transportsender section
+     * @param serverCredentials
+     * @param transportOut
+     */
+    private void getConnectionDetailsFromAxisConfiguration(TransportOutDescription transportOut){
+    	if(transportOut != null){
+			Parameter serverUrl = transportOut.getParameter(XMPPConstants.XMPP_SERVER_URL);
+			if (serverUrl != null) {
+				serverCredentials.setServerUrl(Utils.getParameterValue(serverUrl));
+			}
+			
+			Parameter userName = transportOut.getParameter(XMPPConstants.XMPP_SERVER_USERNAME);
+			if (userName != null) {
+				serverCredentials.setAccountName(Utils.getParameterValue(userName));
+			}
+		
+			Parameter password = transportOut.getParameter(XMPPConstants.XMPP_SERVER_PASSWORD);
+			if (password != null) {
+				serverCredentials.setPassword(Utils.getParameterValue(password));
+			}
+
+			Parameter serverType = transportOut.getParameter(XMPPConstants.XMPP_SERVER_TYPE);			
+			if (serverType != null) {
+				serverCredentials.setServerType(Utils.getParameterValue(serverType));
+			}			
+		}
+	}
+	
+	/**
+	 * Extract connection details from client options
+	 * @param serverCredentials
+	 * @param msgContext
+	 */
+    private void getConnectionDetailsFromClientOptions(MessageContext msgContext){
+    	Options clientOptions = msgContext.getOptions();
+
+		if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_USERNAME) != null){
+			serverCredentials.setAccountName((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_USERNAME));
+		}
+		if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_PASSWORD) != null){
+			serverCredentials.setPassword((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_PASSWORD));
+		}
+		if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_URL) != null){
+			serverCredentials.setServerUrl((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_URL));
+		}
+		if (clientOptions.getProperty(XMPPConstants.XMPP_SERVER_TYPE) != null){
+			serverCredentials.setServerType((String)clientOptions.getProperty(XMPPConstants.XMPP_SERVER_TYPE));
+		}		
+	}  
+	
+    private void handleException(String msg, Exception e) throws AxisFault {
+        log.error(msg, e);
+        throw new AxisFault(msg, e);
+    }
+    private void handleException(String msg) throws AxisFault {
+        log.error(msg);
+        throw new AxisFault(msg);
+    }
 }
\ No newline at end of file

Propchange: webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/XMPPSender.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPClientSidePacketListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPOutTransportInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPPacketListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPServerCredentials.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/commons/trunk/modules/transport/modules/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native