Package org.jivesoftware.openfire
Class XMPPServer
java.lang.Object
org.jivesoftware.openfire.XMPPServer
The main XMPP server that will load, initialize and start all the server's
modules. The server is unique in the JVM and could be obtained by using the
getInstance() method.
The loaded modules will be initialized and may access through the server other modules. This means that the only way for a module to locate another module is through the server. The server maintains a list of loaded modules.
After starting up all the modules the server will load any available plugin.
For more information see: PluginManager.
A configuration file keeps the server configuration. This information is required for the server to work correctly. The server assumes that the configuration file is named openfire.xml and is located in the conf folder. The folder that keeps the configuration file must be located under the home folder. The server will try different methods to locate the home folder.
- system property - The server will use the value defined in the openfireHome system property.
- working folder - The server will check if there is a conf folder in the working directory. This is the case when running in standalone mode.
- openfire_init.xml file - Attempt to load the value from openfire_init.xml which must be in the classpath
- Author:
- Gaston Dombiak
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddServerListener(XMPPServerListener listener) Adds a new server listener that will be notified when the server has been started or is about to be stopped.org.xmpp.packet.JIDCreates an XMPPAddress local to this server.org.xmpp.packet.JIDCreates an XMPPAddress local to this server.voidFinish the setup process.Returns theAdHocCommandHandlerregistered with this server.Collection<org.xmpp.packet.JID>Returns a collection with the JIDs of the server's admins.Returns theArchiveManagerregistered with this server.Returns theAuditManagerregistered with this server.Returns theCertificateExpiryCheckerregistered with this server.Returns theCertificateStoreManagerregistered with this server.Returns theConnectionManagerregistered with this server.Returns the default node ID used by this server before clustering is initialized.Returns theEntityCapabilitiesManagerregistered with this server.Returns theFileTransferManagerregistered with this server.Returns theFileTransferProxyregistered with this server.static XMPPServerReturns a singleton instance of XMPPServer.Returns theIQDiscoInfoHandlerregistered with this server.Returns theIQDiscoItemsHandlerregistered with this server.Returns a list with all the modules registered with the server that inherit from IQHandler.Returns theIQPEPHandlerregistered with this server.Returns theIQRegisterHandlerregistered with this server.Returns theIQRouterregistered with this server.Returns theLockOutManagerregistered with this server.Returns theMediaProxyServiceregistered with this server.Returns theMessageRouterregistered with this server.Returns theMulticastRouterregistered with this server.Returns theMultiUserChatManagerregistered with this server.Returns an ID that uniquely identifies this server in a cluster.Returns theOfflineMessageStoreregistered with this server.Returns theOfflineMessageStrategyregistered with this server.Returns thePacketDelivererregistered with this server.Returns thePacketRouterregistered with this server.Returns thePluginManagerinstance registered with this server.Returns thePresenceManagerregistered with this server.Returns thePresenceRouterregistered with this server.Returns thePresenceSubscribeHandlerregistered with this server.Returns thePresenceUpdateHandlerregistered with this server.Returns thePrivateStorageregistered with this server.Returns thePubSubModuleregistered with this server.Returns the locator to use to find sessions hosted in other cluster nodes.Returns theRosterManagerregistered with this server.Returns theRoutingTableregistered with this server.Returns a snapshot of the server's status.Returns theSessionManagerregistered with this server.Returns theTransportHandlerregistered with this server.Returns theUpdateManagerregistered with this server.Returns theUserManagerregistered with this server.Returns theVCardManagerregistered with this server.booleanisLocal(org.xmpp.packet.JID jid) Returns true if the given address is local to the server (managed by this server domain).booleanisRemote(org.xmpp.packet.JID jid) Returns true if the domain-part of the given address does not match the local server hostname and does not match a component service JIDbooleanbooleanbooleanReturns true if the server is being shutdown.booleanReturns if the server is running in standalone mode.booleanReturns whether or not the server has been started.booleanmatchesComponent(org.xmpp.packet.JID jid) Returns true if the domain-part of the given address matches a component service JID for a component that is connected to the local XMPP domain.voidremoveServerListener(XMPPServerListener listener) Removes a server listener that was being notified when the server was being started or was about to be stopped.voidrestart()Restarts the server and all it's modules only if the server is restartable.voidRestarts the HTTP server only when running in stand alone mode.Future<?>sendMessageToAdmins(String message) Asynchronously send a message to every administrator on the system.static voidsetInstance(XMPPServer instance) Deprecated.- for test use onlyvoidSets an ID that uniquely identifies this server in a cluster.voidsetRemoteSessionLocator(RemoteSessionLocator remoteSessionLocator) Sets the locator to use to find sessions hosted in other cluster nodes.voidstart()voidstop()Stops the server only if running in standalone mode.
-
Field Details
-
EXIT
- See Also:
-
-
Constructor Details
-
XMPPServer
public XMPPServer()Creates a server and starts it.
-
-
Method Details
-
getInstance
Returns a singleton instance of XMPPServer.- Returns:
- an instance.
-
setInstance
Deprecated.- for test use onlyTODO: (2019-04-24) Remove and replace with Mockito mocking of static methods, when available- Parameters:
instance- the mock/stub/spy XMPPServer to return whengetInstance()is called.
-
getServerInfo
Returns a snapshot of the server's status.- Returns:
- the server information current at the time of the method call.
-
isLocal
public boolean isLocal(org.xmpp.packet.JID jid) Returns true if the given address is local to the server (managed by this server domain). Return false even if the jid's domain matches a local component's service JID.- Parameters:
jid- the JID to check.- Returns:
- true if the address is a local address to this server.
-
isRemote
public boolean isRemote(org.xmpp.packet.JID jid) Returns true if the domain-part of the given address does not match the local server hostname and does not match a component service JID- Parameters:
jid- the JID to check.- Returns:
- true if the given address does not match the local server hostname and does not match a component service JID.
-
getNodeID
Returns an ID that uniquely identifies this server in a cluster. When not running in cluster mode the returned value is always the same. However, when in cluster mode the value should be set when joining the cluster and must be unique even upon restarts of this node.- Returns:
- an ID that uniquely identifies this server in a cluster.
-
setNodeID
Sets an ID that uniquely identifies this server in a cluster. When not running in cluster mode the returned value is always the same. However, when in cluster mode the value should be set when joining the cluster and must be unique even upon restarts of this node.- Parameters:
nodeID- an ID that uniquely identifies this server in a cluster or null if not in a cluster.
-
getDefaultNodeID
Returns the default node ID used by this server before clustering is initialized.- Returns:
- The default node ID.
-
matchesComponent
public boolean matchesComponent(org.xmpp.packet.JID jid) Returns true if the domain-part of the given address matches a component service JID for a component that is connected to the local XMPP domain.- Parameters:
jid- the JID to check.- Returns:
- true if the given address matches a component service JID.
-
createJID
Creates an XMPPAddress local to this server.- Parameters:
username- the user name portion of the id or null to indicate none is needed.resource- the resource portion of the id or null to indicate none is needed.- Returns:
- an XMPPAddress for the server.
-
createJID
Creates an XMPPAddress local to this server. The construction of the new JID can be optimized by skipping stringprep operations.- Parameters:
username- the user name portion of the id or null to indicate none is needed.resource- the resource portion of the id or null to indicate none is needed.skipStringprep- true if stringprep should not be applied.- Returns:
- an XMPPAddress for the server.
-
getAdmins
Returns a collection with the JIDs of the server's admins. The collection may include JIDs of local users and users of remote servers.- Returns:
- a collection with the JIDs of the server's admins.
-
addServerListener
Adds a new server listener that will be notified when the server has been started or is about to be stopped.- Parameters:
listener- the new server listener to add.
-
removeServerListener
Removes a server listener that was being notified when the server was being started or was about to be stopped.- Parameters:
listener- the server listener to remove.
-
finishSetup
public void finishSetup()Finish the setup process. Because this method is meant to be called from inside the Admin console plugin, it spawns its own thread to do the work so that the class loader is correct. -
start
public void start() -
restart
public void restart()Restarts the server and all it's modules only if the server is restartable. Otherwise do nothing. -
restartHTTPServer
public void restartHTTPServer()Restarts the HTTP server only when running in stand alone mode. The restart process will be done in another thread that will wait 1 second before doing the actual restart. The delay will give time to the page that requested the restart to fully render its content. -
stop
public void stop()Stops the server only if running in standalone mode. Do nothing if the server is running inside of another server. -
isSetupMode
public boolean isSetupMode() -
isRestartable
public boolean isRestartable() -
isStandAlone
public boolean isStandAlone()Returns if the server is running in standalone mode. We consider that it's running in standalone if the "org.jivesoftware.openfire.starter.ServerStarter" class is present in the system.- Returns:
- true if the server is running in standalone mode.
-
isShuttingDown
public boolean isShuttingDown()Returns true if the server is being shutdown.- Returns:
- true if the server is being shutdown.
-
getConnectionManager
Returns theConnectionManagerregistered with this server. TheConnectionManagerwas registered with the server as a module while starting up the server.- Returns:
- the
ConnectionManagerregistered with this server.
-
getRoutingTable
Returns theRoutingTableregistered with this server. TheRoutingTablewas registered with the server as a module while starting up the server.- Returns:
- the
RoutingTableregistered with this server.
-
getPacketDeliverer
Returns thePacketDelivererregistered with this server. ThePacketDelivererwas registered with the server as a module while starting up the server.- Returns:
- the
PacketDelivererregistered with this server.
-
getRosterManager
Returns theRosterManagerregistered with this server. TheRosterManagerwas registered with the server as a module while starting up the server.- Returns:
- the
RosterManagerregistered with this server.
-
getPresenceManager
Returns thePresenceManagerregistered with this server. ThePresenceManagerwas registered with the server as a module while starting up the server.- Returns:
- the
PresenceManagerregistered with this server.
-
getOfflineMessageStore
Returns theOfflineMessageStoreregistered with this server. TheOfflineMessageStorewas registered with the server as a module while starting up the server.- Returns:
- the
OfflineMessageStoreregistered with this server.
-
getOfflineMessageStrategy
Returns theOfflineMessageStrategyregistered with this server. TheOfflineMessageStrategywas registered with the server as a module while starting up the server.- Returns:
- the
OfflineMessageStrategyregistered with this server.
-
getPacketRouter
Returns thePacketRouterregistered with this server. ThePacketRouterwas registered with the server as a module while starting up the server.- Returns:
- the
PacketRouterregistered with this server.
-
getIQRegisterHandler
Returns theIQRegisterHandlerregistered with this server. TheIQRegisterHandlerwas registered with the server as a module while starting up the server.- Returns:
- the
IQRegisterHandlerregistered with this server.
-
getIQPEPHandler
Returns theIQPEPHandlerregistered with this server. TheIQPEPHandlerwas registered with the server as a module while starting up the server.- Returns:
- the
IQPEPHandlerregistered with this server.
-
getPluginManager
Returns thePluginManagerinstance registered with this server.- Returns:
- the PluginManager instance.
-
getPubSubModule
Returns thePubSubModuleregistered with this server. ThePubSubModulewas registered with the server as a module while starting up the server.- Returns:
- the
PubSubModuleregistered with this server.
-
getArchiveManager
Returns theArchiveManagerregistered with this server. TheArchiveManagerwas registered with the server as a module while starting up the server.- Returns:
- the
ArchiveManagerregistered with this server.
-
getIQHandlers
Returns a list with all the modules registered with the server that inherit from IQHandler.- Returns:
- a list with all the modules registered with the server that inherit from IQHandler.
-
getSessionManager
Returns theSessionManagerregistered with this server. TheSessionManagerwas registered with the server as a module while starting up the server.- Returns:
- the
SessionManagerregistered with this server.
-
getTransportHandler
Returns theTransportHandlerregistered with this server. TheTransportHandlerwas registered with the server as a module while starting up the server.- Returns:
- the
TransportHandlerregistered with this server.
-
getPresenceUpdateHandler
Returns thePresenceUpdateHandlerregistered with this server. ThePresenceUpdateHandlerwas registered with the server as a module while starting up the server.- Returns:
- the
PresenceUpdateHandlerregistered with this server.
-
getPresenceSubscribeHandler
Returns thePresenceSubscribeHandlerregistered with this server. ThePresenceSubscribeHandlerwas registered with the server as a module while starting up the server.- Returns:
- the
PresenceSubscribeHandlerregistered with this server.
-
getIQRouter
Returns theIQRouterregistered with this server. TheIQRouterwas registered with the server as a module while starting up the server.- Returns:
- the
IQRouterregistered with this server.
-
getMessageRouter
Returns theMessageRouterregistered with this server. TheMessageRouterwas registered with the server as a module while starting up the server.- Returns:
- the
MessageRouterregistered with this server.
-
getPresenceRouter
Returns thePresenceRouterregistered with this server. ThePresenceRouterwas registered with the server as a module while starting up the server.- Returns:
- the
PresenceRouterregistered with this server.
-
getMulticastRouter
Returns theMulticastRouterregistered with this server. TheMulticastRouterwas registered with the server as a module while starting up the server.- Returns:
- the
MulticastRouterregistered with this server.
-
getUserManager
Returns theUserManagerregistered with this server. TheUserManagerwas registered with the server as a module while starting up the server.- Returns:
- the
UserManagerregistered with this server.
-
getLockOutManager
Returns theLockOutManagerregistered with this server. TheLockOutManagerwas registered with the server as a module while starting up the server.- Returns:
- the
LockOutManagerregistered with this server.
-
getUpdateManager
Returns theUpdateManagerregistered with this server. TheUpdateManagerwas registered with the server as a module while starting up the server.- Returns:
- the
UpdateManagerregistered with this server.
-
getAuditManager
Returns theAuditManagerregistered with this server. TheAuditManagerwas registered with the server as a module while starting up the server.- Returns:
- the
AuditManagerregistered with this server.
-
getEntityCapabilitiesManager
Returns theEntityCapabilitiesManagerregistered with this server. TheEntityCapabilitiesManagerwas registered with the server as a module while starting up the server.- Returns:
- the
EntityCapabilitiesManagerregistered with this server.
-
getIQDiscoInfoHandler
Returns theIQDiscoInfoHandlerregistered with this server. TheIQDiscoInfoHandlerwas registered with the server as a module while starting up the server.- Returns:
- the
IQDiscoInfoHandlerregistered with this server.
-
getIQDiscoItemsHandler
Returns theIQDiscoItemsHandlerregistered with this server. TheIQDiscoItemsHandlerwas registered with the server as a module while starting up the server.- Returns:
- the
IQDiscoItemsHandlerregistered with this server.
-
getPrivateStorage
Returns thePrivateStorageregistered with this server. ThePrivateStoragewas registered with the server as a module while starting up the server.- Returns:
- the
PrivateStorageregistered with this server.
-
getMultiUserChatManager
Returns theMultiUserChatManagerregistered with this server. TheMultiUserChatManagerwas registered with the server as a module while starting up the server.- Returns:
- the
MultiUserChatManagerregistered with this server.
-
getAdHocCommandHandler
Returns theAdHocCommandHandlerregistered with this server. TheAdHocCommandHandlerwas registered with the server as a module while starting up the server.- Returns:
- the
AdHocCommandHandlerregistered with this server.
-
getFileTransferProxy
Returns theFileTransferProxyregistered with this server. TheFileTransferProxywas registered with the server as a module while starting up the server.- Returns:
- the
FileTransferProxyregistered with this server.
-
getFileTransferManager
Returns theFileTransferManagerregistered with this server. TheFileTransferManagerwas registered with the server as a module while starting up the server.- Returns:
- the
FileTransferProxyregistered with this server.
-
getMediaProxyService
Returns theMediaProxyServiceregistered with this server. TheMediaProxyServicewas registered with the server as a module while starting up the server.- Returns:
- the
MediaProxyServiceregistered with this server.
-
getVCardManager
Returns theVCardManagerregistered with this server. TheVCardManagerwas registered with the server as a module while starting up the server.- Returns:
- the
VCardManagerregistered with this server.
-
getCertificateStoreManager
Returns theCertificateStoreManagerregistered with this server. TheCertificateStoreManagerwas registered with the server as a module while starting up the server.- Returns:
- the
CertificateStoreManagerregistered with this server.
-
getCertificateExpiryChecker
Returns theCertificateExpiryCheckerregistered with this server. TheCertificateExpiryCheckerwas registered with the server as a module while starting up the server.- Returns:
- the
CertificateExpiryCheckerregistered with this server.
-
getRemoteSessionLocator
Returns the locator to use to find sessions hosted in other cluster nodes. When not running in a cluster anullvalue is returned.- Returns:
- the locator to use to find sessions hosted in other cluster nodes.
-
setRemoteSessionLocator
Sets the locator to use to find sessions hosted in other cluster nodes. When not running in a cluster set anullvalue.- Parameters:
remoteSessionLocator- the locator to use to find sessions hosted in other cluster nodes.
-
isStarted
public boolean isStarted()Returns whether or not the server has been started.- Returns:
- whether or not the server has been started.
-
sendMessageToAdmins
Asynchronously send a message to every administrator on the system.- Parameters:
message- The message to send- Returns:
- the future result of sending the message.
-