public class JSTORFetcher extends java.lang.Object implements EntryFetcher
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
COOKIE_CITATIONS
Cookie key for citations to be fetched
|
protected static java.lang.String |
COOKIE_TICKET
Cookie key for Jstor ticket (authentication)
|
protected static int |
MAX_CITATIONS
cookies can't save more than 200 citations
|
protected static java.lang.String |
URL_BIBTEX
location where to obtain the citations cookie
|
protected static java.lang.String |
URL_TICKET
location where the ticket is obtained
|
Constructor and Description |
---|
JSTORFetcher() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Collection<BibtexEntry> |
getBibtexEntries(java.lang.String ticket,
java.lang.String citations)
Given a ticket an a list of citations, retrieve BibtexEntries from JStor
|
protected java.lang.String |
getCitations(java.lang.String ticket,
java.lang.String query)
requires a valid JStor Ticket ID
|
static java.lang.String |
getCookie(java.lang.String name,
java.net.URLConnection conn)
evaluates the 'Set-Cookie'-Header of a HTTP response
|
java.lang.String |
getHelpPage()
Get the name of the help page for this activeFetcher.
|
java.net.URL |
getIcon()
Get the appropriate icon URL for this activeFetcher.
|
java.lang.String |
getKeyName()
Get the name of the key binding for this activeFetcher, if any.
|
javax.swing.JPanel |
getOptionsPanel()
If this activeFetcher requires additional options, a panel for setting up these
should be returned in a JPanel by this method.
|
java.lang.String |
getTitle()
The title for this activeFetcher, displayed in the menu and in the side pane.
|
protected java.lang.String |
openTicket() |
boolean |
processQuery(java.lang.String query,
ImportInspector dialog,
OutputPrinter status)
Handle a query entered by the user.
|
void |
stopFetching()
This method is called by the dialog when the user has cancelled or
signalled a stop.
|
protected static int MAX_CITATIONS
protected static final java.lang.String COOKIE_TICKET
protected static final java.lang.String URL_TICKET
protected static final java.lang.String COOKIE_CITATIONS
protected static final java.lang.String URL_BIBTEX
public java.lang.String getHelpPage()
EntryFetcher
getHelpPage
in interface EntryFetcher
public java.net.URL getIcon()
EntryFetcher
getIcon
in interface EntryFetcher
public java.lang.String getKeyName()
EntryFetcher
getKeyName
in interface EntryFetcher
public javax.swing.JPanel getOptionsPanel()
EntryFetcher
getOptionsPanel
in interface EntryFetcher
public java.lang.String getTitle()
EntryFetcher
getTitle
in interface EntryFetcher
public void stopFetching()
ImportInspectionDialog.CallBack
stopFetching
in interface ImportInspectionDialog.CallBack
public boolean processQuery(java.lang.String query, ImportInspector dialog, OutputPrinter status)
EntryFetcher
processQuery
in interface EntryFetcher
query
- The query text.dialog
- The dialog to add imported entries to.status
- An OutputPrinter passed to the activeFetcher for reporting about the
status of the fetching.protected java.util.Collection<BibtexEntry> getBibtexEntries(java.lang.String ticket, java.lang.String citations) throws java.io.IOException
ticket
- A valid ticket as returned by openTicket()citations
- A list of citations as returned by getCitations()java.io.IOException
- Most probably related to a problem connecting to JStor.protected java.lang.String openTicket() throws java.io.IOException
java.io.IOException
protected java.lang.String getCitations(java.lang.String ticket, java.lang.String query) throws java.io.IOException
query
- The search term to query JStor for.ticket
- JStor ticketjava.io.IOException
public static java.lang.String getCookie(java.lang.String name, java.net.URLConnection conn) throws java.io.IOException
name
- key of a cookie valueconn
- URLConnectionjava.io.IOException