com.ibm.tivoli.maximo.iotservices

Class IoTUtils

  • java.lang.Object
    • com.ibm.tivoli.maximo.iotservices.IoTUtils
    • Constructor Detail

      • IoTUtils

        public IoTUtils()
    • Method Detail

      • getCachedRestEndPointInfo

        public static IoTRestEndPointsInfo getCachedRestEndPointInfo(java.lang.String servicename,
                                                                     java.lang.String usedwith)
                                                              throws java.rmi.RemoteException,
                                                                     MXException
        Returns a Rest EndPoints Info object
        Parameters:
        servicename -
        usedwith -
        Returns:
        IoTRestEndPointsInfo
        Throws:
        java.rmi.RemoteException
        MXException
      • getCachedRestEndPointInfo

        public static java.util.List getCachedRestEndPointInfo(java.lang.String servicename)
                                                        throws java.rmi.RemoteException,
                                                               MXException
        Returns Rest EndPoints Info for a Service
        Parameters:
        servicename -
        Returns:
        List
        Throws:
        java.rmi.RemoteException
        MXException
      • getCachedEndPointValue

        public static java.lang.String getCachedEndPointValue(java.lang.String servicename,
                                                              java.lang.String usedwith)
        Returns a Rest EndPoint Value
        Parameters:
        servicename -
        usedwith -
        Returns:
        IoTRestEndPointsInfo
        Throws:
        java.rmi.RemoteException
        MXException
      • isDeviceOnAssetMeter

        public static boolean isDeviceOnAssetMeter(java.lang.String servicename)
        Returns a boolean indicating if devices are associated at the meter level. If return value is false we assume devices are mapped at the asset level.
        Parameters:
        servicename -
        Returns:
      • getCachedEndPointHttpMethod

        public static java.lang.String getCachedEndPointHttpMethod(java.lang.String servicename,
                                                                   java.lang.String usedwith)
        Returns the Http Method for the endpoint
        Parameters:
        servicename -
        usedwith -
        Returns:
        IoTRestEndPointsInfo
        Throws:
        java.rmi.RemoteException
        MXException
      • getCachedEndPointBody

        public static java.lang.String getCachedEndPointBody(java.lang.String servicename,
                                                             java.lang.String usedwith)
        Returns the Body for the endpoint
        Parameters:
        servicename -
        usedwith -
        Returns:
        IoTRestEndPointsInfo
        Throws:
        java.rmi.RemoteException
        MXException
      • getCachedEndPointResultTag

        public static java.lang.String getCachedEndPointResultTag(java.lang.String servicename,
                                                                  java.lang.String usedwith)
        Returns the ResultTagName for the end point.
        Parameters:
        servicename -
        usedwith -
        Returns:
      • parseDelimiter

        public static java.lang.String parseDelimiter(java.lang.String str,
                                                      java.lang.String delimiter,
                                                      int startPos)
        Returns the right side of a delimited string preserving the rest of the string which may contain the same delimiter. Useful when the delimiters are duplicated in the same string, like colon's in a URL string for example and you want to parse out only one. The string is parsed from the start position which is a zero based index e.g. "http://xyz.com:7001/" will return "//xyz.com:7001/" if startPos = 0 or "7001/" if startPos > 4 and < 13 If the string cannot be parsed the original string will be returned.
        Parameters:
        str -
        delimiter -
        startPos - (zero based)
        Returns:
        parsed string or original if it cannot be parsed
      • getDeviceTypeInfoForActiveService

        public static java.util.Map getDeviceTypeInfoForActiveService()
        Returns a map of for the active service
        Returns:
      • getJsonResourceForActiveService

        public static java.lang.String getJsonResourceForActiveService()
        Returns the JSONResource name for active service
        Returns:
      • getPayloadProps

        public static java.util.Map getPayloadProps(java.lang.String service)
        Returns a map List of payload props for a service
        Returns:
      • getPayloadPropsUsedBy

        public static IoTPayloadPropsInfo getPayloadPropsUsedBy(java.lang.String service,
                                                                java.lang.String property)
      • getPayloadProps

        public static java.util.Map getPayloadProps(java.lang.String service,
                                                    java.lang.String usedby)
        Returns a map List of payload props for a service by Usedby
        Returns:
      • getActiveService

        public static java.lang.String getActiveService()
        Returns the name of the active service
        Returns:
      • toISO8601UTC

        public static java.lang.String toISO8601UTC(java.util.Date date)
        Takes a Date and converts it to a UTC string that conforms to ISO8601 standard
        Parameters:
        date -
        Returns:
      • getJsonObjectAsString

        public static java.lang.String getJsonObjectAsString(com.ibm.json.java.JSONArtifact ja)
      • substituteVariable

        public static java.lang.String substituteVariable(java.lang.String template,
                                                          java.lang.String variable,
                                                          java.lang.String replacement)
      • getJsonTagElementVal

        public static java.lang.Object getJsonTagElementVal(com.ibm.json.java.JSONObject jsonObject,
                                                            java.lang.String jsonPath)
        Get the data desired within a JSON data structure.
        Parameters:
        jsonObject - The JSON data structure
        jsonPath - A string specifying the path to get desired data.
        Returns:
        The desired data
      • parseTagMap

        public static java.util.List parseTagMap(java.lang.String ranges)
                                          throws MXException
        Parses a date tag-mapping string. Returns a list of the external & internal names of time periods. Returns an empty array if the parameter is empty or null.
        Parameters:
        ranges - String in the form of: + "=" + [, + "=" + ]*.
        Returns:
        The list of values pairs in arrays. The [0] element is the internal value, the [1] element is the external value.
        Throws:
        MXException