Commit 664ee4c4 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Initialize and start the compoment after the route has been added.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1234 b35dd754-fafc-0310-a699-88a17e54d16e
parent 70c07d7d
......@@ -15,6 +15,7 @@ import org.dom4j.Element;
import org.xmpp.component.Component;
import org.xmpp.component.ComponentManager;
import org.xmpp.component.ComponentManagerFactory;
import org.xmpp.component.ComponentException;
import org.xmpp.packet.IQ;
import org.xmpp.packet.JID;
import org.xmpp.packet.Packet;
......@@ -71,17 +72,27 @@ public class InternalComponentManager implements ComponentManager, RoutableChann
}
}
public void addComponent(String subdomain, Component component) {
public void addComponent(String subdomain, Component component) throws ComponentException {
components.put(subdomain, component);
JID componentJID = new JID(subdomain + "." + serverDomain);
// Initialize the new component
component.initialize(componentJID, this);
// Add the route to the new service provided by the component
XMPPServer.getInstance().getRoutingTable().addRoute(componentJID,
new RoutableComponent(componentJID, component));
// Initialize the new component
try {
component.initialize(componentJID, this);
component.start();
}
catch (ComponentException e) {
// Remove the route
XMPPServer.getInstance().getRoutingTable().removeRoute(componentJID);
// Rethrow the exception
throw e;
}
// Check for potential interested users.
checkPresences();
// Send a disco#info request to the new component. If the component provides information
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment