Commit 627d836d authored by Ryan Berkheimer's avatar Ryan Berkheimer

bugfixin - testing identified solution

parent 2503a499
......@@ -19,8 +19,7 @@ JNIEXPORT jobject JNICALL Java_gov_noaa_messageapi_endpoints_NativeEndpoint_proc
//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++) {
......@@ -66,7 +65,7 @@ JNIEXPORT jobject JNICALL Java_gov_noaa_messageapi_endpoints_NativeEndpoint_proc
} else {
printf("Field val 4 has a value!\n");
}
fflush(stdout);*/
fflush(stdout);
struct record *returnRecord = createRecord(message);
struct string_list *fieldIds = getFieldIds(message, returnRecord);
printf("field ids for return field follow. \n");
......@@ -82,10 +81,11 @@ JNIEXPORT jobject JNICALL Java_gov_noaa_messageapi_endpoints_NativeEndpoint_proc
printf("Field val for field %s already has a value!\n", fieldIds->strings[i]);
}
}
printf("Leaving our C test!");
fflush(stdout);
struct packet* packet = createPacket(message);
addPacketRecord(message, packet, returnRecord);
printf("Leaving our C test!");
fflush(stdout);
return packet->jpacket;
}
......@@ -510,46 +510,45 @@ struct rejection *MessageApiEndpoint::createRejection(struct record *record, con
*/
jobject MessageApiEndpoint::getProtocolRecords(const char* method, const char* key, const char* val)
{
return this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsMethodId);
/*if (method == "getRecords")
if (method == "getRecords")
{
printf("method entered getRecords selection.\n");
fflush(stdout);
return this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsMethodId);
}
jstring javaKey = this->toJavaString(key);
jobject protocolRecords;
printf("oops, method went too far...\n");
fflush(stdout);
if (method == "getRecordsByCollection")
else if (method == "getRecordsByCollection")
{
protocolRecords = this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsByCollectionMethodId, javaKey);
jstring javaKey = this->toJavaString(key);
jobject protocolRecords = this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsByCollectionMethodId, javaKey);
this->jvm->DeleteLocalRef(javaKey);
return protocolRecords;
}
else if (method == "getRecordsByTransformation")
{
protocolRecords = this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsByTransformationMethodId, javaKey);
jstring javaKey = this->toJavaString(key);
jobject protocolRecords = this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsByTransformationMethodId, javaKey);
this->jvm->DeleteLocalRef(javaKey);
return protocolRecords;
}
else if (method == "getRecordsByUUID")
{
protocolRecords = this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsByUUIDMethodId, javaKey);
jstring javaKey = this->toJavaString(key);
jobject protocolRecords = this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsByUUIDMethodId, javaKey);
this->jvm->DeleteLocalRef(javaKey);
return protocolRecords;
}
else if (method == "getRecordsByClassifier")
{
jstring javaVal = this->toJavaString(val);
protocolRecords = this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsByClassifierMethodId, javaKey, javaVal);
jobject protocolRecords = this->jvm->CallObjectMethod(this->protocolRecord, this->getRecordsByClassifierMethodId, javaKey, javaVal);
this->jvm->DeleteLocalRef(javaKey);
this->jvm->DeleteLocalRef(javaVal);
return protocolRecords;
}
this->jvm->DeleteLocalRef(javaKey);
return protocolRecords;*/
}
struct record_list * MessageApiEndpoint::getRecords(const char *recordMethod, const char *key, const char *val)
{
jobject jprotocolRecords = this->getProtocolRecords(recordMethod, key, val);
printf("Populated jProtocolRecords jobject using method %s.\n", recordMethod);
fflush(stdout);
int recordCount = this->getJListLength(jprotocolRecords);
printf("we got %d protocol records.",recordCount);
struct record_list *record_list = (struct record_list *) malloc(sizeof(struct record_list));
record_list->count = recordCount;
record_list->jrecords = jprotocolRecords;
......
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