public final class JISystem extends Object
A note on logging: The framework exposes JRE based logger "org.jinterop".
Applications need to attach their own handler to this logger. If you would
like to set the in-built handler, which writes to a file
j-Interop.log in the java.io.tmpdir directory,
please use the setInBuiltLogHandler(boolean). Please note that the
level for the logger and all other configuration parameters
should be set directly on the logger instance, using
LogManager.getLogger("org.jinterop")
Note: Methods starting with internal_ keyword are internal to the framework and must not be called by the developer.
| Modifier and Type | Method and Description |
|---|---|
static String |
getClsidFromProgId(String progId)
Queries the property file maintaining the
PROGID Vs
CLSID mappings and returns the CLSID if found
or null otherwise. |
static JIComVersion |
getCOMVersion()
Returns COM version currently being used by the library.
|
static ResourceBundle |
getErrorMessages()
Returns the ResourceBundle associated with current locale.
|
static String |
getIPForHostName(String hostname)
Returns I.P address for the given
hostname. |
static Locale |
getLocale()
Returns current locale associated with the library.
|
static String |
getLocalizedMessage(int code)
Returns the localized error messages for the error code.
|
static Logger |
getLogger()
Returns the framework logger identified by the name "org.jinterop".
|
static void |
internal_dumpMap() |
static Object |
internal_getSocket()
Synchronization will be performed by the oxid master
|
static void |
internal_initLogger() |
static void |
internal_setClsidtoProgId(String progId,
String clsid)
Stores it in a temporary hash map here, and this is later persisted when the library is shutdown
|
static void |
internal_setSocket(Object socket)
Synchronization will be performed by the oxid master
|
static void |
internal_writeProgIdsToFile()
Should be called from system shut down only
|
static boolean |
isAutoRegistrationSet()
Returns true is auto registration is enabled.
|
static boolean |
isJavaCoClassAutoCollectionSet()
Status of autoCollection flag.
|
static void |
mapHostNametoIP(String hostname,
String IP)
Adds a mapping between the
hostname and its IP. |
static void |
setAutoRegisteration(boolean autoRegisteration)
Indicates to the framework, if Windows Registry settings for DLL\OCX
component identified by this object should be modified to add a
Surrogate automatically. |
static void |
setCOMVersion(JIComVersion comVersion)
Sets the COM version which the library would use for communicating with COM servers.
|
static void |
setInBuiltLogHandler(boolean useParentHandlers)
Used to set the in built log handler.
|
static void |
setJavaCoClassAutoCollection(boolean autoCollection)
Sometimes the DCOM runtime of Windows will not send a ping on time to the
Framework.
|
static void |
setLocale(Locale locale)
Sets the locale, this locale will be used to retrieve the resource bundle
for Error Messages.
|
public static Logger getLogger()
public static void setCOMVersion(JIComVersion comVersion)
comVersion - new COM versionpublic static JIComVersion getCOMVersion()
public static void setLocale(Locale locale)
locale - default is Locale.getDefault().public static Locale getLocale()
public static ResourceBundle getErrorMessages()
public static String getLocalizedMessage(int code)
code - error codepublic static String getClsidFromProgId(String progId)
PROGID Vs
CLSID mappings and returns the CLSID if found
or null otherwise.progId - user friendly string such as "Excel.Application".public static void internal_writeProgIdsToFile()
public static void internal_setClsidtoProgId(String progId, String clsid)
progId - clsid - public static Object internal_getSocket()
public static void internal_setSocket(Object socket)
socket - public static void internal_initLogger()
public static void setAutoRegisteration(boolean autoRegisteration)
Surrogate automatically. A Surrogate is a
process which provides resources such as memory and cpu for a DLL\OCX to
execute.
This API overrides the instance specific flags set on JIClsid or JIProgID.
autoRegisteration - true if auto registration should be
done by the framework.public static boolean isAutoRegistrationSet()
public static void setJavaCoClassAutoCollection(boolean autoCollection)
autoCollection - false if auto collection should be
turned off.public static boolean isJavaCoClassAutoCollectionSet()
true if autoCollection is enabled,
false otherwise.public static void setInBuiltLogHandler(boolean useParentHandlers)
throws SecurityException,
IOException
useParentHandlers - true if parent handlers should be used.IOExceptionSecurityExceptionpublic static void mapHostNametoIP(String hostname, String IP) throws UnknownHostException
hostname and its IP.
This method should be used when there is a possibility of multiple
adapters (for example from a Virtual Machine) on the COM server.
j-Interop Framework only uses the host name and ignores the I.P addresses
supplied in the interface reference of a COM object. If this hostname is
not reachable from the machine where library is currently running (such
as a Linux machine with no name mappings) then the call to this COM
server would fail with an UnknownHostException. To avoid
that either add the binding in the host machine or add the binding here.
This method stores the name vs I.P binding in a Map.
Providing the same hostname will overwrite the binding
specified before.
hostname - name of target machine.IP - address of target machine in I.P format.UnknownHostException - if the IP is invalid or cannot
be reached.IllegalArgumentException - if any parameter is null or
of 0 length.public static String getIPForHostName(String hostname)
hostname.hostname - null if a mapping could not be found.public static void internal_dumpMap()
Copyright © 2022. All rights reserved.