## org.eclipse.datatools.sqltools.debugger.core
Interface IDebugHandler

    public interface IDebugHandler

To handle all debug related issues. For example, it is responsible for notifying the `IThread` that some connection events occur. Also, it is responsible for updating the client connections for the External Clients View. Will hold one instance of this class for each profile.

Author:
  Idull

Method Summary
`void` `addConnectionObserver(int connectionId, IConnectionObserver connectionObserver)` Adds a connection observer, which will be notified when connection events occur for the corresponding connection
`int` `convertToInternalConnId(java.lang.String externalId, java.lang.String exteranlName)` As the connection id used inside IControlConnection may be different from those external ids.
`void` `dispose()` Disposes the related resources
`ClientConInfo[]` `getClientConInfos()` Returns the client connections info.
`int` `getNumOfDebugProcess()` Returns the number of debug process which is currently active.
`java.lang.String` `getProfileName()` Returns the profile name
`int[]` `getValidBreakpointLocations(org.eclipse.datatools.sqltools.core.ProcIdentifier proc, int[] lineNumbers, org.eclipse.datatools.sqltools.core.IControlConnection controlConnection)` Given the ProcIdentifier and the line numbers, find out the valid line numbers that is greater than number that can set breakpoint.
`boolean` `hasDebuggee()` Checks whether there is registered debuggee.
`void` `init()` Initialize this debug handler, should be called soon after the instance is constructed
`boolean` `isAttached(int connid)` Tests whether the specified connection is attached by debugger
`boolean` `isClientConnectionProvider()` Checks if this instance is external clients view's content provider or not
`java.lang.String` `readyToDebug()` Checks if can debug now
`void` `refreshExternalClients()` Refreshes the client connections immediately
`void` `removeConnectionObserver(int connectionId)` Removes the connection observer for the given connection id
`void` `requestDetach(int connId)` Requests to stop debugging on the specified connection
`void` `setProfileName(java.lang.String profileName)` Set the profile name

Method Detail

### init

    void init()

  Initialize this debug handler, should be called soon after the instance is constructed

### addConnectionObserver

    void addConnectionObserver(int connectionId,
                               IConnectionObserver connectionObserver)

  Adds a connection observer, which will be notified when connection events occur for the corresponding connection

  Parameters:
    `connectionId` - the id of the connection
    `connectionObserver` - when the connection event occurs on the given connectionId, this observer will be notified

### removeConnectionObserver

    void removeConnectionObserver(int connectionId)

  Removes the connection observer for the given connection id

  Parameters:
    `connectionId` - the given connection id

### getClientConInfos

    ClientConInfo[] getClientConInfos()

  Returns the client connections info. of this debug handler (In fact, this client connections info. are identical for the same server)

  Returns:

### refreshExternalClients

    void refreshExternalClients()

  Refreshes the client connections immediately

### dispose

    void dispose()

  Disposes the related resources

### readyToDebug

    java.lang.String readyToDebug()

  Checks if can debug now

  Returns:

### isAttached

    boolean isAttached(int connid)

  Tests whether the specified connection is attached by debugger

  Parameters:
    `connid` -
  Returns:

### requestDetach

    void requestDetach(int connId)

  Requests to stop debugging on the specified connection

  Parameters:
    `connId` -

### hasDebuggee

    boolean hasDebuggee()

  Checks whether there is registered debuggee.

  Returns:

### isClientConnectionProvider

    boolean isClientConnectionProvider()

  Checks if this instance is external clients view's content provider or not

  Returns:

### getProfileName

    java.lang.String getProfileName()

  Returns the profile name

  Returns:

### convertToInternalConnId

    int convertToInternalConnId(java.lang.String externalId,
                                java.lang.String exteranlName)
                                throws org.eclipse.datatools.sqltools.core.ConnectionException

  As the connection id used inside IControlConnection may be different from those external ids. So sometimes when people have external id and exteranl name, they need to convert to internal id first. For vendors that don't care about it, just return the externalId is fine.

  Parameters:
    `externalId` - external connection id
    `exteranlName` - optional connection name
  Throws:
    `org.eclipse.datatools.sqltools.core.ConnectionException`

### getValidBreakpointLocations

    int[] getValidBreakpointLocations(org.eclipse.datatools.sqltools.core.ProcIdentifier proc,
                                      int[] lineNumbers,
                                      org.eclipse.datatools.sqltools.core.IControlConnection controlConnection)
                                      throws java.sql.SQLException

  Given the ProcIdentifier and the line numbers, find out the valid line numbers that is greater than number that can set breakpoint. if for some reason, this operation is not supported, the original number will be returned.

  Parameters:
    `proc` -
    `lineNumbers` -
  Returns:
    if the returning line number is -1, means can't find a valid location.
  Throws:
    `java.sql.SQLException`

### getNumOfDebugProcess

    int getNumOfDebugProcess()

  Returns the number of debug process which is currently active.

  Returns:

### setProfileName

    void setProfileName(java.lang.String profileName)

  Set the profile name