Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
aca043d9
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aca043d9
编写于
1月 06, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Debug API refactoring
Former-commit-id:
b101b82c
上级
f46a1ffa
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
424 addition
and
337 deletion
+424
-337
plugins/org.jkiss.dbeaver.debug.core/plugin.xml
plugins/org.jkiss.dbeaver.debug.core/plugin.xml
+1
-1
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGBaseController.java
...g.core/src/org/jkiss/dbeaver/debug/DBGBaseController.java
+17
-54
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGController.java
...debug.core/src/org/jkiss/dbeaver/debug/DBGController.java
+4
-6
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGControllerRegistry.java
...re/src/org/jkiss/dbeaver/debug/DBGControllerRegistry.java
+5
-3
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGException.java
....debug.core/src/org/jkiss/dbeaver/debug/DBGException.java
+9
-3
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGProcedureController.java
...e/src/org/jkiss/dbeaver/debug/DBGProcedureController.java
+0
-52
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGSessionManager.java
...g.core/src/org/jkiss/dbeaver/debug/DBGSessionManager.java
+4
-2
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/DatabaseLaunchDelegate.java
.../org/jkiss/dbeaver/debug/core/DatabaseLaunchDelegate.java
+8
-7
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/DebugControllerDescriptor.java
...g/jkiss/dbeaver/debug/core/DebugControllerDescriptor.java
+80
-0
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/DebugControllersRegistry.java
...rg/jkiss/dbeaver/debug/core/DebugControllersRegistry.java
+78
-0
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/DebugCore.java
...ebug.core/src/org/jkiss/dbeaver/debug/core/DebugCore.java
+14
-33
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/ProcedureLaunchDelegate.java
...org/jkiss/dbeaver/debug/core/ProcedureLaunchDelegate.java
+15
-21
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/DatabaseDebugTarget.java
...g/jkiss/dbeaver/debug/core/model/DatabaseDebugTarget.java
+11
-3
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/ProcedureDebugTarget.java
.../jkiss/dbeaver/debug/core/model/ProcedureDebugTarget.java
+4
-4
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/ProcedureThread.java
...c/org/jkiss/dbeaver/debug/core/model/ProcedureThread.java
+4
-4
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/internal/core/DebugCoreActivator.java
...jkiss/dbeaver/debug/internal/core/DebugCoreActivator.java
+0
-11
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/internal/core/ProcedureDebugControllerRegistry.java
...debug/internal/core/ProcedureDebugControllerRegistry.java
+0
-65
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/plugin.xml
...ns/org.jkiss.dbeaver.ext.postgresql.debug.core/plugin.xml
+3
-6
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/PostgreDebugController.java
...ext/postgresql/debug/internal/PostgreDebugController.java
+68
-0
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/PostgreDebugControllerRegistry.java
...gresql/debug/internal/PostgreDebugControllerRegistry.java
+31
-0
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/console/Debugger.java
...eaver/ext/postgresql/debug/internal/console/Debugger.java
+4
-2
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/impl/PostgreDebugBreakpoint.java
...ostgresql/debug/internal/impl/PostgreDebugBreakpoint.java
+2
-2
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/impl/PostgreDebugSession.java
...t/postgresql/debug/internal/impl/PostgreDebugSession.java
+32
-35
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/impl/PostgreDebugSessionManager.java
...resql/debug/internal/impl/PostgreDebugSessionManager.java
+30
-23
未找到文件。
plugins/org.jkiss.dbeaver.debug.core/plugin.xml
浏览文件 @
aca043d9
...
...
@@ -2,7 +2,7 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point
id=
"
procedureC
ontrollers"
name=
"%procedureControllers.name"
schema=
"schema/procedureControllers.exsd"
/>
<extension-point
id=
"
org.jkiss.dbeaver.debug.core.c
ontrollers"
name=
"%procedureControllers.name"
schema=
"schema/procedureControllers.exsd"
/>
<extension
id=
"databaseBreakpointMarker"
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGBaseController.java
浏览文件 @
aca043d9
...
...
@@ -17,98 +17,61 @@
*/
package
org.jkiss.dbeaver.debug
;
import
java.util.Map
;
import
org.eclipse.osgi.util.NLS
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.debug.internal.DebugMessages
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionPurpose
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.registry.DataSourceDescriptor
;
public
abstract
class
DBGBaseController
<
SID_TYPE
,
OID_TYPE
>
implements
DBGController
{
public
abstract
class
DBGBaseController
implements
DBGController
{
private
static
final
Log
log
=
Log
.
getLog
(
DBGBaseController
.
class
);
private
DataSourceDescriptor
dataSourceDescriptor
;
private
DBCExecutionContext
debugContext
;
private
DBCSession
debugSession
;
private
DBPDataSourceContainer
dataSourceContainer
;
public
DBGBaseController
()
{
public
DBGBaseController
(
DBPDataSourceContainer
dataSourceContainer
)
{
this
.
dataSourceContainer
=
dataSourceContainer
;
}
@Override
public
void
init
(
DataSourceDescriptor
dataSourceDescriptor
,
String
databaseName
,
Map
<
String
,
Object
>
attributes
)
{
this
.
dataSourceDescriptor
=
dataSourceDescriptor
;
public
DBPDataSourceContainer
getDataSourceContainer
()
{
return
dataSourceContainer
;
}
@Override
public
void
connect
(
DBRProgressMonitor
monitor
)
throws
DBGException
{
DBPDataSource
dataSource
=
dataSourceDescriptor
.
getDataSource
();
if
(!
dataSourceDescriptor
.
isConnected
())
{
try
{
// FIXME: AF: the contract of this call is not clear, we need
// some utility for this
dataSourceDescriptor
.
connect
(
monitor
,
true
,
true
);
}
catch
(
DBException
e
)
{
String
message
=
NLS
.
bind
(
DebugMessages
.
DatabaseDebugController_e_connecting_datasource
,
dataSourceDescriptor
);
log
.
error
(
message
,
e
);
throw
new
DBGException
(
message
,
e
);
}
public
DBGSession
connect
(
DBRProgressMonitor
monitor
)
throws
DBGException
{
DBPDataSource
dataSource
=
dataSourceContainer
.
getDataSource
();
if
(!
dataSourceContainer
.
isConnected
())
{
throw
new
DBGException
(
"Not connected to database"
);
}
try
{
this
.
debugContext
=
dataSource
.
openIsolatedContext
(
monitor
,
DebugMessages
.
DatabaseDebugController_debug_context_purpose
);
this
.
debugSession
=
debugContext
.
openSession
(
monitor
,
DBCExecutionPurpose
.
UTIL
,
DebugMessages
.
DatabaseDebugController_debug_session_name
);
afterSessionOpen
(
debugSession
);
return
createSession
(
monitor
,
dataSource
);
}
catch
(
DBException
e
)
{
String
message
=
NLS
.
bind
(
DebugMessages
.
DatabaseDebugController_e_opening_debug_context
,
dataSourceDescripto
r
);
dataSourceContaine
r
);
log
.
error
(
message
,
e
);
throw
new
DBGException
(
message
,
e
);
}
}
protected
void
afterSessionOpen
(
DBCSession
session
)
throws
DBGException
{
//do nothing by default
}
protected
void
beforeSessionClose
(
DBCSession
session
)
throws
DBGException
{
//do nothing by default
}
protected
abstract
DBGSession
createSession
(
DBRProgressMonitor
monitor
,
DBPDataSource
dataSource
)
throws
DBGException
;
@Override
public
void
resume
()
throws
DBGException
{
public
void
resume
(
DBRProgressMonitor
monitor
,
DBGSession
session
)
throws
DBGException
{
// TODO Auto-generated method stub
}
@Override
public
void
suspend
()
throws
DBGException
{
public
void
suspend
(
DBRProgressMonitor
monitor
,
DBGSession
session
)
throws
DBGException
{
// TODO Auto-generated method stub
}
@Override
public
void
terminate
()
throws
DBGException
{
beforeSessionClose
(
this
.
debugSession
);
if
(
this
.
debugSession
!=
null
)
{
this
.
debugSession
.
close
();
this
.
debugSession
=
null
;
}
public
void
terminate
(
DBRProgressMonitor
monitor
,
DBGSession
session
)
throws
DBGException
{
if
(
this
.
debugContext
!=
null
)
{
this
.
debugContext
.
close
();
this
.
debugContext
=
null
;
}
}
@Override
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGController.java
浏览文件 @
aca043d9
...
...
@@ -27,15 +27,13 @@ import org.jkiss.dbeaver.registry.DataSourceDescriptor;
*/
public
interface
DBGController
{
void
init
(
DataSourceDescriptor
dataSourceDescriptor
,
String
databaseName
,
Map
<
String
,
Object
>
attributes
)
;
DBGSession
connect
(
DBRProgressMonitor
monitor
)
throws
DBGException
;
void
connect
(
DBRProgressMonitor
monitor
)
throws
DBGException
;
void
resume
(
DBRProgressMonitor
monitor
,
DBGSession
session
)
throws
DBGException
;
void
resume
(
)
throws
DBGException
;
void
suspend
(
DBRProgressMonitor
monitor
,
DBGSession
session
)
throws
DBGException
;
void
suspend
()
throws
DBGException
;
void
terminate
()
throws
DBGException
;
void
terminate
(
DBRProgressMonitor
monitor
,
DBGSession
session
)
throws
DBGException
;
void
dispose
()
throws
DBGException
;
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGControllerRegistry.java
浏览文件 @
aca043d9
package
org.jkiss.dbeaver.debug
;
public
interface
DBGControllerRegistry
<
C
extends
DBGController
>
{
C
createController
(
String
dataTypeProviderId
);
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
public
interface
DBGControllerRegistry
{
DBGController
createController
(
DBPDataSourceContainer
dataSource
)
throws
DBGException
;
}
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGException.java
浏览文件 @
aca043d9
...
...
@@ -18,8 +18,11 @@
package
org.jkiss.dbeaver.debug
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
@SuppressWarnings
(
"serial"
)
public
class
DBGException
extends
Exception
{
public
class
DBGException
extends
DB
Exception
{
public
DBGException
(
String
message
,
Throwable
e
)
{
super
(
message
,
e
);
...
...
@@ -29,8 +32,11 @@ public class DBGException extends Exception {
super
(
message
);
}
public
DBGException
(
Throwable
e
)
{
super
(
e
);
public
DBGException
(
Throwable
cause
,
DBPDataSource
dataSourc
e
)
{
super
(
cause
,
dataSourc
e
);
}
public
DBGException
(
String
message
,
Throwable
cause
,
DBPDataSource
dataSource
)
{
super
(
message
,
cause
,
dataSource
);
}
}
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGProcedureController.java
已删除
100644 → 0
浏览文件 @
f46a1ffa
package
org.jkiss.dbeaver.debug
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
public
abstract
class
DBGProcedureController
<
SID_TYPE
,
OID_TYPE
>
extends
DBGBaseController
<
SID_TYPE
,
OID_TYPE
>
{
private
SID_TYPE
sessionId
;
private
DBGSessionManager
<
SID_TYPE
,
OID_TYPE
>
dbgSessionManager
;
private
DBGSession
<?
extends
DBGSessionInfo
<
SID_TYPE
>,
?
extends
DBGObject
<
OID_TYPE
>,
SID_TYPE
,
OID_TYPE
>
dbgSession
;
public
DBGProcedureController
()
{
super
();
}
@Override
protected
void
afterSessionOpen
(
DBCSession
session
)
throws
DBGException
{
super
.
afterSessionOpen
(
session
);
this
.
dbgSessionManager
=
initSessionManager
(
session
);
if
(
this
.
dbgSessionManager
==
null
)
{
throw
new
DBGException
(
"Failed to initialize Debug Session Manager"
);
}
this
.
dbgSession
=
createSession
(
session
,
dbgSessionManager
);
if
(
this
.
dbgSession
==
null
)
{
throw
new
DBGException
(
"Failed to initialize Debug Session"
);
}
setSessionId
(
dbgSession
.
getSessionId
());
}
protected
abstract
DBGSessionManager
<
SID_TYPE
,
OID_TYPE
>
initSessionManager
(
DBCSession
session
)
throws
DBGException
;
protected
abstract
DBGSession
<?
extends
DBGSessionInfo
<
SID_TYPE
>,
?
extends
DBGObject
<
OID_TYPE
>,
SID_TYPE
,
OID_TYPE
>
createSession
(
DBCSession
session
,
DBGSessionManager
<
SID_TYPE
,
OID_TYPE
>
sessionManager
)
throws
DBGException
;
@Override
protected
void
beforeSessionClose
(
DBCSession
session
)
throws
DBGException
{
if
(
this
.
dbgSessionManager
!=
null
)
{
this
.
dbgSessionManager
.
terminateSession
(
getSessionId
());
this
.
dbgSessionManager
.
dispose
();
}
this
.
dbgSessionManager
=
null
;
super
.
beforeSessionClose
(
session
);
}
public
SID_TYPE
getSessionId
()
{
return
sessionId
;
}
public
void
setSessionId
(
SID_TYPE
sessionId
)
{
this
.
sessionId
=
sessionId
;
}
}
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/DBGSessionManager.java
浏览文件 @
aca043d9
...
...
@@ -18,11 +18,13 @@
package
org.jkiss.dbeaver.debug
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
java.sql.Connection
;
import
java.util.List
;
public
interface
DBGSessionManager
<
SESSION_ID_TYPE
,
OBJECT_ID_TYPE
>
{
DBGSessionInfo
<
SESSION_ID_TYPE
>
getSessionInfo
(
Connection
connection
)
throws
DBGException
;
DBGSessionInfo
<
SESSION_ID_TYPE
>
getSessionInfo
(
DBCExecutionContext
connection
)
throws
DBGException
;
List
<?
extends
DBGSessionInfo
<
SESSION_ID_TYPE
>>
getSessions
()
throws
DBGException
;
...
...
@@ -32,7 +34,7 @@ public interface DBGSessionManager<SESSION_ID_TYPE, OBJECT_ID_TYPE> {
void
terminateSession
(
SESSION_ID_TYPE
id
);
DBGSession
<?
extends
DBGSessionInfo
<
SESSION_ID_TYPE
>,
?
extends
DBGObject
<
OBJECT_ID_TYPE
>,
SESSION_ID_TYPE
,
OBJECT_ID_TYPE
>
createDebugSession
(
Connection
connection
)
throws
DBGException
;
DBGSession
<?
extends
DBGSessionInfo
<
SESSION_ID_TYPE
>,
?
extends
DBGObject
<
OBJECT_ID_TYPE
>,
SESSION_ID_TYPE
,
OBJECT_ID_TYPE
>
createDebugSession
(
DBCExecutionContext
connection
)
throws
DBGException
;
boolean
isSessionExists
(
SESSION_ID_TYPE
id
);
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/DatabaseLaunchDelegate.java
浏览文件 @
aca043d9
...
...
@@ -30,11 +30,13 @@ import org.jkiss.dbeaver.debug.DBGController;
import
org.jkiss.dbeaver.debug.DBGException
;
import
org.jkiss.dbeaver.debug.core.model.DatabaseDebugTarget
;
import
org.jkiss.dbeaver.debug.core.model.DatabaseProcess
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.runtime.DefaultProgressMonitor
;
import
org.jkiss.dbeaver.registry.DataSourceDescriptor
;
import
org.jkiss.dbeaver.registry.DataSourceRegistry
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
public
abstract
class
DatabaseLaunchDelegate
<
C
extends
DBGController
>
extends
LaunchConfigurationDelegate
{
public
abstract
class
DatabaseLaunchDelegate
extends
LaunchConfigurationDelegate
{
@Override
public
void
launch
(
ILaunchConfiguration
configuration
,
String
mode
,
ILaunch
launch
,
IProgressMonitor
monitor
)
...
...
@@ -47,16 +49,15 @@ public abstract class DatabaseLaunchDelegate<C extends DBGController> extends La
}
String
databaseName
=
DebugCore
.
extractDatabaseName
(
configuration
);
Map
<
String
,
Object
>
attributes
=
extractAttributes
(
configuration
);
C
controller
=
createController
(
datasourceDescriptor
,
databaseName
,
attributes
);
DBGController
controller
=
createController
(
datasourceDescriptor
,
databaseName
,
attributes
);
DatabaseProcess
process
=
createProcess
(
launch
,
configuration
.
getName
());
DatabaseDebugTarget
<
C
>
target
=
createDebugTarget
(
launch
,
controller
,
process
);
DatabaseDebugTarget
<
DBGController
>
target
=
createDebugTarget
(
launch
,
controller
,
process
);
launch
.
addDebugTarget
(
target
);
DefaultProgressMonitor
progress
=
new
DefaultProgressMonitor
(
monitor
);
try
{
controller
.
connect
(
progress
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Unable to connect to {0}"
,
datasourceDescriptor
.
getName
());
throw
new
CoreException
(
DebugCore
.
newErrorStatus
(
message
));
throw
new
CoreException
(
GeneralUtils
.
makeExceptionStatus
(
"Error connecting debug controller"
,
e
));
}
}
...
...
@@ -65,10 +66,10 @@ public abstract class DatabaseLaunchDelegate<C extends DBGController> extends La
return
attributes
;
}
protected
abstract
C
createController
(
DataSourceDescriptor
datasourceDescripto
r
,
String
databaseName
,
Map
<
String
,
Object
>
attributes
)
throws
CoreException
;
protected
abstract
DBGController
createController
(
DBPDataSourceContainer
dataSourceContaine
r
,
String
databaseName
,
Map
<
String
,
Object
>
attributes
)
throws
CoreException
;
protected
abstract
DatabaseProcess
createProcess
(
ILaunch
launch
,
String
name
);
protected
abstract
DatabaseDebugTarget
<
C
>
createDebugTarget
(
ILaunch
launch
,
C
controller
,
DatabaseProcess
process
);
protected
abstract
DatabaseDebugTarget
<
DBGController
>
createDebugTarget
(
ILaunch
launch
,
DBGController
controller
,
DatabaseProcess
process
);
}
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/DebugControllerDescriptor.java
0 → 100644
浏览文件 @
aca043d9
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.debug.core
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.debug.DBGControllerRegistry
;
import
org.jkiss.dbeaver.model.DBPDataKind
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.impl.AbstractDescriptor
;
import
org.jkiss.dbeaver.model.struct.DBSDataType
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObjectEx
;
import
org.jkiss.dbeaver.registry.RegistryConstants
;
import
org.jkiss.dbeaver.registry.driver.DriverDescriptor
;
import
org.jkiss.dbeaver.ui.data.IValueManager
;
import
org.jkiss.utils.CommonUtils
;
/**
* ValueManagerDescriptor
*/
public
class
DebugControllerDescriptor
extends
AbstractDescriptor
{
private
static
final
Log
log
=
Log
.
getLog
(
DebugControllerDescriptor
.
class
);
public
static
final
String
EXTENSION_ID
=
"org.jkiss.dbeaver.debug.core.controllers"
;
//$NON-NLS-1$
public
static
final
String
TAG_CONTROLLER
=
"controller"
;
//$NON-NLS-1$
public
static
final
String
ATTR_DATASOURCE
=
"datasource"
;
//$NON-NLS-1$
private
String
dataSourceID
;
private
ObjectType
implType
;
private
DBGControllerRegistry
isntance
;
public
DebugControllerDescriptor
(
IConfigurationElement
config
)
{
super
(
config
);
this
.
dataSourceID
=
config
.
getAttribute
(
ATTR_DATASOURCE
);
this
.
implType
=
new
ObjectType
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_CLASS
));
}
public
String
getDataSourceID
()
{
return
dataSourceID
;
}
@NotNull
public
DBGControllerRegistry
getInstance
()
{
if
(
isntance
==
null
)
{
try
{
isntance
=
implType
.
createInstance
(
DBGControllerRegistry
.
class
);
}
catch
(
Exception
e
)
{
throw
new
IllegalStateException
(
"Can't instantiate debug controller '"
+
this
.
dataSourceID
+
"'"
,
e
);
//$NON-NLS-1$
}
}
return
isntance
;
}
@Override
public
String
toString
()
{
return
dataSourceID
;
}
}
\ No newline at end of file
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/DebugControllersRegistry.java
0 → 100644
浏览文件 @
aca043d9
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.debug.core
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.core.runtime.IExtensionRegistry
;
import
org.eclipse.core.runtime.Platform
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.debug.DBGControllerRegistry
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.data.DBDContent
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.ui.data.IStreamValueManager
;
import
org.jkiss.dbeaver.ui.data.IValueManager
;
import
org.jkiss.dbeaver.ui.data.managers.DefaultValueManager
;
import
org.jkiss.dbeaver.ui.data.registry.StreamValueManagerDescriptor
;
import
org.jkiss.dbeaver.ui.data.registry.ValueManagerDescriptor
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* EntityEditorsRegistry
*/
public
class
DebugControllersRegistry
{
private
static
DebugControllersRegistry
instance
=
null
;
public
synchronized
static
DebugControllersRegistry
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
DebugControllersRegistry
(
Platform
.
getExtensionRegistry
());
}
return
instance
;
}
private
List
<
DebugControllerDescriptor
>
controllers
=
new
ArrayList
<>();
private
DebugControllersRegistry
(
IExtensionRegistry
registry
)
{
// Load datasource providers from external plugins
IConfigurationElement
[]
extElements
=
registry
.
getConfigurationElementsFor
(
DebugControllerDescriptor
.
EXTENSION_ID
);
for
(
IConfigurationElement
ext
:
extElements
)
{
if
(
DebugControllerDescriptor
.
TAG_CONTROLLER
.
equals
(
ext
.
getName
()))
{
controllers
.
add
(
new
DebugControllerDescriptor
(
ext
));
}
}
}
@NotNull
public
DBGControllerRegistry
createControllerRegistry
(
@NotNull
DBPDataSourceContainer
dataSource
)
{
for
(
DebugControllerDescriptor
controllerDescriptor
:
controllers
)
{
if
(
controllerDescriptor
.
getDataSourceID
().
equals
(
dataSource
.
getDriver
().
getProviderId
()))
{
return
controllerDescriptor
.
getInstance
();
}
}
return
null
;
}
}
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/DebugCore.java
浏览文件 @
aca043d9
...
...
@@ -17,9 +17,6 @@
*/
package
org.jkiss.dbeaver.debug.core
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.eclipse.core.runtime.Adapters
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.core.runtime.IStatus
;
...
...
@@ -27,24 +24,21 @@ import org.eclipse.core.runtime.Status;
import
org.eclipse.debug.core.ILaunchConfiguration
;
import
org.eclipse.osgi.util.NLS
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.debug.DBGController
;
import
org.jkiss.dbeaver.debug.DBGControllerRegistry
;
import
org.jkiss.dbeaver.debug.DBG
ProcedureController
;
import
org.jkiss.dbeaver.debug.DBG
Exception
;
import
org.jkiss.dbeaver.debug.internal.core.DebugCoreActivator
;
import
org.jkiss.dbeaver.debug.internal.core.DebugCoreMessages
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.registry.DataSourceDescriptor
;
import
org.jkiss.dbeaver.registry.DataSourceProviderDescriptor
;
import
org.jkiss.dbeaver.registry.driver.DriverDescriptor
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
DebugCore
{
public
static
final
String
BUNDLE_SYMBOLIC_NAME
=
"org.jkiss.dbeaver.debug.core"
;
//$NON-NLS-1$
public
static
final
String
EP_PROCEDURE_CONTROLLERS_ID
=
"procedureControllers"
;
//$NON-NLS-1$
public
static
final
String
EP_PROCEDURE_CONTROLLERS_CONTROLLER
=
"controller"
;
//$NON-NLS-1$
public
static
final
String
EP_PROCEDURE_CONTROLLERS_CONTROLLER_PROVIDER_ID
=
"providerId"
;
//$NON-NLS-1$
public
static
final
String
EP_PROCEDURE_CONTROLLERS_CONTROLLER_CLASS
=
"class"
;
//$NON-NLS-1$
// FIXME: AF: revisit, looks like we can live without it
public
static
final
String
MODEL_IDENTIFIER_DATABASE
=
BUNDLE_SYMBOLIC_NAME
+
'.'
+
"database"
;
//$NON-NLS-1$
public
static
final
String
MODEL_IDENTIFIER_PROCEDURE
=
BUNDLE_SYMBOLIC_NAME
+
'.'
+
"procedure"
;
//$NON-NLS-1$
...
...
@@ -136,29 +130,16 @@ public class DebugCore {
return
newErrorStatus
(
message
,
null
);
}
public
static
String
extractProviderId
(
DataSourceDescriptor
datasourceDescriptor
)
{
if
(
datasourceDescriptor
==
null
)
{
return
null
;
}
DriverDescriptor
driverDescriptor
=
datasourceDescriptor
.
getDriver
();
if
(
driverDescriptor
==
null
)
{
return
null
;
}
DataSourceProviderDescriptor
providerDescriptor
=
driverDescriptor
.
getProviderDescriptor
();
if
(
providerDescriptor
==
null
)
{
return
null
;
}
return
providerDescriptor
.
getId
();
public
static
DBGControllerRegistry
getProcedureControllerRegistry
(
DBPDataSourceContainer
dataSourceContainer
)
{
return
DebugControllersRegistry
.
getInstance
().
createControllerRegistry
(
dataSourceContainer
);
}
public
static
DBGControllerRegistry
<
DBGProcedureController
>
getProcedureControllerRegistry
()
{
return
DebugCoreActivator
.
getDefault
().
getProcedureControllerRegistry
();
}
public
static
DBGProcedureController
findProcedureController
(
DataSourceDescriptor
datasourceDescriptor
)
{
String
providerId
=
extractProviderId
(
datasourceDescriptor
);
DBGControllerRegistry
<
DBGProcedureController
>
controllerRegistry
=
getProcedureControllerRegistry
();
return
controllerRegistry
.
createController
(
providerId
);
public
static
DBGController
findProcedureController
(
DBPDataSourceContainer
dataSourceContainer
)
throws
DBGException
{
DBGControllerRegistry
registry
=
getProcedureControllerRegistry
(
dataSourceContainer
);
if
(
registry
==
null
)
{
throw
new
DBGException
(
"Can't find registry for datasource '"
+
dataSourceContainer
.
getDriver
().
getProviderId
()
+
"'"
);
}
return
registry
.
createController
(
dataSourceContainer
);
}
}
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/ProcedureLaunchDelegate.java
浏览文件 @
aca043d9
...
...
@@ -17,33 +17,28 @@
*/
package
org.jkiss.dbeaver.debug.core
;
import
java.util.Map
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.debug.core.ILaunch
;
import
org.
eclipse.osgi.util.NLS
;
import
org.jkiss.dbeaver.debug.DBG
ProcedureController
;
import
org.
jkiss.dbeaver.debug.DBGController
;
import
org.jkiss.dbeaver.debug.DBG
Exception
;
import
org.jkiss.dbeaver.debug.core.model.DatabaseProcess
;
import
org.jkiss.dbeaver.debug.core.model.ProcedureDebugTarget
;
import
org.jkiss.dbeaver.registry.DataSourceDescriptor
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.utils.GeneralUtils
;
public
class
ProcedureLaunchDelegate
extends
DatabaseLaunchDelegate
<
DBGProcedureController
<?,?>>
{
import
java.util.Map
;
public
class
ProcedureLaunchDelegate
extends
DatabaseLaunchDelegate
{
@Override
protected
DBGProcedureController
<?,?>
createController
(
DataSourceDescriptor
datasourceDescriptor
,
String
databaseName
,
Map
<
String
,
Object
>
attributes
)
throws
CoreException
{
String
providerId
=
DebugCore
.
extractProviderId
(
datasourceDescriptor
);
if
(
providerId
==
null
)
{
String
message
=
NLS
.
bind
(
"Unable to setup procedure debug for {0}"
,
datasourceDescriptor
.
getName
());
throw
new
CoreException
(
DebugCore
.
newErrorStatus
(
message
));
}
DBGProcedureController
<?,?>
procedureController
=
DebugCore
.
findProcedureController
(
datasourceDescriptor
);
if
(
procedureController
==
null
)
{
String
message
=
NLS
.
bind
(
"Procedure debug is not supported for {0}"
,
datasourceDescriptor
.
getName
());
throw
new
CoreException
(
DebugCore
.
newErrorStatus
(
message
));
protected
DBGController
createController
(
DBPDataSourceContainer
dataSourceContainer
,
String
databaseName
,
Map
<
String
,
Object
>
attributes
)
throws
CoreException
{
try
{
return
DebugCore
.
findProcedureController
(
dataSourceContainer
);
}
catch
(
DBGException
e
)
{
throw
new
CoreException
(
GeneralUtils
.
makeExceptionStatus
(
e
));
}
procedureController
.
init
(
datasourceDescriptor
,
databaseName
,
attributes
);
return
procedureController
;
}
@Override
...
...
@@ -52,8 +47,7 @@ public class ProcedureLaunchDelegate extends DatabaseLaunchDelegate<DBGProcedure
}
@Override
protected
ProcedureDebugTarget
createDebugTarget
(
ILaunch
launch
,
DBGProcedureController
<?,?>
controller
,
DatabaseProcess
process
)
{
protected
ProcedureDebugTarget
createDebugTarget
(
ILaunch
launch
,
DBGController
controller
,
DatabaseProcess
process
)
{
return
new
ProcedureDebugTarget
(
launch
,
process
,
controller
);
}
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/DatabaseDebugTarget.java
浏览文件 @
aca043d9
...
...
@@ -32,7 +32,9 @@ import org.eclipse.debug.core.model.IThread;
import
org.eclipse.osgi.util.NLS
;
import
org.jkiss.dbeaver.debug.DBGController
;
import
org.jkiss.dbeaver.debug.DBGException
;
import
org.jkiss.dbeaver.debug.DBGSession
;
import
org.jkiss.dbeaver.debug.core.DebugCore
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
public
abstract
class
DatabaseDebugTarget
<
C
extends
DBGController
>
extends
DatabaseDebugElement
implements
IDatabaseDebugTarget
{
...
...
@@ -44,6 +46,8 @@ public abstract class DatabaseDebugTarget<C extends DBGController> extends Datab
private
final
DatabaseThread
thread
;
private
final
IThread
[]
threads
;
private
DBGSession
debugSession
;
private
String
name
;
private
boolean
suspended
=
false
;
...
...
@@ -146,7 +150,7 @@ public abstract class DatabaseDebugTarget<C extends DBGController> extends Datab
terminated
=
true
;
suspended
=
false
;
try
{
controller
.
terminate
();
controller
.
terminate
(
getProgressMonitor
(),
debugSession
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Error terminating {0}"
,
getName
());
IStatus
status
=
DebugCore
.
newErrorStatus
(
message
,
e
);
...
...
@@ -174,7 +178,7 @@ public abstract class DatabaseDebugTarget<C extends DBGController> extends Datab
public
void
resume
()
throws
DebugException
{
suspended
=
false
;
try
{
controller
.
resume
();
controller
.
resume
(
getProgressMonitor
(),
debugSession
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Error resuming {0}"
,
getName
());
IStatus
status
=
DebugCore
.
newErrorStatus
(
message
,
e
);
...
...
@@ -189,7 +193,7 @@ public abstract class DatabaseDebugTarget<C extends DBGController> extends Datab
@Override
public
void
suspend
()
throws
DebugException
{
try
{
controller
.
suspend
();
controller
.
suspend
(
getProgressMonitor
(),
debugSession
);
}
catch
(
DBGException
e
)
{
String
message
=
NLS
.
bind
(
"Error suspending {0}"
,
getName
());
IStatus
status
=
DebugCore
.
newErrorStatus
(
message
,
e
);
...
...
@@ -197,6 +201,10 @@ public abstract class DatabaseDebugTarget<C extends DBGController> extends Datab
}
}
private
VoidProgressMonitor
getProgressMonitor
()
{
return
new
VoidProgressMonitor
();
}
public
void
suspended
(
int
detail
)
{
suspended
=
true
;
thread
.
setStepping
(
false
);
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/ProcedureDebugTarget.java
浏览文件 @
aca043d9
...
...
@@ -21,18 +21,18 @@ import org.eclipse.core.runtime.CoreException;
import
org.eclipse.debug.core.ILaunch
;
import
org.eclipse.debug.core.ILaunchConfiguration
;
import
org.eclipse.debug.core.model.IProcess
;
import
org.jkiss.dbeaver.debug.DBG
Procedure
Controller
;
import
org.jkiss.dbeaver.debug.DBGController
;
import
org.jkiss.dbeaver.debug.core.DebugCore
;
import
org.jkiss.dbeaver.debug.internal.core.DebugCoreMessages
;
public
class
ProcedureDebugTarget
extends
DatabaseDebugTarget
<
DBG
ProcedureController
<?,?>
>
{
public
class
ProcedureDebugTarget
extends
DatabaseDebugTarget
<
DBG
Controller
>
{
public
ProcedureDebugTarget
(
ILaunch
launch
,
IProcess
process
,
DBG
ProcedureController
<?,?>
controller
)
{
public
ProcedureDebugTarget
(
ILaunch
launch
,
IProcess
process
,
DBG
Controller
controller
)
{
super
(
DebugCore
.
MODEL_IDENTIFIER_PROCEDURE
,
launch
,
process
,
controller
);
}
@Override
protected
DatabaseThread
newThread
(
DBG
ProcedureController
<?,?>
controller
)
{
protected
DatabaseThread
newThread
(
DBG
Controller
controller
)
{
return
new
ProcedureThread
(
this
,
controller
);
}
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/core/model/ProcedureThread.java
浏览文件 @
aca043d9
...
...
@@ -19,21 +19,21 @@ package org.jkiss.dbeaver.debug.core.model;
import
org.eclipse.debug.core.DebugException
;
import
org.eclipse.osgi.util.NLS
;
import
org.jkiss.dbeaver.debug.DBG
Procedure
Controller
;
import
org.jkiss.dbeaver.debug.DBGController
;
import
org.jkiss.dbeaver.debug.internal.core.DebugCoreMessages
;
public
class
ProcedureThread
extends
DatabaseThread
{
private
final
DBG
Procedure
Controller
controller
;
private
final
DBGController
controller
;
public
ProcedureThread
(
IDatabaseDebugTarget
target
,
DBG
Procedure
Controller
controller
)
{
public
ProcedureThread
(
IDatabaseDebugTarget
target
,
DBGController
controller
)
{
super
(
target
);
this
.
controller
=
controller
;
}
@Override
public
String
getName
()
throws
DebugException
{
String
name
=
NLS
.
bind
(
DebugCoreMessages
.
ProcedureThread_name
,
controller
.
get
SessionId
());
String
name
=
NLS
.
bind
(
DebugCoreMessages
.
ProcedureThread_name
,
controller
.
get
Class
().
getSimpleName
());
return
name
;
}
...
...
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/internal/core/DebugCoreActivator.java
浏览文件 @
aca043d9
...
...
@@ -8,8 +8,6 @@ public class DebugCoreActivator implements BundleActivator {
private
static
DebugCoreActivator
activator
;
private
static
BundleContext
bundleContext
;
private
ProcedureDebugControllerRegistry
procedureControllerRegistry
;
public
static
DebugCoreActivator
getDefault
()
{
return
activator
;
}
...
...
@@ -22,22 +20,13 @@ public class DebugCoreActivator implements BundleActivator {
public
void
start
(
BundleContext
context
)
throws
Exception
{
bundleContext
=
context
;
activator
=
this
;
procedureControllerRegistry
=
new
ProcedureDebugControllerRegistry
();
procedureControllerRegistry
.
init
();
}
@Override
public
void
stop
(
BundleContext
context
)
throws
Exception
{
procedureControllerRegistry
.
dispose
();
procedureControllerRegistry
=
null
;
activator
=
null
;
bundleContext
=
null
;
}
public
ProcedureDebugControllerRegistry
getProcedureControllerRegistry
()
{
return
procedureControllerRegistry
;
}
}
plugins/org.jkiss.dbeaver.debug.core/src/org/jkiss/dbeaver/debug/internal/core/ProcedureDebugControllerRegistry.java
已删除
100644 → 0
浏览文件 @
f46a1ffa
package
org.jkiss.dbeaver.debug.internal.core
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.core.runtime.IConfigurationElement
;
import
org.eclipse.core.runtime.IExtensionPoint
;
import
org.eclipse.core.runtime.IExtensionRegistry
;
import
org.eclipse.core.runtime.RegistryFactory
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.debug.DBGControllerRegistry
;
import
org.jkiss.dbeaver.debug.DBGProcedureController
;
import
org.jkiss.dbeaver.debug.core.DebugCore
;
public
class
ProcedureDebugControllerRegistry
implements
DBGControllerRegistry
<
DBGProcedureController
>
{
private
static
Log
log
=
Log
.
getLog
(
ProcedureDebugControllerRegistry
.
class
);
private
final
Map
<
String
,
IConfigurationElement
>
factories
=
new
HashMap
<>();
@Override
public
DBGProcedureController
createController
(
String
dataTypeProviderId
)
{
if
(
dataTypeProviderId
==
null
)
{
return
null
;
}
IConfigurationElement
element
=
factories
.
get
(
dataTypeProviderId
);
if
(
element
==
null
)
{
return
null
;
}
try
{
Object
executable
=
element
.
createExecutableExtension
(
DebugCore
.
EP_PROCEDURE_CONTROLLERS_CONTROLLER_CLASS
);
if
(
executable
instanceof
DBGProcedureController
)
{
DBGProcedureController
controller
=
(
DBGProcedureController
)
executable
;
return
controller
;
}
}
catch
(
CoreException
e
)
{
Log
.
log
(
log
,
e
.
getStatus
());
}
return
null
;
}
public
void
init
()
{
IExtensionRegistry
registry
=
RegistryFactory
.
getRegistry
();
final
String
namespace
=
DebugCore
.
BUNDLE_SYMBOLIC_NAME
;
final
String
epName
=
DebugCore
.
EP_PROCEDURE_CONTROLLERS_ID
;
final
String
elementName
=
DebugCore
.
EP_PROCEDURE_CONTROLLERS_CONTROLLER
;
final
String
identifierName
=
DebugCore
.
EP_PROCEDURE_CONTROLLERS_CONTROLLER_PROVIDER_ID
;
IExtensionPoint
extensionPoint
=
registry
.
getExtensionPoint
(
namespace
,
epName
);
IConfigurationElement
[]
configurationElements
=
extensionPoint
.
getConfigurationElements
();
for
(
IConfigurationElement
element
:
configurationElements
)
{
String
name
=
element
.
getName
();
if
(
elementName
.
equals
(
name
))
{
String
configuredIdentifier
=
element
.
getAttribute
(
identifierName
);
factories
.
put
(
configuredIdentifier
,
element
);
}
}
}
public
void
dispose
()
{
factories
.
clear
();
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/plugin.xml
浏览文件 @
aca043d9
...
...
@@ -30,12 +30,9 @@
name=
"%launchConfigurationTypes.launchConfigurationType.pgSQL.name"
>
</launchConfigurationType>
</extension>
<extension
point=
"org.jkiss.dbeaver.debug.core.procedureControllers"
>
<controller
class=
"org.jkiss.dbeaver.ext.postgresql.debug.internal.PostgreProcedureController"
providerId=
"postgresql"
>
</controller>
<extension
point=
"org.jkiss.dbeaver.debug.core.controllers"
>
<controller
datasource=
"postgresql"
class=
"org.jkiss.dbeaver.ext.postgresql.debug.internal.PostgreDebugControllerRegistry"
/>
</extension>
</plugin>
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/Postgre
Procedure
Controller.java
→
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/Postgre
Debug
Controller.java
浏览文件 @
aca043d9
...
...
@@ -17,56 +17,52 @@
*/
package
org.jkiss.dbeaver.ext.postgresql.debug.internal
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.debug.DBGBaseController
;
import
org.jkiss.dbeaver.debug.DBGException
;
import
org.jkiss.dbeaver.debug.DBGObject
;
import
org.jkiss.dbeaver.debug.DBGProcedureController
;
import
org.jkiss.dbeaver.debug.DBGSession
;
import
org.jkiss.dbeaver.debug.DBGSessionInfo
;
import
org.jkiss.dbeaver.debug.DBGSessionManager
;
import
org.jkiss.dbeaver.ext.postgresql.debug.internal.impl.PostgreDebugSessionManager
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.model.DBPDataSource
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
public
class
PostgreDebugController
extends
DBGBaseController
{
public
class
PostgreProcedureController
extends
DBGProcedureController
<
Integer
,
Integer
>
{
private
PostgreDebugSessionManager
sessionManager
;
public
Postgre
ProcedureController
(
)
{
super
();
public
Postgre
DebugController
(
DBPDataSourceContainer
dataSourceDescriptor
)
{
super
(
dataSourceDescriptor
);
}
@Override
protected
DBGSessionManager
<
Integer
,
Integer
>
initSessionManager
(
DBCSession
session
)
throws
DBGException
{
if
(
session
instanceof
JDBCSession
)
{
JDBCSession
jdbcSession
=
(
JDBCSession
)
session
;
Connection
original
;
private
PostgreDebugSessionManager
getSessionManager
(
DBRProgressMonitor
monitor
)
throws
DBGException
{
if
(
sessionManager
==
null
)
{
try
{
original
=
jdbcSession
.
getOriginal
(
);
return
new
PostgreDebugSessionManager
(
original
);
}
catch
(
SQL
Exception
e
)
{
throw
new
DBGException
(
"
Unable to obtain connection"
);
JDBCExecutionContext
controllerContext
=
(
JDBCExecutionContext
)
getDataSourceContainer
().
getDataSource
().
openIsolatedContext
(
monitor
,
"Debug controller"
);
sessionManager
=
new
PostgreDebugSessionManager
(
controllerContext
);
}
catch
(
Exception
e
)
{
throw
new
DBGException
(
"
Can't initiate debug session manager"
,
e
);
}
}
throw
new
DBGException
(
"Invalid JDBC session handle"
)
;
return
sessionManager
;
}
@Override
protected
DBGSession
<?
extends
DBGSessionInfo
<
Integer
>,
?
extends
DBGObject
<
Integer
>,
Integer
,
Integer
>
createSession
(
DBCSession
session
,
DBGSessionManager
<
Integer
,
Integer
>
sessionManager
)
throws
DBGException
{
if
(
session
instanceof
JDBCSession
)
{
JDBCSession
jdbcSession
=
(
JDBCSession
)
session
;
Connection
original
;
try
{
original
=
jdbcSession
.
getOriginal
();
DBGSession
<?
extends
DBGSessionInfo
<
Integer
>,
?
extends
DBGObject
<
Integer
>,
Integer
,
Integer
>
created
=
sessionManager
.
createDebugSession
(
original
);
return
created
;
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
"Unable to obtain connection"
);
}
protected
DBGSession
createSession
(
DBRProgressMonitor
monitor
,
DBPDataSource
dataSource
)
throws
DBGException
{
PostgreDebugSessionManager
sessionManager
=
getSessionManager
(
monitor
);
try
{
JDBCExecutionContext
sessionContext
=
(
JDBCExecutionContext
)
getDataSourceContainer
().
getDataSource
().
openIsolatedContext
(
monitor
,
"Debug session"
);
return
this
.
sessionManager
.
createDebugSession
(
sessionContext
);
}
catch
(
DBException
e
)
{
throw
new
DBGException
(
"Can't initiate debug session"
,
e
);
}
throw
new
DBGException
(
"Invalid JDBC session handle"
);
}
@Override
public
void
dispose
()
{
if
(
sessionManager
!=
null
)
{
sessionManager
.
dispose
();
sessionManager
=
null
;
}
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/PostgreDebugControllerRegistry.java
0 → 100644
浏览文件 @
aca043d9
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
* Copyright (C) 2017 Alexander Fedorov (alexander.fedorov@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.ext.postgresql.debug.internal
;
import
org.jkiss.dbeaver.debug.DBGController
;
import
org.jkiss.dbeaver.debug.DBGControllerRegistry
;
import
org.jkiss.dbeaver.debug.DBGException
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
public
class
PostgreDebugControllerRegistry
implements
DBGControllerRegistry
{
@Override
public
DBGController
createController
(
DBPDataSourceContainer
dataSource
)
throws
DBGException
{
return
new
PostgreDebugController
(
dataSource
);
}
}
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/console/Debugger.java
浏览文件 @
aca043d9
...
...
@@ -287,7 +287,8 @@ public class Debugger {
return
;
}
pgDbgManager
=
new
PostgreDebugSessionManager
(
conn
);
// TODO: fix connection
pgDbgManager
=
new
PostgreDebugSessionManager
(
null
);
Scanner
sc
=
new
Scanner
(
System
.
in
);
Scanner
scArg
;
...
...
@@ -664,7 +665,8 @@ public class Debugger {
case
COMMAND_NEW:
try
{
Connection
debugConn
=
DriverManager
.
getConnection
(
url
);
PostgreDebugSession
s
=
pgDbgManager
.
createDebugSession
(
debugConn
);
// TODO: fix connection
PostgreDebugSession
s
=
pgDbgManager
.
createDebugSession
(
null
);
System
.
out
.
println
(
"created"
);
System
.
out
.
println
(
s
);
...
...
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/impl/PostgreDebugBreakpoint.java
浏览文件 @
aca043d9
...
...
@@ -54,7 +54,7 @@ public class PostgreDebugBreakpoint implements DBGBreakpoint {
:
String
.
valueOf
(
properties
.
getTargetId
())));
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQL error"
,
e
);
}
}
...
...
@@ -73,7 +73,7 @@ public class PostgreDebugBreakpoint implements DBGBreakpoint {
.
replaceAll
(
"\\?line"
,
properties
.
isOnStart
()
?
"-1"
:
String
.
valueOf
(
properties
.
getLineNo
())));
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQL error"
,
e
);
}
}
...
...
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/impl/PostgreDebugSession.java
浏览文件 @
aca043d9
...
...
@@ -18,26 +18,18 @@
package
org.jkiss.dbeaver.ext.postgresql.debug.internal.impl
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.jkiss.dbeaver.debug.*
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
import
java.sql.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.FutureTask
;
import
java.util.concurrent.locks.ReentrantReadWriteLock
;
import
org.eclipse.debug.core.DebugException
;
import
org.jkiss.dbeaver.debug.DBGBreakpoint
;
import
org.jkiss.dbeaver.debug.DBGBreakpointProperties
;
import
org.jkiss.dbeaver.debug.DBGException
;
import
org.jkiss.dbeaver.debug.DBGSession
;
import
org.jkiss.dbeaver.debug.DBGStackFrame
;
import
org.jkiss.dbeaver.debug.DBGVariable
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCStatement
;
@SuppressWarnings
(
"nls"
)
public
class
PostgreDebugSession
implements
DBGSession
<
PostgreDebugSessionInfo
,
PostgreDebugObject
,
Integer
,
Integer
>
{
...
...
@@ -45,7 +37,7 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
private
final
PostgreDebugSessionInfo
sessionDebugInfo
;
private
final
Connection
connection
;
private
final
JDBCExecutionContext
connection
;
private
final
String
title
;
...
...
@@ -83,13 +75,13 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
acquireWriteLock
();
try
(
Statement
stmt
=
connection
.
createStatement
())
{
try
(
Statement
stmt
=
getConnection
(
connection
)
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_LISTEN
);
if
(
rs
.
next
())
{
connection
.
setClientInfo
(
"ApplicationName"
,
"Debug Mode : "
+
String
.
valueOf
(
sessionId
));
getConnection
(
connection
)
.
setClientInfo
(
"ApplicationName"
,
"Debug Mode : "
+
String
.
valueOf
(
sessionId
));
return
rs
.
getInt
(
"sessionid"
);
}
else
{
...
...
@@ -99,7 +91,7 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
}
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQL error"
,
e
);
}
finally
{
lock
.
writeLock
().
unlock
();
}
...
...
@@ -129,7 +121,7 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
}
public
PostgreDebugSession
(
PostgreDebugSessionInfo
sessionManagerInfo
,
PostgreDebugSessionInfo
sessionDebugInfo
,
Connection
connection
)
throws
DBGException
{
JDBCExecutionContext
connection
)
throws
DBGException
{
this
.
sessionManagerInfo
=
sessionManagerInfo
;
this
.
sessionDebugInfo
=
sessionDebugInfo
;
this
.
connection
=
connection
;
...
...
@@ -137,6 +129,10 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
sessionId
=
listen
();
}
private
static
Connection
getConnection
(
DBCExecutionContext
connectionTarget
)
throws
SQLException
{
return
((
JDBCExecutionContext
)
connectionTarget
).
getConnection
(
new
VoidProgressMonitor
());
}
@Override
public
PostgreDebugSessionInfo
getSessionInfo
()
{
...
...
@@ -227,14 +223,14 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
acquireReadLock
();
try
(
Statement
stmt
=
connection
.
createStatement
())
{
try
(
Statement
stmt
=
getConnection
(
connection
)
.
createStatement
())
{
stmt
.
execute
(
SQL_ABORT
.
replaceAll
(
"\\?sessionid"
,
String
.
valueOf
(
sessionId
)));
task
=
null
;
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQL error"
,
e
);
}
finally
{
lock
.
readLock
().
unlock
();
}
...
...
@@ -257,10 +253,6 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
connection
.
close
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
finally
{
lock
.
writeLock
().
unlock
();
}
...
...
@@ -274,7 +266,7 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
List
<
DBGVariable
<?>>
vars
=
new
ArrayList
<>();
try
(
Statement
stmt
=
connection
.
createStatement
())
{
try
(
Statement
stmt
=
getConnection
(
connection
)
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_GET_VARS
.
replaceAll
(
"\\?sessionid"
,
String
.
valueOf
(
sessionId
)));
...
...
@@ -288,7 +280,7 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
}
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQL error"
,
e
);
}
finally
{
lock
.
readLock
().
unlock
();
}
...
...
@@ -302,7 +294,7 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
acquireReadLock
();
try
(
PreparedStatement
stmt
=
connection
.
prepareStatement
(
SQL_SET_VAR
))
{
try
(
PreparedStatement
stmt
=
getConnection
(
connection
)
.
prepareStatement
(
SQL_SET_VAR
))
{
if
(
variable
instanceof
PostgreDebugVariable
){
...
...
@@ -329,7 +321,7 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQL error"
,
e
);
}
finally
{
lock
.
readLock
().
unlock
();
}
...
...
@@ -342,7 +334,7 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
List
<
DBGStackFrame
>
stack
=
new
ArrayList
<
DBGStackFrame
>(
1
);
try
(
Statement
stmt
=
connection
.
createStatement
())
{
try
(
Statement
stmt
=
getConnection
(
connection
)
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_GET_STACK
.
replaceAll
(
"\\?sessionid"
,
String
.
valueOf
(
sessionId
)));
...
...
@@ -353,15 +345,19 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
}
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQL error"
,
e
);
}
finally
{
lock
.
readLock
().
unlock
();
}
return
stack
;
}
public
Connection
getConnection
()
{
return
connection
;
public
Connection
getConnection
()
throws
DBGException
{
try
{
return
getConnection
(
connection
);
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
"SQL error"
,
e
);
}
}
@Override
...
...
@@ -389,7 +385,7 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
try
{
task
.
get
();
}
catch
(
InterruptedException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQL error"
,
e
);
}
catch
(
ExecutionException
e
)
{
System
.
out
.
println
(
"WARNING "
+
e
.
getMessage
());
return
false
;
...
...
@@ -404,6 +400,7 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
private
void
runAsync
(
String
commandSQL
,
String
name
)
throws
DBGException
{
Connection
connection
=
getConnection
();
try
(
Statement
stmt
=
connection
.
createStatement
())
{
connection
.
setAutoCommit
(
false
);
...
...
@@ -419,7 +416,7 @@ public class PostgreDebugSession implements DBGSession<PostgreDebugSessionInfo,
workerThread
.
start
();
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQL error"
,
e
);
}
}
...
...
plugins/org.jkiss.dbeaver.ext.postgresql.debug.core/src/org/jkiss/dbeaver/ext/postgresql/debug/internal/impl/PostgreDebugSessionManager.java
浏览文件 @
aca043d9
...
...
@@ -30,49 +30,56 @@ import java.util.Map;
import
org.jkiss.dbeaver.debug.DBGException
;
import
org.jkiss.dbeaver.debug.DBGSession
;
import
org.jkiss.dbeaver.debug.DBGSessionManager
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext
;
import
org.jkiss.dbeaver.model.runtime.VoidProgressMonitor
;
@SuppressWarnings
(
"nls"
)
public
class
PostgreDebugSessionManager
implements
DBGSessionManager
<
Integer
,
Integer
>
{
private
final
Connection
connection
;
private
final
DBCExecutionContext
context
;
private
static
final
String
SQL_SESSION
=
"select pid,usename,application_name,state,query from pg_stat_activity"
;
private
static
final
String
SQL_OBJECT
=
"select p.oid,p.proname,u.usename as owner,n.nspname, l.lanname as lang "
+
" from "
+
" pg_catalog.pg_namespace n "
+
" join pg_catalog.pg_proc p on p.pronamespace = n.oid "
+
" join pg_user u on u.usesysid = p.proowner "
+
" join pg_language l on l.oid = p. prolang "
+
" where "
+
" l.lanname = 'plpgsql' "
+
" and p.proname like '%?nameCtx%' "
+
" and u.usename like '%?userCtx%' "
+
" order by "
+
" n.nspname,p.proname"
;
+
" from "
+
" pg_catalog.pg_namespace n "
+
" join pg_catalog.pg_proc p on p.pronamespace = n.oid "
+
" join pg_user u on u.usesysid = p.proowner "
+
" join pg_language l on l.oid = p. prolang "
+
" where "
+
" l.lanname = 'plpgsql' "
+
" and p.proname like '%?nameCtx%' "
+
" and u.usename like '%?userCtx%' "
+
" order by "
+
" n.nspname,p.proname"
;
private
static
final
String
SQL_CURRENT_SESSION
=
"select pid,usename,application_name,state,query from pg_stat_activity where pid = pg_backend_pid()"
;
private
final
Map
<
Integer
,
PostgreDebugSession
>
sessions
=
new
HashMap
<
Integer
,
PostgreDebugSession
>(
1
);
@Override
public
PostgreDebugSessionInfo
getSessionInfo
(
Connection
connectionTarget
)
throws
DBGException
{
try
(
Statement
stmt
=
connectionTarget
.
createStatement
())
{
public
PostgreDebugSessionInfo
getSessionInfo
(
DBCExecutionContext
connectionTarget
)
throws
DBGException
{
try
(
Statement
stmt
=
getConnection
(
connectionTarget
)
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_CURRENT_SESSION
);
if
(
rs
.
next
())
{
PostgreDebugSessionInfo
res
=
new
PostgreDebugSessionInfo
(
rs
.
getInt
(
"pid"
),
rs
.
getString
(
"usename"
),
rs
.
getString
(
"application_name"
),
rs
.
getString
(
"state"
),
rs
.
getString
(
"query"
));
rs
.
getString
(
"application_name"
),
rs
.
getString
(
"state"
),
rs
.
getString
(
"query"
));
return
res
;
}
throw
new
DBGException
(
"Error getting session"
);
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQ Lerror"
,
e
);
}
}
private
static
Connection
getConnection
(
DBCExecutionContext
connectionTarget
)
throws
SQLException
{
return
((
JDBCExecutionContext
)
connectionTarget
).
getConnection
(
new
VoidProgressMonitor
());
}
@Override
public
List
<
PostgreDebugSessionInfo
>
getSessions
()
throws
DBGException
{
try
(
Statement
stmt
=
connection
.
createStatement
())
{
try
(
Statement
stmt
=
getConnection
(
context
)
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_SESSION
);
...
...
@@ -81,61 +88,60 @@ public class PostgreDebugSessionManager implements DBGSessionManager<Integer, In
while
(
rs
.
next
())
{
res
.
add
(
new
PostgreDebugSessionInfo
(
rs
.
getInt
(
"pid"
),
rs
.
getString
(
"usename"
),
rs
.
getString
(
"application_name"
),
rs
.
getString
(
"state"
),
rs
.
getString
(
"query"
)));
rs
.
getString
(
"application_name"
),
rs
.
getString
(
"state"
),
rs
.
getString
(
"query"
)));
}
return
res
;
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQL error"
,
e
);
}
}
/**
* @param con
nection
* @param con
text
*/
public
PostgreDebugSessionManager
(
Connection
connection
)
{
public
PostgreDebugSessionManager
(
DBCExecutionContext
context
)
{
super
();
this
.
con
nection
=
connection
;
this
.
con
text
=
context
;
}
@Override
public
List
<
PostgreDebugObject
>
getObjects
(
String
ownerCtx
,
String
nameCtx
)
throws
DBGException
{
try
(
Statement
stmt
=
connection
.
createStatement
())
{
try
(
Statement
stmt
=
getConnection
(
context
)
.
createStatement
())
{
ResultSet
rs
=
stmt
.
executeQuery
(
SQL_OBJECT
.
replaceAll
(
"\\?nameCtx"
,
nameCtx
).
replaceAll
(
"\\?userCtx"
,
ownerCtx
).
toLowerCase
());
SQL_OBJECT
.
replaceAll
(
"\\?nameCtx"
,
nameCtx
).
replaceAll
(
"\\?userCtx"
,
ownerCtx
).
toLowerCase
());
List
<
PostgreDebugObject
>
res
=
new
ArrayList
<
PostgreDebugObject
>();
while
(
rs
.
next
())
{
res
.
add
(
new
PostgreDebugObject
(
rs
.
getInt
(
"oid"
),
rs
.
getString
(
"proname"
),
rs
.
getString
(
"owner"
),
rs
.
getString
(
"nspname"
),
rs
.
getString
(
"lang"
)));
rs
.
getString
(
"nspname"
),
rs
.
getString
(
"lang"
)));
}
return
res
;
}
catch
(
SQLException
e
)
{
throw
new
DBGException
(
e
);
throw
new
DBGException
(
"SQL error"
,
e
);
}
}
@Override
public
DBGSession
<
PostgreDebugSessionInfo
,
PostgreDebugObject
,
Integer
,
Integer
>
getDebugSession
(
Integer
id
)
throws
DBGException
{
throws
DBGException
{
return
sessions
.
get
(
id
);
}
@Override
public
PostgreDebugSession
createDebugSession
(
Connection
connectionTarget
)
throws
DBGException
{
public
PostgreDebugSession
createDebugSession
(
DBCExecutionContext
connectionTarget
)
throws
DBGException
{
PostgreDebugSessionInfo
targetInfo
=
getSessionInfo
(
connectionTarget
);
PostgreDebugSession
debugSession
=
new
PostgreDebugSession
(
getSessionInfo
(
this
.
connection
),
targetInfo
,
connectionTarget
);
PostgreDebugSession
debugSession
=
new
PostgreDebugSession
(
getSessionInfo
(
this
.
context
),
targetInfo
,
(
JDBCExecutionContext
)
connectionTarget
);
sessions
.
put
(
targetInfo
.
getPid
(),
debugSession
);
...
...
@@ -170,6 +176,7 @@ public class PostgreDebugSessionManager implements DBGSessionManager<Integer, In
@Override
public
void
dispose
()
{
context
.
close
();
//FIXME: AF: perform cleanup for everything cached
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录