# com.bea.ide
Application.I Interface

public static interface Application.I
extends `IPreferencesSupport`, `IPropertySupport`

All Superinterfaces
  `IPreferencesSupport`, `IPropertySupport`

Enclosing class
  `Application`

## Method Summary

`public `Object`` | `addCookie`(`Object` key, `Object` cookie) Adds the cookie object to this object with the given key.
`public boolean` | `addPropertyChangeListener`(`String` sProperty, `PropertyChangeListener` pcl, `Object` oCurrentValue)
`public void` | `exit`() Starts application shutdown.
`public `String`` | `findLibrary`(`String` name) Finds a native code library given the name of the library.
`public `String`` | `findLibrary`(`String` name, `String` path) Finds a native code library given a name and path to the library.
`public void` | `fireChangeEvent`(`String` sEvent, `Object` oldValue, `Object` newValue) This method is used to fire application events.
`public void` | `fireEvent`(`String` sEvent, `Object` oValue) This method is used to fire application events.
`public `ClassLoader`` | `getClassLoader`() Get the class loader for the application.
`public `Object`` | `getCookie`(`Object` key) Returns the cookie object for the corresponding key.
`public `Object`` | `getService`(`Class` c) Obtain an instance of the service defined by the given class.
`public `String`` | `getVersion`() Returns the version string for the core ide.
`public boolean` | `isPrerelease`() Returns true if this is a prerelease version of Workshop, false otherwise.
`public `Class`` | `loadClass`(`String` sClassName) Load a class using the application class loader.
`public `IFile`` | `newFile`(`String` path) returns a file given a path relative to the workshop directory.
`public `Object`` | `newInstance`(`String` sClassName) Create a new instance of the specified class.
`public `Object`` | `removeCookie`(`Object` key) Remove an association between the specified key and its cookie.

Methods from interface `com.bea.ide.core.`IPreferencesSupport``
``getUserObject`, `setUserObject`, `systemNodeForPackage`, `systemRoot`, `userNodeForPackage`, `userRoot``

Methods from interface `com.bea.ide.core.`IPropertySupport``
``addPropertyChangeListener`, `addPropertyChangeListener`, `getProperty`, `removePropertyChangeListener`, `removePropertyChangeListener`, `setProperty``

## Method Detail

### addCookie(Object, Object) Method

    public Object addCookie(Object key,
                            Object cookie)

Adds the cookie object to this object with the given key. getCookie may be used to retrieve the cookie object by passing in the same key. Same is defined as Object.equals returning true.

#### Parameters

key
  Key value to associate the cookie with

cookie
  Object value to store and associate with the key

#### Returns

If key previously had some cookie associated with it, that value is returned otherwise null is returned. It is possible that the key was explicitly associated with the null object and this case cannot be distinguished from the case where the key had no previous association.

### addPropertyChangeListener(String, PropertyChangeListener, Object) Method

    public boolean addPropertyChangeListener(String sProperty,
                                             PropertyChangeListener pcl,
                                             Object oCurrentValue)

### exit() Method

    public void exit()

Starts application shutdown. This may be cancelled by the user. This method will only return if the user cancels the operation, otherwise the system will exit before this method returns.

### findLibrary(String) Method

    public String findLibrary(String name)

Finds a native code library given the name of the library. The library should live in the workshop install directory. This is can be used to call System.load()

#### Returns

Absolute path to library, or null if the library does not exist

### findLibrary(String, String) Method

    public String findLibrary(String name,
                              String path)

Finds a native code library given a name and path to the library. Path is relative the workshop install directory.

#### Returns

Absolute path to library, or null if the library does not exist

### fireChangeEvent(String, Object, Object) Method

    public void fireChangeEvent(String sEvent,
                                Object oldValue,
                                Object newValue)

This method is used to fire application events. See `Application.I.fireEvent(String, Object)``` for more information on application events. This method allows an oldValue to be passed in that will be set as the old value in the PropertyChangeEvent. To help avoid problems, a convention is used where events end in ".EVENT", properties end in ".PROP" and cookies end in ".KEY". Generally, this is not enforced, except in the application event code where the strings must end in ".EVENT"

#### Parameters

sEvent
  event string to identify the event. To prevent confusion this must end in .EVENT

oldValue
  object that will be set as the old value in the property change event that is fired

newValue
  object that will be set as the new value in the property change event that is fired

### fireEvent(String, Object) Method

    public void fireEvent(String sEvent,
                          Object oValue)

This method is used to fire application events. Application events work on a listener model just like properties. To add an application event listener, use the same property change listener addition/removal methods. The namespace is the same. Events don't store any state so they are always fired when this method is called (property change events only go out if the value of the property actually changes). The value passed in will be set as the new value in the property change event. The old value is always null for events fired by this method. To help avoid problems, a convention is used where events end in ".EVENT", properties end in ".PROP" and cookies end in ".KEY". Generally, this is not enforced, except in the application event code where the strings must end in ".EVENT"

#### Parameters

sEvent
  event string to identify the event. To prevent confusion this must end in .EVENT

oValue
  object that will be set as the new value in the property change event that is fired

Related Topics

``IPropertySupport.addPropertyChangeListener(String, PropertyChangeListener)``
``IPropertySupport.removePropertyChangeListener(String, PropertyChangeListener)``

### getClassLoader() Method

    public ClassLoader getClassLoader()

Get the class loader for the application. This class loader has all extension jars and directories added to it. It may be used to load classes or find resources.

#### Returns

The application ClassLoader instance.

Related Topics

``ClassLoader``

### getCookie(Object) Method

    public Object getCookie(Object key)

Returns the cookie object for the corresponding key. Associations are made using the addCookie method. Two keys that compare equal using Object.equals method will be considered the same key.

#### Parameters

key
  Key value to use for cookie lookup.

#### Returns

The cookie value associated with the key for this document or null if there is no association for key. It is possible that the key was explicitly associated with the null object and this case cannot be distinguished from the case where the key has no association.

### getService(Class) Method

    public Object getService(Class c)

Obtain an instance of the service defined by the given class. Typically, this is only used by the `get` method of the s

#### Parameters

c
  Class that represents the service being requested.

#### Returns

The instance of the service.

### getVersion() Method

    public String getVersion()

Returns the version string for the core ide.

### isPrerelease() Method

    public boolean isPrerelease()

Returns true if this is a prerelease version of Workshop, false otherwise. This can be used to add special debugging code. Prerelease mode is enabled with -Dprerelease=true on the command-line

### loadClass(String) Method

    public Class loadClass(String sClassName)
         throws ClassNotFoundException

Load a class using the application class loader.

#### Parameters

sClassName
  String name of the fully-qualified class

#### Returns

An instance of the Class object representing the class name

#### Exceptions

``ClassNotFoundException``

### newFile(String) Method

    public IFile newFile(String path)

returns a file given a path relative to the workshop directory. Can safely be called with absolute paths.

#### Parameters

path
  relative or absolute path

### newInstance(String) Method

    public Object newInstance(String sClassName)

Create a new instance of the specified class. This method uses the application class loader to instantiate the given class name, then invokes `Class.newInstance``` in order to create an object of that class.

#### Parameters

sClassName
  String name of the fully-qualified class

#### Returns

An instance of the desired class, or null if the class cannot be found

### removeCookie(Object) Method

    public Object removeCookie(Object key)

Remove an association between the specified key and its cookie. If the key had no association this method does nothing.

#### Returns

The cookie this key was previously associated with or null if there was no association. It is possible that the key was explicitly associated with the null object and this case cannot be distinguished from the case where the key had no previous association.