org.jinterop.dcom.common
Class JISystem

java.lang.Object
  extended by org.jinterop.dcom.common.JISystem

public final class JISystem
extends java.lang.Object

General purpose utility class. Fields set here are applied system wide. The j-Interop library 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 JISystem.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")

Since:
1.0

Method Summary
static java.lang.String getClsidFromProgId(java.lang.String progId)
          Queries the property file maintaining the progId Vs Clsid DB and returns the JIClsid or null
static JIComVersion getCOMVersion()
          Returns COM version currently being used by the library.
static java.util.ResourceBundle getErrorMessages()
          Returns the ResourceBundle associated with current locale.
static java.util.Locale getLocale()
          Returns current locale associated with the library.
static java.lang.String getLocalizedMessage(int code)
          Returns the localized error messages for the error code.
static java.util.logging.Logger getLogger()
          Returns the j-Interop logger identified by the name "org.jinterop".
static boolean isAutoRegistrationSet()
          Returns true is auto registration is enabled.
static boolean isJavaCoClassAutoCollectionSet()
          Status of autoCollection flag.
static void setAutoRegisteration(boolean autoRegisteration)
          Pass true if, this is an OCX\DLL component and you want the library to do auto registration.
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 j-Interop runtime.
static void setLocale(java.util.Locale locale)
          Sets the locale, this locale will be used to retrieve the resource bundle for Error Messages.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLogger

public static java.util.logging.Logger getLogger()
Returns the j-Interop logger identified by the name "org.jinterop".

Returns:

setCOMVersion

public static void setCOMVersion(JIComVersion comVersion)
Sets the COM version which the library would use for communicating with COM servers.
Default is 5.2.

Parameters:
comVersion -

getCOMVersion

public static JIComVersion getCOMVersion()
Returns COM version currently being used by the library.

Returns:

setLocale

public static void setLocale(java.util.Locale locale)
Sets the locale, this locale will be used to retrieve the resource bundle for Error Messages.

Parameters:
locale - default is Locale.getDefault().

getLocale

public static java.util.Locale getLocale()
Returns current locale associated with the library.

Returns:

getErrorMessages

public static java.util.ResourceBundle getErrorMessages()
Returns the ResourceBundle associated with current locale.

Returns:

getLocalizedMessage

public static java.lang.String getLocalizedMessage(int code)
Returns the localized error messages for the error code.

Parameters:
code - error code
Returns:

getClsidFromProgId

public static java.lang.String getClsidFromProgId(java.lang.String progId)
Queries the property file maintaining the progId Vs Clsid DB and returns the JIClsid or null

Parameters:
progId -
Returns:

setAutoRegisteration

public static void setAutoRegisteration(boolean autoRegisteration)
Pass true if, this is an OCX\DLL component and you want the library to do auto registration. This API supercedes the instance specific flags set on JIClsid or JIProgID.

Parameters:
autoRegisteration -

isAutoRegistrationSet

public static boolean isAutoRegistrationSet()
Returns true is auto registration is enabled.

Returns:

setJavaCoClassAutoCollection

public static void setJavaCoClassAutoCollection(boolean autoCollection)

Sometimes the DCOM runtime of Windows will not send a ping on time to the j-Interop runtime. It is not very abnormal, since Windows can sometimes resort to mechanisms other than DCOM to keep a reference count for the instances they imported. In case of j-Interop, if a ping is not recieved in 8 minutes , the Java CoClass is collected for GC. And when the COM server asks for it, it is sent back an Exception. Please use this flag to set the Auto Collection status to ON or OFF. By Default, it is ON.

Parameters:
autoCollection -

isJavaCoClassAutoCollectionSet

public static boolean isJavaCoClassAutoCollectionSet()
Status of autoCollection flag. True if autoCollection is enabled, false otherwise.

Returns:

setInBuiltLogHandler

public static void setInBuiltLogHandler(boolean useParentHandlers)
                                 throws java.lang.SecurityException,
                                        java.io.IOException
Used to set the in built log handler.

Parameters:
useParentHandlers - true if parent handlers should be used.
Throws:
java.io.IOException
java.lang.SecurityException