Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
cc329424
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
cc329424
编写于
9月 18, 2015
作者:
J
jurgen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Local maven repository
上级
06c649a5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
12 deletion
+41
-12
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenLocalVersion.java
...c/org/jkiss/dbeaver/registry/maven/MavenLocalVersion.java
+3
-0
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRegistry.java
...e/src/org/jkiss/dbeaver/registry/maven/MavenRegistry.java
+29
-8
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRepository.java
...src/org/jkiss/dbeaver/registry/maven/MavenRepository.java
+9
-4
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenLocalVersion.java
浏览文件 @
cc329424
...
...
@@ -62,6 +62,9 @@ public class MavenLocalVersion
}
public
File
getCacheFile
()
{
if
(
artifact
.
getRepository
().
isLocal
())
{
return
new
File
(
getExternalURL
(
MavenArtifact
.
FILE_JAR
));
}
return
new
File
(
artifact
.
getRepository
().
getLocalCacheDir
(),
artifact
.
getGroupId
()
+
"/"
+
fileName
);
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRegistry.java
浏览文件 @
cc329424
...
...
@@ -26,40 +26,53 @@ import org.jkiss.dbeaver.DBeaverPreferences;
import
org.jkiss.dbeaver.core.DBeaverCore
;
import
org.jkiss.utils.CommonUtils
;
import
java.io.IOException
;
import
java.util.*
;
public
class
MavenRegistry
{
public
static
final
String
MAVEN_LOCAL_REPO_ID
=
"local"
;
public
static
final
String
MAVEN_LOCAL_REPO_NAME
=
"Local Repository"
;
public
static
final
String
MAVEN_LOCAL_REPO_FOLDER
=
"maven-local"
;
private
static
MavenRegistry
instance
=
null
;
public
synchronized
static
MavenRegistry
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
MavenRegistry
();
instance
.
loadExtensions
(
Platform
.
getExtensionRegistry
());
instance
.
loadCustomRepositories
();
}
return
instance
;
}
private
final
List
<
MavenRepository
>
repositories
=
new
ArrayList
<
MavenRepository
>();
private
final
MavenRepository
localRepository
;
// Cache for not found artifact ids. Avoid multiple remote metadata reading
private
final
Set
<
String
>
notFoundArtifacts
=
new
HashSet
<
String
>();
private
MavenRegistry
()
{
}
private
void
loadExtensions
(
IExtensionRegistry
registry
)
{
// Load data type providers from external plugins
// Load repositories info
{
IConfigurationElement
[]
extElements
=
registry
.
getConfigurationElementsFor
(
MavenRepository
.
EXTENSION_ID
);
IConfigurationElement
[]
extElements
=
Platform
.
getExtensionRegistry
()
.
getConfigurationElementsFor
(
MavenRepository
.
EXTENSION_ID
);
for
(
IConfigurationElement
ext
:
extElements
)
{
MavenRepository
repository
=
new
MavenRepository
(
ext
);
repositories
.
add
(
repository
);
}
}
// Create local repository
String
localRepoURL
;
try
{
localRepoURL
=
Platform
.
getInstallLocation
().
getDataArea
(
MAVEN_LOCAL_REPO_FOLDER
).
toString
();
}
catch
(
IOException
e
)
{
localRepoURL
=
Platform
.
getInstallLocation
().
getURL
().
toString
()
+
"/"
+
MAVEN_LOCAL_REPO_FOLDER
;
}
localRepository
=
new
MavenRepository
(
MAVEN_LOCAL_REPO_ID
,
MAVEN_LOCAL_REPO_NAME
,
localRepoURL
,
true
);
}
public
void
loadCustomRepositories
()
{
...
...
@@ -85,7 +98,7 @@ public class MavenRegistry
}
String
repoID
=
repoInfo
.
substring
(
0
,
divPos
);
String
repoURL
=
repoInfo
.
substring
(
divPos
+
1
);
MavenRepository
repo
=
new
MavenRepository
(
repoID
,
repoID
,
repoURL
);
MavenRepository
repo
=
new
MavenRepository
(
repoID
,
repoID
,
repoURL
,
false
);
repositories
.
add
(
repo
);
}
}
...
...
@@ -107,12 +120,20 @@ public class MavenRegistry
return
null
;
}
// Try all available repositories
for
(
MavenRepository
repository
:
repositories
)
{
MavenArtifact
artifact
=
repository
.
findArtifact
(
groupId
,
artifactId
);
if
(
artifact
!=
null
)
{
return
artifact
;
}
}
// Try local repository
MavenArtifact
artifact
=
localRepository
.
findArtifact
(
groupId
,
artifactId
);
if
(
artifact
!=
null
)
{
return
artifact
;
}
// Not found
notFoundArtifacts
.
add
(
fullId
);
return
null
;
}
...
...
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/maven/MavenRepository.java
浏览文件 @
cc329424
...
...
@@ -63,6 +63,7 @@ public class MavenRepository
private
String
id
;
private
String
name
;
private
String
url
;
private
boolean
local
;
private
boolean
predefined
=
false
;
private
List
<
MavenArtifact
>
cachedArtifacts
=
new
ArrayList
<
MavenArtifact
>();
...
...
@@ -72,15 +73,19 @@ public class MavenRepository
this
(
config
.
getAttribute
(
RegistryConstants
.
ATTR_ID
),
config
.
getAttribute
(
RegistryConstants
.
ATTR_NAME
),
config
.
getAttribute
(
RegistryConstants
.
ATTR_URL
));
config
.
getAttribute
(
RegistryConstants
.
ATTR_URL
),
false
);
this
.
predefined
=
true
;
}
public
MavenRepository
(
String
id
,
String
name
,
String
ur
l
)
{
MavenRepository
(
String
id
,
String
name
,
String
url
,
boolean
loca
l
)
{
this
.
id
=
id
;
this
.
name
=
name
;
this
.
url
=
url
;
loadCache
();
this
.
local
=
local
;
if
(!
local
)
{
loadCache
();
}
}
public
void
flushCache
()
{
...
...
@@ -104,7 +109,7 @@ public class MavenRepository
}
public
boolean
isLocal
()
{
return
false
;
return
local
;
}
@Nullable
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录