All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.unbound.provider.kmip.request.RequestMessage Maven / Gradle / Ivy

Go to download

This is a collection of JAVA libraries that implement Unbound cryptographic classes for JAVA provider, PKCS11 wrapper, cryptoki, and advapi

There is a newer version: 42761
Show newest version
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();
  }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy