1*ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ef39d40dSAndrew Rist  * distributed with this work for additional information
6*ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9*ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ef39d40dSAndrew Rist  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ef39d40dSAndrew Rist  *
13*ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15*ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18*ef39d40dSAndrew Rist  * under the License.
19*ef39d40dSAndrew Rist  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package convwatch;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // imports
27cdf0e10cSrcweir import java.util.ArrayList;
28cdf0e10cSrcweir import java.io.File;
29cdf0e10cSrcweir import java.io.FileFilter;
30cdf0e10cSrcweir 
31cdf0e10cSrcweir import convwatch.EnhancedComplexTestCase;
32cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir import convwatch.ConvWatchException;
35cdf0e10cSrcweir import convwatch.DirectoryHelper;
36cdf0e10cSrcweir import convwatch.GraphicalTestArguments;
37cdf0e10cSrcweir import convwatch.HTMLOutputter;
38cdf0e10cSrcweir import helper.OfficeProvider;
39cdf0e10cSrcweir import helper.OfficeWatcher;
40cdf0e10cSrcweir import helper.OSHelper;
41cdf0e10cSrcweir import convwatch.PerformanceContainer;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir /**
44cdf0e10cSrcweir  * The following Complex Test will test
45cdf0e10cSrcweir  * an already created document and it's postscript output (by an older office version)
46cdf0e10cSrcweir  * with a new office version.
47cdf0e10cSrcweir  * This test use Ghostscript for the jpeg export and graphically compare tools from ImageMagick.
48cdf0e10cSrcweir  * Read the manual for more information.
49cdf0e10cSrcweir  *
50cdf0e10cSrcweir  * this is only the starter program
51cdf0e10cSrcweir  * more is found in qadevOOo/runner/convwatch/*
52cdf0e10cSrcweir  */
53cdf0e10cSrcweir 
54cdf0e10cSrcweir public class ConvWatchStarter extends EnhancedComplexTestCase
55cdf0e10cSrcweir {
56cdf0e10cSrcweir     // The first of the mandatory functions:
57cdf0e10cSrcweir     /**
58cdf0e10cSrcweir      * Return the name of the test.
59cdf0e10cSrcweir      * In this case it is the actual name of the service.
60cdf0e10cSrcweir      * @return The tested service.
61cdf0e10cSrcweir      */
62cdf0e10cSrcweir     // public String getTestObjectName() {
63cdf0e10cSrcweir     //     return "ConvWatch runner";
64cdf0e10cSrcweir     // }
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     // The second of the mandatory functions: return all test methods as an
67cdf0e10cSrcweir     // array. There is only one test function in this example.
68cdf0e10cSrcweir     /**
69cdf0e10cSrcweir      * Return all test methods.
70cdf0e10cSrcweir      * @return The test methods.
71cdf0e10cSrcweir      */
72cdf0e10cSrcweir     public String[] getTestMethodNames() {
73cdf0e10cSrcweir         return new String[]{"compareGraphicalDiffs"};
74cdf0e10cSrcweir     }
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     String m_sInputPath = "";
77cdf0e10cSrcweir     String m_sReferencePath = "";
78cdf0e10cSrcweir     String m_sOutputPath = "";
79cdf0e10cSrcweir     String m_sDiffPath = null;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     private void initMember()
82cdf0e10cSrcweir         {
83cdf0e10cSrcweir             // MUST PARAMETER
84cdf0e10cSrcweir             // INPUTFILE ----------
85cdf0e10cSrcweir             String sINPATH = (String)param.get( PropertyName.DOC_COMPARATOR_INPUT_PATH );
86cdf0e10cSrcweir             boolean bQuit = false;
87cdf0e10cSrcweir             if (sINPATH == null || sINPATH.length() == 0)
88cdf0e10cSrcweir             {
89cdf0e10cSrcweir                 log.println("Please set input path (path to documents) " + PropertyName.DOC_COMPARATOR_INPUT_PATH + "=path.");
90cdf0e10cSrcweir                 bQuit = true;
91cdf0e10cSrcweir             }
92cdf0e10cSrcweir             else
93cdf0e10cSrcweir             {
94cdf0e10cSrcweir                 log.println("found " + PropertyName.DOC_COMPARATOR_INPUT_PATH + " " + sINPATH);
95cdf0e10cSrcweir                 m_sInputPath = sINPATH;
96cdf0e10cSrcweir             }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir             // REFERENCE_PATH ----------
99cdf0e10cSrcweir             String sREF = (String)param.get( PropertyName.DOC_COMPARATOR_REFERENCE_PATH );
100cdf0e10cSrcweir             if (sREF == null || sREF.length() == 0)
101cdf0e10cSrcweir             {
102cdf0e10cSrcweir                 // log.println("Please set reference file (path to good documents) REFERENCEFILE=path.");
103cdf0e10cSrcweir                 log.println("Assumtion, reference directory and input directory are the same.");
104cdf0e10cSrcweir                 m_sReferencePath = m_sInputPath;
105cdf0e10cSrcweir             }
106cdf0e10cSrcweir             else
107cdf0e10cSrcweir             {
108cdf0e10cSrcweir                 log.println("found " + PropertyName.DOC_COMPARATOR_REFERENCE_PATH + " " + sREF);
109cdf0e10cSrcweir                 m_sReferencePath = sREF;
110cdf0e10cSrcweir             }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir             // OUTPUT_PATH ----------
113cdf0e10cSrcweir             String sOUT = (String)param.get( PropertyName.DOC_COMPARATOR_OUTPUT_PATH );
114cdf0e10cSrcweir             if (sOUT == null || sOUT.length() == 0)
115cdf0e10cSrcweir             {
116cdf0e10cSrcweir                 log.println("Please set output path (path to a temp directory) " + PropertyName.DOC_COMPARATOR_OUTPUT_PATH + "=path.");
117cdf0e10cSrcweir                 bQuit = true;
118cdf0e10cSrcweir             }
119cdf0e10cSrcweir             else
120cdf0e10cSrcweir             {
121cdf0e10cSrcweir                 log.println("found " + PropertyName.DOC_COMPARATOR_OUTPUT_PATH + " " + sOUT);
122cdf0e10cSrcweir                 m_sOutputPath = sOUT;
123cdf0e10cSrcweir             }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir             if (bQuit == true)
126cdf0e10cSrcweir             {
127cdf0e10cSrcweir                 // log.println("must quit.");
128cdf0e10cSrcweir                 assure("Must quit", false);
129cdf0e10cSrcweir             }
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 
132cdf0e10cSrcweir             // DIFF_PATH ----------
133cdf0e10cSrcweir             String sDIFF = (String)param.get( PropertyName.DOC_COMPARATOR_DIFF_PATH );
134cdf0e10cSrcweir             if (sDIFF == null || sDIFF.length() == 0)
135cdf0e10cSrcweir             {
136cdf0e10cSrcweir             }
137cdf0e10cSrcweir             else
138cdf0e10cSrcweir             {
139cdf0e10cSrcweir                 log.println("found " + PropertyName.DOC_COMPARATOR_DIFF_PATH + " " + sDIFF);
140cdf0e10cSrcweir                 m_sDiffPath = sDIFF;
141cdf0e10cSrcweir             }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir             if (m_sInputPath.startsWith("file:") ||
144cdf0e10cSrcweir                 m_sReferencePath.startsWith("file:") ||
145cdf0e10cSrcweir                 m_sOutputPath.startsWith("file:"))
146cdf0e10cSrcweir             {
147cdf0e10cSrcweir                 assure("We can't handle file: URL right, use system path instead.", false);
148cdf0e10cSrcweir             }
149cdf0e10cSrcweir 
150cdf0e10cSrcweir         }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     /**
154cdf0e10cSrcweir      *
155cdf0e10cSrcweir      * @return a List of software which must accessable as an external executable
156cdf0e10cSrcweir      */
157cdf0e10cSrcweir     protected Object[] mustInstalledSoftware()
158cdf0e10cSrcweir         {
159cdf0e10cSrcweir             ArrayList aList = new ArrayList();
160cdf0e10cSrcweir             // Tools from ImageMagick
161cdf0e10cSrcweir             if (! OSHelper.isWindows())
162cdf0e10cSrcweir             {
163cdf0e10cSrcweir             aList.add( "composite -version" );
164cdf0e10cSrcweir             aList.add( "identify -version" );
165cdf0e10cSrcweir 
166cdf0e10cSrcweir             // Ghostscript
167cdf0e10cSrcweir             aList.add( "gs -version" );
168cdf0e10cSrcweir             }
169cdf0e10cSrcweir             else
170cdf0e10cSrcweir             {
171cdf0e10cSrcweir                 aList.add( "composite.exe -version" );
172cdf0e10cSrcweir                 aList.add( "identify.exe -version" );
173cdf0e10cSrcweir 
174cdf0e10cSrcweir                 // Ghostscript
175cdf0e10cSrcweir                 aList.add( "gswin32c.exe -version" );
176cdf0e10cSrcweir             }
177cdf0e10cSrcweir 
178cdf0e10cSrcweir             return aList.toArray();
179cdf0e10cSrcweir         }
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     /**
183cdf0e10cSrcweir      * The test method itself.
184cdf0e10cSrcweir      * Don't try to call it from outside, it is started only from qadevOOo runner
185cdf0e10cSrcweir      */
186cdf0e10cSrcweir 
187cdf0e10cSrcweir     /* protected */
188cdf0e10cSrcweir     public void compareGraphicalDiffs()
189cdf0e10cSrcweir         {
190cdf0e10cSrcweir             GlobalLogWriter.set(log);
191cdf0e10cSrcweir             String sDBConnection = (String)param.get( PropertyName.DB_CONNECTION_STRING );
192cdf0e10cSrcweir             // check if all need software is installed and accessable
193cdf0e10cSrcweir             checkEnvironment(mustInstalledSoftware());
194cdf0e10cSrcweir 
195cdf0e10cSrcweir             GraphicalTestArguments aGTA = getGraphicalTestArguments();
196cdf0e10cSrcweir             if (aGTA == null)
197cdf0e10cSrcweir             {
198cdf0e10cSrcweir                 assure("Must quit", false);
199cdf0e10cSrcweir             }
200cdf0e10cSrcweir             if (aGTA.cancelRequest())
201cdf0e10cSrcweir             {
202cdf0e10cSrcweir                 return;
203cdf0e10cSrcweir             }
204cdf0e10cSrcweir 
205cdf0e10cSrcweir             initMember();
206cdf0e10cSrcweir 
207cdf0e10cSrcweir             aGTA.allowStore();
208cdf0e10cSrcweir 
209cdf0e10cSrcweir             String sBuildID = aGTA.getBuildID();
210cdf0e10cSrcweir             log.println("Current Office has buildid: " + sBuildID);
211cdf0e10cSrcweir 
212cdf0e10cSrcweir             // LLA: sample code, how to access all parameters
213cdf0e10cSrcweir             // for (Enumeration e = param.keys() ; e.hasMoreElements() ;)
214cdf0e10cSrcweir             // {
215cdf0e10cSrcweir             //     System.out.println(e.nextElement());
216cdf0e10cSrcweir             // }
217cdf0e10cSrcweir 
218cdf0e10cSrcweir             String fs = System.getProperty("file.separator");
219cdf0e10cSrcweir 
220cdf0e10cSrcweir             String sHTMLName = "index.html";
221cdf0e10cSrcweir             File aInputPathTest = new File(m_sInputPath);
222cdf0e10cSrcweir             if (!aInputPathTest.isDirectory())
223cdf0e10cSrcweir             {
224cdf0e10cSrcweir                 int n = m_sInputPath.lastIndexOf(fs);
225cdf0e10cSrcweir                 sHTMLName = m_sInputPath.substring(n + 1);
226cdf0e10cSrcweir                 sHTMLName += ".html";
227cdf0e10cSrcweir             }
228cdf0e10cSrcweir             HTMLOutputter HTMLoutput = HTMLOutputter.create(m_sOutputPath, sHTMLName, "", "");
229cdf0e10cSrcweir             HTMLoutput.header( m_sOutputPath );
230cdf0e10cSrcweir             HTMLoutput.indexSection( m_sOutputPath );
231cdf0e10cSrcweir             LISTOutputter LISToutput = LISTOutputter.create(m_sOutputPath, "allfiles.txt");
232cdf0e10cSrcweir 
233cdf0e10cSrcweir             DB.init(aGTA.getDBInfoString() + "," + sDBConnection);
234cdf0e10cSrcweir 
235cdf0e10cSrcweir             File aInputPath = new File(m_sInputPath);
236cdf0e10cSrcweir             if (aInputPath.isDirectory())
237cdf0e10cSrcweir             {
238cdf0e10cSrcweir                 // check a whole directory
239cdf0e10cSrcweir                 // a whole directory
240cdf0e10cSrcweir                 FileFilter aFileFilter = FileHelper.getFileFilter();
241cdf0e10cSrcweir 
242cdf0e10cSrcweir                 Object[] aList = DirectoryHelper.traverse(m_sInputPath, aFileFilter, aGTA.includeSubDirectories());
243cdf0e10cSrcweir                 if (aList.length == 0)
244cdf0e10cSrcweir                 {
245cdf0e10cSrcweir                     log.println("Nothing to do, there are no document files found.");
246cdf0e10cSrcweir                 }
247cdf0e10cSrcweir                 else
248cdf0e10cSrcweir                 {
249cdf0e10cSrcweir                     for (int i=0;i<aList.length;i++)
250cdf0e10cSrcweir                     {
251cdf0e10cSrcweir                         String sEntry = (String)aList[i];
252cdf0e10cSrcweir                         log.println("- next file is: ------------------------------");
253cdf0e10cSrcweir                         log.println(sEntry);
254cdf0e10cSrcweir 
255cdf0e10cSrcweir                         String sNewSubDir = FileHelper.removeFirstDirectorysAndBasenameFrom(sEntry, m_sInputPath);
256cdf0e10cSrcweir 
257cdf0e10cSrcweir                         String sNewReferencePath = m_sReferencePath;
258cdf0e10cSrcweir                         String sNewOutputPath = m_sOutputPath;
259cdf0e10cSrcweir                         String sNewDiffPath = m_sDiffPath;
260cdf0e10cSrcweir                         if (sNewSubDir.length() > 0)
261cdf0e10cSrcweir                         {
262cdf0e10cSrcweir                             if (sNewReferencePath != null)
263cdf0e10cSrcweir                                 sNewReferencePath = sNewReferencePath + fs + sNewSubDir;
264cdf0e10cSrcweir                             // String sNameNoSuffix = FileHelper.getNameNoSuffix(FileHelper.getBasename(sEntry));
265cdf0e10cSrcweir                             // sNewReferenceFile = sNewReferencePath + fs + sNameNoSuffix + ".prn";
266cdf0e10cSrcweir 
267cdf0e10cSrcweir                             sNewOutputPath = sNewOutputPath + fs + sNewSubDir;
268cdf0e10cSrcweir                             if (sNewDiffPath != null)
269cdf0e10cSrcweir                                 sNewDiffPath = sNewDiffPath + fs + sNewSubDir;
270cdf0e10cSrcweir                         }
271cdf0e10cSrcweir 
272cdf0e10cSrcweir                         // NameHelper aNameContainer = new NameHelper(m_sOutputPath, sNewSubDir, FileHelper.getBasename(sEntry));
273cdf0e10cSrcweir                         // aNameContainer.print();
274cdf0e10cSrcweir 
275cdf0e10cSrcweir                         if (aGTA.checkIfUsableDocumentType(sEntry))
276cdf0e10cSrcweir                         {
277cdf0e10cSrcweir                             runGDCWithStatus(HTMLoutput, LISToutput, sEntry, sNewOutputPath, sNewReferencePath, sNewDiffPath, sNewSubDir);
278cdf0e10cSrcweir                         }
279cdf0e10cSrcweir                         if (aGTA.cancelRequest())
280cdf0e10cSrcweir                         {
281cdf0e10cSrcweir                             break;
282cdf0e10cSrcweir                         }
283cdf0e10cSrcweir                     }
284cdf0e10cSrcweir                 }
285cdf0e10cSrcweir             }
286cdf0e10cSrcweir             else
287cdf0e10cSrcweir             {
288cdf0e10cSrcweir                 // check exact name
289cdf0e10cSrcweir                 if (aGTA.checkIfUsableDocumentType(m_sInputPath))
290cdf0e10cSrcweir                 {
291cdf0e10cSrcweir                     runGDCWithStatus(HTMLoutput, LISToutput, m_sInputPath, m_sOutputPath, m_sReferencePath, m_sDiffPath, "");
292cdf0e10cSrcweir                 }
293cdf0e10cSrcweir             }
294cdf0e10cSrcweir 
295cdf0e10cSrcweir             LISToutput.close();
296cdf0e10cSrcweir             HTMLoutput.close();
297cdf0e10cSrcweir             log.println("The file '" + HTMLoutput.getFilename() + "' shows a html based status.");
298cdf0e10cSrcweir             DB.writeHTMLFile(HTMLoutput.getFilename());
299cdf0e10cSrcweir         }
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 
302cdf0e10cSrcweir     // -----------------------------------------------------------------------------
303cdf0e10cSrcweir     void runGDCWithStatus(HTMLOutputter _aHTMLoutput, LISTOutputter _aLISToutput, String _sInputFile, String _sOutputPath, String _sReferencePath, String _sDiffPath, String _sNewSubDir )
304cdf0e10cSrcweir         {
305cdf0e10cSrcweir             // start a fresh Office
306cdf0e10cSrcweir             GraphicalTestArguments aGTA = getGraphicalTestArguments();
307cdf0e10cSrcweir 
308cdf0e10cSrcweir             OfficeProvider aProvider = null;
309cdf0e10cSrcweir             // SimpleFileSemaphore aSemaphore = new SimpleFileSemaphore();
310cdf0e10cSrcweir             if (aGTA.shouldOfficeStart())
311cdf0e10cSrcweir             {
312cdf0e10cSrcweir                 // if (OSHelper.isWindows())
313cdf0e10cSrcweir                 // {
314cdf0e10cSrcweir                 //     aSemaphore.P(aSemaphore.getSemaphoreFile());
315cdf0e10cSrcweir                 // }
316cdf0e10cSrcweir 
317cdf0e10cSrcweir                 aGTA.getPerformance().startTime(PerformanceContainer.OfficeStart);
318cdf0e10cSrcweir                 aProvider = new OfficeProvider();
319cdf0e10cSrcweir                 XMultiServiceFactory xMSF = (XMultiServiceFactory) aProvider.getManager(param);
320cdf0e10cSrcweir                 param.put("ServiceFactory", xMSF);
321cdf0e10cSrcweir                 aGTA.getPerformance().stopTime(PerformanceContainer.OfficeStart);
322cdf0e10cSrcweir 
323cdf0e10cSrcweir                 long nStartTime = aGTA.getPerformance().getTime(PerformanceContainer.OfficeStart);
324cdf0e10cSrcweir                 aGTA = getGraphicalTestArguments(); // get new TestArguments
325cdf0e10cSrcweir                 aGTA.getPerformance().setTime(PerformanceContainer.OfficeStart, nStartTime);
326cdf0e10cSrcweir             }
327cdf0e10cSrcweir 
328cdf0e10cSrcweir             // Watcher Object is need in log object to give a simple way to say if a running office is alive.
329cdf0e10cSrcweir             // As long as a log comes, it pings the Watcher and says the office is alive, if not an
330cdf0e10cSrcweir             // internal counter increase and at a given point (300 seconds) the office is killed.
331cdf0e10cSrcweir             GlobalLogWriter.get().println("Set office watcher");
332cdf0e10cSrcweir             OfficeWatcher aWatcher = (OfficeWatcher)param.get("Watcher");
333cdf0e10cSrcweir             GlobalLogWriter.get().setWatcher(aWatcher);
334cdf0e10cSrcweir             // initializeWatcher(param);
335cdf0e10cSrcweir 
336cdf0e10cSrcweir             String sStatusRunThrough = "";
337cdf0e10cSrcweir             String sStatusMessage = "";
338cdf0e10cSrcweir             try
339cdf0e10cSrcweir             {
340cdf0e10cSrcweir                 DB.destination_start();
341cdf0e10cSrcweir                 // better was:
342cdf0e10cSrcweir                 // load document
343cdf0e10cSrcweir                 // create postscript from document
344cdf0e10cSrcweir                 // check file
345cdf0e10cSrcweir                 GraphicalDifferenceCheck.checkOneFile(_sInputFile, _sOutputPath, _sReferencePath, _sDiffPath, aGTA);
346cdf0e10cSrcweir                 sStatusRunThrough = "PASSED, OK";
347cdf0e10cSrcweir                 DB.destination_finished();
348cdf0e10cSrcweir             }
349cdf0e10cSrcweir             catch(ConvWatchCancelException e)
350cdf0e10cSrcweir             {
351cdf0e10cSrcweir                 assure(e.getMessage(), false, true);
352cdf0e10cSrcweir                 sStatusRunThrough = "CANCELLED, FAILED";
353cdf0e10cSrcweir                 sStatusMessage = e.getMessage();
354cdf0e10cSrcweir                 DB.destination_failed(sStatusRunThrough, sStatusMessage);
355cdf0e10cSrcweir             }
356cdf0e10cSrcweir             catch(ConvWatchException e)
357cdf0e10cSrcweir             {
358cdf0e10cSrcweir                 assure(e.getMessage(), false, true);
359cdf0e10cSrcweir                 sStatusMessage = e.getMessage();
360cdf0e10cSrcweir                 sStatusRunThrough = "PASSED, FAILED";
361cdf0e10cSrcweir                 DB.destination_failed(sStatusRunThrough, sStatusMessage);
362cdf0e10cSrcweir             }
363cdf0e10cSrcweir             catch(com.sun.star.lang.DisposedException e)
364cdf0e10cSrcweir             {
365cdf0e10cSrcweir                 assure(e.getMessage(), false, true);
366cdf0e10cSrcweir                 sStatusMessage = e.getMessage();
367cdf0e10cSrcweir                 sStatusRunThrough = "FAILED, FAILED";
368cdf0e10cSrcweir                 DB.destination_failed(sStatusRunThrough, sStatusMessage);
369cdf0e10cSrcweir             }
370cdf0e10cSrcweir 
371cdf0e10cSrcweir             GlobalLogWriter.get().println("Watcher count is: " + aWatcher.getPing());
372cdf0e10cSrcweir 
373cdf0e10cSrcweir             // Office shutdown
374cdf0e10cSrcweir             if (aProvider != null)
375cdf0e10cSrcweir             {
376cdf0e10cSrcweir                 aProvider.closeExistingOffice(param, true);
377cdf0e10cSrcweir                 // if (OSHelper.isWindows())
378cdf0e10cSrcweir                 // {
379cdf0e10cSrcweir                 //     aSemaphore.V(aSemaphore.getSemaphoreFile());
380cdf0e10cSrcweir                 //     aSemaphore.sleep(2);
381cdf0e10cSrcweir                 //     // wait some time maybe an other process will take the semaphore
382cdf0e10cSrcweir                 //     // I know, this is absolutly dirty, but the whole convwatch is dirty and need a big cleanup.
383cdf0e10cSrcweir                 // }
384cdf0e10cSrcweir             }
385cdf0e10cSrcweir 
386cdf0e10cSrcweir             // -------------------- Status --------------------
387cdf0e10cSrcweir             String fs = System.getProperty("file.separator");
388cdf0e10cSrcweir             String sBasename = FileHelper.getBasename(_sInputFile);
389cdf0e10cSrcweir             String sFilenameNoSuffix = FileHelper.getNameNoSuffix(sBasename);
390cdf0e10cSrcweir 
391cdf0e10cSrcweir             // -------------------- List of all files -----------------
392cdf0e10cSrcweir             String sListFile;
393cdf0e10cSrcweir             if (_sNewSubDir.length() > 0)
394cdf0e10cSrcweir             {
395cdf0e10cSrcweir                 sListFile = _sNewSubDir + fs + sFilenameNoSuffix + ".ini";
396cdf0e10cSrcweir             }
397cdf0e10cSrcweir             else
398cdf0e10cSrcweir             {
399cdf0e10cSrcweir                 sListFile = sFilenameNoSuffix + ".ini";
400cdf0e10cSrcweir             }
401cdf0e10cSrcweir             _aLISToutput.writeValue(sListFile);
402cdf0e10cSrcweir 
403cdf0e10cSrcweir             // -------------------- HTML --------------------
404cdf0e10cSrcweir             String sLink;
405cdf0e10cSrcweir             String sLinkDD;
406cdf0e10cSrcweir             String sLinkName;
407cdf0e10cSrcweir             String sLinkDDName;
408cdf0e10cSrcweir             String sHTMLPrefix = aGTA.getHTMLOutputPrefix();
409cdf0e10cSrcweir 
410cdf0e10cSrcweir             GlobalLogWriter.get().println("----------------------------------------------------------------------");
411cdf0e10cSrcweir             GlobalLogWriter.get().println(" OutputPath: " + _sOutputPath);
412cdf0e10cSrcweir             GlobalLogWriter.get().println("    NewPath: " + _sNewSubDir);
413cdf0e10cSrcweir             GlobalLogWriter.get().println("----------------------------------------------------------------------");
414cdf0e10cSrcweir 
415cdf0e10cSrcweir //             if (_sNewSubDir.length() > 0)
416cdf0e10cSrcweir //             {
417cdf0e10cSrcweir //                 sLink   = sHTMLPrefix /* + "/cw.php?inifile=" */ + _sOutputPath + fs + _sNewSubDir + fs + sFilenameNoSuffix + ".ini";
418cdf0e10cSrcweir //                 sLinkDD = sHTMLPrefix /* + "/cw.php?inifile=" */ + _sOutputPath + fs + _sNewSubDir + fs + "DiffDiff_" + sFilenameNoSuffix + ".ini";
419cdf0e10cSrcweir //             }
420cdf0e10cSrcweir //             else
421cdf0e10cSrcweir //             {
422cdf0e10cSrcweir             sLink = sHTMLPrefix   /* + "/cw.php?inifile=" */ + _sOutputPath + fs + sFilenameNoSuffix + ".ini";
423cdf0e10cSrcweir                 // sLinkDD = sHTMLPrefix /* + "/cw.php?inifile=" */ + _sOutputPath + fs + _sNewSubDir + fs + "DiffDiff_" + sFilenameNoSuffix + ".ini";
424cdf0e10cSrcweir             sLinkDD = sHTMLPrefix /* + "/cw.php?inifile=" */ + _sOutputPath + fs + "DiffDiff_" + sFilenameNoSuffix + ".ini";
425cdf0e10cSrcweir //             }
426cdf0e10cSrcweir             sLinkName = sFilenameNoSuffix;
427cdf0e10cSrcweir             sLinkDDName = sFilenameNoSuffix + " (DiffDiff)";
428cdf0e10cSrcweir 
429cdf0e10cSrcweir             if (_sDiffPath != null && _sDiffPath.length() > 0)
430cdf0e10cSrcweir             {
431cdf0e10cSrcweir                 _aHTMLoutput.indexLine( sLinkDD, sLinkDDName, sLink, sLinkName, sStatusRunThrough, sStatusMessage );
432cdf0e10cSrcweir             }
433cdf0e10cSrcweir             else
434cdf0e10cSrcweir             {
435cdf0e10cSrcweir                 _aHTMLoutput.indexLine( sLink, sLinkName, "", "", sStatusRunThrough, sStatusMessage );
436cdf0e10cSrcweir             }
437cdf0e10cSrcweir 
438cdf0e10cSrcweir         }
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 
441cdf0e10cSrcweir }
442