private <T extends Enum<T>> String getPropertyValue(T algo) { StringBuilder strb = new StringBuilder(); for (T it : active.algos(algo)) { strb.append(it.name()); strb.append(';'); } return strb.toString(); }
/** * Makes sure that conference is allocated for given <tt>room</tt>. * * @param room name of the MUC room of Jitsi Meet conference. * @param properties configuration properties, see {@link JitsiMeetConfig} for the list of valid * properties. * @throws Exception if any error occurs. */ private void createConference(String room, Map<String, String> properties) throws Exception { JitsiMeetConfig config = new JitsiMeetConfig(properties); JitsiMeetConference conference = new JitsiMeetConference(room, focusUserName, protocolProviderHandler, this, config); conferences.put(room, conference); StringBuilder options = new StringBuilder(); for (Map.Entry<String, String> option : properties.entrySet()) { options.append("\n ").append(option.getKey()).append(": ").append(option.getValue()); } logger.info( "Created new focus for " + room + "@" + focusUserDomain + " conferences count: " + conferences.size() + " options:" + options.toString()); // Send focus created event EventAdmin eventAdmin = FocusBundleActivator.getEventAdmin(); if (eventAdmin != null) { eventAdmin.sendEvent(EventFactory.focusCreated(conference.getId(), conference.getRoomName())); } try { conference.start(); } catch (Exception e) { logger.info("Exception while trying to start the conference", e); // stop() method is called by the conference automatically in order // to not release the lock on JitsiMeetConference instance and avoid // a deadlock. It may happen when this thread is about to call // conference.stop() and another thread has entered the method // before us. That other thread will try to call // FocusManager.conferenceEnded, but we're still holding the lock // on FocusManager instance. // conference.stop(); throw e; } }
/** * Makes sure that conference is allocated for given <tt>room</tt>. * * @param room name of the MUC room of Jitsi Meet conference. * @param properties configuration properties, see {@link JitsiMeetConfig} for the list of valid * properties. * @throws Exception if any error occurs. */ private void createConference(String room, Map<String, String> properties) throws Exception { JitsiMeetConfig config = new JitsiMeetConfig(properties); JitsiMeetConference conference = new JitsiMeetConference(room, focusUserName, protocolProviderHandler, this, config); conferences.put(room, conference); StringBuilder options = new StringBuilder(); for (Map.Entry<String, String> option : properties.entrySet()) { options.append("\n ").append(option.getKey()).append(": ").append(option.getValue()); } logger.info( "Created new focus for " + room + "@" + focusUserDomain + " conferences count: " + conferences.size() + " options:" + options.toString()); // Send focus created event EventAdmin eventAdmin = FocusBundleActivator.getEventAdmin(); if (eventAdmin != null) { eventAdmin.sendEvent(EventFactory.focusCreated(conference.getId(), conference.getRoomName())); } try { conference.start(); } catch (Exception e) { logger.info("Exception while trying to start the conference", e); conference.stop(); throw e; } }
/** * Calculates the <tt>String</tt> for a specific <tt>DiscoverInfo</tt> which is to be hashed in * order to compute the ver string for that <tt>DiscoverInfo</tt>. * * @param discoverInfo the <tt>DiscoverInfo</tt> for which the <tt>String</tt> to be hashed in * order to compute its ver string is to be calculated * @return the <tt>String</tt> for <tt>discoverInfo</tt> which is to be hashed in order to compute * its ver string */ private static String calculateEntityCapsString(DiscoverInfo discoverInfo) { StringBuilder bldr = new StringBuilder(); // Add identities { Iterator<DiscoverInfo.Identity> identities = discoverInfo.getIdentities(); SortedSet<DiscoverInfo.Identity> is = new TreeSet<DiscoverInfo.Identity>( new Comparator<DiscoverInfo.Identity>() { public int compare(DiscoverInfo.Identity i1, DiscoverInfo.Identity i2) { int category = i1.getCategory().compareTo(i2.getCategory()); if (category != 0) return category; int type = i1.getType().compareTo(i2.getType()); if (type != 0) return type; /* * TODO Sort by xml:lang. * * Since sort by xml:lang is currently missing, * use the last supported sort criterion i.e. * type. */ return type; } }); if (identities != null) while (identities.hasNext()) is.add(identities.next()); for (DiscoverInfo.Identity i : is) { bldr.append(i.getCategory()) .append('/') .append(i.getType()) .append("//") .append(i.getName()) .append('<'); } } // Add features { Iterator<DiscoverInfo.Feature> features = getDiscoverInfoFeatures(discoverInfo); SortedSet<String> fs = new TreeSet<String>(); if (features != null) while (features.hasNext()) fs.add(features.next().getVar()); for (String f : fs) bldr.append(f).append('<'); } DataForm extendedInfo = (DataForm) discoverInfo.getExtension("x", "jabber:x:data"); if (extendedInfo != null) { synchronized (extendedInfo) { SortedSet<FormField> fs = new TreeSet<FormField>( new Comparator<FormField>() { public int compare(FormField f1, FormField f2) { return f1.getVariable().compareTo(f2.getVariable()); } }); FormField formType = null; for (Iterator<FormField> fieldsIter = extendedInfo.getFields(); fieldsIter.hasNext(); ) { FormField f = fieldsIter.next(); if (!f.getVariable().equals("FORM_TYPE")) fs.add(f); else formType = f; } // Add FORM_TYPE values if (formType != null) formFieldValuesToCaps(formType.getValues(), bldr); // Add the other values for (FormField f : fs) { bldr.append(f.getVariable()).append('<'); formFieldValuesToCaps(f.getValues(), bldr); } } } return bldr.toString(); }