JP5237030B2 - Software development support program, software development support apparatus, and software development support method - Google Patents
Software development support program, software development support apparatus, and software development support method Download PDFInfo
- Publication number
- JP5237030B2 JP5237030B2 JP2008249924A JP2008249924A JP5237030B2 JP 5237030 B2 JP5237030 B2 JP 5237030B2 JP 2008249924 A JP2008249924 A JP 2008249924A JP 2008249924 A JP2008249924 A JP 2008249924A JP 5237030 B2 JP5237030 B2 JP 5237030B2
- Authority
- JP
- Japan
- Prior art keywords
- class
- information
- file
- data access
- component
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Description
本発明は、ソフトウェア開発支援プログラム、ソフトウェア開発支援装置およびソフトウェア開発支援方法に関し、特にデータベースにアクセスするソフトウェアの開発を支援するソフトウェア開発支援プログラム、ソフトウェア開発支援装置およびソフトウェア開発支援方法に関する。 The present invention relates to a software development support program, a software development support apparatus, and a software development support method, and more particularly to a software development support program, a software development support apparatus, and a software development support method that support the development of software that accesses a database.
現在、コンピュータシステムの大規模化や複雑化が進む一方、システム開発の低コスト化や短納期化が求められている。この点、システム開発を効率化するため、頻繁に出現するソフトウェアの機能を部品(コンポーネント)化して再利用性を高め、コンポーネントをシステム開発基盤として提供するという手法が考えられる。再利用性を高めるのに役立つ技術として、例えば、依存性注入(DI:Dependency Injection)やアスペクト指向プログラミング(AOP:Aspect Oriented Programming)などの技術がある。 Currently, computer systems are becoming larger and more complex, and there is a demand for lower system development costs and shorter delivery times. In this regard, in order to improve the efficiency of system development, a method of improving the reusability by converting frequently appearing software functions into components (components) and providing the components as a system development platform can be considered. Examples of techniques useful for enhancing reusability include techniques such as dependency injection (DI) and aspect oriented programming (AOP).
DIでは、コンテナと呼ばれるプログラム実行環境において、コンポーネント間の依存関係を実行時に注入することができる。これにより、個々のコンポーネントの独立性をより高めることができる。また、AOPでは、例外処理やログ出力など、システム内で横断的に利用される機能をコンポーネントとして切り出しておき、プログラム実行環境がこれら機能を事後的にシステムに付加することを可能にする。 In DI, dependency relationships between components can be injected at the time of execution in a program execution environment called a container. Thereby, the independence of each component can be improved more. In AOP, functions used across the system such as exception processing and log output are extracted as components, and the program execution environment can add these functions to the system afterwards.
このように、DIやAOPの技術を用いることで、コンポーネント間の依存関係を疎に保つことができ、コンポーネントの再利用性を高めることができる。このような再利用性の高いコンポーネントは、システム固有の業務ロジックから分離されたものであり、一定のパターン化が可能なものも多い。そこで、システム開発をより効率化する観点から、コンポーネントの作成を支援する方法が考えられている。例えば、データベースに登録されたテーブルにアクセスするためのデータアクセスオブジェクト(DAO:Data Access Object)を、データベースに関する情報から自動生成する技術がある(例えば、特許文献1,2参照)。
ここで、再利用性を高めたコンポーネントを他のプログラムから利用可能にするため、これらコンポーネントをプログラム実行環境に登録することになる。しかし、コンポーネントを実際に運用可能な状態にしてシステム開発基盤を用意する作業は、多大な工数を要するという問題がある。例えば、データベースのテーブル数が多いシステムでは、DAOを登録するための工数が大きな問題となる。また、ログ出力処理や例外処理などのシステム横断的な処理を組み込むための工数も問題となる。 Here, in order to make components with improved reusability available to other programs, these components are registered in the program execution environment. However, the task of preparing a system development infrastructure in a state where components can be actually operated has a problem that it requires a great amount of man-hours. For example, in a system with a large number of database tables, the man-hour for registering DAO becomes a big problem. In addition, man-hours for incorporating cross-system processing such as log output processing and exception processing are also a problem.
本発明はこのような点に鑑みてなされたものであり、効率的なシステム開発を支援するソフトウェア開発支援プログラム、ソフトウェア開発支援装置およびソフトウェア開発支援方法を提供することを目的とする。 The present invention has been made in view of the above, and an object thereof is to provide a software development support program, a software development support apparatus, and a software development support method that support efficient system development.
上記課題を解決するために、ソフトウェア開発支援プログラムが提供される。このソフトウェア開発支援プログラムを実行するコンピュータは、データアクセス部品生成手段、アプリケーション生成手段、共通部品記憶手段および登録情報生成手段を有する。データアクセス部品生成手段は、データベースに格納された複数のテーブルの情報に基づいて、複数のテーブルそれぞれについて、アクセス要求を受け付けて該当のテーブルに対し所定の操作を行うプログラム部品であるデータアクセス部品を生成する。アプリケーション生成手段は、データアクセス部品に対してアクセス要求を行うアプリケーションプログラムを生成する。共通部品記憶手段は、所定の操作に伴って実行させる複数のデータアクセス部品の間で共通の処理を定義した共通部品を記憶する。登録情報生成手段は、データアクセス部品生成手段が生成したデータアクセス部品をプログラム実行環境に登録するための情報と、共通部品記憶手段に記憶された共通部品で定義された処理がデータアクセス部品による所定の操作の際にプログラム実行環境上で実行されるようにするための情報と、アプリケーション生成手段が生成したアプリケーションプログラムをデータアクセス部品に関連付けてプログラム実行環境に登録するための情報とを含む登録情報を生成する。
In order to solve the above problems, a software development support program is provided. A computer that executes the software development support program includes data access component generation means, application generation means, common component storage means, and registration information generation means. The data access component generation unit is configured to obtain a data access component that is a program component that receives an access request and performs a predetermined operation on the corresponding table for each of the plurality of tables based on the information of the plurality of tables stored in the database. Generate. The application generation unit generates an application program that makes an access request to the data access component. The common component storage means stores a common component that defines a common process among a plurality of data access components to be executed in accordance with a predetermined operation. The registration information generation means includes information for registering the data access component generated by the data access component generation means in the program execution environment and a process defined by the common component stored in the common component storage means. Registration information including information for executing on the program execution environment during the operation and information for registering the application program generated by the application generation means in the program execution environment in association with the data access component Is generated.
また、上記課題を解決するために、上記ソフトウェア開発支援プログラムを実行するコンピュータと同様の機能を有するソフトウェア開発支援装置が提供される。また、上記ソフトウェア開発支援プログラムにより実現される処理と同様の処理を行うソフトウェア開発支援方法が提供される。 In order to solve the above problems, a software development support apparatus having the same function as a computer that executes the software development support program is provided. Also provided is a software development support method that performs the same processing as the processing realized by the software development support program.
上記ソフトウェア開発支援プログラム、ソフトウェア開発支援装置およびソフトウェア開発支援方法によれば、効率的なシステム開発を支援することができる。 According to the software development support program, software development support apparatus, and software development support method, efficient system development can be supported.
以下、本実施の形態を図面を参照して詳細に説明する。
図1は、本実施の形態の概要を示す図である。コンピュータ1は、データベース2に登録されたテーブルにアクセスするためのプログラム部品(例えば、DAOクラス)を自動生成する。コンピュータ1は、データアクセス部品生成手段1a、共通部品記憶手段1bおよび登録情報生成手段1cを有する。
Hereinafter, the present embodiment will be described in detail with reference to the drawings.
FIG. 1 is a diagram showing an outline of the present embodiment. The
データアクセス部品生成手段1aは、データベース2に格納されたテーブル2a,2b,2cの情報に基づいて、各テーブルそれぞれについて、アクセス要求を受け付けて該当のテーブルに対し所定の操作を行うプログラム部品であるデータアクセス部品4a,4b,4cを生成する。ここで、データアクセス部品生成手段1aは、例えば、データベース2に対する所定の接続情報に基づいてデータベース2に接続し、データベース2に登録されたテーブル2a,2b,2cそれぞれのテーブル情報を取得する。そして、取得したテーブル情報からデータアクセス部品4a,4b,4cを生成する。
The data access
共通部品記憶手段1bは、所定の操作に伴って実行させるデータアクセス部品4a,4b,4cの間で共通の処理を定義した共通部品4dを記憶する。共通部品4dには、例えば、データベース2への接続処理、例外処理およびログ出力処理など、データアクセス部品4a,4b,4cの実行に必要となるコンポーネントが含まれる。
The common
登録情報生成手段1cは、データアクセス部品生成手段1aが生成したデータアクセス部品4a,4b,4cをプログラム実行環境4に登録するための情報と、共通部品記憶手段1bに記憶された共通部品4dで定義された処理がデータアクセス部品4a,4b,4cによる所定の操作の際にプログラム実行環境4上で実行されるようにするための情報とを含む登録情報3を生成する。
The registration
プログラム実行環境4は、データアクセス部品4a,4b,4cおよび共通部品4dを実行する。プログラム実行環境4は、登録情報3に基づいてデータアクセス部品4a,4b,4cと共通部品4dとを関連付ける。プログラム実行環境4は、例えば、登録情報3に基づいてデータアクセス部品4a,4b,4cの実行前後に共通部品4dを呼び出して実行する。
The program execution environment 4 executes the
このようなコンピュータ1によれば、データベース2に格納されたテーブル2a,2b,2cの情報に基づいて、テーブル2a,2b,2cに対するデータアクセス部品4a,4b,4cが生成される。そして、プログラム実行環境4がデータアクセス部品4a,4b,4cを実行する際に、共通部品記憶手段1bに記憶された共通部品4dを実行するようデータアクセス部品4a,4b,4cをプログラム実行環境4に登録するための登録情報3が生成される。
According to such a
このため、データアクセス部品4a,4b,4cを共通部品4dと関連付けるためのコーディングや登録情報3の作成に要する工数が削減される。そして、データアクセス部品4a,4b,4cを共通部品4dと共に即座に動作可能な状態とすることができる。
For this reason, the man-hour required for coding for associating the
これにより、開発者は、システム固有の業務ロジックの開発に注力することが可能となり、システム開発作業を効率的に行うことができる。
なお、データアクセス部品生成手段1aは、データアクセス部品4a,4b,4cを利用するプログラム(例えば、サンプル用の簡易なプログラム)を更に生成してもよい。このようにすると、このプログラムによるデータアクセス部品4a,4b,4cを介したテーブル2a,2b,2cへのアクセスに関する動作確認を即座に開始することができるようになる。
As a result, the developer can focus on the development of business logic unique to the system, and can efficiently perform the system development work.
The data access
ところで、コンピュータ1は、オブジェクト指向言語によるシステム開発を行う際に特に有用となる。以下では、Java(登録商標)を用いたシステム開発を例に挙げて、本実施の形態を更に詳細に説明する。
Incidentally, the
[第1の実施の形態]
図2は、第1の実施の形態のコンピュータのハードウェア構成を示す図である。コンピュータ100は、システム開発において、システム基盤となるプログラムを自動生成する。コンピュータ100は、CPU(Central Processing Unit)101によって装置全体が制御されている。CPU101には、バス107を介してRAM(Random Access Memory)102、HDDインタフェース103、グラフィック処理装置104、入力インタフェース105および通信インタフェース106が接続されている。
[First Embodiment]
FIG. 2 is a diagram illustrating a hardware configuration of the computer according to the first embodiment. The
RAM102には、CPU101に実行させるOS(Operating System)のプログラムやアプリケーションのプログラムの少なくとも一部が一時的に格納される。また、RAM102には、CPU101による処理に必要な各種データが格納される。
The
HDD103は、データを記憶するためのディスク装置である。HDD103には、OSのプログラムやアプリケーションのプログラムが格納される。また、HDD103には、CPU101による処理に必要な各種データが格納される。
The HDD 103 is a disk device for storing data. The HDD 103 stores an OS program and application programs. The HDD 103 stores various data necessary for processing by the
グラフィック処理装置104には、モニタ11が接続されている。グラフィック処理装置104は、CPU101からの命令に従って、画像をモニタ11の画面に表示させる。入力インタフェース105には、キーボード12とマウス13とが接続されている。入力インタフェース105は、キーボード12やマウス13から送られてくる信号を、バス107を介してCPU101に送信する。
A monitor 11 is connected to the
通信インタフェース106は、ネットワーク10に接続されている。通信インタフェース106は、ネットワーク10を介してDB(DataBase)サーバ200と通信を行う。
コンピュータ100は、通信インタフェース106およびDBサーバ200を介してデータベース210にアクセスする。
The
The
図3は、第1の実施の形態のコンピュータの機能を示す第1のブロック図である。コンピュータ100は、ORM(Object Relational Mapping)ファイル生成部110、ORMファイル記憶部115、ORMクラス生成部120、ORMクラス記憶部125、テンプレート記憶部130、DAOクラス生成部140、DAOクラス記憶部145、クエリ記述ファイル生成部150、クエリ記述ファイル記憶部155、共通部品記憶部160、コンテキストファイル生成部170、コンテキストファイル記憶部175、サンプルクラス生成部180およびサンプルクラス記憶部185を有する。
FIG. 3 is a first block diagram illustrating functions of the computer according to the first embodiment. The
ORMファイル生成部110は、DB接続情報20とDBサーバ200を介して取得するデータベース210のテーブル構成とに基づいてORMを実行する。ここで、ORMとは、オブジェクト指向言語で扱う「オブジェクト」のデータと「リレーショナルデータベース(RDB:Relational DB)」のレコードとを対応付けることを示す。データベース210のテーブル構成を示す情報には、例えば、DDL(Data Definition Language)がある。ORMを行うことで、業務サービスを実行するクラスからデータベース210へのテーブルアクセスを行うために必要となるコーディング作業を軽減することができる。ORMファイル生成部110は、ORMにより生成したORMファイルをORMファイル記憶部115に格納する。ORMファイル生成部110の機能を実現するアプリケーションとして、例えば、Middlegenを用いることができる。
The ORM
ORMファイル記憶部115は、ORMファイル生成部110が生成したORMファイルを記憶する。
ORMクラス生成部120は、ORMファイル記憶部115に記憶されたORMファイルに基づいてORMクラスを生成する。ORMクラスは、ORMファイルに含まれるデータをカプセル化するためのクラスである。ORMクラス生成部120は、生成したORMクラスをORMクラス記憶部125に記憶する。ORMファイル生成部110の機能を実現するアプリケーションとして、例えば、Hibernateを用いることができる。
The ORM
The ORM
ORMクラス記憶部125は、ORMクラス生成部120が生成したORMクラスを記憶する。
テンプレート記憶部130は、DAOクラス生成部140、クエリ記述ファイル生成部150、コンテキストファイル生成部170およびサンプルクラス生成部180で自動生成されるプログラムのテンプレート(雛形)を記憶する。DAOクラス生成部140、クエリ記述ファイル生成部150、コンテキストファイル生成部170およびサンプルクラス生成部180は、テンプレートエンジンなどを使用してプログラムを自動生成する。テンプレートエンジンとしては、例えば、Velocityを用いることができる。
The ORM
The
DAOクラス生成部140は、ORMクラス記憶部125に記憶されたORMクラスとテンプレート記憶部130に記憶されたDAOクラス用テンプレートとに基づいてDAOクラスを生成する。DAOクラスは、業務サービスの要求に応じてORMクラスを介してデータベース210にアクセスするためのクラスである。DAOクラス生成部140は生成したDAOクラスをDAOクラス記憶部145に格納する。
The DAO
DAOクラス記憶部145は、DAOクラス生成部140が生成したDAOクラスを記憶する。また、DAOクラス記憶部145は、汎用DAOクラスを記憶する。汎用DAOクラスは、DAOクラス生成部140が生成したDAOクラスにデータベース210のテーブルに対する基本的な操作を提供するクラスである。ここで、テーブルに対する基本的な操作とは、例えば、CRUD(Create / Read / Update / Delete)などの操作である。汎用DAOクラスに関しては、図17で詳述する。
The DAO
クエリ記述ファイル生成部150は、DAOクラス記憶部145に記憶されたDAOクラスおよびテンプレート記憶部130に記憶されたクエリ記述用テンプレートに基づいてクエリ記述ファイルを生成する。クエリ記述ファイルには、汎用DAOクラスで提供されるテーブルの基本操作以外の操作、例えば、業務処理で要求される複雑なテーブル処理のクエリを設定することができる。クエリ記述ファイル生成部150は、生成したクエリ記述ファイルをクエリ記述ファイル記憶部155に格納する。
The query description
クエリ記述ファイル記憶部155は、クエリ記述ファイル生成部150が生成したクエリ記述ファイルを記憶する。
共通部品記憶部160は、DAOクラス生成部140が生成したDAOクラスやサンプルクラス生成部180が生成したサービスの処理で共通的に利用されるコンポーネントを記憶する。このようなコンポーネントは、例えば、例外処理やログ出力などを行うコンポーネントである。また、データベース210とのコネクションを管理するコンポーネントやデータベース210に対するコミットやロールバックなどのトランザクションを管理するコンポーネントが含まれる。
The query description
The common
コンテキストファイル生成部170は、テンプレート記憶部130に記憶されたコンテキスト用テンプレートに基づいて、DAOクラス記憶部145に記憶されたDAOクラスおよび共通部品記憶部160に記憶された共通コンポーネントを登録したコンテキストファイルを生成する。コンテキストファイルは、共通コンポーネントのクラスやDAOクラスおよび後述するサンプルクラスの関連付けを定義したファイルである。コンテキストファイル生成部170は、生成したコンテキストファイルをコンテキストファイル記憶部175に格納する。
The context
コンテキストファイル記憶部175は、コンテキストファイル生成部170が生成したコンテキストファイルを記憶する。
サンプルクラス生成部180は、DAOクラス記憶部145に記憶されたDAOクラスおよびテンプレート記憶部130に記憶されたサンプルクラス用テンプレートに基づいてDAOクラスを利用するサンプルのサービスであるサンプルクラスを生成する。サンプルクラス生成部180は、生成したサンプルクラスをサンプルクラス記憶部185に格納する。
The context
The sample
サンプルクラス記憶部185は、サンプルクラス生成部180が生成したサンプルクラスを記憶する。
このように、コンピュータ100は、データベース210のテーブルにアクセスするために必要となる定義ファイル(ORMファイルやクエリ記述ファイル)、DAOクラスおよびサンプルクラスを順次生成する。
The sample
As described above, the
次に、生成されたクラスに基づいてサービスを実行する構成に関して説明する。
図4は、第1の実施の形態のコンピュータの機能を示す第2のブロック図である。コンピュータ100は、図3で示した構成に加えて、配置部190および実行部195を有する。
Next, a configuration for executing a service based on the generated class will be described.
FIG. 4 is a second block diagram illustrating functions of the computer according to the first embodiment. The
配置部190は、コンテキストファイル記憶部175に記憶されたコンテキストファイルに基づき、ORMクラス記憶部125に記憶されたORMクラス、DAOクラス記憶部145に記憶されたDAOクラス、汎用DAOクラスおよびサンプルクラス記憶部185に記憶されたサンプルクラスをメモリ上に配置する。このとき、配置部190は、各クラスで必要となる定義ファイル(ORMファイルやクエリ記述ファイル)を読み込む。更に、共通部品記憶部160に記憶された共通コンポーネントのクラスをメモリ上に配置する。
The
実行部195は、コンテキストファイルに基づき、メモリ上に配置された各クラスを関連付けてサービスを実行する。実行部195は、いわゆるコンテナである。
配置部190および実行部195の機能は、例えば、DIやAOPの手法を組み込んだSpring Frameworkと呼ばれるフレームワークを用いて実現することができる。以下では、配置部190や実行部195の機能をSpring Frameworkを用いて実現することを想定とした例を示す。
The
The functions of the
図5は、DB接続情報の例を示す図である。DB接続情報20には、ドライバクラス21、DB接続先情報22、DB接続ユーザ名23、パスワード24、マッピング対象テーブル25,26が設定されている。
FIG. 5 is a diagram illustrating an example of DB connection information. In the
ドライバクラス21には、データベース210へのアクセスに用いるJDBCドライバクラスを指定する情報(例えば、“com.mysql.jdbc.Driver”)が設定される。
DB接続先情報22には、DBサーバ200を示す接続先情報(例えば、“jdbc:mysql://database/testdb”)が設定される。
The
In the DB
DB接続ユーザ名23には、データベース210へのアクセスに用いるユーザ名を指定する情報(例えば、“jim”)が設定される。
パスワード24は、DB接続ユーザ名23に対応するパスワードを示す情報(例えば、“0123”)が設定される。
In the DB
In the
マッピング対象テーブル25,26には、ORMファイル生成部110によるORMの実行対象となるテーブル名(例えば、“Grouptbl”や“Ikisakitbl”)が設定される。
ORMファイル生成部110は、DB接続情報20に基づいて、データベース210にアクセスし、ORMを実行する。
In the mapping target tables 25 and 26, a table name (for example, “Grouptbl” or “Ikisakitbl”) to be executed by the ORM
Based on the
なお、DB接続情報20には、上記で説明した情報以外の情報を含んでいてもよい。例えば、データベースのスキーマ情報や接続先データベースのSQL方言(Dialect)を示す情報を含んでいてもよい。
The
図6は、データベースに格納されるテーブル構造の例を示す図である。テーブル211は、データベース210に格納される“Grouptbl”テーブルの構造を示している。テーブル211には、カラム名、データ型、制約および主キーを示す項目が示されている。各項目の横方向に並べられた情報同士が互いに関連付けられて、1つのカラムについての属性情報を構成する。
FIG. 6 is a diagram illustrating an example of a table structure stored in the database. The table 211 shows the structure of the “Grouptbl” table stored in the
カラム名を示す項目には、カラムの名称を示す情報が設定される。データ型を示す項目には、登録するデータの型を示す情報が設定される。制約を示す項目には、登録するデータを制御する情報が設定される。主キーを示す項目には、該当のカラムがテーブル211の主キーであるか否かを示す情報が設定される。 In the item indicating the column name, information indicating the column name is set. In the item indicating the data type, information indicating the type of data to be registered is set. Information for controlling data to be registered is set in the item indicating restriction. In the item indicating the primary key, information indicating whether or not the corresponding column is the primary key of the table 211 is set.
テーブル211には、例えば、カラム名が“GRCD”、データ型が“varchar(8)”、制約が“NOT NULL”、主キーが“○”という情報が設定される。これは、カラム名“GRCD”には、可変長文字型8桁で非“NULL”であるデータを登録可能であり、“GRCD”は主キーであることを示している。なお、主キーではないカラムである“GRNAME”や“USERID”の主キーの項目には、“−(ハイフン)”が設定されている。
In the table 211, for example, information that the column name is “GRCD”, the data type is “varchar (8)”, the constraint is “NOT NULL”, and the primary key is “◯” is set. This indicates that the column name “GRCD” can register data of variable
なお、このようなテーブル構造は、例えば、所定のDDLファイルにより記述される。
図7は、テンプレート記憶部に格納されるファイルの例を示す図である。テンプレート記憶部130には、DAOクラス用テンプレートファイル131、クエリ記述用テンプレートファイル132、コンテキスト用テンプレートファイル133およびサンプルクラス用テンプレートファイル134が記憶される。
Such a table structure is described by a predetermined DDL file, for example.
FIG. 7 is a diagram illustrating an example of a file stored in the template storage unit. The
DAOクラス用テンプレートファイル131は、DAOクラス生成部140が生成するDAOクラスの雛形である。
クエリ記述用テンプレートファイル132は、クエリ記述ファイル生成部150が生成するクエリ記述ファイルの雛形である。
The DAO
The query
コンテキスト用テンプレートファイル133は、コンテキストファイル生成部170が生成するコンテキストファイルの雛形である。
サンプルクラス用テンプレートファイル134は、サンプルクラス生成部180が生成するサービスクラスの雛形である。
The
The sample
これらのテンプレートファイルは、予めテンプレート記憶部130に格納される。
図8は、DAOクラス用テンプレートファイルの例を示す図である。DAOクラス用テンプレートファイル131は、DAOインタフェースの雛形である。DAOクラス用テンプレートファイル131は、コード131a,131b,131cを有する。DAOクラス生成部140は、コード131a,131b,131cに含まれる文字列“{0}、{1}、{2}、{3}”で示される箇所を適切な文字列で置換することによりDAOクラスのインタフェースを生成することができる。
These template files are stored in the
FIG. 8 is a diagram illustrating an example of a DAO class template file. The DAO
コード131aは、DAOクラスが所属するパッケージを指定する。DAOクラス生成部140は、文字列“{2}”をDAOクラスのパッケージ名に置換する。
コード131bは、インポートするORMクラスを指定する。DAOクラス生成部140は、文字列“{3}”をORMクラスのパッケージ名に置換し、文字列“{0}”をDAOクラスに対応するORMクラス名で置換する。
The
The
コード131cは、DAOクラスのインタフェースを定義する。DAOクラス生成部140は、文字列“0”をDAOクラスに対応するORMクラス名で置換し、文字列“{1}”を該当のORMクラスの主キークラス名で置換する。DAOクラスの名称は、例えば、ORMクラス名の後に“Dao”の文字列を付加した名称とする。
The
なお、DAOクラス生成部140が生成するDAOクラスは、インタフェースのみでよく、実装(Implement)は不要である。メソッドは、汎用DAOクラス(“GenericDao”クラス)に定義されたものを複数のDAOクラスで共通的に利用することができる。
Note that the DAO class generated by the DAO
ここで、“GenaricDao”には、ORMクラスのデータ型と該当のORMクラスに対応するテーブルの主キーの型を設定することができる。これによって、各DAOクラスに入力されるデータや主キーの型の不一致をDAOクラスの生成段階で未然に防止することができる。すなわち、DAOクラスの型安全性を確保することができる。 Here, in “GenaricDao”, the data type of the ORM class and the primary key type of the table corresponding to the corresponding ORM class can be set. As a result, it is possible to prevent inconsistency between the data input to each DAO class and the primary key type at the DAO class generation stage. That is, the DAO class type safety can be ensured.
なお、動的に変化するクエリを扱うDAOクラスの場合には、該当のDAOクラスで個別に実装クラスを作成することで対応が可能である。
図9は、クエリ記述用テンプレートファイルの例を示す図である。クエリ記述ファイル生成部150は、クエリ記述用テンプレートファイル132に記述された内容に基づいて、クエリ記述ファイルを生成する。開発者は、生成されたクエリ記述ファイルに汎用DAOクラスで定義されない複雑なテーブル操作用のクエリを業務ロジックに応じてタグ132aに記述することができる。
In the case of a DAO class that handles a dynamically changing query, it can be dealt with by creating an implementation class individually with the corresponding DAO class.
FIG. 9 is a diagram illustrating an example of a template file for query description. The query description
図10は、コンテキスト用テンプレートファイルの例を示す第1の図である。コンテキスト用テンプレートファイル133には、サービスの実行に用いる複数のビーン(Bean)が定義される。コンテキスト用テンプレートファイル133には、タグ133a,133b,133cが設けられる。
FIG. 10 is a first diagram illustrating an example of a context template file. In the
タグ133aには、“dataSourceMain”ビーンが定義される。“dataSourceMain”は、データベース210に対する接続情報を管理する。“dataSourceMain”には、例えば、DB接続情報20のドライバクラス21、DB接続先情報22、DB接続ユーザ名23およびパスワード24などの情報が設定される。
In the
タグ133bには、“sessionFactory”ビーンが定義される。“sessionFactory”は、“dataSourceMain”を参照して、データベース210の各テーブルに対する操作を行う。“sessionFactory”には、処理に必要な定義情報であるORMファイル(例えば、“(ORMクラス名).hbm.xml”のファイル名で指定される)やクエリ記述ファイル(例えば、“(ORMクラス名).hql.xml”のファイル名で指定される)が設定される。
In the
タグ133cには、“transactionManager”ビーンが定義される。“transactionManager”は、“sessionFactory”を参照して、データベース210とのトランザクションの管理を行う。ここで、トランザクションの管理とは、データベース210に対するコミットやロールバックの制御などを示す。
In the
図11は、コンテキスト用テンプレートファイルの例を示す第2の図である。コンテキスト用テンプレートファイル133には、更に、タグ133d,133e,133fが設けられる。
FIG. 11 is a second diagram illustrating an example of a context template file. The
タグ133dには、“txAttribute”ビーンが定義される。“txAttribute”は、メソッドに対するトランザクションの属性を管理する。“txAttribute”には、例えば、“read”や“get”などの文字列で始まるメソッドに対し、新たなトランザクションを開始する、読み取り専用とするなど、トランザクションを制御するための属性が定義される。
In the
タグ133eには、“txInterceptor”ビーンが定義される。“txInterceptor”は、トランザクション管理の機能を他のクラスの実行時に呼び出すためのビーンである。“txInterceptor”は、タグ133cの“transactionManager”やタグ133dの“txAttribute”を参照する。
In the tag 133e, a “txInterceptor” bean is defined. “TxInterceptor” is a bean for calling a transaction management function when another class is executed. “TxInterceptor” refers to “transactionManager” of the
タグ133fには、“applicationLoggingInterceptor”ビーンが定義される。“applicationLoggingInterceptor”は、ログ出力用の機能を他のクラスの実行時に呼び出すためのビーンである。
The
図12は、コンテキスト用テンプレートファイルの例を示す第3の図である。コンテキスト用テンプレートファイル133には、更に、タグ133g,133h,133iが設けられる。
FIG. 12 is a third diagram illustrating an example of a context template file. The
タグ133gには、“serviceThrowsAdvice”ビーンが定義される。“serviceThrowsAdvice”は、サービスクラスにおける例外処理を行う機能をサービスクラスの実行時に呼び出すためのビーンである。
In the
タグ133hには、“daoThrowsAdvice”ビーンが定義される。“daoThrowsAdvice”は、DAOクラスにおける例外処理を行う機能をDAOクラスの実行時に呼び出すためのビーンである。
In the
タグ133iには、“autoProxyCreator”ビーンが定義される。“autoProxyCreator”は、サービスクラスの実行時に、タグ133e,133f,133gで定義した各ビーンを呼び出すためのビーンである。
In the
図13は、コンテキスト用テンプレートファイルの例を示す第4の図である。コンテキスト用テンプレートファイル133には、更に、タグ133j,133k,133l,133mが設けられる。タグ133j,133k,133l,133mには、DAOクラスの実行時に共通的に呼び出されるビーンが定義される。
FIG. 13 is a fourth diagram illustrating an example of a context template file. The
タグ133jには、“finderIntroductionAdvisor”ビーンが定義される。“finderIntroductionAdvisor”は、各DAOクラスのメソッドのうち汎用DAOクラスが利用できない場合に、該当のDAOクラスに対応するクエリ記述ファイルを呼び出すためのビーンである。
In the
タグ133kには、“abstractDaoTarget”ビーンが定義される。“abstractDaoTarget”は、共通部品記憶部160に記憶された汎用DAOクラスのインスタンスを各DAOクラスで再利用可能とするためのビーンである。
An “abstractDaoTarget” bean is defined in the
タグ133lには、“abstractDao”ビーンが定義される。“abstractDao”は、各DAOクラスに“finderIntroductionAdvisor”の機能を付加するためのビーンである。
タグ133mには、“daoAutoProxyCreator”が定義される。“daoAutoProxyCreator”は、各DAOクラスの実行時に、タグ133f,133hで定義した各ビーンを呼び出すためのビーンである。
An “abstractDao” bean is defined in the tag 133l. “AbstractDao” is a bean for adding the function of “finderIntroductionAdvisor” to each DAO class.
In the
図14は、コンテキスト用テンプレートファイルの例を示す第5の図である。コンテキスト用テンプレートファイル133には、更に、タグ133n,133oが設けられる。
タグ133nには、DAOクラスのビーンが、DAOクラス毎に定義される。ビーンの識別情報を示す“bean id”には、適切な文字列が置換されて設定される。プロパティ“proxyInterfaces”には、DAOクラス記憶部145に記憶されたDAOクラスを指定する適切な文字列が置換されて設定される。また、“abstractDaoTarget”のコンストラクタに該当のDAOクラスに対応するORMクラスを設定する。
FIG. 14 is a fifth diagram illustrating an example of a context template file. The
In the
なお、タグ133nでは、実装が不要なDAOクラスのビーンを定義しているが、例えば、処理要求に応じて可変なクエリを扱う場合には実装が必要となる。この場合は、コンテキスト用テンプレートファイル133に実装が必要なDAOクラスのビーンを直接定義することが可能である。
The
タグ133oには、“sampleService”ビーンが定義される。“sampleService”は、サービスクラスのビーンである。“sampleService”には、DAOクラスを設定するためのプロパティタグが設けられており、DAOクラス毎の名称が設定される。 In the tag 133o, a “sampleService” bean is defined. “SampleService” is a bean of a service class. In “sampleService”, a property tag for setting a DAO class is provided, and a name for each DAO class is set.
図15は、サンプルクラス用テンプレートファイルの例を示す図である。サンプルクラス用テンプレートファイル134には、コード134a,134b,134cが設けられている。
FIG. 15 is a diagram illustrating an example of a sample class template file. In the sample
コード134aは、インポートするDAOクラスやORMクラスを指定する。サンプルクラス生成部180は、コード134aに全てのDAOクラスやORMクラスを示す適切な文字列を設定する。
The
コード134bは、各DAOクラスのオブジェクト変数を定義する。サンプルクラス生成部180は、コード134bに全てのDAOクラスとそのオブジェクト名とを示す適切な文字列を設定する。
The
コード134cは、定義したオブジェクト変数に関するメソッド(例えば、DIにより、DAOクラスのインスタンスへの参照を設定するためのメソッド)を定義する。サンプルクラス生成部180は、全てのオブジェクト変数に関してメソッドを定義する。
The
図16は、共通部品記憶部に格納されるファイルの例を示す図である。共通部品記憶部160には、各クラスで再利用可能なコンポーネントのファイルが記憶される。共通部品記憶部160は、DBコネクション管理用クラス161、DBトランザクション管理用クラス162、ログ出力用クラス163および例外処理用クラス164が記憶される。
FIG. 16 is a diagram illustrating an example of a file stored in the common component storage unit. The common
DBコネクション管理用クラス161は、データベース接続用のクラスである。DBコネクション管理用クラス161には、例えば、コンテキスト用テンプレートファイル133のタグ133aの“dataSourceMain”ビーンやタグ133bの“sessionFactory”ビーンなどのクラスが含まれる。
The DB
DBトランザクション管理用クラス162は、データベースに対するコミットやロールバックなどのトランザクションを管理するためのクラスである。DBトランザクション管理用クラス162には、例えば、コンテキスト用テンプレートファイル133のタグ133cの“transactionManager”ビーン、タグ133dの“txAttribute”ビーンおよびタグ133eの“txInterceptor”ビーンなどのクラスが含まれる。
The DB
ログ出力用クラス163は、ログを出力するためのクラスである。ログ出力用クラス163には、例えば、コンテキスト用テンプレートファイル133のタグ133fの“applicationLoggingInterceptor”ビーンのクラスが含まれる。
The
例外処理用クラス164は、実行時の例外処理用のクラスである。例外処理用クラス164には、例えば、コンテキスト用テンプレートファイル133のタグ133gの“serviceThrowsAdvice”ビーンやタグ133hの“daoThrowsAdvice”ビーンなどのクラスが含まれる。
The
図17は、汎用DAOクラスの例を示す図である。汎用DAOクラス145aは、DAOクラス記憶部145に予め格納される。汎用DAOクラス145aは、複数のDAOクラスで共通的に利用される主要な機能を定義する。汎用DAOクラス145aには、例えば、CRUDの処理や排他有主キー検索および排他開放待ち無主キー検索が定義される。
FIG. 17 is a diagram illustrating an example of a general-purpose DAO class. The general-
ここで、排他有主キー検索とは、データをロックして主キー検索を行う機能である。
また、排他無主キー検索も同様にデータをロックして主キー検索を行う機能である。但し、排他無主キー検索では、該当のデータが他の処理で既にロックされている場合、ロックの開放を待たずに例外処理を行う。
Here, the exclusive primary key search is a function for performing primary key search by locking data.
Similarly, the exclusive non-primary key search is a function for locking the data and performing the primary key search. However, in the exclusive primary key search, if the corresponding data is already locked by another process, exception processing is performed without waiting for the lock to be released.
このように、各DAOクラスにおいて、データベース210に対するこれらの処理を行う場合には、汎用DAOクラス145aに定義された機能を用いて処理を実行させることで、各DAOクラスで実装を不要とすることができる。
As described above, when each processing is performed on the
次に、以上のような構成を備えるコンピュータ100において実行される処理の詳細を説明する。
図18は、第1の実施の形態のプログラム生成処理の手順を示すフローチャートである。以下、図18に示す処理をステップ番号に沿って説明する。
Next, details of processing executed in the
FIG. 18 is a flowchart illustrating the procedure of the program generation process according to the first embodiment. In the following, the process illustrated in FIG. 18 will be described in order of step number.
[ステップS1]ORMファイル生成部110は、DB接続情報およびデータベース210のテーブル構造に基づいてORMを実行し、ORMファイルを生成する。ORMファイル生成部110は、生成したORMファイルをORMファイル記憶部115に格納する。
[Step S1] The ORM
[ステップS2]ORMクラス生成部120は、ORMファイル記憶部115に記憶されたORMファイルに基づいて、データベース210の各テーブルに値を格納または、各テーブルから値を読み出すためのORMクラスを生成する。ORMクラス生成部120は、生成したORMクラスをORMクラス記憶部125に格納する。
[Step S2] The ORM
[ステップS3]DAOクラス生成部140は、テンプレート記憶部130に記憶されたDAOクラス用テンプレートファイル131とORMクラス記憶部125に記憶されたORMクラスの名称とに基づいて、DAOクラスを生成する。DAOクラス生成部140は、生成したDAOクラスをDAOクラス記憶部145に格納する。
[Step S <b> 3] The DAO
[ステップS4]クエリ記述ファイル生成部150は、テンプレート記憶部130に記憶されたクエリ記述用テンプレートファイル132とDAOクラス記憶部145に記憶されたDAOクラスの名称とに基づいて、クエリ記述ファイルを生成する。クエリ記述ファイル生成部150は、生成したクエリ記述ファイルをクエリ記述ファイル記憶部155に格納する。
[Step S <b> 4] The query description
[ステップS5]コンテキストファイル生成部170は、テンプレート記憶部130に記憶されたコンテキスト用テンプレートファイル133とDAOクラス記憶部145に記憶されたDAOクラスの名称とに基づいて、コンテキストファイルを生成する。コンテキストファイル生成部170は、生成したコンテキストファイル記憶部175に格納する。
[Step S <b> 5] The context
[ステップS6]サンプルクラス生成部180は、テンプレート記憶部130に記憶されたサンプルクラス用テンプレートファイル134とDAOクラス記憶部145に記憶されたDAOクラスの名称とに基づいて、サンプルのアプリケーションであるサンプルクラスを生成する。サンプルクラス生成部180は、生成したサンプルクラスをサンプルクラス記憶部185に格納する。
[Step S6] The sample
[ステップS7]配置部190は、コンテキストファイル記憶部175に記憶されたコンテキストファイルに基づいて、DAOクラス、サンプルクラスおよび共通コンポーネントなどの各クラスをメモリ上に配置する。実行部195は、コンテキストファイルに基づいて、配置部190が配置したクラス間の関連付けを行い、サンプルクラスを実行する。
[Step S7] The
このようにして、DAOクラスやサンプルクラスが自動生成される。このとき、実行時に必要となるデータベース210への接続、トランザクションの管理、ログ出力および例外処理の機能が予め用意され、各クラスの実行時に自動的に呼び出されるよう構成される。このため、開発者は、これらの機能を呼び出すためのコーディングをDAOクラス毎に行う必要がなくなる。これにより、アプリケーションが扱うテーブルが多数存在する場合でも、これら機能を組み込むための工数を削減することができる。また、生成した各クラスを実行環境に登録するためのコンテキストファイルを作成する工数を削減することができる。
In this way, DAO classes and sample classes are automatically generated. At this time, functions such as connection to the
次に、上記処理手順の各ステップにおける処理の手順を更に詳しく説明する。
図19は、第1の実施の形態のORMファイル生成処理の手順を示すフローチャートである。以下、図19に示す処理をステップ番号に沿って説明する。なお、以下の処理は、上記ステップS1の処理を詳細に説明したものである。
Next, the processing procedure in each step of the above processing procedure will be described in more detail.
FIG. 19 is a flowchart illustrating a procedure of ORM file generation processing according to the first embodiment. In the following, the process illustrated in FIG. 19 will be described in order of step number. The following process describes the process of step S1 in detail.
[ステップS11]ORMファイル生成部110は、DB接続情報20に設定された情報に基づいて、データベース210に接続する。
[ステップS12]ORMファイル生成部110は、DB接続情報20に設定されたORMの対象テーブルからORMファイル未作成のテーブル情報(例えば、DDL)を1つ取得して、データベース210における該当のテーブル情報を参照する。
[Step S11] The ORM
[Step S12] The ORM
[ステップS13]ORMファイル生成部110は、参照したテーブル情報に含まれるカラムの情報を抽出する。
[ステップS14]ORMファイル生成部110は、参照したテーブル情報に含まれる全てのカラムの情報を抽出したか否かを判定する。全てのカラムの情報を抽出済みの場合、処理がステップS15に移される。未抽出のカラムが存在する場合、処理がステップS13に移される。
[Step S13] The ORM
[Step S14] The ORM
[ステップS15]ORMファイル生成部110は、抽出したカラムの情報に基づいて、ORMファイルを生成し、ORMファイル記憶部115に出力する。
[ステップS16]ORMファイル生成部110は、DB接続情報20に設定された全てのテーブルに関してORMファイルを生成済みであるか否かを判定する。全てのテーブルに関してORMファイルを生成済みである場合、処理が完了する。ORMファイルを未生成のテーブルが存在する場合、処理がステップS12に移される。
[Step S15] The ORM
[Step S <b> 16] The ORM
このようにして、データベース210に存在する各テーブルのカラムが参照され、それぞれのカラムの情報が、テーブル毎に生成されるORMファイルにマッピングされる。ORMファイルのファイル形式は、例えば、xml形式である。
In this way, the columns of each table existing in the
図20は、第1の実施の形態のORMクラス生成処理の手順を示すフローチャートである。以下、図20に示す処理をステップ番号に沿って説明する。なお、以下の処理は、上記ステップS2の処理を詳細に説明したものである。 FIG. 20 is a flowchart illustrating a procedure of ORM class generation processing according to the first embodiment. In the following, the process illustrated in FIG. 20 will be described in order of step number. The following process describes the process in step S2 in detail.
[ステップS21]ORMクラス生成部120は、ORMファイル記憶部115に記憶されたORMファイルのうち、未処理のORMファイルを1つ取得する。
[ステップS22]ORMクラス生成部120は、ORMファイルに設定されたカラムのうち未処理のカラムを1つ抽出する。
[Step S21] The ORM
[Step S22] The ORM
[ステップS23]ORMクラス生成部120は、抽出したカラムの属性を取得し、該当のカラムの属性情報を生成する。
[ステップS24]ORMクラス生成部120は、抽出したカラムに設定された情報を取得するためのGetterメソッドを生成する。
[Step S23] The ORM
[Step S24] The ORM
[ステップS25]ORMクラス生成部120は、抽出したカラムに情報を設定するためのSetterメソッドを生成する。
[ステップS26]ORMクラス生成部120は、ORMファイルに含まれる全てのカラムに関して、属性情報、GetterメソッドおよびSetterメソッドを生成済みであるか否かを判定する。全てのカラムに関して処理済みである場合、処理がステップS27に移される。未処理のカラムが存在する場合、処理がステップS22に移される。
[Step S25] The
[Step S26] The ORM
[ステップS27]ORMクラス生成部120は、生成したカラムの属性情報、GetterメソッドおよびSetterメソッドを設定したORMクラスをORMクラス記憶部125に出力する。
[Step S <b> 27] The ORM
[ステップS28]ORMクラス生成部120は、全てのORMファイルについてORMクラスを生成したか否かを判定する。全てのORMファイルについてORMクラスを生成した場合、処理が完了する。ORMクラスを未生成のORMファイルが存在する場合、処理がステップS21に移される。
[Step S28] The ORM
このようにして、各ORMファイルに対するORMクラスが生成される。
図21は、第1の実施の形態のDAOクラス生成処理の手順を示すフローチャートである。以下、図21に示す処理をステップ番号に沿って説明する。なお、以下の処理は、上記ステップS3の処理を詳細に説明したものである。
In this way, an ORM class for each ORM file is generated.
FIG. 21 is a flowchart illustrating a procedure of DAO class generation processing according to the first embodiment. In the following, the process illustrated in FIG. 21 will be described in order of step number. Note that the following processing describes the processing in step S3 in detail.
[ステップS31]DAOクラス生成部140は、ORMクラス記憶部125に記憶されたORMクラスのファイルリストを取得する。
[ステップS32]DAOクラス生成部140は、取得したファイルリストから未処理のORMクラスを1つ取得する。
[Step S31] The DAO
[Step S32] The DAO
[ステップS33]DAOクラス生成部140は、ORMクラスのソースコードを参照する。
[ステップS34]DAOクラス生成部140は、参照したソースコードからORMクラスの名称を抽出する。具体的には、例えば参照したソースコードに含まれる各行について、行頭の“public class”の文字列の後に続いて定義されるクラス名を抽出する。
[Step S33] The DAO
[Step S34] The DAO
[ステップS35]DAOクラス生成部140は、該当のORMクラスに含まれる主キークラス名を抽出する。具体的には、例えば参照したソースコードに含まれる各行について、最初に現れる行頭の“private”の文字列の後に続いて定義されるクラス名を抽出する。
[Step S35] The DAO
[ステップS36]DAOクラス生成部140は、テンプレート記憶部130に記憶されたDAOクラス用テンプレートファイル131を読み込む。
[ステップS37]DAOクラス生成部140は、DAOクラス用テンプレートファイル131に取得した情報を設定する。具体的には、DAOクラス用テンプレートファイル131の文字列“{0}”を上記ステップS34で取得したORMクラス名に置換する。同様に、文字列“{1}”を上記ステップS35で取得した主キークラス名に置換する。また、文字列“{2}”をDAOのパッケージ名に置換し、文字列“{3}”をORMのパッケージ名に置換する。
[Step S <b> 36] The DAO
[Step S37] The DAO
[ステップS38]DAOクラス生成部140は、DAOクラス用テンプレートファイル131を置換して生成したDAOクラスをDAOクラス記憶部145に出力する。
[ステップS39]DAOクラス生成部140は、ファイルリストに含まれる全てのORMクラスに関して、DAOクラスを生成済みであるか否かを判定する。全てのORMクラスに関してDAOクラスを生成済みである場合、処理が完了する。DAOクラスを未生成のORMクラスが存在する場合、処理がステップS32に移される。
[Step S38] The DAO
[Step S39] The DAO
このようにして、各ORMクラスに対するDAOクラスが生成される。
図22は、第1の実施の形態のクエリ記述ファイル生成処理の手順を示すフローチャートである。以下、図22に示す処理をステップ番号に沿って説明する。なお、以下の処理は、上記ステップS4の処理を詳細に説明したものである。
In this way, a DAO class for each ORM class is generated.
FIG. 22 is a flowchart illustrating a procedure of query description file generation processing according to the first embodiment. In the following, the process illustrated in FIG. 22 will be described in order of step number. The following process describes the process of step S4 in detail.
[ステップS41]クエリ記述ファイル生成部150は、DAOクラス記憶部125に記憶されたDAOクラスのファイルリストを取得する。
[ステップS42]クエリ記述ファイル生成部150は、取得したファイルリストから未処理のDAOクラスを1つ取得する。
[Step S41] The query description
[Step S42] The query description
[ステップS43]クエリ記述ファイル生成部150は、DAOクラスのファイル名からORMクラス名を取得する。
[ステップS44]クエリ記述ファイル生成部150は、テンプレート記憶部130に記憶されたクエリ記述用テンプレートファイル132を読み込む。
[Step S43] The query description
[Step S44] The query description
[ステップS45]クエリ記述ファイル生成部150は、クエリ記述用テンプレートファイル132に記述された内容を複製してORMクラス名に対応付けたクエリ記述用ファイルを生成し、クエリ記述ファイル記憶部155に出力する。
[Step S45] The query description
[ステップS46]クエリ記述ファイル生成部150は、ファイルリストに存在する全てのDAOクラスに関してクエリ記述ファイルを生成したか否かを判定する。全てのDAOクラスに関してクエリ記述ファイルを生成した場合、処理が完了する。クエリ記述ファイルを未生成のDAOクラスが存在する場合、処理がステップS42に移される。
[Step S46] The query description
このようにして、各DAOクラスについてクエリ記述ファイルが生成される。
図23は、第1の実施の形態のコンテキストファイル生成処理の手順を示すフローチャートである。以下、図23に示す処理をステップ番号に沿って説明する。なお、以下の処理は、上記ステップS5の処理を詳細に説明したものである。
In this way, a query description file is generated for each DAO class.
FIG. 23 is a flowchart illustrating a procedure of context file generation processing according to the first embodiment. In the following, the process illustrated in FIG. 23 will be described in order of step number. The following process describes the process in step S5 in detail.
[ステップS51]コンテキストファイル生成部170は、DAOクラス記憶部125に記憶されたDAOクラスのファイルリストを取得する。
[ステップS52]コンテキストファイル生成部170は、取得したファイルリストから未取得のDAOクラスを1つ取得する。
[Step S <b> 51] The context
[Step S52] The context
[ステップS53]コンテキストファイル生成部170は、DAOクラスのファイル名からORMクラス名とDAOクラス名とを取得する。
[ステップS54]コンテキストファイル生成部170は、取得したファイルリストに含まれる全DAOクラスについてORMクラス名とDAOクラス名とを取得済みか否かを判定する。取得済みである場合、処理がステップS55に移される。未取得のDAOクラスが存在する場合、処理がステップS52に移される。
[Step S53] The context
[Step S54] The context
[ステップS55]コンテキストファイル生成部170は、テンプレート記憶部130に記憶されたコンテキスト用テンプレートファイル133を読み込む。
[ステップS56]コンテキストファイル生成部170は、タグ133aで定義されるビーンである“dataSourceMain”にDB接続パラメタを設定する。
[Step S <b> 55] The context
[Step S56] The context
[ステップS57]コンテキストファイル生成部170は、タグ133bで定義されるビーンである“sessionFactory”に、上記ステップS52〜S54で取得したORMクラス名に対応するORMファイルおよびクエリ記述ファイルを設定する。
[Step S57] The context
[ステップS58]コンテキストファイル生成部170は、タグ133nで定義されるDAOクラスのビーンに、上記ステップS52〜S54で取得した各ORMクラス名および各DAOクラス名を設定する。
[Step S58] The context
[ステップS59]コンテキストファイル生成部170は、タグ133oで定義されるサンプルのサービスクラスのビーンである“sampleService”タグに上記ステップS52〜S54で取得したDAOクラス名を設定する。
[Step S59] The context
[ステップS60]コンテキストファイル生成部170は、コンテキスト用テンプレートファイル133に基づいて生成したコンテキストファイルをコンテキストファイル記憶部175に出力し、処理が完了する。
[Step S60] The context
このようにして、コンテキスト用テンプレートファイル133のデータベース210への接続やサンプルクラスのビーンの定義情報にORMクラスやDAOクラスを自動的に設定する。また、コンテキスト用テンプレートファイル133には、共通コンポーネントであるトランザクション管理用のクラスやログ出力用のクラスなどが予め設定される。
In this manner, the ORM class and the DAO class are automatically set in the connection information of the
図24は、第1の実施の形態のサンプルアプリケーション生成処理の手順を示すフローチャートである。以下、図24に示す処理をステップ番号に沿って説明する。なお、以下の処理は、上記ステップS6の処理を詳細に説明したものである。 FIG. 24 is a flowchart illustrating a procedure of sample application generation processing according to the first embodiment. In the following, the process illustrated in FIG. 24 will be described in order of step number. In addition, the following process explains the process of said step S6 in detail.
[ステップS61]サンプルクラス生成部180は、DAOクラス記憶部125に記憶されたDAOクラスのファイルリストを取得する。
[ステップS62]サンプルクラス生成部180は、取得したファイルリストから未取得のDAOクラスを1つ取得する。
[Step S61] The sample
[Step S62] The sample
[ステップS63]サンプルクラス生成部180は、DAOクラスのファイル名からORMクラス名とDAOクラス名とを取得する。
[ステップS64]サンプルクラス生成部180は、取得したファイルリストに含まれる全DAOクラスについてORMクラス名とDAOクラス名とを取得済みか否かを判定する。取得済みである場合、処理がステップS65に移される。未取得のDAOクラスが存在する場合、処理がステップS62に移される。
[Step S63] The sample
[Step S64] The sample
[ステップS65]サンプルクラス生成部180は、テンプレート記憶部130に記憶されたサンプルクラス用テンプレートファイル134を読み込む。
[ステップS66]サンプルクラス生成部180は、サンプルクラス用テンプレートファイル134に、上記ステップS62〜S64で取得したORMクラスやDAOクラスのメソッドを追加し、サンプルのアプリケーションであるサンプルクラスを生成する。
[Step S65] The sample
[Step S66] The sample
[ステップS67]サンプルクラス生成部180は、生成したサンプルクラスをサンプルクラス記憶部185に出力し、処理が完了する。
このようにして、サンプルクラス用テンプレートファイル134に自動的にORMクラス名やDAOクラス名が設定されてサンプルクラスが生成される。生成されたサンプルクラスは、コンテキストファイルに含まれる全てのDAOクラスの定義に対して矛盾なく動作可能であるため、サンプルクラスを用いて即座にデータベース210に対するアクセス処理の動作確認を行うことができる。また、実際の業務サービスを作成する場合には、コンテキストファイルと矛盾無く生成されたサンプルクラスを複写して利用することができるので、効率良くコーディング作業を行うことができる。
[Step S67] The sample
In this way, the ORM class name and DAO class name are automatically set in the sample
図25は、第1の実施の形態のサンプルアプリケーション実行処理の手順を示すフローチャートである。なお、サンプルのアプリケーションとは、DAOクラスとそれを用いるサンプルクラスとを実行部195により関連付けて、サンプルクラスの一連の処理を実行可能としたものである。以下、図25に示す処理をステップ番号に沿って説明する。なお、以下の処理は、上記ステップS7の処理を詳細に説明したものである。
FIG. 25 is a flowchart illustrating a procedure of sample application execution processing according to the first embodiment. The sample application associates the DAO class and the sample class using the DAO class by the
[ステップS71]配置部190は、コンテキストファイル記憶部175に記憶されたコンテキストファイルを読み込む。
[ステップS72]配置部190は、コンテキストファイルの内容に基づいて、ORMクラス記憶部125に記憶されたORMクラス、DAOクラス記憶部145に記憶されたDAOクラスおよびサンプルクラス記憶部185に記憶されたサンプルクラスをメモリ上に配置する。実行部195は、配置部190がメモリ上に配置した各クラスや共通コンポーネントのクラスの関連付けを行い、サンプルのアプリケーションが稼動状態となる。
[Step S71] The
[Step S72] The
[ステップS73]実行部195は、サンプルクラスがデータベース210に対する処理要求を受け付けたか否かを判定する。受け付けた場合、処理がステップS74に移される。受け付けていない場合、処理がステップS78に移される。
[Step S <b> 73] The
[ステップS74]実行部195は、処理要求の内容に応じてSQL文を生成する。このとき、テーブルに対する単純なCRUDなどの処理に関しては、汎用DAOクラス145aに基づいてSQL文を生成する。また、汎用DAOクラスでサポートされない複雑なクエリに関しては、該当のDAOクラスに対するクエリ記述ファイルに基づいてSQL文を生成する。
[Step S74] The
[ステップS75]実行部195は、DAOクラスおよびORMクラスを介してデータベース210における処理対象のテーブルに接続する。
[ステップS76]実行部195は、上記ステップS74で生成したSQL文に基づいてテーブルに対する処理を実行する。
[Step S75] The
[Step S76] The
[ステップS77]実行部195は、サンプルクラスがORMクラスおよびDAOクラスを介して処理結果の応答を受け付けると、処理要求に基づく一連の処理が完了したことを認識し、処理がステップS73に移される。
[Step S77] When the sample class receives a response of the processing result via the ORM class and the DAO class, the
[ステップS78]実行部195は、サンプルのアプリケーションの終了要求を受け付けたか否かを判定する。受け付けた場合、処理が完了する。受け付けていない場合、処理がステップS73に移される。
[Step S78] The
このようにして、生成された各クラスに基づいてサンプルのアプリケーションが実行される。各クラスの処理に必要な機能は、実行部195によって呼び出され、各クラスの実行時に付加される。また、処理要求に応じたSQL文が生成されてデータベース210の各テーブルに対する処理が実行される。
In this way, a sample application is executed based on each generated class. Functions necessary for the processing of each class are called by the
図26は、テンプレートから生成されるファイルの一覧の例を示す図である。このリストは、コンピュータ100により生成されるファイルの一覧を示している。リスト中に示される生成ファイルは、DB接続情報20のマッピング対象テーブルに、“Grouptbl”および“Ikisakitbl”を指定した場合の例である。
FIG. 26 is a diagram illustrating an example of a list of files generated from a template. This list shows a list of files generated by the
ORMファイル生成部110は、ORMファイルとして“Grouptbl.hbm.xml”および“Ikisakitbl.hbm.xml”を生成する。
ORMクラス生成部120はORMクラスとして、“Grouptbl.java”および“Ikisakitbl.java”を生成する。
The ORM
The ORM
DAOクラス生成部140は、DAOクラス用テンプレートファイル131である“TemplateDAO.java”に基づいて、DAOクラス“GrouptblDAO.java”および“IkisakitblDAO.java”を生成する。
The DAO
クエリ記述ファイル生成部150は、クエリ記述用テンプレートファイル132である“template.hql.xml.vm”に基づいて、クエリ記述ファイル“Grouptbl.hql.xml”および“Ikisakitbl.hql.xml”を生成する。
The query description
コンテキストファイル生成部170は、コンテキスト用テンプレートファイル133である“template-application-context.vm”に基づいて、コンテキストファイル“sample-application-context.xml”を生成する。
The context
サンプルクラス生成部180は、サンプルクラス用テンプレートファイル134である“SampleServiceImpl.java.vm”に基づいて、サンプルクラス“SampleServiceImpl.java”を生成する。
The sample
図27は、生成されたORMファイルの例を示す図である。ORMファイル115aは、“Grouptbl.hbm.xml”の例を示している。ORMファイル115aでは、各テーブルのカラムの属性情報が設定される。
FIG. 27 is a diagram illustrating an example of the generated ORM file. The
図28は、生成されたORMクラスの例を示す図である。ORMクラス125aは、“Grouptbl.java”の例を示している。ORMクラス125aでは、ORMファイル115aに設定された各カラムの属性情報と、GetterメソッドやSetterメソッドが定義される。
FIG. 28 is a diagram illustrating an example of the generated ORM class. The
図29は、生成されたDAOクラスの例を示す図である。DAOクラス145aは、“GrouptblDAO.java”の例を示している。DAOクラス145aは、DAOクラス用テンプレートファイル131のコード131a,131b,131cに含まれる“{0}、{1}、{2}、{3}”が適切な文字列に置換されて生成されたものである。
FIG. 29 is a diagram illustrating an example of the generated DAO class. The
図30は、生成されたクエリ記述ファイルの例を示す図である。クエリ記述ファイル155aは、“Grouptbl.hql.xml”の例を示している。クエリ記述ファイル155aには、クエリ記述用テンプレートファイル132に記述された内容が設定される。クエリ記述ファイル155aには、汎用DAOクラス145aで実行可能な処理以外の業務処理に応じたクエリを記述することができる。
FIG. 30 is a diagram illustrating an example of the generated query description file. The
図31は、生成されたコンテキストファイルの例を示す第1の図である。コンテキストファイル175aは、“sample-application-context.xml”の例を示している。コンテキストファイル175aは、コンテキスト用テンプレートファイル133に基づいて生成される。なお、コンテキストファイル175aでは、コンテキスト用テンプレートファイル133においてDB接続情報20で設定したマッピング対象テーブルに応じて設定が挿入されるタグ133a,133bに対応する箇所のみを示している。
FIG. 31 is a first diagram illustrating an example of the generated context file. The
図32は、生成されたコンテキストファイルの例を示す第2の図である。コンテキストファイル175aには、更に、コンテキスト用テンプレートファイル133のタグ133n,133oに対応する箇所にDAOクラスの情報が設定される。
FIG. 32 is a second diagram illustrating an example of the generated context file. In the
図33は、生成されたサンプルクラスの例を示す図である。サンプルクラス185aは、“SampleServiceImpl.java”の例を示している。サンプルクラス生成部180は、サンプルクラス用テンプレートファイル134のコード134a,134b,134cをORMクラス名およびDAOクラス名により置換することで、サンプルクラス185aを生成する。
FIG. 33 is a diagram illustrating an example of the generated sample class. The
このように、各クラスがデータベースへの接続情報とテーブルの選択のみで自動的に生成される。サンプルクラス185aは、コンテキストファイル175aに含まれる全てのDAOクラスの定義に対して矛盾なく動作可能である。このため、サンプルクラス185aを用いて即座にデータベース210に対する処理の動作確認を行うことができる。また、実際の業務サービスを作成する際には、サンプルクラス185aを複写して利用することで、コンテキストファイル175aにおけるDAOクラスの設定に対して矛盾が生じないため、効率良くコーディング作業を行うことができる。
In this way, each class is automatically generated only by selecting database connection information and tables. The
以下では、生成されたクラスファイルの実行時の関連性を詳しく説明する。以下の説明では、生成されたクラスファイルを業務サービスを提供するWebアプリケーションとしてアプリケーションサーバ上で動作させる場合を例に挙げて説明する。 In the following, the relevance at the time of execution of the generated class file will be described in detail. In the following description, a case where the generated class file is operated on an application server as a Web application that provides a business service will be described as an example.
図34は、Webシステムの構成を示す図である。このWebシステムは、端末装置50、DBサーバ200、データベース210およびアプリケーションサーバ300を有する。
FIG. 34 is a diagram showing a configuration of a Web system. This Web system includes a
端末装置50は、ユーザが利用する情報処理装置である。ユーザは、端末装置50の画面に出力されるブラウザを操作してアプリケーションサーバ300に対する処理要求を入力することができる。
The
DBサーバ200は、データベース210をアプリケーションサーバ300からの要求に応じて操作するサーバである。
アプリケーションサーバ300は、端末装置50から受け付けた処理要求に応じてSQL文を生成し、DBサーバ200にデータベース210の操作を依頼する。アプリケーションサーバ300は、処理の役割に応じた3つの層(レイヤ)を有する。具体的には、Web層310、サービス層320およびデータアクセス層330である。
The
The
Web層310は、端末装置50のブラウザを介して業務サービスに対する処理要求を受け付ける。Web層310は、Web層コンポーネント311を有する。
Web層コンポーネント311は、業務サービスの端末装置50に対するインタフェースである。Web層コンポーネント311は、端末装置50からの業務サービスに対する処理要求を受け付けてサービスクラス321に出力する。また、Web層コンポーネント311は、サービスクラス321から業務サービスに対する処理要求の結果を受け付けて端末装置50のブラウザに応答する。
The
The
サービス層320は、業務ロジックを実行するための層である。サービス層320は、サービスクラス321を有する。
サービスクラス321は、Web層コンポーネント311からの業務処理要求に基づいて、業務処理を実行する。サービスクラス321は、業務処理要求に応じたテーブル操作をDAOクラス331に依頼する。また、サービスクラス321は、DAOクラス331がORMクラス332によってカプセル化したデータを受け付け、業務処理を実行する。更に、サービスクラス321は、処理後のデータをORMクラス332によってカプセル化して、DAOクラス331に出力すると共に、データベース210のテーブル操作を依頼する。
The
The
サービスクラス321は、例えば、上述のサンプルクラス185aに対応する。
データアクセス層330は、データベース210にアクセスするための層である。データアクセス層330は、DAOクラス331およびORMクラス332を有する。
The
The
DAOクラス331は、サービスクラス321からのテーブル操作依頼に基づいてデータベース210上のテーブルを操作するためのSQL文を生成し、DBサーバ200に送信する。そして、DAOクラス331は、例えば、DBサーバ200からデータの取得結果を取得すると、ORMクラス332によって取得したデータをカプセル化してサービスクラス321に出力する。
The
DAOクラス331は、例えば、上述のDAOクラス145aに対応する。また、ORMクラス332は、例えば、ORMクラス125aに対応する。
ここで、サービスクラス321、DAOクラス331およびORMクラス332は、コンテナ350上で実行される。
The
Here, the
コンテナ350は、DIやAOPの手法を組み込んだ各クラスの実行環境である。コンテナ350は、各クラス間の関連付けを行う。コンテナ350は、必要に応じて各クラスで共通的に利用可能なコンポーネントを共通部品記憶部340から呼び出し、各クラスの呼び出し前後にその機能を付加したり、各クラスから他のクラスを参照したりすることを可能とする。例えば、コンテナ350は、サービスクラス321の実行時に、DBサーバ200との接続処理、ログ出力処理および例外処理などのコンポーネントを実行し、これらの機能をサービスクラス321に付加する。同様に、DAOクラス331の実行時に、ログ出力処理や例外処理などのコンポーネントを実行し、これらの機能をDAOクラス331に付加する。コンテナ350は、実行部195に対応する。
The
図35は、コンテナによるオブジェクト間の関連付けを示す図である。コンテナ350では、各オブジェクトがコンテキスト情報354に基づいて関連付けられる。例えば、コンテナ350上では、コンテキスト情報354に基づいて、オブジェクト351,352,353が生成される。そして、コンテキスト情報354に基づいて、例えば、オブジェクト351からオブジェクト352,353への参照や呼び出しが行われる。コンテキスト情報354は、コンテキストファイル175aに対応する。
FIG. 35 is a diagram illustrating association between objects by containers. In the
このようにして、サービスクラス321、DAOクラス331、ORMクラス332および共通コンポーネントのクラスの間の関連付けが行われる。
以上、説明したようにコンピュータ100によれば、データベース210に格納された複数のテーブルの情報に基づいて、各テーブルに対応するORMクラス、DAOクラスがそれぞれ自動生成される。また、生成された各クラスと各クラスで共通的に利用される共通のコンポーネントとの関連付けを定義したコンテキストファイルが自動的に生成される。このため、各クラスと共通コンポーネントとを関連付けるためのコーディングを削減することができ、DAOクラスの生成後に実行可能とするまでに要していた工数が削減される。これにより、開発者は、システム固有の業務ロジックの開発に注力することが可能となり、システム開発作業を効率的に行うことができる。
In this manner, the association among the
As described above, according to the
また、コンピュータ100は、生成したDAOクラスを利用するサンプルクラスを自動生成し、サンプルクラスをコンテキストファイルに設定する。開発者は、このサンプルクラスを利用することで、生成したDAOクラスを介したデータベース210のテーブルアクセスを伴う処理の動作確認を即座に開始することができる。
Further, the
[第2の実施の形態]
次に、第2の実施の形態を図面を参照して詳細に説明する。前述の第1の実施の形態との相違点を中心に説明し、同様の事項については説明を省略する。
[Second Embodiment]
Next, a second embodiment will be described in detail with reference to the drawings. Differences from the first embodiment will be mainly described, and description of similar matters will be omitted.
第1の実施の形態では、データベース210が既に構築済みの場合の例を示した。これに対し、第2の実施の形態では、データベース210に新規にテーブルを構築する場合に関して説明する。
In the first embodiment, an example in which the
第2の実施の形態のコンピュータのハードウェア構成は、図2に示す第1の実施の形態のコンピュータ100のハードウェア構成と同一のため、説明を省略する。
図36は、第2の実施の形態のコンピュータの機能を示すブロック図である。コンピュータ100aは、ORMファイル取得部110a、ORMファイル記憶部115、DDLファイル生成部116、ORMクラス生成部120、ORMクラス記憶部125、テンプレート記憶部130、DAOクラス生成部140、DAOクラス記憶部145、クエリ記述ファイル生成部150、クエリ記述ファイル記憶部155、共通部品記憶部160、コンテキストファイル生成部170、コンテキストファイル記憶部175、サンプルクラス生成部180およびサンプルクラス記憶部185を有する。なお、ORMファイル取得部110aおよびDDLファイル生成部116以外の構成(配置部190および実行部195を含む)に関しては、第1の実施の形態のコンピュータ100の構成と同一のため、説明を省略する。
The hardware configuration of the computer according to the second embodiment is the same as the hardware configuration of the
FIG. 36 is a block diagram illustrating functions of a computer according to the second embodiment. The
ORMファイル取得部110aは、ORMファイル20aを取得する。ORMファイル20aは、データベース210に格納する新規テーブル毎に、開発者により予め作成される。ORMファイル取得部110aは、取得したORMファイル20aをORMファイル記憶部115に格納する。
The ORM
DDLファイル生成部116は、ORファイル記憶部115に記憶されたORMファイルを取得する。そして、DDLファイル生成部116は、生成したDDLファイルをDBサーバ200に送信する。DBサーバ200は、取得したDDLファイルに基づいてデータベース210に新たなテーブルを構築する。DDLファイル生成部116の機能を実現するアプリケーションとして、例えば、Hibernateを用いることができる。
The DDL
次に、以上のような構成を備えるコンピュータ100aにおいて実行される処理の詳細を説明する。
図37は、第2の実施の形態のプログラム生成処理の手順を示すフローチャートである。以下、図37に示す処理をステップ番号に沿って説明する。
Next, details of processing executed in the
FIG. 37 is a flowchart illustrating a procedure of a program generation process according to the second embodiment. In the following, the process illustrated in FIG. 37 will be described in order of step number.
[ステップS110]ORMファイル取得部110aは、ORMファイル20aを取得し、取得したORMファイル20aをORMファイル記憶部115に格納する。
[ステップS120]DDLファイル生成部116は、ORMファイル記憶部115に記憶されたORMファイル20aに基づいて、データベース210を構築するためのDDLファイルを生成する。DDLファイル生成部116は、生成したDDLファイルをDBサーバ200に出力する。なお、DBサーバ200は、このDDLファイルに基づいてデータベース210を構築する。
[Step S110] The ORM
[Step S120] The DDL
[ステップS130]ORMクラス生成部120は、ORMファイル記憶部115に記憶されたORMファイル20aに基づいて、データベース210の各テーブルに値を格納または、各テーブルから値を読み出すためのORMクラスを生成する。ORMクラス生成部120は、生成したORMクラスをORMクラス記憶部125に格納する。
[Step S130] Based on the
[ステップS140]DAOクラス生成部140は、テンプレート記憶部130に記憶されたDAOクラス用テンプレートファイル131とORMクラス記憶部125に記憶されたORMクラスの名称とに基づいて、DAOクラスを生成する。DAOクラス生成部140は、生成したDAOクラスをDAOクラス記憶部145に格納する。
[Step S140] The DAO
[ステップS150]クエリ記述ファイル生成部150は、テンプレート記憶部130に記憶されたクエリ記述用テンプレートファイル132とDAOクラス記憶部145に記憶されたDAOクラスの名称とに基づいて、クエリ記述ファイルを生成する。クエリ記述ファイル生成部150は、生成したクエリ記述ファイルをクエリ記述ファイル記憶部155に格納する。
[Step S150] The query description
[ステップS160]コンテキストファイル生成部170は、テンプレート記憶部130に記憶されたコンテキスト用テンプレートファイル133とDAOクラス記憶部145に記憶されたDAOクラスの名称とに基づいて、コンテキストファイルを生成する。コンテキストファイル生成部170は、生成したコンテキストファイル記憶部175に格納する。
[Step S <b> 160] The context
[ステップS170]サンプルクラス生成部180は、テンプレート記憶部130に記憶されたサンプルクラス用テンプレートファイル134とDAOクラス記憶部145に記憶されたDAOクラスの名称とに基づいて、サンプルのサービスクラスを生成する。サンプルクラス生成部180は、生成したサービスクラスをサンプルクラス記憶部185に格納する。
[Step S170] The sample
[ステップS180]配置部190は、コンテキストファイル記憶部175に記憶されたコンテキストファイルに基づいて、DAOクラス、サービスクラスおよび共通コンポーネントなどの各クラスをメモリ上に配置する。そして、実行部195は、コンテキストファイルに基づいて、配置部190が配置したクラス間の関連付けを行い、サンプルのサービスを実行する。
[Step S180] The
このようにして、データベース210にテーブルを構築するためのDDLファイルと共にDAOクラスやサンプルのサービスクラスなどが自動生成される。なお、上記ステップS120の処理は、ステップS130〜S170の処理と非同期で行うことも考えられる。
In this way, a DAO class, a sample service class, and the like are automatically generated together with a DDL file for constructing a table in the
次に、上記ステップS120の処理を更に詳しく説明する。なお、ステップS130〜S180の処理の詳細は、図19で示したステップS2〜S7の処理の詳細と同一であるため、説明を省略する。 Next, the process of step S120 will be described in more detail. Note that details of the processes in steps S130 to S180 are the same as the details of the processes in steps S2 to S7 shown in FIG.
図38は、第2の実施の形態のDDLファイル生成処理の手順を示すフローチャートである。以下、図38に示す処理をステップ番号に沿って説明する。なお、以下の処理は、上記ステップS120の処理を詳細に説明したものである。 FIG. 38 is a flowchart illustrating a procedure of DDL file generation processing according to the second embodiment. In the following, the process illustrated in FIG. 38 will be described in order of step number. The following process describes the process of step S120 in detail.
[ステップS111]DDLファイル生成部116は、ORMファイル記憶部115に記憶されたDDLファイル未作成のORMファイルを読み出す。
[ステップS112]DDLファイル生成部116は、参照したORMファイルに含まれるカラムのうち、未抽出であるカラムを抽出し、そのカラムの属性情報を取得する。
[Step S <b> 111] The DDL
[Step S112] The DDL
[ステップS113]DDLファイル生成部116は、参照したテーブルに含まれる全てのカラムの情報を抽出したか否かを判定する。全てのカラムの情報を抽出済みの場合、処理がステップS114に移される。未抽出のカラムの情報が存在する場合、処理がステップS112に移される。
[Step S113] The DDL
[ステップS114]DDLファイル生成部116は、抽出したカラムの情報に基づいて、DDLファイルを生成し、DBサーバ200に送信する。
[ステップS115]DDLファイル生成部116は、ORMファイル記憶部115に記憶された全てのORMファイルに関してDDLファイルを生成済みであるか否かを判定する。全てのORMファイルに関してDDLファイルを生成済みである場合、処理が完了する。DDLファイルを未生成のORMファイルが存在する場合、処理がステップS111に移される。
[Step S114] The DDL
[Step S115] The DDL
このようにして、ORMファイルで定義されるテーブルのカラムが参照され、それぞれのカラムの情報が、該当のテーブルを構築するためのDDLファイルにマッピングされる。 In this way, the columns of the table defined in the ORM file are referred to, and the information of each column is mapped to the DDL file for constructing the corresponding table.
図39は、生成されたDDLファイルの例を示す図である。DDLファイル116aは、図6に示す“Grouptbl”テーブルのDDLである“grouptbl.ddl”の例を示している。DBサーバ200は、DDLファイル116aに基づいてデータベース210に“Grouptbl”テーブルを構築する。
FIG. 39 is a diagram illustrating an example of the generated DDL file. The
このように、データベース210を構築するためのDDLファイルと共にDAOクラスやサンプルのサービスクラスなどが自動生成される。これにより、第1の実施の形態で示した効果と同様の効果を得ることができる。更に、データベース210や対象のテーブルが構築されていない場合にも、データベース210の構築と共にデータベース210にアクセスするDAOクラスおよびサンプルのサービスクラスを生成することが可能となる。このため、開発者は、データベース210にテーブルを構築した直後から、データベース210のテーブルに対する操作を行うことができる。そして、サンプルのサービスクラスに基づいて、容易に他のアプリケーションを作成することができ、開発の効率を向上することができる。
As described above, the DAO class, the sample service class, and the like are automatically generated together with the DDL file for constructing the
以上、本発明のソフトウェア開発支援プログラム、ソフトウェア開発支援装置およびソフトウェア開発支援方法を図示の実施の形態に基づいて説明したが、これらに限定されるものではなく、各部の構成は同様の機能を有する任意の構成のものに置換することができる。また、他の任意の構成物や工程が付加されてもよい。更に、前述した実施の形態のうちの任意の2以上の構成(特徴)を組み合わせたものであってもよい。 The software development support program, the software development support apparatus, and the software development support method of the present invention have been described based on the illustrated embodiments. However, the present invention is not limited to these, and the configuration of each unit has similar functions. Any configuration can be substituted. Moreover, other arbitrary structures and processes may be added. Further, any two or more configurations (features) of the above-described embodiments may be combined.
なお、上記の処理機能は、コンピュータによって実現することができる。その場合、コンピュータが有すべき機能の処理内容を記述したプログラムが提供される。そのプログラムをコンピュータで実行することにより、上記処理機能がコンピュータ上で実現される。 The above processing functions can be realized by a computer. In that case, a program describing the processing contents of the functions that the computer should have is provided. By executing the program on a computer, the above processing functions are realized on the computer.
処理内容を記述したプログラムは、コンピュータで読み取り可能な記録媒体に記録しておくことができる。コンピュータで読み取り可能な記録媒体には、磁気記録装置、光ディスク、光磁気記録媒体、半導体メモリなどがある。磁気記録装置には、HDD、フレキシブルディスク(FD)、磁気テープ(MT)などがある。光ディスクには、DVD(Digital Versatile Disc)、DVD−RAM、CD−ROM(Compact Disc - Read Only Memory)、CD−R(Recordable)/RW(ReWritable)などがある。光磁気記録媒体には、MO(Magneto - Optical disk)などがある。 The program describing the processing contents can be recorded on a computer-readable recording medium. Examples of the computer-readable recording medium include a magnetic recording device, an optical disk, a magneto-optical recording medium, and a semiconductor memory. Examples of the magnetic recording device include an HDD, a flexible disk (FD), and a magnetic tape (MT). Optical disks include DVD (Digital Versatile Disc), DVD-RAM, CD-ROM (Compact Disc-Read Only Memory), CD-R (Recordable) / RW (ReWritable), and the like. Magneto-optical recording media include MO (Magneto-Optical disk).
上記プログラムを流通させる場合には、例えば、そのプログラムが記録されたDVD、CD−ROMなどの可搬型記録媒体が販売される。また、プログラムをサーバコンピュータに格納しておき、ネットワークを介して、サーバコンピュータから他のコンピュータにそのプログラムを転送することもできる。 When the program is distributed, for example, a portable recording medium such as a DVD or CD-ROM in which the program is recorded is sold. It is also possible to store the program in a server computer and transfer the program from the server computer to another computer via a network.
上記プログラムを実行するコンピュータは、例えば、可搬型記録媒体に記録されたプログラム若しくはサーバコンピュータから転送されたプログラムを、自己の記憶装置に格納する。そして、コンピュータは、自己の記憶装置からプログラムを読み取り、プログラムに従った処理を実行する。なお、コンピュータは、可搬型記録媒体から直接プログラムを読み取り、そのプログラムに従った処理を実行することもできる。また、コンピュータは、サーバコンピュータからプログラムが転送される毎に、逐次、受け取ったプログラムに従った処理を実行することもできる。 The computer that executes the program stores, for example, the program recorded on the portable recording medium or the program transferred from the server computer in its own storage device. Then, the computer reads the program from its own storage device and executes processing according to the program. The computer can also read the program directly from the portable recording medium and execute processing according to the program. In addition, each time the program is transferred from the server computer, the computer can sequentially execute processing according to the received program.
1 コンピュータ
1a データアクセス部品生成手段
1b 共通部品記憶手段
1c 登録情報生成手段
2 データベース
2a,2b,2c テーブル
3 登録情報
4 プログラム実行環境
4a,4b,4c データアクセス部品
4d 共通部品
DESCRIPTION OF
Claims (9)
データベースに格納された複数のテーブルの情報に基づいて、前記複数のテーブルそれぞれについて、アクセス要求を受け付けて当該テーブルに対し所定の操作を行うプログラム部品であるデータアクセス部品を生成するデータアクセス部品生成手段、
前記データアクセス部品に対して前記アクセス要求を行うアプリケーションプログラムを生成するアプリケーション生成手段、
前記所定の操作に伴って実行させる複数の前記データアクセス部品の間で共通の処理を定義した共通部品を記憶する共通部品記憶手段、
前記データアクセス部品生成手段が生成した前記データアクセス部品をプログラム実行環境に登録するための情報と、前記共通部品記憶手段に記憶された前記共通部品で定義された処理が前記データアクセス部品による前記所定の操作の際に前記プログラム実行環境上で実行されるようにするための情報と、前記アプリケーション生成手段が生成した前記アプリケーションプログラムを前記データアクセス部品に関連付けて前記プログラム実行環境に登録するための情報とを含む登録情報を生成する登録情報生成手段、
として機能させることを特徴とするソフトウェア開発支援プログラム。 Computer
Data access component generation means for generating a data access component that is a program component that receives an access request and performs a predetermined operation on the table for each of the plurality of tables based on information of the plurality of tables stored in the database ,
Application generation means for generating an application program for making the access request to the data access component;
Common component storage means for storing a common component defining a common process among the plurality of data access components to be executed in accordance with the predetermined operation;
Information for registering the data access component generated by the data access component generation unit in a program execution environment and processing defined by the common component stored in the common component storage unit are performed by the data access component. Information for execution on the program execution environment during the operation of the information, and information for registering the application program generated by the application generation means in the program execution environment in association with the data access component Registration information generating means for generating registration information including:
Software development support program characterized by functioning as
前記データアクセス部品生成手段が生成する前記データアクセス部品は、前記汎用部品記憶手段に記憶された前記汎用データアクセス部品を、前記テーブルに応じたデータ型を前記パラメタとして指定して利用するプログラム部品である、
ことを特徴とする請求項1記載のソフトウェア開発支援プログラム。 The computer further functions as a general-purpose component storage means for storing a general-purpose data access component that defines the predetermined operation by parameterizing a data type,
The data access component generated by the data access component generation unit is a program component that uses the general-purpose data access component stored in the general-purpose component storage unit by designating a data type corresponding to the table as the parameter. is there,
The software development support program according to claim 1.
前記登録情報生成手段は、生成する前記登録情報に、前記クエリ文書生成手段が生成した前記クエリ文書に記述された操作を前記プログラム実行環境上で実行可能にするための情報を含める、
ことを特徴とする請求項2記載のソフトウェア開発支援プログラム。 The computer is further caused to function as a query document generation unit that generates a query document for describing an operation other than the predetermined operation defined in the general-purpose data access component.
The registration information generation means includes information for enabling the operation described in the query document generated by the query document generation means to be executed on the program execution environment in the registration information to be generated.
The software development support program according to claim 2.
前記登録情報生成手段は、生成する前記登録情報に、前記マッピング情報生成手段が生成した前記マッピング情報に基づいて前記データアクセス部品による前記所定の操作が実行されるようにするための情報を含める、
ことを特徴とする請求項1記載のソフトウェア開発支援プログラム。 The computer further generates mapping information for each of the plurality of tables to generate mapping information that associates the data type of the data used by the application program making the access request with the data type of the data included in the table. Function as a means,
The registration information generation means includes information for causing the predetermined operation by the data access component to be executed based on the mapping information generated by the mapping information generation means in the registration information to be generated.
The software development support program according to claim 1.
前記データアクセス部品生成手段は、前記テーブル情報取得手段が取得した前記複数のテーブルの情報に基づいて、前記データアクセス部品を生成する、 The data access component generation unit generates the data access component based on the information of the plurality of tables acquired by the table information acquisition unit.
ことを特徴とする請求項1記載のソフトウェア開発支援プログラム。 The software development support program according to claim 1.
前記複数のテーブルそれぞれについて、前記アクセス要求を行うアプリケーションプログラムが使用するデータのデータ型と前記テーブルに含まれるデータのデータ型とを対応付けたマッピング情報を取得するマッピング情報取得手段、 Mapping information acquisition means for acquiring mapping information that associates the data type of the data used by the application program that makes the access request with the data type of the data included in the table for each of the plurality of tables.
前記マッピング情報取得手段が取得した前記マッピング情報に基づいて、前記データベースにテーブルを構築するためのテーブル定義情報を生成して、前記データベースに出力するテーブル定義情報生成手段、 Table definition information generating means for generating table definition information for constructing a table in the database based on the mapping information acquired by the mapping information acquiring means, and outputting the table definition information to the database;
として機能させ、 Function as
前記データアクセス部品生成手段は、前記マッピング情報取得手段が取得した複数の前記マッピング情報に基づいて、前記データアクセス部品を生成する、 The data access component generation unit generates the data access component based on a plurality of the mapping information acquired by the mapping information acquisition unit.
ことを特徴とする請求項1記載のソフトウェア開発支援プログラム。 The software development support program according to claim 1.
前記データアクセス部品に対して前記アクセス要求を行うアプリケーションプログラムを生成するアプリケーション生成手段と、
前記所定の操作に伴って実行させる複数の前記データアクセス部品の間で共通の処理を定義した共通部品を記憶する共通部品記憶手段と、
前記データアクセス部品生成手段が生成した前記データアクセス部品をプログラム実行環境に登録するための情報と、前記共通部品記憶手段に記憶された前記共通部品で定義された処理が前記データアクセス部品による前記所定の操作の際に前記プログラム実行環境上で実行されるようにするための情報と、前記アプリケーション生成手段が生成した前記アプリケーションプログラムを前記データアクセス部品に関連付けて前記プログラム実行環境に登録するための情報とを含む登録情報を生成する登録情報生成手段と、
を有することを特徴とするソフトウェア開発支援装置。 Data access component generation means for generating a data access component that is a program component that receives an access request and performs a predetermined operation on the table for each of the plurality of tables based on information of the plurality of tables stored in the database When,
Application generation means for generating an application program for making the access request to the data access component;
A common component storage unit that stores a common component that defines a common process among the plurality of data access components to be executed in accordance with the predetermined operation;
Information for registering the data access component generated by the data access component generation unit in a program execution environment and processing defined by the common component stored in the common component storage unit are performed by the data access component. Information for execution on the program execution environment during the operation of the information, and information for registering the application program generated by the application generation means in the program execution environment in association with the data access component Registration information generating means for generating registration information including:
A software development support apparatus characterized by comprising:
データベースに格納された複数のテーブルの情報に基づいて、前記複数のテーブルそれぞれについて、アクセス要求を受け付けて当該テーブルに対し所定の操作を行うプログラム部品であるデータアクセス部品を生成し、
前記データアクセス部品に対して前記アクセス要求を行うアプリケーションプログラムを生成し、
生成された前記データアクセス部品をプログラム実行環境に登録するための情報と、前記所定の操作に伴って実行させる複数の前記データアクセス部品の間で共通の処理であって共通部品記憶手段に記憶された共通部品で定義された処理が、前記データアクセス部品による前記所定の操作の際に前記プログラム実行環境上で実行されるようにするための情報と、生成された前記アプリケーションプログラムを前記データアクセス部品に関連付けて前記プログラム実行環境に登録するための情報とを含む登録情報を生成する、
ことを特徴とするソフトウェア開発支援方法。 Computer
Based on information of a plurality of tables stored in the database, for each of the plurality of tables, a data access component that is a program component that receives an access request and performs a predetermined operation on the table is generated,
Generating an application program for making the access request to the data access component;
Information for registering the generated data access component in the program execution environment and a process common to the plurality of data access components to be executed in accordance with the predetermined operation and stored in the common component storage means Information for causing the processing defined by the common component to be executed on the program execution environment during the predetermined operation by the data access component, and the generated application program as the data access component Generating registration information including information for registering in the program execution environment in association with
A software development support method characterized by the above.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008249924A JP5237030B2 (en) | 2008-09-29 | 2008-09-29 | Software development support program, software development support apparatus, and software development support method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008249924A JP5237030B2 (en) | 2008-09-29 | 2008-09-29 | Software development support program, software development support apparatus, and software development support method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2010079803A JP2010079803A (en) | 2010-04-08 |
JP5237030B2 true JP5237030B2 (en) | 2013-07-17 |
Family
ID=42210137
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2008249924A Expired - Fee Related JP5237030B2 (en) | 2008-09-29 | 2008-09-29 | Software development support program, software development support apparatus, and software development support method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5237030B2 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR102015980B1 (en) * | 2018-11-14 | 2019-08-29 | 한국과학기술정보연구원 | computational science and engineering platform simulation method and system for connecting pre-processing unit and post-processing unit thereto |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5675666B2 (en) * | 2012-02-09 | 2015-02-25 | 株式会社野村総合研究所 | Timed data history management system |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003186670A (en) * | 2001-12-21 | 2003-07-04 | Hitachi Information Systems Ltd | Automatic generation device, automatic generation method and automatic generation program for database access component |
JP2004252536A (en) * | 2003-02-18 | 2004-09-09 | Fujitsu Ltd | Program development support device |
JP2005275913A (en) * | 2004-03-25 | 2005-10-06 | Mitsubishi Electric Corp | Information processing system, program for acquiring data, program creating method and data providing method |
JP2006268124A (en) * | 2005-03-22 | 2006-10-05 | Fuji Electric Systems Co Ltd | Automatic creation system and program |
-
2008
- 2008-09-29 JP JP2008249924A patent/JP5237030B2/en not_active Expired - Fee Related
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR102015980B1 (en) * | 2018-11-14 | 2019-08-29 | 한국과학기술정보연구원 | computational science and engineering platform simulation method and system for connecting pre-processing unit and post-processing unit thereto |
Also Published As
Publication number | Publication date |
---|---|
JP2010079803A (en) | 2010-04-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101454779B (en) | Search-based application development framework | |
US6920456B2 (en) | Method, system, and program for maintaining information in database tables and performing operations on data in the database tables | |
JP5162094B2 (en) | Method and apparatus for metadata-driven business logic processing | |
JP3437849B2 (en) | Database management system and method for supporting object-oriented programming | |
US6785882B1 (en) | Process-driven tool interface for an object management system | |
US7165073B2 (en) | Dynamic, hierarchical data exchange system | |
US5418957A (en) | Network data dictionary | |
US5758351A (en) | System and method for the creation and use of surrogate information system objects | |
US9886245B2 (en) | Software development tool using a workflow pattern that describes software applications | |
US7559052B2 (en) | Meta-model for associating multiple physical representations of logically equivalent entities in messaging and other applications | |
JP2001282594A (en) | Corporate work integration system and method for integrating a plurality of data sources | |
KR20060045622A (en) | Extraction, transformation and loading designer module of a computerized financial system | |
US8881127B2 (en) | Systems and methods to automatically generate classes from API source code | |
US20100312592A1 (en) | Confirming enforcement of business rules specified in a data access tier of a multi-tier application | |
US20080263142A1 (en) | Meta Data Driven User Interface System and Method | |
WO2011116471A1 (en) | Method and system for generating updated test data | |
US8433729B2 (en) | Method and system for automatically generating a communication interface | |
EP2718841A2 (en) | Code generation and implementation method, system, and storage medium for delivering bidirectional data aggregation and updates | |
US20080263018A1 (en) | Method and System for Mapping Business Objects to Relational Database Tables | |
JP5237030B2 (en) | Software development support program, software development support apparatus, and software development support method | |
US20060047710A1 (en) | Globalized database system and method for accessing the same | |
US20070094289A1 (en) | Dynamic, hierarchical data exchange system | |
US20060190476A1 (en) | Database storage system and associated method | |
US20020019824A1 (en) | Method to generically describe and manipulate arbitrary data structures | |
CN101419611A (en) | Method for performing an operation on an XML database |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20110329 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20120822 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20120828 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20121029 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20121127 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20130128 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20130312 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130328 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 Ref document number: 5237030 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20160405 Year of fee payment: 3 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
LAPS | Cancellation because of no payment of annual fees |