org.scijava.usage
Class DefaultUsageService

java.lang.Object
  extended by org.scijava.AbstractContextual
      extended by org.scijava.plugin.AbstractRichPlugin
          extended by org.scijava.service.AbstractService
              extended by org.scijava.usage.DefaultUsageService
All Implemented Interfaces:
Comparable<Prioritized>, Contextual, Disposable, HasPluginInfo, RichPlugin, SciJavaPlugin, Prioritized, SciJavaService, Service, UsageService

public class DefaultUsageService
extends AbstractService
implements UsageService

Default service for tracking anonymous usage statistics.

Please note that that this implementation is not thread safe. It is up to the caller to ensure that multiple threads do not attempt to modify statistics at the same time. One way to do that (but not the only way) is to only call increment(Object) from the event dispatch thread (i.e., when ThreadService.isDispatchThread() returns true). And one easy way to accomplish that is by calling the UsageService only from event handler methods.

Author:
Curtis Rueden

Constructor Summary
DefaultUsageService()
           
 
Method Summary
 void clearStats()
          Clears the table of usage statistics.
 Map<String,UsageStats> getStats()
          Gets the table of usage statistics.
 UsageStats getUsage(Object o)
          Gets the given object's usage statistics.
 void increment(Object o)
          Increments the given object's usage count.
 
Methods inherited from class org.scijava.service.AbstractService
dispose, getContext, initialize, registerEventHandlers, setContext, toString
 
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
compareTo, getInfo, getPriority, setInfo, setPriority
 
Methods inherited from class org.scijava.AbstractContextual
context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
 
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
 
Methods inherited from interface org.scijava.Prioritized
getPriority, setPriority
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
 
Methods inherited from interface org.scijava.Disposable
dispose
 

Constructor Detail

DefaultUsageService

public DefaultUsageService()
Method Detail

getStats

public Map<String,UsageStats> getStats()
Description copied from interface: UsageService
Gets the table of usage statistics.

Specified by:
getStats in interface UsageService

clearStats

public void clearStats()
Description copied from interface: UsageService
Clears the table of usage statistics.

Specified by:
clearStats in interface UsageService

getUsage

public UsageStats getUsage(Object o)
Description copied from interface: UsageService
Gets the given object's usage statistics.

Specified by:
getUsage in interface UsageService

increment

public void increment(Object o)
Description copied from interface: UsageService
Increments the given object's usage count.

Specified by:
increment in interface UsageService


Copyright © 2009–2014 SciJava. All rights reserved.