com.unbound.provider.kmip.request.RequestMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unbound-java-provider Show documentation
Show all versions of unbound-java-provider Show documentation
This is a collection of JAVA libraries that implement Unbound cryptographic classes for JAVA provider, PKCS11 wrapper, cryptoki, and advapi
package com.unbound.provider.kmip.request;
import com.unbound.common.Log;
import com.unbound.provider.kmip.KMIP;
import com.unbound.provider.kmip.KMIPConvertException;
import com.unbound.provider.kmip.KMIPConverter;
import java.util.ArrayList;
import java.util.stream.Collectors;
/**
* Created by valery.osheter on 19-Nov-15.
*/
public class RequestMessage
{
public RequestHeader header = new RequestHeader();
public ArrayList batch = new ArrayList();
public void convert(KMIPConverter converter) throws KMIPConvertException
{
if (header.batch_count == 0) header.batch_count = batch.size();
int begin = converter.convertBegin(KMIP.Tag.RequestMessage);
header.convert(converter);
// int count = converter.isWrite() ? batch.size() : header.batch_count;
if (converter.isWrite())
{
for (RequestItem item : batch) RequestItem.convert(converter, item);
}
else
{
for (int i = 0; i < header.batch_count; i++)
{
RequestItem item = RequestItem.convert(converter, null);
batch.add(item);
}
}
converter.convertEnd(begin);
}
public void log()
{
Log log = Log.func("RequestMessage").end();
for (int i = 0; i < header.batch_count; i++) batch.get(i).log();
log.leave();
}
}