リビジョン | b21c9fb80ddcbb27e002ffed746d095793e93a04 (tree) |
---|---|
日時 | 2017-01-25 07:57:16 |
作者 | kuboryu <kuboryu@yaho...> |
コミッター | kuboryu |
20170125
@@ -423,6 +423,14 @@ public class CmnUtils{ | ||
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | + public static boolean isEmpty(String _str) throws Exception{ | |
427 | + if(_str == null || _str.equals("")){ | |
428 | + return true; | |
429 | + } else { | |
430 | + return false; | |
431 | + } | |
432 | + } | |
433 | + | |
426 | 434 | public static String[] getSystemProperty(String _str) throws Exception{ |
427 | 435 | String [] retValue = null; |
428 | 436 | if(System.getProperty(_str)!=null){ |
@@ -499,6 +507,43 @@ public class CmnUtils{ | ||
499 | 507 | return retValue; |
500 | 508 | } |
501 | 509 | |
510 | + public static String getDelimiter(String _str) throws Exception{ | |
511 | + String retValue = _str; | |
512 | + if(_str!=null){ | |
513 | + char [] chr = new char[_str.length()]; | |
514 | + int j = 0; | |
515 | + for(int i=0;i<_str.length();i++){ | |
516 | + if (i < _str.length() - 1){ | |
517 | + if (_str.charAt(i) == '\\'){ | |
518 | + switch(_str.charAt(i + 1)){ | |
519 | + case 't': | |
520 | + chr[j] = 0x09; | |
521 | + i++; | |
522 | + j++; | |
523 | + break; | |
524 | + default: | |
525 | + chr[j] = _str.charAt(i); | |
526 | + j++; | |
527 | + break; | |
528 | + } | |
529 | + } else { | |
530 | + chr[j] = _str.charAt(i); | |
531 | + j++; | |
532 | + } | |
533 | + } else { | |
534 | + chr[j] = _str.charAt(i); | |
535 | + j++; | |
536 | + } | |
537 | + } | |
538 | + char [] chr2 = new char[j]; | |
539 | + for(int i=0;i<j;i++){ | |
540 | + chr2[i] = chr[i]; | |
541 | + } | |
542 | + retValue = String.valueOf(chr2); | |
543 | + } | |
544 | + return retValue; | |
545 | + } | |
546 | + | |
502 | 547 | public static String getLineSeparator(String _str, String _strDefault) throws Exception{ |
503 | 548 | String retValue = _strDefault; |
504 | 549 | if(System.getProperty(_str)!=null){ |
@@ -532,5 +577,36 @@ public class CmnUtils{ | ||
532 | 577 | return retValue; |
533 | 578 | } |
534 | 579 | |
580 | + public static String getLineSeparator(String _str) throws Exception{ | |
581 | + String retValue = _str; | |
582 | + if(_str!=null){ | |
583 | + char [] chr = new char[_str.length()]; | |
584 | + int j = 0; | |
585 | + for(int i=0;i<_str.length();i++){ | |
586 | + if (i < _str.length() - 1){ | |
587 | + if (_str.charAt(i) == '\\'){ | |
588 | + switch(_str.charAt(i + 1)){ | |
589 | + case 'r': | |
590 | + chr[j] = 0x0d; | |
591 | + i++; | |
592 | + j++; | |
593 | + break; | |
594 | + case 'n': | |
595 | + chr[j] = 0x0a; | |
596 | + i++; | |
597 | + j++; | |
598 | + break; | |
599 | + } | |
600 | + } | |
601 | + } | |
602 | + } | |
603 | + char [] chr2 = new char[j]; | |
604 | + for(int i=0;i<j;i++){ | |
605 | + chr2[i] = chr[i]; | |
606 | + } | |
607 | + retValue = String.valueOf(chr2); | |
608 | + } | |
609 | + return retValue; | |
610 | + } | |
535 | 611 | |
536 | 612 | } |
@@ -66,15 +66,51 @@ public class DataAccessObjects{ | ||
66 | 66 | private ByteArrayOutputStream baos = null; |
67 | 67 | private boolean isQuotation = true; |
68 | 68 | private boolean isMask = false; |
69 | + private boolean isInclMaskCols = false; | |
70 | + private boolean isExclMaskCols = false; | |
69 | 71 | private String inclMaskCols = null; |
70 | 72 | private String exclMaskCols = null; |
71 | 73 | private String tbName = null; |
72 | 74 | private String nullMark = ""; |
75 | + private String lnSprtr = System.getProperty("line.separator"); | |
76 | + private char singleByteChr = '*'; | |
77 | + private char doubleByteChr = '*'; | |
78 | + private String maskPtn = "ALT"; | |
73 | 79 | private static final int MASK_PTN_ALL = 0; |
74 | 80 | private static final int MASK_PTN_ALT = 1; |
75 | 81 | private static final int MASK_PTN_EDGE = 2; |
76 | 82 | private static final String [] MASK_PTN = {"ALL", "ALT", "EDGE"}; |
77 | - | |
83 | + private static final int USER = 0; | |
84 | + private static final int PASS = 1; | |
85 | + private static final int URL = 2; | |
86 | + private static final int DRIVER = 3; | |
87 | + private static final int OUTPUT = 4; | |
88 | + private static final int INPUT = 5; | |
89 | + private static final int LINESEP = 6; | |
90 | + private static final int INLINESEP = 7; | |
91 | + private static final int FILENCODE = 8; | |
92 | + private static final int NULLMARK = 9; | |
93 | + private static final int DELIMITER = 10; | |
94 | + private static final int TBLSQL = 11; | |
95 | + private static final int TBLKEYSQL = 12; | |
96 | + private static final int ORDER = 13; | |
97 | + private static final int QUOTATION = 14; | |
98 | + private static final int BATCOUNT = 15; | |
99 | + private static final int INCLTAB = 16; | |
100 | + private static final int EXCLTAB = 17; | |
101 | + private static final int INCLCOL = 18; | |
102 | + private static final int EXCLCOL = 19; | |
103 | + private static final int INCLCOLMASK = 20; | |
104 | + private static final int EXCLCOLMASK = 21; | |
105 | + private static final int SBYTEMASKCHR = 22; | |
106 | + private static final int DBYTEMASKCHR = 23; | |
107 | + private static final int MASKPTN = 24; | |
108 | + private static final int PROPFILE = 25; | |
109 | + private static final String [] PROP_KEY = { "us","pw","url","dr","out","in","ls","ils","fe","nm", | |
110 | + "dm","ts","tks","od","qt","bc","it","et","ic","ec", | |
111 | + "icm","ecm","smc","dmc","mp","pf"}; | |
112 | + private static final int KEYS = 26; | |
113 | + private String [] prop_val = null; | |
78 | 114 | DataAccessObjects(String _user, String _pass, String _url, String _driver){ |
79 | 115 | user = _user; |
80 | 116 | pass = _pass; |
@@ -261,6 +297,10 @@ public class DataAccessObjects{ | ||
261 | 297 | tbName = _tbName; |
262 | 298 | } |
263 | 299 | |
300 | + public void setPropVal(String[] _prop_val) throws Exception{ | |
301 | + prop_val = _prop_val; | |
302 | + } | |
303 | + | |
264 | 304 | public ResultSet getResultSet() throws Exception{ |
265 | 305 | return rst; |
266 | 306 | } |
@@ -295,8 +335,9 @@ public class DataAccessObjects{ | ||
295 | 335 | isQuotation = _isQuotation; |
296 | 336 | isMask = _isMask; |
297 | 337 | recCount = 0; |
298 | - String lnSprtr = CmnUtils.getLineSeparator("ls", System.getProperty("line.separator")); | |
299 | - if(System.getProperty("nm")!= null)nullMark = System.getProperty("nm"); | |
338 | + if(!CmnUtils.isEmpty(prop_val[LINESEP]))lnSprtr = CmnUtils.getLineSeparator(prop_val[LINESEP]); | |
339 | + if(!CmnUtils.isEmpty(prop_val[NULLMARK]))nullMark = prop_val[NULLMARK]; | |
340 | + | |
300 | 341 | while (rst.next()) { |
301 | 342 | colString = null; |
302 | 343 | for(int i=0;i<ColumnCount;i++){ |
@@ -393,11 +434,13 @@ public class DataAccessObjects{ | ||
393 | 434 | Clob colClob = null; |
394 | 435 | ByteArrayOutputStream baos = null; |
395 | 436 | InputStream is = null; |
396 | - boolean isQuotation = CmnUtils.getSystemProperty("qt", true); | |
397 | - boolean isMask = CmnUtils.getSystemProperty("imc", false) || CmnUtils.getSystemProperty("emc", false); | |
398 | - char hankakuMask = CmnUtils.getSystemProperty("hmm", '*'); | |
399 | - char zenkakuMask = CmnUtils.getSystemProperty("zmm", '*'); | |
400 | - String maskPtn = CmnUtils.getSystemProperty("mp", MASK_PTN[MASK_PTN_ALT]); | |
437 | + if(!CmnUtils.isEmpty(prop_val[QUOTATION]) && prop_val[QUOTATION].toUpperCase().equals("N"))isQuotation = false; | |
438 | + if(!CmnUtils.isEmpty(prop_val[INCLCOLMASK]))isInclMaskCols = true; | |
439 | + if(!CmnUtils.isEmpty(prop_val[EXCLCOLMASK]))isExclMaskCols = true; | |
440 | + if(isInclMaskCols || isExclMaskCols)isMask = true; | |
441 | + if(!CmnUtils.isEmpty(prop_val[SBYTEMASKCHR]))singleByteChr = prop_val[SBYTEMASKCHR].charAt(0); | |
442 | + if(!CmnUtils.isEmpty(prop_val[DBYTEMASKCHR]))doubleByteChr = prop_val[DBYTEMASKCHR].charAt(0); | |
443 | + if(!CmnUtils.isEmpty(prop_val[MASKPTN]))maskPtn = prop_val[MASKPTN]; | |
401 | 444 | |
402 | 445 | if (CmnUtils.isColString(_colTypeName)) { |
403 | 446 | colString = _rst.getString(_rec_cnt); |
@@ -419,9 +462,9 @@ public class DataAccessObjects{ | ||
419 | 462 | ) |
420 | 463 | ){ |
421 | 464 | if(CmnUtils.isHankaku(colString.charAt(j))){ |
422 | - sb.append(hankakuMask); | |
465 | + sb.append(singleByteChr); | |
423 | 466 | } else { |
424 | - sb.append(zenkakuMask); | |
467 | + sb.append(doubleByteChr); | |
425 | 468 | } |
426 | 469 | } else { |
427 | 470 | sb.append(colString.charAt(j)); |
@@ -9,6 +9,7 @@ import java.io.FileOutputStream; | ||
9 | 9 | import java.io.FileReader; |
10 | 10 | import java.io.FileWriter; |
11 | 11 | import java.io.InputStream; |
12 | +import java.io.InputStreamReader; | |
12 | 13 | import java.io.IOException; |
13 | 14 | import java.io.OutputStreamWriter; |
14 | 15 | import java.io.PrintWriter; |
@@ -45,6 +46,63 @@ public class RapideUnloader{ | ||
45 | 46 | private static final int MASK_PTN_ALT = 1; |
46 | 47 | private static final int MASK_PTN_EDGE = 2; |
47 | 48 | private static final String [] MASK_PTN = {"ALL", "ALT", "EDGE"}; |
49 | + private static final int USER = 0; | |
50 | + private static final int PASS = 1; | |
51 | + private static final int URL = 2; | |
52 | + private static final int DRIVER = 3; | |
53 | + private static final int OUTPUT = 4; | |
54 | + private static final int INPUT = 5; | |
55 | + private static final int LINESEP = 6; | |
56 | + private static final int INLINESEP = 7; | |
57 | + private static final int FILENCODE = 8; | |
58 | + private static final int NULLMARK = 9; | |
59 | + private static final int DELIMITER = 10; | |
60 | + private static final int TBLSQL = 11; | |
61 | + private static final int TBLKEYSQL = 12; | |
62 | + private static final int ORDER = 13; | |
63 | + private static final int QUOTATION = 14; | |
64 | + private static final int BATCOUNT = 15; | |
65 | + private static final int INCLTAB = 16; | |
66 | + private static final int EXCLTAB = 17; | |
67 | + private static final int INCLCOL = 18; | |
68 | + private static final int EXCLCOL = 19; | |
69 | + private static final int INCLCOLMASK = 20; | |
70 | + private static final int EXCLCOLMASK = 21; | |
71 | + private static final int SBYTEMASKCHR = 22; | |
72 | + private static final int DBYTEMASKCHR = 23; | |
73 | + private static final int MASKPTN = 24; | |
74 | + private static final int PROPFILE = 25; | |
75 | + private static final String [] PROP_KEY = { | |
76 | + "us", | |
77 | + "pw", | |
78 | + "url", | |
79 | + "dr", | |
80 | + "out", | |
81 | + "in", | |
82 | + "ls", | |
83 | + "ils", | |
84 | + "fe", | |
85 | + "nm", | |
86 | + "dm", | |
87 | + "ts", | |
88 | + "tks", | |
89 | + "od", | |
90 | + "qt", | |
91 | + "bc", | |
92 | + "it", | |
93 | + "et", | |
94 | + "ic", | |
95 | + "ec", | |
96 | + "icm", | |
97 | + "ecm", | |
98 | + "smc", | |
99 | + "dmc", | |
100 | + "mp", | |
101 | + "pf" | |
102 | + }; | |
103 | + private static final int KEYS = 26; | |
104 | + private String [] prop_val = new String[KEYS]; | |
105 | + | |
48 | 106 | private String propFile = "RapideLoader.properties"; |
49 | 107 | |
50 | 108 | private static String [] arySql_table_list = { |
@@ -100,18 +158,17 @@ public class RapideUnloader{ | ||
100 | 158 | } |
101 | 159 | |
102 | 160 | private void getProperties(String _propFile) throws Exception{ |
103 | - InputStream is = null; | |
161 | + BufferedReader br = null; | |
104 | 162 | Properties prop = null; |
105 | 163 | try { |
106 | 164 | prop = new Properties(); |
107 | - is = RapideUnloader.class.getClassLoader().getResourceAsStream(_propFile); | |
108 | - prop.load(is); | |
109 | - user = prop.getProperty(database + "." + "us"); | |
110 | - pass = prop.getProperty(database + "." + "pw"); | |
111 | - url = prop.getProperty(database + "." + "url"); | |
112 | - driver = prop.getProperty(database + "." + "dr"); | |
113 | - is.close(); | |
114 | - is = null; | |
165 | + br = new BufferedReader(new InputStreamReader(new FileInputStream(_propFile), "UTF-8")); | |
166 | + prop.load(br); | |
167 | + for(int i=0;i<KEYS;i++){ | |
168 | + prop_val[i] = prop.getProperty(database + "." +PROP_KEY[i]); | |
169 | + } | |
170 | + br.close(); | |
171 | + br = null; | |
115 | 172 | } catch (NullPointerException e) { |
116 | 173 | throw new Exception("Property File (" + _propFile +") Not Found"); |
117 | 174 | } catch (IOException e) { |
@@ -119,9 +176,9 @@ public class RapideUnloader{ | ||
119 | 176 | } |
120 | 177 | finally{ |
121 | 178 | try { |
122 | - if (is != null) { | |
123 | - is.close(); | |
124 | - is = null; | |
179 | + if (br != null) { | |
180 | + br.close(); | |
181 | + br = null; | |
125 | 182 | } |
126 | 183 | } |
127 | 184 | catch (IOException e) { |
@@ -151,35 +208,35 @@ public class RapideUnloader{ | ||
151 | 208 | int tb_count = 0; |
152 | 209 | int tb_col_count = 0; |
153 | 210 | |
154 | - boolean isOrder = CmnUtils.getSystemProperty("od", false); | |
155 | - boolean isQuotation = CmnUtils.getSystemProperty("qt", true); | |
156 | - boolean isInclTables = CmnUtils.getSystemProperty("it", false); | |
157 | - boolean isExclTables = CmnUtils.getSystemProperty("et", false); | |
158 | - boolean isInclCols = CmnUtils.getSystemProperty("ic", false); | |
159 | - boolean isExclCols = CmnUtils.getSystemProperty("ec", false); | |
160 | - boolean isMask = CmnUtils.getSystemProperty("imc", false) || CmnUtils.getSystemProperty("emc", false); | |
161 | - boolean isInclMaskCols = CmnUtils.getSystemProperty("imc", false); | |
162 | - boolean isExclMaskCols = CmnUtils.getSystemProperty("emc", false); | |
163 | - String dlmtr = CmnUtils.getSeparator("dm", "\t"); | |
164 | - String lnSprtr = CmnUtils.getLineSeparator("ls", System.getProperty("line.separator")); | |
211 | + boolean isOrder = false; | |
212 | + boolean isQuotation = true; | |
213 | + boolean isInclTables = false; | |
214 | + boolean isExclTables = false; | |
215 | + boolean isInclCols = false; | |
216 | + boolean isExclCols = false; | |
217 | + boolean isMask = false; | |
218 | + boolean isInclMaskCols = false; | |
219 | + boolean isExclMaskCols = false; | |
220 | + String dlmtr = "\t"; | |
221 | + String lnSprtr = System.getProperty("line.separator"); | |
165 | 222 | String defaultFldr = "output"; |
166 | - String outFldr = System.getProperty("out"); | |
167 | - String inclTables = System.getProperty("it"); | |
168 | - String exclTables = System.getProperty("et"); | |
169 | - String inclCols = System.getProperty("ic"); | |
170 | - String exclCols = System.getProperty("ec"); | |
171 | - String inclMaskCols = System.getProperty("imc"); | |
172 | - String exclMaskCols = System.getProperty("emc"); | |
173 | - String [] aryInclTables = CmnUtils.getSystemProperty("it"); | |
174 | - String [] aryExclTables = CmnUtils.getSystemProperty("et"); | |
175 | - String [] aryInclMaskCols = CmnUtils.getSystemProperty("imc"); | |
176 | - String [] aryExclMaskCols = CmnUtils.getSystemProperty("emc"); | |
177 | - String [] aryInclCols = CmnUtils.getSystemProperty("ic"); | |
178 | - String [] aryExclCols = CmnUtils.getSystemProperty("ec"); | |
179 | - char hankakuMask = CmnUtils.getSystemProperty("hmm", '*'); | |
180 | - char zenkakuMask = CmnUtils.getSystemProperty("zmm", '*'); | |
181 | - String maskPtn = CmnUtils.getSystemProperty("mp", "alt"); | |
182 | - String fileEncoding = CmnUtils.getSystemProperty("fe", System.getProperty("file.encoding")); | |
223 | + String outFldr = null; | |
224 | + String inclTables = null; | |
225 | + String exclTables = null; | |
226 | + String inclCols = null; | |
227 | + String exclCols = null; | |
228 | + String inclMaskCols = null; | |
229 | + String exclMaskCols = null; | |
230 | + String [] aryInclTables = null; | |
231 | + String [] aryExclTables = null; | |
232 | + String [] aryInclMaskCols = null; | |
233 | + String [] aryExclMaskCols = null; | |
234 | + String [] aryInclCols = null; | |
235 | + String [] aryExclCols = null; | |
236 | + char SingleByteChr = '*'; | |
237 | + char DoubleByteChr = '*'; | |
238 | + String maskPtn = "ALT"; | |
239 | + String fileEncoding = System.getProperty("file.encoding"); | |
183 | 240 | |
184 | 241 | if(database != null){ |
185 | 242 | if(System.getProperty("pf") != null){ |
@@ -187,16 +244,45 @@ public class RapideUnloader{ | ||
187 | 244 | } else { |
188 | 245 | getProperties(propFile); |
189 | 246 | } |
190 | - } else { | |
191 | - user = System.getProperty("us"); | |
192 | - pass = System.getProperty("pw"); | |
193 | - url = System.getProperty("url"); | |
194 | - driver = System.getProperty("dr"); | |
195 | 247 | } |
196 | - CmnUtils.debugPrint("user=" + user); | |
197 | - CmnUtils.debugPrint("password=" + pass); | |
198 | - CmnUtils.debugPrint("url=" + url); | |
199 | - CmnUtils.debugPrint("driver=" + driver); | |
248 | + | |
249 | + for(int i=0;i<KEYS;i++){ | |
250 | + if(System.getProperty(PROP_KEY[i])!=null)prop_val[i] = System.getProperty(PROP_KEY[i]); | |
251 | + CmnUtils.debugPrint(PROP_KEY[i] + "=" + prop_val[i]); | |
252 | + } | |
253 | + | |
254 | + if(!CmnUtils.isEmpty(prop_val[USER]))user = prop_val[USER]; | |
255 | + if(!CmnUtils.isEmpty(prop_val[PASS]))pass = prop_val[PASS]; | |
256 | + if(!CmnUtils.isEmpty(prop_val[URL]))url = prop_val[URL]; | |
257 | + if(!CmnUtils.isEmpty(prop_val[DRIVER]))driver = prop_val[DRIVER]; | |
258 | + if(!CmnUtils.isEmpty(prop_val[ORDER]) && prop_val[ORDER].toUpperCase().equals("Y"))isOrder = true; | |
259 | + if(!CmnUtils.isEmpty(prop_val[QUOTATION]) && prop_val[QUOTATION].toUpperCase().equals("N"))isQuotation = false; | |
260 | + if(!CmnUtils.isEmpty(prop_val[INCLTAB]))isInclTables = true; | |
261 | + if(!CmnUtils.isEmpty(prop_val[EXCLTAB]))isExclTables = true; | |
262 | + if(!CmnUtils.isEmpty(prop_val[INCLCOL]))isInclCols = true; | |
263 | + if(!CmnUtils.isEmpty(prop_val[EXCLCOL]))isExclCols = true; | |
264 | + if(!CmnUtils.isEmpty(prop_val[INCLCOLMASK]))isInclMaskCols = true; | |
265 | + if(!CmnUtils.isEmpty(prop_val[EXCLCOLMASK]))isExclMaskCols = true; | |
266 | + if(isInclMaskCols || isExclMaskCols)isMask = true; | |
267 | + if(!CmnUtils.isEmpty(prop_val[DELIMITER]))dlmtr = CmnUtils.getDelimiter(prop_val[DELIMITER]); | |
268 | + if(!CmnUtils.isEmpty(prop_val[LINESEP]))lnSprtr = CmnUtils.getLineSeparator(prop_val[LINESEP]); | |
269 | + if(!CmnUtils.isEmpty(prop_val[OUTPUT]))outFldr = prop_val[OUTPUT]; | |
270 | + if(!CmnUtils.isEmpty(prop_val[INCLTAB]))inclTables = prop_val[INCLTAB].toUpperCase(); | |
271 | + if(!CmnUtils.isEmpty(prop_val[EXCLTAB]))exclTables = prop_val[EXCLTAB].toUpperCase(); | |
272 | + if(!CmnUtils.isEmpty(prop_val[INCLCOL]))inclCols = prop_val[INCLCOL].toUpperCase(); | |
273 | + if(!CmnUtils.isEmpty(prop_val[EXCLCOL]))exclCols = prop_val[EXCLCOL].toUpperCase(); | |
274 | + if(!CmnUtils.isEmpty(prop_val[INCLCOLMASK]))inclMaskCols = prop_val[INCLCOLMASK].toUpperCase(); | |
275 | + if(!CmnUtils.isEmpty(prop_val[EXCLCOLMASK]))exclMaskCols = prop_val[EXCLCOLMASK].toUpperCase(); | |
276 | + if(!CmnUtils.isEmpty(prop_val[INCLTAB]))aryInclTables = CmnUtils.splitCsv(prop_val[INCLTAB].toUpperCase()); | |
277 | + if(!CmnUtils.isEmpty(prop_val[EXCLTAB]))aryExclTables = CmnUtils.splitCsv(prop_val[EXCLTAB].toUpperCase()); | |
278 | + if(!CmnUtils.isEmpty(prop_val[INCLCOL]))aryInclCols = CmnUtils.splitCsv(prop_val[INCLCOL].toUpperCase()); | |
279 | + if(!CmnUtils.isEmpty(prop_val[EXCLCOL]))aryExclCols = CmnUtils.splitCsv(prop_val[EXCLCOL].toUpperCase()); | |
280 | + if(!CmnUtils.isEmpty(prop_val[INCLCOLMASK]))aryInclMaskCols = CmnUtils.splitCsv(prop_val[INCLCOLMASK].toUpperCase()); | |
281 | + if(!CmnUtils.isEmpty(prop_val[EXCLCOLMASK]))aryExclMaskCols = CmnUtils.splitCsv(prop_val[EXCLCOLMASK].toUpperCase()); | |
282 | + if(!CmnUtils.isEmpty(prop_val[SBYTEMASKCHR]))SingleByteChr = prop_val[SBYTEMASKCHR].charAt(0); | |
283 | + if(!CmnUtils.isEmpty(prop_val[DBYTEMASKCHR]))DoubleByteChr = prop_val[DBYTEMASKCHR].charAt(0); | |
284 | + if(!CmnUtils.isEmpty(prop_val[MASKPTN]))maskPtn = prop_val[MASKPTN]; | |
285 | + if(!CmnUtils.isEmpty(prop_val[FILENCODE]))fileEncoding = prop_val[FILENCODE]; | |
200 | 286 | |
201 | 287 | if(user == null){ |
202 | 288 | throw new Exception("user is null"); |
@@ -216,8 +302,8 @@ public class RapideUnloader{ | ||
216 | 302 | } |
217 | 303 | |
218 | 304 | if (dbType != DB_TYPE_UNKNOWN){ |
219 | - if(System.getProperty("sql_table_list") != null){ | |
220 | - sql_table_list = System.getProperty("sql_table_list"); | |
305 | + if(!CmnUtils.isEmpty(prop_val[TBLKEYSQL])){ | |
306 | + sql_table_list = prop_val[TBLKEYSQL]; | |
221 | 307 | } else { |
222 | 308 | sql_table_list = arySql_table_list[dbType]; |
223 | 309 | } |
@@ -226,6 +312,7 @@ public class RapideUnloader{ | ||
226 | 312 | } |
227 | 313 | |
228 | 314 | DataAccessObjects dao = new DataAccessObjects(user, pass, url, driver); |
315 | + dao.setPropVal(prop_val); | |
229 | 316 | try { |
230 | 317 | conn = dao.connect(); |
231 | 318 |
@@ -242,11 +329,11 @@ public class RapideUnloader{ | ||
242 | 329 | |
243 | 330 | if(database!=null)CmnUtils.infoPrint("-->Database='" + database.toUpperCase() + "'"); |
244 | 331 | CmnUtils.infoPrint("-->Output='" + fldr + "'"); |
245 | - if(System.getProperty("dm")!=null)CmnUtils.infoPrint("-->Delimiter='" + dlmtr + "'"); | |
246 | - if(System.getProperty("ls")!=null)CmnUtils.infoPrint("-->LineSeparator='" + System.getProperty("ls") + "'"); | |
247 | - if(System.getProperty("fe")!=null)CmnUtils.infoPrint("-->FileEncoding='" + fileEncoding + "'"); | |
248 | - if(System.getProperty("qt")!=null)CmnUtils.infoPrint("-->Quotation=" + CmnUtils.getYesNo(isQuotation)); | |
249 | - if(System.getProperty("od")!=null)CmnUtils.infoPrint("-->Sort=" + CmnUtils.getYesNo(isOrder)); | |
332 | + if(!CmnUtils.isEmpty(prop_val[DELIMITER]))CmnUtils.infoPrint("-->Delimiter='" + prop_val[DELIMITER] + "'"); | |
333 | + if(!CmnUtils.isEmpty(prop_val[LINESEP]))CmnUtils.infoPrint("-->LineSeparator='" + prop_val[LINESEP] + "'"); | |
334 | + if(!CmnUtils.isEmpty(prop_val[FILENCODE]))CmnUtils.infoPrint("-->FileEncoding='" + prop_val[FILENCODE] + "'"); | |
335 | + if(!CmnUtils.isEmpty(prop_val[QUOTATION]))CmnUtils.infoPrint("-->Quotation=" + CmnUtils.getYesNo(isQuotation)); | |
336 | + if(!CmnUtils.isEmpty(prop_val[ORDER]))CmnUtils.infoPrint("-->Sort=" + CmnUtils.getYesNo(isOrder)); | |
250 | 337 | if(isInclTables)CmnUtils.infoPrint("-->Include Tables='" + inclTables.toUpperCase() + "'"); |
251 | 338 | if(isExclTables)CmnUtils.infoPrint("-->Exclude Tables='" + exclTables.toUpperCase() + "'"); |
252 | 339 | if(isInclCols)CmnUtils.infoPrint("-->Include Columns='" + inclCols.toUpperCase() + "'"); |
@@ -255,9 +342,9 @@ public class RapideUnloader{ | ||
255 | 342 | CmnUtils.infoPrint("-->Masking=" + CmnUtils.getYesNo(isMask)); |
256 | 343 | CmnUtils.infoPrint("-->Masking Pattern=" + maskPtn.toUpperCase()); |
257 | 344 | if(isInclMaskCols)CmnUtils.infoPrint("-->Masking Columns='" + inclMaskCols.toUpperCase() + "'"); |
258 | - if(isExclMaskCols)CmnUtils.infoPrint("-->NonMasking Columns='" + exclMaskCols.toUpperCase() + "'"); | |
259 | - CmnUtils.infoPrint("-->1byte Mask Mark='" + hankakuMask + "'"); | |
260 | - CmnUtils.infoPrint("-->2byte Mask Mark='" + zenkakuMask + "'"); | |
345 | + if(isExclMaskCols)CmnUtils.infoPrint("-->Exclude Masking Columns='" + exclMaskCols.toUpperCase() + "'"); | |
346 | + CmnUtils.infoPrint("-->Single Byte Mask Char='" + SingleByteChr + "'"); | |
347 | + CmnUtils.infoPrint("-->Double Byte Mask Char='" + DoubleByteChr + "'"); | |
261 | 348 | } |
262 | 349 | CmnUtils.infoPrint("Start DataUnload ---------------------------------------------"); |
263 | 350 |
@@ -0,0 +1,13 @@ | ||
1 | + | |
2 | +# Please enter the commit message for your changes. Lines starting | |
3 | +# with '#' will be ignored, and an empty message aborts the commit. | |
4 | +# On branch master | |
5 | +# Your branch is up-to-date with 'com/master'. | |
6 | +# | |
7 | +# Changes to be committed: | |
8 | +# new file: com/rapide_act/CmnUtils.java | |
9 | +# new file: com/rapide_act/DataAccessObjects.java | |
10 | +# new file: com/rapide_act/RapideLoader.java | |
11 | +# new file: com/rapide_act/RapideUnloader.java | |
12 | +# | |
13 | + |