public class MultiUserChatManager extends BasicModule implements ClusterEventListener, MUCServicePropertyEventListener, UserEventListener
Constructor and Description |
---|
MultiUserChatManager()
Creates a new MultiUserChatManager instance.
|
Modifier and Type | Method and Description |
---|---|
MultiUserChatServiceImpl |
createMultiUserChatService(String subdomain,
String description,
Boolean isHidden)
Creates a new MUC service and registers it with the manager, and starts up the service.
|
MultiUserChatService |
getMultiUserChatService(org.xmpp.packet.JID jid)
Retrieves a MultiUserChatService instance specified by any JID that refers to it.
|
MultiUserChatService |
getMultiUserChatService(Long serviceID)
Retrieves a MultiUserChatService instance specified by it's service ID.
|
MultiUserChatService |
getMultiUserChatService(String subdomain)
Retrieves a MultiUserChatService instance specified by it's subdomain of the
server's primary domain.
|
Long |
getMultiUserChatServiceID(String subdomain)
Retrieves ID of MUC service by subdomain.
|
List<MultiUserChatService> |
getMultiUserChatServices()
Retrieves all of the MultiUserChatServices managed and configured for this server, sorted by
subdomain.
|
Integer |
getMultiUserChatServicesCount()
Retrieves the number of MultiUserChatServices that are configured for this server.
|
String |
getMultiUserChatSubdomain(Long serviceID)
Retrieves the subdomain of a specified service ID.
|
Integer |
getServicesCount(boolean includePrivate)
Returns the number of registered MultiUserChatServices.
|
boolean |
isServiceRegistered(String subdomain)
Returns true if a MUC service is configured/exists for a given subdomain.
|
void |
joinedCluster()
Notification event indicating that this JVM is now part of a cluster.
|
void |
joinedCluster(byte[] nodeID)
Notification event indicating that another JVM is now part of a cluster.
|
void |
leftCluster()
Notification event indicating that this JVM is no longer part of the cluster.
|
void |
leftCluster(byte[] nodeID)
Notification event indicating that another JVM is no longer part of the cluster.
|
void |
markedAsSeniorClusterMember()
Notification event indicating that this JVM is now the senior cluster member.
|
void |
propertyDeleted(String service,
String property,
Map<String,Object> params)
A property was deleted.
|
void |
propertySet(String service,
String property,
Map<String,Object> params)
A property was set.
|
void |
registerMultiUserChatService(MultiUserChatService service)
Registers a new MultiUserChatService implementation to the manager.
|
void |
removeMultiUserChatService(Long serviceID)
Deletes a configured MultiUserChatService by ID, and shuts it down.
|
void |
removeMultiUserChatService(String subdomain)
Deletes a configured MultiUserChatService by subdomain, and shuts it down.
|
void |
start()
Called when manager starts up, to initialize things.
|
void |
stop()
Called when manager is stopped, to clean things up.
|
void |
unregisterMultiUserChatService(String subdomain)
Unregisters a MultiUserChatService from the manager.
|
void |
updateMultiUserChatService(Long serviceID,
String subdomain,
String description)
Updates the configuration of a MUC service.
|
void |
updateMultiUserChatService(String cursubdomain,
String newsubdomain,
String description)
Updates the configuration of a MUC service.
|
void |
userCreated(User user,
Map<String,Object> params)
A user was created.
|
void |
userDeleting(User user,
Map<String,Object> params)
A user is being deleted.
|
void |
userModified(User user,
Map<String,Object> params)
A user's name, email, or an extended property was changed.
|
destroy, getName, initialize
public MultiUserChatManager()
public void start()
start
in interface Module
start
in class BasicModule
public void stop()
stop
in interface Module
stop
in class BasicModule
public void registerMultiUserChatService(MultiUserChatService service)
service
- The MultiUserChatService to be registered.public void unregisterMultiUserChatService(String subdomain)
subdomain
- The subdomain of the service to be unregistered.public Integer getServicesCount(boolean includePrivate)
includePrivate
- True if you want to include private/hidden services in the count.public MultiUserChatServiceImpl createMultiUserChatService(String subdomain, String description, Boolean isHidden) throws AlreadyExistsException
subdomain
- Subdomain of the MUC service.description
- Description of the MUC service (can be null for default description)isHidden
- True if the service is hidden from view in services lists.AlreadyExistsException
- if the service already exists.public void updateMultiUserChatService(Long serviceID, String subdomain, String description) throws NotFoundException
serviceID
- The ID of the service to be updated.subdomain
- New subdomain to assign to the service.description
- New description to assign to the service.NotFoundException
- if service was not found.public void updateMultiUserChatService(String cursubdomain, String newsubdomain, String description) throws NotFoundException
cursubdomain
- The current subdomain assigned to the service.newsubdomain
- New subdomain to assign to the service.description
- New description to assign to the service.NotFoundException
- if service was not found.public void removeMultiUserChatService(String subdomain) throws NotFoundException
subdomain
- The subdomain of the service to be deleted.NotFoundException
- if the service was not found.public void removeMultiUserChatService(Long serviceID) throws NotFoundException
serviceID
- The ID opf the service to be deleted.NotFoundException
- if the service was not found.public MultiUserChatService getMultiUserChatService(Long serviceID)
serviceID
- ID of the conference service you wish to query.public MultiUserChatService getMultiUserChatService(String subdomain)
subdomain
- Subdomain of the conference service you wish to query.public MultiUserChatService getMultiUserChatService(org.xmpp.packet.JID jid)
jid
- JID that contains a reference to the conference service.public List<MultiUserChatService> getMultiUserChatServices()
public Integer getMultiUserChatServicesCount()
public boolean isServiceRegistered(String subdomain)
subdomain
- Subdomain of service to check on.public Long getMultiUserChatServiceID(String subdomain)
subdomain
- Subdomain of service to get ID of.public String getMultiUserChatSubdomain(Long serviceID)
serviceID
- ID of service to get subdomain of.public void joinedCluster()
ClusterEventListener
XMPPServer.getNodeID()
holds the new nodeID value.
When joining the cluster as the senior cluster member the ClusterEventListener.markedAsSeniorClusterMember()
event will be sent right after this event.
At this point the CacheFactory holds clustered caches. That means that modifications to the caches will be reflected in the cluster. The clustered caches were just obtained from the cluster and no local cached data was automatically moved.
joinedCluster
in interface ClusterEventListener
public void joinedCluster(byte[] nodeID)
ClusterEventListener
At this point the CacheFactory of the new node holds clustered caches. That means that modifications to the caches of this JVM will be reflected in the cluster and in particular in the new node.
joinedCluster
in interface ClusterEventListener
nodeID
- ID of the node that joined the cluster.public void leftCluster()
ClusterEventListener
Moreover, if we were in a "split brain" scenario (ie. separated cluster islands) and the island were this JVM belonged was marked as "old" then all nodes of that island will get the left cluster event and joined cluster events. That means that caches will be reset and thus will need to be repopulated again with fresh data from this JVM. This also includes the case where this JVM was the senior cluster member and when the islands met again then this JVM stopped being the senior member.
At this point the CacheFactory holds local caches. That means that modifications to the caches will only affect this JVM.
leftCluster
in interface ClusterEventListener
public void leftCluster(byte[] nodeID)
ClusterEventListener
Moreover, if we were in a "split brain" scenario (ie. separated cluster islands) and the island were the other JVM belonged was marked as "old" then all nodes of that island will get the left cluster event and joined cluster events. That means that caches will be reset and thus will need to be repopulated again with fresh data from this JVM. This also includes the case where the other JVM was the senior cluster member and when the islands met again then the other JVM stopped being the senior member.
At this point the CacheFactory of the leaving node holds local caches. That means that modifications to the caches of this JVM will not affect the leaving node but other cluster members.
leftCluster
in interface ClusterEventListener
nodeID
- ID of the node that is left the cluster.public void markedAsSeniorClusterMember()
ClusterEventListener
Moreover, in the case of a "split brain" scenario (ie. separated cluster islands) each
island will have its own senior cluster member. However, when the islands meet again there
could only be one senior cluster member so one of the senior cluster members will stop playing
that role. When that happens the JVM no longer playing that role will receive the
ClusterEventListener.leftCluster()
and ClusterEventListener.joinedCluster()
events.
markedAsSeniorClusterMember
in interface ClusterEventListener
public void propertySet(String service, String property, Map<String,Object> params)
MUCServicePropertyEventListener
propertySet
in interface MUCServicePropertyEventListener
service
- the subdomain of the service the property was set on.property
- the name of the property.params
- event parameters.public void propertyDeleted(String service, String property, Map<String,Object> params)
MUCServicePropertyEventListener
propertyDeleted
in interface MUCServicePropertyEventListener
service
- the subdomain of the service the property was deleted from.property
- the name of the property deleted.params
- event parameters.public void userCreated(User user, Map<String,Object> params)
UserEventListener
userCreated
in interface UserEventListener
user
- the user.params
- event parameters.public void userDeleting(User user, Map<String,Object> params)
UserEventListener
userDeleting
in interface UserEventListener
user
- the user.params
- event parameters.public void userModified(User user, Map<String,Object> params)
UserEventListener
userModified
in interface UserEventListener
user
- the user.params
- event parameters.Copyright © 2003–2019 Ignite Realtime. All rights reserved.