This is an automated email from the ASF dual-hosted git repository.
robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git
The following commit(s) were added to refs/heads/master by this push:
new d31226a052 AXIS2-6106 Remove unmaintained XMPP transport module
d31226a052 is described below
commit d31226a052efe8e6bb1efb75220aeb6de26d8e99
Author: Robert Lazarski <[email protected]>
AuthorDate: Tue Apr 21 12:55:29 2026 -1000
AXIS2-6106 Remove unmaintained XMPP transport module
The XMPP transport depends on jivesoftware:smack (circa 2008) which
has not been updated in 18 years. The modern Smack library
(org.igniterealtime.smack 4.x) has a completely incompatible API.
No known users of Axis2 XMPP transport exist.
Removed:
- modules/transport/xmpp (14 source files)
- src/site/xdoc/docs/xmpp-transport.xml
- Dependencies from distribution, webapp, and apidocs POMs
- Module declaration from parent POM
- TOC entry from site docs
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
apidocs/pom.xml | 6 +-
modules/distribution/pom.xml | 20 +-
modules/transport/xmpp/pom.xml | 107 -----
.../apache/axis2/transport/xmpp/XMPPListener.java | 206 ---------
.../apache/axis2/transport/xmpp/XMPPSender.java | 512 ---------------------
.../transport/xmpp/sample/XMPPSampleClient.java | 54 ---
.../apache/axis2/transport/xmpp/sample/axis2.xml | 388 ----------------
.../xmpp/util/XMPPClientConnectionFactory.java | 206 ---------
.../xmpp/util/XMPPClientResponseManager.java | 98 ----
.../xmpp/util/XMPPClientSidePacketListener.java | 65 ---
.../transport/xmpp/util/XMPPConnectionFactory.java | 167 -------
.../axis2/transport/xmpp/util/XMPPConstants.java | 58 ---
.../transport/xmpp/util/XMPPOutTransportInfo.java | 94 ----
.../transport/xmpp/util/XMPPPacketListener.java | 341 --------------
.../transport/xmpp/util/XMPPServerCredentials.java | 91 ----
.../axis2/transport/xmpp/util/XMPPUtils.java | 79 ----
modules/webapp/pom.xml | 20 +-
pom.xml | 3 +-
src/site/xdoc/docs/toc.xml | 2 +-
src/site/xdoc/docs/xmpp-transport.xml | 78 ----
20 files changed, 6 insertions(+), 2589 deletions(-)
diff --git a/apidocs/pom.xml b/apidocs/pom.xml
index a8054337f7..f97be5b5a8 100644
--- a/apidocs/pom.xml
+++ b/apidocs/pom.xml
@@ -194,11 +194,7 @@
<artifactId>axis2-transport-udp</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>axis2-transport-xmpp</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <!-- AXIS2-6106: axis2-transport-xmpp removed -->
<!-- Artifacts that are needed to generate the Javadoc but that are
not transitive dependencies
because they are in scope "provided". -->
<dependency>
diff --git a/modules/distribution/pom.xml b/modules/distribution/pom.xml
index 5562c35ae2..727102a64c 100644
--- a/modules/distribution/pom.xml
+++ b/modules/distribution/pom.xml
@@ -214,25 +214,7 @@
<artifactId>axis2-transport-udp</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>axis2-transport-xmpp</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>jivesoftware</groupId>
- <artifactId>smack</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jivesoftware</groupId>
- <artifactId>smackx</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ <!-- AXIS2-6106: axis2-transport-xmpp removed -->
<!-- None of the Axis2 artifacts should have a dependency on log4j
because we don't want to impose a particular logging
implementation
diff --git a/modules/transport/xmpp/pom.xml b/modules/transport/xmpp/pom.xml
deleted file mode 100644
index 4f8119af4c..0000000000
--- a/modules/transport/xmpp/pom.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<?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
https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2</artifactId>
- <version>2.0.1-SNAPSHOT</version>
- <relativePath>../../../pom.xml</relativePath>
- </parent>
-
- <artifactId>axis2-transport-xmpp</artifactId>
- <packaging>jar</packaging>
-
- <name>Apache Axis2 - Transport - XMPP</name>
- <description>This inclues all the available transports in Axis2
</description>
- <url>http://axis.apache.org/axis2/java/core/</url>
-
- <scm>
-
<connection>scm:git:https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git</connection>
-
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git</developerConnection>
-
<url>https://gitbox.apache.org/repos/asf?p=axis-axis2-java-core.git;a=summary</url>
- <tag>HEAD</tag>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-kernel</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
-
- <!-- Smack Jabber client libraries to be included -->
- <dependency>
- <groupId>jivesoftware</groupId>
- <artifactId>smack</artifactId>
- <version>3.0.4</version>
- </dependency>
- <dependency>
- <groupId>jivesoftware</groupId>
- <artifactId>smackx</artifactId>
- <version>3.0.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <sourceDirectory>src</sourceDirectory>
- <testSourceDirectory>test</testSourceDirectory>
- <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>
- <plugins>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifestEntries>
- <!-- AXIS2-6040: Stable module name for Java 9+
JPMS -->
-
<Automatic-Module-Name>org.apache.axis2.transport.xmpp</Automatic-Module-Name>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/XMPPListener.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/XMPPListener.java
deleted file mode 100644
index ef46a70b25..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/XMPPListener.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * 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 java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.SessionContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.ParameterIncludeImpl;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.kernel.TransportListener;
-import org.apache.axis2.transport.xmpp.util.XMPPConnectionFactory;
-import org.apache.axis2.transport.xmpp.util.XMPPConstants;
-import org.apache.axis2.transport.xmpp.util.XMPPPacketListener;
-import org.apache.axis2.transport.xmpp.util.XMPPServerCredentials;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jivesoftware.smack.Roster;
-import org.jivesoftware.smack.XMPPConnection;
-import org.jivesoftware.smack.Roster.SubscriptionMode;
-
-
-public class XMPPListener implements TransportListener {
-
- /**
- Uncomment this enable XMPP logging, this is useful for testing.
- static {
- XMPPConnection.DEBUG_ENABLED = true;
- }
- **/
- private static Log log = LogFactory.getLog(XMPPListener.class);
- private ConfigurationContext configurationContext = null;
- private XMPPServerCredentials serverCredentials;
-
- /**
- * A Map containing the connection factories managed by this,
- * keyed by userName-at-jabberServerURL
- */
- private Map connectionFactories = new HashMap();
- private ExecutorService workerPool;
- private static final int WORKERS_MAX_THREADS = 5;
- private static final long WORKER_KEEP_ALIVE = 60L;
- private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
- private XMPPConnection xmppConnection = null;
-
-
-
- public XMPPListener() {
- }
-
- /**
- * Initializing the XMPPListener. Retrieve connection details provided in
- * xmpp transport receiver, connect to those servers & start listening in
- * for messages.
- */
- public void init(ConfigurationContext configurationCtx,
TransportInDescription transportIn)
- throws AxisFault {
- log.info("Initializing XMPPListener...");
- //allow anyone to send message to listening account
- Roster.setDefaultSubscriptionMode(SubscriptionMode.accept_all);
- configurationContext = configurationCtx;
- initializeConnectionFactories(transportIn);
- if (connectionFactories.isEmpty()) {
- log.warn("No XMPP connection factories defined." +
- "Will not listen for any XMPP messages");
- return;
- }
- }
-
- /**
- * Extract connection details & connect to those xmpp servers.
- * @see init(ConfigurationContext configurationCtx, TransportInDescription
transportIn)
- * @param configurationContext
- * @param transportIn
- */
- private void initializeConnectionFactories(TransportInDescription
transportIn) throws AxisFault{
- Iterator serversToListenOn = transportIn.getParameters().iterator();
- while (serversToListenOn.hasNext()) {
- Parameter connection = (Parameter) serversToListenOn.next();
- log.info("Trying to establish connection for :
"+connection.getName());
- ParameterIncludeImpl pi = new ParameterIncludeImpl();
- try {
- pi.deserializeParameters((OMElement) connection.getValue());
- } catch (AxisFault axisFault) {
- log.error("Error reading parameters");
- }
-
- Iterator params = pi.getParameters().iterator();
- serverCredentials = new XMPPServerCredentials();
-
- while (params.hasNext()) {
- Parameter param = (Parameter) params.next();
- if(XMPPConstants.XMPP_SERVER_URL.equals(param.getName())){
-
serverCredentials.setServerUrl((String)param.getValue());
- }else
if(XMPPConstants.XMPP_SERVER_USERNAME.equals(param.getName())){
-
serverCredentials.setAccountName((String)param.getValue());
- }else
if(XMPPConstants.XMPP_SERVER_PASSWORD.equals(param.getName())){
-
serverCredentials.setPassword((String)param.getValue());
- }else
if(XMPPConstants.XMPP_SERVER_TYPE.equals(param.getName())){
-
serverCredentials.setServerType((String)param.getValue());
- }else
if(XMPPConstants.XMPP_DOMAIN_NAME.equals(param.getName())){
-
serverCredentials.setDomainName((String)param.getValue());
- }
- }
- XMPPConnectionFactory xmppConnectionFactory = new
XMPPConnectionFactory();
- xmppConnectionFactory.connect(serverCredentials);
-
- connectionFactories.put(serverCredentials.getAccountName() + "@"
- + serverCredentials.getServerUrl(),
xmppConnectionFactory);
- }
- }
-
- /**
- * Stop XMPP listener & disconnect from all XMPP Servers
- */
- public void stop() {
- if (workerPool != null && !workerPool.isShutdown()) {
- workerPool.shutdown();
- }
- //TODO : Iterate through all connections in connectionFactories & call
disconnect()
- }
-
- /**
- * Returns Default EPR for a given Service name & IP
- * @param serviceName
- * @param ip
- */
- public EndpointReference getEPRForService(String serviceName, String ip)
throws AxisFault {
- return getEPRsForService(serviceName, ip)[0];
- }
-
- /**
- * Returns all EPRs for a given Service name & IP
- * @param serviceName
- * @param ip
- */
- public EndpointReference[] getEPRsForService(String serviceName, String
ip) throws AxisFault {
- String domainName = serverCredentials.getDomainName() != null?
serverCredentials.getDomainName()
- : serverCredentials.getServerUrl();
- return new EndpointReference[]{new
EndpointReference(XMPPConstants.XMPP_PREFIX +
- serverCredentials.getAccountName() +"@"+ domainName
+"/services/" + serviceName)};
- }
-
-
- public SessionContext getSessionContext(MessageContext messageContext) {
- return null;
- }
-
- public void destroy() {
- if(xmppConnection != null && xmppConnection.isConnected()){
- xmppConnection.disconnect();
- }
- }
-
- /**
- * Start a pool of Workers. For each connection in connectionFactories,
- * assign a packer listener. This packet listener will trigger when a
- * message arrives.
- */
- public void start() throws AxisFault {
- // create thread pool of workers
- ExecutorService workerPool = new ThreadPoolExecutor(
- 1,
- WORKERS_MAX_THREADS, WORKER_KEEP_ALIVE, TIME_UNIT,
- new LinkedBlockingQueue(),
- new org.apache.axis2.util.threadpool.DefaultThreadFactory(
- new ThreadGroup("XMPP Worker thread group"),
- "XMPPWorker"));
-
- Iterator iter = connectionFactories.values().iterator();
- while (iter.hasNext()) {
- XMPPConnectionFactory connectionFactory = (XMPPConnectionFactory)
iter.next();
- XMPPPacketListener xmppPacketListener =
- new
XMPPPacketListener(connectionFactory,this.configurationContext,workerPool);
- connectionFactory.listen(xmppPacketListener);
- }
- }
-}
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/XMPPSender.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/XMPPSender.java
deleted file mode 100644
index 5126f6eeb1..0000000000
--- a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/XMPPSender.java
+++ /dev/null
@@ -1,512 +0,0 @@
-/*
- * 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.axiom.soap.SOAP12Version;
-import org.apache.axiom.soap.SOAPVersion;
-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.AxisMessage;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-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.kernel.OutTransportInfo;
-import org.apache.axis2.kernel.TransportSender;
-import org.apache.axis2.kernel.http.HTTPConstants;
-import org.apache.axis2.transport.xmpp.util.XMPPClientResponseManager;
-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.axis2.wsdl.WSDLConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ws.commons.schema.*;
-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 javax.xml.namespace.QName;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.UUID;
-
-public class XMPPSender extends AbstractHandler implements TransportSender {
- static Log log = null;
-
- XMPPServerCredentials serverCredentials;
- private XMPPClientResponseManager xmppClientSidePacketListener;
- private XMPPConnectionFactory defaultConnectionFactory;
-
- public XMPPSender() {
- log = LogFactory.getLog(XMPPSender.class);
- xmppClientSidePacketListener = new XMPPClientResponseManager();
- }
-
- 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);
-
- defaultConnectionFactory = new XMPPConnectionFactory();
- }
-
-
- 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;
- XMPPConnectionFactory connectionFactory;
-
- //if on client side,create connection to xmpp server
- if(msgCtx.isServerSide()){
- xmppOutTransportInfo =
(XMPPOutTransportInfo)msgCtx.getProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO);
- connectionFactory =
xmppOutTransportInfo.getConnectionFactory();
- }else{
- getConnectionDetailsFromClientOptions(msgCtx);
- connectionFactory = defaultConnectionFactory;
- }
-
- synchronized (this) {
- xmppConnection = connectionFactory.getXmppConnection();
- if(xmppConnection == null){
- connectionFactory.connect(serverCredentials);
- xmppConnection = connectionFactory.getXmppConnection();
- }
- }
-
- Message message = new Message();
- Options options = msgCtx.getOptions();
- String serviceName = XMPPUtils.getServiceName(targetAddress);
-
- SOAPVersion version = msgCtx.getEnvelope().getVersion();
- if(version instanceof SOAP12Version){
- message.setProperty(XMPPConstants.CONTENT_TYPE,
HTTPConstants.MEDIA_TYPE_APPLICATION_SOAP_XML+ "; action="+
msgCtx.getSoapAction());
- }else{
- message.setProperty(XMPPConstants.CONTENT_TYPE,
HTTPConstants.MEDIA_TYPE_TEXT_XML);
- }
-
-
- if (targetAddress != null) {
- xmppOutTransportInfo = new
XMPPOutTransportInfo(targetAddress);
-
xmppOutTransportInfo.setConnectionFactory(defaultConnectionFactory);
- } else if (msgCtx.getTo() != null &&
- !msgCtx.getTo().hasAnonymousAddress()) {
- //TODO
- } else if (msgCtx.isServerSide()) {
- xmppOutTransportInfo = (XMPPOutTransportInfo)
- msgCtx.getProperty(Constants.OUT_TRANSPORT_INFO);
- }
- try{
- if(msgCtx.isServerSide()){
- message.setProperty(XMPPConstants.IS_SERVER_SIDE, new
Boolean(false));
- message.setProperty(XMPPConstants.IN_REPLY_TO,
xmppOutTransportInfo.getInReplyTo());
- message.setProperty(XMPPConstants.SEQUENCE_ID,
xmppOutTransportInfo.getSequenceID());
- }else{
- //message is going to be processed on server side
- message.setProperty(XMPPConstants.IS_SERVER_SIDE,new
Boolean(true));
- //we are sending a soap envelope as a message
-
message.setProperty(XMPPConstants.CONTAINS_SOAP_ENVELOPE, 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);
-
- boolean waitForResponse =
- msgCtx.getOperationContext() != null &&
- WSDL2Constants.MEP_URI_OUT_IN.equals(
-
msgCtx.getOperationContext().getAxisOperation().getMessageExchangePattern());
-
- OMElement msgElement;
- String messageToBeSent = "";
-
-
if(XMPPConstants.XMPP_CONTENT_TYPE_STRING.equals(xmppOutTransportInfo.getContentType())){
- //if request is received from a chat client,
whole soap envelope
- //should not be sent.
- OMElement soapBodyEle =
msgCtx.getEnvelope().getBody();
- OMElement responseEle =
soapBodyEle.getFirstElement();
- if(responseEle != null){
- msgElement =
responseEle.getFirstElement();
- }else{
- msgElement = responseEle;
- }
- }else{
- //if request received from a ws client whole
soap envelope
- //must be sent.
- msgElement = msgCtx.getEnvelope();
- }
- messageToBeSent = msgElement.toString();
- message.setBody(messageToBeSent);
-
- String key = null;
- if(waitForResponse && !msgCtx.isServerSide()){
- PacketFilter filter = new
PacketTypeFilter(message.getClass());
-
xmppConnection.addPacketListener(xmppClientSidePacketListener,filter);
- key = UUID.randomUUID().toString();
-
xmppClientSidePacketListener.listenForResponse(key, msgCtx);
- message.setProperty(XMPPConstants.SEQUENCE_ID,
key);
- }
-
- 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()){
- xmppClientSidePacketListener.waitFor(key);
- //xmppConnection.disconnect();
- log.debug("Received response sucessfully");
- }
-
-
- } catch (XMPPException e) {
- log.error("Error occurred while sending the message :
"+message.toXML(),e);
- handleException("Error occurred while sending the
message : "+message.toXML(),e);
- } catch (InterruptedException e) {
- log.error("Error occurred while sending the message :
"+message.toXML(),e);
- handleException("Error occurred while sending the message :
"+message.toXML(),e);
- }finally{
-// if(xmppConnection != null && !msgCtx.isServerSide()){
-// xmppConnection.disconnect();
-// }
- }
- }
-
- /**
- * Process message requests that came in through chat clients
- * @param msgCtx
- * @throws AxisFault
- */
- public static void processChatMessage(MessageContext msgCtx) throws
AxisFault {
- Object obj = msgCtx.getProperty(XMPPConstants.MESSAGE_FROM_CHAT);
- if(obj != null){
- String message = (String)obj;
- String response = "";
-
- if(message.trim().startsWith("help")){
- response = prepareHelpTextForChat();
- }else if(message.trim().startsWith("listServices")){
- response = prepareServicesList(msgCtx);
- }else if (message.trim().startsWith("getOperations")){
- response = prepareOperationList(msgCtx,message);
- }else{
- //TODO add support for more help commands
- }
- sendChatMessage(msgCtx,response);
- }
- }
-
- /**
- * Prepares a list of service names deployed in current runtime
- * @param msgCtx
- * @return
- */
- private static String prepareOperationList(MessageContext msgCtx,String
chatMessage) {
- StringBuffer sb = new StringBuffer();
- //extract service name
- String serviceName = chatMessage.replace("getOperations", "");
- serviceName = serviceName.replaceAll(" ", "");
- if(log.isDebugEnabled()){
- log.debug("Finding operations for service :"+
serviceName);
- }
-
- try {
- AxisService service =
msgCtx.getConfigurationContext().getAxisConfiguration().getService(serviceName);
- Iterator itrOperations = service.getOperations();
- int index = 1;
- while(itrOperations.hasNext()){
- AxisOperation operation =
(AxisOperation)itrOperations.next();
- String parameterList =
getParameterListForOperation(operation);
- sb.append(index
+"."+operation.getName().getLocalPart()+"("+parameterList+")"+"\n");
- index++;
- }
- } catch (AxisFault e) {
- log.error("Error occurred while retreiving AxisService
: "+serviceName,e);
- sb.append("Error occurred while retrieving operations
for service : "+serviceName);
- }
- return sb.toString();
- }
-
- /**
- * Retrieves list of parameter names & their type for a given operation
- * @param operation
- */
- private static String getParameterListForOperation(AxisOperation
operation) {
- //Logic copied from BuilderUtil.buildsoapMessage(...)
- StringBuffer paramList = new StringBuffer();
- AxisMessage axisMessage =
- operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- XmlSchemaElement xmlSchemaElement =
axisMessage.getSchemaElement();
- if(xmlSchemaElement != null){
- XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
- if (schemaType instanceof XmlSchemaComplexType) {
- XmlSchemaComplexType complexType =
((XmlSchemaComplexType)schemaType);
- XmlSchemaParticle particle = complexType.getParticle();
- if (particle instanceof XmlSchemaSequence || particle
instanceof XmlSchemaAll) {
-
- if (particle instanceof XmlSchemaSequence) {
- XmlSchemaSequence sequence = (XmlSchemaSequence)
particle;
- for (XmlSchemaSequenceMember member :
sequence.getItems()) {
- XmlSchemaElement innerElement = (XmlSchemaElement)
member;
- QName qName = innerElement.getQName();
- if (qName == null &&
innerElement.getSchemaTypeName()
-
.equals(org.apache.ws.commons.schema.constants.Constants.XSD_ANYTYPE)) {
- break;
- }
- String name =
- qName != null ? qName.getLocalPart() :
innerElement.getName();
- String type =
innerElement.getSchemaTypeName().toString();
- paramList.append(","+type +" " +name);
- }
- } else {
- XmlSchemaAll xmlSchemaAll = (XmlSchemaAll) particle;
- for (XmlSchemaAllMember member :
xmlSchemaAll.getItems()) {
- XmlSchemaElement
innerElement = (XmlSchemaElement) member;
- QName qName = innerElement.getQName();
- if (qName == null &&
innerElement.getSchemaTypeName()
-
.equals(org.apache.ws.commons.schema.constants.Constants.XSD_ANYTYPE)) {
- break;
- }
- String name =
- qName != null ? qName.getLocalPart() :
innerElement.getName();
- String type =
innerElement.getSchemaTypeName().toString();
- paramList.append("," + type + " " + name);
- }
- }
- }
- }
- }
- //remove first ","
- String list = paramList.toString();
- return list.replaceFirst(",", "");
- }
-
-
- /**
- * Prepares a list of service names deployed in current runtime
- * @param msgCtx
- * @return
- */
- private static String prepareServicesList(MessageContext msgCtx) {
- Map services =
msgCtx.getConfigurationContext().getAxisConfiguration().getServices();
- StringBuffer sb = new StringBuffer();
- if(services != null && services.size() > 0){
- Iterator itrServiceNames =
services.keySet().iterator();
- int index = 1;
- while (itrServiceNames.hasNext()) {
- String serviceName = (String)
itrServiceNames.next();
- sb.append(index+"."+serviceName+"\n");
- index++;
- }
- }
- return sb.toString();
- }
-
-
- /**
- * Generate help text for chat client
- * @return {@link String}
- */
- private static String prepareHelpTextForChat(){
- StringBuffer helpText = new StringBuffer();
- helpText.append("Following commands are supported :"+"\n");
- helpText.append("-----------------------------------"+"\n");
- helpText.append("1. listServices"+"\n");
- helpText.append("2. getOperations <service-name>"+"\n");
- helpText.append("3. call
<service-name>:<operation>(<param1>,<param2>,...)"+"\n");
- return helpText.toString();
- }
-
- /**
- * Replies to IM clients via a chat message. The reply contains the
invocation response as a string.
- * @param msgCtx
- * @param responseMsg
- * @throws AxisFault
- */
- private static void sendChatMessage(MessageContext msgCtx,String
responseMsg) throws AxisFault {
- XMPPConnection xmppConnection = null;
- XMPPOutTransportInfo xmppOutTransportInfo = null;
- Message message = new Message();
-
- xmppOutTransportInfo =
(XMPPOutTransportInfo)msgCtx.getProperty(Constants.OUT_TRANSPORT_INFO);
- if(xmppOutTransportInfo != null){
- message.setProperty(XMPPConstants.IN_REPLY_TO,
xmppOutTransportInfo.getInReplyTo());
- xmppConnection =
xmppOutTransportInfo.getConnectionFactory().getXmppConnection();
- if(xmppConnection == null){
- handleException("Connection to XMPP Server is
not established.");
- }
- }else{
- handleException("Could not find message sender
details.");
- }
-
- //initialize the chat manager using connection
- ChatManager chatManager = xmppConnection.getChatManager();
- Chat chat =
chatManager.createChat(xmppOutTransportInfo.getDestinationAccount(), null);
- try{
- message.setProperty(XMPPConstants.SEQUENCE_ID,
- xmppOutTransportInfo.getSequenceID());
- message.setBody(responseMsg);
- chat.sendMessage(message);
- log.debug("Sent message :"+message.toXML());
- } catch (XMPPException e) {
- XMPPSender.handleException("Error occurred while
sending the message : "+message.toXML(),e);
- }
- }
-
- /**
- * 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));
- }
-
- Parameter domainName =
transportOut.getParameter(XMPPConstants.XMPP_DOMAIN_NAME);
- if (serverUrl != null) {
-
serverCredentials.setDomainName(Utils.getParameterValue(domainName));
- }
- }
- }
-
- /**
- * 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 static void handleException(String msg, Exception e) throws
AxisFault {
- log.error(msg, e);
- throw new AxisFault(msg, e);
- }
- private static void handleException(String msg) throws AxisFault {
- log.error(msg);
- throw new AxisFault(msg);
- }
-}
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/sample/XMPPSampleClient.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/sample/XMPPSampleClient.java
deleted file mode 100644
index 4791beeb0f..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/sample/XMPPSampleClient.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.axis2.transport.xmpp.sample;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.transport.xmpp.util.XMPPConstants;
-import org.apache.axis2.util.XMLPrettyPrinter;
-
-public class XMPPSampleClient {
- public static void main(String[] args) {
- invokeTimeService();
- }
-
- private static void invokeTimeService() {
- String endPointUrl = "xmpp://[email protected]/" +
"TimeService";
-
- EndpointReference targetEPR = new
EndpointReference(endPointUrl);
- try {
- ConfigurationContext ctx =
- ConfigurationContextFactory.createConfigurationContextFromURIs(
- XMPPSampleClient.class.getResource("axis2.xml"), null);
-
- OMElement payload = getPayload();
- Options options = new Options();
- options.setProperty(XMPPConstants.XMPP_SERVER_TYPE,
XMPPConstants.XMPP_SERVER_TYPE_GOOGLETALK);
- options.setProperty(XMPPConstants.XMPP_SERVER_URL,
XMPPConstants.GOOGLETALK_URL);
- options.setProperty(XMPPConstants.XMPP_SERVER_USERNAME,
"synapse.demo.0");
- options.setProperty(XMPPConstants.XMPP_SERVER_PASSWORD,
"mailpassword");
-
- options.setTo(targetEPR);
- options.setAction("urn:getServerTime");
- ServiceClient sender = new ServiceClient(ctx,null);
-
- sender.setOptions(options);
- OMElement result = sender.sendReceive(payload);
- XMLPrettyPrinter.prettify(result, System.out);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private static OMElement getPayload() {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace omNs = fac.createOMNamespace(
-
"http://example.xmpp.transports.axis2.org/example1", "example1");
- return fac.createOMElement("getServerTime", omNs);
- }
-}
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/sample/axis2.xml
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/sample/axis2.xml
deleted file mode 100644
index f0eadf6a3d..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/sample/axis2.xml
+++ /dev/null
@@ -1,388 +0,0 @@
-<!--
- ~ 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.
- -->
-
-<axisconfig name="AxisJava2.0">
- <!-- ================================================= -->
- <!-- Parameters -->
- <!-- ================================================= -->
- <parameter name="hotdeployment">true</parameter>
- <parameter name="hotupdate">false</parameter>
- <parameter name="enableMTOM">false</parameter>
- <parameter name="enableSwA">false</parameter>
-
- <!--Uncomment if you want to enable file caching for attachments -->
- <!--parameter name="cacheAttachments">true</parameter>
- <parameter name="attachmentDIR"></parameter>
- <parameter name="sizeThreshold">4000</parameter-->
-
- <!--Uncomment if you want to plugin your own attachments lifecycle
implementation -->
- <!--<attachmentsLifecycleManager
class="org.apache.axiom.attachments.lifecycle.impl.LifecycleManagerImpl"/>-->
-
-
- <!--Uncomment if you want to enable the reduction of the in-memory cache
of WSDL definitions -->
- <!--In some server environments, the available memory heap is limited and
can fill up under load -->
- <!--Since in-memory copies of WSDL definitions can be large, some steps
can be taken-->
- <!--to reduce the memory needed for the cached WSDL definitions. -->
- <!--parameter name="reduceWSDLMemoryCache">true</parameter-->
-
- <!--This will give out the timout of the configuration contexts, in
milliseconds-->
- <parameter name="ConfigContextTimeoutInterval">30000</parameter>
-
- <!--During a fault, stack trace can be sent with the fault message. The
following flag will control -->
- <!--that behavior.-->
- <parameter name="sendStacktraceDetailsWithFaults">false</parameter>
-
- <!--If there aren't any information available to find out the fault
reason, we set the message of the exception-->
- <!--as the faultreason/Reason. But when a fault is thrown from a service
or some where, it will be -->
- <!--wrapped by different levels. Due to this the initial exception message
can be lost. If this flag-->
- <!--is set, then Axis2 tries to get the first exception and set its
message as the faultreason/Reason.-->
- <parameter name="DrillDownToRootCauseForFaultReason">false</parameter>
-
- <parameter name="userName"></parameter>
- <parameter name="password"></parameter>
-
- <!--To override repository/services you need to uncomment following
parameter and value SHOULD be absolute file path.-->
- <!--ServicesDirectory only works on the following cases-->
- <!---File based configurator and in that case the value should be a file
URL (http:// not allowed)-->
- <!---When creating URL Based configurator with URL file:// -->
- <!--- War based configurator with expanded case , -->
-
- <!--All the other scenarios it will be ignored.-->
- <!--<parameter name="ServicesDirectory">service</parameter>-->
- <!--To override repository/modules you need to uncomment following
parameter and value SHOULD be absolute file path-->
- <!--<parameter name="ModulesDirectory">modules</parameter>-->
-
-
- <!--Following params will set the proper context paths for invocations.
All the endpoints will have a commons context-->
- <!--root which can configured using the following contextRoot parameter-->
- <!--<parameter name="contextRoot">axis2</parameter>-->
-
- <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters
can be used to distinguiush those endpoints-->
- <!--In case of a servlet, if you change this you have to manually change
the settings of your servlet container to map this -->
- <!--context path to proper Axis2 servlets-->
- <!--<parameter name="servicePath">services</parameter>-->
- <!--<parameter name="restPath">rest</parameter>-->
-
- <!-- Following parameter will completely disable REST handling in Axis2-->
- <parameter name="disableREST" locked="false">false</parameter>
-
- <!-- Following parameter will suppress generation of SOAP 1.2 bindings in
auto-generated WSDL files -->
- <parameter name="disableSOAP12" locked="true">false</parameter>
-
- <!-- ================================================= -->
- <!-- Deployers -->
- <!-- ================================================= -->
-
- <!--Service deployer , this will alow users to deploy AAR or exploded AAR
as axis2 services-->
- <deployer extension=".aar" directory="services"
class="org.apache.axis2.deployment.ServiceDeployer">
- <serviceBuilderExtension name ="jwsbuilderExt"
class="org.apache.axis2.jaxws.framework.JAXWSServiceBuilderExtension"/>
- <serviceBuilderExtension name ="wsdlbuilderExt"
class="org.apache.axis2.deployment.WSDLServiceBuilderExtension"/>
- </deployer>
-
- <!--POJO deployer , this will alow users to drop .class file and make that
into a service-->
- <deployer extension=".class" directory="pojo"
class="org.apache.axis2.deployment.POJODeployer"/>
- <deployer extension=".jar" directory="servicejars"
- class="org.apache.axis2.jaxws.framework.JAXWSDeployer"/>
- <deployer extension=".jar" directory="transports"
- class="org.apache.axis2.deployment.TransportDeployer"/>
-
- <!--CORBA deployer , this will alow users to invoke remote CORBA services
through Axis2-->
- <!--<deployer extension=".xml" directory="corba"
class="org.apache.axis2.corba.deployer.CorbaDeployer"/>-->
-
- <!--<deployer extension=".jsa" directory="rmiservices"
class="org.apache.axis2.rmi.deploy.RMIServiceDeployer"/>-->
-
-
- <!-- Following parameter will set the host name for the epr-->
- <!--<parameter name="hostname" locked="true">myhost.com</parameter>-->
-
- <!-- If you have a front end host which exposes this webservice using a
different public URL -->
- <!-- use this parameter to override autodetected url -->
- <!--<parameter
name="httpFrontendHostUrl">https://someotherhost/context</parameter>-->
-
- <!--By default, JAXWS services are created by reading annotations. WSDL
and schema are generated-->
- <!--using a separate WSDL generator only when ?wsdl is called. Therefore,
even if you engage-->
- <!--policies etc.. to AxisService, it doesn't appear in the WSDL. By
setting the following property-->
- <!--to true, you can create the AxisService using the generated WSDL and
remove the need for a-->
- <!--WSDL generator. When ?wsdl is called, WSDL is generated in the normal
way.-->
- <parameter name="useGeneratedWSDLinJAXWS">false</parameter>
-
- <!-- The way of adding listener to the system-->
- <!-- <listener class="org.apache.axis2.ObserverIMPL">-->
- <!-- <parameter name="RSS_URL">http://127.0.0.1/rss</parameter>-->
- <!-- </listener>-->
-
- <threadContextMigrators>
- <threadContextMigrator listId="JAXWS-ThreadContextMigrator-List"
-
class="org.apache.axis2.jaxws.addressing.migrator.EndpointContextMapMigrator"/>
- </threadContextMigrators>
-
- <!-- ================================================= -->
- <!-- Message Receivers -->
- <!-- ================================================= -->
- <!--This is the default MessageReceiver for the system , if you want to
have MessageReceivers for -->
- <!--all the other MEP implement it and add the correct entry to here , so
that you can refer from-->
- <!--any operation -->
- <!--Note : You can override this for a particular service by adding the
same element with your requirement-->
- <messageReceivers>
- <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
-
class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
- <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
-
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
- <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
-
class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
- <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
-
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
- <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only"
-
class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
- <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
-
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
- </messageReceivers>
-
- <!-- ================================================= -->
- <!-- Message Formatter -->
- <!-- ================================================= -->
- <!--Following content type to message formatter mapping can be used to
implement support for different message -->
- <!--format serialization in Axis2. These message formats are expected to
be resolved based on the content type. -->
- <messageFormatters>
- <messageFormatter contentType="application/x-www-form-urlencoded"
-
class="org.apache.axis2.kernel.http.XFormURLEncodedFormatter"/>
- <messageFormatter contentType="multipart/form-data"
-
class="org.apache.axis2.kernel.http.MultipartFormDataFormatter"/>
- <messageFormatter contentType="application/xml"
-
class="org.apache.axis2.kernel.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="text/xml"
-
class="org.apache.axis2.kernel.http.SOAPMessageFormatter"/>
- <messageFormatter contentType="application/soap+xml"
-
class="org.apache.axis2.kernel.http.SOAPMessageFormatter"/>
- </messageFormatters>
-
- <!-- ================================================= -->
- <!-- Message Builders -->
- <!-- ================================================= -->
- <!--Following content type to builder mapping can be used to implement
support for different message -->
- <!--formats in Axis2. These message formats are expected to be resolved
based on the content type. -->
- <messageBuilders>
- <messageBuilder contentType="application/xml"
-
class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
- <messageBuilder contentType="application/x-www-form-urlencoded"
-
class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
- <messageBuilder contentType="multipart/form-data"
-
class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
- </messageBuilders>
-
- <!-- ================================================= -->
- <!-- Transport Ins -->
- <!-- ================================================= -->
- <!-- <transportReceiver name="http"
-
class="org.apache.axis2.transport.http.SimpleHTTPServer"> -->
- <!--<parameter name="port">8080</parameter> -->
- <!-- Here is the complete list of supported parameters (see example
settings further below):
- port: the port to listen on (default 6060)
- hostname: if non-null, url prefix used in reply-to endpoint
references (default null)
- originServer: value of http Server header in outgoing messages
(default "Simple-Server/1.1")
- requestTimeout: value in millis of time that requests can wait
for data (default 20000)
- requestTcpNoDelay: true to maximize performance and minimize
latency (default true)
- false to minimize bandwidth consumption by
combining segments
- requestCoreThreadPoolSize: number of threads available for
request processing (unless queue fills up) (default 25)
- requestMaxThreadPoolSize: number of threads available for request
processing if queue fills up (default 150)
- note that default queue never fills up:
see HttpFactory
- threadKeepAliveTime: time to keep threads in excess of core size
alive while inactive (default 180)
- note that no such threads can exist with
default unbounded request queue
- threadKeepAliveTimeUnit: TimeUnit of value in threadKeepAliveTime
(default SECONDS) (default SECONDS)
- -->
- <!-- <parameter name="hostname">http://www.myApp.com/ws</parameter> -->
- <!-- <parameter name="originServer">My-Server/1.1</parameter>
-->
- <!-- <parameter name="requestTimeout">10000</parameter>
-->
- <!-- <parameter name="requestTcpNoDelay">false</parameter>
-->
- <!-- <parameter name="requestCoreThreadPoolSize">50</parameter>
-->
- <!-- <parameter name="requestMaxThreadPoolSize">100</parameter>
-->
- <!-- <parameter name="threadKeepAliveTime">240000</parameter>
-->
- <!-- <parameter
name="threadKeepAliveTimeUnit">MILLISECONDS</parameter> -->
- <!-- </transportReceiver> -->
- <!-- <transportReceiver name="sms"
-
class="org.apache.axis2.transport.sms.SMSMessageReciever"> -->
-
- <!-- <parameter
name="smsImplClass">org.apache.axis2.transport.sms.gsm.GSMImplManager</parameter>
-->
- <!-- <parameter name="com_port">/dev/ttyUSB0</parameter> -->
- <!-- <parameter name="gateway_id">modem.ttyUSB0</parameter> -->
- <!-- <parameter name="baud_rate">115200</parameter> -->
- <!-- <parameter name="manufacturer">HUAWEI</parameter> -->
- <!-- <parameter name="model">E220</parameter> -->
- <!-- </transportReceiver> -->
-
-
-<transportReceiver name="xmpp"
class="org.apache.axis2.transport.xmpp.XMPPListener">
- <!-- Account details for google talk -->
- <parameter name="GoogleServer">
- <parameter name="transport.xmpp.ServerUrl">talk.google.com</parameter>
- <parameter
name="transport.xmpp.ServerAccountUserName">axis2.xmpp.account1</parameter>
- <parameter
name="transport.xmpp.ServerAccountPassword">apacheaxis2</parameter>
- <parameter
name="transport.xmpp.ServerType">transport.xmpp.ServerType.GoogleTalk</parameter>
- </parameter>
-</transportReceiver>
-
- <!--Uncomment if you want to have TCP transport support-->
- <!--transportReceiver name="tcp"
- class="org.apache.axis2.transport.tcp.TCPServer">
- <parameter name="port">6060</parameter-->>
- <!--If you want to give your own host address for EPR generation-->
- <!--uncomment the following paramter , and set it as you required.-->
- <!--<parameter name="hostname">tcp://myApp.com/ws</parameter>-->
- <!-- /transportReceiver -->
-
- <!-- ================================================= -->
- <!-- Transport Outs -->
- <!-- ================================================= -->
-
- <!--Uncomment if you want to have TCP transport support-->
- <!--
- <transportSender name="tcp"
-
class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
- -->
-
- <!-- <transportSender name="sms"
class="org.apache.axis2.transport.sms.SMSSender"> -->
- <!-- <parameter
name="smsImplClass">org.apache.axis2.transport.sms.gsm.GSMImplManager</parameter>
-->
- <!-- <parameter name="com_port">/dev/ttyUSB0</parameter> -->
- <!-- <parameter name="gateway_id">modem.ttyUSB0</parameter> -->
- <!-- <parameter name="baud_rate">115200</parameter> -->
- <!-- <parameter name="manufacturer">HUAWEI</parameter> -->
- <!-- <parameter name="model">E220</parameter> -->
- <!-- </transportSender> -->
-
-<transportSender name="xmpp"
class="org.apache.axis2.transport.xmpp.XMPPSender">
-</transportSender>
-
- <!-- Please enable this if you need the java transport -->
- <!-- <transportSender name="java"
-
class="org.apache.axis2.transport.java.JavaTransportSender"/> -->
-
- <!-- ================================================= -->
- <!-- Global Modules -->
- <!-- ================================================= -->
- <!-- Comment this to disable Addressing -->
- <!--<module ref="addressing"/>-->
-
- <!--Configuring module , providing parameters for modules whether they
refer or not-->
- <!--<moduleConfig name="addressing">-->
- <!--<parameter name="addressingPara">N/A</parameter>-->
- <!--</moduleConfig>-->
-
-
-
- <!-- ================================================= -->
- <!-- Phases -->
- <!-- ================================================= -->
- <phaseOrder type="InFlow">
- <!-- System predefined phases -->
- <phase name="Transport">
- <handler name="RequestURIBasedDispatcher"
-
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
- <order phase="Transport"/>
- </handler>
- <handler name="SOAPActionBasedDispatcher"
-
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
- <order phase="Transport"/>
- </handler>
- </phase>
- <phase name="Addressing">
- <handler name="AddressingBasedDispatcher"
-
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
- <order phase="Addressing"/>
- </handler>
- </phase>
- <phase name="Security"/>
- <phase name="PreDispatch"/>
- <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
- <handler name="RequestURIBasedDispatcher"
-
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
- <handler name="SOAPActionBasedDispatcher"
-
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
- <handler name="RequestURIOperationDispatcher"
-
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
- <handler name="SOAPMessageBodyBasedDispatcher"
-
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
- <handler name="HTTPLocationBasedDispatcher"
-
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
- <handler name="GenericProviderDispatcher"
-
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
- <handler name="MustUnderstandValidationDispatcher"
-
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
- </phase>
- <phase name="RMPhase"/>
- <!-- System predefined phases -->
- <!-- After Postdispatch phase module author or service author can
add any phase he want -->
- <phase name="OperationInPhase">
- <handler name="MustUnderstandChecker"
-
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
- <order phase="OperationInPhase"/>
- </handler>
- </phase>
- <phase name="soapmonitorPhase"/>
- </phaseOrder>
- <phaseOrder type="OutFlow">
- <!-- user can add his own phases to this area -->
- <phase name="soapmonitorPhase"/>
- <phase name="OperationOutPhase"/>
- <!--system predefined phase-->
- <!--these phase will run irrespective of the service-->
- <phase name="RMPhase"/>
- <phase name="PolicyDetermination"/>
- <phase name="MessageOut"/>
- <phase name="Security"/>
- </phaseOrder>
- <phaseOrder type="InFaultFlow">
- <phase name="Addressing">
- <handler name="AddressingBasedDispatcher"
-
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
- <order phase="Addressing"/>
- </handler>
- </phase>
- <phase name="Security"/>
- <phase name="PreDispatch"/>
- <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
- <handler name="RequestURIBasedDispatcher"
-
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
- <handler name="SOAPActionBasedDispatcher"
-
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
- <handler name="RequestURIOperationDispatcher"
-
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
- <handler name="SOAPMessageBodyBasedDispatcher"
-
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
- <handler name="HTTPLocationBasedDispatcher"
-
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
- <handler name="GenericProviderDispatcher"
-
class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher"/>
- <handler name="MustUnderstandValidationDispatcher"
-
class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher"/>
- </phase>
- <phase name="RMPhase"/>
- <!-- user can add his own phases to this area -->
- <phase name="OperationInFaultPhase"/>
- <phase name="soapmonitorPhase"/>
- </phaseOrder>
- <phaseOrder type="OutFaultFlow">
- <!-- user can add his own phases to this area -->
- <phase name="soapmonitorPhase"/>
- <phase name="OperationOutFaultPhase"/>
- <phase name="RMPhase"/>
- <phase name="PolicyDetermination"/>
- <phase name="MessageOut"/>
- <phase name="Security"/>
- </phaseOrder>
-</axisconfig>
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPClientConnectionFactory.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPClientConnectionFactory.java
deleted file mode 100755
index 62783985af..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPClientConnectionFactory.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * 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.util;
-
-import org.apache.axis2.AxisFault;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jivesoftware.smack.ConnectionConfiguration;
-import org.jivesoftware.smack.ConnectionListener;
-import org.jivesoftware.smack.XMPPConnection;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.filter.FromContainsFilter;
-import org.jivesoftware.smack.filter.PacketFilter;
-import org.jivesoftware.smack.filter.ToContainsFilter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class XMPPClientConnectionFactory {
- private static Log log =
LogFactory.getLog(XMPPClientConnectionFactory.class);
- private XMPPConnection xmppConnection = null;
- private PacketFilter packetFilter = null;
- private Map<String,XMPPConnectionDetails> xmppConnections = new
HashMap<String,XMPPConnectionDetails>();
-
- public XMPPClientConnectionFactory(){}
-
- /**
- * Connects to a XMPP server based on the details available in
serverCredentials object
- * @param serverCredentials
- * @throws XMPPException
- */
- public XMPPConnection connect(final XMPPServerCredentials
serverCredentials) throws AxisFault {
- //XMPPConnection.DEBUG_ENABLED = true;
-
if(XMPPConstants.XMPP_SERVER_TYPE_JABBER.equals(serverCredentials.getServerType())){
- xmppConnection = new
XMPPConnection(serverCredentials.getServerUrl());
- try {
- xmppConnection.connect();
- } catch (XMPPException e) {
- log.error("Failed to connect to server
:"+serverCredentials.getServerUrl(), e);
- throw new AxisFault("Failed to connect to
server :"+serverCredentials.getServerUrl());
- }
- //Pause for a small time before trying to login.
- //This prevents random ssl exception from Smack API
- try {
- Thread.sleep(100);
- } catch (InterruptedException e5) {
- log.debug("Sleep interrupted ",e5);
- }
-
- if(xmppConnection.isConnected()){
- String resource =
serverCredentials.getResource()+ new Object().hashCode();
- if(! xmppConnection.isAuthenticated()){
- try {
-
//xmppConnection.login(serverCredentials.getAccountName()+"@"+
- //
serverCredentials.getServerUrl(),
-
xmppConnection.login(serverCredentials.getAccountName(),
-
serverCredentials.getPassword(),
- resource,
- true);
- } catch (XMPPException e) {
- try {
- log.error("Login failed
for "
-
+serverCredentials.getAccountName()
-
+"@"+serverCredentials.getServerUrl()
-
+".Retrying in 2 secs",e);
- Thread.sleep(2000);
-
//xmppConnection.login(serverCredentials.getAccountName()+"@"+
- //
serverCredentials.getServerUrl(),
-
xmppConnection.login(serverCredentials.getAccountName(),
- serverCredentials.getPassword(),
- resource,
- true);
-
- } catch (InterruptedException
e1) {
- log.error("Sleep
interrupted.",e1);
- } catch (XMPPException e2) {
- log.error("Login failed
for : "+serverCredentials.getAccountName()
-
+"@"+serverCredentials.getServerUrl(),e2);
- throw new
AxisFault("Login failed for : "+serverCredentials.getAccountName()
-
+"@"+serverCredentials.getServerUrl());
- }
- }
- //Listen for Message type packets from
specified server url
- //packetFilter = new AndFilter(new
PacketTypeFilter(Message.class),
- // new
FromContainsFilter(serverCredentials.getServerUrl()));
- packetFilter = new
FromContainsFilter(serverCredentials.getServerUrl());
- }
- }
- }else
if(XMPPConstants.XMPP_SERVER_TYPE_GOOGLETALK.equals(serverCredentials.getServerType())){
- ConnectionConfiguration connectionConfiguration =
- new
ConnectionConfiguration(XMPPConstants.GOOGLETALK_URL
- ,XMPPConstants.GOOGLETALK_PORT
-
,XMPPConstants.GOOGLETALK_SERVICE_NAME);
- xmppConnection = new
XMPPConnection(connectionConfiguration);
- try {
- xmppConnection.connect();
-
xmppConnection.login(serverCredentials.getAccountName()
- ,
serverCredentials.getPassword()
-
,serverCredentials.getResource(),
- true);
- //packetFilter = new AndFilter(new
PacketTypeFilter(Message.class),
- // new
FromContainsFilter(XMPPConstants.GOOGLETALK_FROM));
- //packetFilter = new
FromContainsFilter(XMPPConstants.GOOGLETALK_FROM);
- packetFilter = new
ToContainsFilter("@gmail.com");
-
- } catch (XMPPException e1) {
- log.error("Error occured while connecting to
Googletalk server.",e1);
- throw new AxisFault("Error occured while
connecting to Googletalk server.");
- }
- }
-
- ConnectionListener connectionListener = null;
- connectionListener = new ConnectionListener(){
- public void connectionClosed() {
- log.debug("Connection closed normally");
- }
- public void connectionClosedOnError(
- Exception e1) {
- log.error("Connection to
"+serverCredentials.getServerUrl()
- + " closed with error.",e1);
- }
- public void reconnectingIn(int seconds) {
- log.error("Connection to
"+serverCredentials.getServerUrl()
- +" failed. Reconnecting in
"+seconds+"s");
- }
- public void reconnectionFailed(Exception e) {
- log.error("Reconnection to
"+serverCredentials.getServerUrl()+" failed.",e);
- }
- public void reconnectionSuccessful() {
- log.debug("Reconnection to
"+serverCredentials.getServerUrl()+" successful.");
- }
- };
- if(xmppConnection != null && xmppConnection.isConnected()){
-
xmppConnection.addConnectionListener(connectionListener);
- log.info("Connected to "
+serverCredentials.getAccountName()+ "@"
- + serverCredentials.getServerUrl()+
"/"+ serverCredentials.getResource());
- }else{
- log.warn(" Not Connected to "
+serverCredentials.getAccountName()+ "@"
- + serverCredentials.getServerUrl()+
"/"+ serverCredentials.getResource());
- }
- return xmppConnection;
- }
-
- public XMPPConnection getXmppConnection(){
- return xmppConnection;
- }
-
-// public XMPPConnection getConnection(XMPPServerCredentials credentials)
throws AxisFault{
-// StringBuffer buf = new StringBuffer();
-// String key =
buf.append(credentials.getServerUrl()).append(credentials.getAccountName()).toString();
-//
-// XMPPConnectionDetails connDetails = xmppConnections.get(key);
-// if(connDetails == null){
-// connDetails = new XMPPConnectionDetails();
-// connDetails.connection = connect(credentials);
-// connDetails.userCount = 1;
-// xmppConnections.put(key, connDetails);
-// }else{
-// connDetails.userCount = 1;
-// }
-// return connDetails.connection;
-// }
-//
-// public void disconnect(XMPPServerCredentials credentials){
-// StringBuffer buf = new StringBuffer();
-// String key =
buf.append(credentials.getServerUrl()).append(credentials.getAccountName()).toString();
-//
-// XMPPConnectionDetails connDetails = xmppConnections.get(key);
-// if(connDetails != null){
-// connDetails.userCount--;
-// }
-// if(connDetails.userCount == 0){
-// xmppConnections.remove(key);
-// connDetails.connection.disconnect();
-// }
-// }
-
-
-// public void listen(XMPPPacketListener packetListener){
-// xmppConnection.addPacketListener(packetListener,packetFilter);
-// }
-
- public void stop() {}
-
- public class XMPPConnectionDetails{
- XMPPConnection connection;
- int userCount;
- }
-}
\ No newline at end of file
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPClientResponseManager.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPClientResponseManager.java
deleted file mode 100755
index cb8626c1b8..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPClientResponseManager.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Semaphore;
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.commons.lang3.StringEscapeUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jivesoftware.smack.PacketListener;
-import org.jivesoftware.smack.packet.Message;
-import org.jivesoftware.smack.packet.Packet;
-
-public class XMPPClientResponseManager implements PacketListener {
- private static Log log =
LogFactory.getLog(XMPPClientResponseManager.class);
-
- private ConcurrentHashMap<String, WaitingDetails>
prespectiveResponseMap = new ConcurrentHashMap<String, WaitingDetails>();
-
-
- public XMPPClientResponseManager(){
- }
-
-
- public void listenForResponse(String key, MessageContext
messageContext){
- prespectiveResponseMap.put(key, new WaitingDetails(messageContext));
- }
-
-
- /**
- * This method will be triggered, when a message is arrived at client
side
- */
- public void processPacket(Packet packet) {
- Message message = (Message)packet;
- String xml = StringEscapeUtils.unescapeXml(message.getBody());
- log.debug("Client received message : "+message.toXML());
- InputStream inputStream = new
ByteArrayInputStream(xml.getBytes());
-
- String sequenceNumber =
(String)message.getProperty(XMPPConstants.SEQUENCE_ID);
- if(sequenceNumber != null){
- WaitingDetails waitingDetails =
prespectiveResponseMap.remove(sequenceNumber);
- if(waitingDetails != null){
-
waitingDetails.messageContext.setProperty(MessageContext.TRANSPORT_IN,
inputStream);
- waitingDetails.wait.release();
- }else{
- log.error("No one waiting for message "+ xml);
- }
- }else{
- log.error(XMPPConstants.SEQUENCE_ID + " not found in the
message");
- }
- }
-
- /**
- * Indicates response message is received at client side.
- * @see processPacket(Packet packet)
- * @return
- * @throws InterruptedException
- */
- public void waitFor(String key) throws InterruptedException{
- WaitingDetails waitingDetails = prespectiveResponseMap.get(key);
- if(waitingDetails == null){
- //this mean response has arrvied before wait
- return;
- }
- waitingDetails.wait.acquire();
- }
-
- public class WaitingDetails{
- Semaphore wait = new Semaphore(0);
- MessageContext messageContext;
- public WaitingDetails(MessageContext messageContext) {
- super();
- this.messageContext = messageContext;
- }
-
- }
-
-}
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPClientSidePacketListener.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPClientSidePacketListener.java
deleted file mode 100644
index 614955e382..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPClientSidePacketListener.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.commons.lang3.StringEscapeUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jivesoftware.smack.PacketListener;
-import org.jivesoftware.smack.packet.Message;
-import org.jivesoftware.smack.packet.Packet;
-
-public class XMPPClientSidePacketListener implements PacketListener {
- private static Log log =
LogFactory.getLog(XMPPClientSidePacketListener.class);
- private MessageContext messageContext = null;
- private boolean responseReceived;
-
- public XMPPClientSidePacketListener(MessageContext messageContext){
- this.messageContext = messageContext;
- }
-
-
-
- /**
- * This method will be triggered, when a message is arrived at client
side
- */
- public void processPacket(Packet packet) {
- Message message = (Message)packet;
- String xml = StringEscapeUtils.unescapeXml(message.getBody());
- log.info("Client received message : "+xml);
- this.responseReceived = true;
- InputStream inputStream = new
ByteArrayInputStream(xml.getBytes());
- messageContext.setProperty(MessageContext.TRANSPORT_IN,
inputStream);
- }
-
- /**
- * Indicates response message is received at client side.
- * @see processPacket(Packet packet)
- * @return
- */
- public boolean isResponseReceived() {
- return responseReceived;
- }
-
-}
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPConnectionFactory.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPConnectionFactory.java
deleted file mode 100644
index 6df842ae20..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPConnectionFactory.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * 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.util;
-
-import org.apache.axis2.AxisFault;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jivesoftware.smack.ConnectionConfiguration;
-import org.jivesoftware.smack.ConnectionListener;
-import org.jivesoftware.smack.XMPPConnection;
-import org.jivesoftware.smack.XMPPException;
-import org.jivesoftware.smack.filter.FromContainsFilter;
-import org.jivesoftware.smack.filter.PacketFilter;
-import org.jivesoftware.smack.filter.ToContainsFilter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class XMPPConnectionFactory {
- private static Log log = LogFactory.getLog(XMPPConnectionFactory.class);
- private XMPPConnection xmppConnection = null;
- private PacketFilter packetFilter = null;
- private Map<String,XMPPConnectionDetails> xmppConnections = new
HashMap<String,XMPPConnectionDetails>();
-
- public XMPPConnectionFactory(){}
-
- /**
- * Connects to a XMPP server based on the details available in
serverCredentials object
- * @param serverCredentials
- * @throws XMPPException
- */
- public XMPPConnection connect(final XMPPServerCredentials
serverCredentials) throws AxisFault {
- //XMPPConnection.DEBUG_ENABLED = true;
-
if(XMPPConstants.XMPP_SERVER_TYPE_JABBER.equals(serverCredentials.getServerType())){
- xmppConnection = new
XMPPConnection(serverCredentials.getServerUrl());
- try {
- xmppConnection.connect();
- } catch (XMPPException e) {
- log.error("Failed to connect to server
:"+serverCredentials.getServerUrl(), e);
- throw new AxisFault("Failed to connect to
server :"+serverCredentials.getServerUrl());
- }
- //Pause for a small time before trying to login.
- //This prevents random ssl exception from Smack API
- try {
- Thread.sleep(100);
- } catch (InterruptedException e5) {
- log.debug("Sleep interrupted ",e5);
- }
-
- if(xmppConnection.isConnected()){
- String resource =
serverCredentials.getResource()+ new Object().hashCode();
- if(! xmppConnection.isAuthenticated()){
- try {
-
xmppConnection.login(serverCredentials.getAccountName(),
-
serverCredentials.getPassword(),
- resource,
- true);
- } catch (XMPPException e) {
- try {
- log.error("Login failed
for "
-
+serverCredentials.getAccountName()
-
+"@"+serverCredentials.getServerUrl()
-
+".Retrying in 2 secs",e);
- Thread.sleep(2000);
-
xmppConnection.login(serverCredentials.getAccountName(),
- serverCredentials.getPassword(),
- resource,
- true);
-
- } catch (InterruptedException
e1) {
- log.error("Sleep
interrupted.",e1);
- } catch (XMPPException e2) {
- log.error("Login failed
for : "+serverCredentials.getAccountName()
-
+"@"+serverCredentials.getServerUrl(),e2);
- throw new
AxisFault("Login failed for : "+serverCredentials.getAccountName()
-
+"@"+serverCredentials.getServerUrl());
- }
- }
- //Listen for Message type packets from
specified server url
- packetFilter = new
FromContainsFilter(serverCredentials.getServerUrl());
- }
- }
- }else
if(XMPPConstants.XMPP_SERVER_TYPE_GOOGLETALK.equals(serverCredentials.getServerType())){
- ConnectionConfiguration connectionConfiguration =
- new
ConnectionConfiguration(XMPPConstants.GOOGLETALK_URL
- ,XMPPConstants.GOOGLETALK_PORT
-
,XMPPConstants.GOOGLETALK_SERVICE_NAME);
- xmppConnection = new
XMPPConnection(connectionConfiguration);
- try {
- xmppConnection.connect();
-
xmppConnection.login(serverCredentials.getAccountName()
- ,
serverCredentials.getPassword()
-
,serverCredentials.getResource(),
- true);
- packetFilter = new
ToContainsFilter("@gmail.com");
-
- } catch (XMPPException e1) {
- log.error("Error occured while connecting to
Googletalk server.",e1);
- throw new AxisFault("Error occured while
connecting to Googletalk server.");
- }
- }
-
- ConnectionListener connectionListener = null;
- connectionListener = new ConnectionListener(){
- public void connectionClosed() {
- log.debug("Connection closed normally");
- }
- public void connectionClosedOnError(
- Exception e1) {
- log.error("Connection to
"+serverCredentials.getServerUrl()
- + " closed with error.",e1);
- }
- public void reconnectingIn(int seconds) {
- log.error("Connection to
"+serverCredentials.getServerUrl()
- +" failed. Reconnecting in
"+seconds+"s");
- }
- public void reconnectionFailed(Exception e) {
- log.error("Reconnection to
"+serverCredentials.getServerUrl()+" failed.",e);
- }
- public void reconnectionSuccessful() {
- log.debug("Reconnection to
"+serverCredentials.getServerUrl()+" successful.");
- }
- };
- if(xmppConnection != null && xmppConnection.isConnected()){
-
xmppConnection.addConnectionListener(connectionListener);
- log.info("Connected to "
+serverCredentials.getAccountName()+ "@"
- + serverCredentials.getServerUrl()+
"/"+ serverCredentials.getResource());
- }else{
- log.warn(" Not Connected to "
+serverCredentials.getAccountName()+ "@"
- + serverCredentials.getServerUrl()+
"/"+ serverCredentials.getResource());
- }
- return xmppConnection;
- }
-
- public XMPPConnection getXmppConnection(){
- return xmppConnection;
- }
-
-
- public void listen(XMPPPacketListener packetListener){
- xmppConnection.addPacketListener(packetListener,packetFilter);
- }
-
- public void stop() {}
-
- public class XMPPConnectionDetails{
- XMPPConnection connection;
- int userCount;
- }
-}
\ No newline at end of file
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPConstants.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPConstants.java
deleted file mode 100644
index 27d956b93d..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPConstants.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.util;
-
-
-public class XMPPConstants {
- public static final String XMPP = "xmpp";
- //The prefix indicating an Axis XMPP URL
- public static final String XMPP_PREFIX = "xmpp://";
-
- //properties related to XMPP server connection
- public static final String XMPP_SERVER_USERNAME =
"transport.xmpp.ServerAccountUserName";
- public static final String XMPP_SERVER_PASSWORD =
"transport.xmpp.ServerAccountPassword";
- public static final String XMPP_SERVER_URL = "transport.xmpp.ServerUrl";
- public static final String XMPP_DOMAIN_NAME = "transport.xmpp.domain";
-
- //Google talk attributes
- public static final String GOOGLETALK_URL = "talk.google.com";
- public static final int GOOGLETALK_PORT = 5222;
- public static final String GOOGLETALK_SERVICE_NAME = "gmail.com";
- public static final String GOOGLETALK_FROM = "gmail.com";
-
-
- //XMPP Server Types
- public static final String XMPP_SERVER_TYPE = "transport.xmpp.ServerType";
- public static final String XMPP_SERVER_TYPE_JABBER =
"transport.xmpp.ServerType.Jabber";
- public static final String XMPP_SERVER_TYPE_GOOGLETALK =
"transport.xmpp.ServerType.GoogleTalk";
-
- public static final String IS_SERVER_SIDE = "isServerSide";
- public static final String IN_REPLY_TO = "inReplyTo";
- public static final String SERVICE_NAME = "ServiceName";
- public static final String ACTION = "Action";
- public static final String CONTENT_TYPE = "ContentType";
- //This is set to true, if a request message is sent through XMPPSender
- //Used to distinguish messages coming from chat clients.
- public static final String CONTAINS_SOAP_ENVELOPE =
"transport.xmpp.containsSOAPEnvelope";
- public static final String MESSAGE_FROM_CHAT =
"transport.xmpp.message.from.chat";
- public static final String SEQUENCE_ID = "transport.xmpp.sequenceID";
-
- public static final String XMPP_CONTENT_TYPE_STRING = "xmpp/text";
-}
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPOutTransportInfo.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPOutTransportInfo.java
deleted file mode 100644
index 0b6ef75586..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPOutTransportInfo.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.util;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.kernel.OutTransportInfo;
-
-/**
- *
- * Holds XMPP transport out details
- *
- */
-public class XMPPOutTransportInfo implements OutTransportInfo{
- private String contentType = null;
- private String destinationAccount = null;
- private String inReplyTo;
- private EndpointReference from;
- private XMPPConnectionFactory connectionFactory = null;
- private String sequenceID;
-
- public XMPPOutTransportInfo(){
-
- }
-
- public XMPPOutTransportInfo(String transportUrl) throws AxisFault {
- this.destinationAccount = XMPPUtils.getAccountName(transportUrl);
- }
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- public XMPPConnectionFactory getConnectionFactory() {
- return connectionFactory;
- }
-
- public void setConnectionFactory(XMPPConnectionFactory connectionFactory) {
- this.connectionFactory = connectionFactory;
- }
-
- public String getDestinationAccount() {
- return destinationAccount;
- }
-
- public EndpointReference getFrom() {
- return from;
- }
-
- public void setFrom(EndpointReference from) {
- this.from = from;
- }
-
- public String getInReplyTo() {
- return inReplyTo;
- }
-
- public void setInReplyTo(String inReplyTo) {
- this.inReplyTo = inReplyTo;
- }
-
- public void setDestinationAccount(String destinationAccount) {
- this.destinationAccount = destinationAccount;
- }
-
- public String getContentType() {
- return contentType;
- }
-
- public String getSequenceID() {
- return sequenceID;
- }
-
- public void setSequenceID(String sequenceID) {
- this.sequenceID = sequenceID;
- }
-
-}
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPPacketListener.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPPacketListener.java
deleted file mode 100644
index 2fb73c154c..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPPacketListener.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * 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.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.concurrent.Executor;
-
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.builder.BuilderUtil;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.kernel.TransportUtils;
-import org.apache.axis2.kernel.http.HTTPConstants;
-import org.apache.axis2.transport.xmpp.XMPPSender;
-import org.apache.axis2.util.MessageContextBuilder;
-import org.apache.axis2.util.MultipleEntryHashMap;
-import org.apache.commons.lang3.StringEscapeUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jivesoftware.smack.PacketListener;
-import org.jivesoftware.smack.packet.Message;
-import org.jivesoftware.smack.packet.Packet;
-
-public class XMPPPacketListener implements PacketListener {
- private static final Log log =
LogFactory.getLog(XMPPPacketListener.class);
- private XMPPConnectionFactory xmppConnectionFactory = null;
- private ConfigurationContext configurationContext = null;
- private Executor workerPool = null;
-
- public final static String CONTENT_TYPE = "mail.contenttype";
-
- public XMPPPacketListener(XMPPConnectionFactory xmppConnectionFactory,
ConfigurationContext configurationContext, Executor workerPool) {
- this.xmppConnectionFactory = xmppConnectionFactory;
- this.configurationContext = configurationContext;
- this.workerPool = workerPool;
- }
-
- /**
- * This method gets triggered when server side gets a message
- */
- public void processPacket(Packet packet) {
- log.debug("Received : "+packet.toXML());
- if(packet instanceof Message){
- workerPool.execute(new Worker(packet));
- }
- }
-
- /**
- * Creates message context using values received in XMPP packet
- * @param packet
- * @return MessageContext
- * @throws AxisFault
- */
- private MessageContext createMessageContext(Packet packet) throws
AxisFault {
- Message message = (Message) packet;
-
- Boolean isServerSide = (Boolean) message
- .getProperty(XMPPConstants.IS_SERVER_SIDE);
- String serviceName = (String) message
- .getProperty(XMPPConstants.SERVICE_NAME);
- String action = (String)
message.getProperty(XMPPConstants.ACTION);
- MessageContext msgContext = null;
-
- TransportInDescription transportIn = configurationContext
- .getAxisConfiguration().getTransportIn("xmpp");
- TransportOutDescription transportOut = configurationContext
- .getAxisConfiguration().getTransportOut("xmpp");
- if ((transportIn != null) && (transportOut != null)) {
- msgContext =
configurationContext.createMessageContext();
- msgContext.setTransportIn(transportIn);
- msgContext.setTransportOut(transportOut);
- if (isServerSide != null) {
-
msgContext.setServerSide(isServerSide.booleanValue());
- }
- msgContext.setProperty(
- CONTENT_TYPE,
- "text/xml");
- msgContext.setProperty(
-
Constants.Configuration.CHARACTER_SET_ENCODING, "UTF-8");
- msgContext.setIncomingTransportName("xmpp");
-
- Map services =
configurationContext.getAxisConfiguration()
- .getServices();
-
- AxisService axisService = (AxisService)
services.get(serviceName);
- msgContext.setAxisService(axisService);
- msgContext.setSoapAction(action);
-
- // pass the configurationFactory to transport sender
- msgContext.setProperty("XMPPConfigurationFactory",
- this.xmppConnectionFactory);
-
- if (packet.getFrom() != null) {
- msgContext.setFrom(new
EndpointReference(packet.getFrom()));
- }
- if (packet.getTo() != null) {
- msgContext.setTo(new
EndpointReference(packet.getTo()));
- }
-
- XMPPOutTransportInfo xmppOutTransportInfo = new
XMPPOutTransportInfo();
- xmppOutTransportInfo
-
.setConnectionFactory(this.xmppConnectionFactory);
-
- String packetFrom = packet.getFrom();
- if (packetFrom != null) {
- EndpointReference fromEPR = new
EndpointReference(packetFrom);
- xmppOutTransportInfo.setFrom(fromEPR);
-
xmppOutTransportInfo.setDestinationAccount(packetFrom);
- }
-
- // Save Message-Id to set as In-Reply-To on reply
- String xmppMessageId = packet.getPacketID();
- if (xmppMessageId != null) {
-
xmppOutTransportInfo.setInReplyTo(xmppMessageId);
- }
-
xmppOutTransportInfo.setSequenceID((String)message.getProperty(XMPPConstants.SEQUENCE_ID));
- msgContext.setProperty(
-
org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
- xmppOutTransportInfo);
- buildSOAPEnvelope(packet, msgContext);
- } else {
- throw new AxisFault("Either transport in or transport
out is null");
- }
- return msgContext;
- }
-
- /**
- * builds SOAP envelop using message contained in packet
- * @param packet
- * @param msgContext
- * @throws AxisFault
- */
- private void buildSOAPEnvelope(Packet packet, MessageContext
msgContext) throws AxisFault{
- Message message = (Message)packet;
- String logMsg = "Trying to create " +
- "message content using XMPP message received :"+packet.toXML();
-
- String messageBody =
StringEscapeUtils.unescapeXml(message.getBody());
- if(msgContext.isServerSide()){
- log.debug("Received Envelope : "+messageBody);
- }
-
- InputStream inputStream = new
ByteArrayInputStream(messageBody.getBytes());
- SOAPEnvelope envelope = null;
- try {
- Object obj =
message.getProperty(XMPPConstants.CONTAINS_SOAP_ENVELOPE);
- if(obj != null && ((Boolean)obj).booleanValue()){
- String contentType =
(String)message.getProperty(XMPPConstants.CONTENT_TYPE);
- if(contentType == null){
- throw new AxisFault("Can not Find
Content type Property in the XMPP Message");
- }
- envelope =
TransportUtils.createSOAPMessage(msgContext, inputStream, contentType);
-
msgContext.setProperty(XMPPConstants.CONTAINS_SOAP_ENVELOPE, new Boolean(true));
- }else{
- //A text message has been received from a chat
client
- //This message could either be a service call
or a help command
-
if(!(messageContainsCommandsFromChat(messageBody,msgContext))){
- envelope =
createSOAPEnvelopeForRawMessage(msgContext, messageBody);
- }
- }
- if(envelope != null){
- msgContext.setEnvelope(envelope);
- }
- }catch (OMException e) {
- log.error(logMsg, e);
- throw new AxisFault(logMsg);
- }catch (XMLStreamException e) {
- log.error(logMsg, e);
- throw new AxisFault(logMsg);
- }catch (FactoryConfigurationError e) {
- log.error(logMsg, e);
- throw new AxisFault(logMsg);
- }catch (AxisFault e){
- log.error(logMsg, e);
- throw new AxisFault(logMsg);
- }
- }
-
- /**
- * In the direct chat client scenario, client can send commands &
retrieve details
- * on available services, operations,etc. This method checks if a
client has sent
- * such command. Only limited set of commands are available as of now.
- * @param message
- * @param msgContext
- * @return
- */
- private boolean messageContainsCommandsFromChat(String
message,MessageContext msgContext){
- boolean containsKnownCommand = false;
- if(message.trim().startsWith("help")){
- containsKnownCommand = true;
- }else if(message.trim().startsWith("listServices")){
- containsKnownCommand = true;
- }else if (message.trim().startsWith("getOperations")){
- containsKnownCommand = true;
- }
-
- if(containsKnownCommand){
-
msgContext.setProperty(XMPPConstants.MESSAGE_FROM_CHAT,message.trim());
- }
- return containsKnownCommand;
- }
-
- /**
- * Creates a SOAP envelope using details found in chat message.
- * @param msgCtx
- * @param chatMessage
- * @return
- */
- private SOAPEnvelope createSOAPEnvelopeForRawMessage(MessageContext
msgCtx,String chatMessage)
- throws AxisFault{
- //TODO : need to add error handling logic
- String callRemoved = chatMessage.replaceFirst("call", "");
- //extract Service name
- String serviceName = callRemoved.trim().substring(0,
callRemoved.indexOf(":")-1);
- String operationName =
callRemoved.trim().substring(callRemoved.indexOf(":"),
callRemoved.indexOf("(")-1);
-
- //Extract parameters from IM message
- String parameterList =
callRemoved.trim().substring(callRemoved.indexOf("("),callRemoved.trim().length()-1);
- StringTokenizer st = new StringTokenizer(parameterList,",");
- MultipleEntryHashMap parameterMap = new MultipleEntryHashMap();
- while(st.hasMoreTokens()){
- String token = st.nextToken();
- String name = token.substring(0, token.indexOf("="));
- String value = token.substring(token.indexOf("=")+1);
- parameterMap.put(name, value);
- }
-
- SOAPEnvelope envelope = null;
- try {
-
msgCtx.setProperty(XMPPConstants.CONTAINS_SOAP_ENVELOPE, new Boolean(true));
- if(serviceName != null && serviceName.trim().length() >
0){
- AxisService axisService =
msgCtx.getConfigurationContext().getAxisConfiguration().getService(serviceName);
- msgCtx.setAxisService(axisService);
-
- AxisOperation axisOperation =
axisService.getOperationBySOAPAction("urn:"+operationName);
- if(axisOperation != null){
- msgCtx.setAxisOperation(axisOperation);
- }
- }
-
- if(operationName != null &&
operationName.trim().length() > 0){
- msgCtx.setSoapAction("urn:"+operationName);
- }
-
- XMPPOutTransportInfo xmppOutTransportInfo =
(XMPPOutTransportInfo)msgCtx.getProperty(
-
org.apache.axis2.Constants.OUT_TRANSPORT_INFO);
- //This should be only set for messages received via
chat.
- //TODO : need to read from a constant
- xmppOutTransportInfo.setContentType("xmpp/text");
-
- msgCtx.setServerSide(true);
-
- //TODO : need to support SOAP12 as well
- SOAPFactory soapFactory =
OMAbstractFactory.getSOAP11Factory();
- envelope = BuilderUtil.buildsoapMessage(msgCtx,
parameterMap,
- soapFactory);
- //TODO : improve error handling & messages
- } catch (AxisFault e) {
- throw new AxisFault(e.getMessage());
- } catch (OMException e) {
- throw new AxisFault(e.getMessage());
- } catch (FactoryConfigurationError e) {
- throw new AxisFault(e.getMessage());
- }
- return envelope;
- }
-
- /**
- * The actual Runnable Worker implementation which will process the
- * received XMPP messages in the worker thread pool
- */
- class Worker implements Runnable {
- private Packet packet = null;
- Worker(Packet packet) {
- this.packet = packet;
- }
-
- public void run() {
- MessageContext msgCtx = null;
- try {
- msgCtx = createMessageContext(packet);
- Object obj =
msgCtx.getProperty(XMPPConstants.CONTAINS_SOAP_ENVELOPE);
- if(obj != null &&
((Boolean)obj).booleanValue()){
- if(msgCtx.isProcessingFault() &&
msgCtx.isServerSide()){
- AxisEngine.sendFault(msgCtx);
- }else{
- AxisEngine.receive(msgCtx);
- }
- }else{
- //Send a text reply message to command
received from chat client
- XMPPSender.processChatMessage(msgCtx);
- }
- } catch (AxisFault e) {
- log.error("Error occurred while sending
message"+e);
- if (msgCtx != null && msgCtx.isServerSide()) {
- MessageContext faultContext;
- try {
- faultContext =
MessageContextBuilder.createFaultMessageContext(msgCtx, e);
- AxisEngine.sendFault(faultContext);
- } catch (AxisFault e1) {
- log.error("Error occurred while
creating SOAPFault message"+e1);
- }
- }
- }
- }
- }
-}
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPServerCredentials.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPServerCredentials.java
deleted file mode 100644
index 25943f6796..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPServerCredentials.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.util;
-
-/**
- * Holds connection details to a XMPP Server
- *
- */
-public class XMPPServerCredentials {
- private String accountName;
- private String serverUrl;
- private String password;
- private String serverType;
- private String resource;
- private String domainName;
-
- public String getAccountName() {
- return accountName;
- }
- public void setAccountName(String accountName) {
- this.accountName = accountName;
- }
- public String getServerUrl() {
- return serverUrl;
- }
- public void setServerUrl(String serverUrl) {
- this.serverUrl = serverUrl;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public String getServerType() {
- return serverType;
- }
- public void setServerType(String serverType) {
- this.serverType = serverType;
- }
- public String getResource() {
- return resource;
- }
- public void setResource(String resource) {
- this.resource = resource;
- }
-
- public XMPPServerCredentials() {
- super();
- this.accountName = "";
- this.serverUrl = "";
- this.password = "";
- this.serverType = "";
- this.resource = "soapserver"; //Default value
- }
-
- public XMPPServerCredentials(String accountName, String serverUrl,
- String password, String serverType, String resource) {
- super();
- this.accountName = accountName;
- this.serverUrl = serverUrl;
- this.password = password;
- this.serverType = serverType;
- this.resource = resource;
- }
- public String getDomainName() {
- return domainName;
- }
- public void setDomainName(String domainName) {
- this.domainName = domainName;
- }
-
-
-}
diff --git
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPUtils.java
b/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPUtils.java
deleted file mode 100644
index ea1ab7599f..0000000000
---
a/modules/transport/xmpp/src/org/apache/axis2/transport/xmpp/util/XMPPUtils.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.util;
-
-import org.apache.axis2.AxisFault;
-
-
-public class XMPPUtils {
-
- /**
- * Extract XMPP server accountName section from transport URL passed
in.
- * @param transportUrl
- * @return String
- * @throws AxisFault
- */
- public static String getAccountName(String transportUrl) throws AxisFault{
- String accountName = "";
- if(transportUrl == null){
- return null;
- }
-
- if (!transportUrl.startsWith(XMPPConstants.XMPP)) {
- throw new AxisFault ("Invalid XMPP URL : " + transportUrl +
- " Must begin with the prefix xmpp");
- }
- //eg: transportUrl is similar to xmpp://axisserver@sumedha/Version
- int start = transportUrl.indexOf("://") + 3;
- int end = transportUrl.lastIndexOf("/"); //first index
- if(start != -1 && end != -1){
- accountName = transportUrl.substring(start, end);
- }else{
- accountName = transportUrl;
- }
- return accountName;
- }
-
- /**
- * Extract Service name from transport URL passed in
- * @param transportUrl
- * @return
- * @throws AxisFault
- */
- public static String getServiceName(String transportUrl) throws AxisFault{
- String serviceName = "";
- if(transportUrl == null){
- return null;
- }
- if (!transportUrl.startsWith(XMPPConstants.XMPP)) {
- throw new AxisFault ("Invalid XMPP URL : " + transportUrl +
- " Must begin with the prefix xmpp");
- }
- //eg: transportUrl is similar to xmpp://axisserver@sumedha/Version
- int start = transportUrl.lastIndexOf("/") + 1;
- int end = transportUrl.length();
- if(start != -1 && end != -1){
- serviceName = transportUrl.substring(start, end);
- }
- return serviceName;
- }
-
-}
-
diff --git a/modules/webapp/pom.xml b/modules/webapp/pom.xml
index 1d2aa969fb..7a86c41afa 100644
--- a/modules/webapp/pom.xml
+++ b/modules/webapp/pom.xml
@@ -157,25 +157,7 @@
<artifactId>axis2-transport-udp</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>axis2-transport-xmpp</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>jivesoftware</groupId>
- <artifactId>smack</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jivesoftware</groupId>
- <artifactId>smackx</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ <!-- AXIS2-6106: axis2-transport-xmpp removed -->
<dependency><!-- codegen is required for Rampart because of AXIS2-4265
-->
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-codegen</artifactId>
diff --git a/pom.xml b/pom.xml
index c5d1d8bdf9..7669fdffa8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -429,7 +429,8 @@
<module>modules/transport/tcp</module>
<module>modules/transport/testkit</module>
<module>modules/transport/udp</module>
- <module>modules/transport/xmpp</module>
+ <!-- AXIS2-6106: XMPP transport removed — depends on unmaintained
+ jivesoftware:smack (circa 2008), no known users -->
<module>modules/distribution</module>
<module>modules/samples</module>
<module>databinding-tests</module>
diff --git a/src/site/xdoc/docs/toc.xml b/src/site/xdoc/docs/toc.xml
index d65036d854..e08fe9bbfb 100644
--- a/src/site/xdoc/docs/toc.xml
+++ b/src/site/xdoc/docs/toc.xml
@@ -127,7 +127,7 @@ servlet transport</a></li>
<li>18.9 <a href="tcp-transport.html">TCP Transport</a></li>
<li>18.10 <a href="mail-transport.html">Mail Transport</a></li>
<li>18.11 <a href="udp-transport.html">UDP Transport</a></li>
-<li>18.12 <a href="xmpp-transport.html">XMPP Transport</a></li>
+<!-- AXIS2-6106: XMPP transport removed -->
<li>18.13 <a href="transport_howto.html">Custom
Transport</a></li>
</ul>
diff --git a/src/site/xdoc/docs/xmpp-transport.xml
b/src/site/xdoc/docs/xmpp-transport.xml
deleted file mode 100644
index 753c877590..0000000000
--- a/src/site/xdoc/docs/xmpp-transport.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ 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.
- -->
-<document>
- <properties>
- <title>XMPP transport</title>
- </properties>
- <body>
- <section name="Introduction">
- <p>The XMPP transport allows to send and receive chat messages.</p>
- </section>
- <section name="Transport listener">
- <subsection name="Configuration">
- <pre xml:space="preserve"><transportReceiver name="xmpp"
class="org.apache.axis2.transport.xmpp.XMPPListener">
- <!-- Account details for google talk -->
- <parameter name="GoogleServer">
- <parameter
name="transport.xmpp.ServerUrl">talk.google.com</parameter>
- <parameter
name="transport.xmpp.ServerAccountUserName">axis2.xmpp.account1</parameter>
- <parameter
name="transport.xmpp.ServerAccountPassword">apacheaxis2</parameter>
- <parameter
name="transport.xmpp.ServerType">transport.xmpp.ServerType.GoogleTalk</parameter>
- </parameter>
-</transportReceiver></pre>
- </subsection>
- <subsection name="Transport Specific Parameters">
- <p>Following transport specific service parameters are used:</p>
- <table class="bodyTable">
- <tr>
- <th>Parameter</th>
- <th>Required</th>
- <th>Description</th>
- </tr>
- <tr>
- <td>transport.xmpp.ServerUrl</td>
- <td>Yes</td>
- <td>The server url of the XMPP server</td>
- </tr>
- <tr>
- <td>transport.xmpp.ServerAccountUserName</td>
- <td>Yes</td>
- <td>The user name of the XMPP account</td>
- </tr>
- <tr>
- <td>transport.xmpp.ServerAccountPassword</td>
- <td>Yes</td>
- <td>The password for the XMPP account.</td>
- </tr>
- <tr>
- <td>transport.xmpp.ServerType</td>
- <td>Yes</td>
- <td>The type of XMPP server</td>
- </tr>
- </table>
- </subsection>
- </section>
- <section name="Transport sender">
- <subsection name="Configuration">
- <pre xml:space="preserve"><transportSender name="xmpp"
class="org.apache.axis2.transport.xmpp.XMPPSender">
-</transportSender></pre>
- </subsection>
- </section>
- </body>
-</document>