[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.6

JAVA-JNI-C

Asked by rnarang98 in Java Programming Language, Java Native Interface (JNI)

Tags: getstringutfchars, argetentry

Hi All,

would appreciate help pls..

I am trying to prepare a JAVA-API wrapper on C-API for Remedy software.

i have asked some more questions on this also if you want to take a look at my other questions on the same subject.

I am trying to work on ARGetEntry.

This is what my C function looks like:


#include <stdlib.h>
#include <string.h>
#include <ar.h>
#include <arstruct.h>
#include <arextern.h>
#include <arfree.h>
#include <jni.h>
#include "NeTkt.h"

/*****************************************************************************/
/*                                                                           */
/*                                  PrintInt                                 */
/*                                                                           */
/*****************************************************************************/

void PrintInt(header, value)
char      *header;            /* IN; header string for the value */
int        value;             /* IN; value to print */

{
   printf("\nPrintInt\n");
   printf("%s %d\n", header, value);
}




/*****************************************************************************/
/*                                                                           */
/*                                 PrintChar                                 */
/*                                                                           */
/*****************************************************************************/

void PrintChar(header, value)
char      *header;            /* IN; header string for the value */
char      *value;             /* IN; value to print */

{
   printf("\nPrintChar\n");
   if (value == NULL)
      printf("%s\n", header);
   else
      printf("%s %s\n", value);
}


void PrintARValueStruct(header, value)
char          *header;        /* IN; header string for the value */
ARValueStruct *value;         /* IN; value to print */

{
   char  buff[82];         /* buffer to hold second line header */

   printf("%sValue:  ", header);
   printf("%sValue 1:  ", value);


   switch (value->dataType)
   {
      case AR_DATA_TYPE_NULL    :  /* NULL value (incl. no default) */
        printf("NULL\n");
         break;
      case AR_DATA_TYPE_KEYWORD :
         PrintInt("(keyword)  ", value->u.keyNum);
         break;
      case AR_DATA_TYPE_CHAR    :
         printf("(char) %s ", value->u.charVal);
         //return value->u.charVal;
         break;
      default                   :
         printf("<undefined data type tag = %u>\n",
                           value->dataType);
         break;
   }

}

void PrintARInternalId(header, value)
char        *header;          /* IN; header string for the value */
ARInternalId value;           /* IN; value to print */

{
   printf("%s %lu\n", header, value);
}

void PrintARFieldValueStruct(value)
ARFieldValueStruct *value;    /* IN; value to print */

{
   printf("Field Value Struct:\n");

  PrintARInternalId("   Field Id :", value->fieldId);



   if ((value->fieldId == AR_CORE_STATUS_HISTORY) &&
       (value->value.dataType == AR_DATA_TYPE_CHAR))
      printf("   Value: ", value->value.u.charVal);
   else
      PrintARValueStruct("   ", &value->value);

}

void PrintARFieldValueList(value)
ARFieldValueList *value;      /* IN; value to print */

{
   int                 i;      /* working index */
   ARFieldValueStruct *tempPtr;/* working pointer */
     printf("Field Value List : %u items\n", value);

   printf("Field Value List : %u items\n", value->numItems);


   if (value->numItems != 0)
   {
      tempPtr = value->fieldValueList;
      for (i = 0; i < (int) value->numItems; i++)
      {
         PrintARFieldValueStruct(tempPtr);
         tempPtr++;
      }
   }

}



JNIEXPORT void JNICALL Java_NeTkt_Initialize(JNIEnv *env,jobject obj,
       jstring jRemedyServer, jstring jRemedyUser, jstring jRemedyPassword, jstring jSchemaName, jstring jeid)
{

printf("Hello world for different method!\n");



ARStatusList status;
ARControlStruct control;
int result;

 const char *sRemedyUser = (*env)->GetStringUTFChars(env, jRemedyUser, 0);
 const char *sRemedyPassword = (*env)->GetStringUTFChars(env, jRemedyPassword, 0);
 const char *sRemedyServer = (*env)->GetStringUTFChars(env, jRemedyServer, 0);
 const char *sSchemaName = (*env)->GetStringUTFChars(env, jSchemaName, 0);
 const char *seid = (*env)->GetStringUTFChars(env, jeid, 0);
 const char *sResult="";

printf(sRemedyUser);
printf("\n");
printf(sRemedyPassword);
printf("\n");
printf(sRemedyServer);
printf("\n");
printf(sSchemaName);
printf("\n");
printf(seid);
printf("\n");


control.cacheId = 0;
control.sessionId = 0;
strcpy(control.user, sRemedyUser);
strcpy(control.password, sRemedyPassword);
strcpy(control.language, "");
strcpy(control.server, sRemedyServer);


result = ARInitialization(&control, &status);

switch (result)
   {
      case AR_RETURN_OK         :
         printf("OK\n");
         break;
      case AR_RETURN_WARNING    :
         printf("WARNING\n");
         break;
      case AR_RETURN_ERROR      :
         printf("ERROR\n");
         break;
      case AR_RETURN_FATAL      :
         printf("FATAL\n");
         break;
      case AR_RETURN_BAD_STATUS :
         printf("BAD STATUS\n");
         break;
      default                   :
         printf("<unknown return>\n");
         break;
   }



/* Verify user/password/server */
result=ARVerifyUser(&control, NULL,NULL,NULL,&status);

switch (result)
   {
      case AR_RETURN_OK         :
         printf("OK\n");
         break;
      case AR_RETURN_WARNING    :
         printf("WARNING\n");
         break;
      case AR_RETURN_ERROR      :
         printf("ERROR\n");
         break;
      case AR_RETURN_FATAL      :
         printf("FATAL\n");
         break;
      case AR_RETURN_BAD_STATUS :
         printf("BAD STATUS\n");
         break;
      default                   :
         printf("<unknown return>\n");
         break;
   }



/* Set the entryid of the record we want */

AREntryIdList entryId;
entryId.numItems = 1;
entryId.entryIdList = (AREntryIdType *) calloc(1, sizeof(AREntryIdType));
strncpy( entryId.entryIdList[0], seid, AR_MAX_ENTRYID_SIZE );

entryId.entryIdList[0][AR_MAX_ENTRYID_SIZE] = '\0';



/* Get the entry */

ARFieldValueList fieldValues;

result = ARGetEntry(&control, sSchemaName, &entryId, NULL, &fieldValues, &status);

switch (result)
   {
      case AR_RETURN_OK         :
         printf("OK\n");
         break;
      case AR_RETURN_WARNING    :
         printf("WARNING\n");
         break;
      case AR_RETURN_ERROR      :
         printf("ERROR\n");
         break;
      case AR_RETURN_FATAL      :
         printf("FATAL\n");
         break;
      case AR_RETURN_BAD_STATUS :
         printf("BAD STATUS\n");
         break;
      default                   :
         printf("<unknown return>\n");
         break;
   }


if(result >= AR_RETURN_ERROR) {
 printf("\nEntry Error\n");
} else {
      printf("Got Entry");
 PrintARFieldValueList(fieldValues);
}
//return;

/*
jclass cls = (*env)->GetObjectClass(env, obj);
  jmethodID mid = (*env)->GetMethodID(env, cls, "method1", "(Ljava/lang/Object;)V");
  if (mid == 0) {
    return;
  }

printf("\nIn C, depth = %d, about to enter Java\n", 0);
jobject callbackArg = (*env)->NewObject(env, fieldValues);
(*env)->CallVoidMethod(env, obj, mid, callbackArg);

*/
}





Now this fieldValue (which is of Type ARFieldValueList).. I am wondering How to deal with this.

Defination for C API and data types for Remedy can be found at

http://remedy.ncsu.edu/html/ver4/PDF/programmers.pdf


would appreciate help here plz..

regards
 
Loading Advertisement...
 
[+][-]07/16/03 12:25 PM, ID: 8937271Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Java Programming Language, Java Native Interface (JNI)
Tags: getstringutfchars, argetentry
Sign Up Now!
Solution Provided By: CEHJ
Participating Experts: 1
Solution Grade: B
 
[+][-]07/15/03 07:59 AM, ID: 8926048Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/03 08:20 AM, ID: 8926282Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/15/03 08:30 AM, ID: 8926387Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/03 08:43 AM, ID: 8926532Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/15/03 08:49 AM, ID: 8926586Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/03 09:01 AM, ID: 8926700Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/15/03 09:04 AM, ID: 8926737Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/15/03 09:12 AM, ID: 8926811Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/03 09:20 AM, ID: 8926869Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/15/03 09:22 AM, ID: 8926896Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/03 09:29 AM, ID: 8926953Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/15/03 10:05 AM, ID: 8927203Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/03 10:37 AM, ID: 8927459Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/03 02:40 PM, ID: 8929561Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/15/03 02:47 PM, ID: 8929609Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/03 03:06 PM, ID: 8929713Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/15/03 03:07 PM, ID: 8929722Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/15/03 03:11 PM, ID: 8929750Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/03 03:17 PM, ID: 8929774Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/15/03 03:24 PM, ID: 8929812Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/16/03 06:37 AM, ID: 8934188Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/16/03 06:43 AM, ID: 8934254Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/16/03 06:45 AM, ID: 8934273Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/16/03 06:49 AM, ID: 8934321Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/16/03 07:00 AM, ID: 8934436Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/16/03 07:46 AM, ID: 8934895Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/16/03 11:05 AM, ID: 8936756Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92