Class Analytics

java.lang.Object
org.jjazz.analytics.api.Analytics

public class Analytics extends Object
Feature usage analytics methods.

The class acts as a centralized bridge to collect all feature analytics events and pass them to AnalyticsProcessor instances present in the global lookup.

Properties/event names examples: "Upgrade" or "New Version"

  • Field Details

    • EVENT_START_APPLICATION

      public static final String EVENT_START_APPLICATION
      This event is fired by the Analytics instance upon start.
      See Also:
    • EVENT_STOP_APPLICATION

      public static final String EVENT_STOP_APPLICATION
      This event is fired by the Analytics instance upon shutdown, with no properties.

      AnalyticsProcessors must be process the event quickly in order to not block the shutdown sequence.

      See Also:
  • Method Details

    • getInstance

      public static Analytics getInstance()
    • setEnabled

      public void setEnabled(boolean b)
    • isEnabled

      public boolean isEnabled()
    • logEvent

      public static void logEvent(String eventName)
      Log a generic event with no properties.
      Parameters:
      eventName -
    • logEvent

      public static void logEvent(String eventName, Map<String,?> properties)
      Generic event with properties.
      Parameters:
      eventName -
      properties - Authorized value classes: String, Integer, Long, Float, Boolean, or a Collection of one these classes.
    • setProperties

      public static void setProperties(Map<String,?> properties)
      Update the properties of the current JJazzLab computer.

      Parameters:
      properties - Authorized value classes: String, Integer, Long, Float, Boolean, or a Collection of one these classes.
      See Also:
    • setPropertiesOnce

      public static void setPropertiesOnce(Map<String,?> properties)
      Update the properties of the current JJazzLab computer only if they are not already set.

      Parameters:
      properties - Authorized value classes: String, Integer, Long, Float, Boolean, or a Collection of one these classes.
      See Also:
    • incrementProperties

      public static void incrementProperties(Map<String,Long> properties)
      Increment the properties of the current JJazzLab computer by the corresponding Long value.
      Parameters:
      properties -
      See Also:
    • incrementProperties

      public static void incrementProperties(String property, long value)
    • incrementProperties

      public static void incrementProperties(String p1, long v1, String p2, long v2)
    • buildMap

      public static <T> Map<String,T> buildMap(String key, T value)
      Helper methods to quickly build a map from specified parameters.
      Type Parameters:
      T -
      Parameters:
      key -
      value -
      Returns:
    • buildMap

      public static Map<String,Object> buildMap(String k1, Object v1, String k2, Object v2)
    • buildMap

      public static Map<String,Object> buildMap(String k1, Object v1, String k2, Object v2, String k3, Object v3)
    • buildMap

      public static Map<String,Object> buildMap(String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4)
    • buildMap

      public static Map<String,Object> buildMap(String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5)
    • buildMap

      public static Map<String,Object> buildMap(String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5, String k6, Object v6)
    • toStdDateTimeString

      public static String toStdDateTimeString()
      Helper method to get the current date and time as a string in a consistent way, whatever the current locale or time zone.

      Uses UTC time and ISO format: YYYY-MM-DDTHH:MM:SS

      Returns:
    • toStrList

      public static List<String> toStrList(Collection<?> c)
      Helper method to convert a collection of objects to a list of the corresponding strings.
      Parameters:
      c -
      Returns:
    • getJJazzLabComputerId

      public static String getJJazzLabComputerId()
      A unique and anonymous id computed when JJazzLab is run for the first time on a given computer.

      The id is stored as a user preference, so it might be deleted if Netbeans user directory is deleted. If user upgrades to a new version, the id is imported from the previous version settings.

      Id is calculated from current time in milliseconds + a random number, converted to hexadecimal.

      Returns: