|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.co.weft.amazon.AmazonDescriptor
An interface to Amazon Web Services, implemented as a DataStoreDescriptor
| Field Summary | |
protected java.lang.String |
accessKeyId
the amazon access key - you must have one to use match operations, and, furthermore, it must be your own |
static java.lang.String |
ACCESSKEYTOKEN
As of AWS 4.0, you need an access key instead of an associates_id |
static java.lang.String |
AMAZON_HOST_TOKEN
the token on which I will seek my amazon host in the configuration |
static java.lang.String |
AMAZON_SHOP_TOKEN
the token on which I will seek my amazon shop in the configuration |
protected java.lang.String |
amazonHost
the hostname of the amazon data server we will use |
protected java.lang.String |
amazonShop
the hostname of the amazon shop we will use |
static java.lang.String |
ASSOCIATES_ID_TOKEN
Deprecated. obsoleted by AWS v4 |
protected java.lang.String |
associatesId
Deprecated. obsoleted by AWS v4 |
protected boolean |
debug
Whether or not I'm in debug mode |
static java.lang.String |
DEBUGCONFIGTOKEN
A token on which I shall seek in my config whether or not to enter debugging mode |
static java.lang.String |
DEFAULTSEARCHINDEX
Which indexes are availale varies from Amazon store to Amazon store, unfortunately, but 'Books' is always available |
static java.lang.String |
DETAILS_TAG
Deprecated. obsoleted by AWS v4 |
protected java.lang.String |
developerId
tha amazon developer ID I will use |
static java.lang.String |
ERROR_MSG_TAG
Tags used in Amazon's XML: the 'ErrorMsg' (title) tag |
static java.lang.String |
ISBN_TOKEN
The token on which I will seek the isbn to look up in the context. |
static java.lang.String |
ITEM_TAG
Tags used in Amazon's XML: the 'Item' tag |
static java.lang.String |
KEYFN
It's becoming a convention in Jacquard that the keyfield of a store can be found on the KEYFN class constant. |
protected java.lang.String |
mode
my default mode (over-ridden by the value of MODE_TOKEN in the fetch or match context |
static java.lang.String |
MODE_HEAVY
Deprecated. obsoleted by AWS v4 |
static java.lang.String |
MODE_LIGHT
Deprecated. obsoleted by AWS v4 |
static java.lang.String |
MODE_TOKEN
Deprecated. obsoleted by AWS v4 |
static java.lang.String |
PRODUCT_NAME_TAG
Tags used in Amazon's XML: the 'ProductName' (title) tag |
static java.lang.String |
SEARCHAUTHORTOKEN
Amazon Web Services has a number of simple search tokens; this is the author field |
static java.lang.String |
SEARCHINDEXTOKEN
Amazon Web Services have a number of indexes to search |
static java.lang.String |
SEARCHKEYWORDSTOKEN
Amazon Web Services has a number of simple search tokens; this is the keywords field |
static java.lang.String |
SEARCHTITLETOKEN
Amazon Web Services has a number of simple search tokens; this is the title field |
static java.lang.String |
SEARCHTOKENPREFIX
To avoid namespace clashes, we'll prefix the Amazon search tokens in the context with a prefix |
static java.lang.String |
SHOPPING_URL_TOKEN
the token on which I will store the 'shopping URL' in the returned context |
| Constructor Summary | |
AmazonDescriptor(Context config)
initialise me with the data values in this context |
|
| Method Summary | |
java.net.URL |
composeShoppingURL(java.lang.String isbn)
compose a suitable 'shopping' URL for this ISBN |
void |
drop(Context c,
java.lang.Object key)
can't do this; perhaps later could but that requires understanding Amazon's inventory system |
int |
fetch(Context context)
fetch details of the item whose ISBN/ASIN is passed as key; results return in the context |
int |
fetch(Context context,
java.lang.Object key)
fetch details of the item whose ISBN/ASIN is passed as key; results return in the context |
static void |
main(java.lang.String[] args)
Test harness only - don't expect this to be useful in practice |
Contexts |
match(Context c)
Fetch all the records from the data store described by this descriptor, which match the values contained in this context |
Contexts |
match(Context context,
boolean exact)
return all items in Amazon which match the criteria. |
static java.lang.String |
normaliseISBN(java.lang.String isbn)
Clean up this ISBN into the format that Amazon prefers - i.e. |
protected Context |
parseItemRecord(Node item)
parse an Item node returned by Amazon Web Services and return it as a context |
java.lang.Object |
store(Context c)
can't do this; perhaps later could but that requires understanding Amazon's inventory system |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String SEARCHTOKENPREFIX
public static final java.lang.String SEARCHAUTHORTOKEN
public static final java.lang.String SEARCHTITLETOKEN
public static final java.lang.String SEARCHKEYWORDSTOKEN
public static final java.lang.String SEARCHINDEXTOKEN
public static final java.lang.String DEFAULTSEARCHINDEX
public static final java.lang.String MODE_LIGHT
public static final java.lang.String MODE_HEAVY
public static final java.lang.String MODE_TOKEN
public static final java.lang.String AMAZON_HOST_TOKEN
public static final java.lang.String AMAZON_SHOP_TOKEN
public static final java.lang.String SHOPPING_URL_TOKEN
public static final java.lang.String ISBN_TOKEN
public static final java.lang.String KEYFN
public static final java.lang.String DETAILS_TAG
public static final java.lang.String ITEM_TAG
public static final java.lang.String PRODUCT_NAME_TAG
public static final java.lang.String ERROR_MSG_TAG
public static final java.lang.String ASSOCIATES_ID_TOKEN
public static final java.lang.String ACCESSKEYTOKEN
public static final java.lang.String DEBUGCONFIGTOKEN
protected java.lang.String associatesId
protected final java.lang.String developerId
protected java.lang.String accessKeyId
protected java.lang.String amazonHost
protected java.lang.String amazonShop
protected java.lang.String mode
protected boolean debug
| Constructor Detail |
public AmazonDescriptor(Context config)
throws DataStoreException
config - a context containing my configuration values| Method Detail |
public java.net.URL composeShoppingURL(java.lang.String isbn)
throws java.net.MalformedURLException
isbn - an ISBN number, not necessarily normalised
java.net.MalformedURLException
public void drop(Context c,
java.lang.Object key)
throws DataStoreException
drop in interface DataStoreDescriptorDataStoreException
public int fetch(Context context)
throws DataStoreException
context - the context in which this search is performed
DataStoreException
public int fetch(Context context,
java.lang.Object key)
throws DataStoreException
fetch in interface DataStoreDescriptorcontext - the context in which this search is performedkey - an object which when rendered as a string using toString()
is a valid ISBN or ASIN code.
DataStoreException
public static void main(java.lang.String[] args)
throws java.lang.Exception
args - only one understood - amazon_associates_id
java.lang.Exceptionpublic static java.lang.String normaliseISBN(java.lang.String isbn)
isbn - the unclean isbn
public Contexts match(Context c)
throws DataStoreException
DataStoreDescriptor
match in interface DataStoreDescriptorDataStoreException
public Contexts match(Context context,
boolean exact)
throws DataStoreException
match in interface DataStoreDescriptorcontext - the context to matchexact - whether or not an exact match is required - i.e. whether or not
to allow fuzzy matching of strings.
DataStoreException
public java.lang.Object store(Context c)
throws DataStoreException
store in interface DataStoreDescriptorDataStoreExceptionprotected Context parseItemRecord(Node item)
item - the node to parse
|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||