Howdy Françoise,

The way I would approach this project is to use an external script and pull all 
of the attachments
out to the filesystem then push them into XWiki. It is true that with FS 
attachments, XWiki stores
the attachments as plain old files on the filesystem but each one has 
accompanying data in the database
and that is difficult to replicate so I recommend just sending the attachments 
in through the "front door".
A search of oracle blob to file turns up plenty of relevant results.
This looks promising: 
http://www.idevelopment.info/data/Oracle/DBA_tips/LOBs/LOBS_10.shtml

Once the files are exported to the filesystem, I would use a shell script to 
push them to the wiki.
Here's a simple script which pushes files through the webdav system, you should 
be able to modify this
to meet your requirements.

#!/bin/bash
# usage:  upload.sh <document> <file>
# uploads <file> as an attachment to <document>
# example:  upload.sh Main.WebHome /home/user/file.txt
#
fileName="`echo $2 | sed 's/^.*\([^\/]*\)/\1/'`";
path="`echo $1 | sed 's/\(.*\)\.\(.\)\(.*\)$/\1\/_\2_\/\2\3/'`";
curl -v --user Admin:admin -T $2 
http://127.0.0.1:8080/xwiki/webdav/attachments/${path}/${fileName}


Caleb



On 08/24/2011 11:51 AM, Cadin Françoise wrote:
> Thank you very much, I didn't want to start developpement before being sure I 
> can't avoid it. 
> 
> Françoise
> 
> -----Message d'origine-----
> De : [email protected] [mailto:[email protected]] De la part de 
> Thomas Mortagne
> Envoyé : mercredi 24 août 2011 16:14
> À : XWiki Users
> Objet : Re: [xwiki-users] Importing attached files in Xwiki
> 
> Ha I tough you wanted to change the database used for XWiki.
> 
> First thing is to decide where you want to put theses files in XWiki and to 
> define a conversion rule you can then implements in a script.
> 
> You have several solution:
> * use groovy inside a XWiki page since that's the easiest way to use XWiki 
> API to import and store the attachments in your wiki
> * if you are not very confident with groovy (or java since groovy is very 
> close to java) you can also use the REST
> (platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI) or XMLRPC
> (http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPC) or WebDAV
> (http://platform.xwiki.org/xwiki/bin/view/Features/WebDAV) interfaces 
> provided by XWiki to upload the attachments in a whatever script/program you 
> know better
> 
> On Wed, Aug 24, 2011 at 4:04 PM, Guillaume Lerouge <[email protected]> 
> wrote:
>> Hi Françoise,
>>
>> in order to do this, you would need to export all attachments from you 
>> Oracle DB and store them into a ZIP file for instance. Then you would 
>> need to write a script that reads the contents of the ZIP file, 
>> creates a XWiki document for each of them and attaches the file to the 
>> document.
>>
>> I've seen such scripts in action, but unfortunately I cannot find it 
>> on http://extensions.xwiki.org . If you're not a developer, they might 
>> be a bit tough to create from scratch.
>>
>> Guillaume
>>
>> On Wed, Aug 24, 2011 at 3:40 PM, Thomas Mortagne
>> <[email protected]>wrote:
>>
>>> Whatever the way you store the attachment they are supposed to be 
>>> part of the exported xar.
>>>
>>> On Wed, Aug 24, 2011 at 3:33 PM, Cadin Françoise 
>>> <[email protected]> wrote:
>>>> Hello,
>>>>
>>>> My company wants to migrate the content of an Oracle database into XWiki.
>>> This database contains files (xls, doc, rtf etc...) stored in BLOB 
>>> which are linked with text documents. In order to migrate the text 
>>> documents, I use the import in Xar format and it's OK, the problem is 
>>> the migration of the files. In my Wiki I chose the option to store 
>>> the attached files outside the database. I expected to put "metadatas 
>>> attachment" in the xml files and simply copy my files in the right 
>>> directory but it doesn't work. Is it a wrong idea ? What's the best way to 
>>> do it ?
>>>> Thank you for help.
>>>>
>>>> Françoise Cadin
>>>> _______________________________________________
>>>> users mailing list
>>>> [email protected]
>>>> http://lists.xwiki.org/mailman/listinfo/users
>>>>
>>>
>>>
>>>
>>> --
>>> Thomas Mortagne
>>> _______________________________________________
>>> users mailing list
>>> [email protected]
>>> http://lists.xwiki.org/mailman/listinfo/users
>>>
>> _______________________________________________
>> users mailing list
>> [email protected]
>> http://lists.xwiki.org/mailman/listinfo/users
>>
> 
> 
> 
> --
> Thomas Mortagne
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
> 

_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to