public static int calculateDataSize(MapStoreConfigHolder config) { int dataSize = ENCODED_BOOLEANS * BOOLEAN_SIZE_IN_BYTES + ENCODED_INTS * INT_SIZE_IN_BYTES; if (config.getProperties() != null) { dataSize += PropertiesCodec.calculateDataSize(config.getProperties()); } dataSize += ParameterUtil.calculateDataSize(config.getInitialLoadMode()); if (config.getClassName() != null) { dataSize += ParameterUtil.calculateDataSize(config.getClassName()); } if (config.getFactoryClassName() != null) { dataSize += ParameterUtil.calculateDataSize(config.getFactoryClassName()); } if (config.getImplementation() != null) { dataSize += ParameterUtil.calculateDataSize(config.getImplementation()); } if (config.getFactoryImplementation() != null) { dataSize += ParameterUtil.calculateDataSize(config.getFactoryImplementation()); } return dataSize; } }
public static MapStoreConfigHolder of(MapStoreConfig config, SerializationService serializationService) { if (config == null) { return null; } MapStoreConfigHolder holder = new MapStoreConfigHolder(); holder.setClassName(config.getClassName()); holder.setEnabled(config.isEnabled()); holder.setFactoryClassName(config.getFactoryClassName()); holder.setFactoryImplementation(serializationService.toData(config.getFactoryImplementation())); holder.setImplementation(serializationService.toData(config.getImplementation())); holder.setInitialLoadMode(config.getInitialLoadMode().name()); holder.setProperties(config.getProperties()); holder.setWriteBatchSize(config.getWriteBatchSize()); holder.setWriteCoalescing(config.isWriteCoalescing()); holder.setWriteDelaySeconds(config.getWriteDelaySeconds()); return holder; } }
public static void encode(MapStoreConfigHolder config, ClientMessage clientMessage) { clientMessage.set(config.isEnabled()).set(config.isWriteCoalescing()) .set(config.getWriteDelaySeconds()).set(config.getWriteBatchSize()) .set(config.getInitialLoadMode()); boolean isNullProperties = config.getProperties() == null; clientMessage.set(isNullProperties); if (!isNullProperties) { PropertiesCodec.encode(config.getProperties(), clientMessage); } boolean isNullClassName = config.getClassName() == null; clientMessage.set(isNullClassName); if (!isNullClassName) { clientMessage.set(config.getClassName()); } boolean isNullFactoryClassName = config.getFactoryClassName() == null; clientMessage.set(isNullFactoryClassName); if (!isNullFactoryClassName) { clientMessage.set(config.getFactoryClassName()); } boolean isNullImplementation = config.getImplementation() == null; clientMessage.set(isNullImplementation); if (!isNullImplementation) { clientMessage.set(config.getImplementation()); } boolean isNullFactoryImplementation = config.getFactoryImplementation() == null; clientMessage.set(isNullFactoryImplementation); if (!isNullFactoryImplementation) { clientMessage.set(config.getFactoryImplementation()); } }
public static MapStoreConfigHolder of(MapStoreConfig config, SerializationService serializationService) { if (config == null) { return null; } MapStoreConfigHolder holder = new MapStoreConfigHolder(); holder.setClassName(config.getClassName()); holder.setEnabled(config.isEnabled()); holder.setFactoryClassName(config.getFactoryClassName()); holder.setFactoryImplementation(serializationService.toData(config.getFactoryImplementation())); holder.setImplementation(serializationService.toData(config.getImplementation())); holder.setInitialLoadMode(config.getInitialLoadMode().name()); holder.setProperties(config.getProperties()); holder.setWriteBatchSize(config.getWriteBatchSize()); holder.setWriteCoalescing(config.isWriteCoalescing()); holder.setWriteDelaySeconds(config.getWriteDelaySeconds()); return holder; } }
public static void encode(MapStoreConfigHolder config, ClientMessage clientMessage) { clientMessage.set(config.isEnabled()).set(config.isWriteCoalescing()) .set(config.getWriteDelaySeconds()).set(config.getWriteBatchSize()) .set(config.getInitialLoadMode()); boolean isNullProperties = config.getProperties() == null; clientMessage.set(isNullProperties); if (!isNullProperties) { PropertiesCodec.encode(config.getProperties(), clientMessage); } boolean isNullClassName = config.getClassName() == null; clientMessage.set(isNullClassName); if (!isNullClassName) { clientMessage.set(config.getClassName()); } boolean isNullFactoryClassName = config.getFactoryClassName() == null; clientMessage.set(isNullFactoryClassName); if (!isNullFactoryClassName) { clientMessage.set(config.getFactoryClassName()); } boolean isNullImplementation = config.getImplementation() == null; clientMessage.set(isNullImplementation); if (!isNullImplementation) { clientMessage.set(config.getImplementation()); } boolean isNullFactoryImplementation = config.getFactoryImplementation() == null; clientMessage.set(isNullFactoryImplementation); if (!isNullFactoryImplementation) { clientMessage.set(config.getFactoryImplementation()); } }
public static MapStoreConfigHolder decode(ClientMessage clientMessage) { MapStoreConfigHolder config = new MapStoreConfigHolder(); config.setEnabled(clientMessage.getBoolean()); config.setWriteCoalescing(clientMessage.getBoolean()); config.setWriteDelaySeconds(clientMessage.getInt()); config.setWriteBatchSize(clientMessage.getInt()); config.setInitialLoadMode(clientMessage.getStringUtf8()); boolean isNullProperties = clientMessage.getBoolean(); if (!isNullProperties) { config.setProperties(PropertiesCodec.decode(clientMessage)); } boolean isNullClassName = clientMessage.getBoolean(); if (!isNullClassName) { config.setClassName(clientMessage.getStringUtf8()); } boolean isNullFactoryClassName = clientMessage.getBoolean(); if (!isNullFactoryClassName) { config.setFactoryClassName(clientMessage.getStringUtf8()); } boolean isNullImplementation = clientMessage.getBoolean(); if (!isNullImplementation) { config.setImplementation(clientMessage.getData()); } boolean isNullFactoryImplementation = clientMessage.getBoolean(); if (!isNullFactoryImplementation) { config.setFactoryImplementation(clientMessage.getData()); } return config; }
public static void encode(MapStoreConfigHolder config, ClientMessage clientMessage) { clientMessage.set(config.isEnabled()).set(config.isWriteCoalescing()) .set(config.getWriteDelaySeconds()).set(config.getWriteBatchSize()) .set(config.getInitialLoadMode()); boolean isNullProperties = config.getProperties() == null; clientMessage.set(isNullProperties); if (!isNullProperties) { PropertiesCodec.encode(config.getProperties(), clientMessage); } boolean isNullClassName = config.getClassName() == null; clientMessage.set(isNullClassName); if (!isNullClassName) { clientMessage.set(config.getClassName()); } boolean isNullFactoryClassName = config.getFactoryClassName() == null; clientMessage.set(isNullFactoryClassName); if (!isNullFactoryClassName) { clientMessage.set(config.getFactoryClassName()); } boolean isNullImplementation = config.getImplementation() == null; clientMessage.set(isNullImplementation); if (!isNullImplementation) { clientMessage.set(config.getImplementation()); } boolean isNullFactoryImplementation = config.getFactoryImplementation() == null; clientMessage.set(isNullFactoryImplementation); if (!isNullFactoryImplementation) { clientMessage.set(config.getFactoryImplementation()); } }
public static int calculateDataSize(MapStoreConfigHolder config) { int dataSize = ENCODED_BOOLEANS * BOOLEAN_SIZE_IN_BYTES + ENCODED_INTS * INT_SIZE_IN_BYTES; if (config.getProperties() != null) { dataSize += PropertiesCodec.calculateDataSize(config.getProperties()); } dataSize += ParameterUtil.calculateDataSize(config.getInitialLoadMode()); if (config.getClassName() != null) { dataSize += ParameterUtil.calculateDataSize(config.getClassName()); } if (config.getFactoryClassName() != null) { dataSize += ParameterUtil.calculateDataSize(config.getFactoryClassName()); } if (config.getImplementation() != null) { dataSize += ParameterUtil.calculateDataSize(config.getImplementation()); } if (config.getFactoryImplementation() != null) { dataSize += ParameterUtil.calculateDataSize(config.getFactoryImplementation()); } return dataSize; } }
public static MapStoreConfigHolder decode(ClientMessage clientMessage) { MapStoreConfigHolder config = new MapStoreConfigHolder(); config.setEnabled(clientMessage.getBoolean()); config.setWriteCoalescing(clientMessage.getBoolean()); config.setWriteDelaySeconds(clientMessage.getInt()); config.setWriteBatchSize(clientMessage.getInt()); config.setInitialLoadMode(clientMessage.getStringUtf8()); boolean isNullProperties = clientMessage.getBoolean(); if (!isNullProperties) { config.setProperties(PropertiesCodec.decode(clientMessage)); } boolean isNullClassName = clientMessage.getBoolean(); if (!isNullClassName) { config.setClassName(clientMessage.getStringUtf8()); } boolean isNullFactoryClassName = clientMessage.getBoolean(); if (!isNullFactoryClassName) { config.setFactoryClassName(clientMessage.getStringUtf8()); } boolean isNullImplementation = clientMessage.getBoolean(); if (!isNullImplementation) { config.setImplementation(clientMessage.getData()); } boolean isNullFactoryImplementation = clientMessage.getBoolean(); if (!isNullFactoryImplementation) { config.setFactoryImplementation(clientMessage.getData()); } return config; }
public static int calculateDataSize(MapStoreConfigHolder config) { int dataSize = ENCODED_BOOLEANS * BOOLEAN_SIZE_IN_BYTES + ENCODED_INTS * INT_SIZE_IN_BYTES; if (config.getProperties() != null) { dataSize += PropertiesCodec.calculateDataSize(config.getProperties()); } dataSize += ParameterUtil.calculateDataSize(config.getInitialLoadMode()); if (config.getClassName() != null) { dataSize += ParameterUtil.calculateDataSize(config.getClassName()); } if (config.getFactoryClassName() != null) { dataSize += ParameterUtil.calculateDataSize(config.getFactoryClassName()); } if (config.getImplementation() != null) { dataSize += ParameterUtil.calculateDataSize(config.getImplementation()); } if (config.getFactoryImplementation() != null) { dataSize += ParameterUtil.calculateDataSize(config.getFactoryImplementation()); } return dataSize; } }
public static MapStoreConfigHolder decode(ClientMessage clientMessage) { MapStoreConfigHolder config = new MapStoreConfigHolder(); config.setEnabled(clientMessage.getBoolean()); config.setWriteCoalescing(clientMessage.getBoolean()); config.setWriteDelaySeconds(clientMessage.getInt()); config.setWriteBatchSize(clientMessage.getInt()); config.setInitialLoadMode(clientMessage.getStringUtf8()); boolean isNullProperties = clientMessage.getBoolean(); if (!isNullProperties) { config.setProperties(PropertiesCodec.decode(clientMessage)); } boolean isNullClassName = clientMessage.getBoolean(); if (!isNullClassName) { config.setClassName(clientMessage.getStringUtf8()); } boolean isNullFactoryClassName = clientMessage.getBoolean(); if (!isNullFactoryClassName) { config.setFactoryClassName(clientMessage.getStringUtf8()); } boolean isNullImplementation = clientMessage.getBoolean(); if (!isNullImplementation) { config.setImplementation(clientMessage.getData()); } boolean isNullFactoryImplementation = clientMessage.getBoolean(); if (!isNullFactoryImplementation) { config.setFactoryImplementation(clientMessage.getData()); } return config; }