summaryrefslogtreecommitdiff
path: root/filter/source/config/tools/split/FCFGSplit.java
blob: 4693db4cdf837f190657e90332a685ca4e1b6534 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

package com.sun.star.filter.config.tools.split;

//_______________________________________________

import java.lang.*;
import java.util.*;
import java.io.*;
import com.sun.star.filter.config.tools.utils.*;

//_______________________________________________

/**
 *  Implements a simple command line tool, which can read a given xml
 *  configuration file of the filter configuration, analyze it
 *  and split it into different xml fragments.
 *  All parameters of this process can be given by a configuration file.
 *
 *
 */
public class FCFGSplit
{
    //___________________________________________
    // private const

    /** specify the command line parameter to set the debug level for this app. */
    private static final java.lang.String CMD_DEBUG = "debug" ;

    /** specify the command line parameter to set a configuration file for this app. */
    private static final java.lang.String CMD_CONFIG = "config";

    /** The following strings are used as property names of
     *  the configuration file we need here.
     *
     *  @seealso    readCfg()
     */

    private static final java.lang.String CFGKEY_XMLFILE                              = "xmlfile"                             ;
    private static final java.lang.String CFGKEY_INFORMAT                             = "informat"                            ;
    private static final java.lang.String CFGKEY_OUTFORMAT                            = "outformat"                           ;
    private static final java.lang.String CFGKEY_INENCODING                           = "inencoding"                          ;
    private static final java.lang.String CFGKEY_OUTENCODING                          = "outencoding"                         ;
    private static final java.lang.String CFGKEY_OUTDIR                               = "outdir"                              ;
    private static final java.lang.String CFGKEY_FRAGMENT_EXTENSION                   = "fragment_extension"                  ;
    private static final java.lang.String CFGKEY_CREATE_COMBINE_FILTER_FLAG           = "create_combine_filter_flag"          ;
    private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_BROWSERPREFERRED  = "remove_filter_flag_browserpreferred" ;
    private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_PREFERRED         = "remove_filter_flag_preferred"        ;
    private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_3RDPARTY          = "remove_filter_flag_3rdparty"         ;
    private static final java.lang.String CFGKEY_REMOVE_FILTER_UINAMES                = "remove_filter_uinames"               ;
    private static final java.lang.String CFGKEY_REMOVE_GRAPHIC_FILTERS               = "remove_graphic_filters"              ;
    private static final java.lang.String CFGKEY_SET_DEFAULT_DETECTOR                 = "set_default_detector"                ;

    private static final java.lang.String CFGKEY_SUBDIR_TYPES                         = "subdir_types"                        ;
    private static final java.lang.String CFGKEY_SUBDIR_FILTERS                       = "subdir_filters"                      ;
    private static final java.lang.String CFGKEY_SUBDIR_DETECTSERVICES                = "subdir_detectservices"               ;
    private static final java.lang.String CFGKEY_SUBDIR_FRAMELOADERS                  = "subdir_frameloaders"                 ;
    private static final java.lang.String CFGKEY_SUBDIR_CONTENTHANDLERS               = "subdir_contenthandlers"              ;

    private static final java.lang.String CFGKEY_SEPERATE_FILTERS_BY_MODULE           = "seperate_filters_by_module"          ;

    private static final java.lang.String CFGKEY_SUBDIR_MODULE_SWRITER                = "subdir_module_swriter"               ;
    private static final java.lang.String CFGKEY_SUBDIR_MODULE_SWEB                   = "subdir_module_sweb"                  ;
    private static final java.lang.String CFGKEY_SUBDIR_MODULE_SGLOBAL                = "subdir_module_sglobal"               ;
    private static final java.lang.String CFGKEY_SUBDIR_MODULE_SCALC                  = "subdir_module_scalc"                 ;
    private static final java.lang.String CFGKEY_SUBDIR_MODULE_SDRAW                  = "subdir_module_sdraw"                 ;
    private static final java.lang.String CFGKEY_SUBDIR_MODULE_SIMPRESS               = "subdir_module_simpress"              ;
    private static final java.lang.String CFGKEY_SUBDIR_MODULE_SMATH                  = "subdir_module_smath"                 ;
    private static final java.lang.String CFGKEY_SUBDIR_MODULE_SCHART                 = "subdir_module_schart"                ;
    private static final java.lang.String CFGKEY_SUBDIR_MODULE_OTHERS                 = "subdir_module_others"                ;

