@Override public void process(Packet packet) throws PacketException { Component component = getNextComponent(); component.processPacket(packet); } }
/** * 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); } }
/** * 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); } }
component.initialize(componentJID, this); component.start(); throw new ComponentException(e);
public SipComponent() { this.componentManager = ComponentManagerFactory.getComponentManager(); SessionEventDispatcher.addListener(this); }
/** * 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); } }
/** * Default implementation of the shutdown() method of the {@link Component} * interface. */ public final void shutdown() { preComponentShutdown(); closeQueue(); postComponentShutdown(); }
/** * Utility method that will start the processing of a stanza. This method * will defer processing to another method, determined by the stanza type. * * @param packet * The stanza that will be processed. */ final private void processQueuedPacket(final Packet packet) { if (packet instanceof IQ) { processIQ((IQ) packet); } else if (packet instanceof Message) { processMessage((Message) packet); } else if (packet instanceof Presence) { processPresence((Presence) packet); } }
component.shutdown();
if (listener != null) { listener.answerTimeout(packetId);
@Override public void start() { // Set this ComponentManager as the current component manager ComponentManagerFactory.setComponentManager(instance); XMPPServer server = XMPPServer.getInstance(); serverDomain = server.getServerInfo().getXMPPDomain(); // Set the address of this internal service. component.[domain] serviceAddress = new JID(null, "component." + serverDomain, null); if (!server.isSetupMode()) { // Add a route to this service server.getRoutingTable().addComponentRoute(getAddress(), this); } }
if (iqResultListener != null) { try { iqResultListener.receivedAnswer(packet);
public void initialize(JID jid, ComponentManager componentManager) throws ComponentException { component.initialize(jid, componentManager); }
public void start() { // Everything went fine so start reading packets from the server readerThread = new SocketReadThread(this, reader); readerThread.setDaemon(true); readerThread.start(); // Notify the component that it will be notified of new received packets component.start(); }
/** * Initialize the abstract component. * * @see org.xmpp.component.Component#initialize(org.xmpp.packet.JID, * org.xmpp.component.ComponentManager) */ public final void initialize(final JID jid, final ComponentManager componentManager) throws ComponentException { compMan = componentManager; this.jid = jid; // start the executor service. startExecutor(); }
public String getDescription() { return component.getDescription(); }
public String getName() { return component.getName(); }
/** * Send a disco#info request to the new component. If the component provides information * then it will be added to the list of discoverable server items. * * @param component the new component that was added to this manager. * @param componentJID the XMPP address of the new component. */ private void checkDiscoSupport(Component component, JID componentJID) { // Build a disco#info request that will be sent to the component IQ iq = new IQ(IQ.Type.get); iq.setFrom(getAddress()); iq.setTo(componentJID); iq.setChildElement("query", "http://jabber.org/protocol/disco#info"); // Send the disco#info request to the component. The reply (if any) will be processed in // #process(Packet) // sendPacket(component, iq); component.processPacket(iq); }
public void shutdown() { shutdown = true; // Notify the component to shutdown component.shutdown(); disconnect(); }
@Override public void process(Packet packet) throws PacketException { Component component = getNextComponent(); component.processPacket(packet); } }