public abstract class SpongeUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
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 void |
applyCategory(CategoryMeta categoryMeta,
ProcessorAdapter processorAdapter) |
static void |
applyCategory(ProcessorAdapter processorAdapter) |
static boolean |
awaitUntil(Callable<Boolean> callable) |
static boolean |
awaitUntil(Callable<Boolean> callable,
long timeout,
TimeUnit unit) |
static List<Object> |
buildActionArgsList(ActionAdapter actionAdapter,
Map<String,?> argsMap) |
static List<Object> |
buildActionArgsList(ActionAdapter actionAdapter,
Map<String,?> argsMap,
boolean ignoreUnknownArgs) |
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 RuleEventSpec |
convertRuleEventSpec(KnowledgeBase knowledgeBase,
String eventStringSpec) |
static List<RuleEventSpec> |
convertRuleEventSpecs(KnowledgeBase knowledgeBase,
List<String> eventStringSpecs) |
static String |
createControlEventName(Class<? extends ControlEvent> controlEventClass) |
static String |
createErrorMessage(Throwable exception,
ExceptionContext context,
boolean includeStackTrace) |
static String |
createGlobalLoggerName(KnowledgeBaseEngineOperations knowledgeBaseEngineOperations) |
static <T> T |
createInstance(String className,
Class<T> javaClass) |
static KeyManagerFactory |
createKeyManagerFactory(KeyStore ks,
SslConfiguration sslConfiguration) |
static KeyManagerFactory |
createKeyManagerFactory(SslConfiguration sslConfiguration) |
static String |
createLoggerName(KnowledgeBase knowledgeBase,
String targetName) |
static String |
createNonScriptKnowledgeBaseName(KnowledgeBase knowledgeBase) |
static String |
createPluginLoggerName() |
static EventCondition |
createRuleEventConditionForMethod(Rule rule,
String name) |
static EventCondition |
createRuleEventConditionForMethods(Rule rule,
List<String> names) |
static SslConfiguration |
createSslConfiguration(Configuration configuration) |
static SSLContext |
createSslContext(SslConfiguration sslConfiguration) |
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 Future<?> |
executeConcurrentlyOnce(SpongeEngine engine,
Runnable runnable,
String name) |
static String |
getAbbreviatedEventSequenceString(BaseRule rule) |
static Map<String,Integer> |
getActionArgIndexes(ActionAdapter actionAdapter,
Set<String> argNames,
boolean ignoreUnknownArgs) |
static int |
getCategoryIndex(SpongeEngine engine,
CategoryMeta category) |
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 String |
getDisplayLabel(Descriptive descriptive) |
static String |
getFileDir(URL fileUrl) |
static File |
getFileDirAsFile(String filePath) |
static InputStream |
getInputStream(String filename)
Opens an input stream for a file.
|
protected static KeyStore |
getKeyStoreInstance() |
static int |
getKnowledgeBaseIndex(SpongeEngine engine,
KnowledgeBase kb) |
static KnowledgeBaseType |
getKnowledgeBaseType(SpongeEngine engine,
String language) |
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)
Opens a reader for a file.
|
static Reader |
getReader(String filename,
Charset charset)
Opens a reader for a file.
|
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 <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,
K k6,
V v6) |
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 |
isSingleton(Processor<?> processor) |
static boolean |
isSystemEvent(Event event) |
static void |
mergeInheritedRecordType(RecordType type) |
protected static void |
mergeTypes(DataType baseType,
DataType subType) |
static byte[] |
readFileToByteArray(String filename) |
static void |
registerShutdownHook(SpongeEngine engine) |
static String |
removeLeadingExceptionClassNamesFromMessage(Throwable e) |
static Object |
searchConfigurationValueByAttributeValue(Configuration root,
String parentKey,
String attrName,
String attrValue) |
static void |
setupType(DataType type) |
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,
String specificErrorMessage,
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 <T extends Serializable> T deepClone(T source)
public static Reader getReader(String filename)
filename - the filename.null if not found.public static Reader getReader(String filename, Charset charset)
filename - the filename.charset - the charset.null if not found.public static InputStream getInputStream(String filename)
filename - the filename.null if not found.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 Future<?> 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 createErrorMessage(Throwable exception, ExceptionContext context, boolean includeStackTrace)
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(String sourceName, String specificErrorMessage, Throwable throwable)
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 <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, K k6, V v6)
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)
protected static KeyStore getKeyStoreInstance()
public static KeyManagerFactory createKeyManagerFactory(KeyStore ks, SslConfiguration sslConfiguration)
public static KeyManagerFactory createKeyManagerFactory(SslConfiguration sslConfiguration)
public static SSLContext createSslContext(SslConfiguration sslConfiguration)
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 void setupType(DataType type)
public static void mergeInheritedRecordType(RecordType type)
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)
public static int getKnowledgeBaseIndex(SpongeEngine engine, KnowledgeBase kb)
public static int getCategoryIndex(SpongeEngine engine, CategoryMeta category)
public static String getDisplayLabel(Descriptive descriptive)
public static List<RuleEventSpec> convertRuleEventSpecs(KnowledgeBase knowledgeBase, List<String> eventStringSpecs)
public static RuleEventSpec convertRuleEventSpec(KnowledgeBase knowledgeBase, String eventStringSpec)
public static EventCondition createRuleEventConditionForMethods(Rule rule, List<String> names)
public static EventCondition createRuleEventConditionForMethod(Rule rule, String name)
public static KnowledgeBaseType getKnowledgeBaseType(SpongeEngine engine, String language)
public static List<Object> buildActionArgsList(ActionAdapter actionAdapter, Map<String,?> argsMap)
public static List<Object> buildActionArgsList(ActionAdapter actionAdapter, Map<String,?> argsMap, boolean ignoreUnknownArgs)
public static Map<String,Integer> getActionArgIndexes(ActionAdapter actionAdapter, Set<String> argNames, boolean ignoreUnknownArgs)
public static String removeLeadingExceptionClassNamesFromMessage(Throwable e)
public static boolean isSingleton(Processor<?> processor)
public static void applyCategory(CategoryMeta categoryMeta, ProcessorAdapter processorAdapter)
public static void applyCategory(ProcessorAdapter processorAdapter)
Copyright © 2016–2021 Softelnet. All rights reserved.