Return-Path: X-Original-To: apmail-ace-commits-archive@www.apache.org Delivered-To: apmail-ace-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1431D185C4 for ; Fri, 29 Jan 2016 10:11:58 +0000 (UTC) Received: (qmail 83757 invoked by uid 500); 29 Jan 2016 10:11:55 -0000 Delivered-To: apmail-ace-commits-archive@ace.apache.org Received: (qmail 83729 invoked by uid 500); 29 Jan 2016 10:11:55 -0000 Mailing-List: contact commits-help@ace.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ace.apache.org Delivered-To: mailing list commits@ace.apache.org Received: (qmail 83718 invoked by uid 99); 29 Jan 2016 10:11:54 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jan 2016 10:11:54 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 875C6C0F18 for ; Fri, 29 Jan 2016 10:11:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.8 X-Spam-Level: * X-Spam-Status: No, score=1.8 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id GCuxRq10mLWd for ; Fri, 29 Jan 2016 10:11:46 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id D285031AC0 for ; Fri, 29 Jan 2016 10:11:45 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id BE2F9E0678 for ; Fri, 29 Jan 2016 10:11:44 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id B817C3A01E3 for ; Fri, 29 Jan 2016 10:11:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1727510 [2/2] - in /ace/trunk: org.apache.ace.client.automation/src/org/apache/ace/client/automation/ org.apache.ace.client.repository/src/org/apache/ace/client/repository/impl/ org.apache.ace.client.repository/src/org/apache/ace/client/re... Date: Fri, 29 Jan 2016 10:11:44 -0000 To: commits@ace.apache.org From: jawi@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160129101144.B817C3A01E3@svn01-us-west.apache.org> Modified: ace/trunk/org.apache.ace.scheduler/src/org/apache/ace/scheduler/Activator.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.scheduler/src/org/apache/ace/scheduler/Activator.java?rev=1727510&r1=1727509&r2=1727510&view=diff ============================================================================== --- ace/trunk/org.apache.ace.scheduler/src/org/apache/ace/scheduler/Activator.java (original) +++ ace/trunk/org.apache.ace.scheduler/src/org/apache/ace/scheduler/Activator.java Fri Jan 29 10:11:43 2016 @@ -31,9 +31,8 @@ import org.osgi.service.cm.ManagedServic import org.osgi.service.log.LogService; /** - * Activator for the scheduler service. This activator will monitor Runnables coming available, - * and if they are intended to be scheduled, gets the necessary information and passes that to - * the scheduler. + * Activator for the scheduler service. This activator will monitor Runnables coming available, and if they + * are intended to be scheduled, gets the necessary information and passes that to the scheduler. */ public class Activator extends DependencyActivatorBase { private Scheduler m_scheduler; @@ -59,10 +58,12 @@ public class Activator extends Dependenc /** * Handler for both adding and updating runnable service registrations. - * @throws ConfigurationException Is thrown when the SCHEDULER_RECIPE contained in ref's - * service dictionary cannot be parsed by the scheduler. + * + * @throws ConfigurationException + * Is thrown when the SCHEDULER_RECIPE contained in ref's service dictionary + * cannot be parsed by the scheduler. */ - public void addRunnable(ServiceReference ref, Runnable task) throws ConfigurationException { + public void addRunnable(ServiceReference ref, Runnable task) throws ConfigurationException { String name = (String) ref.getProperty(SchedulerConstants.SCHEDULER_NAME_KEY); if (name != null) { String description = (String) ref.getProperty(SchedulerConstants.SCHEDULER_DESCRIPTION_KEY); @@ -72,10 +73,10 @@ public class Activator extends Dependenc } } - public synchronized void removeRunnable(ServiceReference ref, Runnable task) { + public synchronized void removeRunnable(ServiceReference ref, Runnable task) { String name = (String) ref.getProperty(SchedulerConstants.SCHEDULER_NAME_KEY); if (name != null) { m_scheduler.removeRunnable(name); } } -} \ No newline at end of file +} Modified: ace/trunk/org.apache.ace.scheduler/src/org/apache/ace/scheduler/Scheduler.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.scheduler/src/org/apache/ace/scheduler/Scheduler.java?rev=1727510&r1=1727509&r2=1727510&view=diff ============================================================================== --- ace/trunk/org.apache.ace.scheduler/src/org/apache/ace/scheduler/Scheduler.java (original) +++ ace/trunk/org.apache.ace.scheduler/src/org/apache/ace/scheduler/Scheduler.java Fri Jan 29 10:11:43 2016 @@ -18,11 +18,12 @@ */ package org.apache.ace.scheduler; +import java.util.Collections; import java.util.Dictionary; -import java.util.Enumeration; -import java.util.HashMap; import java.util.Iterator; -import java.util.Map; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import org.osgi.framework.Constants; import org.osgi.service.cm.ConfigurationException; @@ -30,45 +31,48 @@ import org.osgi.service.cm.ManagedServic import org.osgi.service.log.LogService; /** - * The scheduler periodically runs tasks based on a scheduling recipe. Tasks can be added and - * removed using the addRunnable and removeRunnable methods. Recipes are - * supplied using configuration properties using the updated method, or are - * passed in the task's properties.
+ * The scheduler periodically runs tasks based on a scheduling recipe. Tasks can be added and removed using the + * addRunnable and removeRunnable methods. Recipes are supplied using configuration properties + * using the updated method, or are passed in the task's properties.
* - * A task will be scheduled if both a Runnable and a recipe are available - * for it. + * A task will be scheduled if both a Runnable and a recipe are available for it. */ public class Scheduler implements ManagedService { - protected final Map m_tasks = new HashMap<>(); + protected final ConcurrentMap m_tasks = new ConcurrentHashMap<>(); private volatile LogService m_log; /** * Makes sure that all tasks are indeed stopped when the scheduler is stopped. */ public void stop() { - for (Iterator i = m_tasks.keySet().iterator(); i.hasNext();) { - String name = (String) i.next(); - SchedulerTask schedTask = (SchedulerTask) m_tasks.get(name); + for (SchedulerTask schedTask : m_tasks.values()) { schedTask.stop(); } + m_tasks.clear(); } /** * Adds a new runnable to this scheduler. The runnable will be created if necessary, registered, and processed. - * @param name A name for this task. - * @param task A runnable to run for this task. - * @param description A description of the task. - * @param recipe Optionally, a recipe for running this task. - * @param recipeOverride Indicates whether or not the recipe passed in prevails over - * any recipe provided by the Scheduler's configuration. - * @throws ConfigurationException When recipe is not null, and cannot - * be decoded into a recipe. + * + * @param name + * A name for this task. + * @param task + * A runnable to run for this task. + * @param description + * A description of the task. + * @param recipe + * Optionally, a recipe for running this task. + * @param recipeOverride + * Indicates whether or not the recipe passed in prevails over any recipe provided by the + * Scheduler's configuration. + * @throws ConfigurationException + * When recipe is not null, and cannot be decoded into a recipe. */ - public synchronized void addRunnable(String name, Runnable task, String description, Object recipe, boolean recipeOverride) throws ConfigurationException { - SchedulerTask schedTask = (SchedulerTask) m_tasks.get(name); + public void addRunnable(String name, Runnable task, String description, Object recipe, boolean recipeOverride) throws ConfigurationException { + SchedulerTask schedTask = m_tasks.get(name); if (schedTask == null) { schedTask = new SchedulerTask(name); - m_tasks.put(name, schedTask); + m_tasks.putIfAbsent(name, schedTask); } schedTask.updateTask(task, description, recipe, recipeOverride); schedTask.process(); @@ -76,11 +80,12 @@ public class Scheduler implements Manage /** * Removes a runnable from this scheduler. - * @param name The name of the runnable. If the name does not indicate a valid runnable, - * nothing is done. + * + * @param name + * The name of the runnable. If the name does not indicate a valid runnable, nothing is done. */ - public synchronized void removeRunnable(String name) { - SchedulerTask schedTask = (SchedulerTask) m_tasks.get(name); + public void removeRunnable(String name) { + SchedulerTask schedTask = m_tasks.get(name); if (schedTask != null) { try { schedTask.updateTask(null, null, null, false); @@ -95,48 +100,48 @@ public class Scheduler implements Manage } /** - * Updates the configuration of the scheduler. The scheduler expects the configuration - * to contain recipes for scheduling. The key of a property should be the name identifying - * a task and the value should be a string describing the scheduling recipe for this task. + * Updates the configuration of the scheduler. The scheduler expects the configuration to contain recipes for + * scheduling. The key of a property should be the name identifying a task and the value should be a string + * describing the scheduling recipe for this task. */ - public void updated(Dictionary properties) throws ConfigurationException { - if (properties != null) { - // first remove all the old schedules. - for (Iterator i = m_tasks.keySet().iterator(); i.hasNext();) { - String name = (String) i.next(); - SchedulerTask schedTask = (SchedulerTask) m_tasks.get(name); - schedTask.updateConfigurationRecipe(null); - } - - // then apply the new ones - properties.remove(Constants.SERVICE_PID); - Enumeration keys = properties.keys(); - while (keys.hasMoreElements()) { - String name = (String) keys.nextElement(); - SchedulerTask schedTask = (SchedulerTask) m_tasks.get(name); - if (schedTask == null) { - schedTask = new SchedulerTask(name); - m_tasks.put(name, schedTask); - } - try { - schedTask.updateConfigurationRecipe(properties.get(name)); - } - catch (ConfigurationException ce) { - // This is most likely an illegal recipe, caused by an config property we don't understand. - // So, no problem. - m_log.log(LogService.LOG_INFO, - name + "=" + properties.get(name) + " does not look like a valid schedule recipe."); - } - } - - // and remove all tasks that now have no schedule or runnable - for (Iterator i = m_tasks.keySet().iterator(); i.hasNext();) { - String name = (String) i.next(); - SchedulerTask schedTask = (SchedulerTask) m_tasks.get(name); - if (!schedTask.process()) { - i.remove(); - } + public void updated(Dictionary properties) throws ConfigurationException { + if (properties == null) { + return; + } + + // first remove all the old schedules. + for (SchedulerTask schedTask : m_tasks.values()) { + schedTask.updateConfigurationRecipe(null); + } + + // then apply the new ones + properties.remove(Constants.SERVICE_PID); + + List keys = Collections.list(properties.keys()); + for (String name : keys) { + SchedulerTask schedTask = m_tasks.get(name); + if (schedTask == null) { + schedTask = new SchedulerTask(name); + m_tasks.putIfAbsent(name, schedTask); + } + + try { + schedTask.updateConfigurationRecipe(properties.get(name)); + } + catch (ConfigurationException ce) { + // This is most likely an illegal recipe, caused by an config property we don't understand. + // So, no problem. + m_log.log(LogService.LOG_INFO, name + "=" + properties.get(name) + " does not look like a valid schedule recipe."); + } + } + + // and remove all tasks that now have no schedule or runnable + Iterator i = m_tasks.keySet().iterator(); + while (i.hasNext()) { + SchedulerTask schedTask = m_tasks.get(i.next()); + if (!schedTask.process()) { + i.remove(); } } } -} \ No newline at end of file +} Modified: ace/trunk/org.apache.ace.scheduler/test/org/apache/ace/scheduler/SchedulerTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.scheduler/test/org/apache/ace/scheduler/SchedulerTest.java?rev=1727510&r1=1727509&r2=1727510&view=diff ============================================================================== --- ace/trunk/org.apache.ace.scheduler/test/org/apache/ace/scheduler/SchedulerTest.java (original) +++ ace/trunk/org.apache.ace.scheduler/test/org/apache/ace/scheduler/SchedulerTest.java Fri Jan 29 10:11:43 2016 @@ -20,7 +20,8 @@ package org.apache.ace.scheduler; import static org.apache.ace.test.utils.TestUtils.UNIT; -import java.util.Properties; +import java.util.Dictionary; +import java.util.Hashtable; import org.apache.ace.test.utils.TestUtils; import org.osgi.service.log.LogService; @@ -44,7 +45,8 @@ public class SchedulerTest { @Test(groups = { UNIT }) public synchronized void testUpdate() throws Exception { - Properties props = new Properties(); + Dictionary props = new Hashtable<>(); + props.put("local.mock.task1", 1000l); props.put("local.mock.task2", 2000l); props.put("local.mock.task3", 3000l); @@ -60,7 +62,8 @@ public class SchedulerTest { @Test( groups = { UNIT } ) public synchronized void testAdditionalProperties() throws Exception { - Properties props = new Properties(); + Dictionary props = new Hashtable<>(); + props.put("local.mock.task1", "invalidValue"); m_scheduler.updated(props); m_scheduler.addRunnable("local.mock.task1", new Runnable() { @@ -93,7 +96,8 @@ public class SchedulerTest { @Test(groups = { UNIT }) public synchronized void testProcessTask() throws Exception { - Properties props = new Properties(); + Dictionary props = new Hashtable<>(); + props.put("local.mock.task1", 1000); m_scheduler.updated(props); @@ -106,7 +110,8 @@ public class SchedulerTest { @Test(groups = { UNIT }) public synchronized void testSchedulePrevailanceAndRemoval() throws Exception { - Properties props = new Properties(); + Dictionary props = new Hashtable<>(); + props.put("local.mock.task1", 1000l); m_scheduler.updated(props); @@ -127,7 +132,7 @@ public class SchedulerTest { assert ((SchedulerTask) m_scheduler.m_tasks.get("local.mock.task1")).getCurrentRecipe().equals(new Long(1000)) : "The schedule for mock task 1 should specify interval 1000, but it specifies " + ((SchedulerTask) m_scheduler.m_tasks.get("local.mock.task1")).getCurrentRecipe(); assert ((SchedulerTask) m_scheduler.m_tasks.get("local.mock.task1")).isScheduled() : "Since we have now provided a runnable for the scheduler, the tasks should be scheduled."; - props = new Properties(); + props = new Hashtable<>(); m_scheduler.updated(props); assert ((SchedulerTask) m_scheduler.m_tasks.get("local.mock.task1")).getCurrentRecipe().equals(new Long(2000)) : "The schedule for mock task 1 should specify interval 2000, but it specifies " + ((SchedulerTask) m_scheduler.m_tasks.get("local.mock.task1")).getCurrentRecipe(); Modified: ace/trunk/org.apache.ace.verifier/src/org/apache/ace/deployment/verifier/impl/VerifyEnvironmentImpl.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.verifier/src/org/apache/ace/deployment/verifier/impl/VerifyEnvironmentImpl.java?rev=1727510&r1=1727509&r2=1727510&view=diff ============================================================================== --- ace/trunk/org.apache.ace.verifier/src/org/apache/ace/deployment/verifier/impl/VerifyEnvironmentImpl.java (original) +++ ace/trunk/org.apache.ace.verifier/src/org/apache/ace/deployment/verifier/impl/VerifyEnvironmentImpl.java Fri Jan 29 10:11:43 2016 @@ -226,7 +226,7 @@ public class VerifyEnvironmentImpl imple } @SuppressWarnings("unused") - public void log(final ServiceReference ref, final int level, final String message, final Throwable t) { + public void log(final ServiceReference ref, final int level, final String message, final Throwable t) { final long time = System.currentTimeMillis(); m_reporter.reportLog(new LogEntry() { @@ -246,7 +246,7 @@ public class VerifyEnvironmentImpl imple return message; } - public ServiceReference getServiceReference() { + public ServiceReference getServiceReference() { return ref; } Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java?rev=1727510&r1=1727509&r2=1727510&view=diff ============================================================================== --- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java (original) +++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java Fri Jan 29 10:11:43 2016 @@ -520,7 +520,7 @@ public class VaadinClient extends com.va ShortcutHelper.addCrossPlatformShortcut(context.getBrowser(), button, description, keycode, ModifierKey.SHIFT); } - private void addDependency(Component component, Class service) { + private void addDependency(Component component, Class service) { component.add(m_manager.createServiceDependency() .setService(service) .setRequired(true) @@ -540,7 +540,7 @@ public class VaadinClient extends com.va m_manager.add(component); } - private void addSessionDependency(Component component, Class service) { + private void addSessionDependency(Component component, Class service) { component.add(m_manager.createServiceDependency() .setService(service, "(" + SessionFactory.SERVICE_SID + "=" + m_sessionID + ")") .setRequired(true) Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java?rev=1727510&r1=1727509&r2=1727510&view=diff ============================================================================== --- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java (original) +++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java Fri Jan 29 10:11:43 2016 @@ -108,7 +108,7 @@ public class VaadinServlet extends Abstr } @Override - public void updated(Dictionary dictionary) throws ConfigurationException { + public void updated(Dictionary dictionary) throws ConfigurationException { boolean useAuth = DEFAULT_USE_AUTHENTICATION; String userName = DEFAULT_USER_NAME; String password = DEFAULT_PASSWORD; @@ -195,7 +195,7 @@ public class VaadinServlet extends Abstr return msgs; } - private boolean getBoolean(Dictionary dictionary, String key) throws ConfigurationException { + private boolean getBoolean(Dictionary dictionary, String key) throws ConfigurationException { Object value = dictionary.get(key); if (value == null || !(value instanceof String)) { throw new ConfigurationException(key, "Missing property"); @@ -207,7 +207,7 @@ public class VaadinServlet extends Abstr return Boolean.parseBoolean(valueStr); } - private int getInteger(Dictionary dictionary, String key) throws ConfigurationException { + private int getInteger(Dictionary dictionary, String key) throws ConfigurationException { Integer value = getOptionalInteger(dictionary, key); if (value == null) { throw new ConfigurationException(key, "Missing property"); @@ -215,7 +215,7 @@ public class VaadinServlet extends Abstr return value.intValue(); } - private Double getOptionalDouble(Dictionary dictionary, String key) throws ConfigurationException { + private Double getOptionalDouble(Dictionary dictionary, String key) throws ConfigurationException { Object value = dictionary.get(key); if (value == null) { return null; @@ -236,7 +236,7 @@ public class VaadinServlet extends Abstr } } - private Integer getOptionalInteger(Dictionary dictionary, String key) throws ConfigurationException { + private Integer getOptionalInteger(Dictionary dictionary, String key) throws ConfigurationException { Object value = dictionary.get(key); if (value == null) { return null; @@ -257,7 +257,7 @@ public class VaadinServlet extends Abstr } } - private String getOptionalString(Dictionary dictionary, String key) throws ConfigurationException { + private String getOptionalString(Dictionary dictionary, String key) throws ConfigurationException { Object value = dictionary.get(key); if (value != null && !(value instanceof String)) { throw new ConfigurationException(key, "Missing property"); @@ -265,7 +265,7 @@ public class VaadinServlet extends Abstr return (value == null) ? "" : ((String) value).trim(); } - private URL getURL(Dictionary dictionary, String key) throws ConfigurationException { + private URL getURL(Dictionary dictionary, String key) throws ConfigurationException { Object value = dictionary.get(key); if (value == null || !(value instanceof String)) { throw new ConfigurationException(key, "Missing property"); Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java?rev=1727510&r1=1727509&r2=1727510&view=diff ============================================================================== --- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java (original) +++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java Fri Jan 29 10:11:43 2016 @@ -129,10 +129,10 @@ abstract class BaseObjectPanel { - private final ServiceReference m_serviceRef; + private final ServiceReference m_serviceRef; private final WeakReference m_extensionFactory; - public UIExtensionFactoryHolder(ServiceReference serviceRef, UIExtensionFactory extensionFactory) { + public UIExtensionFactoryHolder(ServiceReference serviceRef, UIExtensionFactory extensionFactory) { m_serviceRef = serviceRef; m_extensionFactory = new WeakReference<>(extensionFactory); } @@ -141,8 +141,8 @@ abstract class BaseObjectPanel thatServiceRef = other.m_serviceRef; + ServiceReference thisServiceRef = m_serviceRef; // Sort in reverse order so that the highest rankings come first... return thatServiceRef.compareTo(thisServiceRef); } @@ -272,7 +272,7 @@ abstract class BaseObjectPanel ref, UIExtensionFactory factory) { synchronized (m_extensionFactories) { m_extensionFactories.add(new UIExtensionFactoryHolder(ref, factory)); } @@ -381,7 +381,7 @@ abstract class BaseObjectPanel ref, UIExtensionFactory factory) { synchronized (m_extensionFactories) { m_extensionFactories.remove(new UIExtensionFactoryHolder(ref, factory)); } @@ -928,14 +928,14 @@ abstract class BaseObjectPanel ptr = this; while (ptr != null) { ptr.refreshRowCache(); ptr = ptr.m_leftTable; } } if (direction.isGoRight()) { - BaseObjectPanel ptr = this; + BaseObjectPanel ptr = this; while (ptr != null) { ptr.refreshRowCache(); ptr = ptr.m_rightTable; Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/MainActionToolbar.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/MainActionToolbar.java?rev=1727510&r1=1727509&r2=1727510&view=diff ============================================================================== --- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/MainActionToolbar.java (original) +++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/MainActionToolbar.java Fri Jan 29 10:11:43 2016 @@ -25,6 +25,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; import org.apache.ace.client.repository.RepositoryAdmin; import org.apache.ace.webui.UIExtensionFactory; @@ -243,7 +244,7 @@ public abstract class MainActionToolbar } } - private final ConcurrentHashMap m_extensions; + private final ConcurrentMap, UIExtensionFactory> m_extensions; private final boolean m_showLogoutButton; private Button m_retrieveButton; @@ -309,7 +310,7 @@ public abstract class MainActionToolbar m_revertButton.setEnabled(modified); } - protected final void add(ServiceReference ref, UIExtensionFactory factory) { + protected final void add(ServiceReference ref, UIExtensionFactory factory) { m_extensions.put(ref, factory); setExtraComponents(); } @@ -342,19 +343,18 @@ public abstract class MainActionToolbar */ protected abstract void doAfterRevert() throws IOException; - @SuppressWarnings("unchecked") protected final List getExtraComponents() { // create a shapshot of the current extensions... - Map extensions = new HashMap<>(m_extensions); + Map, UIExtensionFactory> extensions = new HashMap<>(m_extensions); // Make sure we've got a predictable order of the components... - List refs = new ArrayList<>(extensions.keySet()); + List> refs = new ArrayList<>(extensions.keySet()); Collections.sort(refs); Map context = new HashMap<>(); List result = new ArrayList<>(); - for (ServiceReference ref : refs) { + for (ServiceReference ref : refs) { UIExtensionFactory factory = extensions.get(ref); result.add(factory.create(context)); @@ -379,7 +379,7 @@ public abstract class MainActionToolbar ); } - protected final void remove(ServiceReference ref, UIExtensionFactory factory) { + protected final void remove(ServiceReference ref, UIExtensionFactory factory) { m_extensions.remove(ref); setExtraComponents(); }