lilantha    2003/07/17 06:22:08

  Modified:    c/src/server/catalina libAxiscpp.cpp libAxiscpp.h
  Log:
  updated
  
  Revision  Changes    Path
  1.3       +38 -75    xml-axis/c/src/server/catalina/libAxiscpp.cpp
  
  Index: libAxiscpp.cpp
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/server/catalina/libAxiscpp.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- libAxiscpp.cpp    17 Jul 2003 13:11:19 -0000      1.2
  +++ libAxiscpp.cpp    17 Jul 2003 13:22:08 -0000      1.3
  @@ -63,85 +63,10 @@
    */
   
   #include "libAxiscpp.h"
  -#include "AxisCppContentHandler.h"
   #include "../../common/Packet.h"
   #include <new>
   
   
  -static void
  -jni_throw(JNIEnv* env, const char* exception, const char* msg)
  -{
  -    if (env->ExceptionOccurred())
  -        return;
  -    jclass jexception = env->FindClass(exception);
  -    if (env->ExceptionOccurred())
  -      return;
  -    if (jexception == NULL)
  -        env->FatalError(exception);
  -    env->ThrowNew(jexception, msg);
  -}
  -
  -
  -#define JNI_ASSERT(assert, name, msg) \
  -    do \
  -    { \
  -        if (p_Env->ExceptionOccurred()) \
  -            return; \
  -        if (! assert) \
  -        { \
  -            jni_throw(p_Env, name, msg); \
  -            return; \
  -        } \
  -    } while (0)
  -
  -
  -class JNIVector
  -{
  -public:
  -    JNIVector(JNIEnv* p_Env, jobject p_jVector)
  -        : m_pEnv(p_Env), m_jVector(p_jVector)
  -    {
  -             jclass clazz = p_Env->FindClass("java/util/Vector");
  -             JNI_ASSERT(clazz != NULL, "java/lang/NoClassDefFoundError", 
"java.util.Vector");
  -    
  -             JNI_ASSERT(p_Env->IsInstanceOf(p_jVector, clazz),
  -                                              "java/lang/IllegalArgumentException",
  -                                              "p_jVector not a java.util.Vector 
object!");
  -
  -             m_jmGet = p_Env->GetMethodID(clazz, "get", "(I)Ljava/lang/Object");
  -
  -             JNI_ASSERT(m_jmGet != NULL,
  -                     "java/lang/NoSuchMethodError",
  -                     "method 'public Object get(int index)' not found!");
  -    }
  -     ///Destructor
  -    ~JNIVector()
  -    {
  -
  -    }
  -
  -    char* operator [] (int i) const
  -    {
  -             jboolean isCopy;
  -             jobject obj = m_pEnv->CallObjectMethod(m_jVector, m_jmGet, i);
  -             jstring str = (jstring) obj;
  -             const char *pch = m_pEnv->GetStringUTFChars(str, &isCopy);
  -             if (m_pEnv->ExceptionOccurred())
  -            throw std::bad_alloc();
  -        return (char*)pch;
  -    }
  -
  -     void push_back(const char* str) 
  -     {
  -     
  -     }
  -
  -private:
  -
  -    JNIEnv* m_pEnv;
  -    jobject m_jVector;
  -     jmethodID m_jmGet;
  -};
   
   JNIEXPORT void JNICALL Java_AxisCppContentHandler_Delegate
     (JNIEnv *p_Env, jclass, jcharArray p_jBody, jint p_nBodySize, jobject 
p_jvHeaders, 
  @@ -170,5 +95,43 @@
        delete str;
   }
   
  +
  +JNIVector::JNIVector(JNIEnv* p_Env, jobject p_jVector)
  +        : m_pEnv(p_Env), m_jVector(p_jVector)
  +{
  +     jclass clazz = p_Env->FindClass("java/util/Vector");
  +     JNI_ASSERT(clazz != NULL, "java/lang/NoClassDefFoundError", 
"java.util.Vector");
  +
  +     JNI_ASSERT(p_Env->IsInstanceOf(p_jVector, clazz),
  +                                      "java/lang/IllegalArgumentException",
  +                                      "p_jVector not a java.util.Vector object!");
  +
  +     m_jmGet = p_Env->GetMethodID(clazz, "get", "(I)Ljava/lang/Object");
  +
  +     JNI_ASSERT(m_jmGet != NULL,
  +                 "java/lang/NoSuchMethodError",
  +                 "method 'public Object get(int index)' not found!");
  +}
  +     ///Destructor
  +JNIVector::~JNIVector()
  +{
  +
  +}
  +
  +char* JNIVector::operator [] (int i) const
  +{
  +     jboolean isCopy;
  +     jobject obj = m_pEnv->CallObjectMethod(m_jVector, m_jmGet, i);
  +     jstring str = (jstring) obj;
  +     const char *pch = m_pEnv->GetStringUTFChars(str, &isCopy);
  +     if (m_pEnv->ExceptionOccurred())
  +        throw std::bad_alloc();
  +    return (char*)pch;
  +}
  +
  +void JNIVector::push_back(const char* str) 
  +{
  +
  +}
   
   
  
  
  
  1.2       +51 -0     xml-axis/c/src/server/catalina/libAxiscpp.h
  
  Index: libAxiscpp.h
  ===================================================================
  RCS file: /home/cvs/xml-axis/c/src/server/catalina/libAxiscpp.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- libAxiscpp.h      8 Jul 2003 13:48:16 -0000       1.1
  +++ libAxiscpp.h      17 Jul 2003 13:22:08 -0000      1.2
  @@ -66,11 +66,62 @@
   #if !defined(_AXIS_LIBAXISCPP_HPP)
   #define _AXIS_LIBAXISCPP_HPP
   
  +#include "AxisCppContentHandler.h"
  +
   #ifdef LIBAXISCPP_EXPORTS
   #define LIBAXIS_DLL_API __declspec(dllexport)
   #else
   #define LIBAXIS_DLL_API __declspec(dllimport)
   #endif
  +
  +
  +
  +static void
  +jni_throw(JNIEnv* env, const char* exception, const char* msg)
  +{
  +    if (env->ExceptionOccurred())
  +        return;
  +    jclass jexception = env->FindClass(exception);
  +    if (env->ExceptionOccurred())
  +      return;
  +    if (jexception == NULL)
  +        env->FatalError(exception);
  +    env->ThrowNew(jexception, msg);
  +}
  +
  +
  +#define JNI_ASSERT(assert, name, msg) \
  +    do \
  +    { \
  +        if (p_Env->ExceptionOccurred()) \
  +            return; \
  +        if (! assert) \
  +        { \
  +            jni_throw(p_Env, name, msg); \
  +            return; \
  +        } \
  +    } while (0)
  +
  +
  +
  +
  +class JNIVector
  +{
  +public:
  +    JNIVector(JNIEnv* p_Env, jobject p_jVector);
  +     ///Destructor
  +    ~JNIVector();
  +
  +    char* operator [] (int i) const;
  +     void push_back(const char* str);
  +
  +private:
  +
  +    JNIEnv* m_pEnv;
  +    jobject m_jVector;
  +     jmethodID m_jmGet;
  +};
  +
   
   #endif //_AXIS_LIBAXISCPP_HPP
   
  
  
  

Reply via email to