Commit 7ba44ae8 authored by Ryan Berkheimer's avatar Ryan Berkheimer

bugfixin

parent 5ea8de10
......@@ -14,13 +14,13 @@ JNIEXPORT jobject JNICALL Java_gov_noaa_messageapi_endpoints_NativeEndpoint_proc
{
printf("In our test!\n");
printf("Hello, World\n");
/*struct record_list* default_record_list = getRecords(message);
struct record_list* default_record_list = getRecords(message);
//struct record_list* classifier_record_list = getRecordsByClassifier(message, "color", "blue");
//struct record_list* collection_record_list = getRecordsByCollection(message, "gold");
//struct record_list* transformation_record_list = getRecordsByTransformation(message, "combine-colors");
printf("Record count: %d\n", default_record_list->count);
fflush(stdout);
struct string_list* default_field_name_list = getFieldIds(message, getRecord(message, default_record_list, 0));
/*struct string_list* default_field_name_list = getFieldIds(message, getRecord(message, default_record_list, 0));
printf("Field name count: %d\n", default_field_name_list->count);
printf("Length of longest field name: %d\n", default_field_name_list->max_length);
for (int i = 0; i < default_field_name_list->count; i++) {
......
......@@ -98,9 +98,6 @@ void MessageApiEndpoint::loadProtocolRecordMethodIds()
jclass protocolRecordClass = this->getObjectClass(this->protocolRecord);
printf("Loaded protocolRecordClass..\n");
fflush(stdout);
this->getRecordsMethodId = this->getMethod(protocolRecordClass, "getRecords", this->getProtocolRecordMethodSignature("getRecords"), false);
this->getRecordsByCollectionMethodId = this->getMethod(protocolRecordClass, "getRecordsByCollection", this->getProtocolRecordMethodSignature("getRecordsByCollection"), false);
this->getRecordsByUUIDMethodId = this->getMethod(protocolRecordClass, "getRecordsByUUID", this->getProtocolRecordMethodSignature("getRecordsByUUID"), false);
......@@ -513,12 +510,17 @@ struct rejection *MessageApiEndpoint::createRejection(struct record *record, con
*/
jobject MessageApiEndpoint::getProtocolRecords(const char* method, const char* key, const char* val)
{
if (method == "getRecords")
return this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsMethodId);
/*if (method == "getRecords")
{
printf("method entered getRecords selection.\n");
fflush(stdout);
return this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsMethodId);
}
jstring javaKey = toJavaString(key);
jstring javaKey = this->toJavaString(key);
jobject protocolRecords;
printf("oops, method went too far...\n");
fflush(stdout);
if (method == "getRecordsByCollection")
{
protocolRecords = this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsByCollectionMethodId, javaKey);
......@@ -533,20 +535,20 @@ jobject MessageApiEndpoint::getProtocolRecords(const char* method, const char* k
}
else if (method == "getRecordsByClassifier")
{
jstring javaVal = toJavaString(val);
jstring javaVal = this->toJavaString(val);
protocolRecords = this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsByClassifierMethodId, javaKey, javaVal);
this->jvm->DeleteLocalRef(javaVal);
}
this->jvm->DeleteLocalRef(javaKey);
return protocolRecords;
return protocolRecords;*/
}
struct record_list * MessageApiEndpoint::getRecords(const char *recordMethod, const char *key, const char *val)
{
jobject jprotocolRecords = this->getProtocolRecords(recordMethod, key, val);
printf("Received jProtocolRecords.\n");
printf("Populated jProtocolRecords jobject using method %s.\n", recordMethod);
fflush(stdout);
//int recordCount = this->getJListLength(jprotocolRecords);
int recordCount = this->getJListLength(jprotocolRecords);
struct record_list *record_list = (struct record_list *) malloc(sizeof(struct record_list));
//record_list->count = recordCount;
record_list->count = 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment