GridDB API Reference
Table of Contents
- 1 Introduction
- 2 Overview
- 3 TQL Syntax and Calculation Functions
- 4 Trigger function
- 5 API (Java)
- 6 Annex
- 7 Trademark
1 Introduction
This manual describes how to use APIs and a query language required for programming using GridDB, a large-scale distributed DB.
Java- and C-based APIs are available for management operations and basic data extractions in GridDB. You can use a dedicated query language TQL for operations with more complicated conditions.
2 Overview
2.1 Terms
Major terms are as follows:
- Node
- A server process which performs data management in GridDB.
- Row
- A piece of data managed by GridDB, which is a unit of data consisting of a key and multiple values.
- Container
- A receptacle which stores a set of Rows. Two types are available: Collection and TimeSeries.
- A Row has one field for each Column. Each field consistently has one value. NULL cannot be set as a field value.
- A Container or Column name is composed of a sequence of one or more ASCII alphanumeric characters and underscores (_). However, the first character must not be numeric. And the names are case-insensitive.
- Collection
- A type of Container storing and managing Rows. A Row can have a key and also need not have any key. A key can be assigned to a single string or integer (INTEGER or LONG type only), or time-type data.
- TimeSeries
- A type of Container storing and managing Rows with a time-type key, provided with a special function to operate time-series data. A key corresponds to the time of a time series row.
2.2 Type
This section shows the definitions of types specifying the value constraints for fields and query operations.
2.2.1 Primitive Types
Here are shown the definitions of primitive types which cannot be represented by a combination of any other types.
- Boolean type (BOOL)
Represents the values: TRUE or FALSE.
- String type (STRING)
Represents a sequence of zero or more Unicode code points (characters) excluding the NULL character (U+0000). Refer to the Annex System limiting values for the upper limit size.
- Integer type
Represents integer values as follows:- BYTE: -27 to 27-1 (8-bit)
- SHORT: -215 to -2^ {15}-1 (16-bit)
- INTEGER: -231 to -2^ {31}-1 (32-bit)
- LONG: -263 to -2^ {63}-1 (64-bit)
- Floating point type
Represents the IEEE754 floating point numbers. The following types are available depending on the precision.- FLOAT: Single-precision type (32-bit)
- DOUBLE: Double-precision type (64-bit)
※In principle, arithmetic precision conforms to the IEEE754 specifications; however, it might vary depending on the runtime environment.
- Time type (TIMESTAMP)
Represents the combination of a date consisting of year, month and day, and a time consisting of hour, minute and second. Refer to the Annex Range of values for the display range.
- BLOB type
Represents binary data, such as image and sound.Refer to the Annex System limiting values for the upper limit size.
2.2.2 Composite Types
Here are shown the definitions of types which can be represented by a combination of primitive types.
- Array types
Represent a sequence of values. The following types are availabe for array values. The length of an array indicates the number of array elements. The minimum size is 0. Refer to the Annex System limiting values for the upper limit size.
- Boolean type
- String type
- Integer Type
- Floating point type
- Time type
3 TQL Syntax and Calculation Functions
TQL supports a query corresponding to the SQL SELECT statement which is required to select data to be fetched, deleted or updated. It does not support other than a selection query, such as manipulation of selected data, management of data structure and transaction processing.
3.1 Basic Syntax
All queries are expressed by the syntax below:
[EXPLAIN [ANALYZE]] SELECT (select expression) [FROM (Collection or TimeSeries name)] [WHERE (conditional expression)] ORDER BY (Column name) [ASC|DESC] [, (Column name) [ASC|DESC]]* [LIMIT (number) [OFFSET (number)]]
A SELECT statement is used to narrow down Rows in a Collection or TimeSeries specified in the FROM clause according to the conditional expression in the WHERE clause and process the result set according to the select expression specifing target Column(s), a calculation formula, etc.
If a target Collection or TimeSeries is already specified, you need to omit the FROM clause or specify the same name as the target in the FROM clause. You should note that the FROM clause is case-insensitive. If the WHERE clause is omitted, all the Rows of a target Collection or TimeSeries are selected.
You can place EXPLAIN or EXPLAIN ANALYZE before a SELECT statement to obtain execution plan information and analysis information on execution results in relation to the SELECT statement. See the later section for more information.
Unlike SQL, you cannot extract only specific Column(s) except for aggregation operations. Additionally, clauses corresponding to the following are not available.
- GROUP BY
- HAVING
- DISTINCT
- FOR UPDATE ※can be carried out with the API
- JOIN
ASCII characters in the keywords of the basic syntax and the names of functions, operators and enumeration constants described in the later sections can be written in lower case.
3.2 Syntax of Conditional Expressions and Calculation Functions
This section shows the definitions of the syntax of conditional expressions used in the WHERE clause and the operators and functions available in a conditional expression.
3.2.1 Values
A value can be either a constant literal or a field of a specified Column in a Row under operation.
- Literal values
A literal value can be either of the following:- Numeric type: A character string of decimal numbers. The notation of floating point numbers conforms to IEEE754. A double-type non-number, positive infinity and negative infinity are written as NaN, INF and -INF, respectively.
- String type: A character string enclosed in single quotation marks. In order to represent a single quotation mark within a character string, use two single quotation marks (the first single quotation mark is an escape character for the second). You cannot use a single quotation mark for any other purposes.
- Field values
To specify a field value held by a row under evaluation, either describe directly the corresponding column name or describe the column name enclosed within quotation marks “"”. Describe a column name enclosed within quotation marks “"”. By enclosing within quotation marks, columns with the same name as key words such as “SELECT” and “WHERE” can also be handled. You should note that Column names are case-insensitive. Additionally, you cannot join a Column name and a Collection or TimeSeries name by "." etc.
3.2.2 Precedence of Operators
Operators are evaluated in the order below: Operators with equal precedence are evaluated in the left-to-right order in which they appear.
- -(Unary)
- *, /, %
- -(Binary), +
- =, >=, >, <=, <, <>, LIKE
- NOT
- AND
- OR, XOR
Round parentheses can be used to override the order of precedence and force some parts of an expression to be evaluated before others.
3.2.3 Comparison Operations
- Type Constraints
A combination of left and right operand types can be only Boolean-Boolean, String-String, numeric-numeric, or time-time. With regard to numeric types, if left and right operand types are different in precision, the type with a lower presicion or a narrower representable value range will be converted to the one with a higher precision or a wider range. Magnitude comparison cannot be made between Boolean and Boolean types or String and String types.
- =, >=, >, <=, <, <>
These operators produce a Boolean value representing the result of comparison; namely, "Equal to," "Greater than or equal to," "Greater than," "Less than or equal to," "Less than" and "Not equal to," respectively. In principle, arithmetic precision conforms to the IEEE754 specifications; however, it might vary depending on the runtime environment. GridDB assumes that NaN is equal to NaN and that NaN is greater than any other values.
3.2.4 Logical Operations
- NOT, AND, OR, XOR
These operators produce the result of negation, logical product, logical sum and exclusive logical sum, respectively. Operands of logical operations must be Boolean. In addition, a short evaluation (or minimum evaluation) is carried out in an AND or OR operation. That is, if the evaluation can be confirmed with the formula described first, the evaluation of the formula described later will not be conducted. For example,WHERE A=1 AND B=1
In this case, if A is 1, then B is deemed to be equal to 1, and if A is not 1, then the evaluation of B=1 need not be carried out.
3.2.5 String Operations
- CHAR_LENGTH(str)
Returns the length of the specified string.
- CONCAT(str1, str2, …)
Returns a new string obtained by concatenating all given strings.
- str LIKE pattern [ESCAPE esc]
Checks if the whole target string matches the specified pattern. The string matching is case-sensitive. It returns TRUE only if the matching is successful.The following wildcards can be used for specifying a pattern.
- %: Matches an arbitrary string, including an empty string.
- _: Matches a single arbitrary character.
For example, the expression below returns TRUE for "RDB" and "RDBMS" but FALSE for "ORDB" and "DBMS".
column LIKE '_DB%'
Wildcards can be placed at any arbitrary position(s) within a pattern. FALSE is always returned if an empty string is specified as a pattern.
In order to search a wildcard character itself, specify an escape character in the ESCAPE clause. For example, the expression below returns TRUE for "10%" but FALSE for "10$%."
column LIKE '10$%' ESCAPE '$'
The escape character must be a single character.
You can specify either a Column name or a string literal as "str," "pattern" and "esc."
- SUBSTRING(str, start[, length])
Extracts parts of a string."start" is the position where to start extraction of characters. The first character is at index 1. "length" is the number of characters to extract (0 or positive number). If "length" is omitted, it extracts all the characters from the "start" position to the end of the string. If "start" or "length" is out of index, it returns an empty string. You should note that "start" must be a positive number and "length" must be 0 or a positive numer.
- UPPER(str), LOWER(str)
Convert ASCII alphabetical characters within a string to upper-case and lower-case characters, respectively.
3.2.6 Numerical Operations
- +, -(unary), -(binary), *, /, %
Perform arithmetic operations; addition, negation, subtraction, multiplication, division and remainder, respectively. You should note that the remainder operator does not support floating point numbers. In floating point division, if a number other than 0 is divided by 0, the result is INF, and if 0 is divided by 0, the result is NaN. The operations on INF or NaN conform to IEEE754.
- ROUND(num)、FLOOR(num)、CEILING(num)
Round a floating point number "num" off to the closest integer, down to the greatest integer that is less than "num," and up to the least integer that is greater than or equal to "num," respectively. The result is DOUBLE. They round a number away from 0, toward negative infinity, and toward positive infinity, respectively. Accordingly, if "num" is negative, the results are equal to -ROUND(abs(num)), -CEIL(abs(num)), and -FLOOR(abs(num)), respectively, where abs(num) is the absolute value of "num."The table below shows operation examples.
Value ROUND FLOOR CEILING 1.34 1.0 1.0 2.0 3.67 4.0 3.0 4.0 -0.23 0.0 -1.0 -0.0 -3.89 -4.0 -4.0 -3.0 If you specify +0, -0, an integer, NaN, INF, or -INF as a parameter, they return the same value as the specified value.
3.2.7 Time-Type Operations
- NOW()
Retuns the current date and time. It returns the constant result during a single query transaction.
- TIMESTAMP(str)
Returns a TIMESTAMP result converted from a timestamp expression.The following format based on the Western calendar and UTC is only supported as a timestamp expression.
YYYY-MM-DDThh:mm:ss.SSSZ
".SSS" can be omitted. In the format above, alphabetical characters stand for decimal integers, as follows:
- YYYY: YYYY: Year. Four digits or more.
- MM: Month. Must be two digits, from 1 to 12.
- DD: Date. Must be two digits, from 1 to 31. If any other number is specified, it will not be accepted. Acceptable numbers depend on the month and the year.
- hh: Hours in 24-hour format. Must be two digits, from 0 to 23.
- mm: Minutes. Must be two digits, from 0 to 59.
- ss: Seconds. Must be two digits, from 0 to 59.
- SSS: Milliseconds. Must be three digits, from 0 to 999.
Refer to the Annex Range of values for the display range.
- TIMESTAMPADD(YEAR|MONTH|DAY|HOUR|MINUTE|SECOND|MILLISECOND, timestamp, duration)
Returns the result of adding the specified number ("duration") of designated intervals (first parameter) to the specified "timestamp" value. Specify a numeric value as "duration." If a negative value is specified as "duration," it returns the time earlier than the specified time. The current version uses the UTC timezone for calculation.
- TIMESTAMPDIFF(YEAR|MONTH|DAY|HOUR|MINUTE|SECOND|MILLISECOND, timestamp1, timestamp2)
Return the difference between two given timestamps for the designate interval (first parameter). The value returned is a numeric value. The current version uses the UTC timezone for calculation.Example) Selecting tickets with three or more days of validity period among a list of tickets (tickets).
SELECT * FROM tickets WHERE TIMESTAMPDIFF(DAY, expired, issued) >= 3
- TO_TIMESTAMP_MS(num)
Convert to a TIMESTAMP corresponding to the num in milliseconds of the time 1970-01-01T00:00:00Z. An error occurs if num is a floating-point number. In addition, an error occurs if the conversion results cannot be expressed as time data e.g. negative values or extremely large values, etc. As a result, if a query using this function on a numerical column is issued, an error occurs if the conversion results contain values that cannot be expressed as time data in the column value. For example, an error occurs if the container contains a row with a num=-1 in the query below.SELECT * WHERE TO_TIMESTAMP_MS(num) > TIMESTAMP('2011-01-01T00:00:00Z')
In such a situation, avoid such errors by using the TO_EPOCH_MS function as shown below to evaluate only the value in which the converted numerical data serves as the range of the time series data.
SELECT * WHERE num < TO_EPOCH_MS(TIMESTAMP('9999-12-31T23:59:59.999Z')) AND num >= 0 AND TO_TIMESTAMP_MS(num) > TIMESTAMP('2011-01-01T00:00:00Z')
- TO_EPOCH_MS(timestamp)
For time series value specified in a timestamp, the time passed in milliseconds starting from the time 1970-01-01T00:00:00Z is converted to a LONG value. An error occurs if a value which is not a time series data is specified. This function is the inverted conversion of the TO_TIMESTAMP_MS function.
3.2.8 Array-Type Operations
- ARRAY_LENGTH(array)
Returns the length of the specified array.
- ELEMENT(n, array)
Extracts an array element at the specified position. An array of length 1 or more must be specified. The parameter "n" is the number indicating the element position, starting from 0. If "n" is Floating point type or a negative value or longer than the length of "array," or if the length of "array" is 0, an error is returned. Accordingly, if different lengths of arrays are contained in a Collection, and if a query specifying an array element as below cannot extract the specified array element, an error can be returned.SELECT * FROM arrays WHERE ELEMENT(1, array) = 1
Rewrite such a query to prevent the ELEMENT function from being evaluated, as below:
SELECT * FROM arrays WHERE ARRAY_LENGTH(array)>= 1 AND ELEMENT(1, array) = 1
3.3 Selection Expressions
3.3.1 Basic Syntax
This section defines the selection expressions to specify target Column(s), a calculation formula, etc. Only the Rows satisfying the conditions specified in the FROM and WHERE clauses are to be processed.
- *
Selects all the Rows satisfying the specified condition(s). By designating a ORDER BY section (to be described later), the data can be sorted by column value.
- (Operation function)
Any one of operation functions described in the following sections is available for aggregation, selection and other operations. If an overflow occurs in an internal operation, -INF or INF is returned for floating point operation, and the value "undefined" is returned for integer operation. And if NaN is given as an operand for floating-point operation, NaN is returned.
3.3.2 Aggregation Operations - General
Here are described the aggregation operations which can be applied to a set of any Rows.
If no target field is found, the number of results returned is 0, except for the functions COUNT and SUM shown below. Otherwise, the number of results returned is always 1.
- MAX(column)
Returns the largest value in the specified Column. Only a numeric or time-type Column can be specified. The type of a returned value is the same as that of the specified Column.
- MIN(column)
Returns the smallest value in the specified Column. Only a numeric or time-type Column can be specified. The type of a returned value is the same as that of the specified Column.
- COUNT(*)
Return the number of Rows satisfying a given condition(s). A Column cannot be specified. The type of a returned value is always If there is not a single row that can serve as a LONG. target, the value of the operation result is 0.
- SUM(column)
Return the sum of values in the specified Column. Only a numeric-type Column can be specified. The type of a returned value is LONG if the specified Column is of integer type, and DOUBLE if it is of floating-point type.
- AVG(column)
Returns the average value of the specified Column. Only a numeric-type Column can be specified. The type of a returned value is always DOUBLE.
- VARIANCE(column)
Returns the variance of values in the specified Column. Only a numeric-type Column can be specified. The type of a returned value is always DOUBLE.
- STDDEV(column)
Returns the standard deviation of values in the specified Column. Only a numeric-type Column can be specified. The type of a returned value is always DOUBLE.
3.3.3 Aggregation Operations - Time Series
Here are described the aggregation operations which can be applied to a set of Rows in a TimeSeries.
In aggregation operation weighted by a time-type key, for each Row satisfying a condition, a weighted value is obtained by calculating half the time span between the adjacent Rows before and after the Row in terms of seconds. However, if a Row has only one adjacent Row, the time span from the adjacent Row is considered, and if no adjacent Rows exist, 1 (sec.) is used as a weighted value.
- TIME_AVG(column)
Returns the average weighted by a time-type key of values in the specified Column. The type of a returned value is always DOUBLE.The weighted average is calculated by dividing the sum of products of sample values and their respective weighted values by the sum of weighted values. Only a numeric-type Column can be specified. The method for calculating a weighted value is as shown above.
Example) Obtaining the time-weighted average voltage at Point 103, plant1 in July 2011.
SELECT TIME_AVG(voltage103) FROM plant1 WHERE TIMESTAMP('2011-07-01T00:00:00Z') <= timestamp AND timestamp < TIMESTAMP('2011-08-01T00:00:00Z')
Here, you can see an example of the procedure for calculating a weighted average for the TimeSeries below.
Key (seconds from 00:00:00 on July 1, 2011) Colum to be aggregated 0 sec. 4 10 sec. 3 20 sec. 2 40 sec. 1 This TimeSeries is extended as shown in the table below; starting from the left, a midpoint time between adjacent Row values, a weighted value, and a product of a sample value (a Column value) and the weighted value are calculated.
Key Column to be aggregated Midpoint (seconds) Time span from (previous) midpoint Time span from (following) midpoint Weighted value Product of sample and weighted values 0 sec. 4 - - 5 (=5-0) 5 20 (=4*5) (Midpoint) - 5 sec.(=(0+10)/2) - - - - 10 sec. 3 - 5 (=10-5) 5 (=15-10) 10 (=5+5) 30 (=3*10) (Midpoint) - 15 sec.(=(10+20)/2) - - - - 20 sec. 2 - 5 (=20-15) 10 (=30-20) 15 (=5+10) 30 (=2*15) (Midpoint) - 30 sec.(=(20+40)/2) - - - - 40 sec. 1 - 10 (=40-30) - 10 10 (=1*10) Finally, all the products of sample values and their respective weighted values and all the weighted values are added up respectively, and then the quotient of both the sums is calculated. In the case of this TimeSeries, it is calculated as: (20+30+30+10)/(5+10+15+10) =90/40=2.25. This procedure is not necessarily the same as that for internal operations in GridDB.
The normal unweighted average is calculated as: (4+3+2+1)/4=10/4=2.5.
3.3.4 Selection and Interpolation Operations on Time-Series Data
- TIME_NEXT(*, timestamp)
Selects a time-series Row whose timestamp is identical with or just after the specified timestamp.Example) Obtaining the temperature at plant1 at the beginning of July 2011.
SELECT TIME_NEXT(*, TIMESTAMP('2011-07-01T00:00:00Z')) FROM plant1
- TIME_NEXT_ONLY(*, timestamp)
Select a time-series Row whose timestamp is just after the specified timestamp.
- TIME_PREV(*, timestamp)
Selects a time-series Row whose timestamp is identical with or just before the specified timestamp.
- TIME_PREV_ONLY(*, timestamp)
Selects a time-series Row whose timestamp is just before the specified timestamp.
- TIME_INTERPOLATED(column, timestamp)
Returns a specified Column value of the time-series Row whose timestamp is identical with the specified timestamp, or a value obtained by linearly interpolating specified Column values of adjacent Rows whose timestamps are just before and after the specified timestamp, respectively. If no Row with the same timestamp nor no Row with an earlier or later timestamp is found, an intended Row is not generated and the number of Rows returned is 0. Only a numeric-type Column can be specified. The field values of the Row with the latest timestamp among those with the timestamp identical with or earlier than the specified timestamp are set on the specified Column and the fields other than a key.
- TIME_SAMPLING(*|column, timestamp_start, timestamp_end, interval, DAY|HOUR|MINUTE|SECOND|MILLISECOND)
Takes a sampling of Rows in a specific range from a given start time to a given end time. Each sampling time point is defined by adding a sampling interval multiplied by a non-negative integer to the start time, excluding the time points later than the end time.If there is a Row whose timestamp is identical with each sampling time point, the values of the Row are used. Otherwise, interpolated values are used. Row field values in the specified Column to be interpolated are obtained by linearly interpolating the values of the Rows just before and after a sampling time point. For other fields, the values of the Row with the latest timestamp among those with earlier timestamps than a sampling time point are used as interpolated values. Columns to be linearly interpolated must be of numeric type. If "*" is specified instead of a specific Column name, the latter method of interpolation is applied to all field.
If there is no Rows to be referenced for interpolation at a specific sampling time point, a corresponding Row is not generated, and thus the number of results returned is reduced by the number of such time points. A shorter sampling interval increases the likelihood that identical Row field values will be used for the Colums with no need for linear interpolation even at different sampling time points. The sampling interval parameter "interval" must be a positive value.
Example) Obtaining hourly voltage information at Point 103, plant1 on July 1, 2011.
SELECT TIME_SAMPLING( voltage103, TIMESTAMP('2011-07-01T00:00:00Z'), TIMESTAMP('2011-07-02T00:00:00Z'), 1, HOUR) FROM plant1
In addition, regarding this sampling result, the ORDER BY section (to be described later) can be described and sorted in column sequence. Example) Determine the hourly voltage at Plant 1, Point 103 on July 1, 2011 and sort the data in voltage sequence.
SELECT TIME_SAMPLING( voltage103, TIMESTAMP('2011-07-01T00:00:00Z'), TIMESTAMP('2011-07-02T00:00:00Z'), 1, HOUR) FROM plant1 ORDER BY voltage103
3.3.5 Row group selection operation with the maximum value/minimum value
Return any row group that has either the maximum or minimum specified column value.
- MAX_ROWS(column)
Find the row group with the maximum specified column value. Only numerical or time series columns can be specified.
- MIN_ROWS(column)
Find the row group with the minimum specified column value. Only numerical or time series columns can be specified.
3.4 Sorting of search results (ORDER BY)
The sorting sequence of the search results can be specified by the description in the ORDER BY section. The description in the ORDER BY section is defined as follows.
ORDER BY (Column name) [ASC|DESC] [, (Column name) [ASC|DESC]]*
However, an '*' means that the previous component is repeated 0 or more times.
ASC means to sort in ascending order and DES means to sort in descending order. If the sorting sequence is not specified, it will remain as ascendant. If multiple sorting conditions are specified, the results will be sorted in order starting from the top-most condition.
Example) Conduct a search with a in descending order as the first sorting condition, b in ascending order as the second sorting condition, and c in ascending order as the third sorting condition.
SELECT * ORDER BY a DESC, b ASC, c
Unlike SQL, functions and formulas cannot be specified in the sorting conditions.
3.5 Number of search results found, relative position specification (LIMIT, OFFSET)
The number of search results found can be limited by the description stated in the LIMIT section. In addition, the start position for locating the search results can be specified by the OFFSET. The syntax of the LIMIT and OFFSET specifications are defined as follows.
LIMIT (number) [OFFSET (number)]
OFFSET is always used together with LIMIT. If omitted, the meaning is the same as OFFSET 0. Negative values and floating point decimals cannot be specified for the LIMIT and OFFSET figures.
Formulas and functions cannot be specified for the LIMIT and OFFSET figures.
3.6 Obtaining Execution Plans and Analyzing Execution Results
You can obtain execution plan information and analysis information on execution results by adding EXPLAIN or EXPLAIN ANALYZE before a SELECT statement.
A obtained result set is composed of an array of entries with the same structure as a Row. The table below shows the elements of an entry.
Name | Type | Description |
---|---|---|
ID | INTEGER | An ID indicating the position of an entry in an array of entries. |
DEPTH | INTEGER | Indicates a depth for representing the relation with other entries. If there is found an entry whose depth is smaller than that of a target entry by one, through checking entries one by one whose IDs are smaller than that of the target entry, it means that the target entry describes the content of the found entry in more detail. |
TYPE | STRING | Indicates classification of information indicated by an entry; namely, classification of analysis results, such as execution time, classification of components of a query plan, etc. |
VALUE_TYPE | STRING | Indicates the type of a value assigned to the information indicated by an entry. The type of a value assigned to execution time or other analysis results, for example, is returned. Type names are the same as the primitive types defined in TQL. An empty string is set if no value is assigned. |
VALUE | STRING | Indicates a character string representing a value assigned to the information indicated by an entry.An empty string is set as VALUE if no value is assigned. |
STATEMENT | STRING | Returns a part of a TQL statement corresponding to the information indicated by an entry. An empty string is set if no correspondence is found. |
3.6.1 EXPLAIN
EXPLAIN is placed before a SELECT statement to obtain execution plan information about the SELECT statement. The SELECT statement itself will not be executed.
Even a single identical query might return different results depending on the indexing settings or other conditions.
3.6.2 EXPLAIN ANALYZE
EXPLAIN ANALYZE is placed before a SELECT statement to execute the SELECT statement and obtain analysis information, such as execution time, as well as obtain execution plan information about the SELECT statement.
4 Trigger function
When an update operation (row registration/update, deletion) is carried out on a container with a set trigger, a notification can be sent using the Java Messaging Service (JMS) or REST. The former is known as a JMS notification while the latter is known as a REST notification.
4.1 Functional overview
- API operations
- The 3 functions that can be carried out with the API are trigger setting, trigger release, and get trigger information.
- Notification timing
- A notification is sent when a new row is created, updated or deleted.
- The system will not wait for the replication to end first. In addition, if the mode is not the auto commit mode, a notification is sent in a non-committed state.
- Notification contents
- The container name and type of operation (creation of a new row or update and deletion) are notified.
- If a column subject to notification is specified, the value of the specified column of the row operated on is also notified together.
- Processing when an error occurs
- Error information is recorded in the event log when an error occurs during notification. The information will not be sent again.
- Others
- When multiple rows are newly created or updated together, notification is carried out on an individual row basis. This operation corresponds to invoking a Container#put(java.util.Collection) or GridStore#multiPut(Map) in the case of a Java API.
- If the schema of a container with a set trigger is changed, the trigger will be inherited by the container after the change but columns not included in the schema after the change are automatically deleted from the group of column names subject to notification.
- Although it is possible to set both the JMS notification and REST notification for the same container, the trigger name needs to be set separately.
4.2 API overview
- Trigger setting
- void Container#createTrigger(TriggerInfo info)
- Set the trigger in the container.
- Settings that are common to both JMS notifications and REST notifications include the trigger name, notification method, operation subject to monitoring (creation of a new row or update and deletion), column subject to notification, and notification destination URI. In addition, settings that are used only in JMS notifications include the destination name, user name, and password. These information are set via TriggerInfo objects.
- The trigger name must be unique for each container.
- If a trigger name that has already been set is specified and set, the setting will be overwritten.
- The validity of the notification destination URI, destination name, user name and password are not checked during trigger setting.
- About JMS notifications
- If the user name and password have not been set yet, the user name and password will not be used in the connection.
- The notification mode shall be Session#AUTO_ACKNOWLEDGE while the distribution mode shall be DeliveryMode#PERSISTENT.
JMS notification | REST notification | |
---|---|---|
Trigger name | ✓ | ✓ |
Notification method | ✓ | ✓ |
Update operation subject to monitoring | ✓ | ✓ |
Notification target column | ✓ | ✓ |
Notification destination URL | ✓ | ✓ |
Destination type | ✓ | |
Destination name | ✓ | |
User name | ✓ | |
Password | ✓ |
- Trigger release
- void Container#dropTrigger(String name)
- Release the trigger set in the container.
- Get trigger information
- List<TriggerInfo> ContainerInfo#getTriggerInfoList()
- Get the setting information of the trigger. The ContainerInfo object obtained by executing getContainerInfo() on a Container object is used.
4.3 Message format
- JMS notification
- Transmitting end
- The container name, type of update operation, and row data are set in the properties. No settings will be made in the body.
- Receiving end
- The message type and schema of the row data are assumed to be known.
- Get notification contents using a JMS TextMessage. A list of the property names can be obtained with TextMessage#getPropetyNames().
- Container name
- Property name is @container. Append a @ in front of the destination so as not to duplicate the column name of the row data.
- Get the property name with TextMessage#getStringProperty(). Example: getStringProperty("@container")
- Type of update operation
- Property name is @event. Append a @ in front of the destination so as not to duplicate the column name of the row data. There are 2 types of update operation, "put" and "delete".
- Get the property name with TextMessage#getStringProperty(). Example: getStringProperty("@event")
- Row data
- Boolean datatype, integer datatype and floating point decimal datatype is acquired with a TextMessage#getXXXProperty() corresponding to the datatype. Example: FLOAT-type getFloatProperty ("column name")
- Set the value converted to the time lapsed (LONG-type data) starting from the time 1970-01-01T00:00:00Z for the time-based data. As a result, return the value acquired by TextMessage#getLongProperty() to the time datatype value at the receiving end.
- BLOB datatype and array datatype are acquired with a TextMessage#getStringProperty(). In order to set a blank character string at the transmitting end, make sure the character string is blank.
- Transmitting end
- REST notification
- Transmitting end
- The JSON character string below is set and posted to the body of the HTTP request.
- The value of the "row" is set only for the specified column subject to notification. If it is not specified, the "row" itself will not be set.
- The value of each column in a "row" shall be as follows.
- Boolean datatype: "true" or "false"
- Integer datatype, time datatype: integer
- Floating point decimal datatype: floating point decimal
- Character string datatype: character string
- BLOB datatype and array datatype: blank character string
- Transmitting end
*JSON character string { "container":"(container name)", "event":"(type of update operation)", "row":{ "(column name 0)":"(value of column name 0)", "(column name 1)":"(value of column name 1)", "(column name 2)":"(value of column name 2)", ... } }
4.4 Precautions
- Precautions regarding the trigger setting and update performance
- The update performance drops depending on the number of containers whose triggers are going to be discharged and the number of triggers to discharge. Assign the minimum number of triggers to only containers which require a trigger.
- Precautions regarding the processing performance of the trigger notification destination server
- If the throughput of the notification destination server is very much lower compared to the throughput of the update process in GridDB, trigger processing may fail and an error message may be recorded in the event log. When updating a container with a set trigger at a high frequency, check and adjust the performance of the notification destination server as well.
5 API (Java)
5.1 API List (Java)
-
Interface Summary Interface Description AggregationResult Stores the result of an aggregation operation.Collection<K,R> A general-purpose Container for managing a set of Rows.Container<K,R> Provides the functions of managing the components of GridDB, each consisting of a set of Rows of a single type.GridStore A function is provided for processing the data in the connected GridDB system.PartitionController Controller for acquiring and processing the partition status.Query<R> Provides the functions of holding the information about a query related to a specificContainer
, specifying the options for fetching and retrieving the result.Row A general-purpose Row for managing fields in any schema.RowSet<R> Manages a set of Rows obtained by executing a query.TimeSeries<R> A specialized Container with a time-type Row key for TimeSeries data operation. -
Class Summary Class Description ColumnInfo Represents the information about the schema of a Column.ContainerInfo Represents the information about a specific Container.Geometry Not supportedGridStoreFactory Manages aGridStore
instance.QueryAnalysisEntry Represents one of information entries composing a query plan and the results of analyzing a query operation.RowKeyPredicate<K> Represents the condition that aRowKey
satisfies.TimeSeriesProperties Represents the information about optional configuration settings used for newly creating or updating a TimeSeries.TimestampUtils Provides the utilities for manipulating time data.TriggerInfo Represent the trigger information for monitoring the Container update. -
Enum Summary Enum Description Aggregation Represents the methods of aggregation operation on a set of Rows or their specific Columns.CompressionMethod Not supportedContainerType Represents the type(s) of a Container.FetchOption The options for fetching the result of a query.GeometryOperator Not supportedGSType Represents the type(s) of field values in GridDB.IndexType Represents the type(s) of indexes set on aContainer
.InterpolationMode Represents the type of interpolation of Rows.QueryOrder Represents the order of Rows requested by a query.TimeOperator Represents how to specify a Row based on a key timestamp ofTimeSeries
.TimeUnit Represents the time unit(s) used in TimeSeries data operation.TriggerInfo.EventType Represent the update operation type subject to monitoring by the trigger.TriggerInfo.Type Represent the trigger type. -
Exception Summary Exception Description GSException Represents the exceptions occurring during a process of a GridDB function.GSTimeoutException Represents the exceptions indicating that the requested operation operation did not finish within a nomal time. -
Annotation Types Summary Annotation Type Description RowField Sets options for mapping Row fields of aContainer
.RowKey Indicates the correspondence with a key ofContainer
.TransientRowField Specifies a Row field not to be mapped in operations on aContainer
.
Package com.toshiba.mwcloud.gs Description
- java.lang.Object
-
- java.lang.Enum<Aggregation>
-
- com.toshiba.mwcloud.gs.Aggregation
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<Aggregation>
public enum Aggregation extends java.lang.Enum<Aggregation>
Represents the methods of aggregation operation on a set of Rows or their specific Columns.Available only to
TimeSeries
in the current version.In a weighted operation, a weighted value is determined based on a key value. In a weighted operation on a
TimeSeries
, a weighted value is obtained by calculating half the time span between the adjacent Rows before and after a Row in terms of the specific unit. However, if a Row has only one adjacent Row, the time span from the adjacent Row is considered, and if no adjacent Rows exist, 1 (sec.) is used as a weighted value.If an overflow occurs in an internal operation, -INF or INF is returned for floating point operation, and the value "undefined" is returned for integer operation. And if NaN is given as an operand for floating-point operation, NaN is returned.
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description AVERAGE
An operation to obtain an average.COUNT
An operation to obtain the number of samples, i.e., the number of Rows.MAXIMUM
An operation to obtain a maximum value.MINIMUM
An operation to obtain a minimum value.STANDARD_DEVIATION
An operation to obtain a standard deviation.TOTAL
An operation to obtain a sum total.VARIANCE
An operation to obtain a variance.WEIGHTED_AVERAGE
An operation to obtain a weighted average.
-
Method Summary
Methods Modifier and Type Method and Description static Aggregation
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Aggregation[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
AVERAGE
public static final Aggregation AVERAGE
An operation to obtain an average.Available only to numeric-type Columns. The type of a returned value is always DOUBLE. If no target Row exists, the aggregation result will not be stored in a result object.
-
COUNT
public static final Aggregation COUNT
An operation to obtain the number of samples, i.e., the number of Rows.Available to any kinds of Columns. The type of a returned value is always LONG. If no target Row exists, the aggregation result will not be stored in a result object.
-
MAXIMUM
public static final Aggregation MAXIMUM
An operation to obtain a maximum value.Available only to Columns of numeric and time types allowing magnitude comparison. The type of a returned value is the same as that of a specified Column. If no target Row exists, the aggregation result will not be stored in a result object.
-
MINIMUM
public static final Aggregation MINIMUM
An operation to obtain a minimum value.Available only to Columns of numeric and time types allowing magnitude comparison. The type of a returned value is the same as that of a specified Column. If no target Row exists, the aggregation result will not be stored in a result object.
-
STANDARD_DEVIATION
public static final Aggregation STANDARD_DEVIATION
An operation to obtain a standard deviation.Available only to numeric-type Columns. The type of a returned value is always DOUBLE. If no target Row exists, the aggregation result will not be stored in a result object.
-
TOTAL
public static final Aggregation TOTAL
An operation to obtain a sum total.Available only to numeric-type Columns. The type of a returned value is LONG if a specified Column is of integer type, and DOUBLE if it is of floating-point type. If no target Row exists, the aggregation result will not be stored in a result object.
-
VARIANCE
public static final Aggregation VARIANCE
An operation to obtain a variance.Available only to numeric-type Columns. The type of a returned value is always DOUBLE. If no target Row exists, the aggregation result will not be stored in a result object.
-
WEIGHTED_AVERAGE
public static final Aggregation WEIGHTED_AVERAGE
An operation to obtain a weighted average.The weighted average is calculated by dividing the sum of products of sample values and their respective weighted values by the sum of weighted values. For the method of calculating a weighted value, see the description of
Aggregation
.This operation is only available to numeric-type Columns. The type of a returned value is always DOUBLE. If no target Row exists, the aggregation result will not be stored in a result object.
-
-
Method Detail
-
valueOf
public static Aggregation valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static Aggregation[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Aggregation c : Aggregation.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
-
public interface AggregationResult
Stores the result of an aggregation operation.Stores the result returned by an aggregation Query or
TimeSeries.aggregate(Date, Date, String, Aggregation)
. A floating-point-type result can be obtained from an operation on a numeric-type Column, and a higher-precision result can be obtained from an operation on a numeric-type Column with a small number of significant digits.The type of the stored result depends on the type of aggregation operation and the type of the target Columns. For specific rules, see
Aggregation
or the TQL specifications.The type of obtaining value depends on the stored type. DOUBLE type and LONG type are only available when a result is of numeric type, and TIMESTAMP type when a result is of TIMESTAMP type.
-
-
Method Summary
Methods Modifier and Type Method and Description java.lang.Double
getDouble()
Obtains the result of aggregating numeric-type values in DOUBLE type (Double
).java.lang.Long
getLong()
Obtains the result of aggregating numeric-type values in LONG type (Long
).java.util.Date
getTimestamp()
Obtains the result of aggregating time-type values in TIMESTAMP type (Date
).
-
-
-
Method Detail
-
getDouble
java.lang.Double getDouble()
Obtains the result of aggregating numeric-type values in DOUBLE type (Double
).It returns
null
if a result is not of numeric type. If a result is not of DOUBLE type, it returns the value converted to DOUBLE.- Returns:
- Result of aggregating DOUBLE type (
Double
). If the type of result is different, returnsnull
.
-
getLong
java.lang.Long getLong()
Obtains the result of aggregating numeric-type values in LONG type (Long
).It returns
null
if a result is not of numeric type. If a result is not of LONG type, it returns the value converted to LONG.- Returns:
- Result of aggregating LONG type (
Long
). If the type of result is different, returnsnull
.
-
getTimestamp
java.util.Date getTimestamp()
Obtains the result of aggregating time-type values in TIMESTAMP type (Date
).It returns
null
if a result is not of TIMESTAMP type.- Returns:
- Result of aggregating TIMESTAMP type (
Date
). If the type of result is different, returnsnull
.
-
-
-
- All Superinterfaces:
- java.lang.AutoCloseable, java.io.Closeable, Container<K,R>
public interface Collection<K,R> extends Container<K,R>
A general-purpose Container for managing a set of Rows.The following types are available as a Row key.
- String type (
String
) - INTEGER type (
Integer
) - LONG type (
Long
) - TIMESTAMP type (
Date
)
There is no Container-specific constraint on Row operations.
A set of Rows retuned by
Container.query(String)
orGridStore.multiGet(java.util.Map)
etc. in no particular order, when order is not specified.The granularity of locking is a Row.
-
-
Method Summary
Methods Modifier and Type Method and Description Query<R>
query(java.lang.String column, Geometry geometryIntersection, Geometry geometryDisjoint)
Not supportedQuery<R>
query(java.lang.String column, Geometry geometry, GeometryOperator geometryOp)
Not supported-
Methods inherited from interface com.toshiba.mwcloud.gs.Container
abort, close, commit, createBlob, createIndex, createIndex, createRow, createTrigger, dropIndex, dropIndex, dropTrigger, flush, get, get, getType, put, put, put, query, query, remove, setAutoCommit
-
-
-
-
Method Detail
-
query
Query<R> query(java.lang.String column, Geometry geometryIntersection, Geometry geometryDisjoint) throws GSException
Not supported- Throws:
GSException
-
query
Query<R> query(java.lang.String column, Geometry geometry, GeometryOperator geometryOp) throws GSException
Not supported- Throws:
GSException
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.ColumnInfo
-
public class ColumnInfo extends java.lang.Object
Represents the information about the schema of a Column.It does not guarantee the validity of values e.g. the Column name and the type of index for the type of a Column.
-
-
Constructor Summary
Constructors Constructor and Description ColumnInfo(java.lang.String name, GSType type)
Creates the information with the specified Column name and type of Column.ColumnInfo(java.lang.String name, GSType type, java.util.Set<IndexType> indexTypes)
Creates the information with the specified Column name and type of Column and set of Index type.
-
Method Summary
Methods Modifier and Type Method and Description java.util.Set<IndexType>
getIndexTypes()
Returns all of set of index type.java.lang.String
getName()
Returns a name of Column.GSType
getType()
Returns the type of a Column, i.e., the type of each field value corresponding to a Column.
-
-
-
Constructor Detail
-
ColumnInfo
public ColumnInfo(java.lang.String name, GSType type)
Creates the information with the specified Column name and type of Column.- Parameters:
name
- Column name.null
indicates no specification of Column name.type
- Column type.null
indicates no specification of Column type.
-
ColumnInfo
public ColumnInfo(java.lang.String name, GSType type, java.util.Set<IndexType> indexTypes)
Creates the information with the specified Column name and type of Column and set of Index type.Creates a copy of a specified non-empty set of Index type copied.
- Parameters:
name
- Column name.null
indicates no specification of Column name.type
- Column type.null
indicates no specification of Column type.indexTypes
- Set of index type.null
indicates no specification. No index type is set if it is an empty set.
-
-
Method Detail
-
getIndexTypes
public java.util.Set<IndexType> getIndexTypes()
Returns all of set of index type.UnsupportedOperationException
can occur when value of the returned object is updated. And value of the returned object is not changed by updating this object.- Returns:
- Set of index type, or
null
if unspecified.
-
getName
public java.lang.String getName()
Returns a name of Column.- Returns:
- Name of Column, or
null
if unspecified.
-
getType
public GSType getType()
Returns the type of a Column, i.e., the type of each field value corresponding to a Column.- Returns:
- Type of Column, or
null
if unspecified.
-
-
- java.lang.Object
-
- java.lang.Enum<CompressionMethod>
-
- com.toshiba.mwcloud.gs.CompressionMethod
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<CompressionMethod>
public enum CompressionMethod extends java.lang.Enum<CompressionMethod>
Not supported
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description HI
Not supportedNO
Not supportedSS
Not supported
-
Method Summary
Methods Modifier and Type Method and Description static CompressionMethod
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static CompressionMethod[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
HI
public static final CompressionMethod HI
Not supported
-
NO
public static final CompressionMethod NO
Not supported
-
SS
public static final CompressionMethod SS
Not supported
-
-
Method Detail
-
valueOf
public static CompressionMethod valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static CompressionMethod[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CompressionMethod c : CompressionMethod.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
-
- Type Parameters:
K
- the type of a Row key. If no Row key is used, specify Void.R
- the type of a Row object used for mapping
- All Superinterfaces:
- java.lang.AutoCloseable, java.io.Closeable
- All Known Subinterfaces:
- Collection<K,R>, TimeSeries<R>
public interface Container<K,R> extends java.io.Closeable
Provides the functions of managing the components of GridDB, each consisting of a set of Rows of a single type.It provides various management functions treating a Row object as a unit of input/output. A Row object and a Row in GridDB are mapped to each other, based on the correspondence between the specified type of a Row object and the schema defined in GridDB.
Each Column composing a schema in GridDB has a correspondence relation with a field and methods defined in a Row object. The number of Columns is from 1 to 1024 per Container. The correspondence relation with each column is determined based on the public, protected and default access fields of the specified type or the getter and setter methods, excluding fields and methods specified as
TransientRowField
and transient fields. A default constructor with a public, protected or default access modifier must be prepared to generate a Row object dynamically. Internal classes must be static.The getter is a method with no parameters which has a name beginning with "is" or "get" if it return a Boolean value, or a name with beginning with "get" if it returns any other type value. The setter is a method with only one parameter specifying a setting value which has a name beginning with "set." The Column names used in GridDB correspond with the character strings obtained by removing prefixes, such as "get," from the names of getter and setter methods. A Column name must be composed of ASCII alphanumeric characters and underscores ("_"). And the first character must not be numeric. Since Column names are case-insensitive, you cannot differentiate upper- and lowercase letters in a Column name. If either (not both) of a getter or a setter is only defined, it is ignored. If a field with the same name and both of a getter and a setter are defined, the getter and the setter are used. If there is a difference in case between a getter and a setter, the getter is given priority. If a Column has a Row key,
RowKey
is set on the corresponding field or methods.The correspondence between the type of a Column and the type of each value in a Row object is as follows:
Column type Column type Type of each value in a Row object STRING String
BOOL Boolean
orboolean
BYTE Byte
orbyte
SHORT Short
orshort
INTEGER Integer
orint
LONG Long
orlong
FLOAT Float
orfloat
DOUBLE Double
ordouble
TIMESTAMP Date
BLOB Class implementing Blob
STRING array String[]
BOOL array boolean[]
BYTE array byte[]
SHORT array short[]
INTEGER array int[]
LONG array long[]
FLOAT array float[]
DOUBLE array double[]
TIMESTAMP array java.util.Date[]
There is an upper limit to the number of columns and length of the column name. In addition, the display range and size are limited in the field value. Refer specifically to "System limiting values" in the GridDB API Reference. Values contrary to the restriction cannot be stored in a Container.
Restrictions such as the datatypes permitted as a Row key, existence of columns corresponding to the Row key, and permissibility of Row operations differ depending on the definition of the sub-interfaces of this Container.
During transaction processing, the auto commit mode is enabled by default. In the auto commit mode, change operations are confirmed sequentially and cannot be deleted explicitly. In the manual commit mode, if an error in the cluster node is detected by an operation via this object and
GSException
is sent out, all update operations before committing are deleted. The transaction separation level supports only READ COMMITTED. The lock particle size differs depending on the type of Container.After generation or transaction of this
Container
ends, a new transaction is started at the point the Row is first updated, added or deleted, and the lock for updating purposes is acquired. In the auto commit mode, when the Row operation which started the transaction ends, the transaction is automatically committed and ended. In the manual commit mode, a transaction will not be ended until the validity period for controlling the transaction explicitly is reached.commit()
is used to commit a transaction whileabort()
is used to abort a transaction. Even if thisContainer
or theGridStore
of the generation source is closed, the transaction will be aborted and ended. In addition, the time an operation is carried out to start a transaction is adopted as the start point, and the validity period is reached only when the period defined in GridDB has passed. When you try to continue with the Row operations and transaction commitment without aborting after the validity period is reached,GSException
will be sent out.-
-
Method Summary
Methods Modifier and Type Method and Description void
abort()
Rolls back the result of the current transaction and starts a new transaction in the manual commit mode.void
close()
Disconnects with GridDB and releases related resources as necessary.void
commit()
Commits the result of the current transaction and start a new transaction in the manual commit mode.java.sql.Blob
createBlob()
Creates a Blob to store a large size of binary data for aContainer
.void
createIndex(java.lang.String columnName)
Creates a default type of index on the specified Column.void
createIndex(java.lang.String columnName, IndexType type)
Creates a specified type of index on the specified Column.R
createRow()
Create a new Row object based on the column layout of this Container.void
createTrigger(TriggerInfo info)
Set the trigger.void
dropIndex(java.lang.String columnName)
Removes a default type of index among indexes on the specified Column.void
dropIndex(java.lang.String columnName, IndexType type)
Removes the specified type of index among indexes on the specified Column.void
dropTrigger(java.lang.String name)
Delete a trigger.void
flush()
Writes the results of earlier updates to a non-volatile storage medium, such as SSD, so as to prevent the data from being lost even if all cluster nodes stop suddenly.R
get(K key)
Returns the content of a Row corresponding to the specified Row key.R
get(K key, boolean forUpdate)
Returns the content of a Row corresponding to the specified Row key according to the specified option.ContainerType
getType()
Get the type of this Container.boolean
put(java.util.Collection<R> rowCollection)
Based on the specified Row object group, an arbitrary number of Rows will be consolidated to create a new group or updated.boolean
put(K key, R row)
Newly creates or updates a Row, based on the specified Row object and also the Row key specified as needed.boolean
put(R row)
Newly creates or updates a Row, based on the specified Row object only.Query<R>
query(java.lang.String tql)
Creates a query object to execute the specified TQL statement.<S> Query<S>
query(java.lang.String tql, java.lang.Class<S> rowType)
Creates a query object to execute the specified TQL statement and return the specified type of result.boolean
remove(K key)
Deletes a Row corresponding to the specified Row key.void
setAutoCommit(boolean enabled)
Change the setting of the commit mode.
-
-
-
Method Detail
-
abort
void abort() throws GSException
Rolls back the result of the current transaction and starts a new transaction in the manual commit mode.- Throws:
GSException
- if called not in the autocommit mode.GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted or a connection failure occurs; or if called after the connection is closed.
-
close
void close() throws GSException
Disconnects with GridDB and releases related resources as necessary.When a transaction is held, uncommitted updates will be rolled back.
Even if
GSException
is thrown, the connection and local resources will be released properly. However, the transaction state might remain in GridDB. If the transaction is already closed, no release operation is invoked by this method.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
GSException
- if a connection failure occurs
-
commit
void commit() throws GSException
Commits the result of the current transaction and start a new transaction in the manual commit mode.- Throws:
GSException
- if called not in the autocommit modeGSException
- if a timeout occurs during this operation or the transaction, this Container is deleted or a connection failure occurs; or if called after the connection is closed.
-
createBlob
java.sql.Blob createBlob() throws GSException
Creates a Blob to store a large size of binary data for aContainer
.The created Blob can be used as a Row field. First, set binary data in the Blob using Blob.setBinaryStream(long) etc. and then store it in
Container
usingput(Object)
etc.At least the following methods can be called on the
Blob
obtained by this method.Blob.length()
Blob.setBinaryStream(long)
Blob.setBytes(long, byte[])
Blob.setBytes(long, byte[], int, int)
Blob.free()
You do not have to use the
Blob
created by this method as BLOB to be set on a Row object. You can set an instance of other class implementingBlob
, such asSerialBlob
. The createdBlob
does not have any validity period.In the current version, since the entire Row is cached in memory, it might be impossible to store larger data than the maximum VM memory size.
GSException
will not be thrown in the current version.- Throws:
GSException
-
createIndex
void createIndex(java.lang.String columnName) throws GSException
Creates a default type of index on the specified Column.In a Container created using
GridStoreFactory.getInstance()
, the following types of indexes are selected by default, depending on the type of Container, the type of a corresponding Column, etc.Column type Collection TimeSeries STRING IndexType.TREE
IndexType.TREE
BOOL IndexType.TREE
IndexType.TREE
Numeric type IndexType.TREE
IndexType.TREE
TIMESTAMP IndexType.TREE
IndexType.TREE
* With some limitationsBLOB (-) (-) Array type (-) (-) If an index is already set on the specified Column, nothing is changed.
When a transaction(s) is active in a target Container, it creates an index after waiting for the transaction(s) to complete.
- Throws:
GSException
- if no Column has the specified name.GSException
- if a timeout occurs during this operation, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed.GSException
- if indexing is not supported on the specified Column.java.lang.NullPointerException
- if anull
parameter is specified.
-
createIndex
void createIndex(java.lang.String columnName, IndexType type) throws GSException
Creates a specified type of index on the specified Column.The supported types of indexes are different depending on the types of a Column and a Container. See the definition of
IndexType
.If an index is already set on the specified Column, nothing is changed.
When a transaction(s) is active in a target Container, it creates an index after waiting for the transaction(s) to complete.
- Throws:
GSException
- if no Column has the specified name.GSException
- if a timeout occurs during this operation, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed.GSException
- if the specified type of index is not supported on the specified Column type.java.lang.NullPointerException
- if anull
parameter(s) is specified.
-
createRow
R createRow() throws GSException
Create a new Row object based on the column layout of this Container.If the Row object type of the Container is
Row
, a fixed default value is set in each field of theRow
to be created, similar to the case when it is created using aGridStore.createRow(ContainerInfo)
. In this case, the operation on the createdRow
also does not affect whether thisContainer
object is closed or not.- Throws:
GSException
- If an exclusion is sent out when creating a user-defined Row objectGSException
- If invoked after being closed
-
createTrigger
void createTrigger(TriggerInfo info) throws GSException
Set the trigger.If a update operation of a specific type is carried out on this Container, a notification will be sent to the specified URI. If a trigger with the same name as the specified trigger exists, the setting will be overwritten.
Refer to the definition of
Trigger typeTriggerInfo
for the detailed trigger settings. The details of the trigger type, notification conditions, notification destination URI and notification contents are as shown below.The following trigger types are supported.
name description REST Trigger to notify the specified URI with a REST notification (HTTP POST method) when an update operation of the specified type is carried out on a Container. Java Message Service(JMS) Trigger to send a JMS message to the JMS server of the specified URI when an update operation of the specified type is carried out on a Container. Apache ActiveMQ is used as the JMS provider. Create new Row/ update Row for this Container (
put(Object)
,put(Object, Object)
,put(java.util.Collection)
,GridStore.multiPut(java.util.Map)
,RowSet.update(Object)
), delete (remove(Object)
,RowSet.remove()
) Perform notification immediately after executing operation command. If multiple operations are specified as monitoring targets, perform notification after executing any one of these operations.Completion of replication at the point notification is carried out is not guaranteed. For notifications corresponding to a create new Row/ update Row or delete command that has been executed by disabling the auto commit mode, if the transaction is not committed at the point of the notification, or if the transaction is aborted after the notification, it may not be possible to get the data included in the notification at the point the notification is received.
For batch operations involving multiple Rows, notification is carried out for each Row operation. If there is no response within a specified time even if notification has been sent to the specified URl, time out is performed and it will not be sent again. If a failure occurs in a GridDB cluster, in addition to not sending any notification to support a certain update operation, multiple notifications may be sent.
Notification destination URIA notification destination URI is described in the following format.
(method name)://(host name):(port number)/(path)
However, if the trigger type is REST, only http can be specified in the method name. Notification contentsProvide notification of the updated Container name, update operation name, and specified column value of the updated Row data. For the update operation name, use
"put"
to create a new Row/ update Row and"delete"
to delete.The notification value shall be the specified column value of the Row data that is newly created immediately after a new Row is created, or updated in an update operation, or before deletion in a delete operation. If the column type is TIMESTAMP, an integer to indicate the time passed in milliseconds starting from
Notification method - For REST1970-01-01T00:00:00Z
is set as the value. If the column type if BLOB, GEOMETRY, or array, a blank character string will be set as the value.JSON character strings such as those shown below are sent with the MIME type application/json.
{ "container" : "(container name)", "event" : "(update operation name)", "row" : { "(column name)" : (column data), "(column name)" : (column data), ... } }
Notification method - For JMSA javax.jms.TextMessage is sent with the specified destination type and destination name.
The container name is set by
javax.jms.Message#setStringProperty("@container", "(container name)")
. The update operation name is set byjavax.jms.Message#setStringProperty("@event", "(update operation name)")
.The column value is set with a
javax.jms.Message#setXXXProperty("(column name)", (column data))
in accordance with the column type.When the column layout is changed by a
GridStore.putCollection(String, Class, boolean)
,GridStore.putTimeSeries(String, Class, TimeSeriesProperties, boolean)
, etc. in relation to a Container with a set trigger, if a column subject to trigger notification is deleted or if its name is changed, the corresponding column will be deleted from the trigger notification targets.If the server does not respond to a request sent to the notification destination URI that has been set up when sending a notification from GridDB, standby processing will occur until the process times out. This standby process becomes a cause for the delay in serving notification of an update in the Container as well as some other containers. Therefore, a trigger having an invalid notification destination URI is recommended to be deleted by using
dropTrigger(String)
.Refer to "System limiting values" in the GridDB API Reference for the maximum number of triggers that can be set for a single Container and the upper limit of the values for various trigger settings.
- Parameters:
info
- Trigger information of the setting target- Throws:
GSException
- If the trigger name isnull
, or blankGSException
- If the update operation subject to monitoring is not specifiedGSException
- If the notification destination URI does not conform to the stipulated syntaxGSException
- If the JMS is specified by the trigger type, and the JMS destination type isnull
, or is blank, or does not conform to the specified formatGSException
- If the JMS is specified by the trigger type, and the JMS destination name isnull
, or is blankGSException
- If the JMS is specified by the trigger type, and the JMS destination name isnull
, or is blankjava.lang.NullPointerException
- Ifnull
is specified in the argument
-
dropIndex
void dropIndex(java.lang.String columnName) throws GSException
Removes a default type of index among indexes on the specified Column.The default type of index in a Container created using
GridStoreFactory.getInstance()
is the same as defined bycreateIndex(String)
.If no index is set, nothing is changed.
When a transaction(s) is active in a target Container, it removes the index after waiting for the transaction(s) to complete.
- Throws:
GSException
- if no Column has the specified name.GSException
- if a timeout occurs during this operation, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- if anull
parameter is specified.
-
dropIndex
void dropIndex(java.lang.String columnName, IndexType type) throws GSException
Removes the specified type of index among indexes on the specified Column.If the specified index is not found, nothing is changed.
When a transaction(s) is active in a target Container, it removes the index after waiting for the transaction(s) to complete.
- Throws:
GSException
- if no Column has the specified name.GSException
- if a timeout occurs during this operation, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- ifnull
is specified as more than one parameter.
-
dropTrigger
void dropTrigger(java.lang.String name) throws GSException
Delete a trigger.Nothing is changed if the trigger of the specified name does not exist.
- Throws:
GSException
- If this process times out, this Container is deleted, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException
- Ifnull
is specified in the argument
-
flush
void flush() throws GSException
Writes the results of earlier updates to a non-volatile storage medium, such as SSD, so as to prevent the data from being lost even if all cluster nodes stop suddenly.It can be used for operations requiring higher reliability than normal. However, frequent execution of this would cause degradation in response time.
Its behaviors vary, such as the scope of cluster nodes concerned, depending on the configuration of GridDB.
- Throws:
GSException
- if a timeout occurs during this operation, this Container is deleted or a connection failure occurs; or if called after the connection is closed.
-
get
R get(K key) throws GSException
Returns the content of a Row corresponding to the specified Row key.It behaves in the same way as
get(Object, boolean)
called without requesting a lock for update.- Throws:
GSException
- See Also:
get(Object, boolean)
-
get
R get(K key, boolean forUpdate) throws GSException
Returns the content of a Row corresponding to the specified Row key according to the specified option.It can be used only if a Column exists which corresponds to the specified Row key.
If it requests a lock for update in the manual commit mode, it will hold the lock until a relevant transaction completes or a timeout occurs. The update or deletion operation by any other transaction on the locked Row will wait until the transaction completes or a timeout occurs. The lock will be held even if the target Row is deleted.
In the autocommit mode, it cannot request a lock for update.
- Parameters:
forUpdate
- indicates whether it requests a lock for update.- Returns:
- A target Row object.
null
if no target Row exists. - Throws:
GSException
- if no Column exists which corresponds to the specified Row key.GSException
- if it requests a lock for update in the autocommit mode.GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed; or if an unsupported value is specified as key.java.lang.ClassCastException
- if the specified Row key does not match the type of a Row key used in mapping operation.java.lang.NullPointerException
- ifnull
is specified askey
.
-
getType
ContainerType getType() throws GSException
Get the type of this Container.In the current version, no inquiry is sent to the GridDB cluster by this operation as the type is always confirmed at the point the instance is generated.
- Throws:
GSException
- If invoked after being closed
-
put
boolean put(java.util.Collection<R> rowCollection) throws GSException
Based on the specified Row object group, an arbitrary number of Rows will be consolidated to create a new group or updated.For each Row in the specified Row object group, a new creation or update operation is carried out just like the case when
put(Object)
is invoked in accordance with the take-out sequence from the iterator.If multiple Rows having the same Row key exist in the specified Row object group, the contents of the rear-most Row having the same Row key will be reflected using the take-out sequence from the iterator of the Row object group as a reference.
Depending on the Container type and setting, the same restrictions as
put(Object)
are established for the contents of Rows that can be operated. Refer to definition of the sub-interface for the specific restrictions.In the manual commit mode, the target Rows are locked.
In the auto commit mode, if an exclusion occurs in the midst of processing a Container and its Rows, only the results for some of the Rows in the Container may remain reflected.
- Returns:
- Always
false
in the current version - Throws:
GSException
- When an operation violating the restrictions unique to a specific Container type is carried outGSException
- if a timeout occurs during this operation or the transaction, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed; or if an unsupported value is set in the key or the Row object.java.lang.ClassCastException
- if the specified Row objects does not match the value types of Row objects used in mapping operation, respectively.java.lang.NullPointerException
- if NULL is specified asrowCollection
or its element; or if no object exists in each Row object which corresponds to the Row field.- See Also:
put(Object)
-
put
boolean put(K key, R row) throws GSException
Newly creates or updates a Row, based on the specified Row object and also the Row key specified as needed.If a Column exists which corresponds to the specified Row key, it determines whether to newly create or update a Row, based on the Row key and the state of the Container. If there is no corresponding Row in the Container, it determines to newly create a Row; otherwise, it updates a relevant Row. If a Row key is specified besides a Row object, the specified Row key is used in preference to the Row key in the Row object.
If no Column exists which corresponds to the specified Row key, it always creates a new Row. In such a case, specify
null
as key.Restrictions are applied depending on the type of Container and its settings. See the descriptions of subinterfaces for detailed restrictions.
In the manual commit mode, the target Row is locked.
- Parameters:
key
- A target Row keyrow
- A Row object representing the content of a Row to be newly created or updated.- Returns:
TRUE
if a Row exists which corresponds to the specified Row key.- Throws:
GSException
- if a Row key is specified although no Column exists which corresponds to the key.GSException
- if its operation is contrary to the restrictions specific to a particular Container.GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed; or if an unsupported value is set in the key or the Row object.java.lang.ClassCastException
- if the specified key or Row object does not completely match the type(s) used in mapping operation.java.lang.NullPointerException
- ifnull
is specified asrow
; or if no object exists in the Row object which corresponds to the Row field.
-
put
boolean put(R row) throws GSException
Newly creates or updates a Row, based on the specified Row object only.It behaves in the same way as
put(Object, Object)
, except that it uses a Row key in the specified Row object.- Throws:
GSException
- See Also:
put(Object, Object)
-
query
Query<R> query(java.lang.String tql) throws GSException
Creates a query object to execute the specified TQL statement.It cannot be used for a query whose output format does not match the types of Rows in this Container, such as a query containing an aggregation operation in its selection expression. For such a query,
query(String, Class)
can be used instead.When obtaining a set of Rows using
Query.fetch(boolean)
, the option of locking for update can be enabled only for the queries that will not select Rows which do not exist in this Container. For example, it cannot be enabled for a query containing an interpolation operation.GSException
will not be thrown in the current version.- Throws:
java.lang.NullPointerException
- ifnull
is specified astql
.GSException
- See Also:
query(String, Class)
-
query
<S> Query<S> query(java.lang.String tql, java.lang.Class<S> rowType) throws GSException
Creates a query object to execute the specified TQL statement and return the specified type of result.It is used for a query whose output format does not match the types of Rows in this Container, such as an aggregation operation. The following types and
null
are only available asrowType
.- Row type of Container
- Indicates receiving Row data of the type matching the Rows in this
Container, as in
query(String)
. AggregationResult
- Indicates receiving the result of executing an aggregation operation.
QueryAnalysisEntry
- Indicates receiving the result of executing an EXPLAIN or EXPLAIN ANALYZE statement.
null
- Indicates receiving a proper type of result, depending on the operation.
When obtaining a set of Rows using
Query.fetch(boolean)
, the option of locking for update can be enabled only for the queries that will not select Rows which do not exist in this Container. For example, it cannot be enabled for a query containing an interpolation operation.- Throws:
GSException
- if an unsupported type is specified asrowType
.java.lang.NullPointerException
- ifnull
is specified astql
.
-
remove
boolean remove(K key) throws GSException
Deletes a Row corresponding to the specified Row key.It can be used only if a Column exists which corresponds to the specified Row key. If no corresponding Row exists, nothing is changed.
Restrictions are applied depending on the type of Container and its settings. See the descriptions of subinterfaces for detailed restrictions.
In the manual commit mode, the target Row is locked.
- Returns:
- TRUE if a corresponding Row exists.
- Throws:
GSException
- if no Column exists which corresponds to the specified Row key.GSException
- if its operation is contrary to the restrictions specific to a particular Container.GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed; or if an unsupported value is specified as key.java.lang.ClassCastException
- if the specified Row key does not match the type of a Row key used in mapping operation.java.lang.NullPointerException
- ifnull
is specified.
-
setAutoCommit
void setAutoCommit(boolean enabled) throws GSException
Change the setting of the commit mode.In the auto commit mode, the transaction state cannot be controlled directly and change operations are committed sequentially. If the auto commit mode is disabled, i.e. in the manual commit mode, as long as the transaction has not timed out or
commit()
has been invoked directly, the same transaction will continue to be used in this Container and change operations will not be committed.When the autocommit mode is switched from On to Off, uncommitted updates are committed implicitly. Unless the commit mode is changed, the state of the transaction will not be changed. These behaviors are the same as those of
Connection.setAutoCommit(boolean)
.- Throws:
GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted or a connection failure occurs, when a commit is requested after a mode change; or if called after the connection is closed.
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.ContainerInfo
-
public class ContainerInfo extends java.lang.Object
Represents the information about a specific Container.It does not guarantee the validity of values e.g. notation of the Container name, and the existence of TimeSeries option related to its Container type.
-
-
Field Summary
Fields Modifier and Type Field and Description protected java.util.List<ColumnInfo>
columnInfoList
protected boolean
columnOrderIgnorable
protected java.lang.String
dataAffinity
protected java.lang.String
name
protected boolean
rowKeyAssigned
protected TimeSeriesProperties
timeSeriesProperties
protected java.util.List<TriggerInfo>
triggerInfoList
protected ContainerType
type
-
Constructor Summary
Constructors Constructor and Description ContainerInfo()
Creates an empty ContainerInfo.ContainerInfo(ContainerInfo containerInfo)
Duplicates the information about the specified Container.ContainerInfo(java.lang.String name, ContainerType type, java.util.List<ColumnInfo> columnInfoList, boolean rowKeyAssigned)
-
Method Summary
Methods Modifier and Type Method and Description int
getColumnCount()
Returns the number of Columns of the specified Container.ColumnInfo
getColumnInfo(int column)
Returns the information about the specified Column.java.lang.String
getDataAffinity()
Returns a data affinity string of the Container.java.lang.String
getName()
Returns the name of the specified Container.TimeSeriesProperties
getTimeSeriesProperties()
Returns the optional properties of TimeSeries.java.util.List<TriggerInfo>
getTriggerInfoList()
Returns a list of the trigger information.ContainerType
getType()
Returns the Container type of the specified Container.boolean
isColumnOrderIgnorable()
Checks if the order of Columns can be ignored.boolean
isRowKeyAssigned()
Checks if a Column is assigned as a Row key.void
setColumnInfoList(java.util.List<ColumnInfo> columnInfoList)
Set information of all Columns all at once.void
setColumnOrderIgnorable(boolean ignorable)
Sets whether the order of Columns can be ignored.void
setDataAffinity(java.lang.String dataAffinity)
Sets a data affinity string of the Container.void
setName(java.lang.String name)
Sets a name of the Container.void
setRowKeyAssigned(boolean assigned)
Sets a Row key Column is assigned or not.void
setTimeSeriesProperties(TimeSeriesProperties props)
Sets the optional properties of TimeSeries.void
setTriggerInfoList(java.util.List<TriggerInfo> triggerInfoList)
Sets all information of triggers.void
setType(ContainerType type)
Sets a type of the Container.
-
-
-
Field Detail
-
columnInfoList
protected java.util.List<ColumnInfo> columnInfoList
-
columnOrderIgnorable
protected boolean columnOrderIgnorable
-
dataAffinity
protected java.lang.String dataAffinity
-
name
protected java.lang.String name
-
rowKeyAssigned
protected boolean rowKeyAssigned
-
timeSeriesProperties
protected TimeSeriesProperties timeSeriesProperties
-
triggerInfoList
protected java.util.List<TriggerInfo> triggerInfoList
-
type
protected ContainerType type
-
-
Constructor Detail
-
ContainerInfo
public ContainerInfo()
Creates an empty ContainerInfo.
-
ContainerInfo
public ContainerInfo(ContainerInfo containerInfo)
Duplicates the information about the specified Container.
-
ContainerInfo
public ContainerInfo(java.lang.String name, ContainerType type, java.util.List<ColumnInfo> columnInfoList, boolean rowKeyAssigned)
-
-
Method Detail
-
getColumnCount
public int getColumnCount()
Returns the number of Columns of the specified Container.- Returns:
- A number of Columns, or
0
if Column layout is unspecified.
-
getColumnInfo
public ColumnInfo getColumnInfo(int column)
Returns the information about the specified Column.- Parameters:
column
- An index of a Column, from0
to number of Columns minus one.- Returns:
- The information of the Column corresponding to the specified index.
- Throws:
java.lang.IllegalArgumentException
- If the specified Column number is out of range.- See Also:
RowField.columnNumber()
-
getDataAffinity
public java.lang.String getDataAffinity()
Returns a data affinity string of the Container.- Returns:
- A data affinity string, or
null
as default. - See Also:
setDataAffinity(String)
-
getName
public java.lang.String getName()
Returns the name of the specified Container.- Returns:
- A Container name, or
null
if unspecified.
-
getTimeSeriesProperties
public TimeSeriesProperties getTimeSeriesProperties()
Returns the optional properties of TimeSeries.If the contents of the returned object is changed after it has been invoked, it is not defined whether the contents of this content will be changed or not. Moreover, it is not defined whether the contents of the returned object will be changed or not by operating this object.
- Returns:
- The optional properties of TimeSeries, or
null
if undefined.
-
getTriggerInfoList
public java.util.List<TriggerInfo> getTriggerInfoList()
Returns a list of the trigger information.UnsupportedOperationException
can occur when the returned value is updated. After objects are returned, updates of this object do not change the returned object.- Returns:
- A list of the trigger information.
-
getType
public ContainerType getType()
Returns the Container type of the specified Container.- Returns:
- A Container type, or
null
if unspecified. - See Also:
ContainerType
-
isColumnOrderIgnorable
public boolean isColumnOrderIgnorable()
Checks if the order of Columns can be ignored.- Returns:
true
if yes, otherwisefalse
.
-
isRowKeyAssigned
public boolean isRowKeyAssigned()
Checks if a Column is assigned as a Row key.If the Container has a Row key, the number of its corresponding Column is
0
.- Returns:
true
If a Row key is assigned, otherwisefalse
.
-
setColumnInfoList
public void setColumnInfoList(java.util.List<ColumnInfo> columnInfoList)
Set information of all Columns all at once.The order of the Columns of the Container corresponds to the order of information of the Columns, if its can be ignored.
It can be undefined, regardless of the existence of a Row key Column.
Updates of the specified object after this function is specified will not change the object.
- Parameters:
columnInfoList
- List of the information of Columns. Fornull
or an empty list, the setting is cancelled.- See Also:
setColumnOrderIgnorable(boolean)
-
setColumnOrderIgnorable
public void setColumnOrderIgnorable(boolean ignorable)
Sets whether the order of Columns can be ignored.Default value cannot be ignored (
false
).- Parameters:
ignorable
- If the order of Columns can be ignored- See Also:
GridStore.putContainer(String, ContainerInfo, boolean)
-
setDataAffinity
public void setDataAffinity(java.lang.String dataAffinity)
Sets a data affinity string of the Container.A data affinity string is for optimizing the arrangement of Containers among the nodes of the cluster.
Containers which have the same data affinity string may be stored near each other. Therefore the efficiency for the expiration of Rows may be improved by using the same data affinity string for TimeSeries Containers which includes Rows with similar elapsed time periods.
An empty string is not acceptable. A data affinity string must be composed of characters same as a Container name. See "System limiting values" in the GridDB API Reference for the maximum length of the string. A Container with a Container name longer than the maximum length cannot be created.
- Parameters:
dataAffinity
- A data affinity string. Ifnull
is specified, the Container will be stored as usual.- Throws:
java.lang.IllegalArgumentException
- If the specified string is not proper. However, an exception may not occur even if the lenght of the string is exceeded.
-
setName
public void setName(java.lang.String name)
Sets a name of the Container.- Parameters:
name
- A name of the Container. Fornull
, the setting is cancelled.
-
setRowKeyAssigned
public void setRowKeyAssigned(boolean assigned)
Sets a Row key Column is assigned or not.A Row key is assigned default.
This function is available regardless of the layout of Columns.
- Parameters:
assigned
- A Row key Column is assigned or not.true
for assigned, otherwisefalse
.
-
setTimeSeriesProperties
public void setTimeSeriesProperties(TimeSeriesProperties props)
Sets the optional properties of TimeSeries.This function is available for any Container type.
Updates of the specified object after this function is invoked will not change the object.
- Parameters:
props
- The optional properties of TimeSeries. Fornull
, the setting is cancelled.
-
setTriggerInfoList
public void setTriggerInfoList(java.util.List<TriggerInfo> triggerInfoList)
Sets all information of triggers.- Parameters:
triggerInfoList
- A list of trigger information. Fornull
, the setting is cancelled.
-
setType
public void setType(ContainerType type)
Sets a type of the Container.- Parameters:
type
- A type of the Container. Fornull
, the setting is cancelled.
-
-
- java.lang.Object
-
- java.lang.Enum<ContainerType>
-
- com.toshiba.mwcloud.gs.ContainerType
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<ContainerType>
public enum ContainerType extends java.lang.Enum<ContainerType>
Represents the type(s) of a Container.
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description COLLECTION
Indicates the target Container is a Collection.TIME_SERIES
Indicates the target Container is a TimeSeries.
-
Method Summary
Methods Modifier and Type Method and Description static ContainerType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ContainerType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
COLLECTION
public static final ContainerType COLLECTION
Indicates the target Container is a Collection.
-
TIME_SERIES
public static final ContainerType TIME_SERIES
Indicates the target Container is a TimeSeries.
-
-
Method Detail
-
valueOf
public static ContainerType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static ContainerType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ContainerType c : ContainerType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
- java.lang.Object
-
- java.lang.Enum<FetchOption>
-
- com.toshiba.mwcloud.gs.FetchOption
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<FetchOption>
public enum FetchOption extends java.lang.Enum<FetchOption>
The options for fetching the result of a query.
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description LIMIT
Used to set the maximum number of Rows to be fetched.
-
Method Summary
Methods Modifier and Type Method and Description static FetchOption
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static FetchOption[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
LIMIT
public static final FetchOption LIMIT
Used to set the maximum number of Rows to be fetched.If the number of Rows in a result exceeds the maximum, the maximum number of Rows counting from the 0-th in
RowSet
are fetched. The rest of the Rows in the result cannot be fetched.The supported types of values are
Integer
andLong
. Negative values are not available. If the setting is omitted, the limit is not defined.
-
-
Method Detail
-
valueOf
public static FetchOption valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static FetchOption[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FetchOption c : FetchOption.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- com.toshiba.mwcloud.gs.GSException
-
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- GSTimeoutException
public class GSException extends java.io.IOException
Represents the exceptions occurring during a process of a GridDB function.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description GSException()
GSException(int errorCode, java.lang.String description)
GSException(int errorCode, java.lang.String errorName, java.lang.String description, java.lang.Throwable cause)
GSException(int errorCode, java.lang.String description, java.lang.Throwable cause)
GSException(int errorCode, java.lang.Throwable cause)
GSException(java.lang.String message)
GSException(java.lang.String message, java.lang.Throwable cause)
GSException(java.lang.Throwable cause)
-
Method Summary
Methods Modifier and Type Method and Description int
getErrorCode()
Returns an error number.java.lang.String
getMessage()
-
-
-
Constructor Detail
-
GSException
public GSException()
-
GSException
public GSException(int errorCode, java.lang.String description)
-
GSException
public GSException(int errorCode, java.lang.String errorName, java.lang.String description, java.lang.Throwable cause)
-
GSException
public GSException(int errorCode, java.lang.String description, java.lang.Throwable cause)
-
GSException
public GSException(int errorCode, java.lang.Throwable cause)
-
GSException
public GSException(java.lang.String message)
-
GSException
public GSException(java.lang.String message, java.lang.Throwable cause)
-
GSException
public GSException(java.lang.Throwable cause)
-
-
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- com.toshiba.mwcloud.gs.GSException
-
- com.toshiba.mwcloud.gs.GSTimeoutException
-
- All Implemented Interfaces:
- java.io.Serializable
public class GSTimeoutException extends GSException
Represents the exceptions indicating that the requested operation operation did not finish within a nomal time.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description GSTimeoutException()
GSTimeoutException(int errorCode, java.lang.String description)
GSTimeoutException(int errorCode, java.lang.String errorName, java.lang.String description, java.lang.Throwable cause)
GSTimeoutException(int errorCode, java.lang.String description, java.lang.Throwable cause)
GSTimeoutException(int errorCode, java.lang.Throwable cause)
GSTimeoutException(java.lang.String message)
GSTimeoutException(java.lang.String message, java.lang.Throwable cause)
GSTimeoutException(java.lang.Throwable cause)
-
Method Summary
-
Methods inherited from class com.toshiba.mwcloud.gs.GSException
getErrorCode, getMessage
-
-
-
-
Constructor Detail
-
GSTimeoutException
public GSTimeoutException()
-
GSTimeoutException
public GSTimeoutException(int errorCode, java.lang.String description)
-
GSTimeoutException
public GSTimeoutException(int errorCode, java.lang.String errorName, java.lang.String description, java.lang.Throwable cause)
-
GSTimeoutException
public GSTimeoutException(int errorCode, java.lang.String description, java.lang.Throwable cause)
-
GSTimeoutException
public GSTimeoutException(int errorCode, java.lang.Throwable cause)
-
GSTimeoutException
public GSTimeoutException(java.lang.String message)
-
GSTimeoutException
public GSTimeoutException(java.lang.String message, java.lang.Throwable cause)
-
GSTimeoutException
public GSTimeoutException(java.lang.Throwable cause)
-
-
- java.lang.Object
-
- java.lang.Enum<GSType>
-
- com.toshiba.mwcloud.gs.GSType
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description BLOB
BOOL
BOOL_ARRAY
BYTE
BYTE_ARRAY
DOUBLE
DOUBLE_ARRAY
FLOAT
FLOAT_ARRAY
GEOMETRY
INTEGER
INTEGER_ARRAY
LONG
LONG_ARRAY
SHORT
SHORT_ARRAY
STRING
STRING_ARRAY
TIMESTAMP
TIMESTAMP_ARRAY
-
Method Summary
Methods Modifier and Type Method and Description static GSType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static GSType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BLOB
public static final GSType BLOB
-
BOOL
public static final GSType BOOL
-
BOOL_ARRAY
public static final GSType BOOL_ARRAY
-
BYTE
public static final GSType BYTE
-
BYTE_ARRAY
public static final GSType BYTE_ARRAY
-
DOUBLE
public static final GSType DOUBLE
-
DOUBLE_ARRAY
public static final GSType DOUBLE_ARRAY
-
FLOAT
public static final GSType FLOAT
-
FLOAT_ARRAY
public static final GSType FLOAT_ARRAY
-
GEOMETRY
public static final GSType GEOMETRY
-
INTEGER
public static final GSType INTEGER
-
INTEGER_ARRAY
public static final GSType INTEGER_ARRAY
-
LONG
public static final GSType LONG
-
LONG_ARRAY
public static final GSType LONG_ARRAY
-
SHORT
public static final GSType SHORT
-
SHORT_ARRAY
public static final GSType SHORT_ARRAY
-
STRING
public static final GSType STRING
-
STRING_ARRAY
public static final GSType STRING_ARRAY
-
TIMESTAMP
public static final GSType TIMESTAMP
-
TIMESTAMP_ARRAY
public static final GSType TIMESTAMP_ARRAY
-
-
Method Detail
-
valueOf
public static GSType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static GSType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (GSType c : GSType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.Geometry
-
public class Geometry extends java.lang.Object
Not supported
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Not supported- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Not supported- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
Not supported- Overrides:
toString
in classjava.lang.Object
-
valueOf
public static Geometry valueOf(java.lang.String value) throws java.lang.IllegalArgumentException
Not supported- Throws:
java.lang.IllegalArgumentException
-
-
- java.lang.Object
-
- java.lang.Enum<GeometryOperator>
-
- com.toshiba.mwcloud.gs.GeometryOperator
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<GeometryOperator>
public enum GeometryOperator extends java.lang.Enum<GeometryOperator>
Not supported
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description INTERSECT
Not supported
-
Method Summary
Methods Modifier and Type Method and Description static GeometryOperator
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static GeometryOperator[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INTERSECT
public static final GeometryOperator INTERSECT
Not supported
-
-
Method Detail
-
valueOf
public static GeometryOperator valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static GeometryOperator[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (GeometryOperator c : GeometryOperator.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
-
- All Superinterfaces:
- java.lang.AutoCloseable, java.io.Closeable
public interface GridStore extends java.io.Closeable
A function is provided for processing the data in the connected GridDB system.A function to add, delete, or change the composition of Collection and TimeSeries Containers as well as to process the Rows constituting a Container is provided.
Rows cannot be stored with duplicated names, regardless of whether it is a TimeSeries or Collection Container. Where necessary, the Container name can be specified by appending the node affinity name after the base Container name with the at mark "@". Only ASCII alphanumeric characters and the underscore mark ( "_" ) can be used in the base Container name and node affinity name. ASCII characters are not case-sensitive. Numbers cannot be used in front of the base Container name. Refer to "System limiting values" in the GridDB API Reference for the upper limit of the length of the Container name.
Thread safety of each method is not guaranteed.
- See Also:
Collection
,TimeSeries
,Container
-
-
Method Summary
Methods Modifier and Type Method and Description void
close()
Disconnects with GridDB and releases related resources as necessary.Row
createRow(ContainerInfo info)
SpecifyContainerInfo
and create a newRow
.void
dropCollection(java.lang.String name)
Deletes a Collection with the specified name.void
dropContainer(java.lang.String name)
Delete a Container having the specified name Nothing is changed if the Container has already been deleted.void
dropTimeSeries(java.lang.String name)
Deletes a TimeSeries with the specified name.void
fetchAll(java.util.List<? extends Query<?>> queryList)
Query execution and fetch is carried out on a specified arbitrary number ofQuery
, with the request unit enlarged as much as possible.<K> Collection<K,Row>
getCollection(java.lang.String name)
Get aCollection
object whose Rows can be processed using aRow
.<K,R> Collection<K,R>
getCollection(java.lang.String name, java.lang.Class<R> rowType)
Return aCollection
object to manipulate a Collection with the specified name.<K> Container<K,Row>
getContainer(java.lang.String name)
ContainerInfo
getContainerInfo(java.lang.String name)
Get information related to a Container with the specified name.PartitionController
getPartitionController()
GetPartitionController
on the corresponding GridDB cluster.TimeSeries<Row>
getTimeSeries(java.lang.String name)
Get aTimeSeries
object whose Rows can be processed using aRow
.<R> TimeSeries<R>
getTimeSeries(java.lang.String name, java.lang.Class<R> rowType)
Returns aTimeSeries
object to manipulate a TimeSeries with the specified name.java.util.Map<java.lang.String,java.util.List<Row>>
multiGet(java.util.Map<java.lang.String,? extends RowKeyPredicate<?>> containerPredicateMap)
Get an arbitrary number and range of Rows of a Container based on the specified conditions, with the request unit enlarged as much as possible.void
multiPut(java.util.Map<java.lang.String,java.util.List<Row>> containerRowsMap)
New creation or update operation is carried out on an arbitrary number of rows of a Container, with the request unit enlarged as much as possible.<K,R> Collection<K,R>
putCollection(java.lang.String name, java.lang.Class<R> rowType)
Newly creates or update a Collection.<K,R> Collection<K,R>
putCollection(java.lang.String name, java.lang.Class<R> rowType, boolean modifiable)
Newly creates or update a Collection with the specified option.<K> Collection<K,Row>
putCollection(java.lang.String name, ContainerInfo info, boolean modifiable)
SpecifyContainerInfo
and create a new Collection or update a Collection.<K,R> Container<K,R>
putContainer(java.lang.String name, java.lang.Class<R> rowType, ContainerInfo info, boolean modifiable)
Specify the Row object type andContainerInfo
and create a new Container or update a Container.<K> Container<K,Row>
putContainer(java.lang.String name, ContainerInfo info, boolean modifiable)
SpecifyContainerInfo
and create a new Container or update a Container.<R> TimeSeries<R>
putTimeSeries(java.lang.String name, java.lang.Class<R> rowType)
Newly creates or updates a TimeSeries.<R> TimeSeries<R>
putTimeSeries(java.lang.String name, java.lang.Class<R> rowType, TimeSeriesProperties props, boolean modifiable)
Newly creates or updates a TimeSeries with the specified additional settings and update option.TimeSeries<Row>
putTimeSeries(java.lang.String name, ContainerInfo info, boolean modifiable)
SpecifyContainerInfo
and create a new or update TimeSeries.
-
-
-
Method Detail
-
close
void close() throws GSException
Disconnects with GridDB and releases related resources as necessary.Even if
GSException
is thrown, the connection and local resources are released properly. However, the transaction state etc. might remain in GridDB. If the connection is already closed, this method will not work effectively.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
GSException
- if a connection failure occurs
-
createRow
Row createRow(ContainerInfo info) throws GSException
SpecifyContainerInfo
and create a newRow
.Include the
ColumnInfo
list and whether there is any Row key so as to conform to the restrictions stipulated inContainer
. Specify the column layout inContainerInfo
.In addition, by including the Container type in
ContainerInfo
, it can be verified whether the restrictions unique to a specific Container type are conformed to or not. However, the Container type will not be included even if aRow.getSchema()
is invoked against the createdRow
.The existing initial value is set in each field of the created
Row
. This initial value is the same as the value of each field in the column newly added inputContainer(String, ContainerInfo, boolean)
. Refer to the definition ofputCollection(String, Class, boolean)
for a list of the specific values.The operation on the created
Row
also does not affect whether thisGridStore
object is closed or not.- Parameters:
info
- Container information including the column layout. Other contents are ignored- Returns:
- Created
Row
- Throws:
GSException
- If the Container type or restrictions of the column layout are not conformed toGSException
- If invoked after being closedjava.lang.NullPointerException
- Ifnull
is specified in the argument- See Also:
Container
-
dropCollection
void dropCollection(java.lang.String name) throws GSException
Deletes a Collection with the specified name.If the specified Collection is already deleted, nothing is changed.
When a transaction(s) is active in a target Collection, it deletes the Collection after waiting for the transaction(s) to complete.
- Parameters:
name
- Name of Collection subject to processing- Throws:
GSException
- if the Container type is unmatched.GSException
- if a timeout occurs during this operation or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- if anull
parameter is specified.
-
dropContainer
void dropContainer(java.lang.String name) throws GSException
Delete a Container having the specified nameNothing is changed if the Container has already been deleted.
If a transaction under execution exists in a Container subject to processing, the system will wait for these to be completed before deleting the data.
- Parameters:
name
- Name of a Container subject to processing- Throws:
GSException
- Name of a Container subject to processingjava.lang.NullPointerException
- Ifnull
is specified in the argument- See Also:
dropCollection(String)
,dropTimeSeries(String)
-
dropTimeSeries
void dropTimeSeries(java.lang.String name) throws GSException
Deletes a TimeSeries with the specified name.If the specified TimeSeries is already deleted, nothing is changed.
When a transaction(s) is active in a target TimeSeries, it deletes the TimeSeries after waiting for the transaction(s) to complete.
- Parameters:
name
- Name of TimeSeries subject to processing- Throws:
GSException
- if the Container type is unmatched.GSException
- if a timeout occurs during this operation or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- if anull
parameter is specified.
-
fetchAll
void fetchAll(java.util.List<? extends Query<?>> queryList) throws GSException
Query execution and fetch is carried out on a specified arbitrary number ofQuery
, with the request unit enlarged as much as possible.For each
Query
included in a specified list, perform a similar query execution and fetch as whenQuery.fetch()
is performed individually and set theRowSet
in the results. UseQuery.getRowSet()
to extract the execution results of eachQuery
. However, unlike the case when carried out individually, the target node is requested for the same storage destination, etc. with a unit that is as large as possible. Based on this, the larger the number of elements in the list, the higher is the possibility that the number of correspondences with the target node will be reduced.Query
in a list are not executed in any particular order.Only a
Query
that has not been closed, including correspondingContainer
acquired via thisGridStore
object, can be included in a specified list. Like aQuery.fetch()
, theRowSet
formed last and held by eachQuery
will be closed. If the same instance is included multiple times in a list, the behavior will be the same as the case in which the respective instances differ.Like other Container or Row operations, consistency between Containers is not guaranteed. Therefore, the processing results for a certain Container may be affected by other operation commands that have been completed prior to the start of the process.
The commit mode of each
Container
corresponding to the specifiedQuery
can be used in either the auto commit mode or manual commit mode. The transaction status is reflected in the execution results of the query. If the operation is completed normally, the corresponding transaction of eachContainer
will not be aborted so long as the transaction timeout time has not been reached.If an exception occurs in the midst of processing each
Query
, a newRowSet
may be set for only some of theQuery
. In addition, uncommitted transactions of eachQuery
corresponding to the designatedContainer
may be aborted.If the system tries to acquire a large number of Rows all at once, the upper limit of the communication buffer size managed by the GridDB node may be reached, possibly resulting in a failure. Refer to "System limiting values" in the GridDB API Reference for the upper limit size.
- Parameters:
queryList
- List ofQuery
targeted- Throws:
If
- aQuery
other than aQuery
obtained via thisGridStore
object is includedGSException
- If the system tries to execute a query containing a wrong parameter, syntax or command. For example, when a column type that is not compatible with the argument of the function is specified in the TQL. Refer to the various definitions of the function to create this query for the specific restrictionsGSException
- If the execution results do not conform to the expected type of each component of theRowSet
, when a TQL is executed.GSException
- If this process or related transaction times out, if the corresponding Container is deleted or the schema is changed, if a connection failure occurs, or if the corresponding Container is invoked after being closedjava.lang.NullPointerException
- Ifnull
is specified in the argumentqueryList
, or ifnull
is included as a component the argumentqueryList
java.lang.NullPointerException
- If a non-permittednull
is included in the parameter given when creating this query. To be executed in GridDB The evaluation results of the TQL text will not be sent out- See Also:
Query.fetch()
-
getCollection
<K> Collection<K,Row> getCollection(java.lang.String name) throws GSException
Get aCollection
object whose Rows can be processed using aRow
.Except for points where the expected Container type is limited to
ContainerType.COLLECTION
and the returned type isCollection
, the behavior will be the same asgetContainer(String)
.- Returns:
- Corresponding
Collection
if a Collection exists andnull
if not. - Throws:
GSException
- If a TimeSeries with the same name existsGSException
- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException
- Ifnull
is specified in the argument- See Also:
getContainer(String)
-
getCollection
<K,R> Collection<K,R> getCollection(java.lang.String name, java.lang.Class<R> rowType) throws GSException
Return aCollection
object to manipulate a Collection with the specified name.For the correspondence between a specified type and a Column layout, see the description of
Container
.- Parameters:
name
- Name of a Collection subject to processingrowType
- Type of Row object corresponding to the column layout of the Collection subject to processing- Returns:
- A Collection object if a
Collection
with the specified name exist; ornull
if not. - Throws:
GSException
- if a TimeSeries with the same name exists.GSException
- if the specified type and the existing Column layout conflict each other.GSException
- if the specified type is not proper as a type of a Row object. For more information, see the description ofContainer
.GSException
- if a timeout occurs during this operation or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- if anull
parameter(s) is specified.
-
getContainer
<K> Container<K,Row> getContainer(java.lang.String name) throws GSException
Get aContainer
object whose Rows can be processed using aRow
.Excluding the next point, the behavior will be the same as
getCollection(String, Class)
orgetTimeSeries(String, Class)
.- Return a
Container
object based on the existing Container type and column layout - No error accompanying these non-conformances will occur as the Container type and column layout are not specified
- The Row object type of the
Container
returned will always beRow
name
with the same respective name are used in the same way as well.- Parameters:
name
- Name of a Container subject to processing- Returns:
- Corresponding
Container
if a Container exists andnull
if not. If a Container exists and the type isContainerType.COLLECTION
, the instance created will be aCollection
instance. If the type isContainerType.TIME_SERIES
, the instance created will be aTimeSeries
instance. - Throws:
GSException
- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException
- Ifnull
is specified in the argument- See Also:
getCollection(String, Class)
,getTimeSeries(String, Class)
- Return a
-
getContainerInfo
ContainerInfo getContainerInfo(java.lang.String name) throws GSException
Get information related to a Container with the specified name.A name stored in GridDB is set for the Container name to be included in a returned
ContainerInfo
. Therefore, compared to the specified Container name, the notation of the ASCII uppercase characters and lowercase characters may differ.The column sequence is set to Do Not Ignore. This setting can be verified through
ContainerInfo.isColumnOrderIgnorable()
.- Parameters:
name
- the target Container name- Returns:
- Container Info of the specific Container.
- Throws:
GSException
- if a timeout occurs during this operation or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- ifnull
is specified as the parameter.
-
getPartitionController
PartitionController getPartitionController() throws GSException
GetPartitionController
on the corresponding GridDB cluster.Use is no longer possible once this
GridStore
is closed.- Returns:
PartitionController
on the corresponding GridDB cluster- Throws:
GSException
- If invoked after being closed- See Also:
PartitionController
-
getTimeSeries
TimeSeries<Row> getTimeSeries(java.lang.String name) throws GSException
Get aTimeSeries
object whose Rows can be processed using aRow
.Except for points where the expected Container type is limited to
ContainerType.TIME_SERIES
and the returned type isTimeSeries
, the behavior will be the same asgetTimeSeries(String)
.- Returns:
- Corresponding
TimeSeries
if a TimeSeries exists andnull
if not. - Throws:
GSException
- If a Collection with the same name existsGSException
- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException
- Ifnull
is specified in the argument- See Also:
getContainer(String)
-
getTimeSeries
<R> TimeSeries<R> getTimeSeries(java.lang.String name, java.lang.Class<R> rowType) throws GSException
Returns aTimeSeries
object to manipulate a TimeSeries with the specified name.For the correspondence between a specified type and a Column layout, see the description of
Container
.- Parameters:
name
- Name of TimeSeries subject to processingrowType
- Type of Row object corresponding to the column layout of the TimeSeries subject to processing- Returns:
- A
TimeSeries
object if a TimeSeries with the specified name exists; ornull
if not. - Throws:
GSException
- if a Collection with the same name exists.GSException
- if the specified type and the existing Column layout conflict each other.GSException
- if the specified type is not proper as a type of a Row object. For more information, see the description ofContainer
.GSException
- if a timeout occurs during this operation or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- if anull
parameter(s) is specified.
-
multiGet
java.util.Map<java.lang.String,java.util.List<Row>> multiGet(java.util.Map<java.lang.String,? extends RowKeyPredicate<?>> containerPredicateMap) throws GSException
Get an arbitrary number and range of Rows of a Container based on the specified conditions, with the request unit enlarged as much as possible.Get the Row contents in accordance with the conditions included in the specified map, similar to invoking
Container.get(Object)
orQuery.fetch()
individually. However, unlike the case when carried out individually, the target node is requested for the same storage destination, etc. with a unit that is as large as possible. Based on this, the larger the total number of Rows conforming to the conditions and the larger the total number of target Containers, the higher is the possibility that the number of correspondences with the target node will be reduced.A specified map is composed of an arbitrary number of entries that adopt the Container name as the key and the acquisition condition represented by
RowKeyPredicate
as the value. Multiple instances with the sameRowKeyPredicate
can also be included. In addition, a subject Container may be a mixture of different Container types and column layouts. However, there are some acquisition conditions that cannot be evaluated due to the composition of the Container. Refer to the definitions of the various setting functions forRowKeyPredicate
for the specific restrictions. In addition, the specified Container name must be a real Container. The Container cannot includenull
as a key or value of the map.A returned map is composed of entries that adopt the Container name as its key and list of Row objects as its value. All the Container names included in a specified map as acquisition conditions are included in a returned map. If the same Container is specified and multiple entries in which Container names with different notations in uppercase and lowercase letters are set are included in a specified map, a single entry consolidating these is stored in the returned map. If multiple Row objects are included in the same list, the stored sequence follows the Container type and the definition of the sub-interface of the corresponding
Container
. If not a single Row corresponding to the specified Container exists, the list of corresponding Row objects is blank.When a returned map or list included in a map is updated, whether an exception will occur or not when
UnsupportedOperationException
, etc. is executed is still not defined.Like other Container or Row operations, consistency between Containers is not guaranteed. Therefore, the processing results for a certain Container may be affected by other operation commands that have been completed prior to the start of the process.
Like
Container.get(Object, boolean)
orQuery.fetch(boolean)
, a transaction cannot be maintained and requests for updating locks cannot be made.If the system tries to acquire a large number of Rows all at once, the upper limit of the communication buffer size managed by the GridDB node may be reached, possibly resulting in a failure. Refer to "System limiting values" in the GridDB API Reference for the upper limit size.
- Parameters:
containerPredicateMap
- Map made up of targeted Container names and conditions- Returns:
- Map that maintains Row groups conforming to the conditions by Container
- Throws:
GSException
- If the subject Container does not exist. If acquisition conditions concerning a specified Container that cannot be evaluated are specifiedGSException
- If this process or transaction times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException
- Ifnull
is specified as an argumentcontainerRowsPredicate
, ifnull
is included as a key or value of this map- See Also:
Container.get(Object)
,Query.fetch()
,RowKeyPredicate
-
multiPut
void multiPut(java.util.Map<java.lang.String,java.util.List<Row>> containerRowsMap) throws GSException
New creation or update operation is carried out on an arbitrary number of rows of a Container, with the request unit enlarged as much as possible.For each Row object included in a specified map, a new creation or update operation is carried out just like the case when
Container.put(Object)
is invoked individually. However, unlike the case when carried out individually, the target node is requested for the same storage destination, etc. with a unit that is as large as possible. Based on this, the larger the total number of Row objects specified and the larger the total number of target Containers, the higher is the possibility that the number of correspondences with the target node will be reduced.A specified map is composed of an arbitrary number of entries that adopt the Container name as its key and list of Row objects as its value. A subject Container may be a mixture of different Container types and column layouts. However, the Containers must already exist. The Container cannot include
null
as a key or value of the map.An arbitrary number of
Row
with the same column layout as the subject Container can be included in each list of Row objects. In the current version, all the column sequences must also be the same. The Container cannot includenull
as a component of the list.Depending on the Container type and setting, the same restrictions as
Container.put(Object)
are established for the contents of Rows that can be operated. Refer to the sub-interface definition ofContainer
for the specific restrictions.If there are multiple Row objects having the same Row key targeting the same Container in the designated map, the contents of the rear-most Row object having a Row key with the same value will be reflected using the take-out sequence from the iterator of the map entry group as a reference if it is between different lists, or the component sequence of the list as a reference if it is within the same list.
The transaction cannot be maintained and the lock cannot continue to be retained. However, if the lock that affects the target Row is secured by an existing transaction, the system will continue to wait for all the locks to be released.
Like other Container or Row operations, consistency between Containers is not guaranteed. Therefore, the processing results for a certain Container may be affected by other operation commands that have been completed prior to the start of the process.
If an exclusion occurs in the midst of processing a Container and its Rows, only the results for some of the Rows of some of the Containers may remain reflected.
- Parameters:
containerRowsMap
- A map made up of a list of Row objects and target Container names- Throws:
GSException
- If the target Container does not exist, or if the column layouts of the target Container and Row object do not matchGSException
- When an operation violating the restrictions unique to a specific Container type is carried outGSException
- If this process or transaction times out, a connection failure were to occur, or if it is invoked after being closed, or if a value outside the supported range is included in the Row objectjava.lang.NullPointerException
- Ifnull
is specified as an argumentcontainerRowsMap
, ifnull
is included as a key or value of this map, or ifnull
is included as a component of the list constituting the map- See Also:
Container.put(Object)
-
putCollection
<K,R> Collection<K,R> putCollection(java.lang.String name, java.lang.Class<R> rowType) throws GSException
Newly creates or update a Collection.If a Container with the specified name does not exist, it newly creates a Collection based on the Column layout defined by the specified class. If a Container with the specified name already exists and its whole Column layout matches the specified type, it behaves in the same way as
getCollection(String, Class)
, except that it waits for active transactions to complete.For the correspondence between a specified type and a Column layout, see the description of
Container
If a Collection with the specified name exists and if a transaction(s) is active in the Collection, it does the operation after waiting for the transaction(s) to complete.
- Parameters:
name
- Name of a Collection subject to processingrowType
- Type of Row object corresponding to the column layout of the Collection subject to processing- Returns:
- A
Collection
object created or updated - Throws:
GSException
- if a Collection with the specified name exists; or if the Column layout and additional settings conflict with the specified type with regard to the existing TimeSeries with the specified name.GSException
- if a timeout occurs during this operation or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- anull
parameter(s) is specified.
-
putCollection
<K,R> Collection<K,R> putCollection(java.lang.String name, java.lang.Class<R> rowType, boolean modifiable) throws GSException
Newly creates or update a Collection with the specified option.If a Container with the specified name does not exist, it newly creates a Collection based on the Column layout defined by the specified class. If a Collection with the specified name already exists and its whole Column layout matches the specified type, it behaves in the same way as
getCollection(String, Class)
, except that it waits for active transactions to complete.If
modifiable
istrue
and a Collection with the specified name exists, it changes its layout as necessary. When changing the layout, it leaves unchanged the existing Columns with the same name and type as defined by the specified class. If a Column name defined by the class is not found in the existing Collection, it creates a Column with the name; and it deletes other Columns in the existing Collection as well as their data. It fails if a Column with the same name but of a different type exists. It is not possible to create or delete a Column corresponding to a Row key.If a trigger is set in a Container, and if a column whose trigger is subject to notification is deleted due to a change in the column layout, the column will be deleted from the list of triggers subject to notification.
The values of Columns to be newly created are initialized according to the type as follows:
Column type Initial value STRING ""
(a string of length 0)BOOL ( false
)Numeric type 0
TIMESTAMP 1970-01-01T00:00:00Z
BLOB BLOB data of length 0 Array type An array with no element For the correspondence between a specified type and a Column layout, see the description of
Container
If a Collection with the specified name exists and if a transaction(s) is active in the Collection, it does the operation after waiting for the transaction(s) to complete.
When creating a Collection with Row key, an index of default type of the Row key which is defined by
Container.createIndex(String)
is created. The index is removable.- Parameters:
name
- Name of a Collection subject to processingrowType
- Type of Row object corresponding to the column layout of the Collection subject to processingmodifiable
- Indicates whether the column layout of the existing Collection can be changed or not- Returns:
- A
Collection
object created or updated - Throws:
GSException
- if a TimeSeries with the same name exists; or ifmodifiable
isfalse
and the Column layout of the existing Collection with the specified name conflicts with the requested layout; or ifmodifiable
istrue
and it attempted to change the unchangeable items in the existing Collection with the specified name.GSException
- if the specified type is not proper as a type of a Row object. For more information, see the description ofContainer
.GSException
- if a timeout occurs during this operation or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- if anull
parameter(s) is specified.
-
putCollection
<K> Collection<K,Row> putCollection(java.lang.String name, ContainerInfo info, boolean modifiable) throws GSException
SpecifyContainerInfo
and create a new Collection or update a Collection.Except for points where the Container type is limited to
ContainerType.COLLECTION
and the returned type isCollection
, the behavior will be the same asputContainer(String, ContainerInfo, boolean)
.- Parameters:
name
- Name of Collection subject to processinginfo
- Collection information subject to processing Specify eithernull
orContainerType.COLLECTION
in the Container typemodifiable
- To permit a change in the column layout of an existing Collection or not- Returns:
- Corresponding
Collection
. - Throws:
GSException
- If specifications other than the Container type do not conform to the rules ofputContainer(String, ContainerInfo, boolean)
. If the specifications do not conform to the restrictions related to the Container type as wellGSException
- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException
- Ifnull
is specified in the argumentinfo
- See Also:
putContainer(String, ContainerInfo, boolean)
-
putContainer
<K,R> Container<K,R> putContainer(java.lang.String name, java.lang.Class<R> rowType, ContainerInfo info, boolean modifiable) throws GSException
Specify the Row object type andContainerInfo
and create a new Container or update a Container.Mainly used when specifying the type of Row object and creating a new Container with additional settings.
Same as
putContainer(String, ContainerInfo, boolean)
if points for which the ignore setting of the column layout and column sequence cannot be specified are excluded.- Parameters:
name
- Name of a Container subject to processingrowType
- Type of Row object corresponding to the column layout of the Collection subject to processinginfo
- Information of a Container subject to processing. Ignored ifnull
is specifiedmodifiable
- To permit a change in the column layout of existing Container data or not- Returns:
- Corresponding
Container
. IfContainerType.COLLECTION
is specified as the Container type, the instance created will be aCollection
instance. IfContainerType.TIME_SERIES
is specified, the instance created will be aTimeSeries
instance. - Throws:
GSException
- If the contents of the argumentsname
andinfo
do not conform to the rules. If the contents also do not conform to the rules of the new Container creation and update method for the specified Container typeGSException
- If the specified type is not suitable as the Row object type. Refer to the definition ofContainer
for details.GSException
- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException
- If this process times out, a connection failure were to occur, or if it is invoked after being closed- See Also:
putContainer(String, ContainerInfo, boolean)
,putCollection(String, Class, boolean)
,putTimeSeries(String, Class, TimeSeriesProperties, boolean)
-
putContainer
<K> Container<K,Row> putContainer(java.lang.String name, ContainerInfo info, boolean modifiable) throws GSException
SpecifyContainerInfo
and create a new Container or update a Container.Excluding the next point, the behavior will be the same as
putCollection(String, Class, boolean)
orputTimeSeries(String, Class, TimeSeriesProperties, boolean)
.- Use
ContainerInfo
to specify the Container type, column layout, as well as the TimeSeries composition option where necessary - The Row object type of the
Container
returned will always beRow
modifiable
with the same respective name are used in the same way as well.A list of the methods to specify Container-related information is given below.
item argument description Container name name
orinfo
Specify a value that is not null
in at least one of the arguments. A different value must be specified when specifying both sides.Container type info
Specify a value that is not null
. IfContainerType.COLLECTION
is specified, the behavior will be the same asputCollection(String, Class, boolean)
. IfContainerType.TIME_SERIES
is specified, the behavior will be the same asputTimeSeries(String, Class, TimeSeriesProperties, boolean)
.column layout info
Set the ColumnInfo
list and whether there is any Row key so as to conform to the restrictions stipulated inContainer
.ignore column sequence info
If ignored, no verification of the conformance with the column sequence of existing Containers with the same name will be carried out. TimeSeries composition option info
A value that is not null
can be specified only if the Container type isContainerType.TIME_SERIES
.index setting info
Ignored in the current version. In future versions, if settings that do not conform to the rules of Container.createIndex(String, IndexType)
are included, an exception may be sent out.trigger setting info
Ignored in the current version. In future versions, if settings that do not conform to the rules of Container.createTrigger(TriggerInfo)
are included, an exception may be sent out.Container similarity info
The specified contents will be reflected if a setting other than null
is specified and newly created. The settings of an existing Container cannot be changed. The settings are ignored ifnull
is specified.- Parameters:
name
- Name of a Container subject to processinginfo
- Information of a Container subject to processingmodifiable
- To permit a change in the column layout of existing Container data or not- Returns:
- Corresponding
Container
. IfContainerType.COLLECTION
is specified as the Container type, the instance created will be aCollection
instance. IfContainerType.TIME_SERIES
is specified, the instance created will be aTimeSeries
instance. - Throws:
GSException
- If the contents of the argumentsname
andinfo
do not conform to the rules. If the contents also do not conform to the rules of the new Container creation and update method for the specified Container typeGSException
- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException
- Ifnull
is specified in the argumentinfo
- See Also:
putCollection(String, Class, boolean)
,putTimeSeries(String, Class, TimeSeriesProperties, boolean)
,Container
- Use
-
putTimeSeries
<R> TimeSeries<R> putTimeSeries(java.lang.String name, java.lang.Class<R> rowType) throws GSException
Newly creates or updates a TimeSeries.If a Container with the specified name does not exist, it newly creates a TimeSeries based on the Column layout defined by the specified class. If a TimeSeries with the specified name already exists and its whole Column layout matches the specified type, it behaves in the same way as
getTimeSeries(String, Class)
, except that it waits for active transactions to complete.For the correspondence between a specified type and a Column layout, see the description of
Container
.If a TimeSeries with the specified name exists and if a transaction(s) is active in the TimeSeries, it does the operation after waiting for the transaction(s) to complete.
- Parameters:
name
- Name of TimeSeries subject to processingrowType
- Type of Row object corresponding to the column layout of the TimeSeries subject to processing- Returns:
- A
TimeSeries
object created or updated - Throws:
GSException
- if a Collection with the same name exists; or if the Column layout and additional settings conflict with the specified type with regard to the existing TimeSeries with the specified name.GSException
- if the specified type is not proper as a type of a Row object. For more information, see the description ofContainer
.GSException
- if a timeout occurs during this operation or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- if anull
parameter(s) is specified.
-
putTimeSeries
<R> TimeSeries<R> putTimeSeries(java.lang.String name, java.lang.Class<R> rowType, TimeSeriesProperties props, boolean modifiable) throws GSException
Newly creates or updates a TimeSeries with the specified additional settings and update option.If a Container with the specified name does not exist, it newly creates a TimeSeries based on the Column layout and additional settings defined by the specified class. If a TimeSeries with the specified name already exists and its whole Column layout and additional settings match the specified type, it behaves in the same way as
getTimeSeries(String, Class)
, except that it waits for active transactions to complete.If
modifiable
istrue
and a TimeSeries with the specified name exists, it changes its layout as necessary. When changing the layout, it leaves unchanged the existing Columns with the same name and type as defined by the specified class. If a Column name defined by the class is not found in the existing TimeSeries, it creates a Column with the name; and it deletes other Columns in the existing Collection as well as their data. It fails if a Column with the same name but of a different type exists. It is not possible to create or delete a Column corresponding to a Row key or change the options for configuring a TimeSeries. When specifying some options for configuring a TimeSeries, specified values must be the same as the current settings.If a trigger is set in a Container, and if a column whose trigger is subject to notification is deleted due to a change in the column layout, the column will be deleted from the list of triggers subject to notification.
For the initial values for newly created Columns, see the description of
putCollection(String, Class, boolean)
.For the correspondence between a specified type and a Column layout, see the description of
Container
If a TimeSeries with the specified name exists and if a transaction(s) is active in the TimeSeries, it does the operation after waiting for the transaction(s) to complete.
- Parameters:
name
- Name of TimeSeries subject to processingrowType
- Type of Row object corresponding to the column layout of the TimeSeries subject to processingprops
- Composition option of TimeSeries. Ifnull
is specified, the existing settings will be inherited if a TimeSeries with the same name exists. If not, they will be deemed as specified in the initial status ofTimeSeriesProperties
.modifiable
- To permit a change in the column layout of an existing TimeSeries or not- Returns:
- A
TimeSeries
object to created or deleted - Throws:
GSException
- if a Collection with the same name exists; or ifmodifiable
isfalse
and the Column layout and additional settings conflict with the specified type with regard to the existing TimeSeries with the specified name; or ifmodifiable
istrue
and it attempted to change the unchangeable items in the existing TimeSeries with the specified name.GSException
- if the specified type is not proper as a type of a Row object. For more information, see the description ofContainer
.GSException
- if a timeout occurs during this operation or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- if anull
parameter(s) is specified.
-
putTimeSeries
TimeSeries<Row> putTimeSeries(java.lang.String name, ContainerInfo info, boolean modifiable) throws GSException
SpecifyContainerInfo
and create a new or update TimeSeries.Except for points where the Container type is limited to
ContainerType.TIME_SERIES
and the returned type isTimeSeries
, the behavior will be the same asputContainer(String, ContainerInfo, boolean)
.- Parameters:
name
- Name of TimeSeries subject to processinginfo
- Information of TimeSeries subject to processing. Specify eithernull
orContainerType.TIME_SERIES
in the Container typemodifiable
- To permit a change in the column layout of an existing TimeSeries or not- Returns:
- Corresponding
TimeSeries
- Throws:
GSException
- If specifications other than the Container type do not conform to the rules ofputContainer(String, ContainerInfo, boolean)
. If the specifications do not conform to the restrictions related to the Container type as wellGSException
- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException
- Ifnull
is specified in the argumentinfo
- See Also:
putContainer(String, ContainerInfo, boolean)
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.GridStoreFactory
-
- All Implemented Interfaces:
- java.io.Closeable, java.lang.AutoCloseable
public abstract class GridStoreFactory extends java.lang.Object implements java.io.Closeable
Manages aGridStore
instance.It manages the client settings shared by
GridStore
instances and used connections.To access GridDB, you need to get a
GridStore
instance using this Factory.All the public methods of this class are thread safe.
Client Logging and Client Properties File are available.
Client Logging
Logging is enabled by adding the logging library SLF4J to the classpath.
The name of the logger begins with "com.toshiba.mwcloud.gs.GridStoreLogger". The recommended version of SLF4J is 1.6.0 or above.
Client Properties File
By including both of the directory including the properties file "gs_client.properties" and the configuration library "gridstore-conf.jar" in the classpath, properties of the file are applied to GridStoreFactory. Connection properties can be changed without editing application codes by using the properties file. The priority of applying the properties of the file is higher than the properties of Properties object. The following properties are available for the Client Properties File.
- Factory Category Property
- Properties conform to
setProperties(Properties)
specifications are available. - Add "factory." before each property name as following.
factory.maxConnectionPoolSize = 10
- Store Category Property
- Properties conform to
getGridStore(Properties)
specifications are available. - Add "store." before each property name as following.
store.clusterName = Project1
-
Exceptions will be thrown in the cases as following.
- If two or more directories of the properties files are included in the classpath
- If only the configuration library is included in the classpath
- If an unavailable property name is specified
- If a specified property name is made up of only the category name
By including only the directory including the properties file, properties of the file are not applied to GridStoreFactory.
-
-
Constructor Summary
Constructors Modifier Constructor and Description protected
GridStoreFactory()
-
Method Summary
Methods Modifier and Type Method and Description abstract void
close()
Closes allGridStore
instances created by this Factory and release related resources as necessary.abstract GridStore
getGridStore(java.util.Properties properties)
Returns aGridStore
with the specified properties.static GridStoreFactory
getInstance()
Returns a default instance.abstract void
setProperties(java.util.Properties properties)
Changes the settings for this Factory.
-
-
-
Method Detail
-
close
public abstract void close() throws GSException
Closes allGridStore
instances created by this Factory and release related resources as necessary.Even if
GSException
is thrown, all related connection resources are released. If the connection is already closed, this method will not work effectively. It is also called when stopping the current VM.- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
GSException
- if an connection failure etc. occurs while closing.- See Also:
Closeable.close()
-
getGridStore
public abstract GridStore getGridStore(java.util.Properties properties) throws GSException
Returns aGridStore
with the specified properties.When obtaining
GridStore
, it just searches for the name of a master node (hereafter, a master) administering eachContainer
as necessary, but authentication is not performed. When a client really needs to connect to a node corresponding to each Container, authentication is performed.The following properties can be specified. Unsupported property names are ignored. See "System limiting values" in the GridDB API Reference for upper limit values of some properties.
Property Description host A destination host name. An IP address (IPV4 only) is also available. Mandatory for manually setting a master. For autodetection of a master, omit the setting. port A destination port number. A string representing of a number from 0
to65535
. Mandatory for manually setting a master. For autodetection of a master, omit the setting.notificationAddress An IP address (IPV4 only) for receiving a notification used for autodetection of a master. A default address is used if omitted. notificationPort A port number for receiving a notification used for autodetection of a master. A string representing of a number from 0
to65535
. A default port number is used if omitted.clusterName A cluster name. It is used to verify whether it matches the cluster name assigned to the destination cluster. If it is omitted or an empty string is specified, cluster name verification is not performed. If a cluster name of over the upper length limit is specified, connection to the cluster node will fail. user A user name password A password for user authentication consistency Either one of the following consistency levels: "IMMEDIATE"
- The updates by other clients are committed immediately after a relevant transaction completes.
"EVENTUAL"
- The updates by other clients may not be
committed even after a relevant transaction completes. No update operation
cannot be applied to
Container
.
transactionTimeout The minimum value of transaction timeout time. The transaction timeout is counted from the beginning of each transaction in a relevant Container
. A string representing of a number from0
toInteger.MAX_VALUE
in seconds. The value0
indicates that it is always uncertain whether a timeout error will occur during a subsequent transaction. If a value specified over the internal upper limit of timeout, timeout will occur at the internal upper limit value. If omitted, the default value used by a destination GridDB is applied.failoverTimeout The minimum value of waiting time until a new destination is found in a failover. A numeric string representing from 0
toInteger.MAX_VALUE
in seconds. The value0
indicates that no failover is performed. If omitted, the default value used by this Factory is applied.containerCacheSize The maximum number of ContainerInfos on the Container cache. A string representing of a number from 0
toInteger.MAX_VALUE
. The Container cache is not used if the value is0
. To obtain aContainer
, its ContainerInfo might be obtained from the Container cache instead of request to GridDB. A default number is used if omitted.dataAffinityPattern Patterns of Container names and data affinity strings in order to set data affinity strings to their Container
s automatically. Format is as following.(ContainerNamePattern1)=(DataAffinityString1),(ContainerNamePattern2)=(DataAffinityString2),...
The dataAffinityPattern is applied to the new Container when it is created with the ContainerInfo which does not include a data affinity string. If a Container name matches one of the ContainerNamePattern of the dataAffinityPattern, the corresponding data affinity string is applied to the new Container. The priority order of matching and applying patterns is the order of specified patterns. ContainerNamePatterns maintain the general contract for Container names, except a wild card character "%" is also acceptable additionally. Data affinity patterns maintain the general contract forContainerInfo.setDataAffinity(String)
.A new
GridStore
instance is created by each call of this method. Operations on differentGridStore
instances and related objects are thread safe. That is, if some two objects are each created based onGridStore
instances or they are justGridStore
instances, and if they are related to differentGridStore
instances respectively, any method of one object can be called, no matter when a method of the other object may be called from any thread. However, since thread safety is not guaranteed forGridStore
itself, it is not allowed to call a method of a singleGridStore
instance from two or more threads at an arbitrary time.- Parameters:
properties
- Properties specifying the settings for the object to be obtained.- Throws:
GSException
- if host name resolution fails.GSException
- if any specified property does not match the format shown above. If the properties match the format, no GSException is thrown even if connection or authentication will not succeed with their values.GSException
- if the connection is closed.java.lang.NullPointerException
-null
is specified asproperties
.
-
getInstance
public static GridStoreFactory getInstance()
Returns a default instance.When loading this class, a default subclass of the
GridStoreFactory
class is loaded and an instance is created.
-
setProperties
public abstract void setProperties(java.util.Properties properties) throws GSException
Changes the settings for this Factory.The changed settings are reflected in
GridStore
already created by this Factory andGridStore
to be created by this Factory later.The following properties can be specified. Unsupported property names are ignored.
Property Description maxConnectionPoolSize The maximum number of connections in the connection pool used inside. A numeric string representing 0
toInteger.MAX_VALUE
. The value0
indicates no use of the connection pool. If omitted, the default value is used.failoverTimeout The minimum value of waiting time until a new destination is found in a failover. A numeric string representing 0
toInteger.MAX_VALUE
in seconds. The value0
indicates that no failover is performed. If omitted, the default value is used.- Throws:
GSException
- if any specified property does not match the format shown above.GSException
- if the connection is closed.java.lang.NullPointerException
-null
is specified asproperties
.
-
-
- java.lang.Object
-
- java.lang.Enum<IndexType>
-
- com.toshiba.mwcloud.gs.IndexType
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description HASH
Indicates a hash index.SPATIAL
Not supportedTREE
Indicates a tree index.
-
Method Summary
Methods Modifier and Type Method and Description static IndexType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static IndexType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
HASH
public static final IndexType HASH
Indicates a hash index.This type of index can be set on the following types of Columns in
Collection
- STRING
- BOOL
- BYTE
- SHORT
- INTEGER
- LONG
- FLOAT
- DOUBLE
- TIMESTAMP
TimeSeries
.
-
SPATIAL
public static final IndexType SPATIAL
Not supported
-
-
Method Detail
-
valueOf
public static IndexType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static IndexType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (IndexType c : IndexType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
- java.lang.Object
-
- java.lang.Enum<InterpolationMode>
-
- com.toshiba.mwcloud.gs.InterpolationMode
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<InterpolationMode>
public enum InterpolationMode extends java.lang.Enum<InterpolationMode>
Represents the type of interpolation of Rows.It is used by the function of interpolating TimeSeries Rows.
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description EMPTY
Indicates using an empty value as an interpolated value.LINEAR_OR_PREVIOUS
Indicates performing linear interpolation or interpolation with the value of a privious Row on Columns.
-
Method Summary
Methods Modifier and Type Method and Description static InterpolationMode
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static InterpolationMode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
EMPTY
public static final InterpolationMode EMPTY
Indicates using an empty value as an interpolated value.It indicates that an empty value defined for each type is used as an interpolated value for all Row fields except Row keys. The empty value is the same as the initial value of a Column newly created when changing a Column layout using
GridStore.putCollection(String, Class, boolean)
.
-
LINEAR_OR_PREVIOUS
public static final InterpolationMode LINEAR_OR_PREVIOUS
Indicates performing linear interpolation or interpolation with the value of a privious Row on Columns.The Column specified the interpolation function is linearly interpolated with the Row values before and after the target time of interpolation. The target Column must be of numeric type.
The Columns not specified as interpolation targets are interpolated with adjacent Row values just before the target time of interpolation. Those Columns can be of any type.
-
-
Method Detail
-
valueOf
public static InterpolationMode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static InterpolationMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (InterpolationMode c : InterpolationMode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
-
- All Superinterfaces:
- java.lang.AutoCloseable, java.io.Closeable
public interface PartitionController extends java.io.Closeable
Controller for acquiring and processing the partition status.A partition is a theoretical region where data is stored. It is used to perform operations based on the data arrangement in a GridDB cluster.
-
-
Method Summary
Methods Modifier and Type Method and Description void
assignPreferableHost(int partitionIndex, java.net.InetAddress host)
Set the address of the host to be prioritized in the selection.void
close()
The connection status with GridDB is released and related resources are released where necessary.java.util.List<java.net.InetAddress>
getBackupHosts(int partitionIndex)
Get a list of the addresses of the backup nodes corresponding to a specified partition.long
getContainerCount(int partitionIndex)
Get the total number of containers belonging to a specified partition.java.util.List<java.lang.String>
getContainerNames(int partitionIndex, long start, java.lang.Long limit)
Get a list of the Container names belonging to a specified partition.java.util.List<java.net.InetAddress>
getHosts(int partitionIndex)
Get a list of the addresses of the nodes corresponding to a specified partition.java.net.InetAddress
getOwnerHost(int partitionIndex)
Get the address of the owner node corresponding to a specified partition.int
getPartitionCount()
Get the number of partitions in the target GridDB cluster.int
getPartitionIndexOfContainer(java.lang.String containerName)
Get the partition index corresponding to the specified Container name.
-
-
-
Method Detail
-
assignPreferableHost
void assignPreferableHost(int partitionIndex, java.net.InetAddress host) throws GSException
Set the address of the host to be prioritized in the selection.If multiple possible destinations exist e.g. connections to backup nodes, etc., the address set will always be selected if it is included in the candidate destination. The setting is ignored otherwise.
- Parameters:
partitionIndex
- Partition index. A value of0
or above and less than the number of partitions.host
- Address of the host to be prioritized in the selection. Fornull
, the setting is cancelled- Throws:
GSException
- If a partition index outside the range is specifiedGSException
- If invoked after this object or correspondingGridStore
is closed.- See Also:
getBackupHosts(int)
-
close
void close() throws GSException
The connection status with GridDB is released and related resources are released where necessary.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
GSException
- Not sent out in the current version
-
getBackupHosts
java.util.List<java.net.InetAddress> getBackupHosts(int partitionIndex) throws GSException
Get a list of the addresses of the backup nodes corresponding to a specified partition.A backup node is a node that is selected with a higher priority when
"EVENTUAL"
is specified as a consistency level inGridStoreFactory.getGridStore(java.util.Properties)
.The list will be compiled in no particular order. No duplicate address will be included.
When a returned list is updated, whether an exception will occur or not when
UnsupportedOperationException
, etc. is executed is still not defined.- Parameters:
partitionIndex
- Partition index. A value of0
or above and less than the number of partitions.- Returns:
- Assuming
InetAddress
, which represents the address of the backup node, as a component,List
- Throws:
GSException
- If a partition index outside the range is specifiedGSException
- If this process times out, when a connection error occurs, or if the process is invoked after this object or correspondingGridStore
is closed
-
getContainerCount
long getContainerCount(int partitionIndex) throws GSException
Get the total number of containers belonging to a specified partition.The calculated quantity when determining the number of containers is generally not dependent on the number of containers.
- Parameters:
partitionIndex
- Partition index. A value of0
or above and less than the number of partitions.- Returns:
- Number of containers
- Throws:
GSException
- If a partition index outside the range is specifiedGSException
- If this process times out, when a connection error occurs, or if the process is invoked after this object or correspondingGridStore
is closed- See Also:
getPartitionIndexOfContainer(String)
-
getContainerNames
java.util.List<java.lang.String> getContainerNames(int partitionIndex, long start, java.lang.Long limit) throws GSException
Get a list of the Container names belonging to a specified partition.For the specified partition, the sequence of the list of acquisition results before and after will not be changed when the relevant Container is excluded even if a Container is newly created, its composition changed or the Container is deleted. All other lists are compiled in no particular order. No duplicate names will be included.
If the upper limit of the number of acquisition cases is specified, the cases will be cut off starting from the ones at the back if the upper limit is exceeded. If no relevant specified condition exists, a blank list is returned.
When a returned list is updated, whether an exception will occur or not when
UnsupportedOperationException
, etc. is executed is still not defined.- Parameters:
partitionIndex
- Partition index. A value of0
or above and less than the number of partitions.start
- Start position of the acquisition range. A value of0
and abovelimit
- Upper limit of the number of cases acquired. Ifnull
, no upper limit is assumed- Returns:
- Assuming the Container name as a component
List
- Throws:
GSException
- If a partition index outside the range is specifiedGSException
- If this process times out, when a connection error occurs, or if the process is invoked after this object or correspondingGridStore
is closed
-
getHosts
java.util.List<java.net.InetAddress> getHosts(int partitionIndex) throws GSException
Get a list of the addresses of the nodes corresponding to a specified partition.The list will be compiled in no particular order. No duplicate address will be included.
When a returned list is updated, whether an exception will occur or not when
UnsupportedOperationException
, etc. is executed is still not defined.- Parameters:
partitionIndex
- Partition index. A value of0
or above and less than the number of partitions.- Returns:
- Assuming
InetAddress
, which represents the address of the node, as a component,List
- Throws:
GSException
- If a partition index outside the range is specifiedGSException
- If this process times out, when a connection error occurs, or if the process is invoked after this object or correspondingGridStore
is closed
-
getOwnerHost
java.net.InetAddress getOwnerHost(int partitionIndex) throws GSException
Get the address of the owner node corresponding to a specified partition.An owner node is a node that is always selected when
"IMMEDIATE"
is specified as a consistency level inGridStoreFactory.getGridStore(java.util.Properties)
.- Parameters:
partitionIndex
- Partition index. A value of0
or above and less than the number of partitions.- Returns:
- Represents the address of the owner node
InetAddress
- Throws:
GSException
- If a partition index outside the range is specifiedGSException
- If this process times out, when a connection error occurs, or if the process is invoked after this object or correspondingGridStore
is closed
-
getPartitionCount
int getPartitionCount() throws GSException
Get the number of partitions in the target GridDB cluster.Get the value of the number of partitions set in the target GridDB cluster. Results are cached once acquired and until the next cluster failure and cluster node failure is detected, no inquiry will be sent to the GridDB cluster again.
- Returns:
- Number of partitions
- Throws:
GSException
- If this process times out or when a connection error occurs, or if the process is invoked after this object or correspondingGridStore
is closed
-
getPartitionIndexOfContainer
int getPartitionIndexOfContainer(java.lang.String containerName) throws GSException
Get the partition index corresponding to the specified Container name.Once a GridDB cluster is constructed, there will not be any changes in the partitions of the destination that the Container belongs to and the partition index will also be fixed. Whether there is a Container corresponding to the specified name or not does not depend on the results
Information required in the computation of the partition index is cached and until the next cluster failure and cluster node failure is detected, no inquiry will be sent to the GridDB cluster again.
- Parameters:
containerName
- Container name.null
cannot be specified- Returns:
- Partition index corresponding to the specified Container name
- Throws:
GSException
- If a character string allowed as a Container name is specifiedGSException
- If this process times out, when a connection error occurs, or if the process is invoked after this object or correspondingGridStore
is closedjava.lang.NullPointerException
- Ifnull
is specified in the argument
-
-
-
- Type Parameters:
R
- the type ofRowSet
elements to be obtained
- All Superinterfaces:
- java.lang.AutoCloseable, java.io.Closeable
public interface Query<R> extends java.io.Closeable
Provides the functions of holding the information about a query related to a specificContainer
, specifying the options for fetching and retrieving the result.
-
-
Method Summary
Methods Modifier and Type Method and Description void
close()
Releases related resources properly.RowSet<R>
fetch()
Executes a query and returns a set of Rows as an execution result.RowSet<R>
fetch(boolean forUpdate)
Executes a query with the specified option and returns a set of Rows as an execution result.RowSet<R>
getRowSet()
ReturnsRowSet
of the latest result.void
setFetchOption(FetchOption option, java.lang.Object value)
Sets an option for a result set.
-
-
-
Method Detail
-
close
void close() throws GSException
Releases related resources properly.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
GSException
- not be thrown in the current version.- See Also:
Closeable.close()
-
fetch
RowSet<R> fetch() throws GSException
Executes a query and returns a set of Rows as an execution result.It behaves in the same way as
fetch(boolean)
is called without requesting a lock for update.- Throws:
GSException
- if the target query contains any wrong parameter, syntax, or directive. For example, in the case of TQL, if the type of a specified Column does not match the parameter of a function. For detailed restrictions, see the descriptions of the functions to create a query.GSException
- if the requested type ofRowSet
elements does not match the type of the result set in executing a TQL query.GSException
- if a timeout occurs during this operation or its related transaction, the relevant Container is deleted, its schema is changed or a connection failure occurs.GSException
- if called after this object or the relevantContainer
is closed.java.lang.NullPointerException
- if an unsupportednull
parameter is specified when creating this query. It will not be thrown as a result of evaluating a TQL statement in GridDB.- See Also:
fetch(boolean)
-
fetch
RowSet<R> fetch(boolean forUpdate) throws GSException
Executes a query with the specified option and returns a set of Rows as an execution result.It locks all target Rows if
true
is specified asforUpdate
. If the target Rows are locked, update operations on the Rows by any other transactions are blocked while a relevant transaction is active. TRUE can be specified only if the autocommit mode is disabled on a relevant Container.If it is called to obtain new Rows,
RowSet
of the last result of this query will be closed.It will be failed if too much Rows are obtained, because of the data buffer size upper limit of GridDB node. See "System limiting values" in the GridDB API Reference about the buffer size upper limit.
- Throws:
GSException
- iftrue
is specified asforUpdate
although the autocommit mode is enabled on a relevant Container.GSException
- iftrue
is specified asforUpdate
for a query which cannot acquire a lock. For the availability of a lock, see the descriptions of the functions to create a query.GSException
- if the target query contains any wrong parameter, syntax, or directive. For example, in the case of TQL, if the type of a specified Column does not match the parameter of a function. For detailed restrictions, see the descriptions of the functions to create a query.GSException
- if the requested type ofRowSet
elements does not match the type of the result set in executing a TQL query.GSException
- if a timeout occurs during this operation or its related transaction, the relevant Container is deleted, its schema is changed or a connection failure occurs.GSException
- if called after this object or the relevantContainer
is closed.java.lang.NullPointerException
- if an unsupportednull
parameter is specified when creating this query.
-
getRowSet
RowSet<R> getRowSet() throws GSException
ReturnsRowSet
of the latest result.After
RowSet
returned once, it returnsnull
until the new query is executed.- Returns:
RowSet
of the latest result at the first time, ornull
from the second time or no query executed before.- Throws:
GSException
- if called after this object or the relevantContainer
is closed.
-
setFetchOption
void setFetchOption(FetchOption option, java.lang.Object value) throws GSException
Sets an option for a result set.See
FetchOption
for the definitions of supported option items and values.- Parameters:
option
- an option itemvalue
- an option value- Throws:
GSException
- if the specified option value is invalid for the specified option item.GSException
- if called after this object or the relevantContainer
is closed.java.lang.NullPointerException
- if anull
parameter(s) is specified.- See Also:
FetchOption
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.QueryAnalysisEntry
-
public class QueryAnalysisEntry extends java.lang.Object
Represents one of information entries composing a query plan and the results of analyzing a query operation.It is used to hold the result of executing an EXPLAIN statement or an EXPLAIN ANALYZE statement in TQL. One execution result is represented by an array of entries.
-
-
Constructor Summary
Constructors Constructor and Description QueryAnalysisEntry()
-
Method Summary
Methods Modifier and Type Method and Description boolean
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.int
getDepth()
Returns the depth indicating the relation to other entries.int
getId()
Returns the ID indicating the location of an entry in an array of entries.java.lang.String
getStatement()
Returns a part of a TQL statement corresponding to the information indicated by an entry.java.lang.String
getType()
Returns the type of the information indicated by an entry.java.lang.String
getValue()
Returns a character string representing the value of the information indicated by an entry.java.lang.String
getValueType()
Returns the value type of the information indicated by an entry.int
hashCode()
Returns hash code of this object.void
setDepth(int depth)
Sets the depth indicating the relation to other entries.void
setId(int id)
Sets the ID indicating the location of an entry in an array of entries.void
setStatement(java.lang.String statement)
Sets a part of a TQL statement corresponding to the information indicated by an entry.void
setType(java.lang.String type)
Sets the type of the information indicated by an entry.void
setValue(java.lang.String value)
Sets a character string representing the value of the information indicated by an entry.void
setValueType(java.lang.String valueType)
Sets the value type of the information indicated by an entry.
-
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.Returns true if each values (e.g. valuse returned by
getId()
orgetDepth()
) of this object and the specified object are equivalent.This method maintain the general contract for the
Object.hashCode()
method, which states that equal objects must have equal hash codes.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the reference object with which to compare.- Returns:
true
if this object is the same as theobj
argument;false
otherwise.- See Also:
hashCode()
-
getDepth
public int getDepth()
Returns the depth indicating the relation to other entries.If there is found an entry whose depth is smaller than that of a target entry by one, through checking entries one by one whose IDs are smaller than that of the target entry, it means that the target entry describes the content of the found entry in more detail.
-
getId
public int getId()
Returns the ID indicating the location of an entry in an array of entries.In a result set of executing a TQL query, IDs are assigned serially starting from
1
.
-
getStatement
public java.lang.String getStatement()
Returns a part of a TQL statement corresponding to the information indicated by an entry.Returns an empty string if no correspondence is found.
-
getType
public java.lang.String getType()
Returns the type of the information indicated by an entry.A returned value indicates the type of an analysis result (e.g., execution time), the type of a component of a query plan, etc.
-
getValue
public java.lang.String getValue()
Returns a character string representing the value of the information indicated by an entry.It returns an empty string if no value is assigned.
- See Also:
getValueType()
-
getValueType
public java.lang.String getValueType()
Returns the value type of the information indicated by an entry.It returns the value type of an analysis result (e.g., execution time) etc. The following types (primitive types defined by TQL) are supported:
- STRING
- BOOL
- BYTE
- SHORT
- INTEGER
- LONG
- FLOAT
- DOUBLE
It returns an empty string if no value is assigned.
-
hashCode
public int hashCode()
Returns hash code of this object.This method maintain the general contract for the
Object.hashCode()
method, which states that equal objects must have equal hash codes.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hash code of this object
- See Also:
equals(Object)
-
setDepth
public void setDepth(int depth)
Sets the depth indicating the relation to other entries.- See Also:
getDepth()
-
setId
public void setId(int id)
Sets the ID indicating the location of an entry in an array of entries.- See Also:
getId()
-
setStatement
public void setStatement(java.lang.String statement)
Sets a part of a TQL statement corresponding to the information indicated by an entry.- See Also:
getStatement()
-
setType
public void setType(java.lang.String type)
Sets the type of the information indicated by an entry.- See Also:
getType()
-
setValue
public void setValue(java.lang.String value)
Sets a character string representing the value of the information indicated by an entry.- See Also:
getValue()
-
setValueType
public void setValueType(java.lang.String valueType)
Sets the value type of the information indicated by an entry.- See Also:
getValueType()
-
-
- java.lang.Object
-
- java.lang.Enum<QueryOrder>
-
- com.toshiba.mwcloud.gs.QueryOrder
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<QueryOrder>
public enum QueryOrder extends java.lang.Enum<QueryOrder>
Represents the order of Rows requested by a query.It is used to specify the order of Rows targeted by each query function. Specific targets differ with individual functions.
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description ASCENDING
Indicates the requested order of Rows is an ascending order.DESCENDING
Indicates the requested order of Rows is a descending order.
-
Method Summary
Methods Modifier and Type Method and Description static QueryOrder
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static QueryOrder[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ASCENDING
public static final QueryOrder ASCENDING
Indicates the requested order of Rows is an ascending order.
-
DESCENDING
public static final QueryOrder DESCENDING
Indicates the requested order of Rows is a descending order.
-
-
Method Detail
-
valueOf
public static QueryOrder valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static QueryOrder[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (QueryOrder c : QueryOrder.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
-
public interface Row
A general-purpose Row for managing fields in any schema.
-
-
Method Summary
Methods Modifier and Type Method and Description java.sql.Blob
getBlob(int column)
Returns the Blob value of the specified field.boolean
getBool(int column)
Returns the boolean value of the specified field.boolean[]
getBoolArray(int column)
Returns the boolean array value of the specified field.byte
getByte(int column)
Returns the byte value of the specified field.byte[]
getByteArray(int column)
Returns the byte array value of the specified field.double
getDouble(int column)
Returns the double value of the specified field.double[]
getDoubleArray(int column)
Returns the double array value of the specified field.float
getFloat(int column)
Returns the float value of the specified field.float[]
getFloatArray(int column)
Returns the byte float value of the specified field.Geometry
getGeometry(int column)
Returns the Geometry value of the specified field.int
getInteger(int column)
Returns the int value of the specified field.int[]
getIntegerArray(int column)
Returns the int array value of the specified field.long
getLong(int column)
Returns the long value of the specified field.long[]
getLongArray(int column)
Returns the long array value of the specified field.ContainerInfo
getSchema()
Returns the schema corresponding to the specified Row.short
getShort(int column)
Returns the short value of the specified field.short[]
getShortArray(int column)
Returns the short array value of the specified field.java.lang.String
getString(int column)
Returns the String value of the specified field.java.lang.String[]
getStringArray(int column)
Returns the String array value of the specified field.java.util.Date
getTimestamp(int column)
Returns the TIMESTAMP value of the specified field.java.util.Date[]
getTimestampArray(int column)
Returns the TIMESTAMP array value of the specified field.java.lang.Object
getValue(int column)
Returns the value of the specified field.void
setBlob(int column, java.sql.Blob fieldValue)
Sets the Blob value to the specified field.void
setBool(int column, boolean fieldValue)
Sets the boolean value to the specified field.void
setBoolArray(int column, boolean[] fieldValue)
Sets the boolean array value to the specified field.void
setByte(int column, byte fieldValue)
Sets the byte value to the specified field.void
setByteArray(int column, byte[] fieldValue)
Sets the byte array value to the specified field.void
setDouble(int column, double fieldValue)
Sets the double value to the specified field.void
setDoubleArray(int column, double[] fieldValue)
Sets the double array value to the specified field.void
setFloat(int column, float fieldValue)
Sets the float value to the specified field.void
setFloatArray(int column, float[] fieldValue)
Sets the float array value to the specified field.void
setGeometry(int column, Geometry fieldValue)
Sets the Geometry value to the specified field.void
setInteger(int column, int fieldValue)
Sets the int value to the specified field.void
setIntegerArray(int column, int[] fieldValue)
Sets the int array value to the specified field.void
setLong(int column, long fieldValue)
Sets the long value to the specified field.void
setLongArray(int column, long[] fieldValue)
Sets the long array value to the specified field.void
setShort(int column, short fieldValue)
Sets the short value to the specified field.void
setShortArray(int column, short[] fieldValue)
Sets the short array value to the specified field.void
setString(int column, java.lang.String fieldValue)
Sets the String value to the specified field.void
setStringArray(int column, java.lang.String[] fieldValue)
Sets the String array value to the specified field.void
setTimestamp(int column, java.util.Date fieldValue)
Sets the TIMESTAMP value to the specified field.void
setTimestampArray(int column, java.util.Date[] fieldValue)
Sets the TIMESTAMP array value to the specified field.void
setValue(int column, java.lang.Object fieldValue)
Sets the value to the specified field.
-
-
-
Method Detail
-
getBlob
java.sql.Blob getBlob(int column) throws GSException
Returns the Blob value of the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed. Moreover, after an object is returned, updating this object will not change the contents of the returned object.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getBool
boolean getBool(int column) throws GSException
Returns the boolean value of the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getBoolArray
boolean[] getBoolArray(int column) throws GSException
Returns the boolean array value of the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed. Moreover, after an object is returned, updating this object will not change the contents of the returned object.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getByte
byte getByte(int column) throws GSException
Returns the byte value of the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getByteArray
byte[] getByteArray(int column) throws GSException
Returns the byte array value of the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed. Moreover, after an object is returned, updating this object will not change the contents of the returned object.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getDouble
double getDouble(int column) throws GSException
Returns the double value of the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getDoubleArray
double[] getDoubleArray(int column) throws GSException
Returns the double array value of the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed. Moreover, after an object is returned, updating this object will not change the contents of the returned object.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getFloat
float getFloat(int column) throws GSException
Returns the float value of the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getFloatArray
float[] getFloatArray(int column) throws GSException
Returns the byte float value of the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed. Moreover, after an object is returned, updating this object will not change the contents of the returned object.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getGeometry
Geometry getGeometry(int column) throws GSException
Returns the Geometry value of the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getInteger
int getInteger(int column) throws GSException
Returns the int value of the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getIntegerArray
int[] getIntegerArray(int column) throws GSException
Returns the int array value of the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed. Moreover, after an object is returned, updating this object will not change the contents of the returned object.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getLong
long getLong(int column) throws GSException
Returns the long value of the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getLongArray
long[] getLongArray(int column) throws GSException
Returns the long array value of the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed. Moreover, after an object is returned, updating this object will not change the contents of the returned object.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getSchema
ContainerInfo getSchema() throws GSException
Returns the schema corresponding to the specified Row.It returns
ContainerInfo
in which only the Column layout information including the existance of anyRowKey
is set, and the Container name, the Container type, index settings, and the TimeSeries configuration options are not included.- Returns:
ContainerInfo
having only container information related to the schema.- Throws:
GSException
- This will not be thrown in the current version.
-
getShort
short getShort(int column) throws GSException
Returns the short value of the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getShortArray
short[] getShortArray(int column) throws GSException
Returns the short array value of the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed. Moreover, after an object is returned, updating this object will not change the contents of the returned object.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getString
java.lang.String getString(int column) throws GSException
Returns the String value of the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getStringArray
java.lang.String[] getStringArray(int column) throws GSException
Returns the String array value of the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed. Moreover, after an object is returned, updating this object will not change the contents of the returned object.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getTimestamp
java.util.Date getTimestamp(int column) throws GSException
Returns the TIMESTAMP value of the specified field.If the contents of a specified object is changed after it has been invoked, it is not defined whether the contents of this object will be changed or not. Moreover, after an object is returned, updating this object will not change the contents of the returned object.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getTimestampArray
java.util.Date[] getTimestampArray(int column) throws GSException
Returns the TIMESTAMP array value of the specified field.If the contents of a specified object is changed after it has been invoked, it is not defined whether the contents of this content will be changed or not On the otherhand, the contents of the returned object will not be changed by operating this object.
An effect of updates of the returned object to this object is uncertain. Moreover, after an object is returned, updating this object will not change the contents of the returned object.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
getValue
java.lang.Object getValue(int column) throws GSException
Returns the value of the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.- Returns:
- the value of the target field
- Throws:
GSException
- if the specified Column number is out of range.
-
setBlob
void setBlob(int column, java.sql.Blob fieldValue) throws GSException
Sets the Blob value to the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value.GSException
- if the type of the specified field does not match the type of the Column.
-
setBool
void setBool(int column, boolean fieldValue) throws GSException
Sets the boolean value to the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
setBoolArray
void setBoolArray(int column, boolean[] fieldValue) throws GSException
Sets the boolean array value to the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value.GSException
- if the type of the specified field does not match the type of the Column.
-
setByte
void setByte(int column, byte fieldValue) throws GSException
Sets the byte value to the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
setByteArray
void setByteArray(int column, byte[] fieldValue) throws GSException
Sets the byte array value to the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value.GSException
- if the type of the specified field does not match the type of the Column.
-
setDouble
void setDouble(int column, double fieldValue) throws GSException
Sets the double value to the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
setDoubleArray
void setDoubleArray(int column, double[] fieldValue) throws GSException
Sets the double array value to the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value.GSException
- if the type of the specified field does not match the type of the Column.
-
setFloat
void setFloat(int column, float fieldValue) throws GSException
Sets the float value to the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
setFloatArray
void setFloatArray(int column, float[] fieldValue) throws GSException
Sets the float array value to the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value.GSException
- if the type of the specified field does not match the type of the Column.
-
setGeometry
void setGeometry(int column, Geometry fieldValue) throws GSException
Sets the Geometry value to the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value.GSException
- if the type of the specified field does not match the type of the Column.
-
setInteger
void setInteger(int column, int fieldValue) throws GSException
Sets the int value to the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
setIntegerArray
void setIntegerArray(int column, int[] fieldValue) throws GSException
Sets the int array value to the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value.GSException
- if the type of the specified field does not match the type of the Column.
-
setLong
void setLong(int column, long fieldValue) throws GSException
Sets the long value to the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
setLongArray
void setLongArray(int column, long[] fieldValue) throws GSException
Sets the long array value to the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value.GSException
- if the type of the specified field does not match the type of the Column.
-
setShort
void setShort(int column, short fieldValue) throws GSException
Sets the short value to the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- if the type of the specified field does not match the type of the Column.
-
setShortArray
void setShortArray(int column, short[] fieldValue) throws GSException
Sets the short array value to the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value.GSException
- if the type of the specified field does not match the type of the Column.
-
setString
void setString(int column, java.lang.String fieldValue) throws GSException
Sets the String value to the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value.GSException
- if the type of the specified field does not match the type of the Column.
-
setStringArray
void setStringArray(int column, java.lang.String[] fieldValue) throws GSException
Sets the String array value to the specified field.If the contents of a specified object is changed after it has been invoked, the contents of this object will not be changed.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value or its element.GSException
- if the type of the specified field does not match the type of the Column.
-
setTimestamp
void setTimestamp(int column, java.util.Date fieldValue) throws GSException
Sets the TIMESTAMP value to the specified field.If the contents of a specified object is changed after it has been invoked, it is not defined whether the contents of this object will be changed or not.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value.GSException
- if the type of the specified field does not match the type of the Column.
-
setTimestampArray
void setTimestampArray(int column, java.util.Date[] fieldValue) throws GSException
Sets the TIMESTAMP array value to the specified field.If the contents of a specified object is changed after it has been invoked, it is not defined whether the contents of this content will be changed or not.
- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value or its element.GSException
- if the type of the specified field does not match the type of the Column.
-
setValue
void setValue(int column, java.lang.Object fieldValue) throws GSException
Sets the value to the specified field.- Parameters:
column
- the Column number of the target field, from0
to number of Columns minus one.fieldValue
- value of the target field- Throws:
GSException
- if the specified Column number is out of range.GSException
- ifnull
is specified as the field value or its element.GSException
- if the type of the specified field does not match the type of the Column.
-
-
-
@Retention(value=RUNTIME) @Target(value={FIELD,METHOD}) public @interface RowField
Sets options for mapping Row fields of aContainer
.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element and Description int
columnNumber
Sets a Column number.java.lang.String
name
Sets the name to be used as a Column name.
-
-
-
Element Detail
-
columnNumber
public abstract int columnNumber
Sets a Column number.To specify the location of a Column explicitly, specify
0
or more and less than the number of Columns. Duplicate Column numbers cannot be specified in a single Container. A Row key must be always assigned to the first Column. If the default value-1
is specified, the corresponding Column number is automatically determined.- Default:
- -1
-
name
public abstract java.lang.String name
Sets the name to be used as a Column name.If an empty string is specified, the Column name is determined based on the corresponding field name or method name.
- Default:
- ""
-
-
-
@Retention(value=RUNTIME) @Target(value={FIELD,METHOD}) public @interface RowKey
Indicates the correspondence with a key ofContainer
.
- java.lang.Object
-
- com.toshiba.mwcloud.gs.RowKeyPredicate<K>
-
- Type Parameters:
K
- type ofRowKey
public class RowKeyPredicate<K> extends java.lang.Object
Represents the condition that aRowKey
satisfies.This is used as the search condition in
GridStore.multiGet(java.util.Map)
There are two types of conditions, range condition and individual condition. The two types of conditions cannot be specified at the same time. If the condition is not specified, it means that the condition is satisfied in all the target row keys.
-
-
Method Summary
Methods Modifier and Type Method and Description void
add(K key)
Appends the value of theRowKey
as one of the elements of the individual condition.static <K> RowKeyPredicate<K>
create(java.lang.Class<K> keyType)
Creates an instance ofRowKeyPredicate
with theGSType
corresponding to the specifiedClass
as theRowKey
type.static RowKeyPredicate<java.lang.Object>
create(GSType keyType)
java.util.Collection<K>
getDistinctKeys()
Returns a Collection containing all of the values of the row keys that make up the individual condition.K
getFinish()
Returns the value ofRowKey
at the last position of the range condition.GSType
getKeyType()
Returns the type ofRowKey
used as a search condition.K
getStart()
Returns the value of theRowKey
at the starting position of the range condition.void
setFinish(K finishKey)
Sets the value of theRowKey
at the last position of the range condition.void
setStart(K startKey)
Sets the value of theRowKey
at the starting positionof the range condition.
-
-
-
Method Detail
-
add
public void add(K key) throws GSException
Appends the value of theRowKey
as one of the elements of the individual condition.A
RowKey
with the same value as the added value is deemed as conforming.- Parameters:
key
- value ofRowKey
to be appended as one of the elements of the individual condition. Must not be anull
value.- Throws:
GSException
- if a range condition had already been setjava.lang.ClassCastException
- the value of the specified key is not NULL or the type is not supported asRowKey
-
create
public static <K> RowKeyPredicate<K> create(java.lang.Class<K> keyType) throws GSException
Creates an instance ofRowKeyPredicate
with theGSType
corresponding to the specifiedClass
as theRowKey
type.The target Container must have a
RowKey
, and the type of theRowKey
must be the specifiedGSType
The type of
RowKey
that can be set is only that allowed by either one of the subinterfaces ofContainer
. For the correspondence ofClass
toGSType
, see the definition ofContainer
.- Parameters:
keyType
-Class
corresponding to aRowKey
used as a search condition- Returns:
RowKeyPredicate
newly created- Throws:
GSException
- if the specified type is not always supported as aRowKey
java.lang.NullPointerException
- ifnull
is specified in the argument.- See Also:
Container
-
create
public static RowKeyPredicate<java.lang.Object> create(GSType keyType) throws GSException
Creates an instance ofRowKeyPredicate
with the specifiedGSType
as theRowKey
type.The target Container must have a
RowKey
, and the type of theRowKey
must be the specifiedGSType
Unlike
create(Class)
, this method is used when the type ofRowKey
is not specified when the application is compiled. However, the criteria for checking the RowKey type when setting the condition is the same ascreate(Class)
.The type of
RowKey
that can be set is only that allowed by either one of the subinterfaces ofContainer
.- Parameters:
keyType
- type ofRowKey
used as a search condition- Returns:
RowKeyPredicate
newly created- Throws:
GSException
- if the specified type is not always supported as aRowKey
java.lang.NullPointerException
- ifnull
is specified in the argument.- See Also:
Container
-
getDistinctKeys
public java.util.Collection<K> getDistinctKeys()
Returns a Collection containing all of the values of the row keys that make up the individual condition.It is not defined whether an exception like
UnsupportedOperationException
will occur during execution, when a returned object is updated. Moreover, after an object is returned, it is not defined whether an update of this object will change the contents of the returned object.- Returns:
Collection
containing all of the values of the row keys that make up the individual condition.
-
getFinish
public K getFinish()
Returns the value ofRowKey
at the last position of the range condition.- Returns:
- the value of
RowKey
at the last position of the range condition, ornull
if it is not set.
-
getKeyType
public GSType getKeyType()
Returns the type ofRowKey
used as a search condition.- Returns:
- the type of
RowKey
used as a search condition.
-
getStart
public K getStart()
Returns the value of theRowKey
at the starting position of the range condition.- Returns:
- the value of
RowKey
at the starting position of the range condition, ornull
if it is not set.
-
setFinish
public void setFinish(K finishKey) throws GSException
Sets the value of theRowKey
at the last position of the range condition.A
RowKey
with a value larger than the specified value is deemed as non-conforming.A type with an undefined magnitude relationship can be set as a condition but cannot be used in the actual judgment e.g. STRING type
- Parameters:
finishKey
- the value ofRowKey
at the last position ornull
. Fornull
, the setting is cancelled.- Throws:
GSException
- if an individual condition had been set alreadyjava.lang.ClassCastException
- the value of specified key is not NULL or the type is not supported asRowKey
-
setStart
public void setStart(K startKey) throws GSException
Sets the value of theRowKey
at the starting positionof the range condition.A
RowKey
with a value smaller than the specified value is deemed as non-conforming.A type with an undefined magnitude relationship can be set as a condition but cannot be used in the actual judgment, e.g. STRING type
- Parameters:
startKey
- value ofRowKey
at the starting position ornull
. Fornull
, the setting is cancelled.- Throws:
GSException
- if an individual condition had been set alreadyjava.lang.ClassCastException
- the specified RowKey is not NULL or the type is not supported asRowKey
-
-
-
- All Superinterfaces:
- java.lang.AutoCloseable, java.io.Closeable
public interface RowSet<R> extends java.io.Closeable
Manages a set of Rows obtained by executing a query.It has a function of per-Row and per-Row-field manipulation and holds a cursor state similar to
ResultSet
to specify a target Row. The cursor is initially located just before the head of a Row set.
-
-
Method Summary
Methods Modifier and Type Method and Description void
close()
Releases related resources as necessary.boolean
hasNext()
Returns TRUE if a Row set has at least one Row ahead of the current cursor position.R
next()
Moves the cursor to the next Row in a Row set and returns the Row object at the moved position.void
remove()
Deletes the Row at the current cursor position.int
size()
Returns the size, namely the number of Rows at the time of creating a Row set.void
update(R rowObj)
Updates the values except a Row key of the Row at the cursor position, using the specified Row object.
-
-
-
Method Detail
-
close
void close() throws GSException
Releases related resources as necessary.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
GSException
- It will not be thrown in the current version.- See Also:
Closeable.close()
-
hasNext
boolean hasNext() throws GSException
Returns TRUE if a Row set has at least one Row ahead of the current cursor position.- Throws:
GSException
- It will not be thrown in the current version.
-
next
R next() throws GSException
Moves the cursor to the next Row in a Row set and returns the Row object at the moved position.- Throws:
GSException
- if there is no Row at the cursor position.GSException
- if a connection failure caused an error in creation of a Row objectGSException
- if called after this object or the relevantContainer
is closed.
-
remove
void remove() throws GSException
Deletes the Row at the current cursor position.It can be used only for
RowSet
obtained with locking enabled. LikeContainer.remove(Object)
, further limitations are placed depending on the type and settings of a Container.- Throws:
GSException
- if there is no Row at the cursor position.GSException
- If called onRowSet
obtained without locking enabled.GSException
- if its operation is contrary to the restrictions specific to a particular Container.GSException
- if a timeout occurs during this operation or its related transaction, the relevant Container is deleted, its schema is changed or a connection failure occurs.GSException
- if called after this object or the relevantContainer
is closed.
-
size
int size()
Returns the size, namely the number of Rows at the time of creating a Row set.
-
update
void update(R rowObj) throws GSException
Updates the values except a Row key of the Row at the cursor position, using the specified Row object.null
cannot be specified. The Row key contained in the specified Row object is ignored.It can be used only for
RowSet
obtained with locking enabled. LikeContainer.put(Object, Object)
, further limitations are placed depending on the type and settings of a Container.- Throws:
GSException
- if there is no Row at the cursor position.GSException
- If called onRowSet
obtained without locking enabled.GSException
- if its operation is contrary to the restrictions specific to a particular Container.GSException
- if a timeout occurs during this operation or its related transaction, the relevant Container is deleted, its schema is changed or a connection failure occurs.GSException
- if called after this object or the relevantContainer
is closed.java.lang.ClassCastException
- if the specified Row object does not match the value types of the Row object used in mapping operation.java.lang.NullPointerException
- If anull
parameter is specified; or if no object exists in the Row object which corresponds to the Row field.
-
-
- java.lang.Object
-
- java.lang.Enum<TimeOperator>
-
- com.toshiba.mwcloud.gs.TimeOperator
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<TimeOperator>
public enum TimeOperator extends java.lang.Enum<TimeOperator>
Represents how to specify a Row based on a key timestamp ofTimeSeries
.It can be used in combination with the timestamp (specified separately) to specify a Row with the nearest timestamp etc. When no relevant Row exists, it behaves differently depending on the function using this enumeration type.
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description NEXT
Returns the oldest among the Rows whose timestamp are identical with or later than the specified time.NEXT_ONLY
Returns the oldest among the Rows whose timestamp are later than the specified time.PREVIOUS
Returns the newest among the Rows whose timestamp are identical with or earlier than the specified time.PREVIOUS_ONLY
Returns the newest among the Rows whose timestamp are earlier than the specified time.
-
Method Summary
Methods Modifier and Type Method and Description static TimeOperator
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static TimeOperator[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NEXT
public static final TimeOperator NEXT
Returns the oldest among the Rows whose timestamp are identical with or later than the specified time.
-
NEXT_ONLY
public static final TimeOperator NEXT_ONLY
Returns the oldest among the Rows whose timestamp are later than the specified time.
-
PREVIOUS
public static final TimeOperator PREVIOUS
Returns the newest among the Rows whose timestamp are identical with or earlier than the specified time.
-
PREVIOUS_ONLY
public static final TimeOperator PREVIOUS_ONLY
Returns the newest among the Rows whose timestamp are earlier than the specified time.
-
-
Method Detail
-
valueOf
public static TimeOperator valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static TimeOperator[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TimeOperator c : TimeOperator.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
-
- All Superinterfaces:
- java.lang.AutoCloseable, java.io.Closeable, Container<java.util.Date,R>
public interface TimeSeries<R> extends Container<java.util.Date,R>
A specialized Container with a time-type Row key for TimeSeries data operation.Generally, in extraction of a specific range and aggregation operations on TimeSeries, more efficient implementation is selected than on
Collection
.If the order of Rows requested by
Container.query(String)
orGridStore.multiGet(java.util.Map)
is not specified, the Rows in a result set are sorted in ascending order of Row key.The granularity of locking is an internal storage unit, i.e., a set of one or more Rows. Accordingly, when locking a specific Row, GridDB will attempt to lock other Rows in the same internal storage unit as the Row.
-
-
Method Summary
Methods Modifier and Type Method and Description AggregationResult
aggregate(java.util.Date start, java.util.Date end, java.lang.String column, Aggregation aggregation)
Performs an aggregation operation on a Row set or its specific Columns, based on the specified start and end times.boolean
append(R row)
Newly creates or updates a Row with a Row key of the current time on GridDB.R
get(java.util.Date key)
Returns the content of a Row corresponding to the Row key, based on the specified option.R
get(java.util.Date base, TimeOperator timeOp)
Returns one Row related with the specified time.R
interpolate(java.util.Date base, java.lang.String column)
Performs linear interpolation etc. of a Row object corresponding to the specified time.boolean
put(java.util.Date key, R row)
Newly creates or updates a Row, based on the specified Row object and also the Row key specified as needed.Query<R>
query(java.util.Date start, java.util.Date end)
Creates a query to obtain a set of Rows within a specific range between the specified start and end times.Query<R>
query(java.util.Date start, java.util.Date end, QueryOrder order)
Creates a query to obtain a set of Rows sorted in the specified order within a specific range between the specified start and end times.Query<R>
query(java.util.Date start, java.util.Date end, java.util.Set<java.lang.String> columnSet, InterpolationMode mode, int interval, TimeUnit intervalUnit)
Creates a query to take a sampling of Rows within a specific range.boolean
remove(java.util.Date key)
Deletes a Row corresponding to the specified Row key.-
Methods inherited from interface com.toshiba.mwcloud.gs.Container
abort, close, commit, createBlob, createIndex, createIndex, createRow, createTrigger, dropIndex, dropIndex, dropTrigger, flush, get, getType, put, put, query, query, setAutoCommit
-
-
-
-
Method Detail
-
aggregate
AggregationResult aggregate(java.util.Date start, java.util.Date end, java.lang.String column, Aggregation aggregation) throws GSException
Performs an aggregation operation on a Row set or its specific Columns, based on the specified start and end times.The parameter
column
might be ignored depending on the parameteraggregation
. The boundary Rows whose timestamps are identical with the start or end time are included in the range of operation. If the specified start time is later than the end time, all Rows are excluded from the range.- Parameters:
start
- Start timeend
- End timecolumn
- The name of a target Column. Specifynull
if the specified aggregation method does not target a specific Column.aggregation
- An aggregation method- Returns:
AggregationResult
if the aggregation result is stored in it, ornull
if not. See the description ofAggregationResult
for more information.- Throws:
GSException
- if the type of the specified Column is not supported by the specified aggregation method.GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted, its schema is changed, or a connection failure occurs; or if called after the connection is closed.java.lang.NullPointerException
- ifnull
is specified asstart
,end
, oraggregation
.- See Also:
Aggregation
-
append
boolean append(R row) throws GSException
Newly creates or updates a Row with a Row key of the current time on GridDB.It behaves in the same way as
put(Date, Object)
, except that it sets as a Row key the TIMESTAMP value equivalent to the current time on GridDB. The Row key in the specified Row object is ignored.In the manual commit mode, the target Row is locked. Other Rows in the same internal storage unit are also locked.
- Parameters:
row
- A Row object representing the content of a Row to be newly created or updated.- Returns:
- TRUE if a Row is found whose timestamp is identical with the current time on GridDB.
- Throws:
GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed; or if an unsupported value is set in the Row object.java.lang.ClassCastException
- if the specified key or Row object does not completely match the types used in mapping operation.java.lang.NullPointerException
- ifnull
is specified asrow
; or if the Row object lacks some object corresponding to a Row field.- See Also:
put(Date, Object)
,TimeSeriesProperties.getCompressionMethod()
-
get
R get(java.util.Date key) throws GSException
Returns the content of a Row corresponding to the Row key, based on the specified option.It behaves in the same way as
Container.get(Object)
. However, since the type of a Row key is predetermined,ClassCastException
will not be thrown.- Specified by:
get
in interfaceContainer<java.util.Date,R>
- Returns:
- TRUE if a corresponding Row exists.
- Throws:
GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed; or if an unsupported value is specified askey
.java.lang.NullPointerException
- if anull
parameter is specified.- See Also:
Container.get(Object)
-
get
R get(java.util.Date base, TimeOperator timeOp) throws GSException
Returns one Row related with the specified time.- Parameters:
base
- a base time pointtimeOp
- what to obtain- Returns:
- The Row(s) satisfying the conditions; or
null
if no such Row is found. - Throws:
GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed; or if an unsupported value is specified as the base time point.java.lang.NullPointerException
- if anull
parameter is specified.
-
interpolate
R interpolate(java.util.Date base, java.lang.String column) throws GSException
Performs linear interpolation etc. of a Row object corresponding to the specified time.It creates a Row object, based on the value of the specified Column of the TimeSeries Row identical with the base time or the value obtained by linearly interpolating the values of the specified Columns of adjacent Rows around the base time. If there is no Row with the same timestamp as the base time nor no Row with an earlier or later timestamp, no Row object is created.
Only Columns of numeric type can be interpolated. The field values of the Row whose timestamp is identical with the specified timestamp or the latest among those with earlier timestamps are set on the specified Column and the fields other than a Row key.
- Parameters:
base
- a base time pointcolumn
- A Column to be interpolated- Throws:
GSException
- if no Column has the specified name; or if an unsupported type of Column is specified.GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed; or if an unsupported value is specified as the base time point.java.lang.NullPointerException
- if anull
parameter is specified.
-
put
boolean put(java.util.Date key, R row) throws GSException
Newly creates or updates a Row, based on the specified Row object and also the Row key specified as needed.It newly creates a Row, based on the value of the Row key specified as
key
or the Row key in the specified Row object ifkey
is not specified.In the manual commit mode, the target Row is locked. Other Rows in the same internal storage unit are also locked.
- Specified by:
put
in interfaceContainer<java.util.Date,R>
- Parameters:
key
- A target Row keyrow
- A Row object representing the content of a Row to be newly created or updated.- Returns:
- TRUE if a Row is found whose timestamp is identical with the specified time.
- Throws:
GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed; or if an unsupported value is set in the Row object.java.lang.ClassCastException
- if the specified key or Row object does not completely match the types used in mapping operation.java.lang.NullPointerException
- ifnull
is specified asrow
; or if the Row object lacks some object corresponding to a Row field.- See Also:
Container.put(Object, Object)
,TimeSeriesProperties.getCompressionMethod()
-
query
Query<R> query(java.util.Date start, java.util.Date end) throws GSException
Creates a query to obtain a set of Rows within a specific range between the specified start and end times.The boundary Rows whose timestamps are identical with the start or end time are included in the range of fetch. If the specified start time is later than the end time, all Rows are excluded from the range. The Rows in a result set are sorted in ascending order, i.e., from an earlier timestamp to a later timestamp.
The option of locking for update can be enabled when obtaining a set of Rows using
Query.fetch(boolean)
.- Parameters:
start
- start time ornull
. Anull
value indicates the timestamp of the oldest Row in this TimeSeries.end
- end time ornull
. Anull
value indicates the timestamp of the newest Row in this TimeSeries.- Throws:
GSException
- It will not be thrown in the current version.
-
query
Query<R> query(java.util.Date start, java.util.Date end, QueryOrder order) throws GSException
Creates a query to obtain a set of Rows sorted in the specified order within a specific range between the specified start and end times.The boundary Rows whose timestamps are identical with the start or end time are included in the range of fetch. If the specified start time is later than the end time, all Rows are excluded from the range.
The option of locking for update can be enabled when obtaining a set of Rows using
Query.fetch(boolean)
.- Parameters:
start
- start time ornull
. Anull
value indicates the timestamp of the oldest Row in this TimeSeries.end
- end time ornull
. A value indicates the timestamp of the newest Row in this TimeSeries.order
- the time order of Rows in a result set.QueryOrder.ASCENDING
indicates the order from older to newer, andQueryOrder.DESCENDING
indicates the order from newer to older.- Throws:
GSException
- It will not be thrown in the current version.
-
query
Query<R> query(java.util.Date start, java.util.Date end, java.util.Set<java.lang.String> columnSet, InterpolationMode mode, int interval, TimeUnit intervalUnit) throws GSException
Creates a query to take a sampling of Rows within a specific range.Each sampling time point is defined by adding a sampling interval multiplied by a non-negative integer to the start time, excluding the time points later than the end time. If the specified start time is later than the end time, all Rows are excluded from the range.
If executed, the query creates a set of Rows, using the values of the Rows whose timestamps are identical with each sampling time point, or the interpolated values according to the parameters
columnSet
andmode
if such a Row is not found. For specific interpolation methods, see the description ofInterpolationMode
.If there is no Rows to be referenced for interpolation at a specific sampling time point, a corresponding Row is not generated, and thus the number of results returned is reduced by the number of such time points. A shorter sampling interval increases the likelihood that identical Row field values will be used even at different sampling time points, depending on the interpolation method.
The option of locking for update cannot be enabled when obtaining a set of Rows using
Query.fetch(boolean)
.- Parameters:
start
- start timeend
- end timecolumnSet
- a set of names of the Columns to be interpolated according tomode
. An empty set indicates no specification of target Columns. Anull
value indicates the same as an empty set.mode
- an interpolation methodinterval
- a sampling interval.0
or a negative value cannot be specified.intervalUnit
- the time unit of the sampling interval.TimeUnit.YEAR
andTimeUnit.MONTH
cannot be specified.- Throws:
GSException
- It will not be thrown in the current version.
-
remove
boolean remove(java.util.Date key) throws GSException
Deletes a Row corresponding to the specified Row key.It can be used only if a Column exists which corresponds to a specified Row key. If no corresponding Row exists, nothing is changed.
In the manual commit mode, the target Row is locked.
- Specified by:
remove
in interfaceContainer<java.util.Date,R>
- Returns:
- TRUE if a corresponding Row exists.
- Throws:
GSException
- if no Column exists which corresponds to the specified Row key.GSException
- if a timeout occurs during this operation or the transaction, this Container is deleted, its schema is changed or a connection failure occurs; or if called after the connection is closed; or if an unsupported value is specified askey
.java.lang.ClassCastException
- if the specified Row key does not match the type of a Row key used in mapping operation.java.lang.NullPointerException
- if anull
parameter is specified.- See Also:
Container.remove(Object)
,TimeSeriesProperties.getCompressionMethod()
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.TimeSeriesProperties
-
- All Implemented Interfaces:
- java.lang.Cloneable
public class TimeSeriesProperties extends java.lang.Object implements java.lang.Cloneable
Represents the information about optional configuration settings used for newly creating or updating a TimeSeries.It does not guarantee the validity of values e.g. the upper limit of the column number that can be individually compressed.
-
-
Constructor Summary
Constructors Constructor and Description TimeSeriesProperties()
Returns a default instance ofTimeSeriesProperties
.
-
Method Summary
Methods Modifier and Type Method and Description TimeSeriesProperties
clone()
Creates newTimeSeriesProperties
with the same settings as this object.CompressionMethod
getCompressionMethod()
Not supportedjava.lang.Double
getCompressionRate(java.lang.String column)
Not supportedjava.lang.Double
getCompressionSpan(java.lang.String column)
Not supportedjava.lang.Double
getCompressionWidth(java.lang.String column)
Not supportedint
getCompressionWindowSize()
Not supportedTimeUnit
getCompressionWindowSizeUnit()
Not supportedint
getExpirationDivisionCount()
Return the division number for the validity period that corresponds to the number of expired rows data units to be released.int
getRowExpirationTime()
Returns the elapsed time period of a Row to be used as the basis of the validity period.TimeUnit
getRowExpirationTimeUnit()
Returns the unit of the elapsed time period of a Row to be used as the basis of the validity period.java.util.Set<java.lang.String>
getSpecifiedColumns()
Not supportedjava.lang.Boolean
isCompressionRelative(java.lang.String column)
Not supportedvoid
setAbsoluteHiCompression(java.lang.String column, double width)
Not supportedvoid
setCompressionMethod(CompressionMethod compressionMethod)
Not supportedvoid
setCompressionWindowSize(int compressionWindowSize, TimeUnit compressionWindowSizeUnit)
Not supportedvoid
setExpirationDivisionCount(int count)
Sets the division number for the validity period as the number of expired row data units to be released.void
setRelativeHiCompression(java.lang.String column, double rate, double span)
Not supportedvoid
setRowExpiration(int elapsedTime, TimeUnit timeUnit)
Sets the elapsed time period of a Row to be used as the basis of validity period.
-
-
-
Constructor Detail
-
TimeSeriesProperties
public TimeSeriesProperties()
Returns a default instance ofTimeSeriesProperties
.
-
-
Method Detail
-
clone
public TimeSeriesProperties clone()
Creates newTimeSeriesProperties
with the same settings as this object.- Overrides:
clone
in classjava.lang.Object
- Returns:
- Creates and returns a copy of this object.
-
getCompressionMethod
public CompressionMethod getCompressionMethod()
Not supported
-
getCompressionRate
public java.lang.Double getCompressionRate(java.lang.String column)
Not supported
-
getCompressionSpan
public java.lang.Double getCompressionSpan(java.lang.String column)
Not supported
-
getCompressionWidth
public java.lang.Double getCompressionWidth(java.lang.String column)
Not supported
-
getCompressionWindowSize
public int getCompressionWindowSize()
Not supported
-
getCompressionWindowSizeUnit
public TimeUnit getCompressionWindowSizeUnit()
Not supported
-
getExpirationDivisionCount
public int getExpirationDivisionCount()
Return the division number for the validity period that corresponds to the number of expired rows data units to be released.- Returns:
- Division number of the validity period.
-1
if unspecified. - See Also:
setExpirationDivisionCount(int)
-
getRowExpirationTime
public int getRowExpirationTime()
Returns the elapsed time period of a Row to be used as the basis of the validity period.- Returns:
- The elapsed time period to be used as the basis of the validity period.
-1
if unspecified.
-
getRowExpirationTimeUnit
public TimeUnit getRowExpirationTimeUnit()
Returns the unit of the elapsed time period of a Row to be used as the basis of the validity period.- Returns:
- The unit of the elapsed time period to be used as the basis of the validity period.
null
if unspecified.
-
getSpecifiedColumns
public java.util.Set<java.lang.String> getSpecifiedColumns()
Not supported
-
isCompressionRelative
public java.lang.Boolean isCompressionRelative(java.lang.String column)
Not supported
-
setAbsoluteHiCompression
public void setAbsoluteHiCompression(java.lang.String column, double width)
Not supported
-
setCompressionMethod
public void setCompressionMethod(CompressionMethod compressionMethod)
Not supported
-
setCompressionWindowSize
public void setCompressionWindowSize(int compressionWindowSize, TimeUnit compressionWindowSizeUnit)
Not supported
-
setExpirationDivisionCount
public void setExpirationDivisionCount(int count)
Sets the division number for the validity period as the number of expired row data units to be released.The division number set is used to control the conditions for releasing row data management areas that have expired in GridDB. Expired row data shall be released at the point they are collected only when the period equivalent to the division number is reached.
It will be failed if the division number exceeds the size limit. See "System limiting values" in the GridDB API Reference for the division number upper limit.
- Parameters:
count
- the division number for the validity period. Must not be0
or less.- Throws:
java.lang.IllegalArgumentException
- if the division number is specified as0
or less.
-
setRelativeHiCompression
public void setRelativeHiCompression(java.lang.String column, double rate, double span)
Not supported
-
setRowExpiration
public void setRowExpiration(int elapsedTime, TimeUnit timeUnit)
Sets the elapsed time period of a Row to be used as the basis of validity period.The validity period of a Row can be obtained by adding the specified elapsed time period to the timestamp of the Row key. Rows whose expiration times are older than the current time on GridDB are treated as expired Rows. Expired Rows are treated as non existent and are not used for search, update or other Row operations. The corresponding internal data in GridDB will be deleted as needed.
The current time used for expiry check is dependent on the runtime environment of each node of GridDB. Therefore, there may be cases where unexpired Rows cannot be accessed before the VM time, or expired Rows can be accessed after the VM time because of a network delay or a discrepancy in the time setting of the runtime environment. In order to avoid unintended loss of Rows, you should set a value larger than the minimum required period of time.
The setting for an already-created TimeSeries cannot be changed.
- Parameters:
elapsedTime
- the elapsed time period of a Row to be used as the basis of the validity period. Must not be0
or less.timeUnit
- the unit of the elapsed time period.TimeUnit.YEAR
orTimeUnit.MONTH
cannot be specified.- Throws:
java.lang.IllegalArgumentException
- ifelapsedTime
ortimeUnit
of out of range is specifiedjava.lang.IllegalArgumentException
- if a column value with an incorrect formatjava.lang.NullPointerException
- ifnull
is specified in the argument.
-
-
- java.lang.Object
-
- java.lang.Enum<TimeUnit>
-
- com.toshiba.mwcloud.gs.TimeUnit
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description DAY
HOUR
MILLISECOND
MINUTE
MONTH
SECOND
YEAR
-
Method Summary
Methods Modifier and Type Method and Description static TimeUnit
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static TimeUnit[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DAY
public static final TimeUnit DAY
-
HOUR
public static final TimeUnit HOUR
-
MILLISECOND
public static final TimeUnit MILLISECOND
-
MINUTE
public static final TimeUnit MINUTE
-
MONTH
public static final TimeUnit MONTH
-
SECOND
public static final TimeUnit SECOND
-
YEAR
public static final TimeUnit YEAR
-
-
Method Detail
-
valueOf
public static TimeUnit valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static TimeUnit[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TimeUnit c : TimeUnit.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.TimestampUtils
-
public class TimestampUtils extends java.lang.Object
Provides the utilities for manipulating time data.
-
-
Constructor Summary
Constructors Constructor and Description TimestampUtils()
-
Method Summary
Methods Modifier and Type Method and Description static java.util.Date
add(java.util.Date timeStamp, int amount, TimeUnit timeUnit)
Adds a specific value to the specified time.static java.util.Date
current()
Returns the current time.static java.util.Calendar
currentCalendar()
Returns the current time as aCalendar
object.static java.lang.String
format(java.util.Date timeStamp)
Returns the string representing the specified time, according to the TIMESTAMP value notation of TQL.static java.text.DateFormat
getFormat()
Returns the date format conforming to the TIMESTAMP value notation of TQL.static java.util.Date
parse(java.lang.String source)
Returns aDate
object corresponding to the specified string, according to the TIMESTAMP value notation of TQL.
-
-
-
Method Detail
-
add
public static java.util.Date add(java.util.Date timeStamp, int amount, TimeUnit timeUnit)
Adds a specific value to the specified time.An earlier time than the specified time can be obtained by specifying a negative value as
amount
.The current version uses the UTC timezone for calculation.
-
current
public static java.util.Date current()
Returns the current time.
-
currentCalendar
public static java.util.Calendar currentCalendar()
Returns the current time as aCalendar
object.The current version always uses the UTC timezone.
-
format
public static java.lang.String format(java.util.Date timeStamp)
Returns the string representing the specified time, according to the TIMESTAMP value notation of TQL.The current version uses the UTC timezone for conversion.
-
getFormat
public static java.text.DateFormat getFormat()
Returns the date format conforming to the TIMESTAMP value notation of TQL.The time representation containing a negative year value is not supported.
-
parse
public static java.util.Date parse(java.lang.String source) throws java.text.ParseException
Returns aDate
object corresponding to the specified string, according to the TIMESTAMP value notation of TQL.- Throws:
java.text.ParseException
- if the specified string does not match any time representation.
-
-
-
@Retention(value=RUNTIME) @Target(value={FIELD,METHOD}) public @interface TransientRowField
Specifies a Row field not to be mapped in operations on aContainer
.
- java.lang.Object
-
- java.lang.Enum<TriggerInfo.EventType>
-
- com.toshiba.mwcloud.gs.TriggerInfo.EventType
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<TriggerInfo.EventType>
- Enclosing class:
- TriggerInfo
public static enum TriggerInfo.EventType extends java.lang.Enum<TriggerInfo.EventType>
Represent the update operation type subject to monitoring by the trigger.
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description DELETE
Indicate the deletion of a row for a Container.PUT
Indicate the creation of a new row or update of an existing row for a Container.
-
Method Summary
Methods Modifier and Type Method and Description static TriggerInfo.EventType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static TriggerInfo.EventType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DELETE
public static final TriggerInfo.EventType DELETE
Indicate the deletion of a row for a Container.
-
PUT
public static final TriggerInfo.EventType PUT
Indicate the creation of a new row or update of an existing row for a Container.
-
-
Method Detail
-
valueOf
public static TriggerInfo.EventType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static TriggerInfo.EventType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TriggerInfo.EventType c : TriggerInfo.EventType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
- java.lang.Object
-
- java.lang.Enum<TriggerInfo.Type>
-
- com.toshiba.mwcloud.gs.TriggerInfo.Type
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<TriggerInfo.Type>
- Enclosing class:
- TriggerInfo
public static enum TriggerInfo.Type extends java.lang.Enum<TriggerInfo.Type>
Represent the trigger type.
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description JMS
Indicate the trigger type to notify in a Java Message Service (JMS) notification when a Container is updated.REST
Indicate the trigger type to notify in a REST notification when a Container is updated.
-
Method Summary
Methods Modifier and Type Method and Description static TriggerInfo.Type
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static TriggerInfo.Type[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
JMS
public static final TriggerInfo.Type JMS
Indicate the trigger type to notify in a Java Message Service (JMS) notification when a Container is updated.
-
REST
public static final TriggerInfo.Type REST
Indicate the trigger type to notify in a REST notification when a Container is updated.
-
-
Method Detail
-
valueOf
public static TriggerInfo.Type valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
values
public static TriggerInfo.Type[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TriggerInfo.Type c : TriggerInfo.Type.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.TriggerInfo
-
public class TriggerInfo extends java.lang.Object
Represent the trigger information for monitoring the Container update.Regarding the validity of the contents such as the notation of the trigger name, this will not be necessarily inspected.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
TriggerInfo.EventType
Represent the update operation type subject to monitoring by the trigger.static class
TriggerInfo.Type
Represent the trigger type.
-
Constructor Summary
Constructors Constructor and Description TriggerInfo()
Generate the trigger information.
-
Method Summary
Methods Modifier and Type Method and Description java.lang.String
getJMSDestinationName()
Get the destination name used in a JMS notification.java.lang.String
getJMSDestinationType()
Get the destination type used in a JMS notification.java.lang.String
getName()
Get the trigger name.java.lang.String
getPassword()
Get password when connecting to a notification destination server.java.util.Set<java.lang.String>
getTargetColumns()
Get the column name subject to notification when a trigger is discharged.java.util.Set<TriggerInfo.EventType>
getTargetEvents()
Get the update operation type subject to trigger discharge.TriggerInfo.Type
getType()
Get the trigger type.java.net.URI
getURI()
Get the notification destination URI when the trigger is discharged.java.lang.String
getUser()
Get user name when connecting to a notification destination server.void
setJMSDestinationName(java.lang.String destinationName)
Set the destination name used in a JMS notification.void
setJMSDestinationType(java.lang.String destinationType)
Set the destination type used in a JMS notification.void
setName(java.lang.String name)
Set the trigger name.void
setPassword(java.lang.String password)
Set the password when connecting to a notification destination server.void
setTargetColumns(java.util.Set<java.lang.String> columnSet)
Set the column name subject to notification when a trigger is discharged.void
setTargetEvents(java.util.Set<TriggerInfo.EventType> eventSet)
Set the update operation type subject to trigger discharge.void
setType(TriggerInfo.Type type)
Set the trigger type.void
setURI(java.net.URI uri)
Set the notification destination URI when the trigger is discharged.void
setUser(java.lang.String user)
Set user name when connecting to a notification destination server.
-
-
-
Method Detail
-
getJMSDestinationName
public java.lang.String getJMSDestinationName()
Get the destination name used in a JMS notification.
-
getJMSDestinationType
public java.lang.String getJMSDestinationType()
Get the destination type used in a JMS notification.
-
getName
public java.lang.String getName()
Get the trigger name.
-
getPassword
public java.lang.String getPassword()
Get password when connecting to a notification destination server.In the current version, the user name is used only when connecting to the JMS server with a JMS notification.
-
getTargetColumns
public java.util.Set<java.lang.String> getTargetColumns()
Get the column name subject to notification when a trigger is discharged.When a returned value is updated,
UnsupportedOperationException
may occur. In addition, the contents of the returned object will not be changed by the operation on this object.
-
getTargetEvents
public java.util.Set<TriggerInfo.EventType> getTargetEvents()
Get the update operation type subject to trigger discharge.When a returned value is updated,
UnsupportedOperationException
may occur. In addition, the contents of the returned object will not be changed by the operation on this object.
-
getType
public TriggerInfo.Type getType()
Get the trigger type.
-
getURI
public java.net.URI getURI()
Get the notification destination URI when the trigger is discharged.
-
getUser
public java.lang.String getUser()
Get user name when connecting to a notification destination server.In the current version, the user name is used only when connecting to the JMS server with a JMS notification.
-
setJMSDestinationName
public void setJMSDestinationName(java.lang.String destinationName)
Set the destination name used in a JMS notification.If
null
is specified, an error occurs whenContainer.createTrigger(TriggerInfo)
is executed.
-
setJMSDestinationType
public void setJMSDestinationType(java.lang.String destinationType)
Set the destination type used in a JMS notification."queue" or "topic" can be specified. Case sensitive.
If a character string other than "queue" or "topic" is specified, an error occurs when
Container.createTrigger(TriggerInfo)
is executed.
-
setName
public void setName(java.lang.String name)
Set the trigger name.If a blank character string or
null
is set, an error occurs whenContainer.createTrigger(TriggerInfo)
is executed.
-
setPassword
public void setPassword(java.lang.String password)
Set the password when connecting to a notification destination server.In the current version, the user name is used only when connecting to the JMS server with a JMS notification.
If there is no setting, or if a blank character string/
null
is set, the blank character string will be used as the password in the connection.If both the user name and password have not been set, or if a blank character string/
null
is set, the user will be connected without using the user name and password.
-
setTargetColumns
public void setTargetColumns(java.util.Set<java.lang.String> columnSet)
Set the column name subject to notification when a trigger is discharged.The column name is not case-sensitive. Even if the same column name is set several times, the value of the column will only be set once in the notification.
If the column name is not specified, none of the column values will be set in the notification.
The contents of the specified object will not change even if they are changed after they have been invoked.
- Throws:
java.lang.NullPointerException
- Ifnull
is specified in the argument
-
setTargetEvents
public void setTargetEvents(java.util.Set<TriggerInfo.EventType> eventSet)
Set the update operation type subject to trigger discharge.If multiple update operations are set, a trigger will be discharges if any one of these operations is carried out.
If there is no update operation setting, an error occurs when
Container.createTrigger(TriggerInfo)
is executed.The contents of the specified object will not change even if they are changed after they have been invoked.
- Throws:
java.lang.NullPointerException
- Ifnull
is specified in the argument
-
setType
public void setType(TriggerInfo.Type type)
Set the trigger type.If
null
is set, an error occurs whenContainer.createTrigger(TriggerInfo)
is executed.
-
setURI
public void setURI(java.net.URI uri)
Set the notification destination URI when the trigger is discharged.If
null
is set, an error occurs whenContainer.createTrigger(TriggerInfo)
is executed.
-
setUser
public void setUser(java.lang.String user)
Set user name when connecting to a notification destination server.In the current version, the user name is used only when connecting to the JMS server with a JMS notification.
If there is no setting, or if a blank character string/
null
is set, the blank character string will be used as the user name in the connection.If both the user name and password have not been set, or if a blank character string/
null
is set, the user will be connected without using the user name and password.
-
-
Serialized Form
-
Package com.toshiba.mwcloud.gs
-
Class com.toshiba.mwcloud.gs.GSException extends java.io.IOException implements Serializable
- serialVersionUID:
- -7261622831192521426L
-
Class com.toshiba.mwcloud.gs.GSRecoverableException extends GSException implements Serializable
- serialVersionUID:
- 1241771194878438360L
-
Class com.toshiba.mwcloud.gs.GSTimeoutException extends GSException implements Serializable
- serialVersionUID:
- -2321647495394140580L
-
5.2 API Samples (Java)
5.2.1 Sample of Collection Operations (Java)
package gsSample; import java.util.Arrays; import java.util.Properties; import com.toshiba.mwcloud.gs.Collection; import com.toshiba.mwcloud.gs.GSException; import com.toshiba.mwcloud.gs.GridStore; import com.toshiba.mwcloud.gs.GridStoreFactory; import com.toshiba.mwcloud.gs.Query; import com.toshiba.mwcloud.gs.RowKey; import com.toshiba.mwcloud.gs.RowSet; // Operaton on Collection data public class Sample1 { static class Person { @RowKey String name; boolean status; long count; byte[] lob; } public static void main(String[] args) throws GSException { // Get a GridStore instance Properties props = new Properties(); props.setProperty("notificationAddress", args[0]); props.setProperty("notificationPort", args[1]); props.setProperty("clusterName", args[2]); props.setProperty("user", args[3]); props.setProperty("password", args[4]); GridStore store = GridStoreFactory.getInstance().getGridStore(props); // Create a Collection (Delete if schema setting is NULL) Collection<String, Person> col = store.putCollection("col01", Person.class); // Set an index on the Row-key Column col.createIndex("name"); // Set an index on the Column col.createIndex("count"); // Set the autocommit mode to OFF col.setAutoCommit(false); // Prepare data for a Row Person person = new Person(); person.name = "name01"; person.status = false; person.count = 1; person.lob = new byte[] { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74 }; // Operate a Row on a K-V basis: RowKey = "name01" boolean update = true; col.put(person); // Add a Row person = col.get(person.name, update); // Obtain the Row (acquiring a lock for update) col.remove(person.name); // Delete the Row // Operate a Row on a K-V basis: RowKey = "name02" col.put("name02", person); // Add a Row (specifying RowKey) // Commit the transaction (Release the lock) col.commit(); // Search the Collection for a Row Query<Person> query = col.query("select * where name = 'name02'"); // Fetch and update the searched Row RowSet<Person> rs = query.fetch(update); while (rs.hasNext()) { // Update the searched Row Person person1 = rs.next(); person1.count += 1; rs.update(person1); System.out.println("Person: " + " name=" + person1.name + " status=" + person1.status + " count=" + person1.count + " lob=" + Arrays.toString(person1.lob)); } // Commit the transaction col.commit(); // Release the resource store.close(); } }
5.2.2 Sample of TimeSeries Operations - Storage and Extraction of Specific Range (Java)
package gsSample; import java.util.Date; import java.util.Properties; import com.toshiba.mwcloud.gs.GSException; import com.toshiba.mwcloud.gs.GridStore; import com.toshiba.mwcloud.gs.GridStoreFactory; import com.toshiba.mwcloud.gs.RowKey; import com.toshiba.mwcloud.gs.RowSet; import com.toshiba.mwcloud.gs.TimeSeries; import com.toshiba.mwcloud.gs.TimeUnit; import com.toshiba.mwcloud.gs.TimestampUtils; // Storage and extraction of a specific range of time-series data public class Sample2 { static class Point { @RowKey Date timestamp; boolean active; double voltage; } public static void main(String[] args) throws GSException { // Get a GridStore instance Properties props = new Properties(); props.setProperty("notificationAddress", args[0]); props.setProperty("notificationPort", args[1]); props.setProperty("clusterName", args[2]); props.setProperty("user", args[3]); props.setProperty("password", args[4]); GridStore store = GridStoreFactory.getInstance().getGridStore(props); // Create a TimeSeries (Only obtain the specified TimeSeries if it already exists) TimeSeries<Point> ts = store.putTimeSeries("point01", Point.class); // Prepare time-series element data Point point = new Point(); point.active = false; point.voltage = 100; // Store the time-series element (GridStore sets its timestamp) ts.append(point); // Extract the specified range of time-series elements: last six hours Date now = TimestampUtils.current(); Date before = TimestampUtils.add(now, -6, TimeUnit.HOUR); RowSet<Point> rs = ts.query(before, now).fetch(); while (rs.hasNext()) { point = rs.next(); System.out.println( "Time=" + TimestampUtils.format(point.timestamp) + " Active=" + point.active + " Voltage=" + point.voltage); } // Release the resource store.close(); } }
5.2.3 Sample of TimeSeries Operations - Search and Aggregation (Java)
package gsSample; import java.util.Date; import java.util.Properties; import com.toshiba.mwcloud.gs.Aggregation; import com.toshiba.mwcloud.gs.AggregationResult; import com.toshiba.mwcloud.gs.GSException; import com.toshiba.mwcloud.gs.GridStore; import com.toshiba.mwcloud.gs.GridStoreFactory; import com.toshiba.mwcloud.gs.Query; import com.toshiba.mwcloud.gs.RowKey; import com.toshiba.mwcloud.gs.RowSet; import com.toshiba.mwcloud.gs.TimeOperator; import com.toshiba.mwcloud.gs.TimeSeries; import com.toshiba.mwcloud.gs.TimeUnit; import com.toshiba.mwcloud.gs.TimestampUtils; // Search and aggregation of time-series data public class Sample3 { static class Point { @RowKey Date timestamp; boolean active; double voltage; } public static void main(String[] args) throws GSException { // Lower the consistency level because of read-only operation (default: IMMEDIATE) Properties props = new Properties(); props.setProperty("notificationAddress", args[0]); props.setProperty("notificationPort", args[1]); props.setProperty("clusterName", args[2]); props.setProperty("user", args[3]); props.setProperty("password", args[4]); props.setProperty("consistency", "EVENTUAL"); // Get a GridStore instance GridStore store = GridStoreFactory.getInstance().getGridStore(props); // Obtain a TimeSeries // ※ Use the Point class as in Sample 2 TimeSeries<Point> ts = store.getTimeSeries("point01", Point.class); // Search for the locations whose voltage is not lower than a reference value, though not in action. Query<Point> query = ts.query( "select * from point01" + " where not active and voltage > 50"); RowSet<Point> rs = query.fetch(); while (rs.hasNext()) { // Examine each abnormal point Point hotPoint = rs.next(); Date hot = hotPoint.timestamp; // Obtain the data around ten minutes before Date start = TimestampUtils.add(hot, -10, TimeUnit.MINUTE); Point startPoint = ts.get(start, TimeOperator.NEXT); // Calculate the average of the data for 20 minutes around the point Date end = TimestampUtils.add(hot, 10, TimeUnit.MINUTE); AggregationResult avg = ts.aggregate(start, end, "voltage", Aggregation.AVERAGE); System.out.println( "[Alert] " + TimestampUtils.format(hot) + " start=" + startPoint.voltage + " hot=" + hotPoint.voltage + " avg=" + avg.getDouble()); } // Release the resource store.close(); } }
6 Annex
6.1 Range of values
Describe the range of values such as the upper limit of the value, etc. Refer to the Annex System limiting values for the restriction values of the system.
6.1.1 Values that may be adopted by basic datatypes
The values that may be adopted by the basic datatypes below are as follows.
Type Representable values Boolean (BOOL) TRUE/FALSE BYTE -27 to 27-1 SHORT -215 to 215-1 INTEGER -231 to 231-1 LONG -263 to 263-1 FLOAT Conforming to IEEE754 DOUBLE Conforming to IEEE754 TIMESTAMP 1970/1/1 to 9999/12/31(UTC). Accuracy is in milliseconds. Leap seconds are not handled.
6.2 System limiting values
Block size 64KB 1MB String data size 31KB 128KB BLOB data size 127MB 1GB Array length 4000 65000 No. of columns 1024 1024 Size of container name Approximately 16KB Approximately 128KB Size of column name 256Byte 256Byte Partition size Approximately 64TB Approximately 1PB Size of cluster name 64Byte 64Byte Size of trigger name 256Byte 256Byte URL of trigger 4KB 4KB No. of affinity groups 10000 10000 Size of data affinity string 8Byte 8Byte No. of divisions in a timeseries container with a cancellation deadline 160 160 Size of communication buffer managed by a GridStore node Approximately 2GB Approximately 2GB - String, container name, column name, trigger name, URL of trigger
- Limiting value is equivalent to UTF-8 encode
7 Trademark
- GridDB is a trademark of Toshiba Corporation.
- Oracle and Java are registered trademarks of Oracle and/or its affiliates.
- Linux is a trademark of Linus Torvalds.
- Other product names are trademarks or registered trademarks of the respective owners.
Copyright © 2013-2016 TOSHIBA CORPORATION