    /** The following strings are used as property default
     *  values if a configuration key does not exist.
     *  It must be a string value, because the class java.util.Properties
     *  accept it as the only type. But of course the value must be
     *  convertable to the right target type.
     *
     *  @seealso    readCfg()
     */

    private static final java.lang.String DEFAULT_XMLFILE                             = ".//TypeDetection.xcu"                ;
    private static final java.lang.String DEFAULT_INFORMAT                            = "6.0"                                 ;
    private static final java.lang.String DEFAULT_OUTFORMAT                           = "6.Y"                                 ;
    private static final java.lang.String DEFAULT_INENCODING                          = "UTF-8"                               ;
    private static final java.lang.String DEFAULT_OUTENCODING                         = "UTF-8"                               ;
    private static final java.lang.String DEFAULT_OUTDIR                              = ".//temp"                             ;
    private static final java.lang.String DEFAULT_FRAGMENT_EXTENSION                  = ".xcu"                                ;
    private static final java.lang.String DEFAULT_CREATE_COMBINE_FILTER_FLAG          = "false"                               ;
    private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_BROWSERPREFERRED = "false"                               ;
    private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_PREFERRED        = "false"                               ;
    private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_3RDPARTY         = "false"                               ;
    private static final java.lang.String DEFAULT_REMOVE_FILTER_UINAMES               = "false"                               ;
    private static final java.lang.String DEFAULT_REMOVE_GRAPHIC_FILTERS              = "false"                               ;
    private static final java.lang.String DEFAULT_SET_DEFAULT_DETECTOR                = "false"                               ;

    private static final java.lang.String DEFAULT_SUBDIR_TYPES                        = "Types"                               ;
    private static final java.lang.String DEFAULT_SUBDIR_FILTERS                      = "Filters"                             ;
    private static final java.lang.String DEFAULT_SUBDIR_DETECTSERVICES               = "DetectServices"                      ;
    private static final java.lang.String DEFAULT_SUBDIR_FRAMELOADERS                 = "FrameLoaders"                        ;
    private static final java.lang.String DEFAULT_SUBDIR_CONTENTHANDLERS              = "ContentHandlers"                     ;

    private static final java.lang.String DEFAULT_SEPERATE_FILTERS_BY_MODULE          = "false"                               ;

    private static final java.lang.String DEFAULT_SUBDIR_MODULE_SWRITER               = "SWriter"                             ;
    private static final java.lang.String DEFAULT_SUBDIR_MODULE_SWEB                  = "SWeb"                                ;
    private static final java.lang.String DEFAULT_SUBDIR_MODULE_SGLOBAL               = "SGlobal"                             ;
    private static final java.lang.String DEFAULT_SUBDIR_MODULE_SCALC                 = "SCalc"                               ;
    private static final java.lang.String DEFAULT_SUBDIR_MODULE_SDRAW                 = "SDraw"                               ;
    private static final java.lang.String DEFAULT_SUBDIR_MODULE_SIMPRESS              = "SImpress"                            ;
    private static final java.lang.String DEFAULT_SUBDIR_MODULE_SMATH                 = "SMath"                               ;
    private static final java.lang.String DEFAULT_SUBDIR_MODULE_SCHART                = "SChart"                              ;
    private static final java.lang.String DEFAULT_SUBDIR_MODULE_OTHERS                = "Others"                              ;

    //___________________________________________
    // private member

    /** contains the name of the reading xcu file. */
    private static java.lang.String m_sXMLFile;

    /** specify the xml file format, which must be interpreted at reading time. */
    private static int m_nInFormat;

    /** specify the xml file format, which must be used
     *  to generate all xcu fragments. */
    private static int m_nOutFormat;

    /** specify the file encoding for reading. */
    private static java.lang.String m_sInEncoding;

