Sha256: 3bf41d5db3bec5d9acd8288bd53d1242b5ddc26ac3402fd4b614411bb1fa406a

Contents?: true

Size: 1.54 KB

Versions: 17

Compression:

Stored size: 1.54 KB

Contents

#include "rhodes.h"
#include "Eventsource.h"

#include "logging/RhoLog.h"
#undef DEFAULT_LOGCATEGORY
#define DEFAULT_LOGCATEGORY "Eventsource_impl"

#define EVENTSOURCE_FACTORY_CLASS "com.rho.eventsource.EventsourceFactory"

extern "C" void Init_Eventsource_API(void);

extern "C" void Init_Eventsource(void)
{
    RAWTRACE(__FUNCTION__);

    JNIEnv *env = jnienv();
    if(env)
    {
        jclass cls = rho_find_class(env, EVENTSOURCE_FACTORY_CLASS);
        if(!cls)
        {
            RAWLOG_ERROR1("Failed to find java class: %s", EVENTSOURCE_FACTORY_CLASS);
            return;
        }
        jmethodID midFactory = env->GetMethodID(cls, "<init>", "()V");
        if(!midFactory)
        {
            RAWLOG_ERROR1("Failed to get constructor for java class %s", EVENTSOURCE_FACTORY_CLASS);
            return;
        }
        jobject jFactory = env->NewObject(cls, midFactory);
        if(env->IsSameObject(jFactory, NULL))
        {
            RAWLOG_ERROR1("Failed to create %s instance", EVENTSOURCE_FACTORY_CLASS);
            return;
        }
        
        RAWTRACE("Initializing Java factory");

        CEventsourceBase::setJavaFactory(env, jFactory);

        RAWTRACE("Deleting JNI reference");

        env->DeleteLocalRef(jFactory);

        RAWTRACE("Initializing API");

        Init_Eventsource_API();

        RAWTRACE("Init_Eventsource succeeded");
    }
    else
    {
        RAWLOG_ERROR("Failed to initialize Eventsource API: jnienv() is failed");
    }

}

extern "C" void Init_Eventsource_extension() {
    Init_Eventsource();
}

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
rhodes-7.6.0 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-7.5.1 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-7.4.1 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-7.1.17 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-6.2.0 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-6.0.11 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-5.5.18 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-5.5.17 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-5.5.15 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-5.5.0.22 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-5.5.2 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-5.5.0.7 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-5.5.0.3 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
rhodes-5.5.0 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
tauplatform-1.0.3 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
tauplatform-1.0.2 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp
tauplatform-1.0.1 lib/commonAPI/eventsource/ext/platform/android/jni/Eventsource_impl.cpp