Coverage Report - org.mule.providers.xmpp.XmppEndpointBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
XmppEndpointBuilder
100%
8/8
100%
6/6
6
 
 1  
 /*
 2  
  * $Id: XmppEndpointBuilder.java 7963 2007-08-21 08:53:15Z 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.impl.endpoint.UserInfoEndpointBuilder;
 14  
 import org.mule.providers.xmpp.i18n.XmppMessages;
 15  
 import org.mule.umo.endpoint.MalformedEndpointException;
 16  
 
 17  
 import java.net.URI;
 18  
 import java.util.Properties;
 19  
 
 20  
 /**
 21  
  * Does the same as the UserINfoEndpointBuilder but also ensures that a path is set
 22  
  * on the uri. The path is used as either the groupChat name or the recipient name of
 23  
  * a one on one chat.
 24  
  */
 25  14
 public class XmppEndpointBuilder extends UserInfoEndpointBuilder
 26  
 {
 27  
     protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException
 28  
     {
 29  14
         if (uri.getPath().length() == 0)
 30  
         {
 31  2
             throw new MalformedEndpointException(XmppMessages.noRecipientInUri(), uri.toString());
 32  
         }
 33  12
         if (props.getProperty(XmppConnector.XMPP_GROUP_CHAT, "false").equalsIgnoreCase("true"))
 34  
         {
 35  4
             if (props.getProperty(XmppConnector.XMPP_NICKNAME, null) == null)
 36  
             {
 37  2
                 throw new MalformedEndpointException(XmppMessages.nicknameMustBeSet(), uri.toString());
 38  
             }
 39  
         }
 40  10
         super.setEndpoint(uri, props);
 41  10
     }
 42  
 }