View Javadoc

1   /*
2    * $Id: XmppsConnector.java 9169 2007-10-16 12:47:45Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.providers.xmpp;
12  
13  import org.mule.umo.endpoint.UMOEndpointURI;
14  
15  import org.jivesoftware.smack.SSLXMPPConnection;
16  import org.jivesoftware.smack.XMPPConnection;
17  import org.jivesoftware.smack.XMPPException;
18  
19  public class XmppsConnector extends XmppConnector
20  {
21      public String getProtocol()
22      {
23          return "xmpps";
24      }
25  
26      /**
27       * This method creates a {@link SSLXMPPConnection} to allow secure communication to the Jabber
28       * server.
29       */
30      protected XMPPConnection doCreateXmppConnection(UMOEndpointURI endpointURI) throws XMPPException
31      {
32          XMPPConnection xmppConnection = null;
33          
34          if (endpointURI.getPort() != -1)
35          {
36              xmppConnection = new SSLXMPPConnection(endpointURI.getHost(), endpointURI.getPort());
37          }
38          else
39          {
40              xmppConnection = new SSLXMPPConnection(endpointURI.getHost());
41          }
42          
43          return xmppConnection;
44      }
45  }