Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 115006 | Differences between
and this patch

Collapse All | Expand All

(-)src-native-new/src/javaBaseAgent/BaseAgentJNI.cpp (-5 / +34 lines)
Lines 122-132 Link Here
122
 */
122
 */
123
JNIEXPORT jint JNICALL Java_org_eclipse_tptp_platform_execution_datacollection_BaseAgent_register0(JNIEnv *env, jobject thisObj, jstring name)
123
JNIEXPORT jint JNICALL Java_org_eclipse_tptp_platform_execution_datacollection_BaseAgent_register0(JNIEnv *env, jobject thisObj, jstring name)
124
{
124
{
125
	 char *cargv = "X";
126
    //No command line args hence the env to be picked up.
127
	 //TODO: Need to pass command line args to the Java agent from the command line.
128
    baseAgentImpl->processCommandLine(0, &cargv);
129
130
	jint returnValue = -1;
125
	jint returnValue = -1;
131
	/* Convert the Unicode Strings into UTF-8 ones */
126
	/* Convert the Unicode Strings into UTF-8 ones */
132
	const char *asciiName = env->GetStringUTFChars(name,NULL);
127
	const char *asciiName = env->GetStringUTFChars(name,NULL);
Lines 932-934 Link Here
932
{
927
{
933
	return processCmdCallBkWCtxt(cmd, DEFAULT_PROVIDER);
928
	return processCmdCallBkWCtxt(cmd, DEFAULT_PROVIDER);
934
}
929
}
930
931
/*
932
 * Class:     org_eclipse_tptp_platform_execution_datacollection_BaseAgent
933
 * Method:    processCommandLine0
934
 * Signature: ([Ljava/lang/String;)V
935
 */
936
JNIEXPORT void JNICALL Java_org_eclipse_tptp_platform_execution_datacollection_BaseAgent_processCommandLine0
937
  (JNIEnv *env, jobject obj, jobjectArray args) {
938
  	
939
	int len = env->GetArrayLength(args);
940
	if (len <= 0) return;
941
942
	char** argv = (char**) malloc(len*sizeof(char*));
943
	if (argv == NULL) return;
944
	
945
	for (int i=0; i<len; i++) {
946
	   jstring arg = (jstring) env->GetObjectArrayElement(args, i);
947
	   char* s = (char*) env->GetStringUTFChars(arg, 0);
948
949
	   int slen = strlen(s);
950
	   argv[i] = (char*) malloc(slen+1);
951
	   if (argv[i] == NULL) return;
952
	   
953
	   strcpy (argv[i], s);
954
955
	   env->ReleaseStringUTFChars(arg, s);
956
	}
957
958
    baseAgentImpl->processCommandLine(len, argv);
959
    
960
    for (i=0; i<len; i++) free(argv[i]);
961
    
962
    free(argv);
963
 }
(-)src-native-new/src/javaBaseAgent/BaseAgentJNI.h (+3 lines)
Lines 141-146 Link Here
141
int removeClientCallBk(int clientID);
141
int removeClientCallBk(int clientID);
142
//char* getServiceConfigFileCallBk();
142
//char* getServiceConfigFileCallBk();
143
143
144
JNIEXPORT void JNICALL Java_org_eclipse_tptp_platform_execution_datacollection_BaseAgent_processCommandLine0
145
  (JNIEnv *, jobject, jobjectArray);
146
144
#ifdef __cplusplus
147
#ifdef __cplusplus
145
}
148
}
146
#endif
149
#endif

Return to bug 115006