(empty log message)
@@ -0,0 +1,49 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<actions> | |
3 | + <action> | |
4 | + <actionName>run</actionName> | |
5 | + <packagings> | |
6 | + <packaging>jar</packaging> | |
7 | + </packagings> | |
8 | + <goals> | |
9 | + <goal>process-classes</goal> | |
10 | + <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal> | |
11 | + </goals> | |
12 | + <properties> | |
13 | + <exec.args>-classpath %classpath org.clearfy.datawrapper.h2db.MiniServer</exec.args> | |
14 | + <exec.executable>java</exec.executable> | |
15 | + <exec.workingdir>D:\work\NetBeansProjects\org.clearfy\org.clearfy.datawrapper</exec.workingdir> | |
16 | + </properties> | |
17 | + </action> | |
18 | + <action> | |
19 | + <actionName>debug</actionName> | |
20 | + <packagings> | |
21 | + <packaging>jar</packaging> | |
22 | + </packagings> | |
23 | + <goals> | |
24 | + <goal>process-classes</goal> | |
25 | + <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal> | |
26 | + </goals> | |
27 | + <properties> | |
28 | + <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.clearfy.datawrapper.h2db.MiniServer</exec.args> | |
29 | + <exec.executable>java</exec.executable> | |
30 | + <jpda.listen>true</jpda.listen> | |
31 | + <exec.workingdir>D:\work\NetBeansProjects\org.clearfy\org.clearfy.datawrapper</exec.workingdir> | |
32 | + </properties> | |
33 | + </action> | |
34 | + <action> | |
35 | + <actionName>profile</actionName> | |
36 | + <packagings> | |
37 | + <packaging>jar</packaging> | |
38 | + </packagings> | |
39 | + <goals> | |
40 | + <goal>process-classes</goal> | |
41 | + <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal> | |
42 | + </goals> | |
43 | + <properties> | |
44 | + <exec.args>-classpath %classpath org.clearfy.datawrapper.h2db.MiniServer</exec.args> | |
45 | + <exec.executable>java</exec.executable> | |
46 | + <exec.workingdir>D:\work\NetBeansProjects\org.clearfy\org.clearfy.datawrapper</exec.workingdir> | |
47 | + </properties> | |
48 | + </action> | |
49 | + </actions> |
@@ -23,6 +23,7 @@ | ||
23 | 23 | */ |
24 | 24 | package org.clearfy.datawrapper.data; |
25 | 25 | |
26 | +import org.clearfy.annotations.Comment; | |
26 | 27 | import org.clearfy.annotations.LogicalName; |
27 | 28 | import org.clearfy.datawrapper.Column; |
28 | 29 | import org.clearfy.datawrapper.CurrentTimestamp; |
@@ -34,11 +35,13 @@ | ||
34 | 35 | * |
35 | 36 | * @author Takahiro MURAKAMI |
36 | 37 | */ |
38 | +@LogicalName("JDBC情報") | |
39 | +@Comment("アプリケーションが利用するJDBC情報を格納するテーブル") | |
37 | 40 | public class JdbcInfo extends Table{ |
38 | 41 | |
39 | - @LogicalName("JDBC情報ID") | |
40 | - public IncrementalKey JdbcInfoId; | |
41 | - | |
42 | + @LogicalName("JDBCURL") | |
43 | + public Column<String> JdbcUrl; | |
44 | + | |
42 | 45 | @LogicalName("作成日") |
43 | 46 | public CurrentTimestamp Stamp; |
44 | 47 |
@@ -54,9 +57,6 @@ | ||
54 | 57 | @LogicalName("JDBCドライバクラス") |
55 | 58 | public Column<String> JdbcDriverClass; |
56 | 59 | |
57 | - @LogicalName("JDBCURL") | |
58 | - public Column<String> JdbcUrl; | |
59 | - | |
60 | 60 | @LogicalName("ユーザー名") |
61 | 61 | public Column<String> User; |
62 | 62 |
@@ -66,5 +66,20 @@ | ||
66 | 66 | @Override |
67 | 67 | public void defineColumns() { |
68 | 68 | |
69 | + this.JdbcServerName.setLength(Column.SIZE_512) | |
70 | + .setAllowNull(false); | |
71 | + | |
72 | + this.JdbcDriverClass.setLength(Column.SIZE_1024) | |
73 | + .setAllowNull(false); | |
74 | + | |
75 | + this.JdbcUrl.setLength(Column.SIZE_1024) | |
76 | + .setPrimaryKey(true) | |
77 | + .setAllowNull(false); | |
78 | + | |
79 | + this.User.setLength(Column.SIZE_512) | |
80 | + .setAllowNull(false); | |
81 | + | |
82 | + this.Password.setLength(Column.SIZE_512); | |
83 | + | |
69 | 84 | } |
70 | 85 | } |
@@ -0,0 +1,93 @@ | ||
1 | +/* | |
2 | + * The MIT License | |
3 | + * | |
4 | + * Copyright 2019 Takahiro MURAKAMI. | |
5 | + * | |
6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | |
7 | + * of this software and associated documentation files (the "Software"), to deal | |
8 | + * in the Software without restriction, including without limitation the rights | |
9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
10 | + * copies of the Software, and to permit persons to whom the Software is | |
11 | + * furnished to do so, subject to the following conditions: | |
12 | + * | |
13 | + * The above copyright notice and this permission notice shall be included in | |
14 | + * all copies or substantial portions of the Software. | |
15 | + * | |
16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
19 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
22 | + * THE SOFTWARE. | |
23 | + */ | |
24 | +package org.clearfy.datawrapper.h2db; | |
25 | + | |
26 | +import java.io.File; | |
27 | +import java.util.logging.Logger; | |
28 | +import org.clearfy.datawrapper.Jdbc; | |
29 | +import org.clearfy.datawrapper.data.ColumnInfo; | |
30 | +import org.clearfy.datawrapper.data.JdbcInfo; | |
31 | +import org.clearfy.datawrapper.data.TableInfo; | |
32 | + | |
33 | +/** | |
34 | + * 単体で起動するミニサーバー | |
35 | + * | |
36 | + * @author Takahiro MURAKAMI | |
37 | + */ | |
38 | +public class MiniServer { | |
39 | + | |
40 | + /** | |
41 | + * 既定のTCPポート | |
42 | + */ | |
43 | + public static final int DEFAULT_TCP_PORT = 1234; | |
44 | + | |
45 | + /** | |
46 | + * 既定のHTTPポート | |
47 | + */ | |
48 | + public static final int DEFAULT_HTTP_PORT = 2345; | |
49 | + | |
50 | + /** | |
51 | + * 既定のデータファイル | |
52 | + */ | |
53 | + public static final String DEFAULT_SERVER_FILE = "miniserv"; | |
54 | + | |
55 | + /** | |
56 | + * @param args | |
57 | + */ | |
58 | + public static void main(String[] args) { | |
59 | + ServerSwitch sSwitch = new ServerSwitch(); | |
60 | + sSwitch.loadDriver(); | |
61 | + sSwitch.setServerPorts(DEFAULT_TCP_PORT, DEFAULT_HTTP_PORT); | |
62 | + | |
63 | + File file = new File(DEFAULT_SERVER_FILE); | |
64 | + String fullpath = file.getAbsolutePath(); | |
65 | + String url = "jdbc:h2:tcp:localhost:" + DEFAULT_TCP_PORT + "//" + fullpath; | |
66 | + | |
67 | + Logger.getLogger(MiniServer.class.getSimpleName()).info("JDBC URL : " + url); | |
68 | + | |
69 | + sSwitch.setUrl(url); | |
70 | + Logger.getLogger(MiniServer.class.getSimpleName()).info("JDBC USER / PASS : sa / (null)"); | |
71 | + | |
72 | + sSwitch.on(); | |
73 | + | |
74 | + ColumnInfo cinfo = new ColumnInfo(); | |
75 | + cinfo.alterOrCreateTable(sSwitch); | |
76 | + | |
77 | + TableInfo tinfo = new TableInfo(); | |
78 | + tinfo.alterOrCreateTable(sSwitch); | |
79 | + | |
80 | + JdbcInfo jdbcInfo = new JdbcInfo(); | |
81 | + jdbcInfo.alterOrCreateTable(sSwitch); | |
82 | + | |
83 | + jdbcInfo.clearValues(); | |
84 | + jdbcInfo.merge( | |
85 | + jdbcInfo.JdbcDriverClass.setValue(ServerSwitch.JDBC_DRIVER_MANAGER), | |
86 | + jdbcInfo.JdbcServerName.setValue(DEFAULT_SERVER_FILE), | |
87 | + jdbcInfo.JdbcUrl.setValue(url), | |
88 | + jdbcInfo.User.setValue("sa"), | |
89 | + jdbcInfo.Password.setValue("") | |
90 | + ); | |
91 | + | |
92 | + } | |
93 | +} |
@@ -134,8 +134,10 @@ | ||
134 | 134 | "-webPort", |
135 | 135 | String.valueOf(this.jdbcHttpPort), |
136 | 136 | "-webAllowOthers" |
137 | - ) | |
138 | - .start(); | |
137 | + ); | |
138 | + if(!this.httpDbServer.isRunning(true)){ | |
139 | + this.httpDbServer.start(); | |
140 | + } | |
139 | 141 | } |
140 | 142 | |
141 | 143 | //DBサーバーのtcp起動 |
@@ -145,8 +147,10 @@ | ||
145 | 147 | "-tcpPort", |
146 | 148 | String.valueOf(this.jdbcTcpPort), |
147 | 149 | "-tcpAllowOthers" |
148 | - ) | |
149 | - .start(); | |
150 | + ); | |
151 | + if(!this.tcpDbServer.isRunning(true)){ | |
152 | + this.tcpDbServer.start(); | |
153 | + } | |
150 | 154 | } |
151 | 155 | |
152 | 156 | //DBを稼働中にする。 |