Package org.jjazz.analytics.api
Class Analytics
java.lang.Object
org.jjazz.analytics.api.Analytics
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"
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Log the start application eventstatic class
Log the application stop event.static class
Log the upgrade event. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildMap
(String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5) 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) Helper methods to quickly build a map from specified parameters.static Analytics
static String
A unique and anonymous id computed when JJazzLab is run for the first time on a given computer.static void
incrementProperties
(String property, long value) static void
incrementProperties
(String p1, long v1, String p2, long v2) static void
incrementProperties
(Map<String, Long> properties) Increment the properties of the current JJazzLab computer by the corresponding Long value.boolean
static void
Log a generic event with no properties.static void
Generic event with properties.void
setEnabled
(boolean b) static void
setProperties
(Map<String, ?> properties) Update the properties of the current JJazzLab computer.static void
setPropertiesOnce
(Map<String, ?> properties) Update the properties of the current JJazzLab computer only if they are not already set.static String
Helper method to get the current date and time as a string in a consistent way, whatever the current locale or time zone.toStrList
(Collection<?> c) Helper method to convert a collection of objects to a list of the corresponding strings.
-
Field Details
-
EVENT_START_APPLICATION
This event is fired by the Analytics instance upon start.- See Also:
-
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
-
setEnabled
public void setEnabled(boolean b) -
isEnabled
public boolean isEnabled() -
logEvent
Log a generic event with no properties.- Parameters:
eventName
-
-
logEvent
Generic event with properties.- Parameters:
eventName
-properties
- Authorized value classes: String, Integer, Long, Float, Boolean, or a Collection of one these classes.
-
setProperties
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
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
Increment the properties of the current JJazzLab computer by the corresponding Long value.- Parameters:
properties
-- See Also:
-
incrementProperties
-
incrementProperties
-
buildMap
Helper methods to quickly build a map from specified parameters.- Type Parameters:
T
-- Parameters:
key
-value
-- Returns:
-
buildMap
-
buildMap
-
buildMap
-
buildMap
-
buildMap
-
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
Helper method to convert a collection of objects to a list of the corresponding strings.- Parameters:
c
-- Returns:
-
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:
-