org.netbeans.api.debugger

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » ant » org.netbeans.api.debugger 
org.netbeans.api.debugger
package The NetBeans Debugger Core API definition. Debugger Core API interfaces allows to install differrent debugger inlementations to one IDE, and share some UI components among them.

Basic debugger model

Debugger Core API represents debugger as some tree structure. {@link org.netbeans.api.debugger.DebuggerManager} represents root of this tree. It manages list of {@link org.netbeans.api.debugger.Breakpoint}s, {@link org.netbeans.api.debugger.Watch}es and running {@link org.netbeans.api.debugger.Session}s. All watches and breakpoints registerred here are shared for all running sessions.

{@link org.netbeans.api.debugger.Session} represents one process or application running in debug mode. Each Session manages list of supported programming languages. Support for each programming language is represented by some instance of {@link org.netbeans.api.debugger.DebuggerEngine}. DebuggerEngine is a main intergation point for all Debugger Plug-ins. Most of Service Providers (like {@link org.netbeans.spi.debugger.ActionsProvider} or different Models) should be registered for some concrete type of DebuggerEngine.

{@link org.netbeans.api.debugger.DebuggerManager}
|
|- {@link org.netbeans.api.debugger.Breakpoint}(s)
|
|- {@link org.netbeans.api.debugger.Watch}(es)
|
|- {@link org.netbeans.api.debugger.Session}(s) <programming language 1 -> {@link org.netbeans.api.debugger.DebuggerEngine} 1>
<programming language 2 -> {@link org.netbeans.api.debugger.DebuggerEngine} 2>
...


One DebuggerEngine can manage more than one language. And it can be used for more than one Session. In extreme example, there may be one DebuggerManager only for several different sessions and for many different languages.

