Class SystemUtilities
java.lang.Object
com.inductiveautomation.ignition.common.script.builtin.SystemUtilities
- Direct Known Subclasses:
DesignerSystemUtilities
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This is the base implementation of the "Result" object of system.util.sendRequestAsync. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
protected static final LoggerEx
protected static final AtomicLong
protected static final org.slf4j.Logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Double
_getCpuUsageString
(ThreadInfo threadInfo) abstract DatasetUtilities.PyDataSet
_getSessionInfo
(String unameFilter, String projectFilter) protected abstract Thread
_invokeAsyncImpl
(org.python.core.PyObject fun, org.python.core.PyObject[] args, String[] kwargs, String description) abstract void
static void
beep()
static void
Executes a shell commandgetGatewayStatus
(org.python.core.PyObject[] values, String[] keywords) static LoggerEx
static String
getProperty
(String name) Simply delegates to System.getProperty()getSessionInfo
(String unameFilter) getSessionInfo
(String unameFilter, String projectFilter) getSessionInfo
(org.python.core.PyObject[] values, String[] keywords) protected abstract Version
final Thread
invokeAsynchronous
(org.python.core.PyObject[] args, String[] keywords) static org.python.core.PyObject
jsonDecode
(String jsonString) Decodes a JSON String into a PyObject.static String
jsonEncode
(DatasetUtilities.PyDataSet dataSet) static String
jsonEncode
(DatasetUtilities.PyDataSet dataSet, int indentFactor) static String
jsonEncode
(org.python.core.PyObject pyObj) Encodes a PyObject into a JSON string.static String
jsonEncode
(org.python.core.PyObject pyObj, int indentFactor) Encodes a prettyprinted PyObject into a JSON string.static org.slf4j.Logger
void
modifyTranslation
(String term, String translation, String locale) protected abstract void
modifyTranslationImpl
(String term, String translation, String locale) parseTranslateArguments
(org.python.core.PyObject[] args, String[] kwargs) Parse keyword arguments to the translate function.static void
playSoundClip
(byte[] soundData) static void
playSoundClip
(byte[] soundData, double volume, boolean wait) static void
playSoundClip
(String wavFile) static void
playSoundClip
(String wavFile, double volume, boolean wait) sendMessage
(org.python.core.PyObject[] values, String[] keywords) sendMessageInternal
(String project, String messageHandler, org.python.core.PyDictionary payload, Properties filterParams) sendRequest
(org.python.core.PyObject[] values, String[] keywords) sendRequestAsync
(org.python.core.PyObject[] values, String[] keywords) protected abstract Request
sendRequestInternal
(String project, String messageHandler, org.python.core.PyDictionary payload, Properties params, boolean async) protected Request
sendRequestInternal
(org.python.core.PyObject[] values, String[] keywords, boolean async) static void
setLoggingLevel
(String loggerName, String loggerLevel) Sets the logging level for the named logger.Gets a thread dump from the JVM and returns as a string.protected abstract String
translateImpl
(String term, String locale, boolean strict)
-
Field Details
-
DEFAULT_REQUEST_TIMEOUT
protected static final int DEFAULT_REQUEST_TIMEOUT- See Also:
-
LOG
-
MSGLOG
protected static final org.slf4j.Logger MSGLOG -
MSGID_GENERATOR
-
-
Constructor Details
-
SystemUtilities
public SystemUtilities()
-
-
Method Details
-
execute
Executes a shell command- Throws:
IOException
-
getProperty
Simply delegates to System.getProperty() -
beep
public static void beep() -
playSoundClip
- Throws:
IOException
-
threadDump
Gets a thread dump from the JVM and returns as a string.- Throws:
IOException
-
_getCpuUsageString
-
setLoggingLevel
Sets the logging level for the named logger.- Throws:
IOException
-
playSoundClip
- Throws:
IOException
-
playSoundClip
- Throws:
IOException
-
playSoundClip
- Throws:
IOException
-
invokeAsynchronous
-
_invokeAsyncImpl
-
logger
-
getLogger
-
jsonEncode
Encodes a PyObject into a JSON string. The conversion is as follows:- None into null
- True into true
- 42 into 42
- 42L into 42
- 42.0 into 42.0
- {'hello': 1, 'world': 2} into {"hello": 1, "world": 2}
- (1, 42, 'Hello world!') into [1, 42, "Hello world!"] .
- Returns:
- String
- Throws:
JSONException
-
jsonEncode
- Throws:
JSONException
-
jsonEncode
public static String jsonEncode(org.python.core.PyObject pyObj, int indentFactor) throws JSONException Encodes a prettyprinted PyObject into a JSON string.- Parameters:
indentFactor
- indentation per line- Returns:
- String result from the encode
- Throws:
JSONException
-
jsonEncode
public static String jsonEncode(DatasetUtilities.PyDataSet dataSet, int indentFactor) throws JSONException - Throws:
JSONException
-
jsonDecode
Decodes a JSON String into a PyObject. The mapping of the JSON strings to PyObjects is the inverse of jsonEncode except that json Arrays get mapped to PyList only( no way to map back to python tuple). Also, JSON integers get mapped to PyIntegers unless they are greater than the maximum value of PyInteger, in which case they get mapped to PyLong. Floating point values are mapped to PyFloat.- Parameters:
jsonString
- the JSON to decode.- Returns:
- a
PyObject
, the structure of which reflects the decoded JSON. - Throws:
JSONException
- if any errors occur decoding the provided JSON.
-
translate
-
translateImpl
@Nullable protected abstract String translateImpl(@Nonnull String term, @Nullable String locale, boolean strict) throws Exception - Throws:
Exception
-
parseTranslateArguments
public static org.apache.commons.lang3.tuple.Triple<String,String, parseTranslateArgumentsBoolean> (org.python.core.PyObject[] args, String[] kwargs) Parse keyword arguments to the translate function. Broken into a unique function to avoid duplication in other, more specific contexts.- Returns:
- A Triple containing the term, locale, and whether the 'strict' flag was passed.
- Throws:
org.python.core.PyException
- if there was an error parsing the arguments. Should be thrown directly.
-
modifyTranslation
-
modifyTranslationImpl
-
getSessionInfo
-
getSessionInfo
-
getSessionInfo
-
getSessionInfo
public DatasetUtilities.PyDataSet getSessionInfo(org.python.core.PyObject[] values, String[] keywords) -
_getSessionInfo
public abstract DatasetUtilities.PyDataSet _getSessionInfo(String unameFilter, String projectFilter) -
sendMessage
public List<String> sendMessage(org.python.core.PyObject[] values, String[] keywords) throws Exception - Throws:
Exception
-
sendMessageInternal
public abstract List<String> sendMessageInternal(String project, String messageHandler, org.python.core.PyDictionary payload, Properties filterParams) throws Exception - Throws:
Exception
-
sendRequest
- Throws:
Exception
-
sendRequestAsync
public Request sendRequestAsync(org.python.core.PyObject[] values, String[] keywords) throws Exception - Throws:
Exception
-
sendRequestInternal
-
sendRequestInternal
protected abstract Request sendRequestInternal(String project, String messageHandler, org.python.core.PyDictionary payload, Properties params, boolean async) -
getGatewayStatus
-
getVersion
- Throws:
Exception
-
getVersionInternal
- Throws:
Exception
-
audit
-