/** @deprecated */ public Enumeration getConditionalPermissionInfos() { // could implement our own Enumeration, but we don't care about performance here. Just do // something simple: synchronized (lock) { SecurityRow[] rows = condAdminTable.getRows(); Vector vRows = new Vector(rows.length); for (int i = 0; i < rows.length; i++) vRows.add(rows[i]); return vRows.elements(); } }
public static Enumeration compoundEnumerations(Enumeration list1, Enumeration list2) { if (list2 == null || !list2.hasMoreElements()) return list1; if (list1 == null || !list1.hasMoreElements()) return list2; Vector compoundResults = new Vector(); while (list1.hasMoreElements()) compoundResults.add(list1.nextElement()); while (list2.hasMoreElements()) { Object item = list2.nextElement(); if (!compoundResults.contains(item)) // don't add duplicates compoundResults.add(item); } return compoundResults.elements(); }
public boolean checkEvents(BundleEvent[] expevents) { boolean res = true; for (int i = 0; i < 20; i++) { try { Thread.sleep(100); } catch (InterruptedException ignore) { } if (events.size() == expevents.length) { break; } } if (events.size() == expevents.length) { for (int i = 0; i < events.size(); i++) { BundleEvent be = (BundleEvent) events.elementAt(i); if (!(be.getBundle().equals(expevents[i].getBundle()) && be.getType() == expevents[i].getType())) { res = false; } } } else { res = false; } if (!res) { out.println("Real events"); for (int i = 0; i < events.size(); i++) { BundleEvent be = (BundleEvent) events.elementAt(i); out.println("Event " + be.getBundle() + ", Type " + be.getType()); } out.println("Expected events"); for (int i = 0; i < expevents.length; i++) { out.println("Event " + expevents[i].getBundle() + ", Type " + expevents[i].getType()); } } return res; }
/** * Creates a <tt>RegistrationStateChangeEvent</tt> corresponding to the specified old and new * states and notifies all currently registered listeners. * * @param oldState the state that the provider had before the change occurred * @param newState the state that the provider is currently in. * @param reasonCode a value corresponding to one of the REASON_XXX fields of the * RegistrationStateChangeEvent class, indicating the reason for this state transition. * @param reason a String further explaining the reason code or null if no such explanation is * necessary. */ private void fireRegistrationStateChanged( RegistrationState oldState, RegistrationState newState, int reasonCode, String reason) { RegistrationStateChangeEvent event = new RegistrationStateChangeEvent(this, oldState, newState, reasonCode, reason); logger.debug( "Dispatching " + event + " to " + registrationStateListeners.size() + " listeners."); Iterator listeners = null; synchronized (registrationStateListeners) { listeners = new ArrayList(registrationStateListeners).iterator(); } while (listeners.hasNext()) { RegistrationStateChangeListener listener = (RegistrationStateChangeListener) listeners.next(); listener.registrationStateChanged(event); } logger.trace("Done."); }
/** * Removes the specified registration listener so that it won't receive further notifications when * our registration state changes. * * @param listener the listener to remove. */ public void removeRegistrationStateChangeListener(RegistrationStateChangeListener listener) { synchronized (registrationStateListeners) { registrationStateListeners.remove(listener); } }
/** * Registers the specified listener with this provider so that it would receive notifications on * changes of its state or other properties such as its local address and display name. * * @param listener the listener to register. */ public void addRegistrationStateChangeListener(RegistrationStateChangeListener listener) { synchronized (registrationStateListeners) { if (!registrationStateListeners.contains(listener)) registrationStateListeners.add(listener); } }
public void clearEvents() { events.clear(); }
public void bundleChanged(BundleEvent evt) { if (evt.getType() == BundleEvent.STARTED || evt.getType() == BundleEvent.STOPPED) { events.addElement(evt); } }