DAO Layer
The DAO (Data Access Object) layer in io-oidis-services provides an object-oriented engine for loading, composing, and querying hierarchical JSON-based configuration. Unlike traditional database DAOs, this layer focuses on configuration management — parsing JSONP resource files into typed class instances with support for inheritance, imports, and localization.
Package: io-oidis-services | Namespace: Io.Oidis.Services.DAO
Architecture
┌──────────────┐
│ BaseDAO │ ← Core: load, cache, compose
└──────┬───────┘
┌────────────┼───────────────┐
▼ ▼
┌─────────────┐ ┌──────────────────────┐
│ BasePageDAO │ │ InstallationRecipeDAO │
└─────────────┘ └──────────────────────┘
Page controllers Installation protocols
with localization with download/execute
Supporting Classes
| Class | Role |
|---|---|
Resources | Extends JsonpFileReader with Extend() and DeepClone() helpers for merging configurations |
BaseDAO
BaseDAO is the core class providing object-oriented data parsed from external JSONP resource files. It handles:
- Configuration loading — Asynchronous JSONP file loading via
Resources.Load() - Inheritance —
extendsConfigproperty chains parent configurations - Imports —
importsarray references other configuration files as named variables - Localization — Language-specific configuration overlays (EN, CZ, CN)
- Static caching — Loaded resources are cached to avoid repeated HTTP requests
- Configuration library — Runtime utility functions (Echo, Log, Warning, Error) injected into configuration instances
Key Methods
| Method | Description |
|---|---|
Load($language, $asyncHandler, $force) | Load the configuration for a given language, resolving inheritance chain and imports |
getStaticConfiguration() | Return the raw parsed configuration data |
getConfigurationInstance() | Return the configuration as a class instance with inheritance, imports, and library merged |
ConfigurationLibrary($value?) | Get or set the library object injected into configuration instances |
getParentDAO() | Return the parent DAO from extendsConfig resolution |
getImportedDAO($variableName) | Return an imported DAO by its variable name |
setConfigurationPath($value) | Set the JSONP file path used as data source |
UnloadResource($filePath) | Static method to remove a resource from the global cache |
Configuration Hierarchy
When BaseDAO.Load() is called, it:
- Loads the JSONP file at
configurationPath - Follows the
extendsConfigchain, merging parent data withResources.Extend() - Resolves
imports— each imported file is loaded into its own DAO instance - Applies
localizationoverlays for the requested language - Caches the result in a static
ArrayListkeyed by file path and language
The getConfigurationInstance() method then composes all these layers into a single prototype-based object where $super references the parent configuration and import variables are accessible as named properties.
Localization Overlays
A configuration file is treated as written in the DAO's default language — LanguageType.EN unless the subclass calls
setDefaultLanguage() in its constructor. The overlay mechanics follow from that:
Load($language)with the default language returns the file as is; no overlay is loaded.Load($language)with any other language looks uplocalization[<language lowercased>]in the base file (e.g."cz"forLanguageType.CZ) and deep-merges that overlay over a clone of the base. Keys missing in the overlay keep the base value, so an incomplete translation falls back per key.- The language passed to
Load()is not validated againstLanguageType— onlysetDefaultLanguage()is.
A file whose texts are Czech therefore needs setDefaultLanguage(LanguageType.CZ) and localization: {en: "…"}; with
the EN default, requesting LanguageType.EN would return the Czech base untouched.
imports and extendsConfig are loaded by DAO instances created through the static getDaoInterfaceClassName(), which
returns plain BaseDAO by default. Those instances have the EN default, so a non-EN base language is lost for imported
files unless the subclass overrides getDaoInterfaceClassName() to return itself.
On the backend use the Hub Resources handler (getResourcesHandler() override, see MailEngineDAO) so JSONP is read
from the file system.
BasePageDAO
Extends BaseDAO for page controller configurations. Adds page-specific accessors:
| Method | Description |
|---|---|
getPageConfiguration() | Return the typed IBasePageLocalization data |
getCacheFilePath() | Return the path used for page static cache loading |
getPageTitle() | Return the configured page title |
getPageLoadingText() | Return the loading indicator text |
getPageLoadingProgressText() | Return the loading progress text |
getModelArgs() | Return the BasePanelViewerArgs for the page viewer |
InstallationRecipeDAO
Extends BaseDAO for managing multi-step installation protocols. This is the most complex DAO, orchestrating package download, installation, validation, and repair sequences.
Installation Protocols
| Protocol Type | Steps |
|---|---|
VALIDATE | validate |
INSTALL_STATUS | installCondition |
INSTALL | installCondition → selectSource → getSource → install → validate |
UNINSTALL | installCondition → uninstall |
REPAIR | installCondition → selectSource → getSource → repair → validate |
Key Methods
| Method | Description |
|---|---|
getChain() | Return the ordered list of package names to process |
getPackage($name) | Resolve and return a fully prepared IInstallationPackage with default handlers for source selection, download, and installation |
RunInstallationChain($protocolType) | Execute the full installation chain for a given protocol type, firing progress events |
Abort() | Cancel the running chain, aborting active downloads |
getEvents() | Return the event interface for subscribing to OnStart, OnChange, OnComplete, and OnError |
Event Flow
OnStart → OnChange (per step/package) → OnComplete
→ OnError (on failure)
Progress events carry InstallationProgressCode values indicating the current phase:
CHAIN_START, STEP_START, DOWNLOAD_START, DOWNLOAD_CHANGE, EXTRACT_START, CLONE, VALIDATED, SKIPPED, CHAIN_END.
Configuration Interfaces
IBaseConfiguration
The minimal interface expected by any JSONP configuration file:
| Property | Type | Description |
|---|---|---|
version | string? | Unique version identifier |
extendsConfig | string? | Path to parent configuration for inheritance |
$interface | string? | DAO parser identifier (e.g. IBasePageConfiguration) |
imports | IImports[]? | Array of imported configuration references |
localization | ILocalization? | Language-specific overlay paths |
noCache | boolean? | Disable resource caching |
$super | IBaseConfiguration | Reference to parent configuration instance |
Echo, Log, Warning, Error | Functions | Runtime utility functions from the configuration library |
IBasePageLocalization
Extends IBaseConfiguration for page controllers:
| Property | Type | Description |
|---|---|---|
cacheFile | string? | Path to GUI static cache for fast loading |
title | string? | Page title value |
loading | string? | Loading indicator text |
loadingProgress | string? | Loading progress text |
IBaseInstallationRecipe Hierarchy
The installation recipe interface hierarchy defines the package structure:
IInstallationPackage— A single installable package with name, version, source, and handler methods (validate, install, uninstall, repair)IInstallationPackageSource— Platform-specific source URLs (x86/x64) with optional download optionsIInstallationHandler— Callback signature($status: boolean, $message?: string) => voidused by all protocol stepsIInstallationEnvironment— The full configuration instance with packages map, current block, utilities, and connectorsIInstallationRecipeNotifications— Localized notification message templates for installation progress
File Structure
source/typescript/Io/Oidis/Services/
├── DAO/
│ ├── BaseDAO.ts # Core configuration engine
│ ├── BasePageDAO.ts # Page controller extension
│ ├── InstallationRecipeDAO.ts # Installation protocol manager
│ └── Resources.ts # JSONP loading + merge helpers
└── Interfaces/DAO/
├── IBaseConfiguration.ts # Core configuration interface
├── IBasePageLocalization.ts # Page localization interface
├── IBaseInstallationRecipe.ts # Installation package interfaces
└── IInstallationUtils.ts # System utility interface for installations
See also: Configuration Overview | JSONP System | HttpProcessor Services