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 |
protected static org.reflections.Reflections |
TYPE_REFLECTIONS |
| Modifier | Constructor and Description |
|---|---|
protected |
SpongeUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
awaitUntil(Callable<Boolean> callable,
long timeout,
TimeUnit unit) |
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 |
createSecurityConfiguration(Configuration securityConfiguration) |
static SSLContext |
createSslContext(SslConfiguration security) |
static <T extends Serializable> |
deepClone(T source) |
static void |
doInWrappedException(KnowledgeBase knowledgeBase,
Runnable runnable,
String sourceName) |
static String |
dumpConfiguration(org.apache.commons.configuration2.Configuration configuration)
Dumps configuration to string.
|
static void |
executeConcurrentlyOnce(SpongeEngine engine,
Runnable runnable) |
static String |
getAbbreviatedEventSequenceString(BaseRule rule) |
static Class<?> |
getClass(String className) |
static String |
getConfigurationFileDir(SpongeEngine engine)
Returns the configuration file directory or
null if the configuration file is not present. |
static KnowledgeBaseEngineOperations |
getEps(KnowledgeBaseInterpreter interpreter) |
static <T> T |
getException(Throwable exception,
Class<T> type) |
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 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 List<Class<? extends Type>> |
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 Object |
invokeMethod(Object target,
String name,
Object... args) |
static boolean |
isAbstract(Class<?> cls) |
static boolean |
isSystemEvent(Event event) |
static void |
registerShutdownHook(SpongeEngine engine) |
static Object |
searchConfigurationValueByAttributeValue(Configuration root,
String parentKey,
String attrName,
String attrValue) |
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 |
trialRunEngine(SpongeEngine engine,
int timeout)
Trial run of the engine.
|
static void |
validateType(Type 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) |
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
protected static final org.reflections.Reflections TYPE_REFLECTIONS
public static void trialRunEngine(SpongeEngine engine, int timeout)
timeout seconds after startup.engine - the engine.timeout - timeout in seconds.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 void executeConcurrentlyOnce(SpongeEngine engine, Runnable runnable)
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(SpongeEngine engine, Object named, ExecutorService executorService)
public static ScriptKnowledgeBaseInterpreter getScriptInterpreter(SpongeEngine engine, String kbName)
public static KnowledgeBaseEngineOperations getEps(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 <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 createSecurityConfiguration(Configuration securityConfiguration)
public static ProcessorQualifiedName getProcessorQualifiedName(ProcessorOperations processorOperations)
public static void doInWrappedException(KnowledgeBase knowledgeBase, Runnable runnable, String sourceName)
public static String getConfigurationFileDir(SpongeEngine engine)
null if the configuration file is not present.engine - the engine.Copyright © 2016–2018 Softelnet. All rights reserved.