Top Inners Fields Constructors Methods
org.jabref.cli

public Class ArgumentProcessor

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.charset.StandardCharsets, java.nio.file.Files, .Path, java.util.ArrayList, .Collections, .List, .Locale, .Optional, .Set, java.util.prefs.BackingStoreException, org.jabref.gui.externalfiles.AutoSetFileLinksUtil, org.jabref.gui.undo.NamedCompound, org.jabref.logic.JabRefException, .UiCommand, org.jabref.logic.bibtex.FieldPreferences, org.jabref.logic.citationkeypattern.CitationKeyGenerator, org.jabref.logic.exporter.AtomicFileWriter, .BibDatabaseWriter, .BibWriter, .BibtexDatabaseWriter, .EmbeddedBibFilePdfExporter, .Exporter, .ExporterFactory, .SelfContainedSaveConfiguration, .XmpPdfExporter, org.jabref.logic.importer.FetcherException, .ImportException, .ImportFormatPreferences, .ImportFormatReader, .OpenDatabase, .ParseException, .ParserResult, .SearchBasedFetcher, .WebFetchers, org.jabref.logic.importer.fileformat.BibtexParser, org.jabref.logic.journals.JournalAbbreviationRepository, org.jabref.logic.l10n.Localization, org.jabref.logic.net.URLDownload, org.jabref.logic.search.DatabaseSearcher, .SearchQuery, org.jabref.logic.shared.prefs.SharedDatabasePreferences, org.jabref.logic.util.OS, org.jabref.logic.util.io.FileUtil, org.jabref.logic.xmp.XmpPreferences, org.jabref.model.database.BibDatabase, .BibDatabaseContext, .BibDatabaseMode, org.jabref.model.entry.BibEntry, .BibEntryTypesManager, org.jabref.model.strings.StringUtil, org.jabref.model.util.DummyFileUpdateMonitor, .FileUpdateMonitor, org.jabref.preferences.FilePreferences, .PreferencesService, .SearchPreferences, com.airhacks.afterburner.injection.Injector, com.google.common.base.Throwables, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private final JabRefCLI
private final BibEntryTypesManager
private final FileUpdateMonitor
private boolean
private static final Logger
private final PreferencesService
private final ArgumentProcessor.Mode
private final List<UiCommand>

Constructor Summary

AccessConstructor and Description
public
ArgumentProcessor(String[] args, ArgumentProcessor.Mode startupMode, PreferencesService preferencesService, FileUpdateMonitor fileUpdateMonitor, BibEntryTypesManager entryTypesManager)

First call the constructor, then call processArguments().

Method Summary

Modifier and TypeMethod and Description
private void
private void
private boolean
private Optional<ParserResult>

Returns:

A parser result containing the entries fetched or null if an error occurred.
fetch
(String
A string containing both the name of the fetcher to use and the search query, separated by a :
fetchCommand
)

Run an entry fetcher from the command line.

private boolean
public List<UiCommand>
private List<ParserResult>

Returns:

List of opened files (could be .bib, but also other formats). May also contain error results.
importAndOpenFiles
()

private Optional<ParserResult>
importBibtexToOpenBase(String argument, ImportFormatPreferences importFormatPreferences)

private Optional<ParserResult>
importFile(String argument)

private Optional<ParserResult>
importFile(Path file, String importFormat)

private void
private Optional<ParserResult>

Returns:

ParserResult with setToOpenTab(true)
importToOpenBase
(String
See importFile.
argument
)

Will open a file (like importFile), but will also request JabRef to focus on this database

public void
private void
private void
private void
saveDatabase(BibDatabase newBase, String subName)

public boolean
private void
writeMetadataToPdf(List<ParserResult> loaded, String filesAndCitekeys, XmpPreferences xmpPreferences, FilePreferences filePreferences, BibDatabaseMode databaseMode, BibEntryTypesManager entryTypesManager, FieldPreferences fieldPreferences, JournalAbbreviationRepository abbreviationRepository, boolean writeXMP, boolean embeddBibfile)

private void
writeMetadataToPdfByCitekey(BibDatabaseContext databaseContext, List<String> citeKeys, FilePreferences filePreferences, XmpPdfExporter xmpPdfExporter, EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, JournalAbbreviationRepository abbreviationRepository, boolean writeXMP, boolean embeddBibfile)

private void
writeMetadataToPdfByFileNames(BibDatabaseContext databaseContext, List<String> pdfs, FilePreferences filePreferences, XmpPdfExporter xmpPdfExporter, EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, JournalAbbreviationRepository abbreviationRepository, boolean writeXMP, boolean embeddBibfile)

private void
writeMetadataToPDFsOfEntry(BibDatabaseContext databaseContext, String citeKey, BibEntry entry, FilePreferences filePreferences, XmpPdfExporter xmpPdfExporter, EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, JournalAbbreviationRepository abbreviationRepository, boolean writeXMP, boolean embeddBibfile)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cliback to summary
private final JabRefCLI cli
entryTypesManagerback to summary
private final BibEntryTypesManager entryTypesManager
fileUpdateMonitorback to summary
private final FileUpdateMonitor fileUpdateMonitor
guiNeededback to summary
private boolean guiNeeded
LOGGERback to summary
private static final Logger LOGGER
preferencesServiceback to summary
private final PreferencesService preferencesService
startupModeback to summary
private final ArgumentProcessor.Mode startupMode
uiCommandsback to summary
private final List<UiCommand> uiCommands

