KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > debugger > test > TestDebugger


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.api.debugger.test;
21
22 import org.netbeans.spi.debugger.ContextProvider;
23 import org.netbeans.spi.debugger.DebuggerEngineProvider;
24
25 import java.util.*;
26
27 /**
28  * A dummy debugger implementation.
29  *
30  * @author Maros Sandor
31  */

32 public class TestDebugger {
33
34     public static final String JavaDoc ENGINE_ID = "netbeans-TestSession/Basic";
35
36     public static final String JavaDoc SESSION_ID = "netbeans-TestSession";
37
38     private ContextProvider lookupProvider;
39     private TestEngineProvider testEngineProvider;
40
41     public TestDebugger(ContextProvider lookupProvider) {
42         this.lookupProvider = lookupProvider;
43         List l = lookupProvider.lookup(null, DebuggerEngineProvider.class);
44         int i, k = l.size ();
45         for (i = 0; i < k; i++) {
46             if (l.get (i) instanceof TestEngineProvider) testEngineProvider = (TestEngineProvider) l.get (i);
47         }
48         if (testEngineProvider == null) throw new IllegalArgumentException JavaDoc("TestEngineProvider have to be used to start TestDebugger!");
49     }
50
51     public void finish() {
52         testEngineProvider.getDestructor().killEngine();
53     }
54 }
55
Popular Tags