Hi Devs,

I have implemented an API for Wiki Importer.

The main component is org.xwiki.wikiimporter.WikiImporter
**WikiImporterDescriptor getDescriptor()
**void importWiki(Object object, WikiImporterListener listener)
**WikiImporterType getType()

Wiki Call back event listener: org.xwiki.wikiimporter.WikiImporterListener
**void beginWikiPage(String pageName, Map<String, String> params)
**void beginWikiPageRevision(String pageName, int revision, Map<String,
String> params)
**void beginObject(String objectType, Map<String, String> params)
**void onProperty(String property, Map<String, String> params, String value)
**void endObject(String objectType, Map<String, String> params)
**void endWikiPageRevision(String pageName, int revision, Map<String,
String> params)
**void endWikiPage(String pageName, Map<String, String> params)
**void beginAttachment(String attachmentName, Map<String, String> param)
**void onAttachmentRevision(String attachmentName, Map<String, String>
params, InputSource input)
**void endAttachment(String attachmentName, Map<String, String> params)


WikiImporter parser for parsing documents (eg: XML ) :
org.xwiki.wikiimporter.WikiImporterParser
**void parse(InputSource source, WikiImporterListener listener) throws
WikiImporterParseException

WikiImporter velocity bridge :
org.xwiki.wikiimporter.WikiImporterVelocityBridge
**public WikiImporterTypeFactory getWikiImporterTypeFactory()
**public WikiImporter getWikiImporter(String wikiImporterType) throws
WikiImporterException

WikiImporter type factory has methods to handle the supported other wiki
formats/types. : org.xwiki.wikiimporter.WikiImporterTypeFactory
**WikiImporterType createTypeFromIdString(String wikiImporterType) throws
WikiImporterException
**List<WikiImporterType> getAvailableTypes() throws WikiImporterException

This is a typical use case in my mind.

   1. Get WikiImporterFactory instance with
   WikiImporterVelocityBridge#getWikiImporterFactory
   2. Call the WikiImporterTypeFactory#getAvailableTypes() --> can be used
   at UI level to show the supported types  ( MediaWiki  XML, XMLRPC etc .. )
   3. Select the format type and call
   WikiImporterVelocityBridge#getWikiImporter(String wikiImporterType) to get
   selected WikiImporter instance.
   4. Use the WikiImporterDescriptor to generate the UI. ( Similiar to
   MacroDescriptor)
   5. User enters all the parameters ( UI )
   6. Call WikiImporter#importWiki(Parameters Class Object,
   WikiImporterListener ) to start the import process. Parameters Class has all
   the required parameters for WikiImporter
   7. Parser parses and WikiImporterListener events are fired.


The next step would be to create xwiki pages on the fly(  one at a time - at
every WikiImporterListener#endWikiPage() event. )

Remaining : API to import the generated WikiPages into XWiki

Is it good idea to use a component which makes use of document bridge to
import the Wiki Pages, Attachments etc.. into XWiki. If not, what will be
the best way to do it?


--
Arun Reddy
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to