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 TypeMethodDescriptionvoid
addServerListener
(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.JID
Creates an XMPPAddress local to this server.org.xmpp.packet.JID
Creates an XMPPAddress local to this server.void
Finish the setup process.Returns theAdHocCommandHandler
registered with this server.Collection<org.xmpp.packet.JID>
Returns a collection with the JIDs of the server's admins.Returns theArchiveManager
registered with this server.Returns theAuditManager
registered with this server.Returns theCertificateExpiryChecker
registered with this server.Returns theCertificateStoreManager
registered with this server.Returns theConnectionManager
registered with this server.Returns the default node ID used by this server before clustering is initialized.Returns theEntityCapabilitiesManager
registered with this server.Returns theFileTransferManager
registered with this server.Returns theFileTransferProxy
registered with this server.static XMPPServer
Returns a singleton instance of XMPPServer.Returns theIQDiscoInfoHandler
registered with this server.Returns theIQDiscoItemsHandler
registered with this server.Returns a list with all the modules registered with the server that inherit from IQHandler.Returns theIQPEPHandler
registered with this server.Returns theIQRegisterHandler
registered with this server.Returns theIQRouter
registered with this server.Returns theLockOutManager
registered with this server.Returns theMediaProxyService
registered with this server.Returns theMessageRouter
registered with this server.Returns theMulticastRouter
registered with this server.Returns theMultiUserChatManager
registered with this server.Returns an ID that uniquely identifies this server in a cluster.Returns theOfflineMessageStore
registered with this server.Returns theOfflineMessageStrategy
registered with this server.Returns thePacketDeliverer
registered with this server.Returns thePacketRouter
registered with this server.Returns thePluginManager
instance registered with this server.Returns thePresenceManager
registered with this server.Returns thePresenceRouter
registered with this server.Returns thePresenceSubscribeHandler
registered with this server.Returns thePresenceUpdateHandler
registered with this server.Returns thePrivateStorage
registered with this server.Returns thePubSubModule
registered with this server.Returns the locator to use to find sessions hosted in other cluster nodes.Returns theRosterManager
registered with this server.Returns theRoutingTable
registered with this server.Returns a snapshot of the server's status.Returns theSessionManager
registered with this server.Returns theTransportHandler
registered with this server.Returns theUpdateManager
registered with this server.Returns theUserManager
registered with this server.Returns theVCardManager
registered with this server.boolean
isLocal
(org.xmpp.packet.JID jid) Returns true if the given address is local to the server (managed by this server domain).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 JIDboolean
boolean
boolean
Returns true if the server is being shutdown.boolean
Returns if the server is running in standalone mode.boolean
Returns whether or not the server has been started.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.void
removeServerListener
(XMPPServerListener listener) Removes a server listener that was being notified when the server was being started or was about to be stopped.void
restart()
Restarts the server and all it's modules only if the server is restartable.void
Restarts 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 void
setInstance
(XMPPServer instance) Deprecated.- for test use onlyvoid
Sets an ID that uniquely identifies this server in a cluster.void
setRemoteSessionLocator
(RemoteSessionLocator remoteSessionLocator) Sets the locator to use to find sessions hosted in other cluster nodes.void
start()
void
stop()
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 theConnectionManager
registered with this server. TheConnectionManager
was registered with the server as a module while starting up the server.- Returns:
- the
ConnectionManager
registered with this server.
-
getRoutingTable
Returns theRoutingTable
registered with this server. TheRoutingTable
was registered with the server as a module while starting up the server.- Returns:
- the
RoutingTable
registered with this server.
-
getPacketDeliverer
Returns thePacketDeliverer
registered with this server. ThePacketDeliverer
was registered with the server as a module while starting up the server.- Returns:
- the
PacketDeliverer
registered with this server.
-
getRosterManager
Returns theRosterManager
registered with this server. TheRosterManager
was registered with the server as a module while starting up the server.- Returns:
- the
RosterManager
registered with this server.
-
getPresenceManager
Returns thePresenceManager
registered with this server. ThePresenceManager
was registered with the server as a module while starting up the server.- Returns:
- the
PresenceManager
registered with this server.
-
getOfflineMessageStore
Returns theOfflineMessageStore
registered with this server. TheOfflineMessageStore
was registered with the server as a module while starting up the server.- Returns:
- the
OfflineMessageStore
registered with this server.
-
getOfflineMessageStrategy
Returns theOfflineMessageStrategy
registered with this server. TheOfflineMessageStrategy
was registered with the server as a module while starting up the server.- Returns:
- the
OfflineMessageStrategy
registered with this server.
-
getPacketRouter
Returns thePacketRouter
registered with this server. ThePacketRouter
was registered with the server as a module while starting up the server.- Returns:
- the
PacketRouter
registered with this server.
-
getIQRegisterHandler
Returns theIQRegisterHandler
registered with this server. TheIQRegisterHandler
was registered with the server as a module while starting up the server.- Returns:
- the
IQRegisterHandler
registered with this server.
-
getIQPEPHandler
Returns theIQPEPHandler
registered with this server. TheIQPEPHandler
was registered with the server as a module while starting up the server.- Returns:
- the
IQPEPHandler
registered with this server.
-
getPluginManager
Returns thePluginManager
instance registered with this server.- Returns:
- the PluginManager instance.
-
getPubSubModule
Returns thePubSubModule
registered with this server. ThePubSubModule
was registered with the server as a module while starting up the server.- Returns:
- the
PubSubModule
registered with this server.
-
getArchiveManager
Returns theArchiveManager
registered with this server. TheArchiveManager
was registered with the server as a module while starting up the server.- Returns:
- the
ArchiveManager
registered 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 theSessionManager
registered with this server. TheSessionManager
was registered with the server as a module while starting up the server.- Returns:
- the
SessionManager
registered with this server.
-
getTransportHandler
Returns theTransportHandler
registered with this server. TheTransportHandler
was registered with the server as a module while starting up the server.- Returns:
- the
TransportHandler
registered with this server.
-
getPresenceUpdateHandler
Returns thePresenceUpdateHandler
registered with this server. ThePresenceUpdateHandler
was registered with the server as a module while starting up the server.- Returns:
- the
PresenceUpdateHandler
registered with this server.
-
getPresenceSubscribeHandler
Returns thePresenceSubscribeHandler
registered with this server. ThePresenceSubscribeHandler
was registered with the server as a module while starting up the server.- Returns:
- the
PresenceSubscribeHandler
registered with this server.
-
getIQRouter
Returns theIQRouter
registered with this server. TheIQRouter
was registered with the server as a module while starting up the server.- Returns:
- the
IQRouter
registered with this server.
-
getMessageRouter
Returns theMessageRouter
registered with this server. TheMessageRouter
was registered with the server as a module while starting up the server.- Returns:
- the
MessageRouter
registered with this server.
-
getPresenceRouter
Returns thePresenceRouter
registered with this server. ThePresenceRouter
was registered with the server as a module while starting up the server.- Returns:
- the
PresenceRouter
registered with this server.
-
getMulticastRouter
Returns theMulticastRouter
registered with this server. TheMulticastRouter
was registered with the server as a module while starting up the server.- Returns:
- the
MulticastRouter
registered with this server.
-
getUserManager
Returns theUserManager
registered with this server. TheUserManager
was registered with the server as a module while starting up the server.- Returns:
- the
UserManager
registered with this server.
-
getLockOutManager
Returns theLockOutManager
registered with this server. TheLockOutManager
was registered with the server as a module while starting up the server.- Returns:
- the
LockOutManager
registered with this server.
-
getUpdateManager
Returns theUpdateManager
registered with this server. TheUpdateManager
was registered with the server as a module while starting up the server.- Returns:
- the
UpdateManager
registered with this server.
-
getAuditManager
Returns theAuditManager
registered with this server. TheAuditManager
was registered with the server as a module while starting up the server.- Returns:
- the
AuditManager
registered with this server.
-
getEntityCapabilitiesManager
Returns theEntityCapabilitiesManager
registered with this server. TheEntityCapabilitiesManager
was registered with the server as a module while starting up the server.- Returns:
- the
EntityCapabilitiesManager
registered with this server.
-
getIQDiscoInfoHandler
Returns theIQDiscoInfoHandler
registered with this server. TheIQDiscoInfoHandler
was registered with the server as a module while starting up the server.- Returns:
- the
IQDiscoInfoHandler
registered with this server.
-
getIQDiscoItemsHandler
Returns theIQDiscoItemsHandler
registered with this server. TheIQDiscoItemsHandler
was registered with the server as a module while starting up the server.- Returns:
- the
IQDiscoItemsHandler
registered with this server.
-
getPrivateStorage
Returns thePrivateStorage
registered with this server. ThePrivateStorage
was registered with the server as a module while starting up the server.- Returns:
- the
PrivateStorage
registered with this server.
-
getMultiUserChatManager
Returns theMultiUserChatManager
registered with this server. TheMultiUserChatManager
was registered with the server as a module while starting up the server.- Returns:
- the
MultiUserChatManager
registered with this server.
-
getAdHocCommandHandler
Returns theAdHocCommandHandler
registered with this server. TheAdHocCommandHandler
was registered with the server as a module while starting up the server.- Returns:
- the
AdHocCommandHandler
registered with this server.
-
getFileTransferProxy
Returns theFileTransferProxy
registered with this server. TheFileTransferProxy
was registered with the server as a module while starting up the server.- Returns:
- the
FileTransferProxy
registered with this server.
-
getFileTransferManager
Returns theFileTransferManager
registered with this server. TheFileTransferManager
was registered with the server as a module while starting up the server.- Returns:
- the
FileTransferProxy
registered with this server.
-
getMediaProxyService
Returns theMediaProxyService
registered with this server. TheMediaProxyService
was registered with the server as a module while starting up the server.- Returns:
- the
MediaProxyService
registered with this server.
-
getVCardManager
Returns theVCardManager
registered with this server. TheVCardManager
was registered with the server as a module while starting up the server.- Returns:
- the
VCardManager
registered with this server.
-
getCertificateStoreManager
Returns theCertificateStoreManager
registered with this server. TheCertificateStoreManager
was registered with the server as a module while starting up the server.- Returns:
- the
CertificateStoreManager
registered with this server.
-
getCertificateExpiryChecker
Returns theCertificateExpiryChecker
registered with this server. TheCertificateExpiryChecker
was registered with the server as a module while starting up the server.- Returns:
- the
CertificateExpiryChecker
registered with this server.
-
getRemoteSessionLocator
Returns the locator to use to find sessions hosted in other cluster nodes. When not running in a cluster anull
value 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 anull
value.- 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.
-