Class Utils
- java.lang.Object
- 
- es.bsc.dataclay.communication.grpc.Utils
 
- 
 public final class Utils extends Object Utility class for communication.
- 
- 
Field SummaryFields Modifier and Type Field Description protected static booleanDEBUG_ENABLEDIndicates if debug is enabled.protected static char[]hexArray
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static Queue<String>bytesToHex(byte[] bytes)Get bytes to hexadecimal Stringsstatic voidcheckIsExc(CommonMessages.ExceptionInfo response)Verifies if response message isException and if this is the case print and raise it properlystatic AccountIDgetAccountID(String idMsg)Get AccountID ID from Protobuf IDstatic ContractIDgetContractID(String idMsg)Get ContractID from Protobuf IDstatic PasswordCredentialgetCredential(CommonMessages.Credential cred)Get password credentialstatic CommonMessages.CredentialgetCredential(PasswordCredential cred)Get password credentialstatic CredentialIDgetCredentialID(String idMsg)Get CredentialID from Protobuf IDstatic DataClayInstancegetDataClayInstance(CommonMessages.DataClayInstance dataClayInstanceMsg)Return an object FROM grpc messagestatic CommonMessages.DataClayInstancegetDataClayInstance(DataClayInstance dataClayInstance)Return a message for GRPC callstatic DataClayInstanceIDgetDataClayInstanceID(String idMsg)Get DataClayID from Protobuf IDstatic DataContractIDgetDataContractID(String idMsg)Get DataContractID from Protobuf IDstatic DataSetIDgetDataSetID(String idMsg)Get DataSetID from Protobuf IDstatic ECAIDgetECAID(String idMsg)Get ECAID from Protobuf IDstatic EventMessageIDgetEventMessageID(String idMsg)Get EventMessageID from Protobuf IDstatic EventObjsMeetConditionIDgetEventObjsMeetConditionID(String idMsg)Get EventObjsMeetConditionID from Protobuf IDstatic ExecutionEnvironmentgetExecutionEnvironment(CommonMessages.ExecutionEnvironmentInfo msg)Return an object FROM grpc messagestatic CommonMessages.ExecutionEnvironmentInfogetExecutionEnvironment(ExecutionEnvironment object)Return a message for GRPC callstatic ExecutionEnvironmentIDgetExecutionEnvironmentID(String idMsg)Get ExecutionEnvironmentID from Protobuf IDstatic ImmutableParamOrReturngetImmutableParamOrReturn(CommonMessages.ImmutableParamOrReturn paramOrRet)Return the immutable instance included in the specified messagestatic CommonMessages.ImmutableParamOrReturngetImmutableParamOrReturn(ImmutableParamOrReturn paramOrRet)Return a message including the specified immutable objectstatic ImplementationIDgetImplementationID(String idMsg)Get ImplementationID from Protobuf IDstatic InterfaceIDgetInterfaceID(String idMsg)Get InterfaceID from Protobuf IDstatic LanguageParamOrReturngetLanguageParamOrReturn(CommonMessages.LanguageParamOrReturn paramOrRet)Return an instance of language object included in the specified messagestatic CommonMessages.LanguageParamOrReturngetLanguageParamOrReturn(LanguageParamOrReturn paramOrRet)Return a message containing a language object (parameter or return)static MetaClassIDgetMetaClassID(String idMsg)Get MetaClassID from Protobuf IDstatic DataClayObjectMetaDatagetMetaData(CommonMessages.DataClayObjectMetaData msg)Retrieve the metadata from the specified msg objectstatic CommonMessages.DataClayObjectMetaDatagetMetaData(DataClayObjectMetaData metadata)Get MetaData GRPC message from DataClayMetaDatastatic MetaDataInfogetMetaDataInfo(CommonMessages.MetaDataInfo msg)Return an object FROM grpc messagestatic CommonMessages.MetaDataInfogetMetaDataInfo(MetaDataInfo object)Return a message for GRPC callstatic StringgetMsgID(ID id)Get string representation of IDstatic NamespaceIDgetNamespaceID(String idMsg)Get NamespaceID from Protobuf IDstatic intgetNumBytesNeededInVLQInt(int numNextBytes)Get number of bytes needed for a GRPC tagstatic ObjectIDgetObjectID(String idMsg)Get ObjectID from Protobuf IDstatic ObjectWithDataParamOrReturngetObjectWithDataParamOrReturn(CommonMessages.ObjectWithDataParamOrReturn volParamOrRet)Obtain the object with data (parameter or return) from the specified messagestatic CommonMessages.ObjectWithDataParamOrReturngetObjectWithDataParamOrReturn(ObjectWithDataParamOrReturn volParamOrRet)Return a message containing an object with data (parameter or return)static OperationIDgetOperationID(String idMsg)Get OperationID from Protobuf IDstatic SerializedParametersOrReturngetParamsOrReturn(CommonMessages.SerializedParametersOrReturn serParamsOrRetMsg)Return a serialized param or return object from the specified messagestatic CommonMessages.SerializedParametersOrReturngetParamsOrReturn(SerializedParametersOrReturn serParamsOrRet)Return the message including the specified serialized param or return objectstatic PersistentParamOrReturngetPersistentParamOrReturn(CommonMessages.PersistentParamOrReturn paramOrRet)Return the param or return object included in the specified messagestatic CommonMessages.PersistentParamOrReturngetPersistentParamOrReturn(PersistentParamOrReturn paramOrRet)Return a message including the specified param or return objectstatic PropertyIDgetPropertyID(String idMsg)Get PropertyID from Protobuf IDstatic QualitativeRegistryIDgetQualitativeRegistryID(String idMsg)Get QualitativeRegistryID from Protobuf IDstatic ResourceIDgetResourceID(String idMsg)Get ResourceID from Protobuf IDstatic SessionIDgetSessionID(String idMsg)Get SessionID from Protobuf IDstatic StorageLocationgetStorageLocation(CommonMessages.StorageLocationInfo msg)Return an object FROM grpc messagestatic CommonMessages.StorageLocationInfogetStorageLocation(StorageLocation object)Return a message for GRPC callstatic StorageLocationIDgetStorageLocationID(String idMsg)Get StorageLocationID from Protobuf IDstatic voidprintBytesHeader(Queue<String> byteStr, int byteIndex)Print bytes headerstatic voidprintMsg(com.google.protobuf.GeneratedMessageV3 msg)Print GRPC message (pretty)static voidreturnExceptionInfoMessage(io.grpc.stub.StreamObserver<CommonMessages.ExceptionInfo> responseObserver)Return ExceptionInfo messagestatic CommonMessages.ExceptionInfoserializeException(Exception ex)Serialize Exception
 
