Package org.apache.cayenne.event
Class XMPPBridge
- java.lang.Object
-
- org.apache.cayenne.event.EventBridge
-
- org.apache.cayenne.event.XMPPBridge
-
- All Implemented Interfaces:
EventListener
public class XMPPBridge extends org.apache.cayenne.event.EventBridgeAn EventBridge implementation based on XMPP protocol and Smack XMPP client library. What's good about XMPP (Extensible Messaging and Presence Protocol, an IETF standard protocol that grew up from Jabber IM) is that generally it has fewer or no deployment limitations (unlike JMS and JGroups that are generally a good solution for local controlled networks). Also it provides lots of additional information for free, such as presence, and much more.This implementation is based on Smack XMPP client library from JiveSoftware.
- Since:
- 1.2
-
-
Field Summary
Fields Modifier and Type Field Description protected StringchatServiceprotected booleanconnectedprotected org.jivesoftware.smack.XMPPConnectionconnectionprotected org.jivesoftware.smack.GroupChatgroupChatprotected StringloginIdprotected Stringpasswordprotected booleansecureConnectionprotected StringsessionHandlestatic StringXMPP_CHAT_SERVICE_PROPERTYAn optional property, "conference" is used as default chat service.static StringXMPP_HOST_PROPERTYstatic StringXMPP_LOGIN_PROPERTYstatic StringXMPP_PASSWORD_PROPERTYstatic StringXMPP_PORT_PROPERTYAn optional property, port 5222 is used as default XMPP port.static StringXMPP_SECURE_CONNECTION_PROPERTYprotected StringxmppHostprotected intxmppPort
-
Constructor Summary
Constructors Constructor Description XMPPBridge(Collection<org.apache.cayenne.event.EventSubject> localSubjects, String externalSubject)Creates an XMPPBridge.XMPPBridge(Collection<org.apache.cayenne.event.EventSubject> localSubjects, String externalSubject, Map<String,String> properties)XMPPBridge(org.apache.cayenne.event.EventSubject localSubject, String externalSubject)Creates an XMPPBridge.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetChatService()StringgetLoginId()StringgetPassword()StringgetSessionHandle()StringgetXmppHost()intgetXmppPort()booleanisSecureConnection()protected voidsendExternalEvent(org.apache.cayenne.event.CayenneEvent localEvent)voidsetChatService(String chatService)voidsetLoginId(String loginId)voidsetPassword(String password)voidsetSecureConnection(boolean secureConnection)voidsetSessionHandle(String sessionHandle)voidsetXmppHost(String xmppHost)voidsetXmppPort(int xmppPort)protected voidshutdownExternal()protected voidstartupExternal()
-
-
-
Field Detail
-
XMPP_HOST_PROPERTY
public static final String XMPP_HOST_PROPERTY
- See Also:
- Constant Field Values
-
XMPP_PORT_PROPERTY
public static final String XMPP_PORT_PROPERTY
An optional property, port 5222 is used as default XMPP port.- See Also:
- Constant Field Values
-
XMPP_CHAT_SERVICE_PROPERTY
public static final String XMPP_CHAT_SERVICE_PROPERTY
An optional property, "conference" is used as default chat service.- See Also:
- Constant Field Values
-
XMPP_SECURE_CONNECTION_PROPERTY
public static final String XMPP_SECURE_CONNECTION_PROPERTY
- See Also:
- Constant Field Values
-
XMPP_LOGIN_PROPERTY
public static final String XMPP_LOGIN_PROPERTY
- See Also:
- Constant Field Values
-
XMPP_PASSWORD_PROPERTY
public static final String XMPP_PASSWORD_PROPERTY
- See Also:
- Constant Field Values
-
secureConnection
protected boolean secureConnection
-
loginId
protected String loginId
-
password
protected String password
-
xmppHost
protected String xmppHost
-
xmppPort
protected int xmppPort
-
chatService
protected String chatService
-
sessionHandle
protected String sessionHandle
-
connection
protected org.jivesoftware.smack.XMPPConnection connection
-
groupChat
protected org.jivesoftware.smack.GroupChat groupChat
-
connected
protected boolean connected
-
-
Constructor Detail
-
XMPPBridge
public XMPPBridge(org.apache.cayenne.event.EventSubject localSubject, String externalSubject)Creates an XMPPBridge. External subject will be used as the chat group name.
-
XMPPBridge
public XMPPBridge(Collection<org.apache.cayenne.event.EventSubject> localSubjects, String externalSubject)
Creates an XMPPBridge. External subject will be used as the chat group name.
-
XMPPBridge
public XMPPBridge(Collection<org.apache.cayenne.event.EventSubject> localSubjects, String externalSubject, Map<String,String> properties)
-
-
Method Detail
-
getXmppHost
public String getXmppHost()
-
setXmppHost
public void setXmppHost(String xmppHost)
-
getXmppPort
public int getXmppPort()
-
setXmppPort
public void setXmppPort(int xmppPort)
-
getLoginId
public String getLoginId()
-
setLoginId
public void setLoginId(String loginId)
-
getPassword
public String getPassword()
-
setPassword
public void setPassword(String password)
-
isSecureConnection
public boolean isSecureConnection()
-
setSecureConnection
public void setSecureConnection(boolean secureConnection)
-
getChatService
public String getChatService()
-
setChatService
public void setChatService(String chatService)
-
getSessionHandle
public String getSessionHandle()
-
setSessionHandle
public void setSessionHandle(String sessionHandle)
-
startupExternal
protected void startupExternal() throws Exception- Specified by:
startupExternalin classorg.apache.cayenne.event.EventBridge- Throws:
Exception
-
shutdownExternal
protected void shutdownExternal() throws Exception- Specified by:
shutdownExternalin classorg.apache.cayenne.event.EventBridge- Throws:
Exception
-
-