Difference between revisions of "Exporter"
(→View Exporter) |
|||
(10 intermediate revisions by one user not shown) | |||
Line 3: | Line 3: | ||
A [[Personality|''personality'']] in the Crawler system can be built around an exporter. It is not a requirement to do so, but using an exporter can make things easier by providing some useful pre-made functionality. | A [[Personality|''personality'']] in the Crawler system can be built around an exporter. It is not a requirement to do so, but using an exporter can make things easier by providing some useful pre-made functionality. | ||
− | + | = Parent-child personalities = | |
− | In many cases, personalities are built around a [[ViewExporter|''view exporter'']], | + | The exporter is a high-level [[Adapter|''adapter'']] which coordinates parent-child relations between [[Personality|''personalities'']]. |
+ | |||
+ | It is possible to create a new personality by tweaking an existing personality. This is achieved by overriding certain settings or adding to the existing settings in the configuration files. | ||
+ | |||
+ | This 'personality-inheritance' mechanism is handled by the exporter adapter. For example, if the default XHTML/CSS personality almost fits the bill, it's possible to derive a new personality from it, and enhance or change the way the derived personality behaves. | ||
+ | |||
+ | = Debug Monitors = | ||
+ | |||
+ | A second function of the exporter is to manage the log level and the injection of [[Debug Monitor|''debug monitors'']] into the adapter network. The exporter reads the top-level configuration file to determine which [[Named Adapter|''named adapters'']] need to be monitored, and it will dynamically add the necessary debug monitors to the adapter network. | ||
+ | |||
+ | This sample top-level config file has a sample [debug] section which enables a debug monitor on the input to the "inputSplitter" [[Named Adapter|''named adapter'']] in the network. | ||
+ | |||
+ | <pre> | ||
+ | [conditionals] | ||
+ | |||
+ | selectors = xhtml | ||
+ | |||
+ | [main] | ||
+ | |||
+ | personalityConfig?xhtml = "./Personalities/XHTML/config.ini" | ||
+ | personalityConfig?text = "./Personalities/Text/config.ini" | ||
+ | personalityConfig?hyperlinks = "./Personalities/Hyperlinks/config.ini" | ||
+ | |||
+ | # ******************************************************************************** | ||
+ | |||
+ | [debug] | ||
+ | |||
+ | # | ||
+ | # Turn on/off logging and target specific adapters by name | ||
+ | # | ||
+ | |||
+ | debugMonitoring = true | ||
+ | monitorAdapters = inputSplitter | ||
+ | |||
+ | # | ||
+ | # Logging.LOG_ERROR = 1; | ||
+ | # Logging.LOG_WARNING = 2; | ||
+ | # Logging.LOG_NOTE = 3; | ||
+ | # Logging.LOG_DEBUG = 4; | ||
+ | # Logging.LOG_TRACE = 5; | ||
+ | # | ||
+ | logLevel = 5 | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | = View Exporter = | ||
+ | |||
+ | In many cases, personalities are built around a [[ViewExporter|''view exporter'']], rather than an exporter. A view exporter is a specialized exporter which supports multiple [[View|''views'']]. | ||
Views are alternate data flows. | Views are alternate data flows. | ||
Line 11: | Line 58: | ||
For example, an InDesign-to-XHTML/CSS conversion will use two separate views: an XHTML view and a CSS view. | For example, an InDesign-to-XHTML/CSS conversion will use two separate views: an XHTML view and a CSS view. | ||
− | The document will first be disassembled by a set of disassemblers, and the resulting output data flow will be duplicated into two separate data flows. One of the two data flows will be routed through the XHTML view, the other through the CSS view. The end result will be two separate data files: one file produced by the XHTML view, the other will be produced by the CSS view. Both files will be based on the same input data, but they will go through separate construction mechanisms. | + | The document will first be disassembled by a set of disassemblers, and the resulting output data flow will be duplicated into two separate data flows by means of an [[Input Splitter|''input splitter'']]. |
+ | |||
+ | One of the two data flows will be routed through the XHTML view, the other through the CSS view. The end result will be two separate data files: one file produced by the XHTML view, the other will be produced by the CSS view. Both files will be based on the same input data, but they will go through separate construction mechanisms. |
Latest revision as of 03:35, 28 December 2013
An exporter is an atomic adapter.
A personality in the Crawler system can be built around an exporter. It is not a requirement to do so, but using an exporter can make things easier by providing some useful pre-made functionality.
Parent-child personalities
The exporter is a high-level adapter which coordinates parent-child relations between personalities.
It is possible to create a new personality by tweaking an existing personality. This is achieved by overriding certain settings or adding to the existing settings in the configuration files.
This 'personality-inheritance' mechanism is handled by the exporter adapter. For example, if the default XHTML/CSS personality almost fits the bill, it's possible to derive a new personality from it, and enhance or change the way the derived personality behaves.
Debug Monitors
A second function of the exporter is to manage the log level and the injection of debug monitors into the adapter network. The exporter reads the top-level configuration file to determine which named adapters need to be monitored, and it will dynamically add the necessary debug monitors to the adapter network.
This sample top-level config file has a sample [debug] section which enables a debug monitor on the input to the "inputSplitter" named adapter in the network.
[conditionals] selectors = xhtml [main] personalityConfig?xhtml = "./Personalities/XHTML/config.ini" personalityConfig?text = "./Personalities/Text/config.ini" personalityConfig?hyperlinks = "./Personalities/Hyperlinks/config.ini" # ******************************************************************************** [debug] # # Turn on/off logging and target specific adapters by name # debugMonitoring = true monitorAdapters = inputSplitter # # Logging.LOG_ERROR = 1; # Logging.LOG_WARNING = 2; # Logging.LOG_NOTE = 3; # Logging.LOG_DEBUG = 4; # Logging.LOG_TRACE = 5; # logLevel = 5
View Exporter
In many cases, personalities are built around a view exporter, rather than an exporter. A view exporter is a specialized exporter which supports multiple views.
Views are alternate data flows.
For example, an InDesign-to-XHTML/CSS conversion will use two separate views: an XHTML view and a CSS view.
The document will first be disassembled by a set of disassemblers, and the resulting output data flow will be duplicated into two separate data flows by means of an input splitter.
One of the two data flows will be routed through the XHTML view, the other through the CSS view. The end result will be two separate data files: one file produced by the XHTML view, the other will be produced by the CSS view. Both files will be based on the same input data, but they will go through separate construction mechanisms.