- 
- 
- 
Method Detail- 
getMsgIDpublic static String getMsgID(ID id) Get string representation of ID- Parameters:
- id- ID to get representation from
- Returns:
- String represation or null if id is null
 
 - 
getCredentialpublic static PasswordCredential getCredential(CommonMessages.Credential cred) Get password credential- Parameters:
- cred- Credential
- Returns:
- Password credential
 
 - 
getAccountIDpublic static AccountID getAccountID(String idMsg) Get AccountID ID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- AccountID
 
 - 
getContractIDpublic static ContractID getContractID(String idMsg) Get ContractID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- ContractID
 
 - 
getCredentialIDpublic static CredentialID getCredentialID(String idMsg) Get CredentialID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- CredentialID
 
 - 
getDataContractIDpublic static DataContractID getDataContractID(String idMsg) Get DataContractID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- DataContractID
 
 - 
getDataSetIDpublic static DataSetID getDataSetID(String idMsg) Get DataSetID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- DataSetID
 
 - 
getNamespaceIDpublic static NamespaceID getNamespaceID(String idMsg) Get NamespaceID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- NamespaceID
 
 - 
getECAIDpublic static ECAID getECAID(String idMsg) Get ECAID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- ECAID
 
 - 
getEventMessageIDpublic static EventMessageID getEventMessageID(String idMsg) Get EventMessageID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- EventMessageID
 
 - 
getEventObjsMeetConditionIDpublic static EventObjsMeetConditionID getEventObjsMeetConditionID(String idMsg) Get EventObjsMeetConditionID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- EventObjsMeetConditionID
 
 - 
getExecutionEnvironmentIDpublic static ExecutionEnvironmentID getExecutionEnvironmentID(String idMsg) Get ExecutionEnvironmentID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- ExecutionEnvironmentID
 
 - 
getImplementationIDpublic static ImplementationID getImplementationID(String idMsg) Get ImplementationID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- ImplementationID
 
 - 
getInterfaceIDpublic static InterfaceID getInterfaceID(String idMsg) Get InterfaceID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- InterfaceID
 
 - 
