| Modifier and Type | Class and Description |
|---|---|
static class |
GPUdbBase.Options
A set of configurable options for the GPUdb API.
|
static class |
GPUdbBase.SubmitException
An exception that occurred during the submission of a request to GPUdb.
|
| Modifier and Type | Field and Description |
|---|---|
static long |
END_OF_SET
Constant used with certain requests to indicate that the maximum allowed
number of results should be returned.
|
| Modifier | Constructor and Description |
|---|---|
protected |
GPUdbBase(List<URL> urls,
GPUdbBase.Options options) |
protected |
GPUdbBase(String url,
GPUdbBase.Options options) |
protected |
GPUdbBase(URL url,
GPUdbBase.Options options) |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
addKnownType(String typeId,
Class<T> objectClass,
TypeObjectMap<T> typeObjectMap)
Adds a type object map for the specified class as a type descriptor for
a GPUdb type, identified by a type ID, to the known type list, and also
adds the type object map to the known type object map list.
|
void |
addKnownType(String typeId,
Object typeDescriptor)
Adds a type descriptor for a GPUdb type (excluding types of join tables),
identified by a type ID, to the known type list.
|
<T> void |
addKnownTypeFromTable(String tableName,
Class<T> objectClass,
TypeObjectMap<T> typeObjectMap)
Adds a type object map for the specified class as a type descriptor for
the GPUdb type stored in the specified table to the known type list, and
also adds the type object map to the known type object map list.
|
void |
addKnownTypeFromTable(String tableName,
Object typeDescriptor)
Adds a type descriptor for the GPUdb type stored in the specified table
to the known type list.
|
<T> void |
addKnownTypeObjectMap(Class<T> objectClass,
TypeObjectMap<T> typeObjectMap)
Adds a type object map for the specified class to the known type object
map list.
|
protected <T> List<T> |
decode(List<String> typeIds,
List<ByteBuffer> data) |
protected <T> List<T> |
decode(Object typeDescriptor,
List<ByteBuffer> data) |
protected <T> List<T> |
decode(String typeId,
List<ByteBuffer> data) |
protected <T> List<List<T>> |
decodeMultiple(List<String> typeIds,
List<List<ByteBuffer>> data) |
protected <T> List<List<T>> |
decodeMultiple(Object typeDescriptor,
List<List<ByteBuffer>> data) |
protected <T> List<ByteBuffer> |
encode(List<T> data) |
protected <T> List<ByteBuffer> |
encode(TypeObjectMap<T> typeObjectMap,
List<T> data) |
static String |
getApiVersion()
Gets the version number of the GPUdb Java API.
|
ExecutorService |
getExecutor()
Gets the
executor service used for managing
threads during data encoding and decoding operations. |
Map<String,String> |
getHttpHeaders()
Gets the map of additional HTTP headers that will be sent to GPUdb with
each request.
|
String |
getPassword()
Gets the password used for authentication to GPUdb.
|
int |
getThreadCount()
Gets the number of threads used during data encoding and decoding
operations.
|
int |
getTimeout()
Gets the timeout value, in milliseconds, after which a lack of
response from the GPUdb server will result in requests being aborted.
|
protected Object |
getTypeDescriptor(String typeId) |
protected <T> TypeObjectMap<T> |
getTypeObjectMap(Class<T> objectClass) |
URL |
getURL()
Gets the active URL of the GPUdb server.
|
List<URL> |
getURLs()
Gets the list of URLs for the GPUdb server.
|
String |
getUsername()
Gets the username used for authentication to GPUdb.
|
boolean |
getUseSnappy()
Gets the value of the flag indicating whether Snappy compression will be
used for certain GPUdb requests that potentially submit large amounts of
data.
|
static <T> List<T> |
list(T... values)
A utility method for creating a list of objects inline.
|
static Map<String,String> |
options(String... values)
A utility method for creating a map of
strings to strings} inline.
|
void |
ping()
Verifies that GPUdb is running on the server.
|
protected void |
setTypeDescriptorIfMissing(String typeId,
String label,
String typeSchema,
Map<String,List<String>> properties) |
<T extends org.apache.avro.generic.IndexedRecord> |
submitRequest(String endpoint,
org.apache.avro.generic.IndexedRecord request,
T response)
Submits an arbitrary request to GPUdb and saves the response into a
pre-created response object.
|
<T extends org.apache.avro.generic.IndexedRecord> |
submitRequest(String endpoint,
org.apache.avro.generic.IndexedRecord request,
T response,
boolean enableCompression)
Submits an arbitrary request to GPUdb and saves the response into a
pre-created response object, optionally compressing the request before
sending.
|
<T extends org.apache.avro.generic.IndexedRecord> |
submitRequest(URL url,
org.apache.avro.generic.IndexedRecord request,
T response,
boolean enableCompression)
Submits an arbitrary request to GPUdb via the specified URL and saves the
response into a pre-created response object, optionally compressing the
request before sending.
|
public static final long END_OF_SET
protected GPUdbBase(String url, GPUdbBase.Options options) throws GPUdbException
GPUdbExceptionprotected GPUdbBase(URL url, GPUdbBase.Options options) throws GPUdbException
GPUdbExceptionprotected GPUdbBase(List<URL> urls, GPUdbBase.Options options) throws GPUdbException
GPUdbExceptionpublic static String getApiVersion()
@SafeVarargs public static <T> List<T> list(T... values)
T - the type of objects in the listvalues - the objects to be added to the listpublic static Map<String,String> options(String... values)
values - an even number of string valuesIllegalArgumentException - if an odd number of values is specifiedpublic List<URL> getURLs()
getURL to determine which one), but in the event of failure, the
other URLs will be tried in order, and if a working one is found
it will become the new active URL.public URL getURL()
public String getUsername()
GPUdb constructor via GPUdbBase.Options.GPUdbBase.Options.setUsername(String)public String getPassword()
GPUdb constructor via GPUdbBase.Options.GPUdbBase.Options.setPassword(String)public boolean getUseSnappy()
false if not overridden using the GPUdb constructor via GPUdbBase.Options.GPUdbBase.Options.setUseSnappy(boolean)public int getThreadCount()
GPUdb constructor via GPUdbBase.Options.GPUdbBase.Options.setThreadCount(int)public ExecutorService getExecutor()
executor service used for managing
threads during data encoding and decoding operations. Will be
null if none was provided to the
GPUdb constructor via
GPUdbBase.Options.GPUdbBase.Options.setExecutor(ExecutorService)public Map<String,String> getHttpHeaders()
GPUdb constructor via GPUdbBase.Options.GPUdbBase.Options.addHttpHeader(String, String),
GPUdbBase.Options.setHttpHeaders(Map)public int getTimeout()
GPUdbBase.Options.setTimeout(int)public void addKnownType(String typeId, Object typeDescriptor)
typeId - the type ID of the type in GPUdb (must not be the
type of a join table)typeDescriptor - the type descriptor to be used for decoding the
typeIllegalArgumentException - if typeDescriptor is not a
Schema, Type, TypeObjectMap, or Class
that implements IndexedRecordpublic <T> void addKnownType(String typeId, Class<T> objectClass, TypeObjectMap<T> typeObjectMap)
T - the classtypeId - the type ID of the type in GPUdbobjectClass - the classtypeObjectMap - the type object map to be used for encoding and
decodingpublic void addKnownTypeFromTable(String tableName, Object typeDescriptor) throws GPUdbException
tableName - the name of the table in GPUdbtypeDescriptor - the type descriptor to be used for decoding the
typeIllegalArgumentException - if typeDescriptor is not a
Schema, Type, TypeObjectMap, or Class
that implements IndexedRecordGPUdbException - if the table does not exist or is not homogeneous,
or if an error occurs during the request for table informationpublic <T> void addKnownTypeFromTable(String tableName, Class<T> objectClass, TypeObjectMap<T> typeObjectMap) throws GPUdbException
T - the classtableName - the name of the table in GPUdbobjectClass - the classtypeObjectMap - the type object map to be used for encoding and
decodingGPUdbException - if the table does not exist or is not homogeneous,
or if an error occurs during the request for informationpublic <T> void addKnownTypeObjectMap(Class<T> objectClass, TypeObjectMap<T> typeObjectMap)
T - the classobjectClass - the classtypeObjectMap - the type object map to be used for encodingprotected <T> List<T> decode(Object typeDescriptor, List<ByteBuffer> data) throws GPUdbException
GPUdbExceptionprotected <T> List<T> decode(String typeId, List<ByteBuffer> data) throws GPUdbException
GPUdbExceptionprotected <T> List<T> decode(List<String> typeIds, List<ByteBuffer> data) throws GPUdbException
GPUdbExceptionprotected <T> List<List<T>> decodeMultiple(Object typeDescriptor, List<List<ByteBuffer>> data) throws GPUdbException
GPUdbExceptionprotected <T> List<List<T>> decodeMultiple(List<String> typeIds, List<List<ByteBuffer>> data) throws GPUdbException
GPUdbExceptionprotected <T> List<ByteBuffer> encode(List<T> data) throws GPUdbException
GPUdbExceptionprotected <T> List<ByteBuffer> encode(TypeObjectMap<T> typeObjectMap, List<T> data) throws GPUdbException
GPUdbExceptionprotected Object getTypeDescriptor(String typeId) throws GPUdbException
GPUdbExceptionprotected <T> TypeObjectMap<T> getTypeObjectMap(Class<T> objectClass) throws GPUdbException
GPUdbExceptionprotected void setTypeDescriptorIfMissing(String typeId, String label, String typeSchema, Map<String,List<String>> properties) throws GPUdbException
GPUdbExceptionpublic <T extends org.apache.avro.generic.IndexedRecord> T submitRequest(String endpoint, org.apache.avro.generic.IndexedRecord request, T response) throws GPUdbException
IndexedRecord interface.T - the type of the response objectendpoint - the GPUdb endpoint to send the request torequest - the request objectresponse - the response objectresponse parameter)GPUdbException - if an error occurs during the requestpublic <T extends org.apache.avro.generic.IndexedRecord> T submitRequest(String endpoint, org.apache.avro.generic.IndexedRecord request, T response, boolean enableCompression) throws GPUdbException
IndexedRecord interface. The request will only be compressed if
enableCompression is true and the
GPUdb constructor was
called with the Snappy compression
flag set to true.T - the type of the response objectendpoint - the GPUdb endpoint to send the request torequest - the request objectresponse - the response objectenableCompression - whether to compress the requestresponse
parameter)GPUdbException - if an error occurs during the requestpublic <T extends org.apache.avro.generic.IndexedRecord> T submitRequest(URL url, org.apache.avro.generic.IndexedRecord request, T response, boolean enableCompression) throws GPUdbException
IndexedRecord interface. The request will only be
compressed if enableCompression is true and the
GPUdb constructor was
called with the Snappy compression
flag set to true.T - the type of the response objecturl - the URL to send the request torequest - the request objectresponse - the response objectenableCompression - whether to compress the requestresponse
parameter)GPUdbException - if an error occurs while preparing the requestGPUdbBase.SubmitException - if an error occurs while submitting the requestpublic void ping()
throws GPUdbException
GPUdbException - if an error occurs and/or GPUdb is not running on
the serverCopyright © 2017. All rights reserved.