Skip to content

Commit

Permalink
update for V4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
knonomura committed May 22, 2019
1 parent eb61b45 commit ec466bf
Show file tree
Hide file tree
Showing 17 changed files with 612 additions and 130 deletions.
13 changes: 13 additions & 0 deletions java_client/src/com/toshiba/mwcloud/gs/GridStoreFactory.java
Expand Up @@ -242,6 +242,13 @@ public static GridStoreFactory getInstance() {
* notificationAddressおよびnotificationMemberと同時に指定することはできない。
* バージョン2.9よりサポート
* </td></tr>
* <tr><td>applicationName</td><td>アプリケーションの名前。
* アプリケーションの識別を補助するための情報として、接続先のクラスタ上での
* 各種管理情報の出力の際に含められる場合がある。ただし、アプリケーションの
* 同一性を どのように定義するかについては関与しない。省略時は
* アプリケーション名の指定がなかったものとみなされる。空文字列は指定
* できない。
* バージョン4.2よりサポート</td></tr>
* </tbody>
* </table>
*
Expand Down Expand Up @@ -374,6 +381,12 @@ public static GridStoreFactory getInstance() {
* This property is supported on version 2.9 or later.
*
* </td></tr>
* <tr><td>applicationName</td><td>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.</td></tr>
* </tbody>
* </table>
*
Expand Down
18 changes: 18 additions & 0 deletions java_client/src/com/toshiba/mwcloud/gs/common/BasicBuffer.java
Expand Up @@ -132,6 +132,9 @@ public void putChar(char value) {
}

public void putString(String value) {
if (value.indexOf('\0') >= 0) {
throw errorNullCharacterRuntime();
}
final byte[] buf = value.getBytes(DEFAULT_CHARSET);
prepare(Integer.SIZE / Byte.SIZE + buf.length);
base.putInt(buf.length);
Expand Down Expand Up @@ -242,6 +245,21 @@ public void clear() {
base.clear();
}

public static IllegalArgumentException errorNullCharacterRuntime() {
try {
throw errorNullCharacter();
}
catch (GSException e) {
throw new IllegalArgumentException(e);
}
}

public static GSException errorNullCharacter() {
return new GSException(
GSErrorCode.ILLEGAL_VALUE_FORMAT,
"Illegal '\\0' character found");
}

public static class BufferUtils {

private BufferUtils() {
Expand Down
Expand Up @@ -35,20 +35,20 @@ public static class ContainerIdInfo {

public final ContainerKey remoteKey;

public final MetaContainerType metaContainerType;
public final MetaDistributionType metaDistType;

public final long metaContainerId;

public final MetaNamingType metaNamingType;

public ContainerIdInfo(
int versionId, long containerId, ContainerKey remoteKey,
MetaContainerType metaContainerType, long metaContainerId,
MetaDistributionType metaDistType, long metaContainerId,
MetaNamingType metaNamingType) {
this.versionId = versionId;
this.containerId = containerId;
this.remoteKey = remoteKey;
this.metaContainerType = metaContainerType;
this.metaDistType = metaDistType;
this.metaContainerId = metaContainerId;
this.metaNamingType = metaNamingType;
}
Expand Down Expand Up @@ -184,9 +184,10 @@ public Integer[] getRawKeys() {

}

public enum MetaContainerType {
public enum MetaDistributionType {
NONE,
FULL
FULL,
NODE
}

public enum MetaNamingType {
Expand Down
22 changes: 22 additions & 0 deletions java_client/src/com/toshiba/mwcloud/gs/common/Extensibles.java
Expand Up @@ -127,6 +127,10 @@ public void multiGet(
? extends RowKeyPredicate<?>, List<Row>> multiContext,
boolean internalMode) throws GSException;

public void setContainerMonitoring(boolean monitoring);

public boolean isContainerMonitoring();

@Override
public AsPartitionController getPartitionController()
throws GSException;
Expand All @@ -145,6 +149,8 @@ public void createIndex(IndexInfo info, OptionalRequestSource source)
public void dropIndex(IndexInfo info, OptionalRequestSource source)
throws GSException;

public ContainerKey getKey();

@Override
public <S> AsQuery<S> query(final String tql, Class<S> rowType)
throws GSException;
Expand All @@ -168,6 +174,12 @@ public void setAcceptableResultKeys(
public void setContainerLostAcceptable(
boolean acceptable) throws GSException;

public QueryInfo getInfo();

public Query<R> getBaseQuery();

public AsContainer<?, ?> getContainer();

}

public interface AsRowSet<R> extends RowSet<R> {
Expand All @@ -178,6 +190,10 @@ public interface AsRowSet<R> extends RowSet<R> {

public byte[] getExtOption(int key) throws GSException;

public QueryInfo getQueryInfo();

public AsContainer<?, ?> getContainer();

}

public interface AsPartitionController extends PartitionController {
Expand Down Expand Up @@ -229,6 +245,12 @@ public interface StatementHandler {

}

public interface QueryInfo {

String getQueryString();

}

public static AsStore get(GridStore store) {
final AsStore extensible;
try {
Expand Down
19 changes: 19 additions & 0 deletions java_client/src/com/toshiba/mwcloud/gs/common/PropertyUtils.java
Expand Up @@ -158,6 +158,25 @@ public Integer getIntProperty(
}
}

public Double getDoubleProperty(
String name, boolean deprecated) throws GSException {
final String strValue = getProperty(name, deprecated);
if (strValue == null) {
return null;
}

try {
return Double.valueOf(strValue);
}
catch (NumberFormatException e) {
throw new GSException(
GSErrorCode.ILLEGAL_VALUE_FORMAT,
"Failed to parse as double (value=" + strValue +
", propertyName=" + name +
", reason=" + e.getMessage() + ")", e);
}
}

public Boolean getBooleanProperty(
String name, Boolean defaultValue,
boolean deprecated) throws GSException {
Expand Down
10 changes: 2 additions & 8 deletions java_client/src/com/toshiba/mwcloud/gs/common/RowMapper.java
Expand Up @@ -65,7 +65,7 @@ public class RowMapper {

protected static boolean restrictKeyOrderFirst = true;

private static final boolean STRING_FIELD_ENCODING_STRICT = true;
private static final boolean STRING_FIELD_ENCODING_STRICT = true;

private static final RowMapper AGGREGATION_RESULT_MAPPER;

Expand Down Expand Up @@ -4166,7 +4166,7 @@ static void putString(BasicBuffer out, String value, boolean varSizeMode)
final byte[] dest = out.base().array();
for (int i = 0; i < buf.length; i++) {
if (buf[i] == 0) {
throw errorNullCharacter();
throw BasicBuffer.errorNullCharacter();
}
dest[pos + i] = buf[i];
}
Expand All @@ -4190,10 +4190,4 @@ static String getString(BasicBuffer in, boolean varSizeMode) throws GSException
return new String(buf, 0, buf.length, BasicBuffer.DEFAULT_CHARSET);
}

private static GSException errorNullCharacter() {
return new GSException(
GSErrorCode.ILLEGAL_VALUE_FORMAT,
"Illegal '\\0' character found");
}

}
Expand Up @@ -30,7 +30,9 @@ public enum ContainerAttribute {

LARGE(0x00000020),

SUB(0x00000030)
SUB(0x00000030),

VIEW(0x00000040)
;

private int flag;
Expand Down

0 comments on commit ec466bf

Please sign in to comment.