1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package com.sun.star.filter.config.tools.split;
25 
26 //_______________________________________________
27 
28 import java.lang.*;
29 import java.util.*;
30 import java.io.*;
31 import com.sun.star.filter.config.tools.utils.*;
32 
33 //_______________________________________________
34 
35 /**
36  *  Implements a simple command line tool, which can read a given xml
37  *  configuration file of the filter configuration, analyze it
38  *  and split it into different xml fragments.
39  *  All parameters of this process can be given by a configuration file.
40  *
41  *
42  */
43 public class FCFGSplit
44 {
45     //___________________________________________
46     // private const
47 
48     /** specify the command line parameter to set the debug level for this app. */
49     private static final java.lang.String CMD_DEBUG = "debug" ;
50 
51     /** specify the command line parameter to set a configuration file for this app. */
52     private static final java.lang.String CMD_CONFIG = "config";
53 
54     /** The following strings are used as property names of
55      *  the configuration file we need here.
56      *
57      *  @seealso    readCfg()
58      */
59 
60     private static final java.lang.String CFGKEY_XMLFILE                              = "xmlfile"                             ;
61     private static final java.lang.String CFGKEY_INFORMAT                             = "informat"                            ;
62     private static final java.lang.String CFGKEY_OUTFORMAT                            = "outformat"                           ;
63     private static final java.lang.String CFGKEY_INENCODING                           = "inencoding"                          ;
64     private static final java.lang.String CFGKEY_OUTENCODING                          = "outencoding"                         ;
65     private static final java.lang.String CFGKEY_OUTDIR                               = "outdir"                              ;
66     private static final java.lang.String CFGKEY_FRAGMENT_EXTENSION                   = "fragment_extension"                  ;
67     private static final java.lang.String CFGKEY_CREATE_COMBINE_FILTER_FLAG           = "create_combine_filter_flag"          ;
68     private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_BROWSERPREFERRED  = "remove_filter_flag_browserpreferred" ;
69     private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_PREFERRED         = "remove_filter_flag_preferred"        ;
70     private static final java.lang.String CFGKEY_REMOVE_FILTER_FLAG_3RDPARTY          = "remove_filter_flag_3rdparty"         ;
71     private static final java.lang.String CFGKEY_REMOVE_FILTER_UINAMES                = "remove_filter_uinames"               ;
72     private static final java.lang.String CFGKEY_REMOVE_GRAPHIC_FILTERS               = "remove_graphic_filters"              ;
73     private static final java.lang.String CFGKEY_SET_DEFAULT_DETECTOR                 = "set_default_detector"                ;
74 
75     private static final java.lang.String CFGKEY_SUBDIR_TYPES                         = "subdir_types"                        ;
76     private static final java.lang.String CFGKEY_SUBDIR_FILTERS                       = "subdir_filters"                      ;
77     private static final java.lang.String CFGKEY_SUBDIR_DETECTSERVICES                = "subdir_detectservices"               ;
78     private static final java.lang.String CFGKEY_SUBDIR_FRAMELOADERS                  = "subdir_frameloaders"                 ;
79     private static final java.lang.String CFGKEY_SUBDIR_CONTENTHANDLERS               = "subdir_contenthandlers"              ;
80 
81     private static final java.lang.String CFGKEY_SEPERATE_FILTERS_BY_MODULE           = "seperate_filters_by_module"          ;
82 
83     private static final java.lang.String CFGKEY_SUBDIR_MODULE_SWRITER                = "subdir_module_swriter"               ;
84     private static final java.lang.String CFGKEY_SUBDIR_MODULE_SWEB                   = "subdir_module_sweb"                  ;
85     private static final java.lang.String CFGKEY_SUBDIR_MODULE_SGLOBAL                = "subdir_module_sglobal"               ;
86     private static final java.lang.String CFGKEY_SUBDIR_MODULE_SCALC                  = "subdir_module_scalc"                 ;
87     private static final java.lang.String CFGKEY_SUBDIR_MODULE_SDRAW                  = "subdir_module_sdraw"                 ;
88     private static final java.lang.String CFGKEY_SUBDIR_MODULE_SIMPRESS               = "subdir_module_simpress"              ;
89     private static final java.lang.String CFGKEY_SUBDIR_MODULE_SMATH                  = "subdir_module_smath"                 ;
90     private static final java.lang.String CFGKEY_SUBDIR_MODULE_SCHART                 = "subdir_module_schart"                ;
91     private static final java.lang.String CFGKEY_SUBDIR_MODULE_OTHERS                 = "subdir_module_others"                ;
92 
93     /** The following strings are used as property default
94      *  values if a configuration key does not exist.
95      *  It must be a string value, because the class java.util.Properties
96      *  accept it as the only type. But of course the value must be
97      *  convertable to the right target type.
98      *
99      *  @seealso    readCfg()
100      */
101 
102     private static final java.lang.String DEFAULT_XMLFILE                             = ".//TypeDetection.xcu"                ;
103     private static final java.lang.String DEFAULT_INFORMAT                            = "6.0"                                 ;
104     private static final java.lang.String DEFAULT_OUTFORMAT                           = "6.Y"                                 ;
105     private static final java.lang.String DEFAULT_INENCODING                          = "UTF-8"                               ;
106     private static final java.lang.String DEFAULT_OUTENCODING                         = "UTF-8"                               ;
107     private static final java.lang.String DEFAULT_OUTDIR                              = ".//temp"                             ;
108     private static final java.lang.String DEFAULT_FRAGMENT_EXTENSION                  = ".xcu"                                ;
109     private static final java.lang.String DEFAULT_CREATE_COMBINE_FILTER_FLAG          = "false"                               ;
110     private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_BROWSERPREFERRED = "false"                               ;
111     private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_PREFERRED        = "false"                               ;
112     private static final java.lang.String DEFAULT_REMOVE_FILTER_FLAG_3RDPARTY         = "false"                               ;
113     private static final java.lang.String DEFAULT_REMOVE_FILTER_UINAMES               = "false"                               ;
114     private static final java.lang.String DEFAULT_REMOVE_GRAPHIC_FILTERS              = "false"                               ;
115     private static final java.lang.String DEFAULT_SET_DEFAULT_DETECTOR                = "false"                               ;
116 
117     private static final java.lang.String DEFAULT_SUBDIR_TYPES                        = "Types"                               ;
118     private static final java.lang.String DEFAULT_SUBDIR_FILTERS                      = "Filters"                             ;
119     private static final java.lang.String DEFAULT_SUBDIR_DETECTSERVICES               = "DetectServices"                      ;
120     private static final java.lang.String DEFAULT_SUBDIR_FRAMELOADERS                 = "FrameLoaders"                        ;
121     private static final java.lang.String DEFAULT_SUBDIR_CONTENTHANDLERS              = "ContentHandlers"                     ;
122 
123     private static final java.lang.String DEFAULT_SEPERATE_FILTERS_BY_MODULE          = "false"                               ;
124 
125     private static final java.lang.String DEFAULT_SUBDIR_MODULE_SWRITER               = "SWriter"                             ;
126     private static final java.lang.String DEFAULT_SUBDIR_MODULE_SWEB                  = "SWeb"                                ;
127     private static final java.lang.String DEFAULT_SUBDIR_MODULE_SGLOBAL               = "SGlobal"                             ;
128     private static final java.lang.String DEFAULT_SUBDIR_MODULE_SCALC                 = "SCalc"                               ;
129     private static final java.lang.String DEFAULT_SUBDIR_MODULE_SDRAW                 = "SDraw"                               ;
130     private static final java.lang.String DEFAULT_SUBDIR_MODULE_SIMPRESS              = "SImpress"                            ;
131     private static final java.lang.String DEFAULT_SUBDIR_MODULE_SMATH                 = "SMath"                               ;
132     private static final java.lang.String DEFAULT_SUBDIR_MODULE_SCHART                = "SChart"                              ;
133     private static final java.lang.String DEFAULT_SUBDIR_MODULE_OTHERS                = "Others"                              ;
134 
135     //___________________________________________
136     // private member
137 
138     /** contains the name of the reading xcu file. */
139     private static java.lang.String m_sXMLFile;
140 
141     /** specify the xml file format, which must be interpreted at reading time. */
142     private static int m_nInFormat;
143 
144     /** specify the xml file format, which must be used
145      *  to generate all xcu fragments. */
146     private static int m_nOutFormat;
147 
148     /** specify the file encoding for reading. */
149     private static java.lang.String m_sInEncoding;
150 
151     /** specify the file encoding for writing fragments. */
152     private static java.lang.String m_sOutEncoding;
153 
154     /** specify the target directory, where all results of this
155      *  process can be generated.
156      *  Note: May it will be cleared! */
157     private static java.lang.String m_sOutDir;
158 
159     /** can be used to generate some output on the console. */
160     private static Logger m_aDebug;
161 
162     /** contains the file extension for all generated xml fragments. */
163     private static java.lang.String m_sFragmentExtension;
164 
165     /** specify the sub directory to generate type fragments.
166      *  Its meaned relativ to m_sOutDir. */
167     private static java.lang.String m_sSubDirTypes;
168 
169     /** specify the sub directory to generate filter fragments.
170      *  Its meaned relativ to m_sOutDir. */
171     private static java.lang.String m_sSubDirFilters;
172 
173     /** specify the sub directory to generate detect service fragments.
174      *  Its meaned relativ to m_sOutDir. */
175     private static java.lang.String m_sSubDirDetectServices;
176 
177     /** specify the sub directory to generate frame loader fragments.
178      *  Its meaned relativ to m_sOutDir. */
179     private static java.lang.String m_sSubDirFrameLoaders;
180 
181     /** specify the sub directory to generate content handler fragments.
182      *  Its meaned relativ to m_sOutDir. */
183     private static java.lang.String m_sSubDirContentHandlers;
184 
185     /** enable/disable generating of filter groups - seperated by
186      *  application modules. */
187     private static boolean m_bSeperateFiltersByModule;
188 
189     /** specify the sub directory to generate filter groups
190      *  for the module writer. Will be used only,
191      *  if m_bSeperateFiltersByModule is set to TRUE.*/
192     private static java.lang.String m_sSubDirModuleSWriter;
193 
194     /** specify the sub directory to generate filter groups
195      *  for the module writer/web. Will be used only,
196      *  if m_bSeperateFiltersByModule is set to TRUE.*/
197     private static java.lang.String m_sSubDirModuleSWeb;
198 
199     /** specify the sub directory to generate filter groups
200      *  for the module writer/global. Will be used only,
201      *  if m_bSeperateFiltersByModule is set to TRUE.*/
202     private static java.lang.String m_sSubDirModuleSGlobal;
203 
204     /** specify the sub directory to generate filter groups
205      *  for the module calc. Will be used only,
206      *  if m_bSeperateFiltersByModule is set to TRUE.*/
207     private static java.lang.String m_sSubDirModuleSCalc;
208 
209     /** specify the sub directory to generate filter groups
210      *  for the module draw. Will be used only,
211      *  if m_bSeperateFiltersByModule is set to TRUE.*/
212     private static java.lang.String m_sSubDirModuleSDraw;
213 
214     /** specify the sub directory to generate filter groups
215      *  for the module impress. Will be used only,
216      *  if m_bSeperateFiltersByModule is set to TRUE.*/
217     private static java.lang.String m_sSubDirModuleSImpress;
218 
219     /** specify the sub directory to generate filter groups
220      *  for the module math. Will be used only,
221      *  if m_bSeperateFiltersByModule is set to TRUE.*/
222     private static java.lang.String m_sSubDirModuleSMath;
223 
224     /** specify the sub directory to generate filter groups
225      *  for the module chart. Will be used only,
226      *  if m_bSeperateFiltersByModule is set to TRUE.*/
227     private static java.lang.String m_sSubDirModuleSChart;
228 
229     /** specify the sub directory to generate filter groups
230      *  for unknown modules - e.g. the graphic filters.
231      *  Will be used only, if m_bSeperateFiltersByModule
232      *  is set to TRUE.*/
233     private static java.lang.String m_sSubDirModuleOthers;
234 
235     private static boolean m_bCreateCombineFilterFlag;
236     private static boolean m_bRemoveFilterFlagBrowserPreferred;
237     private static boolean m_bRemoveFilterFlagPreferred;
238     private static boolean m_bRemoveFilterFlag3rdparty;
239     private static boolean m_bRemoveFilterUINames;
240     private static boolean m_bRemoveGraphicFilters;
241     private static boolean m_bSetDefaultDetector;
242 
243     //___________________________________________
244     // main
245 
246     /** main.
247      *
248      *  Analyze the command line arguments, load the configuration file,
249      *  fill a cache from the specified xml file and generate all
250      *  needed xml fragments inside the specified output directory.
251      *
252      *  @param  lArgs
253      *          contains the command line arguments.
254      */
main(java.lang.String[] lArgs)255     public static void main(java.lang.String[] lArgs)
256     {
257         long t_start = System.currentTimeMillis();
258 
259         // must be :-)
260         FCFGSplit.printCopyright();
261         // can be used as exit code
262         int nErr = 0;
263 
264         // --------------------------------------------------------------------
265         // analyze command line parameter
266         ConfigHelper aCmdLine = null;
267         try
268         {
269             aCmdLine = new ConfigHelper("com/sun/star/filter/config/tools/split/FCFGSplit.cfg", lArgs);
270         }
271         catch(java.lang.Throwable exCmdLine)
272         {
273             exCmdLine.printStackTrace();
274             FCFGSplit.printHelp();
275             System.exit(--nErr);
276         }
277 
278         // --------------------------------------------------------------------
279         // help requested?
280         if (aCmdLine.isHelp())
281         {
282             FCFGSplit.printHelp();
283             System.exit(--nErr);
284         }
285 
286         // --------------------------------------------------------------------
287         // initialize an output channel for errors/warnings etc.
288         int nLevel = aCmdLine.getInt(CMD_DEBUG, Logger.LEVEL_DETAILEDINFOS);
289         m_aDebug = new Logger(nLevel);
290         try
291         {
292             FCFGSplit.readCfg(aCmdLine);
293         }
294         catch(java.lang.Exception exCfgLoad)
295         {
296             m_aDebug.setException(exCfgLoad);
297             System.exit(--nErr);
298         }
299 
300         // --------------------------------------------------------------------
301         // check if the required resources exists
302         java.io.File aXMLFile = new java.io.File(m_sXMLFile);
303         if (!aXMLFile.exists() || !aXMLFile.isFile())
304         {
305             m_aDebug.setError("The specified xml file \""+aXMLFile.getPath()+"\" does not exist or seems not to be a simple file.");
306             System.exit(--nErr);
307         }
308 
309         java.io.File aOutDir = new java.io.File(m_sOutDir);
310         if (!aOutDir.exists() || !aOutDir.isDirectory())
311         {
312             m_aDebug.setError("The specified directory \""+aOutDir.getPath()+"\" does not exist or seems not to be a directory.");
313             System.exit(--nErr);
314         }
315 
316         if (m_nInFormat == Cache.FORMAT_UNSUPPORTED)
317         {
318             m_aDebug.setError("The specified xml format for input is not supported.");
319             System.exit(--nErr);
320         }
321 
322         if (m_nOutFormat == Cache.FORMAT_UNSUPPORTED)
323         {
324             m_aDebug.setError("The specified xml format for output is not supported.");
325             System.exit(--nErr);
326         }
327 
328         // --------------------------------------------------------------------
329         // load the xml file
330         m_aDebug.setGlobalInfo("loading xml file \""+aXMLFile.getPath()+"\" ...");
331         long t_load_start = System.currentTimeMillis();
332         Cache aCache = new Cache(m_aDebug);
333         try
334         {
335             aCache.fromXML(aXMLFile, m_nInFormat);
336         }
337         catch(java.lang.Throwable exLoad)
338         {
339             m_aDebug.setException(exLoad);
340             System.exit(--nErr);
341         }
342         long t_load_end = System.currentTimeMillis();
343 
344         // --------------------------------------------------------------------
345         // validate the content, fix some problems and convert it to the output format
346         m_aDebug.setGlobalInfo("validate and transform to output format ...");
347         long t_transform_start = System.currentTimeMillis();
348         try
349         {
350             aCache.validate(m_nInFormat);
351             if (
352                 (m_nInFormat  == Cache.FORMAT_60) &&
353                 (m_nOutFormat == Cache.FORMAT_6Y)
354                )
355             {
356                 aCache.transform60to6Y(m_bCreateCombineFilterFlag         ,
357                                        m_bRemoveFilterFlagBrowserPreferred,
358                                        m_bRemoveFilterFlagPreferred       ,
359                                        m_bRemoveFilterFlag3rdparty        ,
360                                        m_bRemoveFilterUINames             ,
361                                        m_bRemoveGraphicFilters            ,
362                                        m_bSetDefaultDetector              );
363             }
364             aCache.validate(m_nOutFormat);
365         }
366         catch(java.lang.Throwable exTransform)
367         {
368             m_aDebug.setException(exTransform);
369             System.exit(--nErr);
370         }
371         long t_transform_end = System.currentTimeMillis();
372 
373         // --------------------------------------------------------------------
374         // generate all xml fragments
375         m_aDebug.setGlobalInfo("generate xml fragments into directory \""+aOutDir.getPath()+"\" ...");
376         long t_split_start = System.currentTimeMillis();
377         try
378         {
379             SplitterData aDataSet = new SplitterData();
380             aDataSet.m_aDebug                       = m_aDebug                  ;
381             aDataSet.m_aCache                       = aCache                    ;
382             aDataSet.m_nFormat                      = m_nOutFormat              ;
383             aDataSet.m_sEncoding                    = m_sOutEncoding            ;
384             aDataSet.m_bSeperateFiltersByModule     = m_bSeperateFiltersByModule;
385             aDataSet.m_sFragmentExtension           = m_sFragmentExtension      ;
386             aDataSet.m_aOutDir                      = aOutDir                   ;
387 
388             aDataSet.m_aFragmentDirTypes            = new java.io.File(aOutDir, m_sSubDirTypes          );
389             aDataSet.m_aFragmentDirFilters          = new java.io.File(aOutDir, m_sSubDirFilters        );
390             aDataSet.m_aFragmentDirDetectServices   = new java.io.File(aOutDir, m_sSubDirDetectServices );
391             aDataSet.m_aFragmentDirFrameLoaders     = new java.io.File(aOutDir, m_sSubDirFrameLoaders   );
392             aDataSet.m_aFragmentDirContentHandlers  = new java.io.File(aOutDir, m_sSubDirContentHandlers);
393 
394             if (m_bSeperateFiltersByModule)
395             {
396                 aDataSet.m_aFragmentDirModuleSWriter  = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSWriter );
397                 aDataSet.m_aFragmentDirModuleSWeb     = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSWeb    );
398                 aDataSet.m_aFragmentDirModuleSGlobal  = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSGlobal );
399                 aDataSet.m_aFragmentDirModuleSCalc    = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSCalc   );
400                 aDataSet.m_aFragmentDirModuleSDraw    = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSDraw   );
401                 aDataSet.m_aFragmentDirModuleSImpress = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSImpress);
402                 aDataSet.m_aFragmentDirModuleSMath    = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSMath   );
403                 aDataSet.m_aFragmentDirModuleSChart   = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleSChart  );
404                 aDataSet.m_aFragmentDirModuleOthers   = new java.io.File(aDataSet.m_aFragmentDirFilters, m_sSubDirModuleOthers  );
405             }
406             else
407             {
408                 aDataSet.m_aFragmentDirModuleSWriter  = aDataSet.m_aFragmentDirFilters;
409                 aDataSet.m_aFragmentDirModuleSWeb     = aDataSet.m_aFragmentDirFilters;
410                 aDataSet.m_aFragmentDirModuleSGlobal  = aDataSet.m_aFragmentDirFilters;
411                 aDataSet.m_aFragmentDirModuleSCalc    = aDataSet.m_aFragmentDirFilters;
412                 aDataSet.m_aFragmentDirModuleSDraw    = aDataSet.m_aFragmentDirFilters;
413                 aDataSet.m_aFragmentDirModuleSImpress = aDataSet.m_aFragmentDirFilters;
414                 aDataSet.m_aFragmentDirModuleSMath    = aDataSet.m_aFragmentDirFilters;
415                 aDataSet.m_aFragmentDirModuleSChart   = aDataSet.m_aFragmentDirFilters;
416                 aDataSet.m_aFragmentDirModuleOthers   = aDataSet.m_aFragmentDirFilters;
417             }
418 
419             Splitter aSplitter = new Splitter(aDataSet);
420             aSplitter.split();
421         }
422         catch(java.lang.Throwable exSplit)
423         {
424             m_aDebug.setException(exSplit);
425             System.exit(--nErr);
426         }
427         long t_split_end = System.currentTimeMillis();
428 
429         // --------------------------------------------------------------------
430         // generate some special views
431         m_aDebug.setGlobalInfo("generate views and statistics ...");
432         long t_statistics_start = System.currentTimeMillis();
433         try
434         {
435             aCache.analyze();
436             aCache.toHTML(aOutDir, m_nOutFormat, m_sOutEncoding);
437             m_aDebug.setDetailedInfo(aCache.getStatistics());
438         }
439         catch(java.lang.Throwable exStatistics)
440         {
441             m_aDebug.setException(exStatistics);
442             System.exit(--nErr);
443         }
444         long t_statistics_end = System.currentTimeMillis();
445 
446         // --------------------------------------------------------------------
447         // analyze some time stamps
448         long t_end = System.currentTimeMillis();
449 
450         java.lang.StringBuffer sTimes = new java.lang.StringBuffer(100);
451         sTimes.append("Needed times:\n"                  );
452         sTimes.append("t [all]\t\t=\t"                   );
453         sTimes.append(t_end-t_start                      );
454         sTimes.append(" ms\n"                            );
455         sTimes.append("t [load]\t=\t"                    );
456         sTimes.append(t_load_end-t_load_start            );
457         sTimes.append(" ms\n"                            );
458         sTimes.append("t [transform]\t=\t"               );
459         sTimes.append(t_transform_end-t_transform_start  );
460         sTimes.append(" ms\n"                            );
461         sTimes.append("t [split]\t=\t"                   );
462         sTimes.append(t_split_end-t_split_start          );
463         sTimes.append(" ms\n"                            );
464         sTimes.append("t [statistics]\t=\t"              );
465         sTimes.append(t_statistics_end-t_statistics_start);
466         sTimes.append(" ms\n"                            );
467         m_aDebug.setDetailedInfo(sTimes.toString());
468 
469         // everyting seems to be ok.
470         // Return "OK" to calli.
471         m_aDebug.setGlobalInfo("Finish.");
472         System.exit(0);
473     }
474 
475     //___________________________________________
476 
477     /** read the configuration file.
478      *
479      *  @param  aCfg
480      *          contains the content of the
481      *          loaded configuration file.
482      */
readCfg(java.util.Properties aCfg)483     private static void readCfg(java.util.Properties aCfg)
484     {
485         m_sXMLFile                  = aCfg.getProperty(CFGKEY_XMLFILE                   , DEFAULT_XMLFILE                   );
486 
487         m_sInEncoding               = aCfg.getProperty(CFGKEY_INENCODING                , DEFAULT_INENCODING                );
488         m_sOutEncoding              = aCfg.getProperty(CFGKEY_OUTENCODING               , DEFAULT_OUTENCODING               );
489         m_sOutDir                   = aCfg.getProperty(CFGKEY_OUTDIR                    , DEFAULT_OUTDIR                    );
490         m_sFragmentExtension        = aCfg.getProperty(CFGKEY_FRAGMENT_EXTENSION        , DEFAULT_FRAGMENT_EXTENSION        );
491 
492         m_sSubDirTypes              = aCfg.getProperty(CFGKEY_SUBDIR_TYPES              , DEFAULT_SUBDIR_TYPES              );
493         m_sSubDirFilters            = aCfg.getProperty(CFGKEY_SUBDIR_FILTERS            , DEFAULT_SUBDIR_FILTERS            );
494         m_sSubDirDetectServices     = aCfg.getProperty(CFGKEY_SUBDIR_DETECTSERVICES     , DEFAULT_SUBDIR_DETECTSERVICES     );
495         m_sSubDirFrameLoaders       = aCfg.getProperty(CFGKEY_SUBDIR_FRAMELOADERS       , DEFAULT_SUBDIR_FRAMELOADERS       );
496         m_sSubDirContentHandlers    = aCfg.getProperty(CFGKEY_SUBDIR_CONTENTHANDLERS    , DEFAULT_SUBDIR_CONTENTHANDLERS    );
497 
498         m_sSubDirModuleSWriter      = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SWRITER     , DEFAULT_SUBDIR_MODULE_SWRITER     );
499         m_sSubDirModuleSWeb         = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SWEB        , DEFAULT_SUBDIR_MODULE_SWEB        );
500         m_sSubDirModuleSGlobal      = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SGLOBAL     , DEFAULT_SUBDIR_MODULE_SGLOBAL     );
501         m_sSubDirModuleSCalc        = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SCALC       , DEFAULT_SUBDIR_MODULE_SCALC       );
502         m_sSubDirModuleSDraw        = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SDRAW       , DEFAULT_SUBDIR_MODULE_SDRAW       );
503         m_sSubDirModuleSImpress     = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SIMPRESS    , DEFAULT_SUBDIR_MODULE_SIMPRESS    );
504         m_sSubDirModuleSMath        = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SMATH       , DEFAULT_SUBDIR_MODULE_SMATH       );
505         m_sSubDirModuleSChart       = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_SCHART      , DEFAULT_SUBDIR_MODULE_SCHART      );
506         m_sSubDirModuleOthers       = aCfg.getProperty(CFGKEY_SUBDIR_MODULE_OTHERS      , DEFAULT_SUBDIR_MODULE_OTHERS      );
507 
508         m_bSeperateFiltersByModule          = new java.lang.Boolean(aCfg.getProperty(CFGKEY_SEPERATE_FILTERS_BY_MODULE         , DEFAULT_SEPERATE_FILTERS_BY_MODULE         )).booleanValue();
509         m_bCreateCombineFilterFlag          = new java.lang.Boolean(aCfg.getProperty(CFGKEY_CREATE_COMBINE_FILTER_FLAG         , DEFAULT_CREATE_COMBINE_FILTER_FLAG         )).booleanValue();
510         m_bRemoveFilterFlagBrowserPreferred = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_BROWSERPREFERRED, DEFAULT_REMOVE_FILTER_FLAG_BROWSERPREFERRED)).booleanValue();
511         m_bRemoveFilterFlagPreferred        = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_PREFERRED       , DEFAULT_REMOVE_FILTER_FLAG_PREFERRED       )).booleanValue();
512         m_bRemoveFilterFlag3rdparty         = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_FLAG_3RDPARTY        , DEFAULT_REMOVE_FILTER_FLAG_3RDPARTY        )).booleanValue();
513         m_bRemoveFilterUINames              = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_FILTER_UINAMES              , DEFAULT_REMOVE_FILTER_UINAMES              )).booleanValue();
514         m_bRemoveGraphicFilters             = new java.lang.Boolean(aCfg.getProperty(CFGKEY_REMOVE_GRAPHIC_FILTERS             , DEFAULT_REMOVE_GRAPHIC_FILTERS             )).booleanValue();
515         m_bSetDefaultDetector               = new java.lang.Boolean(aCfg.getProperty(CFGKEY_SET_DEFAULT_DETECTOR               , DEFAULT_SET_DEFAULT_DETECTOR               )).booleanValue();
516 
517         java.lang.String sFormat = aCfg.getProperty(CFGKEY_INFORMAT, DEFAULT_INFORMAT);
518         m_nInFormat = Cache.mapFormatString2Format(sFormat);
519 
520         sFormat = aCfg.getProperty(CFGKEY_OUTFORMAT, DEFAULT_OUTFORMAT);
521         m_nOutFormat = Cache.mapFormatString2Format(sFormat);
522     }
523 
524     //___________________________________________
525 
526     /** prints out a copyright message on stdout.
527      */
printCopyright()528     private static void printCopyright()
529     {
530         java.lang.StringBuffer sOut = new java.lang.StringBuffer(256);
531         sOut.append("FCFGSplit\n");
532         sOut.append("Copyright: 2000 by Sun Microsystems, Inc.\n");
533         sOut.append("All Rights Reserved.\n");
534         System.out.println(sOut.toString());
535     }
536 
537     //___________________________________________
538 
539     /** prints out a help message on stdout.
540      */
printHelp()541     private static void printHelp()
542     {
543         java.lang.StringBuffer sOut = new java.lang.StringBuffer(1000);
544         sOut.append("_______________________________________________________________________________\n\n"   );
545         sOut.append("usage: FCFGSplit "+CMD_CONFIG+"=<file name> "+CMD_DEBUG+"=<level>\n"                       );
546         sOut.append("parameters:\n"                                                                         );
547         sOut.append("\t-help\n"                                                                             );
548         sOut.append("\t\tshow this little help.\n\n"                                                        );
549         sOut.append("\t"+CMD_CONFIG+"=<file name>\n"                                                        );
550         sOut.append("\t\tspecify the configuration file.\n\n"                                               );
551         sOut.append("\t"+CMD_DEBUG+"=<level>\n"                                                             );
552         sOut.append("\t\tprints out some debug messages.\n"                                                 );
553         sOut.append("\t\tlevel=[0..4]\n"                                                                    );
554         sOut.append("\t\t0 => no debug messages\n"                                                          );
555         sOut.append("\t\t1 => print out errors only\n"                                                      );
556         sOut.append("\t\t2 => print out errors & warnings\n"                                                );
557         sOut.append("\t\t3 => print out some global actions   (e.g. load file ...)\n"                       );
558         sOut.append("\t\t4 => print out more detailed actions (e.g. load item nr. xxx of file.)\n\n"        );
559         System.out.println(sOut.toString());
560     }
561 }
562