    /** specify the file encoding for writing fragments. */
    private static java.lang.String m_sOutEncoding;

    /** specify the target directory, where all results of this
     *  process can be generated.
     *  Note: May it will be cleared! */
    private static java.lang.String m_sOutDir;

    /** can be used to generate some output on the console. */
    private static Logger m_aDebug;

    /** contains the file extension for all generated xml fragments. */
    private static java.lang.String m_sFragmentExtension;

    /** specify the sub directory to generate type fragments.
     *  Its meaned relativ to m_sOutDir. */
    private static java.lang.String m_sSubDirTypes;

    /** specify the sub directory to generate filter fragments.
     *  Its meaned relativ to m_sOutDir. */
    private static java.lang.String m_sSubDirFilters;

    /** specify the sub directory to generate detect service fragments.
     *  Its meaned relativ to m_sOutDir. */
    private static java.lang.String m_sSubDirDetectServices;

    /** specify the sub directory to generate frame loader fragments.
     *  Its meaned relativ to m_sOutDir. */
    private static java.lang.String m_sSubDirFrameLoaders;

    /** specify the sub directory to generate content handler fragments.
     *  Its meaned relativ to m_sOutDir. */
    private static java.lang.String m_sSubDirContentHandlers;

    /** enable/disable generating of filter groups - seperated by
     *  application modules. */
    private static boolean m_bSeperateFiltersByModule;

    /** specify the sub directory to generate filter groups
     *  for the module writer. Will be used only,
     *  if m_bSeperateFiltersByModule is set to TRUE.*/
    private static java.lang.String m_sSubDirModuleSWriter;

    /** specify the sub directory to generate filter groups
     *  for the module writer/web. Will be used only,
     *  if m_bSeperateFiltersByModule is set to TRUE.*/
    private static java.lang.String m_sSubDirModuleSWeb;

    /** specify the sub directory to generate filter groups
     *  for the module writer/global. Will be used only,
     *  if m_bSeperateFiltersByModule is set to TRUE.*/
    private static java.lang.String m_sSubDirModuleSGlobal;

    /** specify the sub directory to generate filter groups
     *  for the module calc. Will be used only,
     *  if m_bSeperateFiltersByModule is set to TRUE.*/
    private static java.lang.String m_sSubDirModuleSCalc;

    /** specify the sub directory to generate filter groups
     *  for the module draw. Will be used only,
     *  if m_bSeperateFiltersByModule is set to TRUE.*/
    private static java.lang.String m_sSubDirModuleSDraw;

    /** specify the sub directory to generate filter groups
     *  for the module impress. Will be used only,
     *  if m_bSeperateFiltersByModule is set to TRUE.*/
    private static java.lang.String m_sSubDirModuleSImpress;

    /** specify the sub directory to generate filter groups
     *  for the module math. Will be used only,
     *  if m_bSeperateFiltersByModule is set to TRUE.*/
    private static java.lang.String m_sSubDirModuleSMath;

    /** specify the sub directory to generate filter groups
     *  for the module chart. Will be used only,
     *  if m_bSeperateFiltersByModule is set to TRUE.*/
    private static java.lang.String m_sSubDirModuleSChart;

    /** specify the sub directory to generate filter groups
     *  for unknown modules - e.g. the graphic filters.
     *  Will be used only, if m_bSeperateFiltersByModule
     *  is set to TRUE.*/
    private static java.lang.String m_sSubDirModuleOthers;

    private static boolean m_bCreateCombineFilterFlag;
    private static boolean m_bRemoveFilterFlagBrowserPreferred;
    private static boolean m_bRemoveFilterFlagPreferred;
    private static boolean m_bRemoveFilterFlag3rdparty;
    private static boolean m_bRemoveFilterUINames;
    private static boolean m_bRemoveGraphicFilters;
    private static boolean m_bSetDefaultDetector;

    //___________________________________________
    // main

