How sun0lee/del_gesg_nh works
Project type and purpose
• This is a standalone Java/Maven batch ETL application for financial risk curves (ESG) computations.
• It uses Hibernate (ORM) to read/write from a relational database, applies quantitative models, and exports results (e.g., CSV).
File structure
• Top-level layers in src/com/gof:
– process: orchestrator classes (Main.java, Process.java, EsgXXX job steps)
– dao: data access layer (Hibernate DAOs)
– entity: JPA/Hibernate entity definitions
– model: quantitative model implementations (Nelson-Siegel, CIR, Smith‐Wilson, etc.)
– annotation: custom annotations (ToCsv, ToCsvMethod) to mark outputs for CSV export
– util: shared utilities (HibernateUtil, FileUtils, DateUtil, ReflectionUtil, etc.)
• Configuration files: hibernate.cfg.xml, log4j2.xml, gesg.properties.
• Build: pom.xml (Maven), .gitignore.
(minimal) README
• No details beyond “aa.” Rely on the code structure to infer that Main → Process → individual Esg*** classes form a sequence of batch jobs.
Main components and interactions
a. Components
1. Client/Scheduler – triggers Main (command-line or cron).
2. Main & Process Engine – bootstraps Hibernate, logging, loads properties, iterates through configured EsgXXX jobs.
3. DAO Layer – CoEsgMetaDao, IrCurveDao, etc., use Hibernate sessions to fetch/persist Entity objects.
4. Domain Entities – JPA-annotated classes representing database tables.
5. Business Logic/Model Layer – implements financial models (AFNelsonSiegel, CIRSimulationForcast, SmithWilson*, etc.).
6. Annotation Processor – ReflectionUtil reads @ToCsv annotations on entities/methods to export CSV files.
7. Utilities – common functions (file I/O, date math, encryption, logging).
8. External Systems – RDBMS, file system for scripts and CSV outputs.
b. Relationships & data flow
• Main → initializes HibernateUtil → opens SessionFactory → instantiates Process.
• Process → iterates through EsgXXX job classes in a configured order.
• Each job → calls DAO methods → retrieves Entity data → passes to Model classes → computes results → wraps into Entity objects → DAO persists or writes via ToCsv.
• Utilities support logging, file export, math routines.
c. Architectural patterns/design principles
• Layered architecture: Presentation (CLI), Orchestration, DAO, Domain Model, Utility.
• DAO pattern with Hibernate (ORM).
• Annotation-driven CSV export (custom annotation + reflection).
• Single-threaded batch pipeline (Process class as a command dispatcher).
• Configuration externalization (XML, properties files).
d. Key technologies/frameworks
• Java 8+
• Maven for build and dependency management
• Hibernate (hibernate.cfg.xml) for ORM
• Log4j2 for logging
• Custom Java annotations for export
• JUnit/TestNG for DbTest
• SQL scripts under “table script”