Source code: com/ibatis/db/sqlmap/upgrade/SqlMapUpgradeTool.java
1 /*
2 * Copyright 2004 Clinton Begin
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.ibatis.db.sqlmap.upgrade;
17
18 import com.ibatis.common.exception.NestedRuntimeException;
19
20 import java.io.IOException;
21
22 public class SqlMapUpgradeTool {
23
24 private static final SqlMapXmlConverter CONVERTER = new SqlMapXmlConverter();
25
26 private SqlMapUpgradeTool() {
27 }
28
29 public static void main(String[] args) {
30 try {
31 if (args.length < 2 || args.length > 3) {
32 System.out.println("Usage:\n\njava " + SqlMapUpgradeTool.class.getName() + " [InputXMLFile] [OutputXMLFile]\n\n");
33 return;
34 } else if (args.length == 2) {
35 CONVERTER.convertFile(args[0], args[1]);
36 } else if (args.length == 3) {
37 // Backward compatibility before autodetect
38 CONVERTER.convertFile(args[1], args[2]);
39 }
40 } catch (IOException e) {
41 throw new NestedRuntimeException("Error running SQL Map Upgrade Tool. Cause: " + e, e);
42 }
43 }
44
45
46 }