The only way how to add some language, session or engine to this tree is method {@link org.netbeans.api.debugger.DebuggerManager#startDebugging(DebuggerInfo)}. The only method how to remove something is {@link org.netbeans.api.debugger.DebuggerEngine.Destructor}.

Exension of basic model - lookups, Meta-inf/debugger

Basic debugger model is very simple, and it should be extended by some additional services (see Debugger SPI documentation for default set of additional services). As the Debugger API interfaces should be (and are) final, we use lookup pattern for this purpose.

List of 'extensible' interfaces:
  • {@link org.netbeans.api.debugger.DebuggerManager}: methods {@link org.netbeans.api.debugger.DebuggerManager#lookup(String,Class)} and {@link org.netbeans.api.debugger.DebuggerManager#lookupFirst(String,Class)}
  • {@link org.netbeans.api.debugger.DebuggerInfo}: methods {@link org.netbeans.api.debugger.DebuggerInfo#lookup(String,Class)} and {@link org.netbeans.api.debugger.DebuggerInfo#lookupFirst(String,Class)}
  • {@link org.netbeans.api.debugger.Session}: methods {@link org.netbeans.api.debugger.Session#lookup(String,Class)} and {@link org.netbeans.api.debugger.Session#lookupFirst(String,Class)}
  • {@link org.netbeans.api.debugger.DebuggerEngine}: methods {@link org.netbeans.api.debugger.DebuggerEngine#lookup(String,Class)}, {@link org.netbeans.api.debugger.DebuggerEngine#lookupFirst(String,Class)}, {@link org.netbeans.api.debugger.DebuggerManager#lookup(String,Class)} and {@link org.netbeans.api.debugger.DebuggerManager#lookupFirst(String,Class)}
There are two ways how to registrer services. The first possibility is to put 'live' instance of some service to the interface when a new instance is created. This solution is supported by methods: {@link org.netbeans.api.debugger.DebuggerInfo#create(String,Object[])}, {@link org.netbeans.spi.debugger.SessionProvider#getServices()} and {@link org.netbeans.spi.debugger.DebuggerEngineProvider#getServices()}. Second possibility (and preferred one) is to register service to Meta-inf/debugger folder. The way how to do it is described in Debugger SPI documentation.

Debugger Start Process

The process which implements starting of debugger in Debugger Core module is very simple. There is one instance of {@link org.netbeans.api.debugger.DebuggerInfo} and {@link org.netbeans.api.debugger.DebuggerManager#startDebugging(DebuggerInfo)} method on the begining of this process. DebuggerInfo determines a set of debugger Sessions to be started:

List sessionProviders = debuggerInfo.lookup (null, SessionsProvider.class);

A new instance of {@link org.netbeans.api.debugger.Session} is created for every {@link org.netbeans.spi.debugger.SessionProvider} after that. A set of DebuggerEngines is created for each Session in the second step:

List engineProviders = session.lookup (null, DebuggerEngineProvider.class);

Each {@link org.netbeans.spi.debugger.DebuggerEngineProvider} drives creation of one new instance of {@link org.netbeans.api.debugger.DebuggerEngine}. So, the debugger start process creates a tree of new Sessions and new DebuggerEngines and registers them to the DebuggerManager. Thats all.

Debugger Start Process - advanced version

Debugger API supports two enhancements to the standard debugger start process:
  1. Start new DebuggerEngine for already existing Session
  2. Create a new Session for already existing DebuggerEngine.
{@link org.netbeans.spi.debugger.DelegatingSessionProvider} interface is designed to support first usecase. You should implement and register this interface in Meta-inf/debugger, to delegate on some existing Session.
Second usecase is supported by interface {@link org.netbeans.spi.debugger.DelegatingDebuggerEngineProvider}.

Debugger Actions - how does it work

debuggercore-ui module installs some basic set of standard debugger actions to NetBeans toolbar and menu. Debugger actions (javax.swing.Action) are private. Each action is represented by some constant in {@link org.netbeans.api.debugger.ActionsManager} (like {@link org.netbeans.api.debugger.ActionsManager#ACTION_STEP_INTO}).
ActionsManager manages list of registered {@link org.netbeans.spi.debugger.ActionProvider}s. It contains mapping between action constant and ActionProvider registerred for this constant. For example:

instance of DebuggerEngine which represents JPDA debugger contains mapping:
ActionsManager.ACTION_STEP_INTO --> JPDAStepIntoActionProvider

How to implement and register some debugger action:
public class JPDAStepIntoAction extends ActionsProviderSupport {

    JPDAStepIntoAction () {
        jpdaDebugger.add...Listener (
new Listener () {
public ...event () {
// set state of action here
setEnabled ( state );
}
}
);
    }
public boolean doAction (Object action) {
// put implementation of action here
return true; // action successful
}
}
And JPDAStepIntoAction should be registerred in file:
META-INF/debugger/{DebuggerEngineTypeID}/org.netbeans.spi.debugger.ActionsProvider

Following two diagrams will show how the action system works:

Diagram 1 - what happens when user press Step Into Action:
  1. StepIntoAction calls {@link org.netbeans.api.debugger.ActionsManager#doAction(Object)} for {@link org.netbeans.api.debugger.ActionsManager#ACTION_STEP_INTO}, when its invoked by the user.
  2. {@link org.netbeans.api.debugger.ActionsManager} finds proper {@link org.netbeans.spi.debugger.ActionsProvider} registered for given action. Than it calls {@link org.netbeans.spi.debugger.ActionsProvider#doAction(Object)}.
  3. {@link org.netbeans.api.debugger.ActionsManager} notifies all {@link org.netbeans.api.debugger.ActionsManagerListener}s about it, when the action is done.
 user            StepIntoAction                                 DebuggerEngine                       StepIntoActionProvider                   DebuggerEngineListener
(javax.swing.Action) | (ActionsProvider) |
| | | |
o press -> actionPerformed (...) | | |
_|_ action calls | | |
| button currentDebuggerEngine. --> doAction (ACTION_STEP_INTO) | |
/ \ doAction | | |
(ACTION_STEP_INTO) finds ActionsProviders | |
| registerred for given action --> doAction (ACTION_STEP_INTO) |
| and calls doAction on them implementation of |
| | Step Into Action is here |
| | <-- | |
| fires PROP_ACTION_PERFORMED | |
| | --> -|-> actionPerformed (..)
| | | listener impl.
| <-- <-|- <-|- <--|
| | | |

Diagram 2 - what happens when the state of Step Into Action is changed:
  1. Debugger implementation should recognize that the state of Step Into action should be changed, and it should notify StepIntoActionProvider about it.
  2. StepIntoActionProvider should fire {@link org.netbeans.spi.debugger.ActionsProviderListener#actionStateChange(Object,boolean)} for {@link org.netbeans.api.debugger.ActionsManager#ACTION_STEP_INTO}.
  3. {@link org.netbeans.api.debugger.DebuggerEngine} is listenning on all installed {@link org.netbeans.spi.debugger.ActionsProvider}s and fires all action state changes using {@link org.netbeans.api.debugger.DebuggerEngineListener#actionStateChanged(Object,boolean)}.
  4. StepIntoAction listens on {@link org.netbeans.api.debugger.DebuggerEngine}, and it updates its state when some actionStateChanged is fired.
      debugger    StepIntoActionProvider          DebuggerEngine.ActionsProviderListener                StepIntoAction.DebuggerEngineListener
(ActionsProvider) | (javax.swing.Action)
| | |
_ state of -> fire action state | |
|?| action change --> actionStateChange (ACTION_STEP_INTO, enabled) |
¯ should be | | |
changed | fire DebuggerEngineListener |
| actionStateChanged --> actionStateChanged
| | updates a state
| | of action
|<-- <-|- <-- |

Java Source File NameTypeComment
ActionsManager.javaClass Manages some set of actions.
ActionsManagerAdapter.javaClass Empty implementation of ActionsManagerListener .
ActionsManagerListener.javaInterface This listener notifies about changes in the org.netbeans.api.debugger.DebuggerEngine .
Breakpoint.javaClass Abstract definition of breakpoint.
DebuggerEngine.javaClass Debugger Engine represents implementation of one debugger (Java Debugger, CPP Debugger).
DebuggerInfo.javaClass Contains information needed to start new debugging.
DebuggerManager.javaClass The root class of Debugger APIs.
DebuggerManagerAdapter.javaClass Empty implementation of DebuggerManagerListener .
DebuggerManagerListener.javaInterface This listener notifies about changes in the org.netbeans.api.debugger.DebuggerManager - breakpoints, watches and sessions.
LazyActionsManagerListener.javaClass This ActionsManagerListener modification is designed to be registerred in "META-INF/debugger/". LazyActionsManagerListener should be registerred for some concrete DebuggerEngine (use "META-INF/debugger//LazyActionsManagerListener"), or for global ActionsManager (use "META-INF/debugger/LazyActionsManagerListener"). New instance of LazyActionsManagerListener implementation is loaded when the new instance of ActionsManager is created, and its registerred automatically to all properties returned by LazyActionsManagerListener.getProperties .
LazyDebuggerManagerListener.javaInterface This DebuggerManagerListener modification is designed to be registered in "META-INF/debugger/org.netbeans.api.debugger.LazyDebuggerManagerListener".
Lookup.javaClass Lookup implementation, which provides services in a list.
Properties.javaClass Utility class hepls store properties.
Session.javaClass Session visually represents one process or application.
Watch.javaClass Abstract definition of watch.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.