Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.netbeans.api.debugger/1 1.7.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.netbeans.api.debugger
Class Session

    java.lang.Object
      org.netbeans.api.debugger.Session

    public final class Session

extends Object

Session visually represents one process or application. It should be simple bean with properties like process ID, session name, etc. All other functionality is deleagted to current debugger engine.

Description
Functionality | Properties: Session has two standard read only properties - name (`getName()`) and location name (`getLocationName()`). Management of languages and engines: Debugger Core supports debugging in different languages. It means that each session can be debugged using different languages and `DebuggerEngine`s. Session manages list of supported languages (`getSupportedLanguages()`) and current language (`getCurrentLanguage()`). Current language can be changed (`setCurrentLanguage(java.lang.String)`). Each language corresponds to one `DebuggerEngine` (`getEngineForLanguage(java.lang.String)`). So, the current language defines current debuggger engine (`getCurrentEngine()`) A support for a new debugger language can be added during a start of debugging only. See `DebuggerManager.startDebugging(org.netbeans.api.debugger.DebuggerInfo)` and `DebuggerEngineProvider` Support for aditional services: Session is final class. The standard method how to extend its functionality is using lookup methods (`lookup` and `lookupFirst(java.lang.String, java.lang.Class)`). There are two ways how to register some service provider for some type of Session: Register 'live' instance of service provider during creation of new instance of Session (see method `SessionProvider.getServices()`). Register service provider in Manifest-inf/debugger/<type ID> folder. See Debugger SPI for more information about registration. Support for listening: Session propagates all changes to `PropertyChangeListener`.
Clinents / Providers | This class is final, so it does not have any external provider. Debugger Core and UI modules are clients of this class.
Lifecycle | A new instance of Session class can be created and registerred to `DebuggerManager` during the process of starting of debugging (see `DebuggerManager.startDebugging(org.netbeans.api.debugger.DebuggerInfo)`). Session is removed automatically from `DebuggerManager` when the number of "supported languages" (`getSupportedLanguages()`) is zero.
Evolution | No method should be removed from this class, but some functionality can be added in future.

Field Summary
`static String` | `PROP_CURRENT_LANGUAGE` Name of property for current language.
`static String` | `PROP_SUPPORTED_LANGUAGES` Name of property for the set of supported languages.

Method Summary
`void` | `addPropertyChangeListener(PropertyChangeListener l)` Adds a property change listener.
`void` | `addPropertyChangeListener(String propertyName, PropertyChangeListener l)` Adds a property change listener.
`DebuggerEngine` | `getCurrentEngine()` Returns current debugger engine for this session.
`String` | `getCurrentLanguage()` Returns current language for this session.
`DebuggerEngine` | `getEngineForLanguage(String language)` Return DebuggerEngine registerred for given language or null.
`String` | `getLocationName()` Returns name of location this session is running on.
`String` | `getName()` Returns display name of this session.
`String[]` | `getSupportedLanguages()` Returns set of all languages supported by this session.
`void` | `kill()` Kills all registerred engines / languages.
`List` | `lookup(String folder, Class service)` Returns list of services of given type from given folder.
`Object` | `lookupFirst(String folder, Class service)` Returns one service of given type from given folder.
`void` | `removePropertyChangeListener(PropertyChangeListener l)` Removes a property change listener.
`void` | `removePropertyChangeListener(String propertyName, PropertyChangeListener l)` Removes a property change listener.
`void` | `setCurrentLanguage(String language)` Sets current language for this session.
`String` | `toString()` Returns string representation of this session.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### PROP_CURRENT_LANGUAGE

    public static final String PROP_CURRENT_LANGUAGE

  Name of property for current language.

  See Also:
    Constant Field Values

### PROP_SUPPORTED_LANGUAGES

    public static final String PROP_SUPPORTED_LANGUAGES

  Name of property for the set of supported languages.

  See Also:
    Constant Field Values

Method Detail

### getName

    public String getName()

  Returns display name of this session.

  Returns:
    display name of this session

### getLocationName

    public String getLocationName()

  Returns name of location this session is running on.

  Returns:
    name of location this session is running on

### getCurrentEngine

    public DebuggerEngine getCurrentEngine()

  Returns current debugger engine for this session.

  Returns:
    current debugger engine for this session

### getCurrentLanguage

    public String getCurrentLanguage()

  Returns current language for this session.

  Returns:
    current language for this session

### getSupportedLanguages

    public String[] getSupportedLanguages()

  Returns set of all languages supported by this session.

  Returns:
    set of all languages supported by this session
  See Also:
    `DebuggerEngineProvider`

### lookup

    public List lookup(String folder,
                       Class service)

  Returns list of services of given type from given folder.

  Parameters:
    `service` - a type of service to look for
  Returns:
    list of services of given type

### lookupFirst

    public Object lookupFirst(String folder,
                              Class service)

  Returns one service of given type from given folder.

  Parameters:
    `service` - a type of service to look for
  Returns:
    ne service of given type

### kill

    public void kill()

  Kills all registerred engines / languages. This utility method calls

      doAction (DebuggerEngine.ACTION_KILL)

  method on all registerred DebuggerEngines.

### getEngineForLanguage

    public DebuggerEngine getEngineForLanguage(String language)

  Return DebuggerEngine registerred for given language or null.

  Returns:
    DebuggerEngine registerred for given language or null

### setCurrentLanguage

    public void setCurrentLanguage(String language)

  Sets current language for this session. Language should be refisterred for this session.

  Parameters:
    `language` - current language
  See Also:
    `DebuggerEngineProvider`

### toString

    public String toString()

  Returns string representation of this session.

  Overrides:
    `toString` in class `Object`
  Returns:
    string representation of this session

### addPropertyChangeListener

    public void addPropertyChangeListener(PropertyChangeListener l)

  Adds a property change listener.

  Parameters:
    `l` - the listener to add

### removePropertyChangeListener

    public void removePropertyChangeListener(PropertyChangeListener l)

  Removes a property change listener.

  Parameters:
    `l` - the listener to remove

### addPropertyChangeListener

    public void addPropertyChangeListener(String propertyName,
                                          PropertyChangeListener l)

  Adds a property change listener.

  Parameters:
    `propertyName` - a name of property to listen on
    `l` - the listener to add

### removePropertyChangeListener

    public void removePropertyChangeListener(String propertyName,
                                             PropertyChangeListener l)

  Removes a property change listener.

  Parameters:
    `propertyName` - a name of property to stop listening on
    `l` - the listener to remove

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.netbeans.api.debugger/1 1.7.22
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.