com.unbound.provider.kmip.response.QueryResponse 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.response;
import com.unbound.common.Log;
import com.unbound.provider.kmip.KMIP;
import com.unbound.provider.kmip.KMIPConvertException;
import com.unbound.provider.kmip.KMIPConverter;
import com.unbound.provider.kmip.attribute.CapabilityInformation;
import com.unbound.provider.kmip.attribute.ExtInfo;
import com.unbound.provider.kmip.attribute.ServerInfo;
import java.util.ArrayList;
/**
* Created by valery.osheter on 26-Nov-15.
*/
public class QueryResponse extends ResponseItem
{
public ArrayList operations = new ArrayList<>();
public ArrayList objectTypes = new ArrayList<>();
public String vendorID = null;
public ServerInfo serverInfo = null;
public ArrayList appNameSpaces = new ArrayList<>();
public ArrayList extInfos = new ArrayList<>();
public ArrayList attestationTypes = new ArrayList<>();
public CapabilityInformation capabilityInfo = null;
public ArrayList clientRegistrationMethods = new ArrayList<>();
public QueryResponse()
{
super(KMIP.Operation.Query);
}
public void convert(KMIPConverter converter) throws KMIPConvertException
{
converter.convertIntList(KMIP.Tag.Operation, operations);
converter.convertIntList(KMIP.Tag.ObjectType, objectTypes);
if (converter.isWrite() && serverInfo != null)
vendorID = "unboundtech.com";
vendorID = converter.convertOptional(KMIP.Tag.VendorIdentification, vendorID);
if (converter.isRead() && converter.getNextTag() == KMIP.Tag.ServerInformation) serverInfo = new ServerInfo();
if (serverInfo != null) serverInfo.convert(converter);
converter.convertStrList(KMIP.Tag.ApplicationNamespace, appNameSpaces);
if (converter.isWrite()) for (ExtInfo extInfo : extInfos) extInfo.convert(converter);
else
{
while (converter.getNextTag() == KMIP.Tag.ExtensionInformation)
{
ExtInfo extInfo = new ExtInfo();
extInfo.convert(converter);
extInfos.add(extInfo);
}
}
converter.convertIntList(KMIP.Tag.AttestationType, attestationTypes);
if (converter.isRead() && converter.getNextTag() == KMIP.Tag.CapabilityInformation)
capabilityInfo = new CapabilityInformation();
if (capabilityInfo != null) capabilityInfo.convert(converter);
converter.convertIntList(KMIP.Tag.ClientRegistrationMethod, clientRegistrationMethods);
}
public void log()
{
Log log = Log.func("QueryResponse").log("vendorID", vendorID).end();
if (operations!=null) for (Integer oper : operations) Log.print("Operation").log("code", oper).end();
if (objectTypes!=null) for (Integer objectType : objectTypes) Log.print("Object types").log("type", objectType).end();
if (appNameSpaces !=null) for (String appNameSpace : appNameSpaces) Log.print("App name spaces").log("name", appNameSpace).end();
if (extInfos !=null) for (ExtInfo extInfo : extInfos) extInfo.log();
if (attestationTypes!=null) for (Integer attestationType : attestationTypes) Log.print("Attestation Types").log("code", attestationType).end();
if (serverInfo!=null) serverInfo.log();
if (capabilityInfo!=null) capabilityInfo.log();
if (clientRegistrationMethods!=null) for (Integer clientRegistrationMethod : clientRegistrationMethods) Log.print("Client registration methods").log("code", clientRegistrationMethod).end();
log.leave();
}
}