/** * Registers a new MultiUserChatService implementation to the manager. * This is typically used if you have a custom MUC implementation that you * want to register with the manager. In other words, it may not be database * stored and may follow special rules, implementating MultiUserChatService. * It is also used internally to register services from the database. Triggers * the service to start up. * * @param service The MultiUserChatService to be registered. */ public void registerMultiUserChatService(MultiUserChatService service) { Log.debug("MultiUserChatManager: Registering MUC service "+service.getServiceName()); try { ComponentManagerFactory.getComponentManager().addComponent(service.getServiceName(), service); mucServices.put(service.getServiceName(), service); } catch (ComponentException e) { Log.error("MultiUserChatManager: Unable to add "+service.getServiceName()+" as component.", e); } }
/** * Unregisters a MultiUserChatService from the manager. It can be used * to explicitly unregister services, and is also used internally to unregister * database stored services. Triggers the service to shut down. * * @param subdomain The subdomain of the service to be unregistered. */ public void unregisterMultiUserChatService(String subdomain) { Log.debug("MultiUserChatManager: Unregistering MUC service "+subdomain); MultiUserChatService service = mucServices.get(subdomain); if (service != null) { service.shutdown(); try { ComponentManagerFactory.getComponentManager().removeComponent(subdomain); } catch (ComponentException e) { Log.error("MultiUserChatManager: Unable to remove "+subdomain+" from component manager.", e); } mucServices.remove(subdomain); } }
/** * Helper method to send packets. * * @param packet * The packet to send. */ protected void send(Packet packet) { try { compMan.sendPacket(this, packet); } catch (ComponentException e) { log.warn("(serving component '" + getName() + "') Could not send packet!", e); } }
componentManager.removeComponent(component.getSubdomain()); componentManager.addComponent( subdomain, component );
.setText(sipAccount.getUsername() + "@" + componentManager.getServerName()); registration.addElement("username").setText(sipAccount.getSipUsername()); registration.addElement("authUsername").setText(sipAccount.getAuthUsername()); componentManager.sendPacket(this, reply);
/** * Sends a packet to the component manager in the XMPP server. * * @param packet * packet to send. */ public void sendPacket(Packet packet) { try { getComponentManager().sendPacket(this, packet); } catch (Exception e) { logger.error(GtmsLog.exceptionToString(e)); } }
public void send(Packet packet) { try { logger.debug(packet.toXML()); ComponentManagerFactory.getComponentManager().sendPacket(component, packet); } catch (ComponentException e) { logger.error(GtmsLog.exceptionToString(e)); } }
@Override public void destroy() { if (componentManager != null && component != null) { try { componentManager.removeComponent(component.getSubdomain()); } catch (ComponentException ce) { Log.warn( "An unexpected exception occurred while destroying the wrapper.", ce ); } componentManager = null; component = null; } pluginDirectory = null; }
/** * Registers a new MultiUserChatService implementation to the manager. * This is typically used if you have a custom MUC implementation that you * want to register with the manager. In other words, it may not be database * stored and may follow special rules, implementating MultiUserChatService. * It is also used internally to register services from the database. Triggers * the service to start up. * * @param service The MultiUserChatService to be registered. */ public void registerMultiUserChatService(MultiUserChatService service) { Log.debug("MultiUserChatManager: Registering MUC service "+service.getServiceName()); try { ComponentManagerFactory.getComponentManager().addComponent(service.getServiceName(), service); mucServices.put(service.getServiceName(), service); } catch (ComponentException e) { Log.error("MultiUserChatManager: Unable to add "+service.getServiceName()+" as component.", e); } }
/** * Handles status requests sent to the packet handler. Reports back with the * status, description and dump of any problem as a Gtx message. * * @param status * the status to packetize. * @param to * the jid requesting plugin status. */ public void send(GtmsStatus status, JID to) { try { ComponentManagerFactory.getComponentManager().sendPacket(component, getPacket(status, componentJID, to)); } catch (ComponentException e) { logger.error(GtmsLog.exceptionToString(e)); } }
/** * Unregisters a MultiUserChatService from the manager. It can be used * to explicitly unregister services, and is also used internally to unregister * database stored services. Triggers the service to shut down. * * @param subdomain The subdomain of the service to be unregistered. */ public void unregisterMultiUserChatService(String subdomain) { Log.debug("MultiUserChatManager: Unregistering MUC service "+subdomain); MultiUserChatService service = mucServices.get(subdomain); if (service != null) { service.shutdown(); try { ComponentManagerFactory.getComponentManager().removeComponent(subdomain); } catch (ComponentException e) { Log.error("MultiUserChatManager: Unable to remove "+subdomain+" from component manager.", e); } mucServices.remove(subdomain); } }
ComponentManagerFactory.getComponentManager().addComponent(jicofoSubdomain, jicofoComponent);
/** * Handles status requests sent to the packet handler. Reports back with the * status, description and dump of any problem as a Gtx IQ to the * IQ.getFrom(). * * @param status * the status to packetize. * @param iq * the original IQ requesting plugin status. */ public void send(GtmsStatus status, IQ iq) { try { ComponentManagerFactory.getComponentManager().sendPacket(component, getPacket(status, iq)); } catch (ComponentException e) { logger.error(GtmsLog.exceptionToString(e)); } }
@Override public void destroy() { if ( initThread != null && initThread.isAlive() ) { initThread.interrupt(); initThread = null; } ((InternalComponentManager) ComponentManagerFactory.getComponentManager()).removeListener( this ); try { Log.debug( "Destroying Jitsi Focus Component..." ); if ( jicofoComponent == null) { Log.warn( "Unable to destroy the Jitsi Focus Component, as none appears to be running!" ); } else { ComponentManagerFactory.getComponentManager().removeComponent(jicofoSubdomain); jicofoSubdomain = null; jicofoComponent.dispose(); jicofoComponent = null; } Log.trace( "Successfully destroyed Jitsi Focus Component. " ); } catch ( Exception ex ) { Log.error( "An exception occurred while trying to destroy the Jitsi Jicofo wrapper.", ex ); } }
/** * Handles requests sent to the packet handler. Reports back with the call * event. * * @param callCollection * the collection of calls to packetize. * @param to * the jid requesting plugin status. */ public void send(GtxCallCollection callCollection, JID to, String systemId, String systemUid, String deviceName) { try { ComponentManagerFactory.getComponentManager().sendPacket(component, getPacket(callCollection, componentJID, to, systemId, systemUid, deviceName)); callCollection.clearNotificationState(); } catch (ComponentException e) { logger.error(GtmsLog.exceptionToString(e)); } }
public Response answerTimeout() { BaseResponse response = new BaseResponse(); IQ reply = IQ.createResultIQ(iq); reply.setType(org.xmpp.packet.IQ.Type.error); PacketError error = new PacketError(org.xmpp.packet.PacketError.Condition.undefined_condition, org.xmpp.packet.PacketError.Type.cancel, "Timeout Error"); reply.setError(error); response.setResponseType(ResponseType.ERROR); try { ComponentManagerFactory.getComponentManager().sendPacket(component, reply); response.setResponseType(ResponseType.OK); setExecuted(true); } catch (ComponentException e) { logger.error(GtmsLog.exceptionToString(e)); } return response; }
@Override public Response execute() throws ActionExecutionException { BaseResponse response = new BaseResponse(); IQ reply = IQ.createResultIQ(iq); if (resultBody != null) { reply.setType(org.xmpp.packet.IQ.Type.result); reply.setChildElement(resultBody); } else { reply.setType(org.xmpp.packet.IQ.Type.error); PacketError error = new PacketError(org.xmpp.packet.PacketError.Condition.undefined_condition, org.xmpp.packet.PacketError.Type.cancel, "Timeout Error"); reply.setError(error); response.setResponseType(ResponseType.ERROR); } try { ComponentManagerFactory.getComponentManager().sendPacket(component, reply); response.setResponseType(ResponseType.OK); setExecuted(true); } catch (ComponentException e) { throw new ActionExecutionException(e); } return response; }