Class SystemUtilities
java.lang.Object
com.inductiveautomation.ignition.common.script.builtin.SystemUtilities
- Direct Known Subclasses:
DesignerSystemUtilities
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Double_getCpuUsageString(ThreadInfo threadInfo) abstract Dataset_getSessionInfo(String unameFilter, String projectFilter) protected abstract Thread_invokeAsyncImpl(org.python.core.PyObject fun, org.python.core.PyObject[] args, String[] kwargs, String description) abstract voidstatic voidbeep()static voidExecutes a shell commandgetGatewayStatus(org.python.core.PyObject[] values, String[] keywords) static LoggerExstatic StringgetProperty(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 Versionfinal ThreadinvokeAsynchronous(org.python.core.PyObject[] args, String[] keywords) static org.python.core.PyObjectjsonDecode(String jsonString) Decodes a JSON String into a PyObject.static StringjsonEncode(DatasetUtilities.PyDataSet dataSet) static StringjsonEncode(DatasetUtilities.PyDataSet dataSet, int indentFactor) static StringjsonEncode(org.python.core.PyObject pyObj) Encodes a PyObject into a JSON string.static StringjsonEncode(org.python.core.PyObject pyObj, int indentFactor) Encodes a prettyprinted PyObject into a JSON string.static org.slf4j.LoggervoidmodifyTranslation(String term, String translation, String locale) protected abstract voidmodifyTranslationImpl(String term, String translation, String locale) parseTranslateArguments(org.python.core.PyObject[] args, String[] kwargs) Parse keyword arguments to the translate function.static voidplaySoundClip(byte[] soundData) static voidplaySoundClip(byte[] soundData, double volume, boolean wait) static voidplaySoundClip(String wavFile) static voidplaySoundClip(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 final CompletableFuture<Object>sendRequestInternal(PyArgumentMap args, boolean async) protected abstract CompletableFuture<Object>sendRequestInternal(String project, String messageHandler, org.python.core.PyDictionary payload, Properties params) static voidsetLoggingLevel(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 StringtranslateImpl(String term, String locale, boolean strict)
-
Field Details
-
DEFAULT_REQUEST_TIMEOUT
protected static final int DEFAULT_REQUEST_TIMEOUT -
LOG
-
MSGLOG
-
-
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. -
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
-
_getSessionInfo
-
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
-
sendRequestInternal
-
sendRequestInternal
protected abstract CompletableFuture<Object> sendRequestInternal(String project, String messageHandler, @Nullable org.python.core.PyDictionary payload, Properties params) -
getGatewayStatus
-
getVersion
- Throws:
Exception
-
getVersionInternal
- Throws:
Exception
-
audit
-