public abstract class SpongeUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_SECURITY_ALGORITHM |
static String |
TAG_SECURITY_ALGORITHM |
static String |
TAG_SECURITY_KEY_PASSWORD |
static String |
TAG_SECURITY_KEY_STORE |
static String |
TAG_SECURITY_KEY_STORE_PASSWORD |
| Modifier | Constructor and Description |
|---|---|
protected |
SpongeUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
awaitUntil(Callable<Boolean> callable) |
static boolean |
awaitUntil(Callable<Boolean> callable,
long timeout,
TimeUnit unit) |
static LocalCacheBuilder |
cacheBuilder() |
static int |
calculateInitialDynamicThreadPoolSize(SpongeEngine engine,
int maxPoolSize) |
static void |
close(InputStream stream) |
static void |
close(OutputStream stream) |
static void |
closeQuietly(Reader reader) |
static boolean |
containsException(Throwable exception,
Class<?> type) |
static String |
createControlEventName(Class<? extends ControlEvent> controlEventClass) |
static String |
createGlobalLoggerName(KnowledgeBaseEngineOperations knowledgeBaseEngineOperations) |
static <T> T |
createInstance(String className,
Class<T> javaClass) |
static String |
createLoggerName(KnowledgeBase knowledgeBase,
String targetName) |
static String |
createNonScriptKnowledgeBaseName(KnowledgeBase knowledgeBase) |
static String |
createPluginLoggerName() |
static SslConfiguration |
createSslConfiguration(Configuration configuration) |
static SSLContext |
createSslContext(SslConfiguration security) |
static <T> List<T> |
createUnmodifiableList(List<T> source) |
static <K,V> Map<K,V> |
createUnmodifiableMap(Map<K,V> source) |
static <T extends Serializable> |
deepClone(T source) |
static void |
doInWrappedException(KnowledgeBase knowledgeBase,
Runnable runnable,
String sourceName) |
protected static void |
doValidateType(DataType type,
String valueName,
Deque<DataType> stack) |
static String |
dumpConfiguration(org.apache.commons.configuration2.Configuration configuration)
Dumps configuration to string.
|
static Thread |
executeConcurrentlyOnce(SpongeEngine engine,
Runnable runnable,
String name) |
static String |
getAbbreviatedEventSequenceString(BaseRule rule) |
static Class<?> |
getClass(String className)
Finds a class by the name.
|
static String |
getConfigurationFileDir(SpongeEngine engine)
Returns the configuration file directory or
null if the configuration file is not present. |
static <T> T |
getException(Throwable exception,
Class<T> type) |
static String |
getFileDir(URL fileUrl) |
static File |
getFileDirAsFile(String filePath) |
static String |
getLastSubdirectory(String dir) |
static List<String> |
getNameList(String namesSpec) |
static String |
getPackagePath(Class<?> cls) |
static ProcessorQualifiedName |
getProcessorQualifiedName(ProcessorOperations processorOperations) |
static List<ProcessorQualifiedName> |
getProcessorQualifiedNameList(String processorQualifiedNamesSpec) |
static String |
getRandomUuidString() |
static Reader |
getReader(String fileName) |
static Reader |
getReader(String fileName,
Charset charset) |
static String |
getRequiredConfigurationString(Configuration configuration,
String key) |
static ScriptKnowledgeBaseInterpreter |
getScriptInterpreter(SpongeEngine engine,
String kbName) |
static String |
getSourceName(Throwable exception) |
static KnowledgeBaseEngineOperations |
getSponge(KnowledgeBaseInterpreter interpreter) |
static List<Class<? extends DataType>> |
getSupportedTypes() |
static URL |
getUrlFromClasspath(String resourceName) |
static <K,V> Map<K,V> |
immutableMapOf(K k1,
V v1) |
static <K,V> Map<K,V> |
immutableMapOf(K k1,
V v1,
K k2,
V v2) |
static <K,V> Map<K,V> |
immutableMapOf(K k1,
V v1,
K k2,
V v2,
K k3,
V v3) |
static <K,V> Map<K,V> |
immutableMapOf(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4) |
static <K,V> Map<K,V> |
immutableMapOf(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5) |
static <E> Set<E> |
immutableSetOf(E e) |
static <E> Set<E> |
immutableSetOf(E e1,
E e2) |
static <E> Set<E> |
immutableSetOf(E e1,
E e2,
E e3) |
static <E> Set<E> |
immutableSetOf(E e1,
E e2,
E e3,
E e4) |
static <E> Set<E> |
immutableSetOf(E e1,
E e2,
E e3,
E e4,
E e5) |
static Object |
invokeMethod(Object target,
String name,
Object... args) |
static boolean |
isAbstract(Class<?> cls) |
static boolean |
isSystemEvent(Event event) |
static byte[] |
readFileToByteArray(String fileName) |
static void |
registerShutdownHook(SpongeEngine engine) |
static Object |
searchConfigurationValueByAttributeValue(Configuration root,
String parentKey,
String attrName,
String attrValue) |
static void |
shutdownExecutorService(Object named,
ExecutorService executorService,
long timeout) |
static void |
shutdownExecutorService(SpongeEngine engine,
Object named,
ExecutorService executorService) |
static List<String> |
split(String text,
char separator) |
static <T> Stream<T> |
stream(Iterator<T> iterator) |
static int |
toInt(Object value) |
static String |
toStringArrayEventSequence(Collection<Event> events,
String attributeName) |
static String |
toStringEventSequence(Collection<Event> events) |
static String |
toStringEventSequence(Collection<Event> events,
String attributeName) |
static String |
toUpperCamelCaseFromUnderscore(String s) |
static void |
validateEventName(String name) |
static void |
validateRecordFieldName(String name,
String valueName) |
static void |
validateType(DataType type,
String valueName) |
static SpongeException |
wrapException(KnowledgeBaseInterpreter interpreter,
Throwable throwable) |
static SpongeException |
wrapException(Processor<?> processor,
Throwable throwable) |
static SpongeException |
wrapException(String sourceName,
KnowledgeBaseInterpreter interpreter,
Throwable throwable) |
static SpongeException |
wrapException(String sourceName,
Throwable throwable)
Wraps or creates a new Sponge exception.
|
static SpongeException |
wrapException(Throwable throwable)
Wraps or creates a new Sponge exception.
|
static SpongeException |
wrapInvokeException(Object target,
String method,
KnowledgeBaseInterpreter interpreter,
Throwable throwable) |
static void |
writeByteArrayToFile(byte[] bytes,
String fileName) |
public static final String TAG_SECURITY_KEY_STORE_PASSWORD
public static final String TAG_SECURITY_KEY_PASSWORD
public static final String TAG_SECURITY_KEY_STORE
public static final String TAG_SECURITY_ALGORITHM
public static final String DEFAULT_SECURITY_ALGORITHM
public static <T extends Serializable> T deepClone(T source)
public static String dumpConfiguration(org.apache.commons.configuration2.Configuration configuration)
configuration - a configuration.public static Object searchConfigurationValueByAttributeValue(Configuration root, String parentKey, String attrName, String attrValue)
public static Thread executeConcurrentlyOnce(SpongeEngine engine, Runnable runnable, String name)
public static String createGlobalLoggerName(KnowledgeBaseEngineOperations knowledgeBaseEngineOperations)
public static String createPluginLoggerName()
public static String createLoggerName(KnowledgeBase knowledgeBase, String targetName)
public static String createNonScriptKnowledgeBaseName(KnowledgeBase knowledgeBase)
public static void shutdownExecutorService(Object named, ExecutorService executorService, long timeout)
public static void shutdownExecutorService(SpongeEngine engine, Object named, ExecutorService executorService)
public static ScriptKnowledgeBaseInterpreter getScriptInterpreter(SpongeEngine engine, String kbName)
public static KnowledgeBaseEngineOperations getSponge(KnowledgeBaseInterpreter interpreter)
public static String getAbbreviatedEventSequenceString(BaseRule rule)
public static SpongeException wrapException(Throwable throwable)
throwable - source throwable.public static SpongeException wrapException(String sourceName, Throwable throwable)
sourceName - source name of the exception.throwable - source throwable.public static SpongeException wrapException(Processor<?> processor, Throwable throwable)
public static SpongeException wrapException(KnowledgeBaseInterpreter interpreter, Throwable throwable)
public static SpongeException wrapException(String sourceName, KnowledgeBaseInterpreter interpreter, Throwable throwable)
public static SpongeException wrapInvokeException(Object target, String method, KnowledgeBaseInterpreter interpreter, Throwable throwable)
public static String toStringEventSequence(Collection<Event> events)
public static String toStringEventSequence(Collection<Event> events, String attributeName)
public static String toStringArrayEventSequence(Collection<Event> events, String attributeName)
public static String createControlEventName(Class<? extends ControlEvent> controlEventClass)
public static int calculateInitialDynamicThreadPoolSize(SpongeEngine engine, int maxPoolSize)
public static <E> Set<E> immutableSetOf(E e)
public static <E> Set<E> immutableSetOf(E e1, E e2)
public static <E> Set<E> immutableSetOf(E e1, E e2, E e3)
public static <E> Set<E> immutableSetOf(E e1, E e2, E e3, E e4)
public static <E> Set<E> immutableSetOf(E e1, E e2, E e3, E e4, E e5)
public static <K,V> Map<K,V> immutableMapOf(K k1, V v1)
public static <K,V> Map<K,V> immutableMapOf(K k1, V v1, K k2, V v2)
public static <K,V> Map<K,V> immutableMapOf(K k1, V v1, K k2, V v2, K k3, V v3)
public static <K,V> Map<K,V> immutableMapOf(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
public static <K,V> Map<K,V> immutableMapOf(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
public static void close(InputStream stream)
public static void close(OutputStream stream)
public static void closeQuietly(Reader reader)
public static String getRequiredConfigurationString(Configuration configuration, String key)
public static int toInt(Object value)
public static void registerShutdownHook(SpongeEngine engine)
public static boolean isAbstract(Class<?> cls)
public static boolean awaitUntil(Callable<Boolean> callable, long timeout, TimeUnit unit)
public static boolean isSystemEvent(Event event)
public static List<ProcessorQualifiedName> getProcessorQualifiedNameList(String processorQualifiedNamesSpec)
public static SSLContext createSslContext(SslConfiguration security)
public static SslConfiguration createSslConfiguration(Configuration configuration)
public static ProcessorQualifiedName getProcessorQualifiedName(ProcessorOperations processorOperations)
public static Class<?> getClass(String className)
className - the class name.null if not found.public static void doInWrappedException(KnowledgeBase knowledgeBase, Runnable runnable, String sourceName)
protected static void doValidateType(DataType type, String valueName, Deque<DataType> stack)
public static String getConfigurationFileDir(SpongeEngine engine)
null if the configuration file is not present.engine - the engine.public static LocalCacheBuilder cacheBuilder()
public static String getRandomUuidString()
public static byte[] readFileToByteArray(String fileName)
public static void writeByteArrayToFile(byte[] bytes,
String fileName)
public static void validateEventName(String name)
Copyright © 2016–2019 Softelnet. All rights reserved.