1 package com.explosion.datastream.exql.processes;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.sql.Connection;
23 import java.sql.DatabaseMetaData;
24 import java.util.Vector;
25
26 import com.explosion.datastream.exql.gui.EXQLBaseTool;
27 import com.explosion.datastream.exql.gui.ExqlTreeNode;
28 import com.explosion.expfmodules.rdbmsconn.dbom.utils.MetadataUtils;
29 import com.explosion.utilities.exception.ExceptionManagerFactory;
30 import com.explosion.utilities.process.StackableSimpleProcess;
31 import com.explosion.utilities.process.threads.Finishable;
32
33 /***
34 * @author Stephen Cowx
35 * Date created:@14-Feb-2003
36 */
37 public class RefreshTopNodesProcess extends StackableSimpleProcess
38 {
39 private Connection conn;
40 private ExqlTreeNode rootNode;
41 private EXQLBaseTool tool;
42
43 /***
44 * Constructor for RefreshTopNodesProcess.
45 */
46 public RefreshTopNodesProcess(Finishable finishable, Connection conn, ExqlTreeNode rootNode, EXQLBaseTool tool)
47 {
48 super(finishable,null);
49 this.conn = conn;
50 this.rootNode = rootNode;
51 this.tool= tool;
52 this.setIsUserProcess(true);
53 }
54
55 public void process()
56 {
57 try
58 {
59 Vector collectedNodes = new Vector();
60
61 if (isStopped()) return;
62
63 setStatusText("Obtaining database metadata");
64 setPercentComplete(10);
65
66 DatabaseMetaData dbmd = MetadataUtils.getDBMD(conn);
67
68 if (isStopped()) return;
69
70 setStatusText("Finding schemas");
71 setPercentComplete(60);
72 RefreshCatalogsAndSchemasProcess.refresh(conn,this,tool,rootNode);
73
74 if (isStopped()) return;
75
76 setPercentComplete(80);
77
78 setStatusText("Done");
79 this.setPercentComplete(100);
80 }
81 catch (Exception e)
82 {
83 ExceptionManagerFactory.getExceptionManager().manageException(e,null);
84 setStatusText("Process not completed successfully");
85 setPercentComplete(100);
86 }
87
88 }
89
90 public void log(String string)
91 {
92 tool.log(string);
93 }
94
95 public void log(Exception exception, String message)
96 {
97 tool.log(message + exception.getMessage());
98 }
99
100 }