Constructor Detail

ArgumentProcessorback to summary
public ArgumentProcessor(String[] args, ArgumentProcessor.Mode startupMode, PreferencesService preferencesService, FileUpdateMonitor fileUpdateMonitor, BibEntryTypesManager entryTypesManager) throws ParseException

First call the constructor, then call processArguments(). Afterward, you can access the getUiCommands().

Method Detail

doAuxImportback to summary
private void doAuxImport(List<ParserResult> loaded)
exportFileback to summary
private void exportFile(List<ParserResult> loaded, String[] data)
exportMatchesback to summary
private boolean exportMatches(List<ParserResult> loaded)
fetchback to summary
private Optional<ParserResult> fetch(String fetchCommand)

Run an entry fetcher from the command line.

Parameters
fetchCommand:String

A string containing both the name of the fetcher to use and the search query, separated by a :

Returns:Optional<ParserResult>

A parser result containing the entries fetched or null if an error occurred.

generateAuxback to summary
private boolean generateAux(List<ParserResult> loaded, String[] data)
getUiCommandsback to summary
public List<UiCommand> getUiCommands()
importAndOpenFilesback to summary
private List<ParserResult> importAndOpenFiles()
Returns:List<ParserResult>

List of opened files (could be .bib, but also other formats). May also contain error results.

importBibtexToOpenBaseback to summary
private Optional<ParserResult> importBibtexToOpenBase(String argument, ImportFormatPreferences importFormatPreferences)
importFileback to summary
private Optional<ParserResult> importFile(String argument)
importFileback to summary
private Optional<ParserResult> importFile(Path file, String importFormat)
importPreferencesback to summary
private void importPreferences()
importToOpenBaseback to summary
private Optional<ParserResult> importToOpenBase(String argument)

Will open a file (like importFile), but will also request JabRef to focus on this database

Parameters
argument:String

See importFile.

Returns:Optional<ParserResult>

ParserResult with setToOpenTab(true)

processArgumentsback to summary
public void processArguments()
regenerateCitationKeysback to summary
private void regenerateCitationKeys(List<ParserResult> loaded)
resetPreferencesback to summary
private void resetPreferences(String value)
saveDatabaseback to summary
private void saveDatabase(BibDatabase newBase, String subName)
shouldShutDownback to summary
public boolean shouldShutDown()
writeMetadataToPdfback to summary
private void writeMetadataToPdf(List<ParserResult> loaded, String filesAndCitekeys, XmpPreferences xmpPreferences, FilePreferences filePreferences, BibDatabaseMode databaseMode, BibEntryTypesManager entryTypesManager, FieldPreferences fieldPreferences, JournalAbbreviationRepository abbreviationRepository, boolean writeXMP, boolean embeddBibfile)
writeMetadataToPdfByCitekeyback to summary
private void writeMetadataToPdfByCitekey(BibDatabaseContext databaseContext, List<String> citeKeys, FilePreferences filePreferences, XmpPdfExporter xmpPdfExporter, EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, JournalAbbreviationRepository abbreviationRepository, boolean writeXMP, boolean embeddBibfile)
writeMetadataToPdfByFileNamesback to summary
private void writeMetadataToPdfByFileNames(BibDatabaseContext databaseContext, List<String> pdfs, FilePreferences filePreferences, XmpPdfExporter xmpPdfExporter, EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, JournalAbbreviationRepository abbreviationRepository, boolean writeXMP, boolean embeddBibfile)
writeMetadataToPDFsOfEntryback to summary
private void writeMetadataToPDFsOfEntry(BibDatabaseContext databaseContext, String citeKey, BibEntry entry, FilePreferences filePreferences, XmpPdfExporter xmpPdfExporter, EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, JournalAbbreviationRepository abbreviationRepository, boolean writeXMP, boolean embeddBibfile)
org.jabref.cli back to summary

public final Enum ArgumentProcessor.Mode

extends Enum<ArgumentProcessor.Mode>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ArgumentProcessor.Mode
public static final ArgumentProcessor.Mode

Constructor Summary

AccessConstructor and Description
private
Mode()

Method Summary

Modifier and TypeMethod and Description
public static ArgumentProcessor.Mode
public static ArgumentProcessor.Mode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INITIAL_STARTback to summary
public static final ArgumentProcessor.Mode INITIAL_START
REMOTE_STARTback to summary
public static final ArgumentProcessor.Mode REMOTE_START

Constructor Detail

Modeback to summary
private Mode()

Method Detail

valueOfback to summary
public static ArgumentProcessor.Mode valueOf(String name)
valuesback to summary
public static ArgumentProcessor.Mode[] values()