KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > providers > xmpp > XmppEndpointBuilder


1 /*
2  * $Id: XmppEndpointBuilder.java 3798 2006-11-04 04:07:14Z aperepel $
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 MuleSource MPL
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.config.i18n.Message;
14 import org.mule.impl.endpoint.UserInfoEndpointBuilder;
15 import org.mule.umo.endpoint.MalformedEndpointException;
16
17 import java.net.URI JavaDoc;
18 import java.util.Properties JavaDoc;
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  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
26  * @version $Revision: 3798 $
27  */

28 public class XmppEndpointBuilder extends UserInfoEndpointBuilder
29 {
30     protected void setEndpoint(URI JavaDoc uri, Properties JavaDoc props) throws MalformedEndpointException
31     {
32         if (uri.getPath().length() == 0)
33         {
34             throw new MalformedEndpointException(new Message("xmpp", 1), uri.toString());
35         }
36         if (props.getProperty(XmppConnector.XMPP_GROUP_CHAT, "false").equalsIgnoreCase("true"))
37         {
38             if (props.getProperty(XmppConnector.XMPP_NICKNAME, null) == null)
39             {
40                 throw new MalformedEndpointException(new Message("xmpp", 2), uri.toString());
41             }
42         }
43         super.setEndpoint(uri, props);
44     }
45 }
46
Popular Tags