IRC Archive for channel #xwiki on 23 August 2008
Last modified by Vincent Massol on 2012/10/18 18:30
xwikibot - (23/08/2008 00:32): Design.APIs was modified by XWiki.jmarks (Updated Decisions secion) - http://curriki.xwiki.org/xwiki/bin/view/Design/APIs
daning - (23/08/2008 09:35): vmassol: Hi.
daning - (23/08/2008 09:36): vmassol: I am still confused by the outputstream interface
daning - (23/08/2008 09:36): vmassol: I use the interface in the OfficeConverterPlugin.java. I need to get the data from the outputstream.
vmassol - (23/08/2008 09:38): daning: hi
vmassol - (23/08/2008 09:39): if you don't find the answer I'll help you later today
daning - (23/08/2008 09:39): vmassol: OK.
vmassol - (23/08/2008 09:39): daning: BTW ByteArrayOutputStream should work fine
vmassol - (23/08/2008 09:40): inside the converter you simply write to the output stream and in the user's code you use BAOS that you pass to convert
vmassol - (23/08/2008 09:40): then to get the content you call BAOS.toString()
daning - (23/08/2008 09:40): vmassol: Yes. I just change the OutputStream to ByteArrayOutputStream now.
vmassol - (23/08/2008 09:40): what's wrong with that?
vmassol - (23/08/2008 09:40): no
vmassol - (23/08/2008 09:40): don't do that
daning - (23/08/2008 09:40): ?
vmassol - (23/08/2008 09:40): the signature should be output stream
vmassol - (23/08/2008 09:40): it's only the user code that uses BAOS
vmassol - (23/08/2008 09:41): I really don't understand what you don't understand
daning - (23/08/2008 09:42): vmassol: wait a minute. I will explain my thought.
vmassol - (23/08/2008 09:42): ah I know
daning - (23/08/2008 09:42): vmassol: You mean the interface should be OutputStream convert(InputStream inputStream, OfficeDocumentType inputDocumentType,
daning - (23/08/2008 09:42): OfficeDocumentType outputDocumentType) right?
vmassol - (23/08/2008 09:42): it's because you sdhould return
vmassol - (23/08/2008 09:43): you should pass it as parameter
vmassol - (23/08/2008 09:43): s/shoud/shouldn't
vmassol - (23/08/2008 09:43): you need to leave it to the user to define what stream they want
vmassol - (23/08/2008 09:43): so the sig is: void convert(IS, OS, ...)
daning - (23/08/2008 09:44): vmassol: Yes. This is what I want. oid convert(InputStream inputStream, OfficeDocumentType
daning - (23/08/2008 09:44): inputDocumentType, OutputStream outputStream, OfficeDocumentType
daning - (23/08/2008 09:44): outputDocumentType)
daning - (23/08/2008 09:44): vmassol: Is that OK?
daning - (23/08/2008 09:44): vmassol: s/oid/void/
vmassol - (23/08/2008 09:44): yes
vmassol - (23/08/2008 09:45): you cannot do otherwise
vmassol - (23/08/2008 09:45): since otherwise it would mean that you create the stream but you cannot close it
vmassol - (23/08/2008 09:45): so you'd leave it to the user to close a stream you'd have created which is a bad practice IMO
vmassol - (23/08/2008 09:45): the user should manage it's OS: creation and closing
asyd - (23/08/2008 09:59): ola
vmassol - (23/08/2008 09:59): yo
xwikibot - (23/08/2008 12:03): Development.SpeedingUp was modified by xwiki:XWiki.lucaa - http://watch.xwiki.org/xwiki/bin/view/Development/SpeedingUp
daning - (23/08/2008 16:53): vmassol: I have finish the part of code clean. Know I have some questions to ask. Do you have some time now?
vmassol - (23/08/2008 16:54): daning: go ahead
daning - (23/08/2008 16:54): # TODO leftover like:
daning - (23/08/2008 16:54): / TODO automatically start the open office server
daning - (23/08/2008 16:54): / soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
daning - (23/08/2008 16:54): vmassol: What does this mean?
vmassol - (23/08/2008 16:54): this means remove leftovers
vmassol - (23/08/2008 16:55): I thought we had agreed that it's the user who will start the office server
daning - (23/08/2008 16:55): vmassol: Yes. I thought you want remove all the TODO mark. Sorry for that.
daning - (23/08/2008 16:56): "Util should be removed in general and methods moved elsewhere." I think you mean that, the method in Util only be used in a special class, so the method should move to this special class, right?
vmassol - (23/08/2008 16:56): what I mean is that if you have methods in a util class it means you have a bad design somewhere
daning - (23/08/2008 16:57): vmassol: ?
vmassol - (23/08/2008 16:57): so you should think hard about where would be the best place to move the methods you currently have in util
daning - (23/08/2008 16:57): vmassol: But the xwiki have some Util class. such as com.xpn.xwiki.web.Utils
vmassol - (23/08/2008 16:58): yes and it's a bad design :)
vmassol - (23/08/2008 16:58): lots of the code in xwiki is badly designed
daning - (23/08/2008 16:58): vmassol: OK. Let me think for a moment.
vmassol - (23/08/2008 16:59): doesn't mean we should keep doing it badly ;)
daning - (23/08/2008 16:59): vmassol: Any principles to deal with the Util methods?
vmassol - (23/08/2008 16:59): I'll look at it to give you some ideas
vmassol - (23/08/2008 17:00): yes take each method one by one
vmassol - (23/08/2008 17:00): first one: public static String document2String(Document doc, String charset)
vmassol - (23/08/2008 17:00): this one is not needed I think and should be removed right?
daning - (23/08/2008 17:01): vmassol: I have removed it.
vmassol - (23/08/2008 17:01): ok next one: public static boolean canViewAsHtml(OfficeDocumentType documentType)
daning - (23/08/2008 17:01): vmassol: Remove too.
vmassol - (23/08/2008 17:01): I think this should be included in OfficeDocumentType
vmassol - (23/08/2008 17:01): ok
vmassol - (23/08/2008 17:02): even better if it's not used
daning - (23/08/2008 17:02): canViewAsHtml is not used for now.
vmassol - (23/08/2008 17:02): 3rd method: public static String convertXHTML2XWikiSyntax(String inputXHTML)
vmassol - (23/08/2008 17:02): for this one I think we need something more generic and the abilty to convert from office formats to output formats
vmassol - (23/08/2008 17:02): and wiki syntax is an output format
vmassol - (23/08/2008 17:03): note that I said wiki syntax and not xwiki syntax
vmassol - (23/08/2008 17:03): since you should'nt assume it'll be converted to xwiki syntax
daning - (23/08/2008 17:03): vmassol: But for now, the xwiki syntax is what we need.
vmassol - (23/08/2008 17:03): no
vmassol - (23/08/2008 17:04): so I think you need a mechanism so that in your convert() process we can specify a wiki output format for a syntax
vmassol - (23/08/2008 17:04): this is not your concern in the office converter
vmassol - (23/08/2008 17:04): this is done by the rendering module
vmassol - (23/08/2008 17:04): all you need is give some XHTML to it
vmassol - (23/08/2008 17:04): and it know how to generates any format out of it:
daning - (23/08/2008 17:04): vmassol: I think so.
vmassol - (23/08/2008 17:04): xwiki syntax, mediawiki syntax, Tex syntax, PDF syntax, etc
vmassol - (23/08/2008 17:06): thinking
vmassol - (23/08/2008 17:06): so it means the conversion to wiki syntax is actually not a concern of the office converter
vmassol - (23/08/2008 17:06): it should just provide clean xhtml that can be converted
vmassol - (23/08/2008 17:06): however
vmassol - (23/08/2008 17:07): the plugin is a different matter
daning - (23/08/2008 17:08): vmassol: I think this plugin is just for the xwiki office importer application.
vmassol - (23/08/2008 17:09): I haven't looked very closely at the plugin yet
vmassol - (23/08/2008 17:11): btw this needs to be fixed too:
vmassol - (23/08/2008 17:11): } catch (ParseException e) {
vmassol - (23/08/2008 17:11): e.printStackTrace();
vmassol - (23/08/2008 17:11): }
daning - (23/08/2008 17:11): vmassol: How to convert xhtml to xwiki syntax, mediawiki syntax, Tex syntax, PDF syntax? I think step 1: use xhtmlparser to generate xdom
daning - (23/08/2008 17:11): step2. use special rendering to get the special syntax.
vmassol - (23/08/2008 17:11): daning: answer is it's the user of the office converter that should call it
vmassol - (23/08/2008 17:12): the office converter should probably stop at the generation of clean XHTML
vmassol - (23/08/2008 17:12): I'm separating the plugin from our discussion here
vmassol - (23/08/2008 17:12): anyway just seen this method is only used in the plugin
vmassol - (23/08/2008 17:13): let me look quickly at the plugin to see what it does
daning - (23/08/2008 17:13): vmassol: You can update the version as I just commit something.
vmassol - (23/08/2008 17:14): svn is not working for me right now for some reason
daning - (23/08/2008 17:14): OK. I just remove some unused methods.
vmassol - (23/08/2008 17:15): daning: this needs to be fixed too:
vmassol - (23/08/2008 17:15): // TODO How to create temp file with xwiki util
vmassol - (23/08/2008 17:15): String oriTempDir = System.getProperty("java.io.tmpdir");
vmassol - (23/08/2008 17:15): we have a method in core for this AFAIK
vmassol - (23/08/2008 17:16): it's in XWiki: public File getTempDirectory(XWikiContext context)
vmassol - (23/08/2008 17:17): " // As the <a href="http://www.artofsolving.com/opensource/jodconverter">jodconverter</a> convert the inputstream
vmassol - (23/08/2008 17:17): // to the system temp directory."
vmassol - (23/08/2008 17:18): are you sure you can't define the output directory (would be strange)?
daning - (23/08/2008 17:19): The temp dir is set in jodconverter.
vmassol - (23/08/2008 17:19): you don't seem to be doing anything with the images it seems
vmassol - (23/08/2008 17:19): daning: I know but are you sure you can't control it?
daning - (23/08/2008 17:19): vmassol: With jodconverter, yes, I am sure.
daning - (23/08/2008 17:21): vmassol: Wait a minute. Let me see it again.
vmassol - (23/08/2008 17:23): daning: see http://sourceforge.net/forum/forum.php?thread_id=2129457&forum_id=317001
vmassol - (23/08/2008 17:24): so we can control the output location easily
vmassol - (23/08/2008 17:28): daning: I got to go get the kids
daning - (23/08/2008 17:29): vmassol: OK. I will continue to think it.
daning - (23/08/2008 17:29): vmassol: I will send the status to the list.
vmassol - (23/08/2008 17:30): we need to decide if we separate the plugin from the office converter itself, still not sure about it but probably a good idea
vmassol - (23/08/2008 17:31): I need to look at the plugin + application in more details too
vmassol - (23/08/2008 17:31): then I'll send some vote emails for the move
vmassol - (23/08/2008 17:31): got to go, bfn
daning - (23/08/2008 17:31): vmassol: bye
vmassol - (23/08/2008 17:34): daning: don't you have a patch for me to apply for the HTMLCleaner?
daning - (23/08/2008 17:35): vmassol: Yes, I do. But it's not good enough now I think.
xwikibot - (23/08/2008 18:20): XWiki.haleden was modified by XWiki.haleden (Created user) - http://www.xwiki.org/xwiki/bin/view/XWiki/haleden
daning - (23/08/2008 19:56): vmassol: ?
xwikibot - (23/08/2008 21:28): Community.CodeStyle was modified by xwiki:XWiki.VincentMassol (Added class/interfaces names rules) - http://dev.xwiki.org/xwiki/bin/view/Community/CodeStyle