/** * Start this instance by created XMPP account using igven parameters. * * @param serverAddress XMPP server address. * @param xmppDomain XMPP authentication domain. * @param xmppLoginPassword XMPP login(optional). * @param nickName authentication login. * @param listener the listener that will be notified about created protocol provider's * registration state changes. */ public void start( String serverAddress, String xmppDomain, String xmppLoginPassword, String nickName, RegistrationStateChangeListener listener) { this.regListener = listener; xmppProviderFactory = ProtocolProviderFactory.getProtocolProviderFactory( FocusBundleActivator.bundleContext, ProtocolNames.JABBER); if (xmppLoginPassword != null) { xmppAccount = xmppProviderFactory.createAccount( FocusAccountFactory.createFocusAccountProperties( serverAddress, xmppDomain, nickName, xmppLoginPassword)); } else { xmppAccount = xmppProviderFactory.createAccount( FocusAccountFactory.createFocusAccountProperties( serverAddress, xmppDomain, nickName)); } if (!xmppProviderFactory.loadAccount(xmppAccount)) { throw new RuntimeException("Failed to load account: " + xmppAccount); } ServiceReference protoRef = xmppProviderFactory.getProviderForAccount(xmppAccount); protocolService = (ProtocolProviderService) FocusBundleActivator.bundleContext.getService(protoRef); protocolService.addRegistrationStateChangeListener(this); }