View Javadoc

1   /*
2    * $Id: XmppsConnector.java 10489 2008-01-23 17:53:38Z dfeist $
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.transport.xmpp;
12  
13  import org.mule.api.endpoint.EndpointURI;
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  
22      public static final String XMPPS = "xmpps";
23  
24      public String getProtocol()
25      {
26          return XMPPS;
27      }
28  
29      /**
30       * This method creates a {@link SSLXMPPConnection} to allow secure communication to the Jabber
31       * server.
32       */
33      protected XMPPConnection doCreateXmppConnection(EndpointURI endpointURI) throws XMPPException
34      {
35          XMPPConnection xmppConnection = null;
36          
37          if (endpointURI.getPort() != -1)
38          {
39              xmppConnection = new SSLXMPPConnection(endpointURI.getHost(), endpointURI.getPort());
40          }
41          else
42          {
43              xmppConnection = new SSLXMPPConnection(endpointURI.getHost());
44          }
45          
46          return xmppConnection;
47      }
48      
49  }