Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
dc4f999e
提交
dc4f999e
authored
8月 12, 2013
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting, javadocs
上级
0dae0b0b
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
40 行增加
和
38 行删除
+40
-38
Data.java
h2/src/main/org/h2/store/Data.java
+1
-1
DbDriverActivator.java
h2/src/main/org/h2/util/DbDriverActivator.java
+16
-14
Utils.java
h2/src/main/org/h2/util/Utils.java
+11
-11
DataType.java
h2/src/main/org/h2/value/DataType.java
+1
-1
Value.java
h2/src/main/org/h2/value/Value.java
+1
-1
ValueGeometry.java
h2/src/main/org/h2/value/ValueGeometry.java
+10
-10
没有找到文件。
h2/src/main/org/h2/store/Data.java
浏览文件 @
dc4f999e
...
@@ -56,7 +56,7 @@ import org.h2.value.ValueUuid;
...
@@ -56,7 +56,7 @@ import org.h2.value.ValueUuid;
/**
/**
* This class represents a byte buffer that contains persistent data of a page.
* This class represents a byte buffer that contains persistent data of a page.
*
*
* @author Thomas Mueller
* @author Thomas Mueller
* @author Noel Grandin
* @author Noel Grandin
* @author Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888
* @author Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888
...
...
h2/src/main/org/h2/util/DbDriverActivator.java
浏览文件 @
dc4f999e
...
@@ -19,7 +19,7 @@ import java.util.Properties;
...
@@ -19,7 +19,7 @@ import java.util.Properties;
* is unloaded when stopping the bundle.
* is unloaded when stopping the bundle.
*/
*/
public
class
DbDriverActivator
implements
BundleActivator
{
public
class
DbDriverActivator
implements
BundleActivator
{
private
OSGIClassFactory
osgiClassFactory
;
private
OSGIClassFactory
osgiClassFactory
;
private
OSGIServiceClassFactory
osgiServiceClassFactory
;
private
OSGIServiceClassFactory
osgiServiceClassFactory
;
...
@@ -47,7 +47,7 @@ public class DbDriverActivator implements BundleActivator {
...
@@ -47,7 +47,7 @@ public class DbDriverActivator implements BundleActivator {
* Stop the bundle. This will unload the database driver. The
* Stop the bundle. This will unload the database driver. The
* DataSourceFactory service is implicitly un-registered by the OSGi
* DataSourceFactory service is implicitly un-registered by the OSGi
* framework.
* framework.
*
*
* @param bundleContext the bundle context
* @param bundleContext the bundle context
*/
*/
@Override
@Override
...
@@ -65,7 +65,7 @@ public class DbDriverActivator implements BundleActivator {
...
@@ -65,7 +65,7 @@ public class DbDriverActivator implements BundleActivator {
* BundleSymbolicName:BundleVersion:BinaryClassName
* BundleSymbolicName:BundleVersion:BinaryClassName
*/
*/
private
static
class
OSGIClassFactory
implements
Utils
.
ClassFactory
{
private
static
class
OSGIClassFactory
implements
Utils
.
ClassFactory
{
/**
/**
* Separator character to merge bundle name,version and class binary
* Separator character to merge bundle name,version and class binary
* name
* name
...
@@ -78,7 +78,7 @@ public class DbDriverActivator implements BundleActivator {
...
@@ -78,7 +78,7 @@ public class DbDriverActivator implements BundleActivator {
/**
/**
* Constructor
* Constructor
*
*
* @param bundleContext Valid bundleContext instance
* @param bundleContext Valid bundleContext instance
*/
*/
OSGIClassFactory
(
BundleContext
bundleContext
)
{
OSGIClassFactory
(
BundleContext
bundleContext
)
{
...
@@ -114,21 +114,23 @@ public class DbDriverActivator implements BundleActivator {
...
@@ -114,21 +114,23 @@ public class DbDriverActivator implements BundleActivator {
+
parts
[
BUNDLE_VERSION_INDEX
]);
+
parts
[
BUNDLE_VERSION_INDEX
]);
}
}
}
}
/**
/**
* Extend the H2 class loading in order to find class defined in other bundles.
* Extend the H2 class loading in order to find class defined in other
* bundles.
*
*
* The
C
lass must be registered as a service.
* The
c
lass must be registered as a service.
*
*
* The main difference with {@link OSGIClassFactory} is that it does not rely to a specific bundle.
* The main difference with {@link OSGIClassFactory} is that it does not
* OSGIServiceClassFactory is the preferred way to register function used in table constraints,
* rely to a specific bundle. OSGIServiceClassFactory is the preferred way
* theses functions should not be removed of the DataBase.
* to register function used in table constraints, these functions should
* not be removed from the database.
*
*
* The class format for bundle service class is the following
:
* The class format for bundle service class is the following:
* OSGI:BinaryClassNameService
* OSGI:BinaryClassNameService
*/
*/
private
static
class
OSGIServiceClassFactory
implements
Utils
.
ClassFactory
{
private
static
class
OSGIServiceClassFactory
implements
Utils
.
ClassFactory
{
/**
/**
* Separator character to merge bundle name, version and class binary
* Separator character to merge bundle name, version and class binary
* name
* name
...
@@ -136,7 +138,7 @@ public class DbDriverActivator implements BundleActivator {
...
@@ -136,7 +138,7 @@ public class DbDriverActivator implements BundleActivator {
public
static
final
String
SEPARATOR
=
"="
;
public
static
final
String
SEPARATOR
=
"="
;
private
static
final
int
BINARY_CLASS_NAME_INDEX
=
1
;
private
static
final
int
BINARY_CLASS_NAME_INDEX
=
1
;
private
BundleContext
bundleContext
;
private
BundleContext
bundleContext
;
/**
/**
...
@@ -168,5 +170,5 @@ public class DbDriverActivator implements BundleActivator {
...
@@ -168,5 +170,5 @@ public class DbDriverActivator implements BundleActivator {
throw
new
ClassNotFoundException
(
"OSGi Service not found "
+
parts
[
BINARY_CLASS_NAME_INDEX
]);
throw
new
ClassNotFoundException
(
"OSGi Service not found "
+
parts
[
BINARY_CLASS_NAME_INDEX
]);
}
}
}
}
}
}
h2/src/main/org/h2/util/Utils.java
浏览文件 @
dc4f999e
...
@@ -62,12 +62,12 @@ public class Utils {
...
@@ -62,12 +62,12 @@ public class Utils {
private
static
boolean
allowAllClasses
;
private
static
boolean
allowAllClasses
;
private
static
HashSet
<
String
>
allowedClassNames
;
private
static
HashSet
<
String
>
allowedClassNames
;
/**
/**
* In order to manage more than one class loader
* In order to manage more than one class loader
*/
*/
private
static
ArrayList
<
ClassFactory
>
userClassFactories
=
new
ArrayList
<
ClassFactory
>();
private
static
ArrayList
<
ClassFactory
>
userClassFactories
=
new
ArrayList
<
ClassFactory
>();
private
static
String
[]
allowedClassNamePrefixes
;
private
static
String
[]
allowedClassNamePrefixes
;
static
{
static
{
...
@@ -80,14 +80,14 @@ public class Utils {
...
@@ -80,14 +80,14 @@ public class Utils {
}
}
}
}
}
}
private
Utils
()
{
private
Utils
()
{
// utility class
// utility class
}
}
/**
/**
* Add a class factory in order to manage more than one class loader.
* Add a class factory in order to manage more than one class loader.
*
*
* @param classFactory An object that implements ClassFactory
* @param classFactory An object that implements ClassFactory
*/
*/
public
static
void
addClassFactory
(
ClassFactory
classFactory
)
{
public
static
void
addClassFactory
(
ClassFactory
classFactory
)
{
...
@@ -96,13 +96,13 @@ public class Utils {
...
@@ -96,13 +96,13 @@ public class Utils {
/**
/**
* Remove a class factory
* Remove a class factory
*
*
* @param classFactory Already inserted class factory instance
* @param classFactory Already inserted class factory instance
*/
*/
public
static
void
removeClassFactory
(
ClassFactory
classFactory
)
{
public
static
void
removeClassFactory
(
ClassFactory
classFactory
)
{
getUserClassFactories
().
remove
(
classFactory
);
getUserClassFactories
().
remove
(
classFactory
);
}
}
private
static
ArrayList
<
ClassFactory
>
getUserClassFactories
()
{
private
static
ArrayList
<
ClassFactory
>
getUserClassFactories
()
{
if
(
userClassFactories
==
null
)
{
if
(
userClassFactories
==
null
)
{
// initially, it is empty
// initially, it is empty
...
@@ -111,7 +111,7 @@ public class Utils {
...
@@ -111,7 +111,7 @@ public class Utils {
}
}
return
userClassFactories
;
return
userClassFactories
;
}
}
private
static
int
readInt
(
byte
[]
buff
,
int
pos
)
{
private
static
int
readInt
(
byte
[]
buff
,
int
pos
)
{
return
(
buff
[
pos
++]
<<
24
)
+
((
buff
[
pos
++]
&
0xff
)
<<
16
)
+
((
buff
[
pos
++]
&
0xff
)
<<
8
)
+
(
buff
[
pos
]
&
0xff
);
return
(
buff
[
pos
++]
<<
24
)
+
((
buff
[
pos
++]
&
0xff
)
<<
16
)
+
((
buff
[
pos
++]
&
0xff
)
<<
8
)
+
(
buff
[
pos
]
&
0xff
);
}
}
...
@@ -920,19 +920,19 @@ public class Utils {
...
@@ -920,19 +920,19 @@ public class Utils {
* in order to provide a class from another bundle ClassLoader.
* in order to provide a class from another bundle ClassLoader.
*/
*/
public
interface
ClassFactory
{
public
interface
ClassFactory
{
/**
/**
* Check whether the factory can return the named class.
* Check whether the factory can return the named class.
*
*
* @param name the binary name of the class
* @param name the binary name of the class
* @return true if this factory can return a valid class for the
* @return true if this factory can return a valid class for the
* provided class name
* provided class name
*/
*/
boolean
match
(
String
name
);
boolean
match
(
String
name
);
/**
/**
* Load the class.
* Load the class.
*
*
* @param name the binary name of the class
* @param name the binary name of the class
* @return the class object
* @return the class object
* @throws ClassNotFoundException If the class is not handle by this
* @throws ClassNotFoundException If the class is not handle by this
...
...
h2/src/main/org/h2/value/DataType.java
浏览文件 @
dc4f999e
...
@@ -963,7 +963,7 @@ public class DataType {
...
@@ -963,7 +963,7 @@ public class DataType {
/**
/**
* Check whether a given object is a Geometry object.
* Check whether a given object is a Geometry object.
*
*
* @param x the the object
* @param x the the object
* @return true if it is a Geometry object
* @return true if it is a Geometry object
*/
*/
...
...
h2/src/main/org/h2/value/Value.java
浏览文件 @
dc4f999e
...
@@ -34,7 +34,7 @@ import org.h2.util.Utils;
...
@@ -34,7 +34,7 @@ import org.h2.util.Utils;
/**
/**
* This is the base class for all value classes.
* This is the base class for all value classes.
* It provides conversion and comparison methods.
* It provides conversion and comparison methods.
*
*
* @author Thomas Mueller
* @author Thomas Mueller
* @author Noel Grandin
* @author Noel Grandin
* @author Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888
* @author Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888
...
...
h2/src/main/org/h2/value/ValueGeometry.java
浏览文件 @
dc4f999e
...
@@ -22,7 +22,7 @@ import com.vividsolutions.jts.io.WKTWriter;
...
@@ -22,7 +22,7 @@ import com.vividsolutions.jts.io.WKTWriter;
/**
/**
* Implementation of the GEOMETRY data type.
* Implementation of the GEOMETRY data type.
*
*
* @author Thomas Mueller
* @author Thomas Mueller
* @author Noel Grandin
* @author Noel Grandin
* @author Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888
* @author Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888
...
@@ -79,18 +79,18 @@ public class ValueGeometry extends Value {
...
@@ -79,18 +79,18 @@ public class ValueGeometry extends Value {
/**
/**
* Test if this geometry envelope intersects with the other geometry
* Test if this geometry envelope intersects with the other geometry
* envelope.
* envelope.
*
*
* @param r the other geometry
* @param r the other geometry
* @return true if the two
envelopes overlaps
* @return true if the two
overlap
*/
*/
public
boolean
intersectsBoundingBox
(
ValueGeometry
r
)
{
public
boolean
intersectsBoundingBox
(
ValueGeometry
r
)
{
//
it is useless to cache the envelope as the Geometry object do this already
//
the Geometry object caches the envelope
return
geometry
.
getEnvelopeInternal
().
intersects
(
r
.
getGeometry
().
getEnvelopeInternal
());
return
geometry
.
getEnvelopeInternal
().
intersects
(
r
.
getGeometry
().
getEnvelopeInternal
());
}
}
/**
/**
* Get the union.
* Get the union.
*
*
* @param r the other geometry
* @param r the other geometry
* @return the union of this geometry envelope and another geometry envelope
* @return the union of this geometry envelope and another geometry envelope
*/
*/
...
@@ -99,13 +99,13 @@ public class ValueGeometry extends Value {
...
@@ -99,13 +99,13 @@ public class ValueGeometry extends Value {
Envelope
mergedEnvelope
=
new
Envelope
(
geometry
.
getEnvelopeInternal
());
Envelope
mergedEnvelope
=
new
Envelope
(
geometry
.
getEnvelopeInternal
());
mergedEnvelope
.
expandToInclude
(
r
.
getGeometry
().
getEnvelopeInternal
());
mergedEnvelope
.
expandToInclude
(
r
.
getGeometry
().
getEnvelopeInternal
());
return
get
(
gf
.
toGeometry
(
mergedEnvelope
));
return
get
(
gf
.
toGeometry
(
mergedEnvelope
));
}
}
/**
/**
* Get the intersection.
* Get the intersection.
*
*
* @param r the other geometry
* @param r the other geometry
* @return the intersection of this geometry envelope and another
geometry envelope
* @return the intersection of this geometry envelope and another
*/
*/
public
ValueGeometry
getEnvelopeIntersection
(
ValueGeometry
r
)
{
public
ValueGeometry
getEnvelopeIntersection
(
ValueGeometry
r
)
{
Envelope
e1
=
geometry
.
getEnvelopeInternal
();
Envelope
e1
=
geometry
.
getEnvelopeInternal
();
...
@@ -120,7 +120,7 @@ public class ValueGeometry extends Value {
...
@@ -120,7 +120,7 @@ public class ValueGeometry extends Value {
GeometryFactory
gf
=
new
GeometryFactory
();
GeometryFactory
gf
=
new
GeometryFactory
();
return
get
(
gf
.
toGeometry
(
e3
));
return
get
(
gf
.
toGeometry
(
e3
));
}
}
@Override
@Override
public
int
getType
()
{
public
int
getType
()
{
return
Value
.
GEOMETRY
;
return
Value
.
GEOMETRY
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论