    /** main.
     *
     *  Analyze the command line arguments, load the configuration file,
     *  fill a cache from the specified xml file and generate all
     *  needed xml fragments inside the specified output directory.
     *
     *  @param  lArgs
     *          contains the command line arguments.
     */
    public static void main(java.lang.String[] lArgs)
    {
        long t_start = System.currentTimeMillis();

        // must be :-)
        FCFGSplit.printCopyright();
        // can be used as exit code
        int nErr = 0;

        // --------------------------------------------------------------------
        // analyze command line parameter
        ConfigHelper aCmdLine = null;
        try
        {
            aCmdLine = new ConfigHelper("com/sun/star/filter/config/tools/split/FCFGSplit.cfg", lArgs);
        }
        catch(java.lang.Throwable exCmdLine)
        {
            exCmdLine.printStackTrace();
            FCFGSplit.printHelp();
            System.exit(--nErr);
        }

        // --------------------------------------------------------------------
        // help requested?
        if (aCmdLine.isHelp())
        {
            FCFGSplit.printHelp();
            System.exit(--nErr);
        }

        // --------------------------------------------------------------------
        // initialize an output channel for errors/warnings etc.
        int nLevel = aCmdLine.getInt(CMD_DEBUG, Logger.LEVEL_DETAILEDINFOS);
        m_aDebug = new Logger(nLevel);
        try
        {
            FCFGSplit.readCfg(aCmdLine);
        }
        catch(java.lang.Exception exCfgLoad)
        {
            m_aDebug.setException(exCfgLoad);
            System.exit(--nErr);
        }

        // --------------------------------------------------------------------
        // check if the required resources exists
        java.io.File aXMLFile = new java.io.File(m_sXMLFile);
        if (!aXMLFile.exists() || !aXMLFile.isFile())
        {
            m_aDebug.setError("The specified xml file \""+aXMLFile.getPath()+"\" does not exist or seems not to be a simple file.");
            System.exit(--nErr);
        }

        java.io.File aOutDir = new java.io.File(m_sOutDir);
        if (!aOutDir.exists() || !aOutDir.isDirectory())
        {
            m_aDebug.setError("The specified directory \""+aOutDir.getPath()+"\" does not exist or seems not to be a directory.");
            System.exit(--nErr);
        }

        if (m_nInFormat == Cache.FORMAT_UNSUPPORTED)
        {
            m_aDebug.setError("The specified xml format for input is not supported.");
            System.exit(--nErr);
        }

        if (m_nOutFormat == Cache.FORMAT_UNSUPPORTED)
        {
            m_aDebug.setError("The specified xml format for output is not supported.");
            System.exit(--nErr);
        }

        // --------------------------------------------------------------------
        // load the xml file
        m_aDebug.setGlobalInfo("loading xml file \""+aXMLFile.getPath()+"\" ...");
        long t_load_start = System.currentTimeMillis();
        Cache aCache = new Cache(m_aDebug);
        try
        {
            aCache.fromXML(aXMLFile, m_nInFormat);
        }
        catch(java.lang.Throwable exLoad)
        {
            m_aDebug.setException(exLoad);
            System.exit(--nErr);
        }
        long t_load_end = System.currentTimeMillis();

        // --------------------------------------------------------------------
        // validate the content, fix some problems and convert it to the output format
        m_aDebug.setGlobalInfo("validate and transform to output format ...");
        long t_transform_start = System.currentTimeMillis();
        try
        {
            aCache.validate(m_nInFormat);
            if (
                (m_nInFormat  == Cache.FORMAT_60) &&
                (m_nOutFormat == Cache.FORMAT_6Y)
               )
            {
                aCache.transform60to6Y(m_bCreateCombineFilterFlag         ,
                                       m_bRemoveFilterFlagBrowserPreferred,
                                       m_bRemoveFilterFlagPreferred       ,
                                       m_bRemoveFilterFlag3rdparty        ,
                                       m_bRemoveFilterUINames             ,
                                       m_bRemoveGraphicFilters            ,
                                       m_bSetDefaultDetector              );
            }
            aCache.validate(m_nOutFormat);
        }
        catch(java.lang.Throwable exTransform)
        {
            m_aDebug.setException(exTransform);
            System.exit(--nErr);
        }
        long t_transform_end = System.currentTimeMillis();

        // --------------------------------------------------------------------
        // generate all xml fragments
        m_aDebug.setGlobalInfo("generate xml fragments into directory \""+aOutDir.getPath()+"\" ...");
        long t_split_start = System.currentTimeMillis();
        try
        {
            SplitterData aDataSet = new SplitterData();
            aDataSet.m_aDebug                       = m_aDebug                  ;
            aDataSet.m_aCache                       = aCache                    ;
            aDataSet.m_nFormat                      = m_nOutFormat              ;
            aDataSet.m_sEncoding                    = m_sOutEncoding            ;
            aDataSet.m_bSeperateFiltersByModule     = m_bSeperateFiltersByModule;
            aDataSet.m_sFragmentExtension           = m_sFragmentExtension      ;
            aDataSet.m_aOutDir                      = aOutDir                   ;

            aDataSet.m_aFragmentDirTypes            = new java.io.File(aOutDir, m_sSubDirTypes          );
            aDataSet.m_aFragmentDirFilters          = new java.io.File(aOutDir, m_sSubDirFilters        );
            aDataSet.m_aFragmentDirDetectServices   = new java.io.File(aOutDir, m_sSubDirDetectServices );
            aDataSet.m_aFragmentDirFrameLoaders     = new java.io.File(aOutDir, m_sSubDirFrameLoaders   );
            aDataSet.m_aFragmentDirContentHandlers  = new java.io.File(aOutDir, m_sSubDirContentHandlers);

            if (m_bSeperateFiltersByModule)
            {
                aDataSet.m_aFragmentDirModuleSWriter  = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSWriter );
                aDataSet.m_aFragmentDirModuleSWeb     = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSWeb    );
                aDataSet.m_aFragmentDirModuleSGlobal  = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSGlobal );
                aDataSet.m_aFragmentDirModuleSCalc    = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSCalc   );
                aDataSet.m_aFragmentDirModuleSDraw    = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSDraw   );
                aDataSet.m_aFragmentDirModuleSImpress = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSImpress);
                aDataSet.m_aFragmentDirModuleSMath    = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSMath   );
                aDataSet.m_aFragmentDirModuleSChart   = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSChart  );
                aDataSet.m_aFragmentDirModuleOthers   = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleOthers  );
            }
            else
            {
                aDataSet.m_aFragmentDirModuleSWriter  = aDataSet.m_aFragmentDirFilters;
                aDataSet.m_aFragmentDirModuleSWeb     = aDataSet.m_aFragmentDirFilters;
                aDataSet.m_aFragmentDirModuleSGlobal  = aDataSet.m_aFragmentDirFilters;
                aDataSet.m_aFragmentDirModuleSCalc    = aDataSet.m_aFragmentDirFilters;
                aDataSet.m_aFragmentDirModuleSDraw    = aDataSet.m_aFragmentDirFilters;
                aDataSet.m_aFragmentDirModuleSImpress = aDataSet.m_aFragmentDirFilters;
                aDataSet.m_aFragmentDirModuleSMath    = aDataSet.m_aFragmentDirFilters;
                aDataSet.m_aFragmentDirModuleSChart   = aDataSet.m_aFragmentDirFilters;
                aDataSet.m_aFragmentDirModuleOthers   = aDataSet.m_aFragmentDirFilters;
            }

            Splitter aSplitter = new Splitter(aDataSet);
            aSplitter.split();
        }
        catch(java.lang.Throwable exSplit)
        {
            m_aDebug.setException(exSplit);
            System.exit(--nErr);
        }
        long t_split_end = System.currentTimeMillis();

        // --------------------------------------------------------------------
        // generate some special views
        m_aDebug.setGlobalInfo("generate views and statistics ...");
        long t_statistics_start = System.currentTimeMillis();
        try
        {
            aCache.analyze();
            aCache.toHTML(aOutDir, m_nOutFormat, m_sOutEncoding);
            m_aDebug.setDetailedInfo(aCache.getStatistics());
        }
        catch(java.lang.Throwable exStatistics)
        {
            m_aDebug.setException(exStatistics);
            System.exit(--nErr);
        }
        long t_statistics_end = System.currentTimeMillis();

        // --------------------------------------------------------------------
        // analyze some time stamps
        long t_end = System.currentTimeMillis();

        java.lang.StringBuffer sTimes = new java.lang.StringBuffer(100);
        sTimes.append("Needed times:\n"                  );
        sTimes.append("t [all]\t\t=\t"                   );
        sTimes.append(t_end-t_start                      );
        sTimes.append(" ms\n"                            );
        sTimes.append("t [load]\t=\t"                    );
        sTimes.append(t_load_end-t_load_start            );
        sTimes.append(" ms\n"                            );
        sTimes.append("t [transform]\t=\t"               );
        sTimes.append(t_transform_end-t_transform_start  );
        sTimes.append(" ms\n"                            );
        sTimes.append("t [split]\t=\t"                   );
        sTimes.append(t_split_end-t_split_start          );
        sTimes.append(" ms\n"                            );
        sTimes.append("t [statistics]\t=\t"              );
        sTimes.append(t_statistics_end-t_statistics_start);
        sTimes.append(" ms\n"                            );
        m_aDebug.setDetailedInfo(sTimes.toString());

        // everyting seems to be ok.
        // Return "OK" to calli.
        m_aDebug.setGlobalInfo("Finish.");
        System.exit(0);
    }

    //___________________________________________

    /** read the configuration file.
     *
     *  @param  aCfg
     *          contains the content of the
     *          loaded configuration file.
     */
    private static void readCfg(java.util.Properties aCfg)
    {
        m_sXMLFile                  = aCfg.getProperty(CFGKEY_XMLFILE                   , DEFAULT_XMLFILE                   );

        m_sInEncoding               = aCfg.getProperty(CFGKEY_INENCODING                , DEFAULT_INENCODING                );
        m_sOutEncoding              = aCfg.getProperty(CFGKEY_OUTENCODING               , DEFAULT_OUTENCODING               );
        m_sOutDir                   = aCfg.getProperty(CFGKEY_OUTDIR                    , DEFAULT_OUTDIR                    );
        m_sFragmentExtension        = aCfg.getProperty(CFGKEY_FRAGMENT_EXTENSION        , DEFAULT_FRAGMENT_EXTENSION        );

        m_sSubDirTypes              = aCfg.getProperty(CFGKEY_SUBDIR_TYPES              , DEFAULT_SUBDIR_TYPES              );
        m_sSubDirFilters            = aCfg.getProperty(CFGKEY_SUBDIR_FILTERS            , DEFAULT_SUBDIR_FILTERS            );
        m_sSubDirDetectServices     = aCfg.getProperty(CFGKEY_SUBDIR_DETECTSERVICES     , DEFAULT_SUBDIR_DETECTSERVICES     );
        m_sSubDirFrameLoaders       = aCfg.getProperty(CFGKEY_SUBDIR_FRAMELOADERS       , DEFAULT_SUBDIR_FRAMELOADERS       );
        m_sSubDirContentHandlers    = aCfg.getProperty(CFGKEY_SUBDIR_CONTENTHANDLERS    , DEFAULT_SUBDIR_CONTENTHANDLERS    );

        m_sSubDirModuleSWriter      = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SWRITER     , DEFAULT_SUBDIR_MODULE_SWRITER     );
        m_sSubDirModuleSWeb         = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SWEB        , DEFAULT_SUBDIR_MODULE_SWEB        );
        m_sSubDirModuleSGlobal      = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SGLOBAL     , DEFAULT_SUBDIR_MODULE_SGLOBAL     );
        m_sSubDirModuleSCalc        = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SCALC       , DEFAULT_SUBDIR_MODULE_SCALC       );
        m_sSubDirModuleSDraw        = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SDRAW       , DEFAULT_SUBDIR_MODULE_SDRAW       );
        m_sSubDirModuleSImpress     = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SIMPRESS    , DEFAULT_SUBDIR_MODULE_SIMPRESS    );
        m_sSubDirModuleSMath        = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SMATH       , DEFAULT_SUBDIR_MODULE_SMATH       );
        m_sSubDirModuleSChart       = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SCHART      , DEFAULT_SUBDIR_MODULE_SCHART      );
        m_sSubDirModuleOthers       = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_OTHERS      , DEFAULT_SUBDIR_MODULE_OTHERS      );

        m_bSeperateFiltersByModule          = new java.lang.Boolean(aCfg.getProperty(CFGKEY_SEPERATE_FILTERS_BY_MODULE         , DEFAULT_SEPERATE_FILTERS_BY_MODULE         )).booleanValue();
        m_bCreateCombineFilterFlag          = new java.lang.Boolean(aCfg.getProperty(CFGKEY_CREATE_COMBINE_FILTER_FLAG         , DEFAULT_CREATE_COMBINE_FILTER_FLAG         )).booleanValue();
        m_bRemoveFilterFlagBrowserPreferred = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_BROWSERPREFERRED, DEFAULT_REMOVE_FILTER_FLAG_BROWSERPREFERRED)).booleanValue();
        m_bRemoveFilterFlagPreferred        = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_PREFERRED       , DEFAULT_REMOVE_FILTER_FLAG_PREFERRED       )).booleanValue();
        m_bRemoveFilterFlag3rdparty         = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_3RDPARTY        , DEFAULT_REMOVE_FILTER_FLAG_3RDPARTY        )).booleanValue();
        m_bRemoveFilterUINames              = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_UINAMES              , DEFAULT_REMOVE_FILTER_UINAMES              )).booleanValue();
        m_bRemoveGraphicFilters             = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_GRAPHIC_FILTERS             , DEFAULT_REMOVE_GRAPHIC_FILTERS             )).booleanValue();
        m_bSetDefaultDetector               = new java.lang.Boolean(aCfg.getProperty(CFGKEY_SET_DEFAULT_DETECTOR               , DEFAULT_SET_DEFAULT_DETECTOR               )).booleanValue();

        java.lang.String sFormat = aCfg.getProperty(CFGKEY_INFORMAT, DEFAULT_INFORMAT);
        m_nInFormat = Cache.mapFormatString2Format(sFormat);

        sFormat = aCfg.getProperty(CFGKEY_OUTFORMAT, DEFAULT_OUTFORMAT);
        m_nOutFormat = Cache.mapFormatString2Format(sFormat);
    }

    //___________________________________________

    /** prints out a copyright message on stdout.
     */
    private static void printCopyright()
    {
        java.lang.StringBuffer sOut = new java.lang.StringBuffer(256);
        sOut.append("FCFGSplit\n");
        sOut.append("Copyright: 2000 by Sun Microsystems, Inc.\n");
        sOut.append("All Rights Reserved.\n");
        System.out.println(sOut.toString());
    }

    //___________________________________________

    /** prints out a help message on stdout.
     */
    private static void printHelp()
    {
        java.lang.StringBuffer sOut = new java.lang.StringBuffer(1000);
        sOut.append("_______________________________________________________________________________\n\n"   );
        sOut.append("usage: FCFGSplit "+CMD_CONFIG+"=<file name> "+CMD_DEBUG+"=<level>\n"                       );
        sOut.append("parameters:\n"                                                                         );
        sOut.append("\t-help\n"                                                                             );
        sOut.append("\t\tshow this little help.\n\n"                                                        );
        sOut.append("\t"+CMD_CONFIG+"=<file name>\n"                                                        );
        sOut.append("\t\tspecify the configuration file.\n\n"                                               );
        sOut.append("\t"+CMD_DEBUG+"=<level>\n"                                                             );
        sOut.append("\t\tprints out some debug messages.\n"                                                 );
        sOut.append("\t\tlevel=[0..4]\n"                                                                    );
        sOut.append("\t\t0 => no debug messages\n"                                                          );
        sOut.append("\t\t1 => print out errors only\n"                                                      );
        sOut.append("\t\t2 => print out errors & warnings\n"                                                );
        sOut.append("\t\t3 => print out some global actions   (e.g. load file ...)\n"                       );
        sOut.append("\t\t4 => print out more detailed actions (e.g. load item nr. xxx of file.)\n\n"        );
        System.out.println(sOut.toString());
    }
}