<?php require_once( dirname(dirname(dirname( __FILE__ ))) . '/wp-load.php' ); ?>
<!-- START of header -->
<?php get_header(); ?>
<!-- END of header -->

<!-- warapper -->

<div class="docs-content">
<!-- START of page navigation -->
<?php get_template_part( 'docs_navigation' ); ?>
<!-- END of page navigation -->
<!-- START of pusher -->
<div class="docs-content-body">
<div id="content" class="docs-content-body__inner">

<h1 class="title">5.1.22 Meta-information</h1>
<h2 id="overview">Overview</h2>
<br>    
<h2 id="container-infomation">Container Infomation</h2>
<p>Note: Explains the value that can be obtained in ContainerInfo.</p>
<strong>List.1 Obtain of Multi-Query results</strong>(ContainerInfomation.java)
<pre class="prettyprint linenums:x">
// Get Container Infomation
ContainerInfo containerInfo = store.getContainerInfo("weather_station");
System.out.println("WeatherStation Container Infomation ##########");
int collectionCount = containerInfo.getColumnCount();
System.out.println("Container Name:" + containerInfo.getName());
System.out.println("Container Type:" + containerInfo.getType());
System.out.println("Column Count:" + collectionCount);
System.out.println("DataAffinity:" + containerInfo.getDataAffinity());
System.out.println("Column Order Ignorable:" + containerInfo.isColumnOrderIgnorable());
System.out.println("RowKeyAssigned:" + containerInfo.isRowKeyAssigned());
</pre>
<strong>List 2 Result of Multi-Query</strong>(ContainerDynamicCreate.java)
<pre class="prettyprint linenums:x">
WeatherStation Container Infomation ##########
Container Name:weather_station
Container Type:COLLECTION
Column Count:5
DataAffinity:null
Column Order Ignorable:false
RowKeyAssigned:true
</pre>
<h2 id="dynamic-container-creation">Dynamic Container creation</h2>
<p>Note: It will be described schema definition and the container of the creation of the container using a ContainerInfo and ColumnInfo. There is such a method other than the method of schema defined using a static class, such as WeatherStation class, explaining the fact that.</p>
<strong>List.3 Dynamic Container creation</strong>(ContainerDynamicCreate.java)
<pre class="prettyprint linenums:x">
// Create Connection
store = logic.createGridStore();

List&lt;ColumnInfo&gt; columnInfoList = new ArrayList&lt;ColumnInfo&gt;();

// Define Container Key and Index
EnumSet&lt;IndexType&gt; indexSet = EnumSet.of(IndexType.HASH);
ColumnInfo keyColumn = new ColumnInfo("id", GSType.STRING, indexSet);
// Define Index
columnInfoList.add(keyColumn);

// Define Container Columns
columnInfoList.add(new ColumnInfo("name", GSType.STRING));
columnInfoList.add(new ColumnInfo("latitude", GSType.DOUBLE));
columnInfoList.add(new ColumnInfo("longitude", GSType.DOUBLE));
columnInfoList.add(new ColumnInfo("hasCamera", GSType.BOOL));

// Define Container
ContainerInfo containerInfo = new ContainerInfo("dynamic_weather_station",
        ContainerType.COLLECTION, columnInfoList, true);

// Create Container
Container&lt;String, Row&gt; dynamicWeatherStaton =
        store.putContainer("dynamic_weather_station", containerInfo, true);
</pre>
<p>Note: Explain the set and registration value way of using the Row.</p>
<strong>List.4 Row registration of dynamic Container</strong>(ContainerDynamicCreate.java)
<pre class="prettyprint linenums:x">
int columnCount = containerInfo.getColumnCount();
for (int rowIndex = 0; rowIndex &lt; 5; rowIndex++) {
    Row row = dynamicWeatherStaton.createRow();
    for (int columnIndex = 0; columnIndex &lt; columnCount; columnIndex++) {
        ColumnInfo columnInfo = containerInfo.getColumnInfo(columnIndex);
        GSType columnType = columnInfo.getType();
        Object value = null;
        switch (columnType) {
            case STRING:
                if ("id".equals(columnInfo.getName())) {
                    value = String.valueOf(rowIndex + 1);
                } else {
                    value = "name_" + (rowIndex + 1) + "_" + columnIndex;
                }
                break;
            case DOUBLE:
                value = Double.valueOf(rowIndex + 1 + columnIndex);
                break;
            case BOOL:
                value = true;
                break;
            // Omitted other types
            default:
                break;
        }

        row.setValue(columnIndex, value);
    }

    // Register Row
    dynamicWeatherStaton.put(row);
}
</pre>
<strong>List.5 Row acquisition of dynamic Container</strong>(ContainerDynamicCreate.java)
<pre class="prettyprint linenums:x">
// Re-Get Container
Container&lt;String, Row&gt; weatherStationCol =
        store.getContainer("dynamic_weather_station");

