makeBibliography is expensive since the
CSL instance will be created. As long as the style stays the same, we can reuse this instance. On style-change, the
engine is re-instantiated. Therefore, the use-case of this class is many calls to makeBibliography with the
same style. Changing the output format is cheap.
Note on the implementation:
The main function makeBibliography will enforce
synchronized calling. The main CSL engine under the hood is not thread-safe. Since this class is usually called from
a BackgroundTask, the only other option would be to create several CSL instances which is wasting a lot of resources and very slow.
In the current scheme, makeBibliography can be called as usual
background task and to the best of my knowledge, concurrent calls will pile up and processed sequentially.
| Modifier and Type | Field and Description |
|---|---|
| private de. | |
| private final JabRefItemDataProvider | |
| private CitationStyleOutputFormat | |
| private String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | initialize(String
journal style of the output newStyle, CitationStyleOutputFormat usually HTML or RTF. newFormat)Initialized the static CSL instance if needed. |
| public synchronized List | makeBibliography(List<BibEntry> bibEntries, String style, CitationStyleOutputFormat outputFormat, BibDatabaseContext
BibDatabaseContext is used to be able to resolve fields and their aliasesCreates the bibliography of the provided items. |
| cslInstance | back to summary |
|---|---|
| private de. | |
| dataProvider | back to summary |
|---|---|
| private final JabRefItemDataProvider dataProvider | |
| format | back to summary |
|---|---|
| private CitationStyleOutputFormat format | |
| style | back to summary |
|---|---|
| private String style | |
| CSLAdapter | back to summary |
|---|---|
| public CSLAdapter() | |
| initialize | back to summary |
|---|---|
| private void initialize(String newStyle, CitationStyleOutputFormat newFormat) throws IOException Initialized the static CSL instance if needed.
| |
| makeBibliography | back to summary |
|---|---|
| public synchronized List Creates the bibliography of the provided items. This method needs to run synchronized because the underlying CSL engine is not thread-safe.
| |