Class NewtsUtils


  • public abstract class NewtsUtils
    extends java.lang.Object
    Utility functions and constants.
    Author:
    jwhite
    • Field Detail

      • DISABLE_INDEXING

        public static final boolean DISABLE_INDEXING
      • MAX_BATCH_SIZE

        public static final int MAX_BATCH_SIZE
      • TTL

        public static final int TTL
      • HOSTNAME_PROPERTY

        public static final java.lang.String HOSTNAME_PROPERTY
        See Also:
        Constant Field Values
      • KEYSPACE_PROPERTY

        public static final java.lang.String KEYSPACE_PROPERTY
        See Also:
        Constant Field Values
      • DEFAULT_HOSTNAME

        public static final java.lang.String DEFAULT_HOSTNAME
        See Also:
        Constant Field Values
      • DEFAULT_KEYSPACE

        public static final java.lang.String DEFAULT_KEYSPACE
        See Also:
        Constant Field Values
      • INDEXING_OPTIONS

        public static final org.opennms.newts.cassandra.search.CassandraIndexingOptions INDEXING_OPTIONS
    • Constructor Detail

      • NewtsUtils

        public NewtsUtils()
    • Method Detail

      • addIndicesToAttributes

        public static void addIndicesToAttributes​(ResourcePath path,
                                                  java.util.Map<java.lang.String,​java.lang.String> attributes)
        Extends the attribute map with indices used by the NewtsResourceStorageDao. A resource path of the form [a, b, c, d] will be indexed with:
        • _idx1: (a, 4)
        • _idx2: (a:b, 4)
        • _idx3: (a:b:c, 4)
      • toResourceId

        public static java.lang.String toResourceId​(ResourcePath path)
        Converts a ResourcePath to a Newts resource id.
        Parameters:
        path - path to convert
        Returns:
        Newts resource id
      • toResourcePath

        public static ResourcePath toResourcePath​(java.lang.String resourceId)
        Converts a Newts resource id to a ResourcePath.
        Parameters:
        resourceId - Newts resource id
        Returns:
        path
      • toMetricName

        public static java.lang.String toMetricName​(java.lang.String resourceId)
        Extracts the metric name from the resource id.
        Parameters:
        resourceId - Newts resource id
        Returns:
        metric name
      • createSampleForIndexingStrings

        public static org.opennms.newts.api.Sample createSampleForIndexingStrings​(org.opennms.newts.api.Context context,
                                                                                  org.opennms.newts.api.Resource resource)
        Creates a sample used to index string attributes. These should only be index and not be persisted.