Last modified by Vincent Massol on 2024/11/19 16:12

Show last authors
1 {{error}}
2 Superseeded by the [[Application Manager>>Design.ExtensionManager]]
3 {{/error}}
4
5 {{warning}}
6 This is some old design. Nowadays I would add the ability to import full applications, i.e. XWiki XML Documents + XWiki plugins + external JARS + Application descriptor) all packaged inside a XAR. The rest still sounds good
7 {{/warning}}
8
9 {{info}}
10 We should make sure that this new architecture incorporates the current Core Packager + the [[Application Packager>>extensions:Extension.Packager Application]] + the new Application Manager plugin
11 {{/info}}
12
13 {{info}}
14 See this [[thread>>http://www.nabble.com/-Proposal--New-Importer-Architecture-tf3535641.html#a9869030]] for the discussion related to this proposal
15 {{/info}}
16
17 The current importer is lacking some features:
18
19 * bad design and too complex to maintain
20 * cannot import HTML, plain text, etc
21 * cannot convert from one wiki syntax to another
22
23 == Proposal ==
24
25 * A **Importer** interface to represent the different importers
26 ** //import(Converter converter, DocumentImportFactory factory)//
27 ** //setFilter(ImportFilter filter)// : to decide what document to import
28 * A **Converter** interface to convert original content before it's imported into a page
29 ** //OutputStream convert(InputStream originalContent)//
30 * A **DocumentImportFactory** interface for delegating how pages are created. This is important as there are different strategies for finding out the following data from the original content:
31 ** Language
32 ** Target Space
33 ** Target Page name
34 ** Objects to attach
35 ** Attachments
36 ** Versions
37 ** Author
38 ** API:
39 *** //XWikiDocument createDocument(String originalFileName, InputStream contentAfterConversion)//
40 *** //setMode(REPLACE || APPEND)//: whether to create a new version or replace any existing doc
41
42 Examples of implementations:
43
44 * For Importer: FileImporter, DirectoryImporter, ZIPImporter, ZipURLImporter, JARImporter
45 * For Converter: PlainTextConverter, HTMLConverter, TWikiConverter, ConfluenceConverter, XWikiXMLConverter (for converting documents in XWiki XML format)
46 * For DocumentImportFactory: XARDocumentImportFactory, ExpandedXARDocumentImportFactory, DefaultDocumentImportFactory (uses the file name as page name and parent directory as space, etc)
47
48 == Examples of Use Cases ==
49
50 * A XAR file
51 ** //new ZipImporter(new File(".../.xar"), new XWikiXMLConverter(), new XARDocumentImportFactory(new File(".../.xar"~)~)~)//
52 * A single HTML file
53 ** //new FileImporter(new File(".../.html"), new HTMLConverter(), new DefaultDocumentImporterFactory())//
54 * A zip file containing TWiki pages
55 ** //new ZipImporter(new File(".../.zip"), new TWikiConverter(), new DefaultDocumentImporterFactory())//
56 * An expanded directory of HTML files
57 ** //new DirectoryImporter(new File(".../somedir"), new HTMLConverter(), new DefaultDocumentImporterFactory())//
58
59 == Questions ==
60
61 Put any question you have here:
62
63 * (question here)

Get Connected