Package com.senzing.g2.engine
Class G2DiagnosticJNI
- java.lang.Object
-
- com.senzing.g2.engine.G2DiagnosticJNI
-
- All Implemented Interfaces:
G2Diagnostic,G2Fallible
public class G2DiagnosticJNI extends Object implements G2Diagnostic
Implements theG2Diagnosticto call the native implementations of each function.
-
-
Constructor Summary
Constructors Constructor Description G2DiagnosticJNI()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcheckDBPerf(int secondsToRun, StringBuffer response)Runs non-destruction DB performance tests and writes detail of the result as JSON in the specifiedStringBuffer.voidclearLastException()Clears the information about the last error the system received.voidcloseEntityListBySize(long entityListBySizeHandle)Experimental/internal method to close the result set associated with the specified handle obtained fromG2Diagnostic.getEntityListBySize(long).intcloseEntityListBySizeV2(long entityListBySizeHandle)Experimental/internal method to close the result set associated with the specified handle obtained fromG2Diagnostic.getEntityListBySizeV2(long,Result).intdestroy()Uninitializes the G2 diagnostic object.StringfetchNextEntityBySize(long entityListBySizeHandle)Experimental/internal method for obtaining the next sized entity result with the specified handle obtained fromG2Diagnostic.getEntityListBySize(long).intfetchNextEntityBySizeV2(long entityListBySizeHandle, StringBuffer response)Experimental/internal method for obtaining the next sized entity result with the specified handle obtained fromG2Diagnostic.getEntityListBySizeV2(long,Result).intfindEntitiesByFeatureIDs(String features, StringBuffer response)This methods asks g2 for any entities having any of the lib feat id specified in the "features" doc.longgetAvailableMemory()Returns the available number of bytes of RAM on the systemintgetDataSourceCounts(StringBuffer response)Experimental/internal method for obtaining data source counts.intgetDBInfo(StringBuffer response)Gets information about database connections and generates a JSON document describing the result in the following format (sans pretty-printing):intgetEntityDetails(long entityID, boolean includeInternalFeatures, StringBuffer response)Experimental/internal method for obtaining diagnostic entity details.longgetEntityListBySize(long entitySize)Experimental/internal method for obtaining diagnostic information on sized entities.intgetEntityListBySizeV2(long entitySize, Result<Long> exportHandle)Experimental/internal method for obtaining diagnostic information on sized entities.intgetEntityResume(long entityID, StringBuffer response)Experimental/internal method for obtaining diagnostic entity resume.intgetEntitySizeBreakdown(long minimumEntitySize, boolean includeInternalFeatures, StringBuffer response)Experimental/internal method for obtaining entity size breakdown.intgetFeature(long libFeatID, StringBuffer response)Experimental/internal method for obtaining diagnostic feature information.intgetGenericFeatures(String featureType, long maximumEstimatedCount, StringBuffer response)Experimental/internal method for obtaining generic features.StringgetLastException()Returns a string about the last error the system received.intgetLastExceptionCode()Returns the exception code of the last error the system received.intgetLogicalCores()Returns the number of logical cores on the system.intgetMappingStatistics(boolean includeInternalFeatures, StringBuffer response)Experimental/internal method for obtaining mapping statistics.intgetPhysicalCores()Returns the number of physical cores on the system.intgetRelationshipDetails(long relationshipID, boolean includeInternalFeatures, StringBuffer response)Experimental/internal method for obtaining diagnostic relationship details.intgetResolutionStatistics(StringBuffer response)Experimental/internal method for obtaining resolution statistics.longgetTotalSystemMemory()Returns the total number of bytes of RAM on the systemintinitV2(String moduleName, String iniParams, boolean verboseLogging)Initializes the G2 Diagnostic object with the specified module name, init parameters and flag indicating verbose logging.intinitWithConfigIDV2(String moduleName, String iniParams, long initConfigID, boolean verboseLogging)Initializes the G2 Diagnostic object with the module name, initialization parameters, verbose logging flag and a specific configuration ID identifying the configuration to use.intreinitV2(long initConfigID)Reinitializes with the specified configuration ID.
-
-
-
Method Detail
-
initV2
public int initV2(String moduleName, String iniParams, boolean verboseLogging)
Initializes the G2 Diagnostic object with the specified module name, init parameters and flag indicating verbose logging. If theG2CONFIGFILEinit parameter is absent then the default configuration from the repository is used.- Specified by:
initV2in interfaceG2Diagnostic- Parameters:
moduleName- A short name given to this instance of the diagnostic object.iniParams- A JSON string containing configuration parameters.verboseLogging- Enable diagnostic logging which will print a massive amount of information to stdout.- Returns:
- Zero (0) on success, non-zero on failure.
-
initWithConfigIDV2
public int initWithConfigIDV2(String moduleName, String iniParams, long initConfigID, boolean verboseLogging)
Initializes the G2 Diagnostic object with the module name, initialization parameters, verbose logging flag and a specific configuration ID identifying the configuration to use.- Specified by:
initWithConfigIDV2in interfaceG2Diagnostic- Parameters:
moduleName- The module name with which to initialize.iniParams- The JSON initialization parameters.initConfigID- The specific configuration ID to initialize with.verboseLogging- Whether or not to initialize with verbose logging.- Returns:
- Zero (0) on success and non-zero on failure.
-
reinitV2
public int reinitV2(long initConfigID)
Reinitializes with the specified configuration ID.- Specified by:
reinitV2in interfaceG2Diagnostic- Parameters:
initConfigID- The configuration ID with which to reinitialize.- Returns:
- Zero (0) on success and non-zero on failure.
-
destroy
public int destroy()
Uninitializes the G2 diagnostic object.- Specified by:
destroyin interfaceG2Diagnostic- Returns:
- Zero (0) on success and non-zero on failure.
-
getTotalSystemMemory
public long getTotalSystemMemory()
Returns the total number of bytes of RAM on the system- Specified by:
getTotalSystemMemoryin interfaceG2Diagnostic- Returns:
- The number of bytes on success and negative one (-1) on failure.
-
getAvailableMemory
public long getAvailableMemory()
Returns the available number of bytes of RAM on the system- Specified by:
getAvailableMemoryin interfaceG2Diagnostic- Returns:
- The number of bytes on success and negative one (-1) on failure.
-
getPhysicalCores
public int getPhysicalCores()
Returns the number of physical cores on the system.- Specified by:
getPhysicalCoresin interfaceG2Diagnostic- Returns:
- The number of cores on success and negative one (-1) on failure.
-
getLogicalCores
public int getLogicalCores()
Returns the number of logical cores on the system. This may be different that physical due to hyper-threading.- Specified by:
getLogicalCoresin interfaceG2Diagnostic- Returns:
- The number of cores on success and negative one (-1) on failure.
-
checkDBPerf
public int checkDBPerf(int secondsToRun, StringBuffer response)Runs non-destruction DB performance tests and writes detail of the result as JSON in the specifiedStringBuffer.- Specified by:
checkDBPerfin interfaceG2Diagnostic- Parameters:
secondsToRun- How long to run the database performance test.response- TheStringBufferin which to write the JSON text that details the result of the performance test.- Returns:
- Zero (0) on success and non-zero on failure.
-
getDBInfo
public int getDBInfo(StringBuffer response)
Gets information about database connections and generates a JSON document describing the result in the following format (sans pretty-printing):{ "Hybrid Mode": false, "Database Details": [ { "Name": "SENZDB", "Type": "POSTGRES" } ] }- Specified by:
getDBInfoin interfaceG2Diagnostic- Parameters:
response- TheStringBufferin which to write Json document describing the result.- Returns:
- Zero (0) on success and non-zero on failure.
-
findEntitiesByFeatureIDs
public int findEntitiesByFeatureIDs(String features, StringBuffer response)
This methods asks g2 for any entities having any of the lib feat id specified in the "features" doc. The "features" also contains an entity id that specifies the entity to be ignored in the returned values. The response is written as a JSON document to the specifiedStringBuffer.The format of the "features" document is as follows:
{ "ENTITY_ID": <entity_id>, "LIB_FEAT_IDS": [ <id1>, <id2>, ... <idn> ] }The format of the response document is as follows (sans pretty-printing):
[ { "LIB_FEAT_ID": <lib_feat_id>, "USAGE_TYPE": "<usage_type>", "RES_ENT_ID": <entity_id> }, ... ]- Specified by:
findEntitiesByFeatureIDsin interfaceG2Diagnostic- Parameters:
features- Json document describing the desired features.response- TheStringBufferto write the JSON response to.- Returns:
- Zero (0) on success and non-zero on failure.
-
getDataSourceCounts
public int getDataSourceCounts(StringBuffer response)
Experimental/internal method for obtaining data source counts.- Specified by:
getDataSourceCountsin interfaceG2Diagnostic- Parameters:
response- TheStringBufferto write the JSON response document to.- Returns:
- Zero (0) on success and non-zero on failure.
-
getMappingStatistics
public int getMappingStatistics(boolean includeInternalFeatures, StringBuffer response)Experimental/internal method for obtaining mapping statistics.- Specified by:
getMappingStatisticsin interfaceG2Diagnostic- Parameters:
includeInternalFeatures-trueif internal features should be included andfalseif they should be excluded.response- TheStringBufferto write the JSON response document to.- Returns:
- Zero (0) on success and non-zero on failure.
-
getGenericFeatures
public int getGenericFeatures(String featureType, long maximumEstimatedCount, StringBuffer response)
Experimental/internal method for obtaining generic features.- Specified by:
getGenericFeaturesin interfaceG2Diagnostic- Parameters:
featureType- The feature type code.maximumEstimatedCount- The maximum estimated count.response- TheStringBufferto write the JSON response document to.- Returns:
- Zero (0) on success and non-zero on failure.
-
getEntitySizeBreakdown
public int getEntitySizeBreakdown(long minimumEntitySize, boolean includeInternalFeatures, StringBuffer response)Experimental/internal method for obtaining entity size breakdown.- Specified by:
getEntitySizeBreakdownin interfaceG2Diagnostic- Parameters:
minimumEntitySize- The minimum entity size.includeInternalFeatures-trueif internal features should be included andfalseif they should be excluded.response- TheStringBufferto write the JSON response document to.- Returns:
- Zero (0) on success and non-zero on failure.
-
getEntityDetails
public int getEntityDetails(long entityID, boolean includeInternalFeatures, StringBuffer response)Experimental/internal method for obtaining diagnostic entity details.- Specified by:
getEntityDetailsin interfaceG2Diagnostic- Parameters:
entityID- The entity ID for the entity.includeInternalFeatures-trueif internal features should be included andfalseif they should be excluded.response- TheStringBufferto write the JSON response document to.- Returns:
- Zero (0) on success and non-zero on failure.
-
getResolutionStatistics
public int getResolutionStatistics(StringBuffer response)
Experimental/internal method for obtaining resolution statistics.- Specified by:
getResolutionStatisticsin interfaceG2Diagnostic- Parameters:
response- TheStringBufferto write the JSON response document to.- Returns:
- Zero (0) on success and non-zero on failure.
-
getRelationshipDetails
public int getRelationshipDetails(long relationshipID, boolean includeInternalFeatures, StringBuffer response)Experimental/internal method for obtaining diagnostic relationship details.- Specified by:
getRelationshipDetailsin interfaceG2Diagnostic- Parameters:
relationshipID- The relationship ID identifying the relationship.includeInternalFeatures-trueif internal features should be included andfalseif they should be excluded.response- TheStringBufferto write the JSON response document to.- Returns:
- Zero (0) on success and non-zero on failure.
-
getEntityResume
public int getEntityResume(long entityID, StringBuffer response)Experimental/internal method for obtaining diagnostic entity resume.- Specified by:
getEntityResumein interfaceG2Diagnostic- Parameters:
entityID- The entity ID.response- TheStringBufferto write the JSON result document to.- Returns:
- Zero (0) on success and non-zero on failure.
-
getFeature
public int getFeature(long libFeatID, StringBuffer response)Experimental/internal method for obtaining diagnostic feature information.- Specified by:
getFeaturein interfaceG2Diagnostic- Parameters:
libFeatID- TheLIB_FEAT_IDidentifying the feature.response- TheStringBufferto write the JSON result document to.- Returns:
- Zero (0) on success and non-zero on failure.
-
getEntityListBySize
public long getEntityListBySize(long entitySize)
Experimental/internal method for obtaining diagnostic information on sized entities.- Specified by:
getEntityListBySizein interfaceG2Diagnostic- Parameters:
entitySize- The entity size.- Returns:
- The handle for the result set.
-
fetchNextEntityBySize
public String fetchNextEntityBySize(long entityListBySizeHandle)
Experimental/internal method for obtaining the next sized entity result with the specified handle obtained fromG2Diagnostic.getEntityListBySize(long).- Specified by:
fetchNextEntityBySizein interfaceG2Diagnostic- Parameters:
entityListBySizeHandle- The handle for the result set.- Returns:
- The next sized entity result.
-
closeEntityListBySize
public void closeEntityListBySize(long entityListBySizeHandle)
Experimental/internal method to close the result set associated with the specified handle obtained fromG2Diagnostic.getEntityListBySize(long).- Specified by:
closeEntityListBySizein interfaceG2Diagnostic- Parameters:
entityListBySizeHandle- The handle for the result set.
-
getEntityListBySizeV2
public int getEntityListBySizeV2(long entitySize, Result<Long> exportHandle)Experimental/internal method for obtaining diagnostic information on sized entities.- Specified by:
getEntityListBySizeV2in interfaceG2Diagnostic- Parameters:
entitySize- The entity size.exportHandle- TheResultobject on which the result handle will be set.- Returns:
- Zero (0) on success and non-zero on failure.
-
fetchNextEntityBySizeV2
public int fetchNextEntityBySizeV2(long entityListBySizeHandle, StringBuffer response)Experimental/internal method for obtaining the next sized entity result with the specified handle obtained fromG2Diagnostic.getEntityListBySizeV2(long,Result).- Specified by:
fetchNextEntityBySizeV2in interfaceG2Diagnostic- Parameters:
entityListBySizeHandle- The handle for the result set.response- TheStringBufferto write the JSON result document to.- Returns:
- Zero (0) on success and non-zero on failure.
-
closeEntityListBySizeV2
public int closeEntityListBySizeV2(long entityListBySizeHandle)
Experimental/internal method to close the result set associated with the specified handle obtained fromG2Diagnostic.getEntityListBySizeV2(long,Result).- Specified by:
closeEntityListBySizeV2in interfaceG2Diagnostic- Parameters:
entityListBySizeHandle- The handle for the result set.- Returns:
- Zero (0) on success and non-zero on failure.
-
getLastException
public String getLastException()
Returns a string about the last error the system received. This is most commonly called after an API function returns an error code (non-zero or NULL)- Specified by:
getLastExceptionin interfaceG2Fallible- Returns:
- An error message
-
getLastExceptionCode
public int getLastExceptionCode()
Returns the exception code of the last error the system received. This is most commonly called after an API function returns an error code (non-zero or NULL)- Specified by:
getLastExceptionCodein interfaceG2Fallible- Returns:
- An error code
-
clearLastException
public void clearLastException()
Clears the information about the last error the system received.- Specified by:
clearLastExceptionin interfaceG2Fallible
-
-