public class ContentImportManager extends AbstractLogEnabled implements Serviceable, Component
ContentImporter
multiple extension point.Modifier and Type | Class and Description |
---|---|
class |
ContentImportManager.ImportResult
Class representing a content import result.
|
Modifier and Type | Field and Description |
---|---|
protected ContentImporterExtensionPoint |
_contentImportEP
The content importer extension point.
|
protected DOMParser |
_domParser
A DOM parser.
|
static String |
ROLE
The avalon role.
|
Constructor and Description |
---|
ContentImportManager() |
Modifier and Type | Method and Description |
---|---|
protected ContentImporter |
getImporter(File file)
Get the
ContentImporter supporting the file. |
ContentImportManager.ImportResult |
importContents(File file)
Import contents from a given file.
|
ContentImportManager.ImportResult |
importContents(InputStream is,
String name)
Import contents from an input stream.
|
void |
service(ServiceManager serviceManager) |
protected boolean |
supports(ContentImporter importer,
BufferedInputStream in,
String name,
Map<String,Object> importContext)
Test if an importer supports the file.
|
protected boolean |
supportsXml(XmlContentImporter importer,
BufferedInputStream in,
Map<String,Object> importContext)
Test if an
XmlContentImporter supports the file. |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
protected ContentImporterExtensionPoint _contentImportEP
protected DOMParser _domParser
public ContentImportManager()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
ServiceException
public ContentImportManager.ImportResult importContents(File file) throws ContentImportException
file
- the file describing the contents to import.ContentImportException
- if an exception occurs while importing the contents from the file.public ContentImportManager.ImportResult importContents(InputStream is, String name) throws ContentImportException
is
- an input stream on the data describing the contents to import.name
- the "file" name, can be null. If it's null, some importers may not be able to identify the stream.ContentImportException
- if an exception occurs while importing the contents from the file.protected ContentImporter getImporter(File file) throws IOException
ContentImporter
supporting the file.file
- the fileContentImporter
corresponding to aIOException
- if an exception occurs when manipulating the fileprotected boolean supports(ContentImporter importer, BufferedInputStream in, String name, Map<String,Object> importContext) throws IOException
importer
- the importer to test.in
- an InputStream on the file.name
- the file name, can be null.importContext
- the import context map.IOException
- if an error occurs testing the importer.protected boolean supportsXml(XmlContentImporter importer, BufferedInputStream in, Map<String,Object> importContext) throws IOException
XmlContentImporter
supports the file.importer
- the XML content importer to test.in
- an InputStream on the file.importContext
- the import context map.IOException
- if an error occurs testing the importer.