public LocalMUCRoom getRoom() { MultiUserChatService mucService = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(subdomain); if (mucService == null) { throw new IllegalArgumentException("MUC service not found for subdomain: "+subdomain); } LocalMUCRoom room = (LocalMUCRoom) mucService.getChatRoom(roomName); if (room == null) { throw new IllegalArgumentException("Room not found: " + roomName); } return room; }
@Override public double sample() { double occupants = 0; for (MultiUserChatService service : getMultiUserChatServices()) { occupants += service.getNumberRoomOccupants(); } return occupants; }
/** * Called when manager starts up, to initialize things. */ @Override public void start() { super.start(); loadServices(); for (MultiUserChatService service : mucServices.values()) { registerMultiUserChatService(service); } // Add statistics addTotalRoomStats(); addTotalOccupantsStats(); addTotalConnectedUsers(); addNumberIncomingMessages(); addNumberOutgoingMessages(); ClusterManager.addListener(this); UserEventDispatcher.addListener(this); }
/** * Updates the configuration of a MUC service. This is more involved than it may seem. If the * subdomain is changed, we need to shut down the old service and start up the new one, registering * the new subdomain and cleaning up the old one. Properties are tied to the ID, which will not change. * * @param cursubdomain The current subdomain assigned to the service. * @param newsubdomain New subdomain to assign to the service. * @param description New description to assign to the service. * @throws NotFoundException if service was not found. */ public void updateMultiUserChatService(String cursubdomain, String newsubdomain, String description) throws NotFoundException { Long serviceID = getMultiUserChatServiceID(cursubdomain); if (serviceID == null) throw new NotFoundException(); updateMultiUserChatService(serviceID, newsubdomain, description); }
/** * Deletes a configured MultiUserChatService by subdomain, and shuts it down. * * @param subdomain The subdomain of the service to be deleted. * @throws NotFoundException if the service was not found. */ public void removeMultiUserChatService(String subdomain) throws NotFoundException { Long serviceID = getMultiUserChatServiceID(subdomain); if (serviceID == null) { Log.error("MultiUserChatManager: Unable to find service to remove for "+subdomain); throw new NotFoundException(); } removeMultiUserChatService(serviceID); }
MultiUserChatServiceImpl muc = (MultiUserChatServiceImpl) getMultiUserChatService(serviceID); if (muc == null) throw new NotFoundException(); updateService(serviceID, subdomain, description); unregisterMultiUserChatService(subdomain); updateService(serviceID, subdomain, description); registerMultiUserChatService(muc);
/** * Deletes a configured MultiUserChatService by ID, and shuts it down. * * @param serviceID The ID opf the service to be deleted. * @throws NotFoundException if the service was not found. */ public void removeMultiUserChatService(Long serviceID) throws NotFoundException { MultiUserChatServiceImpl muc = (MultiUserChatServiceImpl) getMultiUserChatService(serviceID); if (muc == null) { Log.error("MultiUserChatManager: Unable to find service to remove for service ID "+serviceID); throw new NotFoundException(); } unregisterMultiUserChatService(muc.getServiceName()); deleteService(serviceID); }
/** * Creates a new MUC service and registers it with the manager, and starts up the service. * * @param subdomain Subdomain of the MUC service. * @param description Description of the MUC service (can be null for default description) * @param isHidden True if the service is hidden from view in services lists. * @return MultiUserChatService implementation that was just created. * @throws AlreadyExistsException if the service already exists. */ public MultiUserChatServiceImpl createMultiUserChatService(String subdomain, String description, Boolean isHidden) throws AlreadyExistsException { if (getMultiUserChatServiceID(subdomain) != null) throw new AlreadyExistsException(); MultiUserChatServiceImpl muc = new MultiUserChatServiceImpl(subdomain, description, isHidden); insertService(subdomain, description, isHidden); registerMultiUserChatService(muc); return muc; }
for (ServiceInfo serviceInfo : result) { MultiUserChatService service; service = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceInfo.getSubdomain()); if (service == null) { XMPPServer.getInstance().getMultiUserChatManager().registerMultiUserChatService(service);
public MUCServiceProperties(String subdomain) { this.subdomain = subdomain; if (properties == null) { properties = new ConcurrentHashMap<>(); } else { properties.clear(); } serviceID = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServiceID(subdomain); if (serviceID == null) { Log.debug("MUCServiceProperties: Unable to find service ID for subdomain "+subdomain); } else { loadProperties(); } }
/** * Retrieves a MultiUserChatService instance specified by it's service ID. * * @param serviceID ID of the conference service you wish to query. * @return The MultiUserChatService instance associated with the id, or null if none found. */ public MultiUserChatService getMultiUserChatService(Long serviceID) { String subdomain = getMultiUserChatSubdomain(serviceID); if (subdomain == null) return null; return mucServices.get(subdomain); }
MultiUserChatServiceImpl muc = (MultiUserChatServiceImpl) getMultiUserChatService(serviceID); if (muc == null) throw new NotFoundException(); updateService(serviceID, subdomain, description); unregisterMultiUserChatService(subdomain); updateService(serviceID, subdomain, description); registerMultiUserChatService(muc);
/** * Deletes a configured MultiUserChatService by ID, and shuts it down. * * @param serviceID The ID opf the service to be deleted. * @throws NotFoundException if the service was not found. */ public void removeMultiUserChatService(Long serviceID) throws NotFoundException { MultiUserChatServiceImpl muc = (MultiUserChatServiceImpl) getMultiUserChatService(serviceID); if (muc == null) { Log.error("MultiUserChatManager: Unable to find service to remove for service ID "+serviceID); throw new NotFoundException(); } unregisterMultiUserChatService(muc.getServiceName()); deleteService(serviceID); }
/** * Creates a new MUC service and registers it with the manager, and starts up the service. * * @param subdomain Subdomain of the MUC service. * @param description Description of the MUC service (can be null for default description) * @param isHidden True if the service is hidden from view in services lists. * @return MultiUserChatService implementation that was just created. * @throws AlreadyExistsException if the service already exists. */ public MultiUserChatServiceImpl createMultiUserChatService(String subdomain, String description, Boolean isHidden) throws AlreadyExistsException { if (getMultiUserChatServiceID(subdomain) != null) throw new AlreadyExistsException(); MultiUserChatServiceImpl muc = new MultiUserChatServiceImpl(subdomain, description, isHidden); insertService(subdomain, description, isHidden); registerMultiUserChatService(muc); return muc; }
for (ServiceInfo serviceInfo : result) { MultiUserChatService service; service = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(serviceInfo.getSubdomain()); if (service == null) { XMPPServer.getInstance().getMultiUserChatManager().registerMultiUserChatService(service);
/** * Deletes a configured MultiUserChatService by subdomain, and shuts it down. * * @param subdomain The subdomain of the service to be deleted. * @throws NotFoundException if the service was not found. */ public void removeMultiUserChatService(String subdomain) throws NotFoundException { Long serviceID = getMultiUserChatServiceID(subdomain); if (serviceID == null) { Log.error("MultiUserChatManager: Unable to find service to remove for "+subdomain); throw new NotFoundException(); } removeMultiUserChatService(serviceID); }
Long serviceID = XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatServiceID(chatserver.getServiceName());
/** * Updates the configuration of a MUC service. This is more involved than it may seem. If the * subdomain is changed, we need to shut down the old service and start up the new one, registering * the new subdomain and cleaning up the old one. Properties are tied to the ID, which will not change. * * @param cursubdomain The current subdomain assigned to the service. * @param newsubdomain New subdomain to assign to the service. * @param description New description to assign to the service. * @throws NotFoundException if service was not found. */ public void updateMultiUserChatService(String cursubdomain, String newsubdomain, String description) throws NotFoundException { Long serviceID = getMultiUserChatServiceID(cursubdomain); if (serviceID == null) throw new NotFoundException(); updateMultiUserChatService(serviceID, newsubdomain, description); }
/** * Retrieves a MultiUserChatService instance specified by it's service ID. * * @param serviceID ID of the conference service you wish to query. * @return The MultiUserChatService instance associated with the id, or null if none found. */ public MultiUserChatService getMultiUserChatService(Long serviceID) { String subdomain = getMultiUserChatSubdomain(serviceID); if (subdomain == null) return null; return mucServices.get(subdomain); }
/** * Called when manager starts up, to initialize things. */ @Override public void start() { super.start(); loadServices(); for (MultiUserChatService service : mucServices.values()) { registerMultiUserChatService(service); } // Add statistics addTotalRoomStats(); addTotalOccupantsStats(); addTotalConnectedUsers(); addNumberIncomingMessages(); addNumberOutgoingMessages(); ClusterManager.addListener(this); UserEventDispatcher.addListener(this); }