Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
de69210a
提交
de69210a
authored
7月 11, 2010
作者:
christian.peter.io
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add upgrade classes to 1.1 branch
上级
88fcdf0f
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
109 行增加
和
0 行删除
+109
-0
UpgradeCreator.java
h2/src/tools/org/h2/build/upgrade/UpgradeCreator.java
+94
-0
package.html
h2/src/tools/org/h2/build/upgrade/package.html
+15
-0
没有找到文件。
h2/src/tools/org/h2/build/upgrade/UpgradeCreator.java
0 → 100644
浏览文件 @
de69210a
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
build
.
upgrade
;
import
java.io.File
;
import
org.h2.build.BuildBase
;
/**
* Creates the v 1.1 upgrade sources
*/
public
class
UpgradeCreator
{
private
static
final
String
[]
TEXT_FILE_EXTENSIONS
=
{
".java"
,
".xml"
,
".bat"
,
".sh"
,
".txt"
,
".html"
,
".csv"
};
/**
* This method is called when executing this application from the command
* line.
*
* @param args the command line parameters
*/
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(
args
.
length
!=
2
)
{
System
.
out
.
println
(
"Usage: java -cp . org.h2.build.upgrade.UpgradeCreator <srcDir> <destDir>"
);
System
.
exit
(
1
);
}
File
srcDir
=
new
File
(
args
[
0
]);
if
(!
srcDir
.
exists
())
{
System
.
out
.
println
(
"Source dir does not exist"
);
System
.
exit
(
1
);
}
File
destDir
=
new
File
(
args
[
1
]);
if
(
destDir
.
exists
())
{
System
.
out
.
println
(
"Destination dir already exists"
);
System
.
exit
(
1
);
}
destDir
.
mkdirs
();
convert
(
srcDir
,
srcDir
,
destDir
);
}
private
static
void
convert
(
File
file
,
File
srcDir
,
File
destDir
)
throws
Exception
{
String
pathInDestDir
=
file
.
getCanonicalPath
().
substring
(
srcDir
.
getCanonicalPath
().
length
());
pathInDestDir
=
pathInDestDir
.
replaceAll
(
"org"
+
File
.
separator
+
"h2"
,
"org"
+
File
.
separator
+
"h2"
+
File
.
separator
+
"upgrade"
+
File
.
separator
+
"v1_1"
);
File
fileInDestDir
=
new
File
(
destDir
,
pathInDestDir
);
// System.out.println(fileInDestDir.getAbsoluteFile());
if
(
file
.
isDirectory
())
{
fileInDestDir
.
mkdirs
();
File
[]
files
=
file
.
listFiles
();
for
(
File
child
:
files
)
{
convert
(
child
,
srcDir
,
destDir
);
}
}
else
{
byte
[]
content
=
BuildBase
.
readFile
(
file
);
String
contentString
=
new
String
(
content
);
if
(
isTextFile
(
file
))
{
contentString
=
replace
(
file
,
contentString
);
}
content
=
contentString
.
getBytes
();
BuildBase
.
writeFile
(
fileInDestDir
,
content
);
}
}
private
static
String
replace
(
File
file
,
String
content
)
{
content
=
content
.
replaceAll
(
"org\\.h2"
,
"org.h2.upgrade.v1_1"
);
content
=
content
.
replaceAll
(
"org/h2/"
,
"org/h2/upgrade/v1_1/"
);
content
=
content
.
replaceAll
(
"jdbc:h2:"
,
"jdbc:h2v1_1:"
);
if
(
file
.
getName
().
equals
(
"ConnectionInfo.java"
))
{
content
=
content
.
replaceAll
(
"boolean isPersistent\\(\\) \\{"
,
"public boolean isPersistent() {"
);
content
=
content
.
replaceAll
(
"String getName\\(\\) throws SQLException \\{"
,
"public String getName() throws SQLException {"
);
}
return
content
;
}
private
static
boolean
isTextFile
(
File
file
)
{
for
(
String
extension
:
TEXT_FILE_EXTENSIONS
)
{
if
(
file
.
getName
().
toLowerCase
().
endsWith
(
extension
))
{
return
true
;
}
}
return
false
;
}
}
h2/src/tools/org/h2/build/upgrade/package.html
0 → 100644
浏览文件 @
de69210a
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version 1.0,
and under the Eclipse Public License, Version 1.0
(http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html
xmlns=
"http://www.w3.org/1999/xhtml"
lang=
"en"
xml:lang=
"en"
>
<head><meta
http-equiv=
"Content-Type"
content=
"text/html;charset=utf-8"
/><title>
Javadoc package documentation
</title></head><body
style=
"font: 9pt/130% Tahoma, Arial, Helvetica, sans-serif; font-weight: normal;"
><p>
A tool to change the package name 'org.h2.' to a new name, to create a migration jar file.
</p></body></html>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论