http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropAssemblies.h ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropAssemblies.h b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropAssemblies.h deleted file mode 100644 index 2e80d71..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropAssemblies.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#pragma once -#define _USING_V110_SDK71_ - -#pragma warning( push ) -#pragma warning( disable : 4793 ) -#include <jni.h> -#pragma warning( pop ) -#include "mscoree.h" -#include "vcclr.h" - -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -public ref class AssemblyUtil { - public : - static int _asmCount = 0; - static Dictionary<String^, System::Reflection::Assembly^>^ asms2 = gcnew Dictionary<String^, Assembly^>(); - static void Add(Assembly^ myasm); - static Assembly^ FindAsm (String^ myasm); - static Assembly^ MyResolveEventHandler(Object^ sender, ResolveEventArgs^ args); -};
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.cpp ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.cpp b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.cpp deleted file mode 100644 index 418bd55..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#include "InteropLogger.h" - -namespace Microsoft { - namespace Reef { - namespace Interop { - /// currently not being used - InteropLogger::InteropLogger (JNIEnv* env, jobject jobjectInteropLogger) { - _env = env; - _jobjectInteropLogger = jobjectInteropLogger; - _jclassInteropLogger = env->GetObjectClass(jobjectInteropLogger); - wchar_t formatBuf[1024]; - if (NULL == _jclassInteropLogger) { - swprintf_s (formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"_jclassInteropLogger %p\n", _jclassInteropLogger); - fwprintf (stdout, formatBuf); - fflush (stdout); - } - _jmidLog = env->GetMethodID(_jclassInteropLogger, "Log", "(ILjava/lang/String;)V"); - if (NULL == _jmidLog) { - swprintf_s (formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"_jmidLog %p\n", _jmidLog); - fwprintf (stdout, formatBuf); - fflush (stdout); - } - - } - void InteropLogger::Log(TraceLevel traceLevel, String^ message) { - pin_ptr<const wchar_t> wch = PtrToStringChars(message); - jstring msg = _env->NewString((const jchar*)wch, message->Length); - _env->CallObjectMethod(_jobjectInteropLogger, _jmidLog, (int)traceLevel, msg); - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.h ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.h b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.h deleted file mode 100644 index c2a2e80..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#include "InteropUtil.h" -#include "org_apache_reef_javabridge_NativeInterop.h" -#include "JavaClrBridge.h" -#include "InteropAssemblies.h" -#using "clrhandler.dll" - -using namespace System; -using namespace System::IO; -using namespace System::Collections::Generic; -using namespace System::Runtime::InteropServices; -using namespace System::Reflection; -using namespace Microsoft::Reef::Interop; - -namespace Microsoft { - namespace Reef { - namespace Interop { - public ref class InteropLogger : public ILogger { - jobject _jobjectInteropLogger; - jclass _jclassInteropLogger; - jmethodID _jmidLog; - JNIEnv* _env; - - public: - InteropLogger (JNIEnv* env, jobject jobjectInteropLogger); - virtual void Log(TraceLevel traceLevel, String^ message ); - }; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.cpp ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.cpp b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.cpp deleted file mode 100644 index 821c0d1..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#include "InteropReturnInfo.h" - -namespace Microsoft { - namespace Reef { - namespace Interop { - // currently not being used - InteropReturnInfo::InteropReturnInfo ( - JNIEnv* env, - jobject jobjectInteropReturnInfo, - ILogger^ logger - ) { - _env = env; - _jobjectInteropReturnInfo = jobjectInteropReturnInfo; - jclass thisClass = env->GetObjectClass(jobjectInteropReturnInfo); - wchar_t formatBuf[1024]; - - swprintf_s (formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"zzzzzzz this should be printed by java jmid 00 %p\n", thisClass); - logger->Log(TraceLevel::Error, gcnew String(formatBuf)); - _jmidAddExceptionString = env->GetMethodID(thisClass, "addExceptionString", "(Ljava/lang/String;)V"); - if (NULL == _jmidAddExceptionString) { - swprintf_s (formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"_jmidAddExceptionString %p\n", _jmidAddExceptionString); - fwprintf (stdout, formatBuf); - fflush (stdout); - } - - _jmidHasExceptions = env->GetMethodID(thisClass, "hasExceptions", "()Z"); - if (NULL == _jmidHasExceptions) { - swprintf_s (formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"_jmidHasExceptions %p\n", _jmidHasExceptions); - fwprintf (stdout, formatBuf); - fflush (stdout); - } - - _jmidsetReturnCode = env->GetMethodID(thisClass, "setReturnCode", "(I)V"); - if (NULL == _jmidsetReturnCode) { - swprintf_s (formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"_jmidsetReturnCode %p\n", _jmidsetReturnCode); - fwprintf (stdout, formatBuf); - fflush (stdout); - } - - _jmidgetReturnCode = env->GetMethodID(thisClass, "getReturnCode", "()I"); - if (NULL == _jmidgetReturnCode) { - swprintf_s (formatBuf, sizeof(formatBuf) / sizeof(wchar_t), L"_jmidgetReturnCode %p\n", _jmidgetReturnCode); - fwprintf (stdout, formatBuf); - fflush (stdout); - } - } - - void InteropReturnInfo::AddExceptionString(String^ exceptionString) { - HasExceptions(); - pin_ptr<const wchar_t> wch = PtrToStringChars(exceptionString); - jstring ret = _env->NewString((const jchar*)wch, exceptionString->Length); - _env->CallObjectMethod(_jobjectInteropReturnInfo, _jmidAddExceptionString, ret); - HasExceptions(); - } - - Boolean InteropReturnInfo::HasExceptions() { - jobject obj = _env->CallObjectMethod(_jobjectInteropReturnInfo, _jmidHasExceptions); - return ((int)obj) != 0; - } - void InteropReturnInfo::SetReturnCode(int rc) { - _env->CallObjectMethod(_jobjectInteropReturnInfo, _jmidsetReturnCode, rc); - GetReturnCode(); - } - int InteropReturnInfo::GetReturnCode() { - jobject obj = _env->CallObjectMethod(_jobjectInteropReturnInfo, _jmidgetReturnCode); - return (int)obj; - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.h ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.h b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.h deleted file mode 100644 index 1278516..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#include "InteropUtil.h" -#include "org_apache_reef_javabridge_NativeInterop.h" -#include "JavaClrBridge.h" -#include "InteropAssemblies.h" -#using "clrhandler.dll" - -using namespace System; -using namespace System::IO; -using namespace System::Collections::Generic; -using namespace System::Runtime::InteropServices; -using namespace System::Reflection; -using namespace Microsoft::Reef::Interop; - -namespace Microsoft { - namespace Reef { - namespace Interop { - public ref class InteropReturnInfo : public IInteropReturnInfo { - JNIEnv* _env; - jobject _jobjectInteropReturnInfo; - - jmethodID _jmidAddExceptionString; - jmethodID _jmidHasExceptions; - jmethodID _jmidsetReturnCode; - jmethodID _jmidgetReturnCode; - - public: - InteropReturnInfo ( - JNIEnv* env, - jobject jobjectInteropReturnInfo, - ILogger^ logger - ); - virtual void AddExceptionString(String^ exceptionString); - virtual Boolean HasExceptions(); - virtual void SetReturnCode(int rc); - virtual int GetReturnCode(); - }; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.cpp ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.cpp b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.cpp deleted file mode 100644 index be24f32..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#include "InteropUtil.h" -#include "Clr2JavaImpl.h" - -using namespace System::Runtime::InteropServices; - -ref class ManagedLog { - internal: - static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>InteropUtil"); -}; - -const wchar_t* UnicodeCppStringFromJavaString ( - JNIEnv *env, - jstring javaString) { - const wchar_t* cppString = NULL; - if (NULL != javaString) { - cppString = (const wchar_t* )env->GetStringChars( javaString, 0); - } - return cppString; -} - -void ReleaseUnicodeCppString ( - JNIEnv* env, - jstring javaString, - jchar* cppString) { - if (NULL != cppString) { - env->ReleaseStringChars(javaString, (jchar *)cppString); - } -} - -String^ ManagedStringFromJavaString ( - JNIEnv *env, - jstring javaString) { - if (javaString != NULL) { - int len = env->GetStringLength(javaString); - const wchar_t* wcsStr = UnicodeCppStringFromJavaString (env, javaString); - String^ managedStr = (NULL == wcsStr || 0 == len) ? nullptr : Marshal::PtrToStringUni((IntPtr)(unsigned short*)wcsStr, len); - ReleaseUnicodeCppString (env, javaString, (jchar*)wcsStr); - return managedStr; - } - return nullptr; -} - -jstring JavaStringFromManagedString( - JNIEnv *env, - String^ managedString) { - pin_ptr<const wchar_t> wch = PtrToStringChars(managedString); - return env->NewString((const jchar*)wch, managedString->Length); -} - -void HandleClr2JavaError( - JNIEnv *env, - String^ errorMessage, - jobject javaObject) { - ManagedLog::LOGGER->LogStart("InteropUtil::HandleClr2JavaError"); - - jclass javaClass = env->GetObjectClass (javaObject); - jmethodID jmidOnError = env->GetMethodID(javaClass, "onError", "(Ljava/lang/String;)V"); - - if (jmidOnError == NULL) { - ManagedLog::LOGGER->Log("jmidOnError is NULL"); - return; - } - env -> CallObjectMethod( - javaObject, - jmidOnError, - JavaStringFromManagedString(env, errorMessage)); - ManagedLog::LOGGER->LogStop("InteropUtil::HandleClr2JavaError"); -} - -array<byte>^ ManagedByteArrayFromJavaByteArray( - JNIEnv *env, - jbyteArray javaByteArray) { - if (javaByteArray != NULL) { - byte* bytes = (byte*)env->GetByteArrayElements (javaByteArray, FALSE); - int len = env->GetArrayLength(javaByteArray); - array<byte>^ managedByteArray = gcnew array<byte>(len); - //System::Array - for (int i = 0; i < len; i++) { - managedByteArray[i] = bytes[i]; - } - return managedByteArray; - } - return nullptr; -} - -jbyteArray JavaByteArrayFromManagedByteArray( - JNIEnv *env, - array<byte>^ managedByteArray) { - jbyteArray javaByteArray = env->NewByteArray(managedByteArray->Length); - pin_ptr<Byte> p = &managedByteArray[0]; - env->SetByteArrayRegion(javaByteArray, 0, managedByteArray->Length, (jbyte*) p); - return javaByteArray; -} - -jlongArray JavaLongArrayFromManagedLongArray( - JNIEnv *env, - array<unsigned long long>^ managedLongArray) { - jlongArray javaLongArray = env->NewLongArray(managedLongArray->Length); - pin_ptr<unsigned long long> p = &managedLongArray[0]; - env->SetLongArrayRegion(javaLongArray, 0, managedLongArray->Length, (jlong*) p); - return javaLongArray; -} - -JNIEnv* RetrieveEnv(JavaVM* jvm) { - JNIEnv *env; - if (jvm->AttachCurrentThread((void **) &env, NULL) != 0) { - ManagedLog::LOGGER->Log("cannot attach jni env to current jvm thread."); - throw; - } - return env; -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.h ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.h b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.h deleted file mode 100644 index 2d95bcc..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#pragma once -#define _USING_V110_SDK71_ - -#pragma warning( push ) -#pragma warning( disable : 4793 ) -#include <jni.h> -#pragma warning( pop ) -#include "mscoree.h" -#include "vcclr.h" - -using namespace System; - -const wchar_t* UnicodeCppStringFromJavaString ( - JNIEnv *env, - jstring javaString); - -void ReleaseUnicodeCppString ( - JNIEnv* env, - jstring javaString, - jchar* cppString); - -String^ ManagedStringFromJavaString ( - JNIEnv *env, - jstring javaString); - -jstring JavaStringFromManagedString( - JNIEnv *env, - String^ managedString); - -array<byte>^ ManagedByteArrayFromJavaByteArray( - JNIEnv *env, - jbyteArray javaByteArray); - -jbyteArray JavaByteArrayFromManagedByteArray( - JNIEnv *env, - array<byte>^ managedByteArray); - -jlongArray JavaLongArrayFromManagedLongArray( - JNIEnv *env, - array<unsigned long long>^ managedLongArray); - -JNIEnv* RetrieveEnv(JavaVM* jvm); - -void HandleClr2JavaError( - JNIEnv *env, - String^ errorMessage, - jobject javaObject); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.cpp ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.cpp b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.cpp deleted file mode 100644 index b4b79f0..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.cpp +++ /dev/null @@ -1,492 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#include "InteropUtil.h" -#include "org_apache_reef_javabridge_NativeInterop.h" -#include "JavaClrBridge.h" -#include "InteropAssemblies.h" -#include "InteropReturnInfo.h" -#include "Clr2JavaImpl.h" -#include "InteropLogger.h" -#include "BinaryUtil.h" -#include "malloc.h" - -using namespace System; -using namespace System::IO; -using namespace System::Collections::Generic; -using namespace System::Runtime::InteropServices; -using namespace System::Reflection; -using namespace Org::Apache::Reef::Driver::Bridge; - -ref class ManagedLog { - internal: - static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>"); -}; - -static void MarshalErrorToJava ( - JNIEnv *env, - jobject jerrorInfo, - int errorNo, - String^ exceptionString -) { - jclass objectClass; - jfieldID fieldID; - - objectClass = env->GetObjectClass(jerrorInfo); - fieldID = env->GetFieldID(objectClass, "errorNo", "I"); - env->SetIntField (jerrorInfo, fieldID, errorNo); - - pin_ptr<const wchar_t> wchExceptionString = PtrToStringChars(exceptionString); - jstring jexceptionString = env->NewString((const jchar*)wchExceptionString, exceptionString->Length); - fieldID = env->GetFieldID(objectClass, "exceptionString", "Ljava/lang/String;"); - env->SetObjectField(jerrorInfo, fieldID, jexceptionString); -} - - -// Loading Clr Assembly. Note that we do not use ManagerLogger in this method since the -// logger assembly needs to be loaded by this method before it can be used. -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_loadClrAssembly -( - JNIEnv *env, - jclass tobj, - jstring jfileName) { - try { - Console::Write("+Java_org_apache_reef_javabridge_NativeInterop_loadClrAssembly: "); - const wchar_t* charAsmName = UnicodeCppStringFromJavaString (env, jfileName); - int len = env->GetStringLength(jfileName); - wchar_t* fileName = (wchar_t* )_alloca((len + 2) * sizeof(wchar_t)); - memcpy(fileName, charAsmName, (len + 2)* sizeof(wchar_t)); - fileName[len] = 0; - String^ asmName = ManagedStringFromJavaString(env, jfileName); - Console::WriteLine("loading " + asmName); - - BINARY_TYPE binaryType = IsManagedBinary(fileName); - if (binaryType == BINARY_TYPE_CLR) { - System::Reflection::Assembly^ asm1 = Assembly::LoadFrom(asmName); - AssemblyUtil::Add(asm1); - } - else if (binaryType == BINARY_TYPE_NATIVE) { - HANDLE handle = LoadLibraryW(fileName); - } - } - catch (System::Exception^ ex) { - // We do not propagate the exception back to Java to stop driver here - // since failure to load an assembly is not necesary devastating - Console::Write("Exceptions in Java_org_apache_reef_javabridge_NativeInterop_loadClrAssembly"); - Console::Write(ex->Message); - Console::Write(ex->StackTrace); - } - -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: CallClrSystemOnStartHandler - * Signature: (Ljava/lang/String;)V - */ -JNIEXPORT jlongArray JNICALL Java_org_apache_reef_javabridge_NativeInterop_CallClrSystemOnStartHandler -(JNIEnv * env, jclass jclassx, jstring dateTimeString, jstring httpServerPort) { - try { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_CallClrSystemOnStartHandler"); - const wchar_t* charConfig = UnicodeCppStringFromJavaString (env, dateTimeString); - int lenConfig = env->GetStringLength(dateTimeString); - String^ strConfig = Marshal::PtrToStringUni((IntPtr)(unsigned short*) charConfig, lenConfig); - DateTime dt = DateTime::Now; - - const wchar_t* charPort = UnicodeCppStringFromJavaString (env, httpServerPort); - int lenPort = env->GetStringLength(httpServerPort); - String^ strPort = Marshal::PtrToStringUni((IntPtr)(unsigned short*) charPort, lenPort); - - array<unsigned long long>^ handlers = ClrSystemHandlerWrapper::Call_ClrSystemStartHandler_OnStart(dt, strPort); - return JavaLongArrayFromManagedLongArray(env, handlers); - } - catch (System::Exception^ ex) { - // we cannot get error back to java here since we don't have an object to call back (although we idealy should...) - ManagedLog::LOGGER->LogError("Exceptions in Java_org_apache_reef_javabridge_NativeInterop_CallClrSystemOnStartHandler", ex); - return NULL; - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemAllocatedEvaluatorHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/AllocatedEvaluatorBridge;Lorg/apache/reef/javabridge/InteropLogger;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemAllocatedEvaluatorHandlerOnNext -(JNIEnv *env, jclass cls, jlong handle, jobject jallocatedEvaluatorBridge, jobject jlogger) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemAllocatedEvaluatorHandlerOnNext:"); - AllocatedEvaluatorClr2Java^ allocatedEval = gcnew AllocatedEvaluatorClr2Java(env, jallocatedEvaluatorBridge); - try { - ClrSystemHandlerWrapper::Call_ClrSystemAllocatedEvaluatorHandler_OnNext(handle, allocatedEval); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemAllocatedEvaluatorHandler_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - allocatedEval -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemActiveContextHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/ActiveContextBridge;Lorg/apache/reef/javabridge/InteropLogger;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemActiveContextHandlerOnNext -(JNIEnv *env, jclass cls, jlong handle, jobject jactiveContextBridge, jobject jlogger) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemActiveContextHandlerOnNext"); - ActiveContextClr2Java^ activeContextBrdige = gcnew ActiveContextClr2Java(env, jactiveContextBridge); - try { - ClrSystemHandlerWrapper::Call_ClrSystemActiveContextHandler_OnNext(handle, activeContextBrdige); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemActiveContextHandler_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - activeContextBrdige -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemEvaluatorRequstorHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/EvaluatorRequstorBridge;Lorg/apache/reef/javabridge/InteropLogger;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemEvaluatorRequstorHandlerOnNext -(JNIEnv *env, jclass cls, jlong handle, jobject jevaluatorRequestorBridge, jobject jlogger) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemEvaluatorRequstorHandlerOnNext"); - EvaluatorRequestorClr2Java^ evaluatorRequestorBridge = gcnew EvaluatorRequestorClr2Java(env, jevaluatorRequestorBridge); - try { - ClrSystemHandlerWrapper::Call_ClrSystemEvaluatorRequestor_OnNext(handle, evaluatorRequestorBridge); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemEvaluatorRequestor_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - evaluatorRequestorBridge -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemTaskMessageHandlerOnNext - * Signature: (J[BLorg/apache/reef/javabridge/TaskMessageBridge;Lorg/apache/reef/javabridge/InteropLogger;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemTaskMessageHandlerOnNext -(JNIEnv *env, jclass cls, jlong handle, jbyteArray jmessage, jobject jtaskMessageBridge, jobject jlogger) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemTaskMessageHandlerOnNext"); - TaskMessageClr2Java^ taskMesageBridge = gcnew TaskMessageClr2Java(env, jtaskMessageBridge); - array<byte>^ message = ManagedByteArrayFromJavaByteArray(env, jmessage); - try { - ClrSystemHandlerWrapper::Call_ClrSystemTaskMessage_OnNext(handle, taskMesageBridge, message); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemTaskMessage_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - taskMesageBridge -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSysteFailedTaskHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/FailedTaskBridge;Lorg/apache/reef/javabridge/InteropLogger;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemFailedTaskHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler, jobject jfailedTask, jobject jlogger) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemFailedTaskHandlerOnNext"); - FailedTaskClr2Java^ failedTaskBridge = gcnew FailedTaskClr2Java(env, jfailedTask); - try { - ClrSystemHandlerWrapper::Call_ClrSystemFailedTask_OnNext(handler, failedTaskBridge); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemTaskMessage_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - failedTaskBridge -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSysteFailedTaskHandlerOnNext - * Signature: (JLorg.apache.reef.javabridge/FailedTaskBridge;Lorg.apache.reef.javabridge/InteropLogger;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemRunningTaskHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler, jobject jrunningTask, jobject jlogger) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemRunningTaskHandlerOnNext"); - RunningTaskClr2Java^ runningTaskBridge = gcnew RunningTaskClr2Java(env, jrunningTask); - try { - ClrSystemHandlerWrapper::Call_ClrSystemRunningTask_OnNext(handler, runningTaskBridge); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemRunningTask_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - runningTaskBridge -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemFailedEvaluatorHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/FailedEvaluatorBridge;Lorg/apache/reef/javabridge/InteropLogger;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemFailedEvaluatorHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler, jobject jfailedEvaluator, jobject jlogger) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemFailedEvaluatorHandlerOnNext"); - FailedEvaluatorClr2Java^ failedEvaluatorBridge = gcnew FailedEvaluatorClr2Java(env, jfailedEvaluator); - try { - ClrSystemHandlerWrapper::Call_ClrSystemFailedEvaluator_OnNext(handler, failedEvaluatorBridge); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemFailedEvaluator_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - failedEvaluatorBridge -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemHttpServerEventHandlerOnHttpRequest - * Signature: (JLorg/apache/reef/javabridge/HttpServerEventBridge;Lorg/apache/reef/javabridge/InteropLogger;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemHttpServerHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler, jobject jhttpServerEventBridge, jobject jlogger) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemHttpServerHandlerOnNext"); - HttpServerClr2Java^ httpServerClr2Java = gcnew HttpServerClr2Java(env, jhttpServerEventBridge); - try { - ClrSystemHandlerWrapper::Call_ClrSystemHttpServer_OnNext(handler, httpServerClr2Java); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemHttpServer_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - httpServerClr2Java -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemCompletedTaskHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/CompletedTaskBridge;Lorg/apache/reef/javabridge/InteropLogger;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemCompletedTaskHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler, jobject jcompletedTask, jobject jlogger) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemCompletedTaskHandlerOnNext"); - CompletedTaskClr2Java^ completedTaskBridge = gcnew CompletedTaskClr2Java(env, jcompletedTask); - try { - ClrSystemHandlerWrapper::Call_ClrSystemCompletedTask_OnNext(handler, completedTaskBridge); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemCompletedTask_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - completedTaskBridge -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrBufferedLog - * Signature: (ILjava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrBufferedLog -(JNIEnv *env, jclass cls, jint logLevel, jstring message) { - try { - if (!JavaClrBridge::LoggerWrapper::initialized) { - ManagedLog::LOGGER->Log("Initializing CLRBufferedLogHandler in java bridge..."); - JavaClrBridge::LoggerWrapper::logger->Listeners->Add(gcnew System::Diagnostics::ConsoleTraceListener()); - JavaClrBridge::LoggerWrapper::initialized = true; - } - - System::Diagnostics::TraceEventType eventType; - switch (logLevel) { - case 0: - eventType = System::Diagnostics::TraceEventType::Stop; - break; - case 1: - eventType = System::Diagnostics::TraceEventType::Error; - break; - case 2: - eventType = System::Diagnostics::TraceEventType::Warning; - break; - case 3: - eventType = System::Diagnostics::TraceEventType::Information; - break; - case 4: - eventType = System::Diagnostics::TraceEventType::Verbose; - break; - default: - eventType = System::Diagnostics::TraceEventType::Information; - break; - - } - - String^ msg = ManagedStringFromJavaString(env, message); - msg = System::String::Concat(System::DateTime::Now, msg); - JavaClrBridge::LoggerWrapper::logger->TraceEvent(eventType, 0, msg); - } - catch (System::Exception^ ex) { - ManagedLog::LOGGER->LogError("Exception in Java_javabridge_NativeInterop_ClrBufferedLog", ex); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemSupendedTaskHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/SuspendedTaskBridge;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemSupendedTaskHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler, jobject jsuspendedTask) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemSupendedTaskHandlerOnNext"); - SuspendedTaskClr2Java^ suspendedTaskBridge = gcnew SuspendedTaskClr2Java(env, jsuspendedTask); - try { - ClrSystemHandlerWrapper::Call_ClrSystemSuspendedTask_OnNext(handler, suspendedTaskBridge); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemSuspendedTask_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - suspendedTaskBridge -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemCompletdEvaluatorHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/CompletedEvaluatorBridge;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemCompletdEvaluatorHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler, jobject jcompletedEvaluator) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemCompletdEvaluatorHandlerOnNext"); - CompletedEvaluatorClr2Java^ completedEvaluatorBridge = gcnew CompletedEvaluatorClr2Java(env, jcompletedEvaluator); - try { - ClrSystemHandlerWrapper::Call_ClrSystemCompletedEvaluator_OnNext(handler, completedEvaluatorBridge); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemSuspendedTask_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - completedEvaluatorBridge -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemClosedContextHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/ClosedContextBridge;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemClosedContextHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler, jobject jclosedContext) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemClosedContextHandlerOnNext"); - ClosedContextClr2Java^ closedContextBridge = gcnew ClosedContextClr2Java(env, jclosedContext); - try { - ClrSystemHandlerWrapper::Call_ClrSystemClosedContext_OnNext(handler, closedContextBridge); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemClosedContext_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - closedContextBridge -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemFailedContextHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/FailedContextBridge;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemFailedContextHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler, jobject jfailedContext) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemFailedContextHandlerOnNext"); - FailedContextClr2Java^ failedContextBridge = gcnew FailedContextClr2Java(env, jfailedContext); - try { - ClrSystemHandlerWrapper::Call_ClrSystemFailedContext_OnNext(handler, failedContextBridge); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemFailedContext_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - failedContextBridge -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemContextMessageHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/ContextMessageBridge;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemContextMessageHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler, jobject jcontextMessage) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemContextMessageHandlerOnNext"); - ContextMessageClr2Java^ contextMessageBridge = gcnew ContextMessageClr2Java(env, jcontextMessage); - try { - ClrSystemHandlerWrapper::Call_ClrSystemContextMessage_OnNext(handler, contextMessageBridge); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemContextMessage_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - contextMessageBridge -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemDriverRestartHandlerOnNext - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemDriverRestartHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemDriverRestartHandlerOnNext"); - try { - ClrSystemHandlerWrapper::Call_ClrSystemDriverRestart_OnNext(handler); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemContextMessage_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - // we do not call back to Java for exception in .NET restart handler - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemDriverRestartActiveContextHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/ActiveContextBridge;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemDriverRestartActiveContextHandlerOnNext -(JNIEnv *env, jclass cls, jlong handle, jobject jactiveContextBridge) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemDriverRestartActiveContextHandlerOnNext"); - ActiveContextClr2Java^ activeContextBrdige = gcnew ActiveContextClr2Java(env, jactiveContextBridge); - try { - ClrSystemHandlerWrapper::Call_ClrSystemDriverRestartActiveContextHandler_OnNext(handle, activeContextBrdige); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemDriverRestartActiveContextHandler_OnNext"; - ManagedLog::LOGGER -> LogError(errorMessage, ex); - activeContextBrdige -> OnError(errorMessage); - } -} - -/* - * Class: org_apache_reef_javabridge_NativeInterop - * Method: ClrSystemDriverRestartRunningTaskHandlerOnNext - * Signature: (JLorg/apache/reef/javabridge/RunningTaskBridge;)V - */ -JNIEXPORT void JNICALL Java_org_apache_reef_javabridge_NativeInterop_ClrSystemDriverRestartRunningTaskHandlerOnNext -(JNIEnv *env , jclass cls, jlong handler, jobject jrunningTask) { - ManagedLog::LOGGER->Log("+Java_org_apache_reef_javabridge_NativeInterop_ClrSystemDriverRestartRunningTaskHandlerOnNext"); - RunningTaskClr2Java^ runningTaskBridge = gcnew RunningTaskClr2Java(env, jrunningTask); - try { - ClrSystemHandlerWrapper::Call_ClrSystemDriverRestartRunningTask_OnNext(handler, runningTaskBridge); - } - catch (System::Exception^ ex) { - String^ errorMessage = "Exception in Call_ClrSystemDriverRestartRunningTask_OnNext"; - ManagedLog::LOGGER->LogError(errorMessage, ex); - runningTaskBridge -> OnError(errorMessage); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.h ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.h b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.h deleted file mode 100644 index 61d9d0a..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -// JavaClrBridge.h - -#pragma once - -using namespace System; - -namespace JavaClrBridge { - ref class LoggerWrapper - { - public: - static System::Diagnostics::TraceSource^ logger = - gcnew System::Diagnostics::TraceSource("JavaCLRBridgeLogger", System::Diagnostics::SourceLevels::All); - static bool initialized = false; - }; -} http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.sln ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.sln b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.sln deleted file mode 100644 index d4b2aec..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.sln +++ /dev/null @@ -1,56 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JavaClrBridge", "JavaClrBridge.vcxproj", "{2825FD53-350B-4294-8CFC-8DD2F4F4F285}" - ProjectSection(ProjectDependencies) = postProject - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD} = {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClrHandler", "..\..\..\CSharp\CSharp\ClrHandler\ClrHandler.csproj", "{443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Debug|Mixed Platforms.ActiveCfg = Release|x64 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Debug|Mixed Platforms.Build.0 = Release|x64 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Debug|Mixed Platforms.Deploy.0 = Release|x64 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Debug|Win32.ActiveCfg = Debug|Win32 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Debug|Win32.Build.0 = Debug|Win32 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Debug|x64.ActiveCfg = Debug|x64 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Debug|x64.Build.0 = Debug|x64 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Release|Any CPU.ActiveCfg = Release|Win32 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Release|Mixed Platforms.ActiveCfg = Release|x64 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Release|Mixed Platforms.Build.0 = Release|x64 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Release|Win32.ActiveCfg = Release|Win32 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Release|Win32.Build.0 = Release|Win32 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Release|x64.ActiveCfg = Release|x64 - {2825FD53-350B-4294-8CFC-8DD2F4F4F285}.Release|x64.Build.0 = Release|x64 - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Debug|Win32.ActiveCfg = Debug|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Debug|x64.ActiveCfg = Debug|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Debug|x64.Build.0 = Debug|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Release|Any CPU.Build.0 = Release|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Release|Win32.ActiveCfg = Release|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Release|x64.ActiveCfg = Release|Any CPU - {443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}.Release|x64.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj deleted file mode 100644 index 08412d1..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj +++ /dev/null @@ -1,173 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup Condition="'$(Configuration)'==''"> - <Configuration>Release</Configuration> - </PropertyGroup> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="DefaultDirectories"> - <JAVA_HOME Condition=" '$(JAVA_HOME)' == '' ">c:\progra~1\java\jdk1.7.0_40</JAVA_HOME> - </PropertyGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{2825FD53-350B-4294-8CFC-8DD2F4F4F285}</ProjectGuid> - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <Keyword>ManagedCProj</Keyword> - <RootNamespace>Microsoft.Reef.Interop</RootNamespace> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v110</PlatformToolset> - <CLRSupport>true</CLRSupport> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v110</PlatformToolset> - <CLRSupport>true</CLRSupport> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v110</PlatformToolset> - <CLRSupport>true</CLRSupport> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v110</PlatformToolset> - <CLRSupport>true</CLRSupport> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <LinkIncremental>true</LinkIncremental> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <LinkIncremental>true</LinkIncremental> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <LinkIncremental>false</LinkIncremental> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <LinkIncremental>false</LinkIncremental> - </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <AdditionalUsingDirectories>..\..\..\..\..\target\classes</AdditionalUsingDirectories> - <AdditionalIncludeDirectories>..\..\..\..\..\..\reef-bridge-java\target\classes;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32</AdditionalIncludeDirectories> - </ClCompile> - <Link> - <GenerateDebugInformation>false</GenerateDebugInformation> - <OutputFile>..\..\..\..\..\target\classes\$(TargetName)$(TargetExt)</OutputFile> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PrecompiledHeader>Use</PrecompiledHeader> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - </ClCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PrecompiledHeader>NotUsing</PrecompiledHeader> - </ClCompile> - </ItemDefinitionGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="System.Data" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="BinaryUtil.h" /> - <ClInclude Include="Clr2JavaImpl.h" /> - <ClInclude Include="InteropAssemblies.h" /> - <ClInclude Include="InteropLogger.h" /> - <ClInclude Include="InteropReturnInfo.h" /> - <ClInclude Include="InteropUtil.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="ActiveContextClr2Java.cpp" /> - <ClCompile Include="AllocatedEvaluatorClr2Java.cpp" /> - <ClCompile Include="AssemblyInfo.cpp" /> - <ClCompile Include="AssemblyUtil.cpp" /> - <ClCompile Include="BinaryUtil.cpp" /> - <ClCompile Include="ClosedContextClr2Java.cpp" /> - <ClCompile Include="CommonUtilities.cpp" /> - <ClCompile Include="CompletedEvaluatorClr2Java.cpp" /> - <ClCompile Include="CompletedTaskClr2Java.cpp" /> - <ClCompile Include="ContextMessageClr2Java.cpp" /> - <ClCompile Include="EvaluatorRequestorClr2Java.cpp" /> - <ClCompile Include="FailedContextClr2Java.cpp" /> - <ClCompile Include="FailedEvaluatorClr2Java.cpp" /> - <ClCompile Include="FailedTaskClr2Java.cpp" /> - <ClCompile Include="HttpServerClr2Java.cpp" /> - <ClCompile Include="InteropLogger.cpp" /> - <ClCompile Include="InteropReturnInfo.cpp" /> - <ClCompile Include="InteropUtil.cpp" /> - <ClCompile Include="JavaClrBridge.cpp" /> - <ClCompile Include="RunningTaskClr2Java.cpp" /> - <ClCompile Include="SuspendedTaskClr2Java.cpp" /> - <ClCompile Include="TaskMessageClr2Java.cpp" /> - </ItemGroup> - <ItemGroup> - <Text Include="ReadMe.txt" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj.filters ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj.filters b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj.filters deleted file mode 100644 index 5421846..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj.filters +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="InteropUtil.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="InteropAssemblies.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="InteropReturnInfo.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="InteropLogger.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="Clr2JavaImpl.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="BinaryUtil.h"> - <Filter>Header Files</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="JavaClrBridge.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="AssemblyInfo.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="InteropUtil.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="AssemblyUtil.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="InteropReturnInfo.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="InteropLogger.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="AllocatedEvaluatorClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="ActiveContextClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="EvaluatorRequestorClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="TaskMessageClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="BinaryUtil.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="FailedTaskClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="FailedEvaluatorClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="HttpServerClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="CompletedTaskClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="RunningTaskClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="SuspendedTaskClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="CompletedEvaluatorClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="ClosedContextClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="CommonUtilities.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="FailedContextClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="ContextMessageClr2Java.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <Text Include="ReadMe.txt" /> - </ItemGroup> -</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ManagedLogger.cpp ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ManagedLogger.cpp b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ManagedLogger.cpp deleted file mode 100644 index 62e30b3..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ManagedLogger.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#include "Clr2JavaImpl.h" - -using namespace JavaClrBridge; - -namespace Microsoft -{ - namespace Reef - { - namespace Driver - { - namespace Bridge - { - ManagedLogger::ManagedLogger(String^ className) - { - _logger = BridgeLogger::GetLogger(className); - } - BridgeLogger^ ManagedLogger::GetLogger(String^ className) - { - if(_logger == nullptr) - { - _logger = BridgeLogger::GetLogger(className); - } - return _logger; - } - - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ReadMe.txt ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ReadMe.txt b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ReadMe.txt deleted file mode 100644 index 4e1b52f..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ReadMe.txt +++ /dev/null @@ -1,57 +0,0 @@ -==== - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -==== - -======================================================================== - DYNAMIC LINK LIBRARY : JavaClrBridge Project Overview -======================================================================== - -AppWizard has created this JavaClrBridge DLL for you. - -This file contains a summary of what you will find in each of the files that -make up your JavaClrBridge application. - -JavaClrBridge.vcxproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -JavaClrBridge.vcxproj.filters - This is the filters file for VC++ projects generated using an Application Wizard. - It contains information about the association between the files in your project - and the filters. This association is used in the IDE to show grouping of files with - similar extensions under a specific node (for e.g. ".cpp" files are associated with the - "Source Files" filter). - -JavaClrBridge.cpp - This is the main DLL source file. - -JavaClrBridge.h - This file contains a class declaration. - -AssemblyInfo.cpp - Contains custom attributes for modifying assembly metadata. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/RunningTaskClr2Java.cpp ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/RunningTaskClr2Java.cpp b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/RunningTaskClr2Java.cpp deleted file mode 100644 index 8ca1e65..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/RunningTaskClr2Java.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#include "Clr2JavaImpl.h" - -namespace Org { - namespace Apache { - namespace Reef { - namespace Driver { - namespace Bridge { - ref class ManagedLog { - internal: - static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>"); - }; - RunningTaskClr2Java::RunningTaskClr2Java(JNIEnv *env, jobject jobjectRunningTask) { - ManagedLog::LOGGER->LogStart("RunningTaskClr2Java::RunningTaskClr2Java"); - - pin_ptr<JavaVM*> pJavaVm = &_jvm; - if (env->GetJavaVM(pJavaVm) != 0) { - ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr); - } - _jobjectRunningTask = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectRunningTask)); - - jclass jclassRunningTask = env->GetObjectClass (_jobjectRunningTask); - jmethodID jmidGetId = env->GetMethodID(jclassRunningTask, "getId", "()Ljava/lang/String;"); - - _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env -> CallObjectMethod(_jobjectRunningTask, jmidGetId))); - ManagedLog::LOGGER->LogStop("RunningTaskClr2Java::RunningTaskClr2Java"); - } - - IActiveContextClr2Java^ RunningTaskClr2Java::GetActiveContext() { - ManagedLog::LOGGER->LogStart("RunningTaskClr2Java::GetActiveContext"); - - JNIEnv *env = RetrieveEnv(_jvm); - - jclass jclassRunningTask = env->GetObjectClass(_jobjectRunningTask); - jfieldID jidActiveContext = env->GetFieldID(jclassRunningTask, "jactiveContext", "Lorg/apache/reef/javabridge/ActiveContextBridge;"); - jobject jobjectActiveContext = env->GetObjectField(_jobjectRunningTask, jidActiveContext); - ManagedLog::LOGGER->LogStop("RunningTaskClr2Java::GetActiveContext"); - - return gcnew ActiveContextClr2Java(env, jobjectActiveContext); - } - - String^ RunningTaskClr2Java::GetId() { - ManagedLog::LOGGER->Log("RunningTaskClr2Java::GetId"); - JNIEnv *env = RetrieveEnv(_jvm); - return ManagedStringFromJavaString(env, _jstringId); - } - - void RunningTaskClr2Java::Send(array<byte>^ message) { - ManagedLog::LOGGER->LogStart("RunningTaskClr2Java::Send"); - JNIEnv *env = RetrieveEnv(_jvm); - jclass jclassRunningTask = env->GetObjectClass(_jobjectRunningTask); - jmethodID jmidSend = env->GetMethodID(jclassRunningTask, "send", "([B)V"); - - - if (jmidSend == NULL) { - ManagedLog::LOGGER->Log("jmidSend is NULL"); - return; - } - env->CallObjectMethod( - _jobjectRunningTask, - jmidSend, - JavaByteArrayFromManagedByteArray(env, message)); - ManagedLog::LOGGER->LogStop("RunningTaskClr2Java::Send"); - } - - void RunningTaskClr2Java::OnError(String^ message) { - ManagedLog::LOGGER->Log("RunningTaskClr2Java::OnError"); - JNIEnv *env = RetrieveEnv(_jvm); - HandleClr2JavaError(env, message, _jobjectRunningTask); - } - } - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/SuspendedTaskClr2Java.cpp ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/SuspendedTaskClr2Java.cpp b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/SuspendedTaskClr2Java.cpp deleted file mode 100644 index a10f88e..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/SuspendedTaskClr2Java.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#include "Clr2JavaImpl.h" - -namespace Org { - namespace Apache { - namespace Reef { - namespace Driver { - namespace Bridge { - ref class ManagedLog { - internal: - static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>"); - }; - - SuspendedTaskClr2Java::SuspendedTaskClr2Java(JNIEnv *env, jobject jobjectSuspendedTask) { - ManagedLog::LOGGER->LogStart("SuspendedTaskClr2Java::SuspendedTaskClr2Java"); - pin_ptr<JavaVM*> pJavaVm = &_jvm; - if (env->GetJavaVM(pJavaVm) != 0) { - ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr); - } - _jobjectSuspendedTask = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectSuspendedTask)); - - jclass jclassSuspendedTask = env->GetObjectClass (_jobjectSuspendedTask); - jfieldID jidTaskId = env->GetFieldID(jclassSuspendedTask, "taskId", "Ljava/lang/String;"); - _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectSuspendedTask, jidTaskId))); - ManagedLog::LOGGER->LogStop("SuspendedTaskClr2Java::SuspendedTaskClr2Java"); - } - - IActiveContextClr2Java^ SuspendedTaskClr2Java::GetActiveContext() { - ManagedLog::LOGGER->LogStart("SuspendedTaskClr2Java::GetActiveContext"); - JNIEnv *env = RetrieveEnv(_jvm); - - jclass jclassSuspendedTask = env->GetObjectClass (_jobjectSuspendedTask); - jfieldID jidActiveContext = env->GetFieldID(jclassSuspendedTask, "jactiveContext", "Lorg/apache/reef/javabridge/ActiveContextBridge;"); - jobject jobjectActiveContext = env->GetObjectField(_jobjectSuspendedTask, jidActiveContext); - ManagedLog::LOGGER->LogStop("SuspendedTaskClr2Java::GetActiveContext"); - return gcnew ActiveContextClr2Java(env, jobjectActiveContext); - } - - String^ SuspendedTaskClr2Java::GetId() { - ManagedLog::LOGGER->Log("SuspendedTaskClr2Java::GetId"); - JNIEnv *env = RetrieveEnv(_jvm); - return ManagedStringFromJavaString(env, _jstringId); - } - - array<byte>^ SuspendedTaskClr2Java::Get() { - ManagedLog::LOGGER->Log("SuspendedTaskClr2Java::Get"); - JNIEnv *env = RetrieveEnv(_jvm); - jclass jclassSuspendedTask = env->GetObjectClass (_jobjectSuspendedTask); - jmethodID jmidGet = env->GetMethodID(jclassSuspendedTask, "get", "()[B"); - - if (jmidGet == NULL) { - ManagedLog::LOGGER->Log("jmidGet is NULL"); - return nullptr; - } - jbyteArray jMessage = (jbyteArray) env->CallObjectMethod(_jobjectSuspendedTask, jmidGet); - return ManagedByteArrayFromJavaByteArray(env, jMessage); - } - - void SuspendedTaskClr2Java::OnError(String^ message) { - ManagedLog::LOGGER->Log("SuspendedTaskClr2Java::OnError"); - JNIEnv *env = RetrieveEnv(_jvm); - HandleClr2JavaError(env, message, _jobjectSuspendedTask); - } - } - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/TaskMessageClr2Java.cpp ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/TaskMessageClr2Java.cpp b/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/TaskMessageClr2Java.cpp deleted file mode 100644 index d2f8286..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/TaskMessageClr2Java.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -#include "Clr2JavaImpl.h" - -namespace Org { - namespace Apache { - namespace Reef { - namespace Driver { - namespace Bridge { - ref class ManagedLog { - internal: - static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>"); - }; - - TaskMessageClr2Java::TaskMessageClr2Java(JNIEnv *env, jobject jtaskMessage) { - ManagedLog::LOGGER->LogStart("TaskMessageClr2Java::TaskMessageClr2Java"); - pin_ptr<JavaVM*> pJavaVm = &_jvm; - if (env->GetJavaVM(pJavaVm) != 0) { - ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr); - } - _jobjectTaskMessage = reinterpret_cast<jobject>(env->NewGlobalRef(jtaskMessage)); - - jclass jclassTaskMessage = env->GetObjectClass (_jobjectTaskMessage); - jfieldID jidTaskId = env->GetFieldID(jclassTaskMessage, "taskId", "Ljava/lang/String;"); - _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectTaskMessage, jidTaskId))); - ManagedLog::LOGGER->LogStop("TaskMessageClr2Java::TaskMessageClr2Java"); - } - - void TaskMessageClr2Java::OnError(String^ message) { - ManagedLog::LOGGER->Log("TaskMessageClr2Java::OnError"); - JNIEnv *env = RetrieveEnv(_jvm); - HandleClr2JavaError(env, message, _jobjectTaskMessage); - } - - String^ TaskMessageClr2Java::GetId() { - ManagedLog::LOGGER->Log("TaskMessageClr2Java::GetId"); - JNIEnv *env = RetrieveEnv(_jvm); - return ManagedStringFromJavaString(env, _jstringId); - } - } - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/22f651f8/lang/java/reef-bridge-project/reef-bridge-java/pom.xml ---------------------------------------------------------------------- diff --git a/lang/java/reef-bridge-project/reef-bridge-java/pom.xml b/lang/java/reef-bridge-project/reef-bridge-java/pom.xml deleted file mode 100644 index c383190..0000000 --- a/lang/java/reef-bridge-project/reef-bridge-java/pom.xml +++ /dev/null @@ -1,116 +0,0 @@ -<?xml version="1.0"?> -<!-- -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. ---> -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>reef-bridge-java</artifactId> - <name>REEF Bridge Java</name> - <description>Bridge between JVM and CLR.</description> - - - <parent> - <groupId>org.apache.reef</groupId> - <artifactId>reef-bridge-project</artifactId> - <version>0.11.0-incubating-SNAPSHOT</version> - </parent> - - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>reef-common</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>reef-runtime-local</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>reef-runtime-yarn</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>reef-io</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>reef-checkpoint</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>reef-webserver</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.avro</groupId> - <artifactId>avro</artifactId> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <addClasspath>false</addClasspath> - <classpathPrefix>lib/</classpathPrefix> - <mainClass>org.apache.reef.javabridge.JavaBridge</mainClass> - </manifest> - </archive> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <execution> - <phase>process-classes</phase> - <goals> - <goal>run</goal> - </goals> - <configuration> - <exportAntProperties>true</exportAntProperties> - <target> - <property name="runtime_classpath" refid="maven.compile.classpath"/> - <exec executable="javah"> - <arg value="-cp"/> - <arg value="${runtime_classpath}"/> - <arg value="-d"/> - <arg value="${project.build.directory}/classes"/> - <arg value="org.apache.reef.javabridge.NativeInterop"/> - </exec> - </target> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - </plugin> - </plugins> - </build> -</project>
