ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
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 GMT
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 <code>Runnable</code>s
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 <code>Runnable</code>s
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 <code>SCHEDULER_RECIPE</code>
contained in <code>ref</code>'s
-     * service dictionary cannot be parsed by the scheduler.
+     * 
+     * @throws ConfigurationException
+     *             Is thrown when the <code>SCHEDULER_RECIPE</code> contained
in <code>ref</code>'s service dictionary
+     *             cannot be parsed by the scheduler.
      */
-    public void addRunnable(ServiceReference ref, Runnable task) throws ConfigurationException
{
+    public void addRunnable(ServiceReference<Runnable> 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<Runnable> 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 <code>addRunnable</code> and <code>removeRunnable</code>
methods. Recipes are
- * supplied using configuration properties using the <code>updated</code> method,
or are
- * passed in the task's properties.<br>
+ * The scheduler periodically runs tasks based on a scheduling recipe. Tasks can be added
and removed using the
+ * <code>addRunnable</code> and <code>removeRunnable</code> methods.
Recipes are supplied using configuration properties
+ * using the <code>updated</code> method, or are passed in the task's properties.<br>
  *
- * A task will be scheduled if both a <code>Runnable</code> and a <code>recipe</code>
are available
- * for it.
+ * A task will be scheduled if both a <code>Runnable</code> and a <code>recipe</code>
are available for it.
  */
 public class Scheduler implements ManagedService {
-    protected final Map<String, SchedulerTask> m_tasks = new HashMap<>();
+    protected final ConcurrentMap<String, SchedulerTask> 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 <code>recipe</code>
passed in prevails over
-     * any recipe provided by the <code>Scheduler</code>'s configuration.
-     * @throws ConfigurationException When <code>recipe</code> is not <code>null</code>,
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 <code>recipe</code> passed in
prevails over any recipe provided by the
+     *            <code>Scheduler</code>'s configuration.
+     * @throws ConfigurationException
+     *             When <code>recipe</code> is not <code>null</code>,
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<String, ?> 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<String> 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<String> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, ?> 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<String, ?> 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<String, ?> 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<String, ?> 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<String, ?> 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<String, ?> 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<String, ?> 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<REPO_OBJ
      * Provides a small container for {@link UIExtensionFactory} instances.
      */
     private static class UIExtensionFactoryHolder implements Comparable<UIExtensionFactoryHolder>
{
-        private final ServiceReference m_serviceRef;
+        private final ServiceReference<UIExtensionFactory> m_serviceRef;
         private final WeakReference<UIExtensionFactory> m_extensionFactory;
 
-        public UIExtensionFactoryHolder(ServiceReference serviceRef, UIExtensionFactory extensionFactory)
{
+        public UIExtensionFactoryHolder(ServiceReference<UIExtensionFactory> serviceRef,
UIExtensionFactory extensionFactory) {
             m_serviceRef = serviceRef;
             m_extensionFactory = new WeakReference<>(extensionFactory);
         }
@@ -141,8 +141,8 @@ abstract class BaseObjectPanel<REPO_OBJ
          * {@inheritDoc}
          */
         public int compareTo(UIExtensionFactoryHolder other) {
-            ServiceReference thatServiceRef = other.m_serviceRef;
-            ServiceReference thisServiceRef = m_serviceRef;
+            ServiceReference<UIExtensionFactory> thatServiceRef = other.m_serviceRef;
+            ServiceReference<UIExtensionFactory> 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<REPO_OBJ
      * @param factory
      *            the extension instance itself.
      */
-    public final void addExtension(ServiceReference ref, UIExtensionFactory factory) {
+    public final void addExtension(ServiceReference<UIExtensionFactory> ref, UIExtensionFactory
factory) {
         synchronized (m_extensionFactories) {
             m_extensionFactories.add(new UIExtensionFactoryHolder(ref, factory));
         }
@@ -381,7 +381,7 @@ abstract class BaseObjectPanel<REPO_OBJ
      * @param factory
      *            the extension instance itself.
      */
-    public final void removeExtension(ServiceReference ref, UIExtensionFactory factory) {
+    public final void removeExtension(ServiceReference<UIExtensionFactory> ref, UIExtensionFactory
factory) {
         synchronized (m_extensionFactories) {
             m_extensionFactories.remove(new UIExtensionFactoryHolder(ref, factory));
         }
@@ -928,14 +928,14 @@ abstract class BaseObjectPanel<REPO_OBJ
 
     protected final void refreshAllRowCaches(Direction direction) {
         if (direction.isGoLeft()) {
-            BaseObjectPanel ptr = this;
+            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<ServiceReference, UIExtensionFactory> m_extensions;
+    private final ConcurrentMap<ServiceReference<UIExtensionFactory>, 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<UIExtensionFactory> 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<Component> getExtraComponents() {
         // create a shapshot of the current extensions...
-        Map<ServiceReference, UIExtensionFactory> extensions = new HashMap<>(m_extensions);
+        Map<ServiceReference<UIExtensionFactory>, UIExtensionFactory> extensions
= new HashMap<>(m_extensions);
 
         // Make sure we've got a predictable order of the components...
-        List<ServiceReference> refs = new ArrayList<>(extensions.keySet());
+        List<ServiceReference<UIExtensionFactory>> refs = new ArrayList<>(extensions.keySet());
         Collections.sort(refs);
 
         Map<String, Object> context = new HashMap<>();
 
         List<Component> result = new ArrayList<>();
-        for (ServiceReference ref : refs) {
+        for (ServiceReference<UIExtensionFactory> 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<UIExtensionFactory> ref, UIExtensionFactory
factory) {
         m_extensions.remove(ref);
         setExtraComponents();
     }



Mime
View raw message