Commit c437bd2c authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

Start and stop work

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8591 b35dd754-fafc-0310-a699-88a17e54d16e
parent f046600d
...@@ -16,10 +16,7 @@ import org.jivesoftware.openfire.*; ...@@ -16,10 +16,7 @@ import org.jivesoftware.openfire.*;
import org.jivesoftware.openfire.container.BasicModule; import org.jivesoftware.openfire.container.BasicModule;
import org.jivesoftware.openfire.disco.IQDiscoItemsHandler; import org.jivesoftware.openfire.disco.IQDiscoItemsHandler;
import org.jivesoftware.openfire.session.ComponentSession; import org.jivesoftware.openfire.session.ComponentSession;
import org.jivesoftware.util.JiveGlobals; import org.jivesoftware.util.*;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.PropertyEventDispatcher;
import org.jivesoftware.util.PropertyEventListener;
import org.xmpp.component.Component; import org.xmpp.component.Component;
import org.xmpp.component.ComponentException; import org.xmpp.component.ComponentException;
import org.xmpp.component.ComponentManager; import org.xmpp.component.ComponentManager;
...@@ -65,16 +62,21 @@ public class InternalComponentManager extends BasicModule implements ComponentMa ...@@ -65,16 +62,21 @@ public class InternalComponentManager extends BasicModule implements ComponentMa
private String serverDomain; private String serverDomain;
private final RoutingTable routingTable; private final RoutingTable routingTable;
private final IQDiscoItemsHandler discoItemsHandler; private final IQDiscoItemsHandler discoItemsHandler;
private final JiveProperties jiveProperties;
public InternalComponentManager() { public InternalComponentManager() {
this(XMPPServer.getInstance().getRoutingTable(), XMPPServer.getInstance().getIQDiscoItemsHandler()); this(XMPPServer.getInstance().getRoutingTable(),
XMPPServer.getInstance().getIQDiscoItemsHandler(), JiveProperties.getInstance());
} }
public InternalComponentManager(RoutingTable routingTable, IQDiscoItemsHandler discoItemsHandler) { public InternalComponentManager(RoutingTable routingTable, IQDiscoItemsHandler discoItemsHandler,
JiveProperties jiveProperties)
{
super("Internal Component Manager"); super("Internal Component Manager");
instance = this; instance = this;
this.routingTable = routingTable; this.routingTable = routingTable;
this.discoItemsHandler = discoItemsHandler; this.discoItemsHandler = discoItemsHandler;
this.jiveProperties = jiveProperties;
} }
public static InternalComponentManager getInstance() { public static InternalComponentManager getInstance() {
...@@ -530,6 +532,12 @@ public class InternalComponentManager extends BasicModule implements ComponentMa ...@@ -530,6 +532,12 @@ public class InternalComponentManager extends BasicModule implements ComponentMa
} }
public synchronized void start() { public synchronized void start() {
if(jiveProperty != null) {
jiveProperties.put(jiveProperty, Boolean.TRUE.toString());
}
else {
startComponent();
}
} }
private synchronized void startComponent() { private synchronized void startComponent() {
...@@ -543,6 +551,12 @@ public class InternalComponentManager extends BasicModule implements ComponentMa ...@@ -543,6 +551,12 @@ public class InternalComponentManager extends BasicModule implements ComponentMa
} }
public synchronized void stop() { public synchronized void stop() {
if(jiveProperty != null) {
jiveProperties.put(jiveProperty, Boolean.FALSE.toString());
}
else {
stopComponent();
}
} }
private synchronized void stopComponent() { private synchronized void stopComponent() {
......
...@@ -27,6 +27,7 @@ import org.jivesoftware.openfire.handler.IQAuthHandler; ...@@ -27,6 +27,7 @@ import org.jivesoftware.openfire.handler.IQAuthHandler;
import org.jivesoftware.openfire.handler.PresenceUpdateHandler; import org.jivesoftware.openfire.handler.PresenceUpdateHandler;
import org.jivesoftware.openfire.handler.PresenceSubscribeHandler; import org.jivesoftware.openfire.handler.PresenceSubscribeHandler;
import org.jivesoftware.openfire.roster.RosterManager; import org.jivesoftware.openfire.roster.RosterManager;
import org.jivesoftware.util.JiveProperties;
import org.xmpp.component.ComponentManager; import org.xmpp.component.ComponentManager;
import org.xmpp.component.ComponentManagerFactory; import org.xmpp.component.ComponentManagerFactory;
...@@ -36,6 +37,8 @@ import org.xmpp.component.ComponentManagerFactory; ...@@ -36,6 +37,8 @@ import org.xmpp.component.ComponentManagerFactory;
public class PluginModule extends AbstractModule { public class PluginModule extends AbstractModule {
protected void configure() { protected void configure() {
bind(JiveProperties.class).toInstance(JiveProperties.getInstance());
XMPPServer server = XMPPServer.getInstance(); XMPPServer server = XMPPServer.getInstance();
bind(XMPPServer.class).toInstance(server); bind(XMPPServer.class).toInstance(server);
bind(ConnectionManager.class).toInstance(server.getConnectionManager()); bind(ConnectionManager.class).toInstance(server.getConnectionManager());
......
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