Package sk.ipesoft.d2000.d2japi
Interface D2Connector
-
- All Superinterfaces:
D2SessionFactory
- All Known Implementing Classes:
Connector
public interface D2Connector extends D2SessionFactory
D2000 JAPI connector. Each instance of JVM should use just one instance of D2Connector to connect to one instance of D2Connector.exe - proxy client to D2000 kernel.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ConvertorcreateDictionaryConvertor(int languageIndex)Create new instance of dictionary convertor for specified language.TranslatorcreateDictionaryTranslator(int languageIndex)Create new instance of dictionary translator for specified language.ObjectInfoCachecreateObjectInfoCache(int cacheTimeMilliseconds)Create new instance of ObjectInfoCache with defined maximum cache time.UnivalConvertorcreateUnivalConvertor()Create new instance ofUnivalConvertorattached to connector's structure definition resolver.java.util.TimeZonegetApplicationTimeZone()Get time zone of D2000 kernel.java.util.concurrent.ExecutorgetConnectionExecutor()Get executor used by this connector and its related sessions to perform background tasks.java.lang.StringgetConnectionName()Get connection string.longgetCurrentServerTimeMilliseconds()Get current system time in milliseconds since unix epoch of connected D2000 kernel.ObjectInfoCachegetDefaultObjectInfoCache()Get reference to default instance of ObjectInfoCache.UnivalConvertorgetDefaultUnivalConvertor()Get default instance of unival convertor.SharedResourcesCachegetSharedResourcesCache()Get cache of shared resources.D2StructureDefinitionResolvergetStructureDefinitionResolver()Get reference to D2000 structure definition cache.longgetTotalBytesRead()Get number of bytes read from stream.longgetTotalBytesSent()Get number of bytes sent into stream.booleanisConnected()Get state of being connected do D2Connector.exe.voidregisterStructureClasses(java.util.List<? extends java.lang.Class<?>> list)Register implementations ofTableclasses for use in structured univals.voidsetAutonomousWatchdog(boolean value)Activate autonomous watchdog.-
Methods inherited from interface sk.ipesoft.d2000.d2japi.D2SessionFactory
close, createSession, createSession, isClosed
-
-
-
-
Method Detail
-
getTotalBytesRead
long getTotalBytesRead()
Get number of bytes read from stream. Note that actual number of bytes received from socket may differ when TLS is used.- Returns:
-
getTotalBytesSent
long getTotalBytesSent()
Get number of bytes sent into stream. Note that actual number of bytes sent by socket may differ when TLS is used.- Returns:
-
setAutonomousWatchdog
void setAutonomousWatchdog(boolean value)
Activate autonomous watchdog. Watchdog ensures that a message is send to d2connector.exe at least every 5 seconds.- Parameters:
value-trueto activate orfalseto deactivate.
-
createDictionaryConvertor
Convertor createDictionaryConvertor(int languageIndex)
Create new instance of dictionary convertor for specified language. Dictionary convertor instance is thread safe.- Parameters:
languageIndex- index of language- Returns:
- dictionary convertor for specified language
-
createDictionaryTranslator
Translator createDictionaryTranslator(int languageIndex)
Create new instance of dictionary translator for specified language. Dictionary translator is thread safe.- Parameters:
languageIndex- index of language- Returns:
- dictionary translator for specified language
-
createObjectInfoCache
ObjectInfoCache createObjectInfoCache(int cacheTimeMilliseconds)
Create new instance of ObjectInfoCache with defined maximum cache time.- Parameters:
cacheTimeMilliseconds- maximal amount of time an item is cached- Returns:
- new instance
-
createUnivalConvertor
UnivalConvertor createUnivalConvertor()
Create new instance ofUnivalConvertorattached to connector's structure definition resolver. Unival convertor is thread safe.- Returns:
- new instance of convertor
-
getApplicationTimeZone
java.util.TimeZone getApplicationTimeZone()
Get time zone of D2000 kernel. May return local time zone if kernel doesn't provide time zone information. Returnnullbefore the first successful session connection.- Returns:
- default application time zone
-
getConnectionExecutor
java.util.concurrent.Executor getConnectionExecutor()
Get executor used by this connector and its related sessions to perform background tasks. It can be used for other background tasks in order to utilize idle worker threads from its thread pool.Since returned executor is initiated by
Executors.newCachedThreadPool()it should be used for mostly IO-bound tasks, such as waiting for and processing asynchronous events, because it would spawn any number of new worker threads, if more tasks are to be executed simultaneously.It is inadvisable to pollute it with many CPU-intensive, long-running tasks, since it would degrade overall performance of the whole system. Use dedicated
Executors.newFixedThreadPool(int)for CPU intensive tasks instead.- Returns:
- executor used by this connector instance and its related sessions
-
getConnectionName
java.lang.String getConnectionName()
Get connection string.- Returns:
- connection string
-
getCurrentServerTimeMilliseconds
long getCurrentServerTimeMilliseconds()
Get current system time in milliseconds since unix epoch of connected D2000 kernel.- Returns:
- current system time of connected D2000 kernel
-
getDefaultObjectInfoCache
ObjectInfoCache getDefaultObjectInfoCache()
Get reference to default instance of ObjectInfoCache.- Returns:
- default instance of ObjectInfoCache
-
getDefaultUnivalConvertor
UnivalConvertor getDefaultUnivalConvertor()
Get default instance of unival convertor. Unival convertor is thread safe.- Returns:
- default instance of unival convertor
-
getSharedResourcesCache
SharedResourcesCache getSharedResourcesCache()
Get cache of shared resources.- Returns:
- cache of shared resources
-
getStructureDefinitionResolver
D2StructureDefinitionResolver getStructureDefinitionResolver()
Get reference to D2000 structure definition cache.- Returns:
- D2000 structure definition cache
-
isConnected
boolean isConnected()
Get state of being connected do D2Connector.exe.- Returns:
trueif connected
-
registerStructureClasses
void registerStructureClasses(java.util.List<? extends java.lang.Class<?>> list)
Register implementations ofTableclasses for use in structured univals. Registered class must be appropriately annotated withStructureTableDefinitionandStructureConstructor.- Parameters:
list- list of classes to be used by structured univals.
-
-