Search in sources :

Example 56 with BinaryObjectException

use of org.apache.ignite.binary.BinaryObjectException in project ignite by apache.

the class JdbcBinaryTypePutRequest method readBinary.

/**
 * {@inheritDoc}
 */
@Override
public void readBinary(BinaryReaderExImpl reader, JdbcProtocolContext protoCtx) throws BinaryObjectException {
    super.readBinary(reader, protoCtx);
    meta = new BinaryMetadata();
    try {
        meta.readFrom(reader);
    } catch (IOException e) {
        throw new BinaryObjectException(e);
    }
}
Also used : IOException(java.io.IOException) BinaryMetadata(org.apache.ignite.internal.binary.BinaryMetadata) BinaryObjectException(org.apache.ignite.binary.BinaryObjectException)

Example 57 with BinaryObjectException

use of org.apache.ignite.binary.BinaryObjectException in project ignite by apache.

the class JdbcQueryExecuteRequest method readBinary.

/**
 * {@inheritDoc}
 */
@Override
public void readBinary(BinaryReaderExImpl reader, JdbcProtocolContext protoCtx) throws BinaryObjectException {
    super.readBinary(reader, protoCtx);
    schemaName = reader.readString();
    pageSize = reader.readInt();
    maxRows = reader.readInt();
    sqlQry = reader.readString();
    int argsNum = reader.readInt();
    args = new Object[argsNum];
    for (int i = 0; i < argsNum; ++i) args[i] = JdbcUtils.readObject(reader, protoCtx);
    if (protoCtx.isAutoCommitSupported())
        autoCommit = reader.readBoolean();
    try {
        if (reader.available() > 0)
            stmtType = JdbcStatementType.fromOrdinal(reader.readByte());
        else
            stmtType = JdbcStatementType.ANY_STATEMENT_TYPE;
    } catch (IOException e) {
        throw new BinaryObjectException(e);
    }
    if (protoCtx.isAffinityAwarenessSupported())
        partResReq = reader.readBoolean();
    if (protoCtx.features().contains(JdbcThinFeature.QUERY_TIMEOUT))
        explicitTimeout = reader.readBoolean();
}
Also used : IOException(java.io.IOException) BinaryObjectException(org.apache.ignite.binary.BinaryObjectException)

Example 58 with BinaryObjectException

use of org.apache.ignite.binary.BinaryObjectException in project ignite by apache.

the class JdbcBulkLoadAckResult method readBinary.

/**
 * {@inheritDoc}
 */
@Override
public void readBinary(BinaryReaderExImpl reader, JdbcProtocolContext protoCtx) throws BinaryObjectException {
    super.readBinary(reader, protoCtx);
    cursorId = reader.readLong();
    String locFileName = reader.readString();
    int batchSize = reader.readInt();
    if (!BulkLoadAckClientParameters.isValidPacketSize(batchSize))
        throw new BinaryObjectException(BulkLoadAckClientParameters.packetSizeErrorMesssage(batchSize));
    params = new BulkLoadAckClientParameters(locFileName, batchSize);
}
Also used : BulkLoadAckClientParameters(org.apache.ignite.internal.processors.bulkload.BulkLoadAckClientParameters) BinaryObjectException(org.apache.ignite.binary.BinaryObjectException)

Example 59 with BinaryObjectException

use of org.apache.ignite.binary.BinaryObjectException in project ignite by apache.

the class ClientBinary method buildEnum.

/**
 * {@inheritDoc}
 */
@Override
public BinaryObject buildEnum(String typeName, String name) {
    if (typeName == null || typeName.isEmpty())
        throw new IllegalArgumentException("typeName");
    if (name == null || name.isEmpty())
        throw new IllegalArgumentException("name");
    BinaryContext ctx = marsh.context();
    int typeId = ctx.typeId(typeName);
    BinaryMetadata metadata = ctx.metadata0(typeId);
    if (metadata == null)
        throw new BinaryObjectException(String.format("Failed to get metadata for type [typeId=%s, typeName='%s']", typeId, typeName));
    Integer ordinal = metadata.getEnumOrdinalByName(name);
    if (ordinal == null)
        throw new BinaryObjectException(String.format("Failed to resolve enum ordinal by name [typeId=%s, typeName='%s', name='%s']", typeId, typeName, name));
    return new BinaryEnumObjectImpl(ctx, typeId, null, ordinal);
}
Also used : BinaryContext(org.apache.ignite.internal.binary.BinaryContext) BinaryEnumObjectImpl(org.apache.ignite.internal.binary.BinaryEnumObjectImpl) BinaryMetadata(org.apache.ignite.internal.binary.BinaryMetadata) BinaryObjectException(org.apache.ignite.binary.BinaryObjectException)

Example 60 with BinaryObjectException

use of org.apache.ignite.binary.BinaryObjectException in project ignite by apache.

the class CacheObjectBinaryProcessorImpl method addMetaLocally.

/**
 * {@inheritDoc}
 */
@Override
public void addMetaLocally(int typeId, BinaryType newMeta) throws BinaryObjectException {
    assert newMeta != null;
    assert newMeta instanceof BinaryTypeImpl;
    BinaryMetadata newMeta0 = ((BinaryTypeImpl) newMeta).metadata();
    BinaryMetadataHolder metaHolder = metadataLocCache.get(typeId);
    BinaryMetadata oldMeta = metaHolder != null ? metaHolder.metadata() : null;
    try {
        BinaryMetadata mergedMeta = mergeMetadata(oldMeta, newMeta0);
        if (!ctx.clientNode())
            metadataFileStore.mergeAndWriteMetadata(mergedMeta);
        metadataLocCache.put(typeId, new BinaryMetadataHolder(mergedMeta, 0, 0));
    } catch (BinaryObjectException e) {
        throw new BinaryObjectException("New binary metadata is incompatible with binary metadata" + " persisted locally." + " Consider cleaning up persisted metadata from <workDir>/db/binary_meta directory.", e);
    }
}
Also used : BinaryTypeImpl(org.apache.ignite.internal.binary.BinaryTypeImpl) BinaryMetadata(org.apache.ignite.internal.binary.BinaryMetadata) BinaryObjectException(org.apache.ignite.binary.BinaryObjectException)

Aggregations

BinaryObjectException (org.apache.ignite.binary.BinaryObjectException)68 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)13 BinaryObject (org.apache.ignite.binary.BinaryObject)12 BinaryMetadata (org.apache.ignite.internal.binary.BinaryMetadata)9 IOException (java.io.IOException)7 BinaryType (org.apache.ignite.binary.BinaryType)7 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)6 Test (org.junit.Test)6 Date (java.util.Date)5 HashMap (java.util.HashMap)5 LinkedHashMap (java.util.LinkedHashMap)5 Map (java.util.Map)5 TreeMap (java.util.TreeMap)5 IgniteException (org.apache.ignite.IgniteException)5 BigInteger (java.math.BigInteger)3 Time (java.sql.Time)3 Timestamp (java.sql.Timestamp)3 BinaryEnumObjectImpl (org.apache.ignite.internal.binary.BinaryEnumObjectImpl)3 BinaryTypeImpl (org.apache.ignite.internal.binary.BinaryTypeImpl)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2