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
Nested ClassesModifier and TypeClassDescriptionstatic classLog the start application eventstatic classLog the application stop event.static classLog the upgrade event. -
Field Summary
Fields -
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 Analyticsstatic StringA unique and anonymous id computed when JJazzLab is run for the first time on a given computer.static voidincrementProperties(String property, long value) static voidincrementProperties(String p1, long v1, String p2, long v2) static voidincrementProperties(Map<String, Long> properties) Increment the properties of the current JJazzLab computer by the corresponding Long value.booleanstatic voidLog a generic event with no properties.static voidGeneric event with properties.voidsetEnabled(boolean b) static voidsetProperties(Map<String, ?> properties) Update the properties of the current JJazzLab computer.static voidsetPropertiesOnce(Map<String, ?> properties) Update the properties of the current JJazzLab computer only if they are not already set.static StringHelper 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:
-