getMetaClassIDpublic static MetaClassID getMetaClassID(String idMsg) Get MetaClassID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- MetaClassID
 
 - 
getObjectIDpublic static ObjectID getObjectID(String idMsg) Get ObjectID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- ObjectID
 
 - 
getOperationIDpublic static OperationID getOperationID(String idMsg) Get OperationID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- OperationID
 
 - 
getPropertyIDpublic static PropertyID getPropertyID(String idMsg) Get PropertyID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- PropertyID
 
 - 
getQualitativeRegistryIDpublic static QualitativeRegistryID getQualitativeRegistryID(String idMsg) Get QualitativeRegistryID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- QualitativeRegistryID
 
 - 
getResourceIDpublic static ResourceID getResourceID(String idMsg) Get ResourceID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- ResourceID
 
 - 
getSessionIDpublic static SessionID getSessionID(String idMsg) Get SessionID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- SessionID
 
 - 
getStorageLocationIDpublic static StorageLocationID getStorageLocationID(String idMsg) Get StorageLocationID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- StorageLocationID
 
 - 
getDataClayInstanceIDpublic static DataClayInstanceID getDataClayInstanceID(String idMsg) Get DataClayID from Protobuf ID- Parameters:
- idMsg- Message ID
- Returns:
- DataClayID
 
 - 
getCredentialpublic static CommonMessages.Credential getCredential(PasswordCredential cred) Get password credential- Parameters:
- cred- Credential
- Returns:
- Password credential
 
 - 
returnExceptionInfoMessagepublic static void returnExceptionInfoMessage(io.grpc.stub.StreamObserver<CommonMessages.ExceptionInfo> responseObserver) Return ExceptionInfo message- Parameters:
- responseObserver- Observer
 
 - 
getMetaDatapublic static CommonMessages.DataClayObjectMetaData getMetaData(DataClayObjectMetaData metadata) Get MetaData GRPC message from DataClayMetaData- Parameters:
- metadata- DataClayMetaData
- Returns:
- MetaData GRPC message
 
 - 
getMetaDatapublic static DataClayObjectMetaData getMetaData(CommonMessages.DataClayObjectMetaData msg) Retrieve the metadata from the specified msg object- Parameters:
- msg- a message with metadata of a certain object
- Returns:
- the metadata included within the message
 
 - 
getMetaDataInfopublic static CommonMessages.MetaDataInfo getMetaDataInfo(MetaDataInfo object) Return a message for GRPC call- Parameters:
- object- object to convert
- Returns:
- the resulting message
 
 - 
getMetaDataInfopublic static MetaDataInfo getMetaDataInfo(CommonMessages.MetaDataInfo msg) Return an object FROM grpc message- Parameters:
- msg- object to convert
- Returns:
- the resulting object
 
 - 
getExecutionEnvironmentpublic static CommonMessages.ExecutionEnvironmentInfo getExecutionEnvironment(ExecutionEnvironment object) Return a message for GRPC call- Parameters:
- object- object to convert
- Returns:
- the resulting message
 
 - 
getExecutionEnvironmentpublic static ExecutionEnvironment getExecutionEnvironment(CommonMessages.ExecutionEnvironmentInfo msg) Return an object FROM grpc message- Parameters:
- msg- object to convert
- Returns:
- the resulting object
 
 - 
getStorageLocationpublic static CommonMessages.StorageLocationInfo getStorageLocation(StorageLocation object) Return a message for GRPC call- Parameters:
- object- object to convert
- Returns:
- the resulting message
 
 - 
getStorageLocationpublic static StorageLocation getStorageLocation(CommonMessages.StorageLocationInfo msg) Return an object FROM grpc message- Parameters:
- msg- object to convert
- Returns:
- the resulting object
 
 - 
getDataClayInstancepublic static CommonMessages.DataClayInstance getDataClayInstance(DataClayInstance dataClayInstance) Return a message for GRPC call- Parameters:
- dataClayInstance- object to convert
- Returns:
- the resulting message
 
 - 
getDataClayInstancepublic static DataClayInstance getDataClayInstance(CommonMessages.DataClayInstance dataClayInstanceMsg) Return an object FROM grpc message- Parameters:
- dataClayInstanceMsg- object to convert
- Returns:
- the resulting message
 
 - 
