[Castore-commits] FODTConverter.java 1.2 1.3
Céline BENOIT
cbenoit at adullact1.hosting.cri74.org
Ven 1 Déc 11:48:27 CET 2006
Update of /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/metier/textes/retro/fodtconverter
In directory adullact1:/tmp/cvs-serv19865/src/java/fr/emn/castor/documents/metier/textes/retro/fodtconverter
Modified Files:
FODTConverter.java
Log Message:
Ajout de log pour avoir une meilleure visibilité de la progression de la rétroconversion
Index: FODTConverter.java
===================================================================
RCS file: /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/metier/textes/retro/fodtconverter/FODTConverter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FODTConverter.java 17 Nov 2006 15:23:21 -0000 1.2
--- FODTConverter.java 1 Dec 2006 10:48:24 -0000 1.3
***************
*** 42,51 ****
import java.io.File;
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
-
import nu.xom.ParsingException;
import nu.xom.ValidityException;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
--- 42,52 ----
import java.io.File;
import nu.xom.ParsingException;
import nu.xom.ValidityException;
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.tools.ant.BuildException;
+
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
***************
*** 57,68 ****
import com.sun.star.util.XCloseable;
! import fr.emn.castor.documents.metier.textes.retro.FODTConverterAntTask;
/**
! *
! * @author $Author$
! * @version $Revision$
! *
! */
public class FODTConverter {
--- 58,69 ----
import com.sun.star.util.XCloseable;
! import fr.emn.castor.common.PropertiesHelper;
/**
! *
! * @author $Author$
! * @version $Revision$
! *
! */
public class FODTConverter {
***************
*** 107,111 ****
/** The default port to contact OpenOffice.org */
! public String port = "2809";
public OOOConnection oooConnect;
--- 108,112 ----
/** The default port to contact OpenOffice.org */
! public String port = PropertiesHelper.getProperty("openoffice.port");
public OOOConnection oooConnect;
***************
*** 121,127 ****
public void execute() {
-
// Check the parameters
-
// Step 1 : Connect to OOO
oooConnect = new OOOConnection();
--- 122,126 ----
***************
*** 129,154 ****
if (connect) {
-
// Step 2 : Get a XML representation of the input document
// (FODT)
try {
-
getFodtFromText();
!
} catch (ValidityException e) {
if (logger.isErrorEnabled())
! logger.error(e.getMessage());
} catch (ParsingException e) {
if (logger.isErrorEnabled())
! logger.error(e.getMessage());
} catch (java.io.IOException e) {
if (logger.isErrorEnabled())
! logger.error(e.getMessage());
} catch (Exception e) {
if (logger.isErrorEnabled())
! logger.error(e.getMessage());
}
- if (logger.isInfoEnabled())
- logger.info("Convert done.");
}
}
--- 128,150 ----
if (connect) {
// Step 2 : Get a XML representation of the input document
// (FODT)
try {
getFodtFromText();
! if (logger.isInfoEnabled())
! logger.info("Convert done.");
} catch (ValidityException e) {
if (logger.isErrorEnabled())
! logger.error("ValidityException " + e.getMessage());
} catch (ParsingException e) {
if (logger.isErrorEnabled())
! logger.error("ParsingException " + e.getMessage());
} catch (java.io.IOException e) {
if (logger.isErrorEnabled())
! logger.error("java.io.IOException " + e.getMessage());
} catch (Exception e) {
if (logger.isErrorEnabled())
! logger.error("Exception " + e.getMessage());
}
}
}
***************
*** 160,166 ****
--- 156,169 ----
File fTextFile = new File(sInputTextFilePath);
String sTextFilePathURL = formatOOUrl(fTextFile.getAbsolutePath());
+ if (logger.isDebugEnabled())
+ logger
+ .debug("Document to convert into Flat OpenDocument Text : "
+ + sTextFilePathURL);
// Flat OpenDocument Text's document
String sOutputFodtFilePathURL = formatOOUrl(sOutputFodtFilePath);
+ if (logger.isDebugEnabled())
+ logger.debug("Flat OpenDocument Text's document : "
+ + sOutputFodtFilePathURL);
Object oTextDocument = null;
***************
*** 170,173 ****
--- 173,184 ----
sTextFilePathURL, "_blank", 0, oooConnect.hiddenLoadDocProp);
+ // Si l'URL n'est pas bonne, on aura un null ici...
+ if (oTextDocument == null) {
+ throw new BuildException(
+ "Impossible de charger le document "
+ + sTextFilePathURL
+ + " avec OpenOffice ; est-ce que ce fichier existe bien ?");
+ }
+
// get the XModel interface from the component
XModel xModel = (XModel) UnoRuntime.queryInterface(
***************
*** 176,180 ****
// the model knows its controller
XController xController = xModel.getCurrentController();
!
// Get the Properties set of the document
XPropertySet xTextDocumentPropertySet = (XPropertySet) UnoRuntime
--- 187,191 ----
// the model knows its controller
XController xController = xModel.getCurrentController();
!
// Get the Properties set of the document
XPropertySet xTextDocumentPropertySet = (XPropertySet) UnoRuntime
***************
*** 193,196 ****
--- 204,209 ----
// Store the input document in FODT format
+ if (logger.isDebugEnabled())
+ logger.debug("Store the input document in FODT format");
PropertyValue storeFodtProp[] = new PropertyValue[2];
storeFodtProp[0] = new PropertyValue();
***************
*** 201,204 ****
--- 214,220 ----
storeFodtProp[1].Value = "devguide_FlatXMLFilter_Cpp_writer";
+ if (logger.isDebugEnabled())
+ logger.debug("sOutputFodtFilePathURL : "
+ + sOutputFodtFilePathURL);
xStorableTextDocument.storeAsURL(
sOutputFodtFilePathURL, storeFodtProp);
***************
*** 235,238 ****
--- 251,256 ----
// Query the input document for its XCloseable interface in order to
// close it
+ if (logger.isDebugEnabled())
+ logger.debug("close input document ");
XCloseable xCloseableInputDocument = (XCloseable) UnoRuntime
.queryInterface(XCloseable.class, oTextDocument);
Plus d'informations sur la liste de diffusion Castore-commits