GridDB Java API Reference
Table of Contents
- 1 API
- 1.1 API List
- 1.2 API Samples
- 1.2.1 Sample of Collection Operations
- 1.2.2 Sample of TimeSeries Operations - Storage and Extraction of Specific Range
- 1.2.3 Sample of TimeSeries Operations - Search and Aggregation
- 1.2.4 Sample of Collection Operations - Schema definition using container information
- 1.2.5 Sample of Collection Operations - Bulk operation on multiple containers
- 2 Annex
- 3 Trademark
1 API
1.1 API List
-
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.Row.Key A type ofRowconfigured only by columns related to the Row key.Row.WithKey<K> Indicates that the type of row object used for mapping is always associated with the specified Row key type.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 Collection.BindType Auxiliary class for configuringContainer.BindTypewhich is associated withCollectionand its type parameters.ColumnInfo Represents the information about the schema of a Column.Container.BindType<K,R,C extends Container<K,R>> Represents the type information associated with theContainerand its type parameters.ContainerInfo Represents the information about a specific Container.Geometry Manages the geometry data which represents geometry range of two or three dimensions.GridStoreFactory Manages aGridStoreinstance.IndexInfo shows the index setting The notation of column names and the validity of column numbers are not inspected.QueryAnalysisEntry Represents one of information entries composing a query plan and the results of analyzing a query operation.RowKeyPredicate<K> Represents the condition that aRowKeysatisfies.TimeSeries.BindType Auxiliary class for configuringContainer.BindTypewhich is associated withTimeSeriesand its type parameters.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 Represents types of compression methods.ContainerType Represents the type(s) of a Container.FetchOption The options for fetching the result of a query.GeometryOperator Represents the constraints regarding relationship between each two spatial ranges.GSType 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 normal time. -
Annotation Types Summary Annotation Type Description NotNull Indicates a column with a NOT NULL constraint.Nullable NOT NULL indicates the column has no constraint.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
TimeSeriesin 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 AVERAGEAn operation to obtain an average.COUNTAn operation to obtain the number of samples, i.e., the number of Rows.MAXIMUMAn operation to obtain a maximum value.MINIMUMAn operation to obtain a minimum value.STANDARD_DEVIATIONAn operation to obtain a standard deviation.TOTALAn operation to obtain a sum total.VARIANCEAn operation to obtain a variance.WEIGHTED_AVERAGEAn operation to obtain a weighted average.
-
Method Summary
Methods Modifier and Type Method and Description static AggregationvalueOf(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 AggregationResultStores 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
Aggregationor 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.DoublegetDouble()Obtains the result of aggregating numeric-type values in DOUBLE type (Double).java.lang.LonggetLong()Obtains the result of aggregating numeric-type values in LONG type (Long).java.util.DategetTimestamp()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
nullif 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
nullif 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
nullif a result is not of TIMESTAMP type.- Returns:
- Result of aggregating TIMESTAMP type (
Date). If the type of result is different, returnsnull.
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.Collection.BindType
-
- Enclosing interface:
- Collection<K,R>
public static class Collection.BindType extends java.lang.ObjectAuxiliary class for configuringContainer.BindTypewhich is associated withCollectionand its type parameters.- Since:
- 4.3
- See Also:
Container.BindType
-
-
Method Summary
Methods Modifier and Type Method and Description static <R> Container.BindType<java.lang.Void,R,? extends Collection<java.lang.Void,R>>noKeyOf(java.lang.Class<R> rowClass)Returns theContainer.BindType, which has no Row key, associated with the specified Row object type and theCollection.static <K,R> Container.BindType<K,R,? extends Collection<K,R>>of(java.lang.Class<K> keyClass, java.lang.Class<R> rowClass)Returns the specified Row key type, the specified Row object type, andContainer.BindTypeassociated with theCollection.static <K,R extends Row.WithKey<K>>
Container.BindType<K,R,? extends Collection<K,R>>of(java.lang.Class<R> rowClass)Returns the Row key type obtained from the specified Row object type, the specified Row object type, andContainer.BindTypeassociated with theCollection.
-
-
-
Method Detail
-
noKeyOf
public static <R> Container.BindType<java.lang.Void,R,? extends Collection<java.lang.Void,R>> noKeyOf(java.lang.Class<R> rowClass) throws GSException
Returns theContainer.BindType, which has no Row key, associated with the specified Row object type and theCollection.- Type Parameters:
R- Type of Row object- Parameters:
rowClass- Class object corresponding to the type of the Row object- Throws:
GSException- if an inconsistency is detected between the type of Row key and the type of Row object- Since:
- 4.3
-
of
public static <K,R> Container.BindType<K,R,? extends Collection<K,R>> of(java.lang.Class<K> keyClass, java.lang.Class<R> rowClass) throws GSException
Returns the specified Row key type, the specified Row object type, andContainer.BindTypeassociated with theCollection.- Type Parameters:
K- Type of Row keyR- Type of Row object- Parameters:
keyClass- Class object corresponding to the type of Row keyrowClass- Class object corresponding to the type of the Row object- Throws:
GSException- if an inconsistency is detected between the type of Row key and the type of Row object- Since:
- 4.3
-
of
public static <K,R extends Row.WithKey<K>> Container.BindType<K,R,? extends Collection<K,R>> of(java.lang.Class<R> rowClass) throws GSException
Returns the Row key type obtained from the specified Row object type, the specified Row object type, andContainer.BindTypeassociated with theCollection.- Type Parameters:
K- Type of Row keyR- Type of Row object- Parameters:
rowClass- Class object corresponding to the type of the Row object- Throws:
GSException- if the Row key type cannot be obtained from the specified Row object type- Since:
- 4.3
-
-
-
- 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) - Row key, or composite Row key (
Row.Key), that has one or more columns of the above type.
It is not mandatory to set a Row key.
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static classCollection.BindTypeAuxiliary class for configuringContainer.BindTypewhich is associated withCollectionand its type parameters.
-
Method Summary
Methods Modifier and Type Method and Description Query<R>query(java.lang.String column, Geometry geometryIntersection, Geometry geometryDisjoint)Creates a query to obtain a set of Rows which are matched to specified geometry range conditions with exclusion range.Query<R>query(java.lang.String column, Geometry geometry, GeometryOperator geometryOp)Creates a query to obtain a set of Rows which are matched to specified geometry range conditions.-
Methods inherited from interface com.toshiba.mwcloud.gs.Container
abort, close, commit, createBlob, createIndex, createIndex, createIndex, createRow, createTrigger, dropIndex, dropIndex, dropIndex, dropTrigger, flush, get, get, getBindType, getType, put, put, put, query, query, remove, setAutoCommit
-
-
-
-
Method Detail
-
query
Query<R> query(java.lang.String column, Geometry geometryIntersection, Geometry geometryDisjoint) throws GSException
Creates a query to obtain a set of Rows which are matched to specified geometry range conditions with exclusion range.Obtains a set of Rows which has the column values that intersect with
geometryIntersectionand do not intersect withgeometryDisjoint. Conditions of the intersection determination is the same as theGeometryOperator.INTERSECT.When obtaining a set of Rows using
Query.fetch(boolean), the option of locking for update can be enabled.In the current version,
NullPointerExceptionwill not be dispatched whenGSExceptionandnullcannot be specified asnull. If there is an error in the column name, etc., an exception is thrown when the obtained query is fetched.- Parameters:
column- A name of the geometry type column to be compared.nullcannot be specifiedgeometryIntersection- Geometry structure indicating a range that intersects with the value on the column.nullcannot be specifiedgeometryDisjoint- Geometry structure indicating a range that does not intersect with the values on the column.nullcannot be specified- Throws:
GSException- It will not be thrown in the current version.
-
query
Query<R> query(java.lang.String column, Geometry geometry, GeometryOperator geometryOp) throws GSException
Creates a query to obtain a set of Rows which are matched to specified geometry range conditions.When obtaining a set of Rows using
Query.fetch(boolean), the option of locking for update can be enabled.GSExceptionwill not be thrown in the current version. If there is an error such as column names, exception will be thrown when fetching the obtained query.In the current version,
NullPointerExceptionwill not be dispatched whenGSExceptionandnullcannot be specified asnull. If there is an error in the column name, etc., an exception is thrown when the obtained query is fetched.- Parameters:
column- A name of the geometry type column to be compared.nullcannot be specifiedgeometry- Geometry structure to be compared.nullcannot be specifiedgeometryOp- Comparison method.nullcannot be specified- Throws:
GSException- It will not be thrown in the current version.
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.ColumnInfo
-
public class ColumnInfo extends java.lang.ObjectRepresents 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)Constructs column information with the specified column name and type.ColumnInfo(java.lang.String name, GSType type, java.lang.Boolean nullable, java.lang.Boolean defaultValueNull, java.util.Set<IndexType> indexTypes)Constructs column information with specifying the column name, type, whether to use of NULL for the initial value, NOT NULL constraint state, and set of index types.ColumnInfo(java.lang.String name, GSType type, java.lang.Boolean nullable, java.util.Set<IndexType> indexTypes)Constructs column information with the column name, type, NOT NULL constraint state, and set of index types.ColumnInfo(java.lang.String name, GSType type, java.util.Set<IndexType> indexTypes)Constructs column information with the specified column name, type, and set of index types.
-
Method Summary
Methods Modifier and Type Method and Description java.lang.BooleangetDefaultValueNull()Returns whether to use of NULL for the initial value.java.util.Set<IndexType>getIndexTypes()Returns all of set of index type.java.lang.StringgetName()Returns a name of column.java.lang.BooleangetNullable()Returns the value irrespective to NOT NULL constraint is set in the column or not.GSTypegetType()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)Constructs column information with the specified column name and type.- Parameters:
name- Column name. Not set whennullis specified.type- Column type. Not set whennullis specified.
-
ColumnInfo
public ColumnInfo(java.lang.String name, GSType type, java.lang.Boolean nullable, java.lang.Boolean defaultValueNull, java.util.Set<IndexType> indexTypes)Constructs column information with specifying the column name, type, whether to use of NULL for the initial value, NOT NULL constraint state, and set of index types.If a set of not empty index types is specified, the contents are duplicated.
- Parameters:
name- Column name. Not set whennullis specified.type- Column type. Not set whennullis specified.defaultValueNull-trueif the initial value is set to NULL.falseif the initial value is set to non-NULL. Not set whennullis specified.nullable-trueif NOT NULL constraint is not set.falseif it is set. Not set whennullis specified.indexTypes- A set of index types. Not set whennullis specified. No index type is set if empty set is specified.- Since:
- 4.1
-
ColumnInfo
public ColumnInfo(java.lang.String name, GSType type, java.lang.Boolean nullable, java.util.Set<IndexType> indexTypes)Constructs column information with the column name, type, NOT NULL constraint state, and set of index types.If a set of not empty index types is specified, the contents are duplicated.
- Parameters:
name- Column name. Not set whennullis specified.type- Column type. Not set whennullis specified.nullable-trueif NOT NULL constraint is not set.falseif it is set. Not set whennullis specified.indexTypes- A set of index types. Not set whennullis specified. No index type is set if empty set is specified.- Since:
- 3.5
-
ColumnInfo
public ColumnInfo(java.lang.String name, GSType type, java.util.Set<IndexType> indexTypes)Constructs column information with the specified column name, type, and set of index types.If a set of not empty index types is specified, the contents are duplicated.
- Parameters:
name- Column name. Not set whennullis specified.type- Column type. Not set whennullis specified.indexTypes- A set of index types. Not set whennullis specified. No index type is set if empty set is specified.
-
-
Method Detail
-
getDefaultValueNull
public java.lang.Boolean getDefaultValueNull()
Returns whether to use of NULL for the initial value.- Returns:
trueif the initial value is set to NULL.falseif the initial value is set to non-NULL.nullif not specified.- Since:
- 4.1
-
getIndexTypes
public java.util.Set<IndexType> getIndexTypes()
Returns all of set of index type.UnsupportedOperationExceptioncan 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
nullif unspecified.
-
getName
public java.lang.String getName()
Returns a name of column.- Returns:
- Name of column, or
nullif unspecified.
-
getNullable
public java.lang.Boolean getNullable()
Returns the value irrespective to NOT NULL constraint is set in the column or not.- Returns:
trueif the NOT NULL constraint is not set,falseif set. If not setnull.- Since:
- 3.5
-
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
nullif 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>
Represents types of compression methods.These types are used when setting a time series compression.
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description HIRepresents a thinning compression with error In this type of compression, values that represent gradient same as before and immediately after may be thinned.NORepresents no compression.SSRepresents a thinning compression without error In this type of compression, rows that have the same value registered immediately before and after are thinned.
-
Method Summary
Methods Modifier and Type Method and Description static CompressionMethodvalueOf(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
Represents a thinning compression with errorIn this type of compression, values that represent gradient same as before and immediately after may be thinned. The algorithm to determine the equality of the gradients can be specified by users. Only if specified column meets the above conditions and other columns are the same as the last registered data, the row is thinned. The thinned value is recovered in an interpolation or sampling processing within the specified error range.
-
NO
public static final CompressionMethod NO
Represents no compression.
-
SS
public static final CompressionMethod SS
Represents a thinning compression without errorIn this type of compression, rows that have the same value registered immediately before and after are thinned. The thinned values are recovered in the interpolation or sampling processing without information loss.
-
-
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
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.Container.BindType<K,R,C>
-
- Type Parameters:
K- Type of Row key. If no Row key is used, specifyVoidorRow.KeyR- The type of a Row object used for mappingC- The type ofContaineror its subinterfaces that are expected to be implemented in the correspondingContainerinstance
public static class Container.BindType<K,R,C extends Container<K,R>> extends java.lang.ObjectRepresents the type information associated with theContainerand its type parameters.Multiple pieces of type information given when constructing a
Containerinstance can be collectively stored as one object.The validity of the contents, such as the validity of the correspondence between the type of the Row key and the type of the
Containerinstance, is not always checked when the instance of this class is generated.- Since:
- 4.3
- See Also:
GridStore.getContainer(String, Container.BindType)
-
-
Method Summary
Methods Modifier and Type Method and Description CcastContainer(Container<?,?> container)Casts to the type ofContaineror its subinterface that has the type of Row key and the type of Row object held by this object as type parameters.KcastKey(java.lang.Object obj)Casts to the type of the Row key held by this object.RcastRow(java.lang.Object obj)Casts to the type of the Row object held by this object.java.lang.Class<? extends Container<?,?>>getContainerClass()Returns the type ofContaineror its subinterface.java.lang.Class<K>getKeyClass()Returns the type of the Row key.java.lang.Class<R>getRowClass()Returns the type of the Row object.static <R> Container.BindType<java.lang.Void,R,? extends Container<java.lang.Void,R>>noKeyOf(java.lang.Class<R> rowClass)Returns theContainer.BindType, which has no Row key, associated with the specified Row object type andContainerof any type.static <K,R> Container.BindType<K,R,? extends Container<K,R>>of(java.lang.Class<K> keyClass, java.lang.Class<R> rowClass)Returns theContainer.BindTypeassociated with the specified Row key type, the specified Row object type, andContainerof any type.static <K,R extends Row.WithKey<K>>
Container.BindType<K,R,? extends Container<K,R>>of(java.lang.Class<R> rowClass)Returns theContainer.BindTypeassociated with the Row key type obtained from the specified Row object type, the specified Row object type, andContainerof any type.
-
-
-
Method Detail
-
castContainer
public C castContainer(Container<?,?> container) throws GSException
Casts to the type ofContaineror its subinterface that has the type of Row key and the type of Row object held by this object as type parameters.- Parameters:
container- theContainerinstance to be casted- Returns:
- Casted object
- Throws:
GSException- if the type of Row key and the type of Row object do not match between theContainerinstance to be casted and the type information held by this object- Since:
- 4.3
-
castKey
public K castKey(java.lang.Object obj)
Casts to the type of the Row key held by this object.- Parameters:
obj- The object to cast- Returns:
- Casted object
- Since:
- 4.3
-
castRow
public R castRow(java.lang.Object obj)
Casts to the type of the Row object held by this object.- Parameters:
obj- The object to cast- Returns:
- Casted object
- Since:
- 4.3
-
getContainerClass
public java.lang.Class<? extends Container<?,?>> getContainerClass()
Returns the type ofContaineror its subinterface.
-
getKeyClass
public java.lang.Class<K> getKeyClass()
Returns the type of the Row key.- Returns:
- Type of Row key
- Since:
- 4.3
-
getRowClass
public java.lang.Class<R> getRowClass()
Returns the type of the Row object.- Returns:
- Type of Row object
- Since:
- 4.3
-
noKeyOf
public static <R> Container.BindType<java.lang.Void,R,? extends Container<java.lang.Void,R>> noKeyOf(java.lang.Class<R> rowClass) throws GSException
Returns theContainer.BindType, which has no Row key, associated with the specified Row object type andContainerof any type.- Type Parameters:
R- Type of Row object- Parameters:
rowClass- Class object corresponding to the type of the Row object- Returns:
- corresponding type information
- Throws:
GSException- if an inconsistency is detected between the type of Row key and the type of Row object- Since:
- 4.3
-
of
public static <K,R> Container.BindType<K,R,? extends Container<K,R>> of(java.lang.Class<K> keyClass, java.lang.Class<R> rowClass) throws GSException
Returns theContainer.BindTypeassociated with the specified Row key type, the specified Row object type, andContainerof any type.- Type Parameters:
K- Type of Row keyR- Type of Row object- Parameters:
keyClass- Class object corresponding to the type of Row keyrowClass- Class object corresponding to the type of the Row object- Returns:
- corresponding type information
- Throws:
GSException- if an inconsistency is detected between the type of Row key and the type of Row object- Since:
- 4.3
-
of
public static <K,R extends Row.WithKey<K>> Container.BindType<K,R,? extends Container<K,R>> of(java.lang.Class<R> rowClass) throws GSException
Returns theContainer.BindTypeassociated with the Row key type obtained from the specified Row object type, the specified Row object type, andContainerof any type.- Type Parameters:
K- Type of Row keyR- Type of Row object- Parameters:
rowClass- Class object corresponding to the type of the Row object- Returns:
- corresponding type information
- Throws:
GSException- if the Row key type cannot be obtained from the specified Row object type- Since:
- 4.3
-
-
-
- Type Parameters:
K- the type of a Row key. If no Row key is used, specifyVoidorRow.Key.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.CloseableProvides 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
TransientRowFieldand 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." Unless specified by
RowField, the column names used in GridDB correspond with the character strings obtained by removing prefixes, such as "get," from the names of field, getter or setter methods. 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,RowKeyis set on the corresponding field or methods.Multiple column names that are different only in upper- and lowercase letters cannot be defined in a table. Further the allowed characters, the length of column names and the number of columns are limited. See the GridDB Features Reference for the details. In the operations specifying column names, ASCII uppercase and lowercase characters are identified as same unless otherwise noted. Use
RowFieldto specify column names that cannot be defined as fields or methods (such as the names in which the first character is a number and Java reserved words).The correspondence between the type of a Column and the type of each value in a Row object is as follows:
Column type Type of each value in a Row object STRING StringBOOL BooleanorbooleanBYTE ByteorbyteSHORT ShortorshortINTEGER IntegerorintLONG LongorlongFLOAT FloatorfloatDOUBLE DoubleordoubleTIMESTAMP DateBLOB Class implementing BlobSTRING 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 are the restrictions on the display range and size of the field value. See the GridDB Features Reference and the appendix "Range of values" for the details. 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.
NULL in GridDB rows can be retained unless the NOT NULL constraint is set. When the field of the row object or the getter / setter method can input / output the value of the reference type, NULL in GridDB rows can be input and output as
null. Otherwise, NULL is mapped to an empty value in the row object.The NOT NULL constraint on the row object type can be explicitly specified with
NotNullandNullable. If a NOT NULL constraint is not specified for any of the specifications, the column other than the row key is assumed to be without the NOT NULL constraint. The row key is implicitly set to the NOT NULL constraint and cannot be specified to exclude this constraint. Also, it is not possible to specify conflicting NOT NULL constraints between the same object and between getter and setter methods. For example, ifNotNullandNullableare specified simultaneously for the row object type, it is assumed that a conflicting NOT NULL constraint was specified. The priority order by designation target on the presence or absence of the NOT NULL constraint is as follows.- Field of row object or getter/setter method
- Raw object
- Enclosing of row object (Example: An interface that surrounds the class of the row object as an inner class) or an enclosing that is recursively obtained. Among enclosing types that are determined in recurrence, there are constraint specifications, and the type found first is given priority.
- Package to which the type of row object belongs to
An empty value is a type of field value that may be used as initial value of various operations such as creation of
Row. Values are defined for each column as follows.Column empty value STRING ""(String with length 0)BOOL False ( false)NUMERAL 0TIMESTAMP 1970-01-01T00:00:00ZGEOMETRY POINT(EMPTY)BLOB BLOB data of length 0 ARRAY Array with 0 element 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
GSExceptionis 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
Containerends, 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 thisContaineror theGridStoreof 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,GSExceptionwill be sent out.In some cases, operations on the same container may have to wait until the processing on the cluster node is started in response to an operation request to a certain container. Operations here include changes of definitions such as container schema and index, container information reference, row operation, etc. When manipulating containers through
GridStoreinstances with a consistency level ofIMMEDIATE, in principle, they are made to wait in the middle of other manipulations with theIMMEDIATEsetting for the same container. In principle, processing is not performed based on the state in the middle of other operation processing on the container. For exceptional items, see the explanation for each individual operation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static classContainer.BindType<K,R,C extends Container<K,R>>Represents the type information associated with theContainerand its type parameters.
-
Method Summary
Methods Modifier and Type Method and Description voidabort()Rolls back the result of the current transaction and starts a new transaction in the manual commit mode.voidclose()Disconnects with GridDB and releases related resources as necessary.voidcommit()Commits the result of the current transaction and start a new transaction in the manual commit mode.java.sql.BlobcreateBlob()Creates a Blob to store a large size of binary data for aContainer.voidcreateIndex(IndexInfo info)Create an index according to the contents set inIndexInfo.voidcreateIndex(java.lang.String columnName)Creates an unnamed index with default type for the column with the specified name.voidcreateIndex(java.lang.String columnName, IndexType type)Creates an unnamed index with the specified type for the column with the specified name.RcreateRow()Create a new Row object based on the column layout of this Container.voidcreateTrigger(TriggerInfo info)Set the trigger.voiddropIndex(IndexInfo info)Delete all indexes that match the content set inIndexInfo.voiddropIndex(java.lang.String columnName)Delete only the default type index from the column with the specified name.voiddropIndex(java.lang.String columnName, IndexType type)Deletes only the index of the specified type from the column with the specified name.voiddropTrigger(java.lang.String name)Delete a trigger.voidflush()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.Rget(K key)Returns the content of a Row corresponding to the specified Row key.Rget(K key, boolean forUpdate)Returns the content of a Row corresponding to the specified Row key according to the specified option.Container.BindType<K,R,? extends Container<K,R>>getBindType()Returns the type information associated with this object.ContainerTypegetType()Get the type of this Container.booleanput(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.booleanput(K key, R row)Newly creates or updates a Row, based on the specified Row object and also the Row key specified as needed.booleanput(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.booleanremove(K key)Deletes a Row corresponding to the specified Row key.voidsetAutoCommit(boolean enabled)Change the setting of the commit mode.
-
-
-
Method Detail
-
abort
void abort() throws GSExceptionRolls 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 GSExceptionDisconnects with GridDB and releases related resources as necessary.When a transaction is held, uncommitted updates will be rolled back.
Even if
GSExceptionis 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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
GSException- if a connection failure occurs
-
commit
void commit() throws GSExceptionCommits 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 GSExceptionCreates 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
Containerusingput(Object)etc.At least the following methods can be called on the
Blobobtained 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
Blobcreated by this method as BLOB to be set on a Row object. You can set an instance of other class implementingBlob, such asSerialBlob. The createdBlobdoes 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.
GSExceptionwill not be thrown in the current version.- Throws:
GSException
-
createIndex
void createIndex(IndexInfo info) throws GSException
Create an index according to the contents set inIndexInfo.For the column of the index to be created, at least one of the column name sequence and column number sequence must be set, and the actual column must be set in the corresponding container. If both are set, corresponding columns and its order must match each other.
If the index type is not set or
IndexType.DEFAULTis set, the default index type is selected according to the criteria described below.If an index name is set, a new index is created only if there is no index with the same name or the different name only in upper- or lowercase letters in the target container. See the GridDB Features Reference for the details. In defining an index name, there are limits on the allowed characters and the length. In the operations of index, the names are not case-sensitive unless otherwise noted.
If a name index gets duplicated, you must specify the same setting
IndexInfothat satisfies the conditions described below, in which case no new index will be created. On the other hand, you can not specify an existingIndexInfothat has the same name as an index with a different name or an unnamed index.If an index name is not set, it is assumed that creation of an unnamed index was requested. If an identical index already exists (excluding name), it must be an unnamed index, which in this case no new index will be created.
In the current version, an index created through
Containeris considered to be the same set of indexes except for index names if the following conditions are satisfied.- The columns to be indexed must match, including its order. Differences in column specification methods, such as column name sequence, column number sequence and single column are ignored.
- The index types must match. Differences in the specification method of index type such as existence of default designation are ignored.
In the current version, for the
Containerinstance generated based on(), the following index type is selected as default based on the type of container, the type of corresponding column, etc.Column type collection time series STRING IndexType.TREEIndexType.TREEBOOL IndexType.TREEIndexType.TREENUMERAL IndexType.TREEIndexType.TREETIMESTAMP IndexType.TREEIndexType.TREENote:restriction appliesGEOMETRY IndexType.SPATIAL(-) BLOB (-) (-) ARRAY (-) (-) An Index cannot be set for Time Series Row Keys (TIMESTAMP type). These index types cannot be selected if the default type differs depending on the column type that configures the column.
If this
Containerinstance holds an uncommitted transaction, commit before create. Container to be processed. If there are other transactions being executed at the same time, wait for them to finish before creating. If an index already exists and no new index is created, it is undefined whether to wait by another transaction. In this case, it is undefined whether uncommitted transactions held by thisContainerinstance are always committed or not.In the current version, in the case of satisfying the conditions such as the size of the container, during creating an index, the reference of the container information, a part of the index operations, the trigger operations, and the row operations (including the update of rows) may be performed. Under the definition of
Container, other operations may be waited. For the operations during the index creation, the container information doesn't include the index information to be created.- Throws:
GSException- When the column or index name to be created does not conform to the above ruleGSException- If this process's timeout, deletion of this container or schema change, connection failure occurs, or when called after closingGSException- When an unsupported index type is specified in the specified columnjava.lang.NullPointerException- whennullis specified as argument- Since:
- 3.5
-
createIndex
void createIndex(java.lang.String columnName) throws GSExceptionCreates an unnamed index with default type for the column with the specified name.Behaves the same as calling
createIndex(IndexInfo)withIndexInfowith only the column name set.- Throws:
GSException- If the specified column name does not conform to the rule ofcreateIndex(IndexInfo)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 anullparameter is specified.
-
createIndex
void createIndex(java.lang.String columnName, IndexType type) throws GSExceptionCreates an unnamed index with the specified type for the column with the specified name.Behaves the same as calling
createIndex(IndexInfo)withIndexInfowith only the column name and type set.- Throws:
GSException- If the specified column name and type does not conform to the rule ofcreateIndex(IndexInfo)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 anullparameter(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 theRowto be created, similar to the case when it is created using aGridStore.createRow(ContainerInfo). In this case, the operation on the createdRowalso does not affect whether thisContainerobject 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 nameTriggerInfofor the detailed trigger settings. The details of the trigger name, the trigger type, notification conditions, notification destination URI and notification contents are as shown below.Multiple trigger names which are identified as the same, including the names only different in ASCII uppercase and lowercase characters, even if they have different types or notification conditions, in a container cannot be defined. And there are the limitations, the allowed characters and the length, on the trigger names. See the GridDB Features Reference for the details. Trigger names are case-sensitive unless otherwise noted.
Trigger typeThe following trigger types are supported.
Notification conditionname 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:00Zis 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).See the GridDB Features 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, blank, or does not follow to other rulesGSException- 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- Ifnullis specified in the argument- Since:
- 1.5
-
dropIndex
void dropIndex(IndexInfo info) throws GSException
Delete all indexes that match the content set inIndexInfo.The setting information of
IndexInfoare used as a condition to narrow down the index to be deleted. Filtering conditions are classified into three categories: column sequence, index type, and index name. Setting each of them is optional. If none of them are set, all created indexes are deleted.If a column name sequence or column number sequence is set, it must exist in the corresponding container. If both column name sequence and column number sequence are set, corresponding columns must match each other. If neither the column name sequence nor the column number sequence is set, the index for any column sequence that satisfies other refinement conditions (index type, index name) will be deleted.
When the index type is set, only the index of the specified type will be deleted. If
IndexType.DEFAULTis set, the default type index is selected according to the standard ofcreateIndex(IndexInfo). Columns that do not support indexes and columns that do not support indexes of the specified type are not eligible for deletion. If the index type is not set, index that fulfil the conditions (column sequence, index name) will be deleted.If an index name is set, only the index with the specified name will be deleted. The identity of the index name follows the criteria of
createIndex(IndexInfo). If an index name is not set, an index with an arbitrary name and an unnamed index that fulfils the conditions (column sequence, index type) will be deleted.If there is no index to be deleted, the index will not get deleted.
Transaction handling is similar to
createIndex(IndexInfo). Also, it is undefined whether or not other transactions may be executed while only a few indexes are deleted when multiple indexes are subject to deletion.The immediate state after completion of the index deletion request is similar to
GridStore.dropContainer(String).- Throws:
GSException- if the column or index name to be deleted does not conform to the above ruleGSException- if the process is timeout, deletion of this container or schema change, connection failure occurs, or called after closingjava.lang.NullPointerException- whennullis specified as argument- Since:
- 3.5
-
dropIndex
void dropIndex(java.lang.String columnName) throws GSExceptionDelete only the default type index from the column with the specified name.Behaves the same as calling
dropIndex(IndexInfo)withIndexInfowith column name and default type set.- Throws:
GSException- When the specified column name does not conform to the rule ofdropIndex(IndexInfo)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 anullparameter is specified.
-
dropIndex
void dropIndex(java.lang.String columnName, IndexType type) throws GSExceptionDeletes only the index of the specified type from the column with the specified name.Behaves the same as calling
dropIndex(IndexInfo)withIndexInfowith column name and type set.- Throws:
GSException- when the specified column name does not conform to the rule ofdropIndex(IndexInfo)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- ifnullis specified as more than one parameter.
-
dropTrigger
void dropTrigger(java.lang.String name) throws GSExceptionDelete 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- Ifnullis specified in the argument
-
flush
void flush() throws GSExceptionWrites 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.
nullif 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- ifnullis specified askey.
-
getBindType
Container.BindType<K,R,? extends Container<K,R>> getBindType() throws GSException
Returns the type information associated with this object.The type information obtained is set to be the same as the Row key type and Row object type specified when the object was configured.
The type of
Containeror its subinterface is not necessarily the same as the type specified at the time of configuration; the type obtained may be that of the subinterface. Furthermore, a one-to-one correspondence with the container type represented byContainerTypeis not guaranteed.- Returns:
- Type information associated with this object
- Throws:
GSException- If invoked after being closed- Since:
- 4.3
-
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
falsein 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 asrowCollectionor its element; As withput(Object, Object), ifnullis included in a specific part of the row object.- 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
nullas 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:
TRUEif 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- ifnullis specified asrow; For objects in row objects corresponding to row fields, if there is a NOT NULL constrain butnullis set, it will in include elements ofnullwhen array type is selected.
-
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.In the current version, due to an error in the TQL statement,
GSExceptionand by specifyingnullwith an argument that cannot specifynull,NullPointerExceptionwill not be dispatched. If there is an error in the argument, an exception will be thrown when the resulting query is fetched.- Parameters:
tql- TQL statement.nullcannot be specified- Throws:
GSException- It will not be thrown in the current version.- 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
nullare 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.
No other value can be specified.
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.In the current version, due to an error in the TQL statement,
GSExceptionand by specifyingnullwith an argument that cannot specifynull,NullPointerExceptionwill not be dispatched. If there is an error in the argument, an exception will be thrown when the resulting query is fetched.- Parameters:
tql- TQL statement.nullcannot be specifiedrowType- the expected row object type ornull- Throws:
GSException- if an unsupported type is specified asrowType.
-
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- ifnullis specified.
-
setAutoCommit
void setAutoCommit(boolean enabled) throws GSExceptionChange 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.ObjectRepresents 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.
-
-
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)Limited to those with no composite Row key, creates container information by specifying information on the column layout.ContainerInfo(java.lang.String name, ContainerType type, java.util.List<ColumnInfo> columnInfoList, java.util.List<java.lang.Integer> rowKeyColumnList)Creates container information by specifying information about column layout, including any Row key configuration.
-
Method Summary
Methods Modifier and Type Method and Description intgetColumnCount()Returns the number of Columns of the specified Container.ColumnInfogetColumnInfo(int column)Returns the information about the specified Column.java.lang.StringgetDataAffinity()Returns a data affinity string of the Container.java.util.List<IndexInfo>getIndexInfoList()Get a list of index information.java.lang.StringgetName()Returns the name of the specified Container.java.util.List<java.lang.Integer>getRowKeyColumnList()Returns the list of columns that configures the Row key.TimeSeriesPropertiesgetTimeSeriesProperties()Returns the optional properties of TimeSeries.java.util.List<TriggerInfo>getTriggerInfoList()Returns a list of the trigger information.ContainerTypegetType()Returns the Container type of the specified Container.booleanisColumnOrderIgnorable()Checks if the order of Columns can be ignored.booleanisRowKeyAssigned()Limited to those with no composite Row key, checks if a Column is assigned as a Row key.voidsetColumnInfoList(java.util.List<ColumnInfo> columnInfoList)Set information of all Columns all at once.voidsetColumnOrderIgnorable(boolean ignorable)Sets whether the order of Columns can be ignored.voidsetDataAffinity(java.lang.String dataAffinity)Sets a string to represent similarity between containers (data affinity).voidsetIndexInfoList(java.util.List<IndexInfo> indexInfoList)Set a list of index information.voidsetName(java.lang.String name)Sets a name of the Container.voidsetRowKeyAssigned(boolean assigned)Sets a Row key Column is assigned or not.voidsetRowKeyColumnList(java.util.List<java.lang.Integer> rowKeyColumnList)Sets the list of columns that configures the Row key.voidsetTimeSeriesProperties(TimeSeriesProperties props)Sets the optional properties of TimeSeries.voidsetTriggerInfoList(java.util.List<TriggerInfo> triggerInfoList)Sets all information of triggers.voidsetType(ContainerType type)Sets a type of the Container.
-
-
-
Constructor Detail
-
ContainerInfo
public ContainerInfo()
Creates an empty ContainerInfo.
-
ContainerInfo
public ContainerInfo(ContainerInfo containerInfo)
Duplicates the information about the specified Container.- Parameters:
containerInfo- Copied Container information.nullcannot be specified.- Throws:
java.lang.NullPointerException- whennullis specified as argument- Since:
- 1.5
-
ContainerInfo
public ContainerInfo(java.lang.String name, ContainerType type, java.util.List<ColumnInfo> columnInfoList, boolean rowKeyAssigned)Limited to those with no composite Row key, creates container information by specifying information on the column layout.- Parameters:
name- Container name. Not set whennullis specified.type- Container type. Not set whennullis specified.columnInfoList- List of column information.nullcannot be specified.rowKeyAssigned- if a column is assigned or not to the Row key:trueif a single column is assigned,falseotherwise- Throws:
java.lang.NullPointerException- whennullis specified as argument- Since:
- 1.5
-
ContainerInfo
public ContainerInfo(java.lang.String name, ContainerType type, java.util.List<ColumnInfo> columnInfoList, java.util.List<java.lang.Integer> rowKeyColumnList)Creates container information by specifying information about column layout, including any Row key configuration.- Parameters:
name- Container name. Not set whennullis specified.type- Container type. Not set whennullis specified.columnInfoList- List of column information.nullcannot be specified.rowKeyColumnList- List of column numbers starting from 0 for the columns configuring the Row key. If a list of length0ornullis specified, it is assumed that there is no Row key.- Throws:
java.lang.NullPointerException- whennullis specified as argument- Since:
- 4.3
-
-
Method Detail
-
getColumnCount
public int getColumnCount()
Returns the number of Columns of the specified Container.- Returns:
- A number of Columns, or
0if Column layout is unspecified.
-
getColumnInfo
public ColumnInfo getColumnInfo(int column)
Returns the information about the specified Column.- Parameters:
column- An index of a Column, from0to 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
nullas default. - See Also:
setDataAffinity(String)
-
getIndexInfoList
public java.util.List<IndexInfo> getIndexInfoList()
Get a list of index information.UnsupportedOperationExceptionmay occur if the returned value is changed. Also, the operation on this object does not change the contents of the returned object.- Returns:
- List of index information.
- Since:
- 3.5
-
getName
public java.lang.String getName()
Returns the name of the specified Container.- Returns:
- A Container name, or
nullif unspecified.
-
getRowKeyColumnList
public java.util.List<java.lang.Integer> getRowKeyColumnList()
Returns the list of columns that configures the Row key.UnsupportedOperationExceptionmay occur if the returned value is changed. Also, the operation on this object does not change the contents of the returned object.- Returns:
- List of column numbers starting from
0for the columns configuring the Row key. A list of length0if the corresponding container has no Row key - Since:
- 4.3
-
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
nullif undefined.
-
getTriggerInfoList
public java.util.List<TriggerInfo> getTriggerInfoList()
Returns a list of the trigger information.UnsupportedOperationExceptioncan 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
nullif unspecified. - See Also:
ContainerType
-
isColumnOrderIgnorable
public boolean isColumnOrderIgnorable()
Checks if the order of Columns can be ignored.- Returns:
trueif yes, otherwisefalse.
-
isRowKeyAssigned
public boolean isRowKeyAssigned()
Limited to those with no composite Row key, checks if a Column is assigned as a Row key.If this method returns
true, the column number corresponding to the Row key is0.Use
getRowKeyColumnList()to refer to any Row key configuration.- Returns:
trueIf a Row key is assigned, otherwisefalse.- Throws:
java.lang.IllegalStateException- if a composite Row key has been set
-
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. Fornullor 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 string to represent similarity between containers (data affinity). The string is used for optimizing the data allocation.A data affinity string is for optimizing the arrangement of Containers among the nodes of the cluster.
Containers which have the same data affinity 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.
There are the limitations, allowed characters and maximum length, for the data affinity string. See GridDB Features Reference for the details. All the limitations may not be checked when setting the string. The data affinity string is case-sensitive unless otherwise noted.
- Parameters:
dataAffinity- A string to represent similarity between containers. Ifnullis specified, the Container will be stored as usual. There are the cases that string against the limitations cannot be specified.- Throws:
java.lang.IllegalArgumentException- If the specified string is not proper.- Since:
- 2.1
-
setIndexInfoList
public void setIndexInfoList(java.util.List<IndexInfo> indexInfoList)
Set a list of index information.Even if you change the contents of the specified object after calling, the contents of this object will not change.
- Parameters:
indexInfoList- List of index information. Not set in the case ofnullor empty list.- Since:
- 3.5
-
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.truefor assigned, otherwisefalse.
-
setRowKeyColumnList
public void setRowKeyColumnList(java.util.List<java.lang.Integer> rowKeyColumnList)
Sets the list of columns that configures the Row key.Updates of the specified object after this function is specified will not change the object.
- Parameters:
rowKeyColumnList- List of column numbers starting from0for the columns configuring the Row key. If a list of length0ornullis specified, it is assumed that there is no Row key.- Since:
- 4.3
-
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 COLLECTIONIndicates the target Container is a Collection.TIME_SERIESIndicates the target Container is a TimeSeries.
-
Method Summary
Methods Modifier and Type Method and Description static ContainerTypevalueOf(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 LIMITUsed to set the maximum number of Rows to be fetched.PARTIAL_EXECUTIONUsed to set the partial execution mode.
-
Method Summary
Methods Modifier and Type Method and Description static FetchOptionvalueOf(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
RowSetare fetched. The rest of the Rows in the result cannot be fetched.The supported types of values are
IntegerandLong. Negative values are not available. If the setting is omitted, the limit is not defined.
-
PARTIAL_EXECUTION
public static final FetchOption PARTIAL_EXECUTION
Used to set the partial execution mode.In the partial execution mode, it is trying for the buffer size of the intermediate query processing and the data transfer, etc. to fit inside a fixed size by dividing the target data and getting the query results in each divided range. Therefore the results for some data ranges may not be determined when the
RowSetis obtained, and in the middle of getting the results, there are the cases that the query is executed partially for the rest of the ranges.In this version, the partial execution mode can be used for queries satisfying all the following conditions. And it can be used in combination with
LIMIToption. Even if not satisfying the conditions, the error may not be detected when setting the fetch option.- The query must be specified by TQL
- The SELECT clause must be consisted of only '*' and an ORDER BY clause must not be specified.
- The target
Containermust have been set to the auto commit mode at the each partial execution of the query.
In the partial execution mode, rows that can be fetched at the each partial execution of the query based on the separation level and the status of the corresponding
Containertransaction are used. However rows that don't exist at the first time of the whole query execution may not be reflected to the results.For inhibited operations and behaviors on
RowSetin this mode, see the individual definitions.The only supported type for this setting is
Boolean. The value matching toBoolean.TRUEmust be specified to activate this mode. In this version, the partial execution mode is not effective unless setting the mode explicitly.- Since:
- 4.0
-
-
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.IOExceptionRepresents the exceptions occurring during a process of a GridDB function.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description GSException()Build a non-descriptive exception.GSException(int errorCode, java.lang.String description)Specify the error number and description, then build an exception.GSException(int errorCode, java.lang.String errorName, java.lang.String description, java.util.Map<java.lang.String,java.lang.String> parameters, java.lang.Throwable cause)Specify the error number, error name, description, map of parameters, and cause, then build an exception.GSException(int errorCode, java.lang.String errorName, java.lang.String description, java.lang.Throwable cause)Specify the error number, error name, description, and cause, then build an exception.GSException(int errorCode, java.lang.String description, java.lang.Throwable cause)Specify the error number, description and cause, then build an exception.GSException(int errorCode, java.lang.Throwable cause)Specify the error number and description, then build an exception.GSException(java.lang.String message)Specify the description, then build an exception.GSException(java.lang.String message, java.lang.Throwable cause)Specify the description and cause, then build an exception.GSException(java.lang.Throwable cause)Specify the error, then build an exception.
-
Method Summary
Methods Modifier and Type Method and Description intgetErrorCode()Returns an error number.java.lang.StringgetMessage()java.util.Map<java.lang.String,java.lang.String>getParameters()Returns a map of parameters related to the error.
-
-
-
Constructor Detail
-
GSException
public GSException()
Build a non-descriptive exception.- See Also:
Exception.Exception()
-
GSException
public GSException(int errorCode, java.lang.String description)Specify the error number and description, then build an exception.- Parameters:
errorCode- Error numberdescription- Description ornull- See Also:
Exception.Exception(String)
-
GSException
public GSException(int errorCode, java.lang.String errorName, java.lang.String description, java.util.Map<java.lang.String,java.lang.String> parameters, java.lang.Throwable cause)Specify the error number, error name, description, map of parameters, and cause, then build an exception.- Parameters:
errorCode- Error numbererrorName- Error name ornulldescription- Description ornullparameters- Map of paramaters ornullcause- Cause ornull- See Also:
Exception.Exception(String, Throwable)
-
GSException
public GSException(int errorCode, java.lang.String errorName, java.lang.String description, java.lang.Throwable cause)Specify the error number, error name, description, and cause, then build an exception.- Parameters:
errorCode- Error numbererrorName- Error name ornulldescription- Description ornullcause- Cause ornull- See Also:
Exception.Exception(String, Throwable)
-
GSException
public GSException(int errorCode, java.lang.String description, java.lang.Throwable cause)Specify the error number, description and cause, then build an exception.- Parameters:
errorCode- Error numberdescription- Description ornullcause- Cause ornull- See Also:
Exception.Exception(String, Throwable)
-
GSException
public GSException(int errorCode, java.lang.Throwable cause)Specify the error number and description, then build an exception.- Parameters:
errorCode- Error numbercause- Cause ornull- See Also:
Exception.Exception(Throwable)
-
GSException
public GSException(java.lang.String message)
Specify the description, then build an exception.- Parameters:
message- Description ornull- See Also:
Exception.Exception(String)
-
GSException
public GSException(java.lang.String message, java.lang.Throwable cause)Specify the description and cause, then build an exception.- Parameters:
message- Description ornullcause- Cause ornull- See Also:
Exception.Exception(String, Throwable)
-
GSException
public GSException(java.lang.Throwable cause)
Specify the error, then build an exception.- Parameters:
cause- Cause ornull- See Also:
Exception.Exception(Throwable)
-
-
Method Detail
-
getErrorCode
public int getErrorCode()
Returns an error number.It returns
0if no corresponding number is found.
-
getMessage
public java.lang.String getMessage()
- Overrides:
getMessagein classjava.lang.Throwable
-
getParameters
public java.util.Map<java.lang.String,java.lang.String> getParameters()
Returns a map of parameters related to the error.It is used to extract particular information about the error. Returned map is a set which each entry consists of a parameter name and a parameter value. For the parameters included in this map, see the definition of interfaces which may output this exception or the definition of related interfaces.
The information in the map is also included in the message string returned by
getMessage()in principle. But by a fixed parsing rule, it may not be able to extract the particular information from this message. Even if the intended information can be extracted from a context in a version, for other conditions, unintended information may be acquired or nothing may be acquired. By using this map, a part of information specified in the definition of the interfaces can be acquired without parsing.When recording only the content of the returned map and not recording other exception information such as the message text, it may become difficult to identify the reason for the error.
-
-
- 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 normal time.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description GSTimeoutException()Build a non-descriptive exception.GSTimeoutException(int errorCode, java.lang.String description)Specify the error number and description, then build an exception.GSTimeoutException(int errorCode, java.lang.String errorName, java.lang.String description, java.util.Map<java.lang.String,java.lang.String> parameters, java.lang.Throwable cause)Specify the error number, error name, description, map of parameters, and cause, then build an exception.GSTimeoutException(int errorCode, java.lang.String errorName, java.lang.String description, java.lang.Throwable cause)Specify the error number, error name, description, and cause, then build an exception.GSTimeoutException(int errorCode, java.lang.String description, java.lang.Throwable cause)Specify the error number, description and cause, then build an exception.GSTimeoutException(int errorCode, java.lang.Throwable cause)Specify the error number and description, then build an exception.GSTimeoutException(java.lang.String message)Specify the description, then build an exception.GSTimeoutException(java.lang.String message, java.lang.Throwable cause)Specify the description and cause, then build an exception.GSTimeoutException(java.lang.Throwable cause)Specify the error, then build an exception.
-
Method Summary
-
Methods inherited from class com.toshiba.mwcloud.gs.GSException
getErrorCode, getMessage, getParameters
-
-
-
-
Constructor Detail
-
GSTimeoutException
public GSTimeoutException()
Build a non-descriptive exception.- See Also:
GSException.GSException()
-
GSTimeoutException
public GSTimeoutException(int errorCode, java.lang.String description)Specify the error number and description, then build an exception.- Parameters:
errorCode- Error numberdescription- Description ornull- See Also:
GSException.GSException(int, String)
-
GSTimeoutException
public GSTimeoutException(int errorCode, java.lang.String errorName, java.lang.String description, java.util.Map<java.lang.String,java.lang.String> parameters, java.lang.Throwable cause)Specify the error number, error name, description, map of parameters, and cause, then build an exception.- Parameters:
errorCode- Error numbererrorName- Error name ornulldescription- Description ornullparameters- Map of paramaters ornullcause- Cause ornull- See Also:
GSException.GSException(int, String, String, Map, Throwable)
-
GSTimeoutException
public GSTimeoutException(int errorCode, java.lang.String errorName, java.lang.String description, java.lang.Throwable cause)Specify the error number, error name, description, and cause, then build an exception.- Parameters:
errorCode- Error numbererrorName- Error name ornulldescription- Description ornullcause- Cause ornull- See Also:
GSException.GSException(int, String, String, Throwable)
-
GSTimeoutException
public GSTimeoutException(int errorCode, java.lang.String description, java.lang.Throwable cause)Specify the error number, description and cause, then build an exception.- Parameters:
errorCode- Error numberdescription- Description ornullcause- Cause ornull- See Also:
GSException.GSException(int, String, Throwable)
-
GSTimeoutException
public GSTimeoutException(int errorCode, java.lang.Throwable cause)Specify the error number and description, then build an exception.- Parameters:
errorCode- Error numbercause- Cause ornull- See Also:
GSException.GSException(int, Throwable)
-
GSTimeoutException
public GSTimeoutException(java.lang.String message)
Specify the description, then build an exception.- Parameters:
message- Description ornull- See Also:
GSException.GSException(String)
-
GSTimeoutException
public GSTimeoutException(java.lang.String message, java.lang.Throwable cause)Specify the description and cause, then build an exception.- Parameters:
message- Description ornullcause- Cause ornull- See Also:
GSException.GSException(String, Throwable)
-
GSTimeoutException
public GSTimeoutException(java.lang.Throwable cause)
Specify the error, then build an exception.- Parameters:
cause- Cause ornull- See Also:
GSException.GSException(Throwable)
-
-
- java.lang.Object
-
- java.lang.Enum<GSType>
-
- com.toshiba.mwcloud.gs.GSType
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description BLOBBOOLBOOL_ARRAYBYTEBYTE_ARRAYDOUBLEDOUBLE_ARRAYFLOATFLOAT_ARRAYGEOMETRYINTEGERINTEGER_ARRAYLONGLONG_ARRAYSHORTSHORT_ARRAYSTRINGSTRING_ARRAYTIMESTAMPTIMESTAMP_ARRAY
-
Method Summary
Methods Modifier and Type Method and Description static GSTypevalueOf(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.ObjectManages the geometry data which represents geometry range of two or three dimensions.An instance of this class are immutable. In addition, all method calls to an instance of this class are thread safe.
-
-
Method Summary
Methods Modifier and Type Method and Description booleanequals(java.lang.Object obj)Indicates whether some other object is "equal to" this one.inthashCode()Returns the hash code of this object.java.lang.StringtoString()Returns the string representation (WKT representation) in WKT (Well-Known Text) format.static GeometryvalueOf(java.lang.String value)Creates theGeometryfrom the string representation (WKT representation) to geometry data in WKT (Well-Known Text) format.
-
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.Objects generated by
valueOf(String)and have no notation difference except inconsistent spelling such as blank character as a delimiter or the default SRID values are considered to be equivalent even if WKT representation of the source is not equivalent to each other as a string. For example, objects generated with the following three WKT representation are considered to be equivalent.POLYGON((0 0,10 0,10 10,0 10,0 0)) POLYGON( (0 0,10 0,10 10,0 10,0 0) ) POLYGON((0 0,10 0,10 10,0 10,0 0);-1)
On the other hand, objects which have no equivalent WKT representation as a string because of the difference in the start/end position to the closed line that make up the area are considered not to be equivalent even if they indicate to the same space region. For example, objects generated with the following two WKT representation are considered not to be equivalent.
POLYGON((0 0,10 0,10 10,0 10,0 0)) POLYGON((0 10,0 0,10 0,10 10,0 10))
This method maintain the general contract for the
Object.hashCode()method, which states that equal objects must have equal hash codes.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The reference object to be compared- Returns:
trueif this object is equal toobj, otherwisefalse- See Also:
hashCode()
-
hashCode
public int hashCode()
Returns the 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:
hashCodein classjava.lang.Object- Returns:
- Hash code of this object
- See Also:
equals(Object)
-
toString
public java.lang.String toString()
Returns the string representation (WKT representation) in WKT (Well-Known Text) format.Returned string may not be equivalent to the specified WKT representation when generated by
valueOf(String), if there are inconsistent spelling such as blank character as a delimiter or the default SRID values.- Overrides:
toStringin classjava.lang.Object
-
valueOf
public static Geometry valueOf(java.lang.String value) throws java.lang.IllegalArgumentException
Creates theGeometryfrom the string representation (WKT representation) to geometry data in WKT (Well-Known Text) format.Supported WKT representation is the same as the representation range to be handled by
ST_GeomFromTextfunction in TQL. However, the geometry structureQUADRATICSURFACEcan only be used as search condition and not to be stored in the container.- Parameters:
value- WKT representation to be created.nullcannot be specified- Returns:
- Instance of
Geometrycreated by WKT representation - Throws:
java.lang.IllegalArgumentException- If the specified string does not match to the WKT formatjava.lang.IllegalArgumentException- whennullis specified as argument
-
-
- 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>
Represents the constraints regarding relationship between each two spatial ranges.It is used to specify the conditions to spatial range query.
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description INTERSECTRepresents that each spatial ranges or their bounding volume are intersected.
-
Method Summary
Methods Modifier and Type Method and Description static GeometryOperatorvalueOf(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
Represents that each spatial ranges or their bounding volume are intersected.Represents that each MBBs (Minimum Bounding Box) or MBB and quadric surface are intersected. The conditions for determination of the intersections are the same as
ST_MBRIntersectsorST_QSFMBRIntersectsin TQL.
-
-
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.CloseableA 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.
Regardless of container types, etc., multiple container names different only in uppercase and lowercase ASCII characters cannot be defined in a database. A container name is represented by only a base container name or by connecting the base name and a node affinity name with '@'. See the GridDB Features Reference for the details. In the operations specifying a container name, uppercase and lowercase ASCII characters are identified as the same unless otherwise noted.
The
GSExceptionthrown by this interface or the interface of the instance which is acquired through this interface may contain the following parameters related the error.Parameter name Description address Address and port of connecting cluster node. It is a string connecting the host name or the IP address and the port number with a colon ":". In this interface or the interface of the instance which is acquired through this interface, when an error is detected in invoking an operation including a cluster access, this parameter may be contained. In that case, the details of the error may be logged in the cluster node shown by this parameter. container The name of container which may relate the exception. When operating an arbitrary number of containers and detected that the operation cannot be performed for one of the containers, this parameter may be contained. For instance of such operations, see the definition of each interface. For such as resource shortage in preparing requests to cluster nodes, it may not be possible to determine which container is the cause, so this parameter may not be contained in some error cases. And even if it is not possible to operate multiple containers, this parameter contains only one container name at most. Thread safety of each method is not guaranteed.
- See Also:
Collection,TimeSeries,Container,GSException.getParameters()
-
-
Method Summary
Methods Modifier and Type Method and Description voidclose()Disconnects with GridDB and releases related resources as necessary.RowcreateRow(ContainerInfo info)Creates a newRowby specifyingContainerInfo.Row.KeycreateRowKey(ContainerInfo info)Creates a newRow.Keyby specifyingContainerInfo.voiddropCollection(java.lang.String name)Deletes a Collection with the specified name.voiddropContainer(java.lang.String name)Delete a Container having the specified name Nothing is changed if the Container has already been deleted.voiddropTimeSeries(java.lang.String name)Deletes a TimeSeries with the specified name.voidfetchAll(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 aCollectionobject whose Rows can be processed using aRow.<K,R> Collection<K,R>getCollection(java.lang.String name, java.lang.Class<R> rowType)Return aCollectionobject to manipulate a Collection with the specified name.<K> Container<K,Row>getContainer(java.lang.String name)<K,R,C extends Container<K,R>>
CgetContainer(java.lang.String name, Container.BindType<K,R,C> bindType)Returns aContainerobject by specifyingContainer.BindType.ContainerInfogetContainerInfo(java.lang.String name)Get information related to a Container with the specified name.PartitionControllergetPartitionController()GetPartitionControlleron the corresponding GridDB cluster.TimeSeries<Row>getTimeSeries(java.lang.String name)Get aTimeSeriesobject whose Rows can be processed using aRow.<R> TimeSeries<R>getTimeSeries(java.lang.String name, java.lang.Class<R> rowType)Returns aTimeSeriesobject 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.voidmultiPut(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 updates a Collection.<K,R> Collection<K,R>putCollection(java.lang.String name, java.lang.Class<R> rowType, boolean modifiable)Newly creates or updates a Collection with the specified option.<K> Collection<K,Row>putCollection(java.lang.String name, ContainerInfo info, boolean modifiable)Creates a new Collection or updates a Collection by specifyingContainerInfo.<K,R> Container<K,R>putContainer(java.lang.String name, java.lang.Class<R> rowType, ContainerInfo info, boolean modifiable)Creates a new Container or updates a Container by specifying the Row object type andContainerInfo.<K,R,C extends Container<K,R>>
CputContainer(java.lang.String name, Container.BindType<K,R,C> bindType)Creates a new container or updates a container by specifyingContainer.BindType.<K,R,C extends Container<K,R>>
CputContainer(java.lang.String name, Container.BindType<K,R,C> bindType, ContainerInfo info, boolean modifiable)Creates a new container or updates a container by specifyingContainer.BindTypeandContainerInfo.<K> Container<K,Row>putContainer(java.lang.String name, ContainerInfo info, boolean modifiable)Creates a new Container or updates a Container by specifyingContainerInfo.<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)Creates a new TimeSeries or updates a TimeSeries by specifyingContainerInfo.
-
-
-
Method Detail
-
close
void close() throws GSExceptionDisconnects with GridDB and releases related resources as necessary.Even if
GSExceptionis 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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
GSException- if a connection failure occurs
-
createRow
Row createRow(ContainerInfo info) throws GSException
Creates a newRowby specifyingContainerInfo.Include the
ColumnInfolist and Row key configuration 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.Each field will be set to the initial value which is based on
ColumnInfoof each column in the specifiedContainerInfo. The initial value corresponding to the return value ofColumnInfo.getDefaultValueNull()is selected by the following way.Return value of ColumnInfo.getDefaultValueNull()Initial value trueNULL. However a row which violates constraints can not be created. falseThe empty value. See the definition of Container.nullIn the current version, same as false.An empty value defined in
Containeris set as the initial value for each field of the createdRow.The operation on the created
Rowalso does not affect whether thisGridStoreobject 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- Ifnullis specified in the argument- See Also:
Container
-
createRowKey
Row.Key createRowKey(ContainerInfo info) throws GSException
Creates a newRow.Keyby specifyingContainerInfo.Information about columns other than the Row key is ignored. Otherwise, it behaves the same as
createRow(ContainerInfo).- Parameters:
info- Container information including the column layout. Other contents are ignored- Returns:
- Created
Row.Key - Throws:
GSException- If container information without Row key is specifiedGSException- If the Container type or restrictions of the column layout are not conformed toGSException- If invoked after being closedjava.lang.NullPointerException- Ifnullis specified in the argument- Since:
- 4.3
-
dropCollection
void dropCollection(java.lang.String name) throws GSExceptionDeletes a Collection with the specified name.Deletion handling, transaction handling, and the immediate state after deletion request is completed are the same as those found in
dropContainer(String)- 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 anullparameter is specified.
-
dropContainer
void dropContainer(java.lang.String name) throws GSExceptionDelete 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.
Immediately after the container deletion request is completed, the memory and storage area used for the index or row of the container may not be reused immediately. In addition, when delete processing is run on the cluster, increase in load may occur for sometime.
- Parameters:
name- Name of a Container subject to processing- Throws:
GSException- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException- Ifnullis specified in the argument- See Also:
dropCollection(String),dropTimeSeries(String)
-
dropTimeSeries
void dropTimeSeries(java.lang.String name) throws GSExceptionDeletes a TimeSeries with the specified name.Deletion handling, transaction handling, and the immediate state after deletion request is completed are the same as those found in
dropContainer(String)- 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 anullparameter 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
Queryincluded in a specified list, perform a similar query execution and fetch as whenQuery.fetch()is performed individually and set theRowSetin 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.Queryin a list are not executed in any particular order.Only a
Querythat has not been closed, including correspondingContaineracquired via thisGridStoreobject, can be included in a specified list. Like aQuery.fetch(), theRowSetformed last and held by eachQuerywill 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
Containercorresponding to the specifiedQuerycan 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 eachContainerwill 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 newRowSetmay be set for only some of theQuery. In addition, uncommitted transactions of eachQuerycorresponding to the designatedContainermay 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 Features Reference for the upper limit size.
The thrown
GSExceptionmay containcontainerparameter. For the details of the parameters related the error, see the definition ofGridStore.- Parameters:
queryList- List ofQuerytargeted- Throws:
GSException- If aQueryother than aQueryobtained via thisGridStoreobject 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- Ifnullis specified in the argumentqueryList, or ifnullis included as a component the argumentqueryListjava.lang.NullPointerException- If a non-permittednullis 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 aCollectionobject whose Rows can be processed using aRow.Except for points where the expected Container type is limited to
ContainerType.COLLECTIONand the returned type isCollection, the behavior will be the same asgetContainer(String).- Returns:
- Corresponding
Collectionif a Collection exists andnullif 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- Ifnullis 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 aCollectionobject 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
Collectionwith the specified name exist; ornullif 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 anullparameter(s) is specified.
-
getContainer
<K> Container<K,Row> getContainer(java.lang.String name) throws GSException
Get aContainerobject 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
Containerobject 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
Containerreturned will always beRow
Arguments
namewith the same respective name are used in the same way as well.- Parameters:
name- Name of a Container subject to processing- Returns:
- Corresponding
Containerif a Container exists andnullif not. If a Container exists and the type isContainerType.COLLECTION, the instance created will be aCollectioninstance. If the type isContainerType.TIME_SERIES, the instance created will be aTimeSeriesinstance. - Throws:
GSException- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException- Ifnullis specified in the argument- See Also:
getCollection(String, Class),getTimeSeries(String, Class)
- Return a
-
getContainer
<K,R,C extends Container<K,R>> C getContainer(java.lang.String name, Container.BindType<K,R,C> bindType) throws GSException
Returns aContainerobject by specifyingContainer.BindType.The behavior is the same as one of the following methods, depending on the specified
bindType:- Parameters:
name- Name of a Container subject to processingbindType- Type information associated with the container subject to processing- Returns:
- An instance of the type of the corresponding
Containeror its subinterfaces - Throws:
GSException- if the contents of thenameandbindTypeparameters do not conform to the rulesGSException- If the specified type is not suitable as the Row object type. Refer to the definition ofContainerfor details.GSException- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException- Ifnullis specified in the argumentbindType- Since:
- 4.3
-
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().In the current version, whether to use of NULL for the initial value is not set. Note that it may be set in the future version. This information can be acquired through
ColumnInfo.getDefaultValueNull()on each column.- 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- ifnullis specified as the parameter.
-
getPartitionController
PartitionController getPartitionController() throws GSException
GetPartitionControlleron the corresponding GridDB cluster.Use is no longer possible once this
GridStoreis closed.- Returns:
PartitionControlleron 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 aTimeSeriesobject whose Rows can be processed using aRow.Except for points where the expected Container type is limited to
ContainerType.TIME_SERIESand the returned type isTimeSeries, the behavior will be the same asgetTimeSeries(String).- Returns:
- Corresponding
TimeSeriesif a TimeSeries exists andnullif 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- Ifnullis 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 aTimeSeriesobject 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
TimeSeriesobject if a TimeSeries with the specified name exists; ornullif 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 anullparameter(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
RowKeyPredicateas the value. Multiple instances with the sameRowKeyPredicatecan 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 forRowKeyPredicatefor the specific restrictions. In addition, the specified Container name must be a real Container. The Container cannot includenullas 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. And only the real Container names at the request included in a specified map as acquisition conditions are included in a returned map. If multiple entries in which Container names with different notations in uppercase and lowercase letters that specify the same Container 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 Features Reference for the upper limit size.
The thrown
GSExceptionmay containcontainerparameter. For the details of the parameters related the error, see the definition ofGridStore.- 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 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- Ifnullis specified as an argumentcontainerRowsPredicate, ifnullis 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
nullas a key or value of the map.An arbitrary number of
Rowwith 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 includenullas 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 ofContainerfor 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.
The thrown
GSExceptionmay containcontainerparameter. For the details of the parameters related the error, see the definition ofGridStore.- 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- Ifnullis specified as an argumentcontainerRowsMap, ifnullis included as a key or value of this map, or ifnullis 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 updates 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
ContainerIf 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
Collectionobject 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- anullparameter(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 updates 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
modifiableistrueand 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 with an empty value defined in
Containeras an initial value.For the correspondence between a specified type and a Column layout, see the description of
ContainerIf 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.In the current version, when conditions such as the size of a container are met, from the beginning to the end of changing the column layout, it is sometimes possible to refer to the container information for the container to be processed and reference the row without updating lock. There are cases where other operations are made to wait as defined in
Container. If another operation is performed during column layout change, the prior layout will be used.- 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
Collectionobject created or updated - Throws:
GSException- if a TimeSeries with the same name exists; or ifmodifiableisfalseand the Column layout of the existing Collection with the specified name conflicts with the requested layout; or ifmodifiableistrueand 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 anullparameter(s) is specified.
-
putCollection
<K> Collection<K,Row> putCollection(java.lang.String name, ContainerInfo info, boolean modifiable) throws GSException
Creates a new Collection or updates a Collection by specifyingContainerInfo.Except for points where the Container type is limited to
ContainerType.COLLECTIONand 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 eithernullorContainerType.COLLECTIONin 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- Ifnullis 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
Creates a new Container or updates a Container by specifying the Row object type andContainerInfo.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 ifnullis specifiedmodifiable- To permit a change in the column layout of existing Container data or not- Returns:
- Corresponding
Container. IfContainerType.COLLECTIONis specified as the Container type, the instance created will be aCollectioninstance. IfContainerType.TIME_SERIESis specified, the instance created will be aTimeSeriesinstance. - Throws:
GSException- If the contents of the argumentsnameandinfodo 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 ofContainerfor details.GSException- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException- Ifnullis specified as an argumentrowType- See Also:
putContainer(String, ContainerInfo, boolean),putCollection(String, Class, boolean),putTimeSeries(String, Class, TimeSeriesProperties, boolean)
-
putContainer
<K,R,C extends Container<K,R>> C putContainer(java.lang.String name, Container.BindType<K,R,C> bindType) throws GSException
Creates a new container or updates a container by specifyingContainer.BindType.The behavior is the same as when
putContainer(String, Container.BindType, ContainerInfo, boolean)is called without specifying the container information and not allowing the column layout to be updated.- Parameters:
name- Name of a Container subject to processingbindType- Type information associated with the container subject to processing- Returns:
- An instance of the type of the corresponding
Containeror its subinterfaces - Throws:
GSException- If the contents of thenameandbindTypeparameters 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 ofContainerfor details.GSException- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException- Ifnullis specified in the argumentbindType- Since:
- 4.3
-
putContainer
<K,R,C extends Container<K,R>> C putContainer(java.lang.String name, Container.BindType<K,R,C> bindType, ContainerInfo info, boolean modifiable) throws GSException
Creates a new container or updates a container by specifyingContainer.BindTypeandContainerInfo.The behavior is the same as one of the following methods, depending on the specified
bindType:- Parameters:
name- Name of a Container subject to processingbindType- Type information associated with the container subject to processinginfo- Information of a Container subject to processing. Ignored ifnullis specifiedmodifiable- To permit a change in the column layout of existing Container data or not- Returns:
- An instance of the type of the corresponding
Containeror its subinterfaces - Throws:
GSException- If the contents of thename,bindType, andinfoarguments 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 ofContainerfor details.GSException- If this process times out, a connection failure were to occur, or if it is invoked after being closedjava.lang.NullPointerException- Ifnullis specified in the argumentbindType- Since:
- 4.3
-
putContainer
<K> Container<K,Row> putContainer(java.lang.String name, ContainerInfo info, boolean modifiable) throws GSException
Creates a new Container or updates a Container by specifyingContainerInfo.Excluding the next point, the behavior will be the same as
putCollection(String, Class, boolean)orputTimeSeries(String, Class, TimeSeriesProperties, boolean).- Use
ContainerInfoto specify the Container type, column layout, as well as the TimeSeries composition option where necessary - The Row object type of the
Containerreturned will always beRow
Arguments
modifiablewith 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 nameorinfoSpecify a value that is not nullin at least one of the arguments. A different value must be specified when specifying both sides.Container type infoSpecify a value that is not null. IfContainerType.COLLECTIONis specified, the behavior will be the same asputCollection(String, Class, boolean). IfContainerType.TIME_SERIESis specified, the behavior will be the same asputTimeSeries(String, Class, TimeSeriesProperties, boolean).Column layout infoSet the ColumnInfolist and Row key configuration so as to conform to the restrictions stipulated inContainer. However, in the current version, it is not allowed that the list includes one or moreColumnInfowhich returns a value except fornullthroughColumnInfo.getDefaultValueNull().Ignore column sequence infoIf ignored, no verification of the conformance with the column sequence of existing Containers with the same name will be carried out. TimeSeries composition option infoA value that is not nullcan be specified only if the Container type isContainerType.TIME_SERIES.Index setting infoIgnored 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 infoIgnored 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 infoThe specified contents will be reflected if a setting other than nullis specified and newly created. The settings of an existing Container cannot be changed. The settings are ignored ifnullis 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.COLLECTIONis specified as the Container type, the instance created will be aCollectioninstance. IfContainerType.TIME_SERIESis specified, the instance created will be aTimeSeriesinstance. - Throws:
GSException- If the contents of the argumentsnameandinfodo 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- Ifnullis 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
TimeSeriesobject 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 anullparameter(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
modifiableistrueand 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
ContainerIf 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. Ifnullis 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
TimeSeriesobject to created or deleted - Throws:
GSException- if a Collection with the same name exists; or ifmodifiableisfalseand the Column layout and additional settings conflict with the specified type with regard to the existing TimeSeries with the specified name; or ifmodifiableistrueand 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 anullparameter(s) is specified.
-
putTimeSeries
TimeSeries<Row> putTimeSeries(java.lang.String name, ContainerInfo info, boolean modifiable) throws GSException
Creates a new TimeSeries or updates a TimeSeries by specifyingContainerInfo.Except for points where the Container type is limited to
ContainerType.TIME_SERIESand 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 eithernullorContainerType.TIME_SERIESin 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- Ifnullis 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.CloseableManages aGridStoreinstance.It manages the client settings shared by
GridStoreinstances and used connections.To access GridDB, you need to get a
GridStoreinstance using this Factory.All the public methods of this class are thread safe.
With additional settings, the following features will become available:
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.
SSL connection
By including the library for advanced features "gridstore-advanced.jar" in the class path, SSL connection will become available for a TCP connection to the cluster or the address provider.
-
-
Constructor Summary
Constructors Modifier Constructor and Description protectedGridStoreFactory()
-
Method Summary
Methods Modifier and Type Method and Description abstract voidclose()Closes allGridStoreinstances created by this Factory and release related resources as necessary.abstract GridStoregetGridStore(java.util.Properties properties)Returns aGridStorewith the specified properties.static GridStoreFactorygetInstance()Returns a default instance.abstract voidsetProperties(java.util.Properties properties)Changes the settings for this Factory.
-
-
-
Method Detail
-
close
public abstract void close() throws GSExceptionCloses allGridStoreinstances created by this Factory and release related resources as necessary.Even if
GSExceptionis 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:
closein interfacejava.io.Closeable- Specified by:
closein 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 aGridStorewith the specified properties.When obtaining
GridStore, it just searches for the name of a master node (hereafter, a master) administering eachContaineras 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.
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 0to65535. 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. This property cannot be specified with neither notificationMembernor notificationProvider properties at the same time.notificationPort A port number for receiving a notification used for autodetection of a master. A string representing of a number from 0to65535. 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. database Name of the database to be connected. If it is omitted, "public" database that all users can access is automatically connected. Users can handle the containers belonging to the connected database. user A user name password A password for user authentication consistency consistency levels. One of the following strings can be specified: "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
can 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 from0toInteger.MAX_VALUEin seconds. The value0indicates 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 0toInteger.MAX_VALUEin seconds. The value0indicates 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 0toInteger.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 Specifies the arbitrary number of patterns as show below, using pairs of an affinity string for the function of data affinity and a container pattern. (ContainerNamePattern1)=(DataAffinityString1),(ContainerNamePattern2)=(DataAffinityString2),...
WhenContaineris added byContainerInfo.setDataAffinity(String), the affinity string pairing with a container name pattern that matches the container name is applied. If there are multiple patterns that match the name, the first pattern in the specified order is selected. Each container name pattern follows the naming rules of container, except a wild card character '%' can also be specified in the pattern. The affinity string follows the rules ofContainerInfo.setDataAffinity(String). To specify special characters used in the patterns or as delimiters for the patterns in a container name, etc., they must be escaped by '\'. But the characters against the naming rules of container or affinity cannot be specified. Supported since the version 2.7.notificationMember A list of address and port pairs in cluster. It is used to connect to cluster which is configured with FIXED_LIST mode, and specified as follows. (Address1):(Port1),(Address2):(Port2),...
This property cannot be specified with neithernotificationAddressnor notificationProvider properties at the same time. This property is supported on version 2.9 or later.notificationProvider A URL of address provider. It is used to connect to cluster which is configured with PROVIDER mode. This property cannot be specified with neither notificationAddressnornotificationMemberproperties at the same time. This property is supported on version 2.9 or later.applicationName Name of an application. It may be contained in various information for management on the connected cluster. However, the cluster shall not be involved with the identity of applications. If the property is omitted, it is regarded that the name is not specified. Empty string cannot be specified. This property is supported on version 4.2 or later. timeZone Time zone information. It is used for TIMESTAMP value operations in TQL. Specifies an offset value in the " ±hh:mm" or the "±hhmm" format (where±is+or-,hhis hours, andmmis minutes), "Z" (equivalent to+00:00), or "auto" (automatically set according to the execution environment). "auto" can only be used for the time zone that does not observe the daylight saving time. This property is supported on version 4.3 or later.authentication authentication type. One of the following strings can be specified: "INTERNAL"- internal authentication based on the account information managed on the cluster.
"LDAP"- external authentication based on the account information managed by the LDAP server outside the cluster. This property is not applicable when connecting to the cluster where LDAP connection settings are not available or when the administrative user is used.
sslMode mode for specifying whether to use SSL in connecting to the cluster. One of the following strings can be specified: "DISABLED"- Never uses SSL.
"PREFERRED"- Uses SSL as much as possible. If both SSL and non-SSL connections can be used, uses SSL connection.
"VERIFY"- Always uses SSL. Server certificate verification is enabled.
GridStoreFactory) allow to select SSL connection. Otherwise, it is not applicable regardless of the value of the property. If SSL connection can be selected but the value is omitted,"PREFERRED"is specified by default. This property is supported on version 4.5 or later. "VERIFY" is supported on version 4.6 or later.Cluster names, database names, user names and passwords are case-sensitive. See the GridDB Features Reference for the details of the limitations, such as allowed characters and maximum length. When a name violating the limitations has been specified as a property value, the error detection may be delayed until the authentication processing. And there are the cases that the error is identified as an authentication error, etc., not a violation error for the limitations.
A new
GridStoreinstance is created by each call of this method. Operations on differentGridStoreinstances and related objects are thread safe. That is, if some two objects are each created based onGridStoreinstances or they are justGridStoreinstances, and if they are related to differentGridStoreinstances 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 forGridStoreitself, it is not allowed to call a method of a singleGridStoreinstance 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 explained above. even if connection or authentication will not succeed with their values.GSException- if the connection is closed.java.lang.NullPointerException-nullis specified asproperties.
-
getInstance
public static GridStoreFactory getInstance()
Returns a default instance.When loading this class, a default subclass of the
GridStoreFactoryclass is loaded and an instance is created.
-
setProperties
public abstract void setProperties(java.util.Properties properties) throws GSExceptionChanges the settings for this Factory.The changed settings are reflected in
GridStorealready created by this Factory andGridStoreto 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 0toInteger.MAX_VALUE. The value0indicates 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 0toInteger.MAX_VALUEin seconds. The value0indicates 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-nullis specified asproperties.
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.IndexInfo
-
public class IndexInfo extends java.lang.Objectshows the index settingThe notation of column names and the validity of column numbers are not inspected.
- Since:
- 3.5
-
-
Constructor Summary
Constructors Constructor and Description IndexInfo()Create empty index information.IndexInfo(IndexInfo info)Inherits the specified content and creates new index information.
-
Method Summary
Methods Modifier and Type Method and Description static IndexInfocreateByColumn(java.lang.String columnName, IndexType type)If necessary, create index information by specifying the column name and index type.static IndexInfocreateByColumnList(java.util.List<java.lang.String> columnNames, IndexType type)Creates index information by specifying the list of column names and index type as needed.static IndexInfocreateByName(java.lang.String name, IndexType type)Creates index information by specifying the index name and index type as necessary.java.lang.IntegergetColumn()Returns the column number of the single column corresponding to the index.java.util.List<java.lang.Integer>getColumnList()Returns the list of the column numbers of any number of columns corresponding to the index.java.lang.StringgetColumnName()Returns the column name of the single column corresponding to the index.java.util.List<java.lang.String>getColumnNameList()Returns the list of the column names of any number of columns corresponding to the index.java.lang.StringgetName()Returns the index name.IndexTypegetType()Returns the index type.voidsetColumn(java.lang.Integer column)Sets the list of the column numbers consisting of a single column corresponding to the index.voidsetColumnList(java.util.List<java.lang.Integer> columns)Sets the list of the column numbers of any number of columns corresponding to the index.voidsetColumnName(java.lang.String columnName)Sets the list of the column names consisting of a single column corresponding to the index.voidsetColumnNameList(java.util.List<java.lang.String> columnNames)Sets the list of the column names of any number of columns corresponding to the index.voidsetName(java.lang.String name)Sets the index name.voidsetType(IndexType type)Sets the index type.
-
-
-
Constructor Detail
-
IndexInfo
public IndexInfo()
Create empty index information.Creates index information with no index type, index name, column number, column name.
-
IndexInfo
public IndexInfo(IndexInfo info)
Inherits the specified content and creates new index information.- Parameters:
info- Index information- Throws:
java.lang.NullPointerException- whennullis specified as argument
-
-
Method Detail
-
createByColumn
public static IndexInfo createByColumn(java.lang.String columnName, IndexType type)
If necessary, create index information by specifying the column name and index type.- Parameters:
columnName- Column name. If not specifiednulltype- Index type. If not specifiednull
-
createByColumnList
public static IndexInfo createByColumnList(java.util.List<java.lang.String> columnNames, IndexType type)
Creates index information by specifying the list of column names and index type as needed.- Parameters:
columnNames- List of column names. Length0is allowed, butnullcannot be specifiedtype- Index type. If not specifiednull- Throws:
java.lang.NullPointerException- Ifnullis specified in the argumentcolumnNames- Since:
- 4.3
-
createByName
public static IndexInfo createByName(java.lang.String name, IndexType type)
Creates index information by specifying the index name and index type as necessary.- Parameters:
name- Index name. If not specifiednulltype- Index type. If not specifiednull
-
getColumn
public java.lang.Integer getColumn()
Returns the column number of the single column corresponding to the index.- Returns:
- column number. If not set
null - Throws:
java.lang.IllegalStateException- If a list of column numbers or a list of column names is set for the composite index
-
getColumnList
public java.util.List<java.lang.Integer> getColumnList()
Returns the list of the column numbers of any number of columns corresponding to the index.- Returns:
- List of column numbers. If not set, a list of length
0 - Since:
- 4.3
-
getColumnName
public java.lang.String getColumnName()
Returns the column name of the single column corresponding to the index.- Returns:
- column name. If not set
null - Throws:
java.lang.IllegalStateException- If a list of column numbers or a list of column names is set for the composite index
-
getColumnNameList
public java.util.List<java.lang.String> getColumnNameList()
Returns the list of the column names of any number of columns corresponding to the index.- Returns:
- List of column names. If not set, a list of length 0
- Since:
- 4.3
-
getName
public java.lang.String getName()
Returns the index name.- Returns:
- index name. If not set
null
-
getType
public IndexType getType()
Returns the index type.- Returns:
- Index type. If not set
null
-
setColumn
public void setColumn(java.lang.Integer column)
Sets the list of the column numbers consisting of a single column corresponding to the index.- Parameters:
column- Column number. Not set whennullis specified.
-
setColumnList
public void setColumnList(java.util.List<java.lang.Integer> columns)
Sets the list of the column numbers of any number of columns corresponding to the index.- Parameters:
columns- List of column numbers. Length0is allowed, butnullcannot be specified- Throws:
java.lang.NullPointerException- Ifnullis specified in the argumentcolumns- Since:
- 4.3
-
setColumnName
public void setColumnName(java.lang.String columnName)
Sets the list of the column names consisting of a single column corresponding to the index.- Parameters:
columnName- column name. Not set whennullis specified.
-
setColumnNameList
public void setColumnNameList(java.util.List<java.lang.String> columnNames)
Sets the list of the column names of any number of columns corresponding to the index.- Parameters:
columnNames- List of column names. Length0is allowed, butnullcannot be specified- Throws:
java.lang.NullPointerException- Ifnullis specified in the argumentcolumnNames- Since:
- 4.3
-
setName
public void setName(java.lang.String name)
Sets the index name.- Parameters:
name- index name. Not set whennullis specified.
-
setType
public void setType(IndexType type)
Sets the index type.- Parameters:
type- Index type. Not set whennullis specified.
-
-
- java.lang.Object
-
- java.lang.Enum<IndexType>
-
- com.toshiba.mwcloud.gs.IndexType
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description DEFAULTIndicates the default index type.HASHIndicates a hash index.SPATIALIndicates a spatial index.TREEIndicates a tree index.
-
Method Summary
Methods Modifier and Type Method and Description static IndexTypevalueOf(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
-
DEFAULT
public static final IndexType DEFAULT
Indicates the default index type.This index type is used when it is necessary to manipulate the index without specifying a type, and the existing index is classified as another type
- Since:
- 3.5
-
HASH
public static final IndexType HASH
Indicates a hash index.This index type can be set on the following types of Columns in
Collection- STRING
- BOOL
- BYTE
- SHORT
- INTEGER
- LONG
- FLOAT
- DOUBLE
- TIMESTAMP
It cannot be set on Columns in
TimeSeries.
-
SPATIAL
public static final IndexType SPATIAL
Indicates a spatial index.This index type can be applied to only GEOMETRY type of Columns in
Collection. It cannot be set on Columns inTimeSeries.
-
-
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 EMPTYIndicates using an empty value as an interpolated value.LINEAR_OR_PREVIOUSIndicates performing linear interpolation or interpolation with the value of a previous Row on Columns.
-
Method Summary
Methods Modifier and Type Method and Description static InterpolationModevalueOf(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 in
Containeris used as an interpolated value for all Row fields except Row keys.
-
LINEAR_OR_PREVIOUS
public static final InterpolationMode LINEAR_OR_PREVIOUS
Indicates performing linear interpolation or interpolation with the value of a previous 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
-
-
-
@Retention(value=RUNTIME) @Target(value={TYPE,FIELD,METHOD,PACKAGE}) public @interface NotNullIndicates a column with a NOT NULL constraint.- Since:
- 3.5
- See Also:
Container
-
@Retention(value=RUNTIME) @Target(value={TYPE,FIELD,METHOD,PACKAGE}) public @interface NullableNOT NULL indicates the column has no constraint.- Since:
- 3.5
- See Also:
Container
-
- All Superinterfaces:
- java.lang.AutoCloseable, java.io.Closeable
public interface PartitionController extends java.io.CloseableController 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 voidassignPreferableHost(int partitionIndex, java.net.InetAddress host)Set the address of the host to be prioritized in the selection.voidclose()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.longgetContainerCount(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.InetAddressgetOwnerHost(int partitionIndex)Get the address of the owner node corresponding to a specified partition.intgetPartitionCount()Get the number of partitions in the target GridDB cluster.intgetPartitionIndexOfContainer(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 GSExceptionSet 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 of0or 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 correspondingGridStoreis closed.- See Also:
getBackupHosts(int)
-
close
void close() throws GSExceptionThe connection status with GridDB is released and related resources are released where necessary.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
GSException- Not sent out in the current version
-
getBackupHosts
java.util.List<java.net.InetAddress> getBackupHosts(int partitionIndex) throws GSExceptionGet 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 of0or 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 correspondingGridStoreis closed
-
getContainerCount
long getContainerCount(int partitionIndex) throws GSExceptionGet 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 of0or 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 correspondingGridStoreis closed- See Also:
getPartitionIndexOfContainer(String)
-
getContainerNames
java.util.List<java.lang.String> getContainerNames(int partitionIndex, long start, java.lang.Long limit) throws GSExceptionGet 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 of0or above and less than the number of partitions.start- Start position of the acquisition range. A value of0and 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 correspondingGridStoreis closed
-
getHosts
java.util.List<java.net.InetAddress> getHosts(int partitionIndex) throws GSExceptionGet 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 of0or 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 correspondingGridStoreis closed
-
getOwnerHost
java.net.InetAddress getOwnerHost(int partitionIndex) throws GSExceptionGet 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 of0or 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 correspondingGridStoreis closed
-
getPartitionCount
int getPartitionCount() throws GSExceptionGet 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 correspondingGridStoreis closed
-
getPartitionIndexOfContainer
int getPartitionIndexOfContainer(java.lang.String containerName) throws GSExceptionGet 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.nullcannot 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 correspondingGridStoreis closedjava.lang.NullPointerException- Ifnullis specified in the argument
-
-
-
- Type Parameters:
R- the type ofRowSetelements to be obtained
- All Superinterfaces:
- java.lang.AutoCloseable, java.io.Closeable
public interface Query<R> extends java.io.CloseableProvides 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 voidclose()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()ReturnsRowSetof the latest result.voidsetFetchOption(FetchOption option, java.lang.Object value)Sets an option for a result set.
-
-
-
Method Detail
-
close
void close() throws GSExceptionReleases related resources properly.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein 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 ofRowSetelements 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 relevantContaineris closed.java.lang.NullPointerException- if an unsupportednullparameter 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
trueis 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,
RowSetof 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 Features Reference about the buffer size upper limit.
- Throws:
GSException- iftrueis specified asforUpdatealthough the autocommit mode is enabled on a relevant Container.GSException- iftrueis specified asforUpdatefor 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, directive or option setting. 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 ofRowSetelements 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 relevantContaineris closed.java.lang.NullPointerException- if an unsupportednullparameter is specified when creating this query.
-
getRowSet
RowSet<R> getRowSet() throws GSException
ReturnsRowSetof the latest result.When
FetchOption.PARTIAL_EXECUTIONhas been set to be effective, the continuation of the query processing may be executed.After
RowSetreturned once, it returnsnulluntil the new query is executed.- Returns:
RowSetof the latest result at the first time, ornullfrom the second time or no query executed before.- Throws:
GSException- when there is a timeout of this processing or of related transaction, the target container has been deleted or its schema has been changed.GSException- if called after this object or the relevantContaineris closed.
-
setFetchOption
void setFetchOption(FetchOption option, java.lang.Object value) throws GSException
Sets an option for a result set.See
FetchOptionfor 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 relevantContaineris closed.java.lang.NullPointerException- if anullparameter(s) is specified.- See Also:
FetchOption
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.QueryAnalysisEntry
-
public class QueryAnalysisEntry extends java.lang.ObjectRepresents 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 booleanequals(java.lang.Object obj)Indicates whether some other object is "equal to" this one.intgetDepth()Returns the depth indicating the relation to other entries.intgetId()Returns the ID indicating the location of an entry in an array of entries.java.lang.StringgetStatement()Returns a part of a TQL statement corresponding to the information indicated by an entry.java.lang.StringgetType()Returns the type of the information indicated by an entry.java.lang.StringgetValue()Returns a character string representing the value of the information indicated by an entry.java.lang.StringgetValueType()Returns the value type of the information indicated by an entry.inthashCode()Returns hash code of this object.voidsetDepth(int depth)Sets the depth indicating the relation to other entries.voidsetId(int id)Sets the ID indicating the location of an entry in an array of entries.voidsetStatement(java.lang.String statement)Sets a part of a TQL statement corresponding to the information indicated by an entry.voidsetType(java.lang.String type)Sets the type of the information indicated by an entry.voidsetValue(java.lang.String value)Sets a character string representing the value of the information indicated by an entry.voidsetValueType(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. value 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:
equalsin classjava.lang.Object- Parameters:
obj- the reference object with which to compare ornull- Returns:
trueif this object is the same as theobjargument;falseotherwise.- 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:
hashCodein 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.- Parameters:
statement- Part of the TQL statement ornull- See Also:
getStatement()
-
setType
public void setType(java.lang.String type)
Sets the type of the information indicated by an entry.- Parameters:
type- type ornull- 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.- Parameters:
value- A string representation of the value ornull- See Also:
getValue()
-
setValueType
public void setValueType(java.lang.String valueType)
Sets the value type of the information indicated by an entry.- Parameters:
valueType- value type ornull- 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 ASCENDINGIndicates the requested order of Rows is an ascending order.DESCENDINGIndicates the requested order of Rows is a descending order.
-
Method Summary
Methods Modifier and Type Method and Description static QueryOrdervalueOf(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
-
-
-
- All Superinterfaces:
- Row
- Enclosing interface:
- Row
public static interface Row.Key extends Row
A type ofRowconfigured only by columns related to the Row key.The column information included in ContainerInfo returned from
Row.getSchema()is only the column information related to the Row key.- Since:
- 4.3
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.toshiba.mwcloud.gs.Row
Row.Key, Row.WithKey<K>
-
-
Method Summary
-
Methods inherited from interface com.toshiba.mwcloud.gs.Row
createKey, createRow, getBlob, getBool, getBoolArray, getByte, getByteArray, getDouble, getDoubleArray, getFloat, getFloatArray, getGeometry, getInteger, getIntegerArray, getLong, getLongArray, getSchema, getShort, getShortArray, getString, getStringArray, getTimestamp, getTimestampArray, getValue, isNull, setBlob, setBool, setBoolArray, setByte, setByteArray, setDouble, setDoubleArray, setFloat, setFloatArray, setGeometry, setInteger, setIntegerArray, setLong, setLongArray, setNull, setShort, setShortArray, setString, setStringArray, setTimestamp, setTimestampArray, setValue
-
-
-
- Enclosing interface:
- Row
public static interface Row.WithKey<K>Indicates that the type of row object used for mapping is always associated with the specified Row key type.If the type of Row object with this interface is specified to obtain the type information through
Container.BindType.of(Class), the type of Row key needs not to be specified when generating aContainerinstance.- Since:
- 4.3
-
- All Known Subinterfaces:
- Row.Key
public interface RowA general-purpose Row for managing fields in any schema.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static interfaceRow.KeyA type ofRowconfigured only by columns related to the Row key.static interfaceRow.WithKey<K>Indicates that the type of row object used for mapping is always associated with the specified Row key type.
-
Method Summary
Methods Modifier and Type Method and Description Row.KeycreateKey()Creates a newRow.Keyinstance with only the columns that configure the row key and the same field values for those columns.RowcreateRow()Creates a newRowinstance with the same field values.java.sql.BlobgetBlob(int column)Returns the Blob value of the specified field.booleangetBool(int column)Returns the boolean value of the specified field.boolean[]getBoolArray(int column)Returns the boolean array value of the specified field.bytegetByte(int column)Returns the byte value of the specified field.byte[]getByteArray(int column)Returns the byte array value of the specified field.doublegetDouble(int column)Returns the double value of the specified field.double[]getDoubleArray(int column)Returns the double array value of the specified field.floatgetFloat(int column)Returns the float value of the specified field.float[]getFloatArray(int column)Returns the byte float value of the specified field.GeometrygetGeometry(int column)Returns the Geometry value of the specified field.intgetInteger(int column)Returns the int value of the specified field.int[]getIntegerArray(int column)Returns the int array value of the specified field.longgetLong(int column)Returns the long value of the specified field.long[]getLongArray(int column)Returns the long array value of the specified field.ContainerInfogetSchema()Returns the schema corresponding to the specified Row.shortgetShort(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.StringgetString(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.DategetTimestamp(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.ObjectgetValue(int column)Returns the value of the specified field.booleanisNull(int column)Returns to the specified field regardless it is set to NULL or not.voidsetBlob(int column, java.sql.Blob fieldValue)Sets the Blob value to the specified field.voidsetBool(int column, boolean fieldValue)Sets the boolean value to the specified field.voidsetBoolArray(int column, boolean[] fieldValue)Sets the boolean array value to the specified field.voidsetByte(int column, byte fieldValue)Sets the byte value to the specified field.voidsetByteArray(int column, byte[] fieldValue)Sets the byte array value to the specified field.voidsetDouble(int column, double fieldValue)Sets the double value to the specified field.voidsetDoubleArray(int column, double[] fieldValue)Sets the double array value to the specified field.voidsetFloat(int column, float fieldValue)Sets the float value to the specified field.voidsetFloatArray(int column, float[] fieldValue)Sets the float array value to the specified field.voidsetGeometry(int column, Geometry fieldValue)Sets the Geometry value to the specified field.voidsetInteger(int column, int fieldValue)Sets the int value to the specified field.voidsetIntegerArray(int column, int[] fieldValue)Sets the int array value to the specified field.voidsetLong(int column, long fieldValue)Sets the long value to the specified field.voidsetLongArray(int column, long[] fieldValue)Sets the long array value to the specified field.voidsetNull(int column)Set the field to NULL.voidsetShort(int column, short fieldValue)Sets the short value to the specified field.voidsetShortArray(int column, short[] fieldValue)Sets the short array value to the specified field.voidsetString(int column, java.lang.String fieldValue)Sets the String value to the specified field.voidsetStringArray(int column, java.lang.String[] fieldValue)Sets the String array value to the specified field.voidsetTimestamp(int column, java.util.Date fieldValue)Sets the TIMESTAMP value to the specified field.voidsetTimestampArray(int column, java.util.Date[] fieldValue)Sets the TIMESTAMP array value to the specified field.voidsetValue(int column, java.lang.Object fieldValue)Sets the value to the specified field.
-
-
-
Method Detail
-
createKey
Row.Key createKey() throws GSException
Creates a newRow.Keyinstance with only the columns that configure the row key and the same field values for those columns.- Returns:
- Created
Row.Key - Throws:
GSException- If there is no Row key- Since:
- 4.3
-
createRow
Row createRow() throws GSException
Creates a newRowinstance with the same field values.- Returns:
- Created
Row - Throws:
GSException- It will not be thrown in the current version.- Since:
- 4.3
-
getBlob
java.sql.Blob getBlob(int column) throws GSExceptionReturns 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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 GSExceptionReturns the boolean value of the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as empty value.
- 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 GSExceptionReturns 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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 GSExceptionReturns the byte value of the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as empty value.
- 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 GSExceptionReturns 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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 GSExceptionReturns the double value of the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as empty value.
- 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 GSExceptionReturns 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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 GSExceptionReturns the float value of the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as empty value.
- 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 GSExceptionReturns 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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 GSExceptionReturns the int value of the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as empty value.
- 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 GSExceptionReturns 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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 GSExceptionReturns the long value of the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as empty value.
- 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 GSExceptionReturns 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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
ContainerInfoin which only the Column layout information including the existence of anyRowKeyis set, and the Container name, the Container type, index settings, and the TimeSeries configuration options are not included.- Returns:
ContainerInfohaving only container information related to the schema.- Throws:
GSException- This will not be thrown in the current version.
-
getShort
short getShort(int column) throws GSExceptionReturns the short value of the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as empty value.
- 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 GSExceptionReturns 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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 GSExceptionReturns the String value of the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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 GSExceptionReturns 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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 GSExceptionReturns 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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 GSExceptionReturns 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, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - 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 GSExceptionReturns the value of the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.- Returns:
- the value of the target field. If NULL is set as
null. - Throws:
GSException- if the specified Column number is out of range.
-
isNull
boolean isNull(int column) throws GSExceptionReturns to the specified field regardless it is set to NULL or not.Whenever a column with the NOT NULL constraint is specified, returns
false.- Parameters:
column- Column number of target field. Values greater than0and less than the number of columns- Returns:
- regardless the specified field is set to NULL or not
- Throws:
GSException- when a column number outside the range is specified- Since:
- 3.5
-
setBlob
void setBlob(int column, java.sql.Blob fieldValue) throws GSExceptionSets 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, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.GSException- if the type of the specified field does not match the type of the Column.
-
setBool
void setBool(int column, boolean fieldValue) throws GSExceptionSets the boolean value to the specified field.- Parameters:
column- the Column number of the target field, from0to 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 GSExceptionSets 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, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.GSException- if the type of the specified field does not match the type of the Column.
-
setByte
void setByte(int column, byte fieldValue) throws GSExceptionSets the byte value to the specified field.- Parameters:
column- the Column number of the target field, from0to 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 GSExceptionSets 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, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.GSException- if the type of the specified field does not match the type of the Column.
-
setDouble
void setDouble(int column, double fieldValue) throws GSExceptionSets the double value to the specified field.- Parameters:
column- the Column number of the target field, from0to 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 GSExceptionSets 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, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.GSException- if the type of the specified field does not match the type of the Column.
-
setFloat
void setFloat(int column, float fieldValue) throws GSExceptionSets the float value to the specified field.- Parameters:
column- the Column number of the target field, from0to 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 GSExceptionSets 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, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.GSException- if the type of the specified field does not match the type of the Column.
-
setGeometry
void setGeometry(int column, Geometry fieldValue) throws GSExceptionSets the Geometry value to the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.GSException- if the type of the specified field does not match the type of the Column.
-
setInteger
void setInteger(int column, int fieldValue) throws GSExceptionSets the int value to the specified field.- Parameters:
column- the Column number of the target field, from0to 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 GSExceptionSets 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, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.GSException- if the type of the specified field does not match the type of the Column.
-
setLong
void setLong(int column, long fieldValue) throws GSExceptionSets the long value to the specified field.- Parameters:
column- the Column number of the target field, from0to 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 GSExceptionSets 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, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.GSException- if the type of the specified field does not match the type of the Column.
-
setNull
void setNull(int column) throws GSExceptionSet the field to NULL.- Parameters:
column- Column number of the targeted field. Values greater than0and less than the number of columns- Throws:
GSException- when a column number outside the range is specifiedGSException- when a column with NOT NULL constraint is specified- Since:
- 3.5
-
setShort
void setShort(int column, short fieldValue) throws GSExceptionSets the short value to the specified field.- Parameters:
column- the Column number of the target field, from0to 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 GSExceptionSets 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, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.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 GSExceptionSets the String value to the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as field value for a column with NOT NULL constraint.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 GSExceptionSets 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, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.GSException- if the array element of a field value of array type containsnullGSException- 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 GSExceptionSets 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, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.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 GSExceptionSets 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, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- ifnullis specified as the field value for a column with a NOT NULL constraint.GSException- if the array element of a field value of array type containsnullGSException- 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 GSExceptionSets the value to the specified field.- Parameters:
column- the Column number of the target field, from0to number of Columns minus one.fieldValue- value of the target field- Throws:
GSException- if the specified Column number is out of range.GSException- whennullis specified as a field value for a column with a NOT NULL constraintGSException- if the array element of a field value of array type containsnullGSException- if the type of the specified field does not match the type of the Column.
-
-
-
@Retention(value=RUNTIME) @Target(value={FIELD,METHOD}) public @interface RowFieldSets options for mapping Row fields of aContainer.Applicable to each Row field that configures a composite Row key, but not applicable to the field method for setting and getting the entire composite Row key as one object.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element and Description intcolumnNumberSets a Column number.java.lang.StringnameSets 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
0or more and less than the number of Columns. Duplicate Column numbers cannot be specified in a single Container. In the current version, a Row key must be always assigned to the first Column. If the default value-1is specified, the corresponding Column number is automatically determined.For the Row object with a composite Row key when setting a number for a Row field other than the Row key, make sure that the number does not overlap with the number assigned to each column that configures the composite Row key.
- 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 RowKeyIndicates the correspondence with a key ofContainer.For a composite Row key, applicable to the field method for setting and getting the entire composite Row key as one object, not applicable to each row field that configures a composite Row key.
- java.lang.Object
-
- com.toshiba.mwcloud.gs.RowKeyPredicate<K>
-
- Type Parameters:
K- type ofRowKey
public class RowKeyPredicate<K> extends java.lang.ObjectRepresents the condition that aRowKeysatisfies.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.
- Since:
- 1.5
-
-
Method Summary
Methods Modifier and Type Method and Description voidadd(K key)Appends the value of theRowKeyas one of the elements of the individual condition.static <K> RowKeyPredicate<K>create(java.lang.Class<K> keyType)Creates an instance ofRowKeyPredicatewith theGSTypecorresponding to the specifiedClassas theRowKeytype.static RowKeyPredicate<Row.Key>create(ContainerInfo info)Creates an instance ofRowKeyPredicatebased on the Row key column definition described in the specifiedContainerInfo.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.KgetFinish()Returns the value ofRowKeyat the last position of the range condition.ContainerInfogetKeySchema()Returns the Row key schema used as a search condition.GSTypegetKeyType()Returns the type of Row key used as a search condition, except when it is a search condition for the composite Row key.KgetStart()Returns the value of theRowKeyat the starting position of the range condition.voidsetFinish(K finishKey)Sets the value of theRowKeyat the last position of the range condition.voidsetStart(K startKey)Sets the value of theRowKeyat the starting position of the range condition.
-
-
-
Method Detail
-
add
public void add(K key) throws GSException
Appends the value of theRowKeyas one of the elements of the individual condition.A
RowKeywith the same value as the added value is deemed as conforming.- Parameters:
key- value ofRowKeyto be appended as one of the elements of the individual condition. Must not be anullvalue.- 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 asRowKeyjava.lang.NullPointerException- whennullis specified as an argument
-
create
public static <K> RowKeyPredicate<K> create(java.lang.Class<K> keyType) throws GSException
Creates an instance ofRowKeyPredicatewith theGSTypecorresponding to the specifiedClassas theRowKeytype.The container to be evaluated by the search condition must have a Row key with a single column, and the type of the Row key must be same as the specified
GSType.The type of
RowKeythat can be set is only that allowed by either one of the subinterfaces ofContainer. For the correspondence ofClasstoGSType, see the definition ofContainer.For a composite Row key, use
create(ContainerInfo)which allows to create a search condition regardless of the number of columns that configure a Row key.- Parameters:
keyType-Classcorresponding to aRowKeyused as a search condition- Returns:
RowKeyPredicatenewly created- Throws:
GSException- if the specified type is not always supported as aRowKeyjava.lang.NullPointerException- ifnullis specified in the argument.- See Also:
Container
-
create
public static RowKeyPredicate<Row.Key> create(ContainerInfo info) throws GSException
Creates an instance ofRowKeyPredicatebased on the Row key column definition described in the specifiedContainerInfo.The container to be evaluated by the search condition must have a Row key and must correspond to the column definition described in the specified
ContainerInfo. Column definitions other than that of the Row key are not used for the evaluation.- Parameters:
info- Container information including the column layout of the Row key for which the search condition is determined. Other contents are ignored- Returns:
RowKeyPredicatenewly created- Throws:
GSException- if the specified information does not include the Row key or is always not supported as a Row keyjava.lang.NullPointerException- ifnullis specified in the argument.- Since:
- 4.3
-
create
public static RowKeyPredicate<java.lang.Object> create(GSType keyType) throws GSException
Creates an instance ofRowKeyPredicatewith the specifiedGSTypeas theRowKeytype.The target Container must have a
RowKey, and the type of theRowKeymust be the specifiedGSTypeUnlike
create(Class), this method is used when the type ofRowKeyis 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
RowKeythat can be set is only that allowed by either one of the subinterfaces ofContainer.- Parameters:
keyType- type ofRowKeyused as a search condition- Returns:
RowKeyPredicatenewly created- Throws:
GSException- if the specified type is not always supported as aRowKeyjava.lang.NullPointerException- ifnullis 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
UnsupportedOperationExceptionwill 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:
Collectioncontaining all of the values of the row keys that make up the individual condition.
-
getFinish
public K getFinish()
Returns the value ofRowKeyat the last position of the range condition.- Returns:
- the value of
RowKeyat the last position of the range condition, ornullif it is not set.
-
getKeySchema
public ContainerInfo getKeySchema()
Returns the Row key schema used as a search condition.The schema information to be returned does not have column information other than the Row key and container information other than the schema, even though it is in the information used to create the search condition.
- Returns:
ContainerInfothat has only container information related to the schema of the Row key- Since:
- 4.3
-
getKeyType
public GSType getKeyType()
Returns the type of Row key used as a search condition, except when it is a search condition for the composite Row key.Uses
getKeySchema()to get the schema for any Row key including the composite Row key.- Returns:
- the type of
RowKeyused as a search condition. - Throws:
java.lang.IllegalStateException- if called for a search condition for a composite Row key.
-
getStart
public K getStart()
Returns the value of theRowKeyat the starting position of the range condition.- Returns:
- the value of
RowKeyat the starting position of the range condition, ornullif it is not set.
-
setFinish
public void setFinish(K finishKey) throws GSException
Sets the value of theRowKeyat the last position of the range condition.A
RowKeywith a value larger than the specified value is deemed as non-conforming.A Row key with no magnitude relation defined, including a Row key of the STRING type or one with a composite Row key containing STRING type, are not used for the determination even though it can be set as a condition.
- Parameters:
finishKey- the value ofRowKeyat 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 theRowKeyat the starting position of the range condition.A
RowKeywith a value smaller than the specified value is deemed as non-conforming.A Row key with no magnitude relation defined, including a Row key of the STRING type or one with a composite Row key containing STRING type, are not used for the determination even though it can be set as a condition.
- Parameters:
startKey- value ofRowKeyat 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.CloseableManages 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
ResultSetto 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 voidclose()Releases related resources as necessary.booleanhasNext()Returns TRUE if a Row set has at least one Row ahead of the current cursor position.Rnext()Moves the cursor to the next Row in a Row set and returns the Row object at the moved position.voidremove()Deletes the Row at the current cursor position.intsize()Returns the size, namely the number of Rows at the time of creating a Row set.voidupdate(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 GSExceptionReleases related resources as necessary.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
GSException- It will not be thrown in the current version.- See Also:
Closeable.close()
-
hasNext
boolean hasNext() throws GSExceptionReturns 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.When
FetchOption.PARTIAL_EXECUTIONhas been set to be effective, the continuation of the query execution may be executed in this method.- 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- when there is a timeout of transaction for this processing or of related processing, the target container has been deleted, its schema has been changed or there is a connection failure.GSException- if called after this object or the relevantContaineris closed.
-
remove
void remove() throws GSExceptionDeletes the Row at the current cursor position.It can be used only for
RowSetobtained 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 onRowSetobtained 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 relevantContaineris closed.
-
size
int size()
Returns the size, namely the number of Rows at the time of creating a Row set.If
FetchOption.PARTIAL_EXECUTIONhas been set to be effective, the result cannot be obtained despite the status of the query processing progress.- Throws:
java.lang.IllegalStateException- if the number of rows cannot be obtained by the option setting.
-
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.nullcannot be specified. The Row key contained in the specified Row object is ignored.It can be used only for
RowSetobtained 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 onRowSetobtained 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 relevantContaineris 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 anullparameter 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 NEXTReturns the oldest among the Rows whose timestamp are identical with or later than the specified time.NEXT_ONLYReturns the oldest among the Rows whose timestamp are later than the specified time.PREVIOUSReturns the newest among the Rows whose timestamp are identical with or earlier than the specified time.PREVIOUS_ONLYReturns the newest among the Rows whose timestamp are earlier than the specified time.
-
Method Summary
Methods Modifier and Type Method and Description static TimeOperatorvalueOf(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
-
-
- java.lang.Object
-
- com.toshiba.mwcloud.gs.TimeSeries.BindType
-
- Enclosing interface:
- TimeSeries<R>
public static class TimeSeries.BindType extends java.lang.ObjectAuxiliary class for configuringContainer.BindTypewhich is associated withTimeSeriesand its type parameters.- Since:
- 4.3
- See Also:
Container.BindType
-
-
Method Summary
Methods Modifier and Type Method and Description static <R> Container.BindType<java.util.Date,R,? extends TimeSeries<R>>of(java.lang.Class<R> rowClass)Returns the specified Row object type andContainer.BindTypeassociated withTimeSeries.
-
-
-
Method Detail
-
of
public static <R> Container.BindType<java.util.Date,R,? extends TimeSeries<R>> of(java.lang.Class<R> rowClass) throws GSException
Returns the specified Row object type andContainer.BindTypeassociated withTimeSeries.- Type Parameters:
R- the type of a Row object- Parameters:
rowClass- Class object corresponding to the type of the Row object- Throws:
GSException- if an inconsistency is detected between the type of Row key and the type of Row object- Since:
- 4.3
-
-
-
- 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.There are some limitations on row operations unlike
Collection. If a compression option based onTimeSeriesPropertieshas been set, the following operations cannot be performed.- Update of the specified row
- Deletion of the specified row
- Creation of a new row that has an older timestamp key than the latest one.
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static classTimeSeries.BindTypeAuxiliary class for configuringContainer.BindTypewhich is associated withTimeSeriesand its type parameters.
-
Method Summary
Methods Modifier and Type Method and Description AggregationResultaggregate(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.booleanappend(R row)Newly creates or updates a Row with a Row key of the current time on GridDB.Rget(java.util.Date key)Returns the content of a Row corresponding to the Row key, based on the specified option.Rget(java.util.Date base, TimeOperator timeOp)Returns one Row related with the specified time.Rinterpolate(java.util.Date base, java.lang.String column)Performs linear interpolation etc. of a Row object corresponding to the specified time.booleanput(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.booleanremove(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, createIndex, createRow, createTrigger, dropIndex, dropIndex, dropIndex, dropTrigger, flush, get, getBindType, 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
columnmight 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. Specifynullif the specified aggregation method does not target a specific Column.aggregation- An aggregation method- Returns:
AggregationResultif the aggregation result is stored in it, ornullif not. See the description ofAggregationResultfor 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- ifnullis 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- ifnullis 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,ClassCastExceptionwill not be thrown.- Specified by:
getin 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 anullparameter 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
nullif 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 anullparameter 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 anullparameter is specified.
-
put
boolean put(java.util.Date key, R row) throws GSExceptionNewly 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
keyor the Row key in the specified Row object ifkeyis not specified.Only rows that have a newer timestamp key than any existing row can be created. If the timestamp is equal to the newest one, no update occurs and the existing row is held.
In the manual commit mode, the target Row is locked. Other Rows in the same internal storage unit are also locked.
- Specified by:
putin 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- ifnullis 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. Anullvalue indicates the timestamp of the oldest Row in this TimeSeries.end- end time ornull. Anullvalue 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).For arguments that cannot specify
NULL, depending on theNULLstatus,NullPointerExceptionmay not be dispatched. If there is an error in the argument, an exception will be thrown when the query result is fetched.- Parameters:
start- start time ornull. Anullvalue 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.nullcannot be specifiedQueryOrder.ASCENDINGindicates the order from older to newer, andQueryOrder.DESCENDINGindicates 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
columnSetandmodeif 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).In the current version, for arguments that cannot specify
GSExceptionorNULL, depending on theNULLstatus,NullPointerExceptionmay not be dispatched. If there is an error in the argument, an exception will be thrown when the query result is fetched.- Parameters:
start- start time.nullcannot be specifiedend- end time.nullcannot be specifiedcolumnSet- a set of names of the Columns to be interpolated according tomode. An empty set indicates no specification of target Columns. Anullvalue indicates the same as an empty set.mode- an interpolation method.nullcannot be specifiedinterval- a sampling interval.0or a negative value cannot be specified.intervalUnit- the time unit of the sampling interval.TimeUnit.YEARandTimeUnit.MONTHcannot be specified.nullcannot be specified- Throws:
GSException- It will not be thrown in the current version.
-
remove
boolean remove(java.util.Date key) throws GSExceptionDeletes 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.
It can not be used for time series that has a setting of compression option.
In the manual commit mode, the target Row is locked.
- Specified by:
removein 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 anullparameter 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.CloneableRepresents 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 column names and 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 TimeSeriesPropertiesclone()Creates newTimeSeriesPropertieswith the same settings as this object.CompressionMethodgetCompressionMethod()Gets the type of compression methodjava.lang.DoublegetCompressionRate(java.lang.String column)Returns the ratio of error range based on the possible value range of the specified column for the thinning compression with relative error.java.lang.DoublegetCompressionSpan(java.lang.String column)Returns the difference between maximum and minimum possible value of the specified column by the thinning compression with relative error.java.lang.DoublegetCompressionWidth(java.lang.String column)Returns the width of error boundary on the specified column for the thinning compression with absolute error.intgetCompressionWindowSize()Returns the window size for the thinning compression.TimeUnitgetCompressionWindowSizeUnit()Returns the unit of the window size for the thinning compression.intgetExpirationDivisionCount()Return the division number for the validity period that corresponds to the number of expired rows data units to be released.intgetRowExpirationTime()Returns the elapsed time period of a Row to be used as the basis of the validity period.TimeUnitgetRowExpirationTimeUnit()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()Returns all names of the columns which have additional setting.java.lang.BooleanisCompressionRelative(java.lang.String column)Returns value which indicates whether the error threshold of the thinning compression with error is relative or not on the specified column.voidsetAbsoluteHiCompression(java.lang.String column, double width)Sets parameters for the thinning compression method with absolute error on the specified column.voidsetCompressionMethod(CompressionMethod compressionMethod)Sets a type of TimeSeries compression method.voidsetCompressionWindowSize(int compressionWindowSize, TimeUnit compressionWindowSizeUnit)Sets a window size which means maximum time span of contiguous data thinned by the compression.voidsetExpirationDivisionCount(int count)Sets the division number for the validity period as the number of expired row data units to be released.voidsetRelativeHiCompression(java.lang.String column, double rate, double span)Sets parameters for the thinning compression method with relative error on the specified column.voidsetRowExpiration(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 newTimeSeriesPropertieswith the same settings as this object.- Overrides:
clonein classjava.lang.Object- Returns:
- Creates and returns a copy of this object.
-
getCompressionMethod
public CompressionMethod getCompressionMethod()
Gets the type of compression method- Returns:
- Type of compression method.
nullis not returned.
-
getCompressionRate
public java.lang.Double getCompressionRate(java.lang.String column)
Returns the ratio of error range based on the possible value range of the specified column for the thinning compression with relative error.The possible value range can be obtained by
getCompressionWidth(String).- Parameters:
column- Column name- Returns:
- If the specified column has the corresponding
setting, the value is returned, otherwise
null - Throws:
java.lang.IllegalArgumentException- When detecting an illegal column name against the limitations.java.lang.NullPointerException- Ifnullis specified in the argument.
-
getCompressionSpan
public java.lang.Double getCompressionSpan(java.lang.String column)
Returns the difference between maximum and minimum possible value of the specified column by the thinning compression with relative error.- Parameters:
column- Column name- Returns:
- If the specified column has the corresponding
setting, the value is returned, otherwise
null - Throws:
java.lang.IllegalArgumentException- When detecting an illegal column name against the limitations.java.lang.NullPointerException- Ifnullis specified in the argument.
-
getCompressionWidth
public java.lang.Double getCompressionWidth(java.lang.String column)
Returns the width of error boundary on the specified column for the thinning compression with absolute error.- Parameters:
column- Column name- Returns:
- If the specified column has the corresponding
setting, the value is returned, otherwise
null - Throws:
java.lang.IllegalArgumentException- When detecting an illegal column name against the limitations.java.lang.NullPointerException- ifnullis specified in the argument.
-
getCompressionWindowSize
public int getCompressionWindowSize()
Returns the window size for the thinning compression. The contiguous data can be thinned in the window size which represents a time span.- Returns:
- Window size.
-1if it has not been set.
-
getCompressionWindowSizeUnit
public TimeUnit getCompressionWindowSizeUnit()
Returns the unit of the window size for the thinning compression. The contiguous data can be thinned in the window size which represents a time span.- Returns:
- Unit of window size.
-1if it has not been set.
-
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.
-1if unspecified. - Since:
- 2.0
- 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.
-1if 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.
nullif unspecified.
-
getSpecifiedColumns
public java.util.Set<java.lang.String> getSpecifiedColumns()
Returns all names of the columns which have additional setting.This object is not changed by updating the returned object, and the returned object is not changed by updating this object.
- Returns:
- Name set of columns which have additional setting.
-
isCompressionRelative
public java.lang.Boolean isCompressionRelative(java.lang.String column)
Returns value which indicates whether the error threshold of the thinning compression with error is relative or not on the specified column.- Parameters:
column- Column name- Returns:
- If the specified column has the corresponding
setting, the value is returned, otherwise
null - Throws:
java.lang.IllegalArgumentException- When detecting an illegal column name against the limitations.java.lang.NullPointerException- Ifnullis specified in the argument.
-
setAbsoluteHiCompression
public void setAbsoluteHiCompression(java.lang.String column, double width)Sets parameters for the thinning compression method with absolute error on the specified column.If a different compression method had been set, it is changed to the thinning method.
The limitation of column type and the upper limit of the number of columns are the same as
setRelativeHiCompression(String, double, double).- Parameters:
column- Column namewidth- Width of error boundary corresponding togetCompressionWidth(String)- Throws:
java.lang.IllegalArgumentException- When detecting an illegal column name against the limitations.java.lang.NullPointerException- Ifnullis specified in the argument.
-
setCompressionMethod
public void setCompressionMethod(CompressionMethod compressionMethod)
Sets a type of TimeSeries compression method.When changing the compression method, all settings of individual column are released.
- Parameters:
compressionMethod- A type of compression method- Throws:
java.lang.NullPointerException- Ifnullis specified in the argument
-
setCompressionWindowSize
public void setCompressionWindowSize(int compressionWindowSize, TimeUnit compressionWindowSizeUnit)Sets a window size which means maximum time span of contiguous data thinned by the compression.When the window size has been set to a time series and a row in the time series is apart over the window size from previous stored data, even if the row satisfies the other compression conditions, the row is not thinned.
This setting is ignored if
CompressionMethod.NOhas been set.If
CompressionMethod.HIorCompressionMethod.SShas been set and this setting is not specified, the maximum value of TIMESTAMP is set as the window size.Even if the row is in the window size from the previous data and it satisfies the conditions of the compression, it may not be thinned depending on its stored location, etc.
- Parameters:
compressionWindowSize- Window size. It is not allowed to set value less than or equal to0.compressionWindowSizeUnit- Unit of the window size.TimeUnit.YEARandTimeUnit.MONTHcannot be specified.- Throws:
java.lang.IllegalArgumentException- WhencompressionWindowSizeis out of the range.java.lang.IllegalArgumentException- when detecting an illegal column name against the limitationsjava.lang.NullPointerException- ifnullis specified in the argument.
-
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.
See the GridDB Features Reference for the upper limit of the division number. It will be failed if the division number exceeds the size limit.
If the elapsed time period is not set, the setting of division number is ignored. If the elapsed time period has been set and the setting of division number is not set, the division number is set to the default value of the connected GridDB server.
- Parameters:
count- the division number for the validity period. Must not be0or less.- Throws:
java.lang.IllegalArgumentException- if the division number is specified as0or less.- Since:
- 2.0
-
setRelativeHiCompression
public void setRelativeHiCompression(java.lang.String column, double rate, double span)Sets parameters for the thinning compression method with relative error on the specified column.If a different compression method had been set, it is changed to the thinning method.
Multiplying
rateandspantogether is equal to the value that is obtained bygetCompressionWidth(String)in the thinning compression with absolute error.The column types are limited to the followings.
See the GridDB Features Reference for the upper limit of the number of columns on which the parameters can be specified. The number of options that is over the limit can be created, but the TimeSeries cannot be created for that case.
- Parameters:
column- Column namerate- Boundary value of relative error based onspan. It must be greater than or equal to 0.0 and less than or equal to 1.0.span- The difference between maximum and minimum value of the column.- Throws:
java.lang.IllegalArgumentException- When detecting an illegal column name against the limitations, or specifying value out of the range forrate.java.lang.NullPointerException- Ifnullis specified in the argument.
-
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 be0or less.timeUnit- the unit of the elapsed time period.TimeUnit.YEARorTimeUnit.MONTHcannot be specified.- Throws:
java.lang.IllegalArgumentException- ifelapsedTimeortimeUnitof out of range is specifiedjava.lang.IllegalArgumentException- when detecting an illegal column name against the limitationsjava.lang.NullPointerException- ifnullis 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 DAYHOURMILLISECONDMINUTEMONTHSECONDYEAR
-
Method Summary
Methods Modifier and Type Method and Description static TimeUnitvalueOf(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.ObjectProvides the utilities for manipulating time data.Used to help construct TQL statements and to process TIMESTAMP values with the same notation as TQL.
Does not depend on the time zone and locale settings of the execution environment.
-
-
Method Summary
Methods Modifier and Type Method and Description static java.util.Dateadd(java.util.Date timestamp, int amount, TimeUnit timeUnit)Adds a specific value to the specified time.static java.util.Dateadd(java.util.Date timestamp, int amount, TimeUnit timeUnit, java.util.TimeZone zone)Adds a fixed value to the time using the specified time zone setting.static java.util.Datecurrent()Returns the current time.static java.util.CalendarcurrentCalendar()Returns the current time as aCalendarobject.static java.lang.Stringformat(java.util.Date timestamp)Returns the string representing the specified time, according to the TIMESTAMP value notation of TQL.static java.lang.Stringformat(java.util.Date timestamp, java.util.TimeZone zone)Using the specified time zone setting, returns the string representing the specified time, according to the TIMESTAMP value notation of TQL.static java.text.DateFormatgetFormat()Returns the date format conforming to the TIMESTAMP value notation of TQL.static java.text.DateFormatgetFormat(java.util.TimeZone zone)Using the specified time zone setting, returns the string representing the specified time, according to the TIMESTAMP value notation of TQL.static java.util.Dateparse(java.lang.String source)Returns aDateobject 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.
- Parameters:
timestamp- target timeamount- value to be addedtimeUnit- unit of value to be added- Returns:
- The added value
- Throws:
java.lang.NullPointerException- whennullis specified fortimestamp,timeUnit
-
add
public static java.util.Date add(java.util.Date timestamp, int amount, TimeUnit timeUnit, java.util.TimeZone zone)Adds a fixed value to the time using the specified time zone setting.Depending on the unit of time used for calculation, the time zone setting may not be affected.
- Parameters:
timestamp- target timeamount- value to be addedtimeUnit- unit of value to be addedzone- time zone setting used for calculation- Returns:
- The added value
- Throws:
java.lang.NullPointerException- whennullis specified fortimestamp,timeUnit- Since:
- 4.3
-
current
public static java.util.Date current()
Returns the current time.
-
currentCalendar
public static java.util.Calendar currentCalendar()
Returns the current time as aCalendarobject.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.
- Parameters:
timestamp- target time- Throws:
java.lang.NullPointerException- whennullis specified as argument
-
format
public static java.lang.String format(java.util.Date timestamp, java.util.TimeZone zone)Using the specified time zone setting, returns the string representing the specified time, according to the TIMESTAMP value notation of TQL.- Parameters:
timestamp- target timezone- time zone setting used for calculation- Returns:
- corresponding string representation
- Throws:
java.lang.NullPointerException- whennullis specified as argument- Since:
- 4.3
- See Also:
format(Date)
-
getFormat
public static java.text.DateFormat getFormat()
Returns the date format conforming to the TIMESTAMP value notation of TQL.The current version always uses the UTC timezone.
- Returns:
- date format
The time representation containing a negative year value is not supported.
-
getFormat
public static java.text.DateFormat getFormat(java.util.TimeZone zone)
Using the specified time zone setting, returns the string representing the specified time, according to the TIMESTAMP value notation of TQL.- Parameters:
zone- applicable time zone settings- Returns:
- date format
- Throws:
java.lang.NullPointerException- whennullis specified as argument- Since:
- 4.3
-
parse
public static java.util.Date parse(java.lang.String source) throws java.text.ParseExceptionReturns aDateobject corresponding to the specified string, according to the TIMESTAMP value notation of TQL.- Parameters:
source- string representation of target time- Returns:
Dateobject corresponding to the specified string- Throws:
java.text.ParseException- if the specified string does not match any time representation.java.lang.NullPointerException- whennullis specified as argument
-
-
-
@Retention(value=RUNTIME) @Target(value={FIELD,METHOD}) public @interface TransientRowFieldSpecifies 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 DELETEIndicate the deletion of a row for a Container.PUTIndicate 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.EventTypevalueOf(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 JMSIndicate the trigger type to notify in a Java Message Service (JMS) notification when a Container is updated.RESTIndicate 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.TypevalueOf(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.ObjectRepresent 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 classTriggerInfo.EventTypeRepresent the update operation type subject to monitoring by the trigger.static classTriggerInfo.TypeRepresent 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.StringgetJMSDestinationName()Get the destination name used in a JMS notification.java.lang.StringgetJMSDestinationType()Get the destination type used in a JMS notification.java.lang.StringgetName()Get the trigger name.java.lang.StringgetPassword()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.TypegetType()Get the trigger type.java.net.URIgetURI()Get the notification destination URI when the trigger is discharged.java.lang.StringgetUser()Get user name when connecting to a notification destination server.voidsetJMSDestinationName(java.lang.String destinationName)Set the destination name used in a JMS notification.voidsetJMSDestinationType(java.lang.String destinationType)Set the destination type used in a JMS notification.voidsetName(java.lang.String name)Set the trigger name.voidsetPassword(java.lang.String password)Set the password when connecting to a notification destination server.voidsetTargetColumns(java.util.Set<java.lang.String> columnSet)Set the column name subject to notification when a trigger is discharged.voidsetTargetEvents(java.util.Set<TriggerInfo.EventType> eventSet)Set the update operation type subject to trigger discharge.voidsetType(TriggerInfo.Type type)Set the trigger type.voidsetURI(java.net.URI uri)Set the notification destination URI when the trigger is discharged.voidsetUser(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,
UnsupportedOperationExceptionmay 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,
UnsupportedOperationExceptionmay 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
nullis 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
nullis 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/
nullis 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/
nullis 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.When identifying a column as the target of the notification, the difference in uppercase and lowercase letters is not distinguished. 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- Ifnullis 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- Ifnullis specified in the argument
-
setType
public void setType(TriggerInfo.Type type)
Set the trigger type.If
nullis 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
nullis 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/
nullis 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/
nullis 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
-
1.2 API Samples
1.2.1 Sample of Collection Operations
package test;
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;
// Operation 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 {
// Acquiring 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);
// Creating a collection
Collection<String, Person> col = store.putCollection("col01", Person.class);
// Setting an index for a column
col.createIndex("count");
// Setting auto-commit off
col.setAutoCommit(false);
// Preparing row data
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 };
// Operating a row in KV format: RowKey is "name01"
boolean update = true;
col.put(person); // Registration
person = col.get(person.name, update); // Aquisition (Locking to update)
col.remove(person.name); // Deletion
// Operating a row in KV format: RowKey is "name02"
col.put("name02", person); // Registration (Specifying RowKey)
// Committing transaction (releasing lock)
col.commit();
// Search rows in a container
Query<Person> query = col.query("select * where name = 'name02'");
// Fetching and updating retrieved rows
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));
}
// Committing transaction
col.commit();
// Releasing resource
store.close();
}
}
1.2.2 Sample of TimeSeries Operations - Storage and Extraction of Specific Range
package test;
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.TimestampUtils;
import com.toshiba.mwcloud.gs.TimeUnit;
// 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 {
// Acquiring 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);
// Creating a TimeSeries (Only obtain the specified TimeSeries if it already exists)
TimeSeries<Point> ts = store.putTimeSeries("point01", Point.class);
// Preparing 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);
}
// Releasing resource
store.close();
}
}
1.2.3 Sample of TimeSeries Operations - Search and Aggregation
package test;
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.TimestampUtils;
import com.toshiba.mwcloud.gs.TimeUnit;
// 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");
// Acquiring 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());
}
// Releasing resource
store.close();
}
}
1.2.4 Sample of Collection Operations - Schema definition using container information
package test;
import java.util.Arrays;
import java.util.Properties;
import com.toshiba.mwcloud.gs.ColumnInfo;
import com.toshiba.mwcloud.gs.Container;
import com.toshiba.mwcloud.gs.ContainerInfo;
import com.toshiba.mwcloud.gs.ContainerType;
import com.toshiba.mwcloud.gs.GSException;
import com.toshiba.mwcloud.gs.GSType;
import com.toshiba.mwcloud.gs.GridStore;
import com.toshiba.mwcloud.gs.GridStoreFactory;
import com.toshiba.mwcloud.gs.Query;
import com.toshiba.mwcloud.gs.Row;
import com.toshiba.mwcloud.gs.RowSet;
// Schema definition using container information
public class Sample4 {
public static void main(String[] args) throws GSException {
// Acquiring 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);
// Creating a container information
ContainerInfo info = new ContainerInfo();
info.setType(ContainerType.COLLECTION);
info.setName("col01");
info.setColumnInfoList(Arrays.asList(
new ColumnInfo("name", GSType.STRING),
new ColumnInfo("status", GSType.BOOL),
new ColumnInfo("count", GSType.LONG),
new ColumnInfo("lob", GSType.BYTE_ARRAY)));
info.setRowKeyAssigned(true);
// Creating a collection
Container<String, Row> container = store.putContainer(null, info, false);
// Setting an index for a column
container.createIndex("count");
// Setting auto-commit off
container.setAutoCommit(false);
// Preparing row data
Row row;
{
String name = "name01";
boolean status = false;
long count = 1;
byte[] lob = new byte[] { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74 };
row = container.createRow();
row.setString(0, name);
row.setBool(1, status);
row.setLong(2, count);
row.setByteArray(3, lob);
}
// Operating a row in KV format: RowKey is "name01"
boolean update = true;
container.put(row); // Registration
row = container.get("name01", update); // Acquisition (Locking to update)
container.remove("name01"); // Deletion
// Operating a row in KV format: RowKey is "name02"
container.put("name02", row); // Registration (Specifying RowKey)
// Committing transaction (Releasing lock)
container.commit();
// Search rows in a container
Query<Row> query = container.query("select * where name = 'name02'");
// Fetching and updating retrieved rows
RowSet<Row> rs = query.fetch(update);
while (rs.hasNext()) {
// Updating retrived rows
row = rs.next();
String name = row.getString(0);
boolean status = row.getBool(1);
long count = row.getLong(2);
byte[] lob = row.getByteArray(3);
count += 1;
rs.update(row);
System.out.println("Person:" +
" name=" + name +
" status=" + status +
" count=" + count +
" lob=" + Arrays.toString(lob));
}
// Committing transaction
container.commit();
// Releasing resource
store.close();
}
}1.2.5 Sample of Collection Operations - Bulk operation on multiple containers
package test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import com.toshiba.mwcloud.gs.ColumnInfo;
import com.toshiba.mwcloud.gs.Container;
import com.toshiba.mwcloud.gs.ContainerInfo;
import com.toshiba.mwcloud.gs.ContainerType;
import com.toshiba.mwcloud.gs.GSException;
import com.toshiba.mwcloud.gs.GSType;
import com.toshiba.mwcloud.gs.GridStore;
import com.toshiba.mwcloud.gs.GridStoreFactory;
import com.toshiba.mwcloud.gs.Query;
import com.toshiba.mwcloud.gs.Row;
import com.toshiba.mwcloud.gs.RowKeyPredicate;
import com.toshiba.mwcloud.gs.RowSet;
// Bulk operation on multiple containers
public class Sample5 {
public static void main(String[] args) throws GSException {
final List<String> containerNameList = Arrays.asList(
"col01", "col02", "col03", "col04", "col05");
final List<String> keyList = Arrays.asList(
"name01", "name02");
// Acquiring 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);
// Creating a container information
ContainerInfo info = new ContainerInfo();
info.setType(ContainerType.COLLECTION);
info.setColumnInfoList(Arrays.asList(
new ColumnInfo("name", GSType.STRING),
new ColumnInfo("status", GSType.BOOL),
new ColumnInfo("count", GSType.LONG),
new ColumnInfo("lob", GSType.BYTE_ARRAY)));
info.setRowKeyAssigned(true);
// Creating collections
List<Container<String, Row>> containerList =
new ArrayList<Container<String, Row>>();
for (String containerName : containerNameList) {
Container<String, Row> container =
store.putContainer(containerName, info, false);
containerList.add(container);
}
// Registering rows in bulk to multiple collections
{
boolean status = false;
long count = 1;
byte[] lob = new byte[] { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74 };
Map<String, List<Row>> inMap = new HashMap<String, List<Row>>();
for (String containerName : containerNameList) {
List<Row> rowList = new ArrayList<Row>();
for (String key : keyList) {
Row row = store.createRow(info);
row.setString(0, key);
row.setBool(1, status);
row.setLong(2, count);
row.setByteArray(3, lob);
count++;
rowList.add(row);
}
inMap.put(containerName, rowList);
}
store.multiPut(inMap);
}
// Acquiring rows in bulk from multiple collections
{
// Constructing conditions for acquisition
Map<String, RowKeyPredicate<String>> predMap =
new HashMap<String, RowKeyPredicate<String>>();
for (String containerName : containerNameList) {
RowKeyPredicate<String> predicate =
RowKeyPredicate.create(String.class);
for (String key : keyList) {
predicate.add(key);
}
predMap.put(containerName, predicate);
}
Map<String, List<Row>> outMap = store.multiGet(predMap);
// Printing results
for (Map.Entry<String, List<Row>> entry : outMap.entrySet()) {
for (Row row : entry.getValue()) {
String name = row.getString(0);
long count = row.getLong(2);
System.out.println("Person[" + entry.getKey() + "]:" +
" name=" + name +
" count=" + count);
}
}
}
// Searching rows in bulk from multiple collections (Using queries)
{
List<Query<Row>> queryList = new ArrayList<Query<Row>>();
for (Container<String, Row> container : containerList) {
String tql = "select * where count >= 0";
queryList.add(container.query(tql));
}
store.fetchAll(queryList);
for (int i = 0; i < queryList.size(); i++) {
Query<Row> query = queryList.get(i);
RowSet<Row> rs = query.getRowSet();
while (rs.hasNext()) {
Row row = rs.next();
String name = row.getString(0);
boolean status = row.getBool(1);
long count = row.getLong(2);
byte[] lob = row.getByteArray(3);
System.out.println("Person[" + i + "]:" +
" name=" + name +
" status=" + status +
" count=" + count +
" lob=" + Arrays.toString(lob));
}
}
}
// Release of resource
store.close();
}
}2 Annex
2.1 Range of values
Describe the range of values such as the upper limit of the value, etc. Refer to GridDB Features Reference for the restriction values of the system.
2.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. |
Value that can be used to TQL operation in spatial (GEOMETRY) type is any arbitrary value returned by the ST_GeomFromText function. Among these values, the value that can be stored containers is excluding the QUADRATICSURFACE structure.
The range of values of objects mapped onto the basic types through API may be different from those of the above basic types. The value out of the described range cannot be registered into containers. But the value may be used in the other operations, such as constructing a search condition. For example, a java.util.Date object to be mapped onto TIMESTAMP by Java API can have a value before the year 1970 that cannot be stored in containers, and the value can be used as a RowKey condition of a RowKeyPredicate object or in a sampling query. However, in that case, it is possible that an error occurs when obtaining rows by the condition. For the representation range of the object itself to be mapped onto the above basic types, see the definition of the object type.
3 Trademark
- GridDB is a trademark of Toshiba Digital Solutions 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.