com.esri.arcgis.system
Class EngineInitializer

java.lang.Object
  extended bycom.esri.arcgis.system.EngineInitializer

public class EngineInitializer
extends Object

Initializes ArcObjects for Java for usage in ArcGIS Engine. The preferred way of using EngineInitializer to initialize ArcObjects is to use one of it's static initializeXXX() methods as the first call in your main method. This class also provides other static methods to control object lifetime and provide authentication information.

EngineInitializer.initializeEngine() method should be called when you want to use ArcGIS Engine in a Java based console application.

EngineInitializer.initializeVisualBeans() should be called when you are using ArcGIS Engine in a Java based GUI application. This applies even if you are not using any ArcGIS Engine visual beans (such as the MapControl) in your application.

Alternatively, the non-static setXXX(boolean) instance memebers of this class can be used to get a finer grained control over the runtime parameters. The setXXX(boolean) methods only set the options for initialization, but init() method must be called to actually initialize the ArcObjects for Java with these options.

Note that the use of EngineInitializer does not replace the need to use #AoInitialize to initialize ArcObjects.


Method Summary
 void init()
          Initializes the ArcObjects for Java with options set previously by calling setXxx() methods.
static void initializeEngine()
          Initializes ArcObjects for Java with options set for usage in an ArcGIS Engine console application.
static void initializeVisualBeans()
          Initializes ArcObjects for Java with options set for development of ArcGIS Engine GUI applications.
static void release(Object anObject)
          Releases a specific reference to a COM object.
static void releaseAll()
          Releases all outstanding references to COM objects.
static void releaseAllInCurrentThread()
          Tells the runtime to release all objects used in the current thread since the last 'trackObjectsInCurrentThread' call.
 void setBeanUsage(boolean beanUsage)
          Indicates whether visual ArcObjects for Java beans are used
static void setDefault(String domain, String user, String password)
          Sets the authentification to be used by default if none is specified when creating or using an ArcObjects Java component.
 void setEngineUsage()
          Sets the default usage for using the ArcGIS ArcObjects for Java.
 void setNativeMode(boolean nativeMode)
          Indicates whether native mode is used.
 void setShutdownHook(boolean shutdownHook)
          Causes the runtime to release COM references when the JVM shuts down normally, like when Ctrl- C is pressed
static void trackObjectsInCurrentThread()
          Tells the runtime to remember all objects used in the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setBeanUsage

public void setBeanUsage(boolean beanUsage)
Indicates whether visual ArcObjects for Java beans are used

Parameters:
beanUsage - set to true if visual ArcEngine java beans are to be used

setNativeMode

public void setNativeMode(boolean nativeMode)
Indicates whether native mode is used.

Parameters:
nativeMode - set to true if native mode is to be used. Native mode means the JVM will load ArcObjects in-process. The default value of true should not be changed for ArcGIS Engine applications.

setShutdownHook

public void setShutdownHook(boolean shutdownHook)
Causes the runtime to release COM references when the JVM shuts down normally, like when Ctrl- C is pressed

Parameters:
shutdownHook - set to true if shutdownHook is to be enabled. Defaults to true.

setEngineUsage

public void setEngineUsage()
Sets the default usage for using the ArcGIS ArcObjects for Java. Note that this method only sets the options for initialization, but init() method should be called to actually initialize the ArcObjects for Java with these options. Calling this method is equivalent of calling the following methods: setBeanUsage(true) setNativeMode(true) setShutdownHook(true)


init

public void init()
Initializes the ArcObjects for Java with options set previously by calling setXxx() methods. You only need to call this method if you have changed any options by calling one or more setXxx() methods.


initializeEngine

public static void initializeEngine()
Initializes ArcObjects for Java with options set for usage in an ArcGIS Engine console application.


initializeVisualBeans

public static void initializeVisualBeans()
Initializes ArcObjects for Java with options set for development of ArcGIS Engine GUI applications.

Use this method for initializing ArcGIS Engine in any GUI based application, even if the application does not use any of the ArcGIS visual beans like the MapControl. This method includes all the optimization parameters in initializeEngine method as well.


setDefault

public static void setDefault(String domain,
                              String user,
                              String password)
Sets the authentification to be used by default if none is specified when creating or using an ArcObjects Java component. This setting should not be changed for ArcGIS Engine applications.

Parameters:
domain - - the domain to be used when authenticating using default authentification
user - - the user to be used when authenticating using default authentification
password - - the password to be used when authenticating using default authentification

release

public static void release(Object anObject)
Releases a specific reference to a COM object.


releaseAll

public static void releaseAll()
Releases all outstanding references to COM objects.


releaseAllInCurrentThread

public static void releaseAllInCurrentThread()
Tells the runtime to release all objects used in the current thread since the last 'trackObjectsInCurrentThread' call.


trackObjectsInCurrentThread

public static void trackObjectsInCurrentThread()
Tells the runtime to remember all objects used in the current thread.