merge the formfield patch from ooo-build
[ooovba.git] / transex3 / source / filter / merge / FCFGMerge.java
blob27c6b3bdf0bd0ed4b3232b18dbe602edb22da70a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: FCFGMerge.java,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package com.sun.star.filter.config.tools.merge;
33 //_______________________________________________
35 import java.lang.*;
36 import java.util.*;
37 import java.io.*;
38 import com.sun.star.filter.config.tools.utils.*;
40 //_______________________________________________
42 /**
43 * Its a simple command line tool, which can merge different XML fragments
44 * together. Such fragments must exist as files on disk, will be moved into
45 * one file together on disk.
49 public class FCFGMerge
51 //___________________________________________
52 // const
54 private static final java.lang.String CFGFILE = "com/sun/star/filter/config/tools/merge/FCFGMerge.cfg";
55 private static final java.lang.String PROP_LOGLEVEL = "loglevel";
57 //___________________________________________
58 // main
60 public static void main(java.lang.String[] sCmdLine)
62 FCFGMerge.printCopyright();
64 // create log object in default mode "WARNINGS"
65 // If a command line parameter indicates another
66 // level - change it!
67 Logger aLog = new Logger();
69 try
71 // merge config file and overwrite properties
72 // via command line
73 ConfigHelper aCfg = null;
74 aCfg = new ConfigHelper(CFGFILE, sCmdLine);
76 // update log level
77 int nLogLevel = aCfg.getInt(PROP_LOGLEVEL, Logger.LEVEL_WARNINGS);
78 aLog = new Logger(nLogLevel);
80 // help requested?
81 if (aCfg.isHelp())
83 FCFGMerge.printHelp();
84 System.exit(-1);
87 // create new merge object and start operation
88 Merger aMerger = new Merger(aCfg, aLog);
89 aMerger.merge();
91 catch(java.lang.Throwable ex)
93 aLog.setException(ex);
94 System.exit(-1);
97 System.exit(0);
100 //___________________________________________
102 /** prints out a copyright message on stdout.
104 private static void printCopyright()
106 java.lang.StringBuffer sOut = new java.lang.StringBuffer(256);
107 sOut.append("FCFGMerge\n");
108 sOut.append("Copyright: 2003 by Sun Microsystems, Inc.\n");
109 sOut.append("All Rights Reserved.\n");
110 System.out.println(sOut.toString());
113 //___________________________________________
115 /** prints out a help message on stdout.
117 private static void printHelp()
119 java.lang.StringBuffer sOut = new java.lang.StringBuffer(256);
120 sOut.append("____________________________________________________________\n");
121 sOut.append("usage: FCFGMerge cfg=<file name>\n" );
122 sOut.append("parameters:\n" );
123 sOut.append("\tcfg=<file name>\n" );
124 sOut.append("\t\tmust point to a system file, which contains\n" );
125 sOut.append("\t\tall neccessary configuration data for the merge process.\n");
126 sOut.append("\n\tFurther cou can specify every parameter allowed in the\n" );
127 sOut.append("\n\tconfig file as command line parameter too, to overwrite\n" );
128 sOut.append("\n\tthe value from the file.\n" );
129 System.out.println(sOut.toString());