DeveelDB
20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
deveeldb.git
src
deveeldb
Deveel.Data
SystemBuilder.cs
Go to the documentation of this file.
1
//
2
// Copyright 2010-2015 Deveel
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
//
8
// http://www.apache.org/licenses/LICENSE-2.0
9
//
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
// See the License for the specific language governing permissions and
14
// limitations under the License.
15
//
16
17
using
System
;
18
using
System
.Collections.Generic;
19
using
System
.Linq;
20
21
using
Deveel
.
Data
.
Caching
;
22
using
Deveel
.
Data
.
Configuration
;
23
using
Deveel
.
Data
.
Routines
;
24
using
Deveel
.
Data
.
Security
;
25
using
Deveel
.
Data
.
Services
;
26
using
Deveel
.
Data
.
Sql
;
27
using
Deveel
.
Data
.
Sql
.
Compile
;
28
using
Deveel
.
Data
.
Sql
.
Query
;
29
using
Deveel
.
Data
.
Sql
.
Schemas
;
30
using
Deveel
.
Data
.
Sql
.
Sequences
;
31
using
Deveel
.
Data
.
Sql
.
Tables
;
32
using
Deveel
.
Data
.
Sql
.
Triggers
;
33
using
Deveel
.
Data
.
Sql
.
Variables
;
34
using
Deveel
.
Data
.
Sql
.
Views
;
35
using
Deveel
.
Data
.
Store
;
36
37
namespace
Deveel
.Data {
38
public
class
SystemBuilder
{
39
public
SystemBuilder
()
40
: this(new
Configuration
.
Configuration
()) {
41
}
42
43
public
SystemBuilder
(
IConfiguration
configuration) {
44
Configuration
= configuration;
45
ServiceContainer
=
new
ServiceContainer
();
46
}
47
48
public
IConfiguration
Configuration
{
get
; set; }
49
50
private
ServiceContainer
ServiceContainer
{
get
; set; }
51
52
private
void
RegisterDefaultServices
() {
53
ServiceContainer
.
Register
<
SecurityModule
>();
54
55
ServiceContainer
.Bind<
IRoutineResolver
>()
56
.To<SystemFunctionsProvider>()
57
.InDatabaseScope();
58
59
ServiceContainer
.Bind<
ISqlCompiler
>()
60
.To<SqlDefaultCompiler>()
61
.InSystemScope();
62
63
ServiceContainer
.Bind<
IQueryPlanner
>()
64
.To<QueryPlanner>()
65
.InSystemScope();
66
67
ServiceContainer
.Bind<
ITableCellCache
>()
68
.To<TableCellCache>()
69
.InSystemScope();
70
71
ServiceContainer
.Bind<
IObjectManager
>()
72
.To<TableManager>()
73
.WithKey(
DbObjectType
.Table)
74
.InTransactionScope();
75
76
ServiceContainer
.Bind<
IObjectManager
>()
77
.To<ViewManager>()
78
.InTransactionScope()
79
.WithKey(
DbObjectType
.View);
80
81
ServiceContainer
.Bind<
IObjectManager
>()
82
.To<SequenceManager>()
83
.WithKey(
DbObjectType
.Sequence)
84
.InTransactionScope();
85
86
ServiceContainer
.Bind<
IObjectManager
>()
87
.To<TriggerManager>()
88
.WithKey(
DbObjectType
.Trigger)
89
.InTransactionScope();
90
91
ServiceContainer
.Bind<
IObjectManager
>()
92
.To<SchemaManager>()
93
.WithKey(
DbObjectType
.Schema)
94
.InTransactionScope();
95
96
ServiceContainer
.Bind<
IObjectManager
>()
97
.To<PersistentVariableManager>()
98
.WithKey(
DbObjectType
.Variable)
99
.InTransactionScope();
100
101
ServiceContainer
.Bind<
IObjectManager
>()
102
.To<RoutineManager>()
103
.WithKey(
DbObjectType
.Routine)
104
.InTransactionScope();
105
106
ServiceContainer
.Bind<
IStoreSystem
>()
107
.To<InMemoryStorageSystem>()
108
.WithKey(
DefaultStorageSystemNames
.
Heap
)
109
.InDatabaseScope();
110
111
ServiceContainer
.Bind<
IStoreSystem
>()
112
.To<SingleFileStoreSystem>()
113
.WithKey(
DefaultStorageSystemNames
.
SingleFile
)
114
.InDatabaseScope();
115
116
#if !PCL
117
ServiceContainer
.Bind<
IFileSystem
>()
118
.To<LocalFileSystem>()
119
.InSystemScope();
120
#endif
121
}
122
123
private
ISystemContext
BuildContext
(out IEnumerable<ModuleInfo> modules) {
124
RegisterDefaultServices();
125
126
OnServiceRegistration(
ServiceContainer
);
127
modules = LoadModules();
128
129
return
new
SystemContext
(
Configuration
,
ServiceContainer
);
130
}
131
132
private
IEnumerable<ModuleInfo>
LoadModules
() {
133
var moduleInfo =
new
List<ModuleInfo>();
134
135
var modules =
ServiceContainer
.
ResolveAll
<
ISystemModule
>();
136
foreach
(var systemModule
in
modules) {
137
systemModule.
Register
(
ServiceContainer
);
138
139
moduleInfo.Add(
new
ModuleInfo
(systemModule.ModuleName, systemModule.Version));
140
}
141
142
ServiceContainer
.
Unregister
<
ISystemModule
>();
143
return
moduleInfo;
144
}
145
146
protected
virtual
void
OnServiceRegistration
(
ServiceContainer
container) {
147
}
148
149
public
ISystem
BuildSystem
() {
150
IEnumerable<ModuleInfo> modules;
151
var context = BuildContext(out modules);
152
return
new
DatabaseSystem
(context, modules);
153
}
154
}
155
}
Deveel.Data.SystemBuilder.SystemBuilder
SystemBuilder()
Definition:
SystemBuilder.cs:39
Deveel.Data.Store.DefaultStorageSystemNames.SingleFile
const string SingleFile
Definition:
DefaultStorageSystemNames.cs:22
Deveel.Data.Caching
Definition:
Cache.cs:21
Deveel.Data.Routines.IRoutineResolver
The system uses instances of this interface to resolve routines given a user invocation.
Definition:
IRoutineResolver.cs:26
Deveel
Deveel.Data.Sql.Variables
Definition:
ContextExtensions.cs:23
System
Definition:
NonSerializedAttribute.cs:3
Deveel.Data.ISystemContext
The execution context of a database system, that is defining the configurations and the components us...
Definition:
ISystemContext.cs:28
Deveel.Data.SystemBuilder
Definition:
SystemBuilder.cs:38
Deveel.Data.Sql.Schemas
Definition:
InformationSchema.cs:22
Deveel.Data.SystemBuilder.OnServiceRegistration
virtual void OnServiceRegistration(ServiceContainer container)
Definition:
SystemBuilder.cs:146
Deveel.Data.Sql.Compile
Definition:
CompileMessageLevel.cs:19
Deveel.Data.Store.IFileSystem
Definition:
IFileSystem.cs:20
Deveel.Data.Services.ServiceContainer.Register
void Register(ServiceRegistration registration)
Definition:
ServiceContainer.cs:128
Deveel.Data.SystemBuilder.RegisterDefaultServices
void RegisterDefaultServices()
Definition:
SystemBuilder.cs:52
Deveel.Data.ModuleInfo
Definition:
ModuleInfo.cs:20
Deveel.Data.Sql.Triggers
Definition:
ITableStateHandler.cs:19
Deveel.Data.Services.ServiceContainer.Unregister
bool Unregister(Type serviceType, object serviceName)
Definition:
ServiceContainer.cs:156
Deveel.Data.Store.IStoreSystem
An object that creates and manages the IStore objects that the database engine uses to represent itse...
Definition:
IStoreSystem.cs:31
Deveel.Data.SystemContext
This is the context of a database system, that handles the configurations and services used by all th...
Definition:
SystemContext.cs:28
Deveel.Data.ISystem
Definition:
ISystem.cs:24
Deveel.Data.SystemBuilder.BuildSystem
ISystem BuildSystem()
Definition:
SystemBuilder.cs:149
Deveel.Data.Security.SecurityModule
Definition:
SecurityModule.cs:22
Deveel.Data.ISystemModule
Definition:
ISystemModule.cs:22
Deveel.Data.Security
Definition:
AccessPrivilege.cs:19
Deveel.Data.SystemBuilder.SystemBuilder
SystemBuilder(IConfiguration configuration)
Definition:
SystemBuilder.cs:43
Deveel.Data.Configuration.Configuration
Definition:
Configuration.cs:25
Deveel.Data.Sql.Tables
Definition:
BaseDataTable.cs:25
Deveel.Data.Services.ServiceContainer.ResolveAll
IEnumerable ResolveAll(Type serviceType)
Definition:
ServiceContainer.cs:116
Deveel.Data.Store.DefaultStorageSystemNames.Heap
const string Heap
Definition:
DefaultStorageSystemNames.cs:23
Deveel.Data.Services.ServiceContainer
Definition:
ServiceContainer.cs:24
Deveel.Data.Services
Definition:
IRegistrationConfiguration.cs:19
Deveel.Data.Store.DefaultStorageSystemNames
Definition:
DefaultStorageSystemNames.cs:20
Deveel.Data.Sql.Compile.ISqlCompiler
Definition:
ISqlCompiler.cs:22
Deveel.Data.Configuration.IConfiguration
Defines the contract for the configuration node of a component within the system or of the system its...
Definition:
IConfiguration.cs:33
Deveel.Data.Routines
Definition:
AggregateFunction.cs:24
Deveel.Data.Sql.Query.IQueryPlanner
Definition:
IQueryPlanner.cs:20
Deveel.Data.SystemBuilder.BuildContext
ISystemContext BuildContext(out IEnumerable< ModuleInfo > modules)
Definition:
SystemBuilder.cs:123
Deveel.Data
Definition:
ActiveSessionList.cs:22
Deveel.Data.SystemBuilder.LoadModules
IEnumerable< ModuleInfo > LoadModules()
Definition:
SystemBuilder.cs:132
Deveel.Data.Caching.ITableCellCache
Definition:
ITableCellCache.cs:20
Deveel.Data.Sql.Query
Definition:
BranchQueryPlanNode.cs:23
Deveel.Data.Configuration
Definition:
ConfigGroup.cs:19
Deveel.Data.Sql.Sequences
Definition:
ISequence.cs:21
Deveel.Data.Store
Definition:
AreaExtensions.cs:19
Deveel.Data.ISystemModule.Register
void Register(IScope systemScope)
Deveel.Data.Sql.IObjectManager
Defines the contract for the business managers of database objects of a given type.
Definition:
IObjectManager.cs:37
Deveel.Data.DatabaseSystem
Definition:
DatabaseSystem.cs:26
Deveel.Data.Sql.Views
Definition:
QueryContext.Views.cs:9
Deveel.Data.Sql.DbObjectType
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition:
DbObjectType.cs:27
Deveel.Data.Sql
Definition:
CellId.cs:22
Generated by
1.8.10