getObjectWithDataParamOrReturnpublic static CommonMessages.ObjectWithDataParamOrReturn getObjectWithDataParamOrReturn(ObjectWithDataParamOrReturn volParamOrRet) Return a message containing an object with data (parameter or return)- Parameters:
- volParamOrRet- an object with data (parameter or return)
- Returns:
- the resulting message
 
 - 
getObjectWithDataParamOrReturnpublic static ObjectWithDataParamOrReturn getObjectWithDataParamOrReturn(CommonMessages.ObjectWithDataParamOrReturn volParamOrRet) Obtain the object with data (parameter or return) from the specified message- Parameters:
- volParamOrRet- a message containing an object with data (parameter or return)
- Returns:
- the instance of an object with data (parameter or return)
 
 - 
getLanguageParamOrReturnpublic static CommonMessages.LanguageParamOrReturn getLanguageParamOrReturn(LanguageParamOrReturn paramOrRet) Return a message containing a language object (parameter or return)- Parameters:
- paramOrRet- the language object
- Returns:
- the resulting message
 
 - 
getLanguageParamOrReturnpublic static LanguageParamOrReturn getLanguageParamOrReturn(CommonMessages.LanguageParamOrReturn paramOrRet) Return an instance of language object included in the specified message- Parameters:
- paramOrRet- the message containing the language objet
- Returns:
- the language object
 
 - 
getImmutableParamOrReturnpublic static ImmutableParamOrReturn getImmutableParamOrReturn(CommonMessages.ImmutableParamOrReturn paramOrRet) Return the immutable instance included in the specified message- Parameters:
- paramOrRet- the message
- Returns:
- the resulting immutable instance
 
 - 
getImmutableParamOrReturnpublic static CommonMessages.ImmutableParamOrReturn getImmutableParamOrReturn(ImmutableParamOrReturn paramOrRet) Return a message including the specified immutable object- Parameters:
- paramOrRet- the immutable object
- Returns:
- the resulting message
 
 - 
getPersistentParamOrReturnpublic static CommonMessages.PersistentParamOrReturn getPersistentParamOrReturn(PersistentParamOrReturn paramOrRet) Return a message including the specified param or return object- Parameters:
- paramOrRet- the object to be included within the message
- Returns:
- the resulting message
 
 - 
getPersistentParamOrReturnpublic static PersistentParamOrReturn getPersistentParamOrReturn(CommonMessages.PersistentParamOrReturn paramOrRet) Return the param or return object included in the specified message- Parameters:
- paramOrRet- the message
- Returns:
- the resulting param or return object
 
 - 
getParamsOrReturnpublic static CommonMessages.SerializedParametersOrReturn getParamsOrReturn(SerializedParametersOrReturn serParamsOrRet) Return the message including the specified serialized param or return object- Parameters:
- serParamsOrRet- a serialized param or return object
- Returns:
- the resulting message
 
 - 
getParamsOrReturnpublic static SerializedParametersOrReturn getParamsOrReturn(CommonMessages.SerializedParametersOrReturn serParamsOrRetMsg) Return a serialized param or return object from the specified message- Parameters:
- serParamsOrRetMsg- the message
- Returns:
- the serialized param or return object from the message
 
 - 
bytesToHexpublic static Queue<String> bytesToHex(byte[] bytes) Get bytes to hexadecimal Strings- Parameters:
- bytes- Bytes
- Returns:
- Hexadecimal strings
 
 - 
getNumBytesNeededInVLQIntpublic static int getNumBytesNeededInVLQInt(int numNextBytes) Get number of bytes needed for a GRPC tag- Parameters:
- numNextBytes- Number of bytes to represent
- Returns:
- Number of bytes needed for a GRPC tag.
 
 - 
printBytesHeaderpublic static void printBytesHeader(Queue<String> byteStr, int byteIndex) Print bytes header
 - 
printMsgpublic static void printMsg(com.google.protobuf.GeneratedMessageV3 msg) Print GRPC message (pretty)- Parameters:
- msg- GRPC message
 
 - 
serializeExceptionpublic static CommonMessages.ExceptionInfo serializeException(Exception ex) Serialize Exception- Parameters:
- ex- Exception to serialize
- Returns:
- Serialized exception
 
 - 
checkIsExcpublic static void checkIsExc(CommonMessages.ExceptionInfo response) Verifies if response message isException and if this is the case print and raise it properly- Parameters:
- response- ExceptionInfo response message
 
 
- 
 
-