// Retrieve Container
System.out.println("ID\tName\t\t\tLongitude\tLatitude\tCamera");
for (int i = 0; i &lt; 5; i++) {
    // Retrieve Row by key
    Row row = weatherStationCol.get(String.valueOf(i + 1));
    String id = row.getString(0);
    String name = row.getString(1);
    double latitude = row.getDouble(2);
    double longitude = row.getDouble(3);
    boolean hasCamera = row.getBool(4);

    System.out.println(String.format("%-3s\t%-20s\t%-10s\t%-10s\t%-5s", id, name,
            latitude, longitude, hasCamera));
}
</pre>
<strong>List.6 Row acquisition result of dynamic Container</strong>
<pre class="prettyprint linenums:x">
ID      Name                    Longitude       Latitude        Camera
1       name_1_1                3.0             4.0             true
2       name_2_1                4.0             5.0             true
3       name_3_1                5.0             6.0             true
4       name_4_1                6.0             7.0             true
5       name_5_1                7.0             8.0             true
</pre>
<h2 id="partition-information">Partition Information</h2>
<p>Note: Description of each information that can be acquired in the PartitionController class</p>
<strong>List.7 Partition information acquisition</strong>(PartitionInfomation.java)
<pre class="prettyprint linenums:x">
// Create Connection
store = logic.createGridStore();

// Get PartitionController
PartitionController partitionController = store.getPartitionController();

// Show PartitionController has Infomation
int partitionCount = partitionController.getPartitionCount();
System.out.println("Partition Count:" + partitionCount);
for (int i = 0; i &lt; partitionCount; i++) {
    System.out.println("Partition:" + (i + 1) + " ##########");
    System.out.println("BackupHosts:" + partitionController.getBackupHosts(i));
    System.out.println("ContainerCount:" + partitionController.getContainerCount(i));
    List&lt;String&gt; containerNames = partitionController.getContainerNames(i, 0, null);
    for (String containerName : containerNames) {
        System.out.println("Container Name:" + containerName);
    }
    System.out.println("Owner Node:" + partitionController.getOwnerHost(i));
    List&lt;InetAddress&gt; nodeHosts = partitionController.getHosts(i);
    for (InetAddress nodeHost : nodeHosts) {
        System.out.println("Node Host" + nodeHost);
    }
}

System.out.println("\nWeatherStation Partition:"
        + partitionController.getPartitionIndexOfContainer("weather_station"));
</pre>
<strong>List.8 Partition information acquisition result</strong>
<pre class="prettyprint linenums:x">
Partition Count:128
Partition:1 ##########
BackupHosts:[/192.168.11.12]
ContainerCount:0
Owner Node:/192.168.11.11
Node Host/192.168.11.11
Node Host/192.168.11.12
Partition:2 ##########
BackupHosts:[/192.168.11.11]
ContainerCount:0
Owner Node:/192.168.11.12
Node Host/192.168.11.12
Node Host/192.168.11.11
</pre>
<h2 id="timeseries-container-information">TimeSeries Container information</h2>
<p>Note: It describes each property of TimeSeriesProperties. For a detailed explanation of CompressionMethod and RowExpirationTime, please refer to <a href="/en/docs/GridDB_TechnicalReference.pdf">Technical Reference (Section 4.3.4)</a>.</p>
<strong>List.9 TimeSeries Container information acquisition</strong>(TimeSeriesInfomation.java)
<pre class="prettyprint linenums:x">
// Create Connection
store = logic.createGridStore();

// Get Container Infomation
ContainerInfo containerInfo = store.getContainerInfo("weather_station_1");
// Get TimeSeries Properties
TimeSeriesProperties tsProp = containerInfo.getTimeSeriesProperties();

// Show TimeSeriesProperties has values
System.out.println("########## TimeSeriesProperties");
System.out.println("CompressionMethod:" + tsProp.getCompressionMethod());
System.out.println(
        "CompressionRate(temperture):" + tsProp.getCompressionRate("temperture"));
System.out.println(
        "CompressionSpan(temperture):" + tsProp.getCompressionSpan("temperture"));
System.out.println(
        "CompressionWidth(temperture):" + tsProp.getCompressionWidth("temperture"));
System.out.println("CompressionWindowSize:" + tsProp.getCompressionWindowSize());
System.out
        .println("CompressionWindowSizeUnit:" + tsProp.getCompressionWindowSizeUnit());
System.out.println("ExpirationDivisionCount:" + tsProp.getExpirationDivisionCount());
System.out.println("RowExpirationTime:" + tsProp.getRowExpirationTime());
System.out.println("RowExpirationTimeUnit:" + tsProp.getRowExpirationTimeUnit());
System.out.println("SpecifiedColumns:");
Set&lt;String&gt; specifiedColumns = tsProp.getSpecifiedColumns();
for (String specifiedColumn : specifiedColumns) {
    System.out.println(specifiedColumn);
}
System.out.println("isCompressionRelative(temperture):"
        + tsProp.isCompressionRelative("temperture"));
</pre>
<strong>List.10 TimeSeries Container information acquisition result</strong>
<pre class="prettyprint linenums:x">
TimeSeriesProperties:
CompressionMethod:NO
CompressionRate(temperture):null
CompressionSpan(temperture):null
CompressionWidth(temperture):null
CompressionWindowSize:-1
CompressionWindowSizeUnit:null
ExpirationDivisionCount:8
RowExpirationTime:-1
RowExpirationTimeUnit:null
SpecifiedColumns:
isCompressionRelative(temperture):null
</pre>
<h2 id="source-code">Source Code</h2>
<p>Complete source code used in this sample can be downloaded from the following.</p>
<p>Download:<a href="img/meta-info.zip">meta-info.zip</a></p>
<p><br/></p>
</div>
</div>
</div>
</div>
</div>
<!-- / main -->

<?php get_footer(); ?>
