You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by we...@apache.org on 2015/03/20 01:32:26 UTC
[1/5] incubator-reef git commit: [REEF-194] Merge the bridge into a
single DLL
Repository: incubator-reef
Updated Branches:
refs/heads/master 722d8c43c -> 492da34a0
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs
index 58922fe..3ef579b 100644
--- a/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs
+++ b/lang/cs/Org.Apache.REEF.Tests/Functional/Bridge/TestBridgeClient.cs
@@ -73,7 +73,7 @@ namespace Org.Apache.REEF.Tests.Functional.Bridge
arguments.Add(runOnYarn.ToString());
arguments.Add(Constants.BridgeLaunchClass);
arguments.Add(".");
- arguments.Add(Path.Combine(_binFolder, Constants.BridgeJarFileName));
+ arguments.Add(Path.Combine(_binFolder, Constants.JavaBridgeJarFileName));
arguments.Add(Path.Combine(_binFolder, _cmdFile));
ProcessStartInfo startInfo = new ProcessStartInfo()
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Tests/Functional/ReefFunctionalTest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tests/Functional/ReefFunctionalTest.cs b/lang/cs/Org.Apache.REEF.Tests/Functional/ReefFunctionalTest.cs
index 582ad26..0654800 100644
--- a/lang/cs/Org.Apache.REEF.Tests/Functional/ReefFunctionalTest.cs
+++ b/lang/cs/Org.Apache.REEF.Tests/Functional/ReefFunctionalTest.cs
@@ -51,7 +51,7 @@ namespace Org.Apache.REEF.Tests.Functional
private bool _onLocalRuntime = false;
private readonly string _className = Constants.BridgeLaunchClass;
private readonly string _clrFolder = ".";
- private readonly string _reefJar = Path.Combine(_binFolder, Constants.BridgeJarFileName);
+ private readonly string _reefJar = Path.Combine(_binFolder, Constants.JavaBridgeJarFileName);
private readonly string _runCommand = Path.Combine(_binFolder, _cmdFile);
// TODO: once things stablize, we would like to toggle this to be false and only enable when needed for debugging test failures.
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj b/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj
index b697953..6301c29 100644
--- a/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj
+++ b/lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj
@@ -126,9 +126,13 @@ under the License.
<Project>{1b983182-9c30-464c-948d-f87eb93a8240}</Project>
<Name>Org.Apache.REEF.Evaluator</Name>
</ProjectReference>
+ <ProjectReference Include="..\Org.Apache.REEF.Bridge\Org.Apache.REEF.Bridge.vcxproj">
+ <Project>{4e69d40a-26d6-4d4a-b96d-729946c07fe1}</Project>
+ <Name>Org.Apache.REEF.Bridge</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
- <Content Include="bin\reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar">
+ <Content Include="bin\reef-bridge-java-0.11.0-incubating-SNAPSHOT-shaded.jar">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Tests/bin/reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tests/bin/reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar b/lang/cs/Org.Apache.REEF.Tests/bin/reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar
deleted file mode 100644
index c4a6fc7..0000000
Binary files a/lang/cs/Org.Apache.REEF.Tests/bin/reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Tests/bin/reef-bridge-java-0.11.0-incubating-SNAPSHOT-shaded.jar
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tests/bin/reef-bridge-java-0.11.0-incubating-SNAPSHOT-shaded.jar b/lang/cs/Org.Apache.REEF.Tests/bin/reef-bridge-java-0.11.0-incubating-SNAPSHOT-shaded.jar
new file mode 100644
index 0000000..24e8b02
Binary files /dev/null and b/lang/cs/Org.Apache.REEF.Tests/bin/reef-bridge-java-0.11.0-incubating-SNAPSHOT-shaded.jar differ
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.sln
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.sln b/lang/cs/Org.Apache.REEF.sln
index 40ac1ca..981b3ad 100644
Binary files a/lang/cs/Org.Apache.REEF.sln and b/lang/cs/Org.Apache.REEF.sln differ
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/build.props
----------------------------------------------------------------------
diff --git a/lang/cs/build.props b/lang/cs/build.props
index 29b04fe..c7fc616 100644
--- a/lang/cs/build.props
+++ b/lang/cs/build.props
@@ -23,17 +23,6 @@ under the License.
</PropertyGroup>
<!-- Common build configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>AnyCPU</PlatformTarget>
- </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
@@ -45,18 +34,6 @@ under the License.
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <BuildPackage>true</BuildPackage>
- <SignAssembly>true</SignAssembly>
- <AssemblyOriginatorKeyFile>$(SolutionDir)\keyfile.snk</AssemblyOriginatorKeyFile>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<BuildPackage>true</BuildPackage>
<SignAssembly>true</SignAssembly>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/pom.xml
----------------------------------------------------------------------
diff --git a/lang/cs/pom.xml b/lang/cs/pom.xml
index 9faa604..64896a8 100644
--- a/lang/cs/pom.xml
+++ b/lang/cs/pom.xml
@@ -29,6 +29,13 @@ under the License.
<version>0.11.0-incubating-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>reef-bridge-java</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
<profiles>
<profile>
<id>DotNet</id>
@@ -76,26 +83,6 @@ under the License.
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <id>copy-driver-files</id>
- <phase>compile</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target name="copy driver dll file to class cpp project">
- <copy file="${project.basedir}/bin/x64/Release/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.dll" tofile="${basedir}\target\classes\Org.Apache.REEF.Driver.dll" />
- <copy file="${project.basedir}/bin/x64/Release/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.dll" tofile="../cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/externals/Org.Apache.REEF.Driver.dll" />
- </target>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
</profile>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/LibLoader.java
----------------------------------------------------------------------
diff --git a/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/LibLoader.java b/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/LibLoader.java
index 8f4132a..5789eed 100644
--- a/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/LibLoader.java
+++ b/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/LibLoader.java
@@ -59,10 +59,7 @@ public class LibLoader {
try (final LoggingScope lb = loggingScopeFactory.loadLib()) {
// Load the native library connecting C# and Java
- this.loadMixedDLL();
-
- // Load the CLR side
- this.loadCLRBridgeDLL();
+ this.loadBridgeDLL();
// Load all DLLs in local
this.loadAllManagedDLLs(this.reefFileNames.getLocalFolder());
@@ -73,43 +70,66 @@ public class LibLoader {
LOG.log(Level.INFO, "Done loading DLLs for Driver at time {0}." + new Date().toString());
}
- private void loadMixedDLL() throws IOException {
+ /**
+ * Loads the Bridge DLL. First, it attempts to load from the reef/local folder. Second attempt is reef/global, last
+ * attempt is loading it from the JAR.
+ *
+ * @throws IOException If all attempts fail.
+ */
+ private void loadBridgeDLL() throws IOException {
try {
- final String JavaClrBridgeDll = this.reefFileNames.getMixedDLLFile().getAbsolutePath();
- LOG.log(Level.INFO, "loadMixedDLL() -JavaClrBridge Dll: {0}.", JavaClrBridgeDll);
- System.load(JavaClrBridgeDll);
- } catch (final Throwable e) {
- LOG.log(Level.WARNING, "loadMixedDLL() - Unable to load {0}, trying the JAR", this.reefFileNames.getMixedDLLFile().getAbsolutePath());
- final String tempLoadDir = System.getProperty(USER_DIR) + this.reefFileNames.getLoadDir();
- new File(tempLoadDir).mkdir();
- LOG.log(Level.INFO, "loadMixedDLL() - tempLoadDir created: {0} ", tempLoadDir);
- final String bridgeMixedDLLName = this.reefFileNames.getBridgeMixedDLLName();
- LOG.log(Level.INFO, "loadMixedDLL() - BridgeMixedDLLName: {0}", bridgeMixedDLLName);
- loadFromReefJar(bridgeMixedDLLName, false);
+ loadBridgeDLLFromLocal();
+ } catch (final Throwable t) {
+ try {
+ loadBridgeDLLFromGlobal();
+ } catch (final Throwable t2) {
+ loadBridgeDLLFromJAR();
+ }
}
}
- private void loadCLRBridgeDLL() throws IOException {
- try {
- File bridgeClrDLLFile = this.reefFileNames.getBridgeClrDLLFile();
- LOG.log(Level.INFO, "loadCLRBridgeDLL() - BridgeClrDLLFile: {0}.", bridgeClrDLLFile);
- loadManagedDLL(bridgeClrDLLFile);
- } catch (final Throwable t) {
- LOG.log(Level.WARNING, "Unable to load {0}, trying the JAR.", this.reefFileNames.getBridgeClrDLLFile().getAbsolutePath());
- final String tempLoadDir = System.getProperty(USER_DIR) + this.reefFileNames.getLoadDir();
- new File(tempLoadDir).mkdir();
- LOG.log(Level.INFO, "loadCLRBridgeDLL() - tempLoadDir created: {0} ", tempLoadDir);
- String bridgeClrDllName = this.reefFileNames.getBridgeClrDllName();
- LOG.log(Level.INFO, "loadCLRBridgeDLL() - BridgeClrDllName: {0}", bridgeClrDllName);
- loadFromReefJar(bridgeClrDllName, true);
- }
+
+ /**
+ * Attempts to load the bridge DLL from the global folder.
+ */
+ private void loadBridgeDLLFromGlobal() {
+ LOG.log(Level.INFO, "Attempting to load the bridge DLL from the global folder.");
+ loadBridgeDLLFromFile(reefFileNames.getBridgeDLLInGlobalFolderFile());
}
/**
- * Load assemblies at global folder
+ * Attempts to load the bridge DLL from the local folder.
*/
- private void loadDLLsInGlobal() {
- loadAllManagedDLLs(this.reefFileNames.getGlobalFolder());
+ private void loadBridgeDLLFromLocal() {
+ LOG.log(Level.INFO, "Attempting to load the bridge DLL from the local folder.");
+ loadBridgeDLLFromFile(reefFileNames.getBridgeDLLInLocalFolderFile());
+ }
+
+ /**
+ * Attempts to load the bridge DLL from the given file.
+ *
+ * @param bridgeDLLFile
+ */
+ private static void loadBridgeDLLFromFile(final File bridgeDLLFile) {
+ LOG.log(Level.INFO, "Attempting to load the bridge DLL from {0}", bridgeDLLFile);
+ System.load(bridgeDLLFile.getAbsolutePath());
+ LOG.log(Level.INFO, "Successfully loaded the bridge DLL from {0}", bridgeDLLFile);
+ }
+
+ /**
+ * Attempts to load the bridge DLL from the JAR file.
+ *
+ * @throws IOException
+ * @deprecated We should use the files instead.
+ */
+ @Deprecated
+ private void loadBridgeDLLFromJAR() throws IOException {
+ final String tempLoadDir = System.getProperty(USER_DIR) + this.reefFileNames.getLoadDir();
+ new File(tempLoadDir).mkdir();
+ LOG.log(Level.INFO, "loadBridgeDLL() - tempLoadDir created: {0} ", tempLoadDir);
+ final String bridgeMixedDLLName = this.reefFileNames.getBridgeDLLName();
+ LOG.log(Level.INFO, "loadBridgeDLL() - BridgeMixedDLLName: {0}", bridgeMixedDLLName);
+ loadFromReefJar(bridgeMixedDLLName, false);
}
/**
@@ -149,10 +169,13 @@ public class LibLoader {
}
/**
- * Get file from jar file and copy it to temp dir and loads the library to memory
+ * Get file from jar file and copy it to temp dir and loads the library to memory.
+ *
+ * @deprecated This is replaced by loading it from the folders directly.
*/
+ @Deprecated
private void loadFromReefJar(String name, final boolean managed) throws IOException {
-
+ LOG.log(Level.SEVERE, "Consider upgrading your REEF client. Loading DLLs from the JAR is deprecated.");
if (!name.endsWith(".dll")) {
name = name + DLL_EXTENSION;
}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/REEFFileNames.java
----------------------------------------------------------------------
diff --git a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/REEFFileNames.java b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/REEFFileNames.java
index 1beb131..562ca7b 100644
--- a/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/REEFFileNames.java
+++ b/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/files/REEFFileNames.java
@@ -31,9 +31,9 @@ public final class REEFFileNames {
private static final String REEF_BASE_FOLDER = "reef";
private static final String GLOBAL_FOLDER = "global";
- static final String GLOBAL_FOLDER_PATH = REEF_BASE_FOLDER + '/' + GLOBAL_FOLDER;
+ private static final String GLOBAL_FOLDER_PATH = REEF_BASE_FOLDER + '/' + GLOBAL_FOLDER;
private static final String LOCAL_FOLDER = "local";
- static final String LOCAL_FOLDER_PATH = REEF_BASE_FOLDER + '/' + LOCAL_FOLDER;
+ private static final String LOCAL_FOLDER_PATH = REEF_BASE_FOLDER + '/' + LOCAL_FOLDER;
private static final String DRIVER_CONFIGURATION_NAME = "driver.conf";
private static final String DRIVER_CONFIGURATION_PATH =
LOCAL_FOLDER_PATH + '/' + DRIVER_CONFIGURATION_NAME;
@@ -47,10 +47,11 @@ public final class REEFFileNames {
private static final String DRIVER_STDOUT = "driver.stdout";
private static final String EVALUATOR_STDERR = "evaluator.stderr";
private static final String EVALUATOR_STDOUT = "evaluator.stdout";
+ @Deprecated
private static final String REEF_DRIVER_APPDLL_DIR = "/ReefDriverAppDlls/";
+ @Deprecated
private static final String TMP_LOAD_DIR = "/reef/CLRLoadingDirectory";
- private static final String BRIDGE_CLR_DLL_NAME = "Org.Apache.REEF.Bridge.Clr.dll";
- private static final String BRIDGE_MIXED_DLL_NAME = "Org.Apache.REEF.Bridge.JavaClrBridge.dll";
+ private static final String BRIDGE_DLL_NAME = "Org.Apache.REEF.Bridge.dll";
@Inject
@@ -59,35 +60,26 @@ public final class REEFFileNames {
/**
- * @return the filename of the DLL containing the CLR side of the bridge.
+ * @return the filename of the CPP DLL for the bridge.
*/
- public String getBridgeClrDllName() {
- return BRIDGE_CLR_DLL_NAME;
+ public String getBridgeDLLName() {
+ return BRIDGE_DLL_NAME;
}
/**
- * reef/local/BRIDGE_CLR_DLL_NAME
+ * reef/local/BRIDGE_DLL_NAME
*
- * @return the File pointing to the DLL containing the CLR side of the bridge.
+ * @return the File pointing to the DLL containing the DLL for the bridge.
*/
- public File getBridgeClrDLLFile() {
- return new File(getLocalFolder(), getBridgeClrDllName());
+ public File getBridgeDLLInLocalFolderFile() {
+ return new File(getLocalFolder(), getBridgeDLLName());
}
/**
- * @return the filename of the CPP DLL for the bridge.
- */
- public String getBridgeMixedDLLName() {
- return BRIDGE_MIXED_DLL_NAME;
- }
-
- /**
- * reef/local/BRIDGE_MIXED_DLL_NAME
- *
- * @return the File pointing to the DLL containing the CPP DLL for the bridge.
+ * @return a File pointing to the Bridge DLL in the global folder.
*/
- public File getMixedDLLFile() {
- return new File(getLocalFolder(), getBridgeMixedDLLName());
+ public File getBridgeDLLInGlobalFolderFile() {
+ return new File(getGlobalFolder(), getBridgeDLLName());
}
@@ -233,6 +225,7 @@ public final class REEFFileNames {
/**
* @return reef driver app dll directory
*/
+ @Deprecated
public String getReefDriverAppDllDir() {
return REEF_DRIVER_APPDLL_DIR;
}
@@ -240,6 +233,7 @@ public final class REEFFileNames {
/**
* @return temp load directory
*/
+ @Deprecated
public String getLoadDir() {
return TMP_LOAD_DIR;
}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/reef-bridge/.gitignore
----------------------------------------------------------------------
diff --git a/lang/reef-bridge/.gitignore b/lang/reef-bridge/.gitignore
deleted file mode 100644
index 10c876b..0000000
--- a/lang/reef-bridge/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-dotnethello
-
-
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/reef-bridge/pom.xml
----------------------------------------------------------------------
diff --git a/lang/reef-bridge/pom.xml b/lang/reef-bridge/pom.xml
deleted file mode 100644
index 9c13086..0000000
--- a/lang/reef-bridge/pom.xml
+++ /dev/null
@@ -1,139 +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</artifactId>
- <name>REEF Bridge</name>
- <description>Bridge between JVM and CLR.</description>
-
- <parent>
- <groupId>org.apache.reef</groupId>
- <artifactId>reef-project</artifactId>
- <version>0.11.0-incubating-SNAPSHOT</version>
- <relativePath>../..</relativePath>
- </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-bridge-java</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>reef-bridge-clr</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack-dependencies</id>
- <phase>process-resources</phase>
- <goals>
- <goal>unpack-dependencies</goal>
- </goals>
-
- <configuration>
- <includeArtifactIds>reef-bridge-java,reef-bridge-clr</includeArtifactIds>
- <outputDirectory>
- ${project.build.directory}/classes/ReefDriverAppDlls
- </outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <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-shade-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <outputFile>
- ${project.build.directory}/${project.artifactId}-${project.version}-shaded.jar
- </outputFile>
- <filters>
- <filter>
- <artifact>*:*</artifact>
- <excludes>
- <exclude>yarn-default.xml</exclude>
- <exclude>yarn-version-info.properties</exclude>
- <exclude>core-default.xml</exclude>
- <exclude>LICENSE</exclude>
- <exclude>META-INF/*</exclude>
- </excludes>
- </filter>
- </filters>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 615f875..f913080 100644
--- a/pom.xml
+++ b/pom.xml
@@ -247,6 +247,8 @@ under the License.
<exclude>**/*.sln*</exclude>
<exclude>**/*.vcxproj*</exclude>
<exclude>**/*.csproj*</exclude>
+ <exclude>**/*.opensdf*</exclude>
+ <exclude>**/*.sdf*</exclude>
<!-- The below are auto generated during the .Net build -->
<exclude>**/bin/**</exclude>
<exclude>**/obj/**</exclude>
@@ -623,9 +625,7 @@ under the License.
<modules>
<module>lang/cs</module>
<module>lang/java/reef-annotations</module>
- <module>lang/java/reef-bridge-java</module>
- <module>lang/cpp/reef-bridge-clr</module>
- <module>lang/reef-bridge</module>
+ <module>lang/java/reef-bridge-java</module>
<module>lang/java/reef-checkpoint</module>
<module>lang/java/reef-common</module>
<module>lang/java/reef-examples</module>
@@ -667,18 +667,5 @@ under the License.
</plugins>
</build>
</profile>
- <profile>
- <id>reef-bridge</id>
- <activation>
- <os>
- <name>Windows</name>
- <family>Windows</family>
- </os>
- </activation>
- <modules>
- <module>lang/reef-bridge</module>
- </modules>
-
- </profile>
</profiles>
</project>
[4/5] incubator-reef git commit: [REEF-194] Merge the bridge into a
single DLL
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedEvaluatorClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedEvaluatorClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedEvaluatorClr2Java.cpp
deleted file mode 100644
index 615e09f..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedEvaluatorClr2Java.cpp
+++ /dev/null
@@ -1,76 +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 Org {
- namespace Apache {
- namespace REEF {
- namespace Driver {
- namespace Bridge {
- namespace Clr2java {
- ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
- };
-
- FailedEvaluatorClr2Java::FailedEvaluatorClr2Java(JNIEnv *env, jobject jobjectFailedEvaluator) {
- ManagedLog::LOGGER->LogStart("FailedEvaluatorClr2Java::FailedEvaluatorClr2Java");
- pin_ptr<JavaVM*> pJavaVm = &_jvm;
- if (env->GetJavaVM(pJavaVm) != 0) {
- ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
- }
- _jobjectFailedEvaluator = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectFailedEvaluator));
-
- jclass jclassFailedEvaluator = env->GetObjectClass(_jobjectFailedEvaluator);
- jfieldID jidEvaluatorId = env->GetFieldID(jclassFailedEvaluator, "evaluatorId", "Ljava/lang/String;");
- _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectFailedEvaluator, jidEvaluatorId)));
- ManagedLog::LOGGER->LogStop("FailedEvaluatorClr2Java::FailedEvaluatorClr2Java");
- }
-
- IEvaluatorRequestorClr2Java^ FailedEvaluatorClr2Java::GetEvaluatorRequestor() {
- ManagedLog::LOGGER->LogStart("FailedEvaluatorClr2Java::GetEvaluatorRequestor");
- JNIEnv *env = RetrieveEnv(_jvm);
-
- jclass jclassFailedEvaluator = env->GetObjectClass(_jobjectFailedEvaluator);
- jfieldID jidEvaluatorRequestor = env->GetFieldID(jclassFailedEvaluator, "evaluatorRequestorBridge", "Lorg/apache/reef/javabridge/EvaluatorRequestorBridge;");
- jobject jobjectEvaluatorRequestor = env->GetObjectField(_jobjectFailedEvaluator, jidEvaluatorRequestor);
- ManagedLog::LOGGER->LogStop("FailedEvaluatorClr2Java::GetEvaluatorRequestor");
- return gcnew EvaluatorRequestorClr2Java(env, jobjectEvaluatorRequestor);
- }
-
- String^ FailedEvaluatorClr2Java::GetId() {
- ManagedLog::LOGGER->Log("FailedEvaluatorClr2Java::GetId");
-
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringId);
- }
-
- void FailedEvaluatorClr2Java::OnError(String^ message) {
- ManagedLog::LOGGER->Log("FailedEvaluatorClr2Java::OnError");
- JNIEnv *env = RetrieveEnv(_jvm);
- HandleClr2JavaError(env, message, _jobjectFailedEvaluator);
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedTaskClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedTaskClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedTaskClr2Java.cpp
deleted file mode 100644
index b27b13d..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedTaskClr2Java.cpp
+++ /dev/null
@@ -1,83 +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 {
- namespace Clr2java {
- ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
- };
-
- FailedTaskClr2Java::FailedTaskClr2Java(JNIEnv *env, jobject jobjectFailedTask) {
- ManagedLog::LOGGER->LogStart("FailedTaskClr2Java::AllocatedEvaluatorClr2Java");
- pin_ptr<JavaVM*> pJavaVm = &_jvm;
- if (env->GetJavaVM(pJavaVm) != 0) {
- ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
- }
- _jobjectFailedTask = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectFailedTask));
- ManagedLog::LOGGER->LogStop("FailedTaskClr2Java::AllocatedEvaluatorClr2Java");
- }
-
- IActiveContextClr2Java^ FailedTaskClr2Java::GetActiveContext() {
- ManagedLog::LOGGER->LogStart("FailedTaskClr2Java::GetActiveContext");
-
- JNIEnv *env = RetrieveEnv(_jvm);
-
- jclass jclassFailedTask = env->GetObjectClass(_jobjectFailedTask);
- jfieldID jidActiveContext = env->GetFieldID(jclassFailedTask, "jactiveContext", "Lorg/apache/reef/javabridge/ActiveContextBridge;");
- jobject jobjectActiveContext = env->GetObjectField(_jobjectFailedTask, jidActiveContext);
-
- ManagedLog::LOGGER->LogStop("FailedTaskClr2Java::GetActiveContext");
- return gcnew ActiveContextClr2Java(env, jobjectActiveContext);
- }
-
- String^ FailedTaskClr2Java::GetString() {
- ManagedLog::LOGGER->LogStart("FailedTaskClr2Java::GetString");
- JNIEnv *env = RetrieveEnv(_jvm);
-
- jclass jclassFailedTask = env->GetObjectClass(_jobjectFailedTask);
- jmethodID jmidGetFailedTaskString = env->GetMethodID(jclassFailedTask, "getFailedTaskString", "()Ljava/lang/String;");
-
- if (jmidGetFailedTaskString == NULL) {
- ManagedLog::LOGGER->LogStart("jmidGetFailedTaskString is NULL");
- return nullptr;
- }
- jstring jFailedTaskString = (jstring)env->CallObjectMethod(
- _jobjectFailedTask,
- jmidGetFailedTaskString);
- ManagedLog::LOGGER->LogStop("FailedTaskClr2Java::GetString");
- return ManagedStringFromJavaString(env, jFailedTaskString);
- }
-
- void FailedTaskClr2Java::OnError(String^ message) {
- ManagedLog::LOGGER->Log("FailedTaskClr2Java::OnError");
- JNIEnv *env = RetrieveEnv(_jvm);
- HandleClr2JavaError(env, message, _jobjectFailedTask);
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/HttpServerClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/HttpServerClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/HttpServerClr2Java.cpp
deleted file mode 100644
index f8a819d..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/HttpServerClr2Java.cpp
+++ /dev/null
@@ -1,139 +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 {
- namespace Clr2java {
- ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
- };
-
- HttpServerClr2Java::HttpServerClr2Java(JNIEnv *env, jobject jhttpServerEventBridge) {
- ManagedLog::LOGGER->LogStart("HttpServerClr2Java::HttpServerClr2Java");
- pin_ptr<JavaVM*> pJavaVm = &_jvm;
- if (env->GetJavaVM(pJavaVm) != 0) {
- ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
- }
- _jhttpServerEventBridge = reinterpret_cast<jobject>(env->NewGlobalRef(jhttpServerEventBridge));
- ManagedLog::LOGGER->LogStop("HttpServerClr2Java::HttpServerClr2Java");
- }
-
- String^ HttpServerClr2Java::GetQueryString() {
- ManagedLog::LOGGER->LogStart("HttpServerClr2Java::GetQueryString");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclasshttpServerEventBridge = env->GetObjectClass(_jhttpServerEventBridge);
- jmethodID jmidgetQueryString = env->GetMethodID(jclasshttpServerEventBridge, "getQueryString", "()Ljava/lang/String;");
- if (jmidgetQueryString == NULL) {
- fprintf(stdout, " jmidgetQueryString is NULL\n");
- fflush(stdout);
- return nullptr;
- }
- jstring jQueryString = (jstring)env->CallObjectMethod(
- _jhttpServerEventBridge,
- jmidgetQueryString);
-
- ManagedLog::LOGGER->LogStop("HttpServerClr2Java::GetQueryString");
- return ManagedStringFromJavaString(env, jQueryString);
- }
-
- array<byte>^ HttpServerClr2Java::GetQueryRequestData() {
- ManagedLog::LOGGER->LogStart("HttpServerClr2Java::GetQueryRequestData");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclasshttpServerEventBridge = env->GetObjectClass(_jhttpServerEventBridge);
- jmethodID jmidgetQueryBytes = env->GetMethodID(jclasshttpServerEventBridge, "getQueryRequestData", "()[B");
-
- if (jmidgetQueryBytes == NULL) {
- ManagedLog::LOGGER->Log("jmidgetQueryBytes is NULL");
- return nullptr;
- }
- jbyteArray jQueryBytes = (jbyteArray)env->CallObjectMethod(
- _jhttpServerEventBridge,
- jmidgetQueryBytes);
-
- ManagedLog::LOGGER->LogStop("HttpServerClr2Java::GetQueryRequestData");
- return ManagedByteArrayFromJavaByteArray(env, jQueryBytes);
- }
-
- void HttpServerClr2Java::SetQueryResult(String^ queryResult) {
- ManagedLog::LOGGER->LogStart("HttpServerClr2Java::SetQueryResult");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclasshttpServerEventBridge = env->GetObjectClass(_jhttpServerEventBridge);
- jmethodID jmidsetQueryResult = env->GetMethodID(jclasshttpServerEventBridge, "setQueryResult", "(Ljava/lang/String;)V");
-
- if (jmidsetQueryResult == NULL) {
- ManagedLog::LOGGER->Log("jmidsetQueryResult is NULL");
- return;
- }
- env->CallObjectMethod(
- _jhttpServerEventBridge,
- jmidsetQueryResult,
- JavaStringFromManagedString(env, queryResult));
- ManagedLog::LOGGER->LogStop("HttpServerClr2Java::SetQueryResult");
- }
-
- void HttpServerClr2Java::SetQueryResponseData(array<byte>^ queryResponseData) {
- ManagedLog::LOGGER->LogStart("HttpServerClr2Java::SetQueryResponseData");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclasshttpServerEventBridge = env->GetObjectClass(_jhttpServerEventBridge);
- jmethodID jmidsetQueryResult = env->GetMethodID(jclasshttpServerEventBridge, "setQueryResponseData", "([B)V");
-
- if (jmidsetQueryResult == NULL) {
- ManagedLog::LOGGER->Log("jmidsetQueryResult is NULL");
- return;
- }
- env->CallObjectMethod(
- _jhttpServerEventBridge,
- jmidsetQueryResult,
- JavaByteArrayFromManagedByteArray(env, queryResponseData));
- ManagedLog::LOGGER->LogStop("HttpServerClr2Java::SetQueryResponseData");
- }
-
- void HttpServerClr2Java::SetUriSpecification(String^ uriSpecification) {
- ManagedLog::LOGGER->LogStart("HttpServerClr2Java::SetUriSpecification");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclasshttpServerEventBridge = env->GetObjectClass(_jhttpServerEventBridge);
- jmethodID jmidsetUriSpecification = env->GetMethodID(jclasshttpServerEventBridge, "setUriSpecification", "(Ljava/lang/String;)V");
-
- if (jmidsetUriSpecification == NULL) {
- ManagedLog::LOGGER->Log("jmidsetUriSpecification is NULL");
- return;
- }
- env->CallObjectMethod(
- _jhttpServerEventBridge,
- jmidsetUriSpecification,
- JavaStringFromManagedString(env, uriSpecification));
- ManagedLog::LOGGER->LogStop("HttpServerClr2Java::SetUriSpecification");
- }
-
- void HttpServerClr2Java::OnError(String^ message) {
- ManagedLog::LOGGER->Log("HttpServerClr2Java::OnError");
- JNIEnv *env = RetrieveEnv(_jvm);
- HandleClr2JavaError(env, message, _jhttpServerEventBridge);
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropAssemblies.h
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropAssemblies.h b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropAssemblies.h
deleted file mode 100644
index 2e80d71..0000000
--- a/lang/cpp/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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.cpp
deleted file mode 100644
index 418bd55..0000000
--- a/lang/cpp/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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.h
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.h b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropLogger.h
deleted file mode 100644
index c191c98..0000000
--- a/lang/cpp/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 "Org.Apache.REEF.Bridge.Clr.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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.cpp
deleted file mode 100644
index 821c0d1..0000000
--- a/lang/cpp/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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.h
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.h b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropReturnInfo.h
deleted file mode 100644
index af885d7..0000000
--- a/lang/cpp/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 "Org.Apache.REEF.Bridge.Clr.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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.cpp
deleted file mode 100644
index be24f32..0000000
--- a/lang/cpp/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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.h
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.h b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/InteropUtil.h
deleted file mode 100644
index 2d95bcc..0000000
--- a/lang/cpp/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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.cpp
deleted file mode 100644
index 2b8c7da..0000000
--- a/lang/cpp/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::Clr2java;
-
-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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.h
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.h b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.h
deleted file mode 100644
index 61d9d0a..0000000
--- a/lang/cpp/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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.sln
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.sln b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.sln
deleted file mode 100644
index a994683..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.sln
+++ /dev/null
@@ -1,58 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Org.Apache.REEF.Bridge.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}") = "Org.Apache.REEF.Bridge.Clr", "..\..\..\CSharp\CSharp\ClrHandler\Org.Apache.REEF.Bridge.Clr.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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj
deleted file mode 100644
index c9cd219..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.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>
- <ProjectName>Org.Apache.REEF.Bridge.JavaClrBridge</ProjectName>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
- <CLRSupport>true</CLRSupport>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
- <CLRSupport>true</CLRSupport>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
- <CLRSupport>true</CLRSupport>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v120</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>..\..\..\..\..\..\..\java\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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj.filters
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj.filters b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.vcxproj.filters
deleted file mode 100644
index 5421846..0000000
--- a/lang/cpp/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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ManagedLogger.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ManagedLogger.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ManagedLogger.cpp
deleted file mode 100644
index 62e30b3..0000000
--- a/lang/cpp/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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ReadMe.txt
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ReadMe.txt b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ReadMe.txt
deleted file mode 100644
index 4e1b52f..0000000
--- a/lang/cpp/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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/RunningTaskClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/RunningTaskClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/RunningTaskClr2Java.cpp
deleted file mode 100644
index dfc8ae3..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/RunningTaskClr2Java.cpp
+++ /dev/null
@@ -1,94 +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 {
- namespace Clr2java {
- 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
[3/5] incubator-reef git commit: [REEF-194] Merge the bridge into a
single DLL
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/SuspendedTaskClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/SuspendedTaskClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/SuspendedTaskClr2Java.cpp
deleted file mode 100644
index e052d24..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/SuspendedTaskClr2Java.cpp
+++ /dev/null
@@ -1,87 +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 {
- namespace Clr2java {
- 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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/TaskMessageClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/TaskMessageClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/TaskMessageClr2Java.cpp
deleted file mode 100644
index 1ee79e9..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/TaskMessageClr2Java.cpp
+++ /dev/null
@@ -1,62 +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 {
- namespace Clr2java {
- 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/492da34a/lang/cs/.gitignore
----------------------------------------------------------------------
diff --git a/lang/cs/.gitignore b/lang/cs/.gitignore
index cea2523..8db483c 100644
--- a/lang/cs/.gitignore
+++ b/lang/cs/.gitignore
@@ -6,6 +6,9 @@ TestResults
**/*.suo
**/*.csproj.user
**/obj
+**/x64
+**/*.opensdf
+**/*.sdf
**/.nuget/nuspec
**/.nuget/packages
*.sln.GhostDoc.xml
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/.nuget/finalizeNuspec.ps1
----------------------------------------------------------------------
diff --git a/lang/cs/.nuget/finalizeNuspec.ps1 b/lang/cs/.nuget/finalizeNuspec.ps1
index 69683d8..825072e 100644
--- a/lang/cs/.nuget/finalizeNuspec.ps1
+++ b/lang/cs/.nuget/finalizeNuspec.ps1
@@ -77,6 +77,7 @@ Function Finalize-Nuspec-Version {
}
$nuspecDir = "$SolutionDir\.nuget\nuspec"
+ Write-Output $nuspecDir
$nuspecFiles = Get-ChildItem $nuspecDir
# Replace the $version$ token with the specified version in each nuspec file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.csproj b/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.csproj
index 4623ddc..a728d18 100644
--- a/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.csproj
+++ b/lang/cs/Org.Apache.REEF.Bridge.JAR/Org.Apache.REEF.Bridge.JAR.csproj
@@ -24,17 +24,34 @@ under the License.
<RootNameSpace>$(MSBuildProjectName)</RootNameSpace>
</PropertyGroup>
<Import Project="..\build.props" />
+ <Import Project="$(MSBuildBinPath)\Microsoft.Common.targets" />
<!--
Check that maven is installed
-->
<Target Name="CheckMavenInstall">
<Error Condition=" '$(M2_HOME)' == '' " Text="$M2_HOME is not set. Please make sure that Maven is installed and configured. See https://cwiki.apache.org/confluence/display/REEF/Compiling+REEF for details." />
+ <Error Condition=" '$(JAVA_HOME)' == '' " Text="$JAVA_HOME is not set. Please make sure that Java is installed and configured. See https://cwiki.apache.org/confluence/display/REEF/Compiling+REEF for details." />
<Message Text="Using the maven installation found in $(M2_HOME)" />
</Target>
+
+ <Target Name="CheckJavaInstall">
+ <Error Condition=" '$(JAVA_HOME)' == '' " Text="$JAVA_HOME is not set. Please make sure that Java is installed and configured. See https://cwiki.apache.org/confluence/display/REEF/Compiling+REEF for details." />
+ <Message Text="Using the java installation found in $(JAVA_HOME)" />
+ </Target>
+
+ <Target Name="CheckProtocInstall">
+ <Exec ContinueOnError="True" IgnoreExitCode='true'
+ Command='"cmd /c where protoc.exe"'>
+ <Output TaskParameter="ExitCode" PropertyName="ErrorCode"/>
+ </Exec>
+ <Message Text="The exit code is $(ErrorCode)"/>
+ <Error Text="protoc.exe not found. Please make sure that protoc.exe is on the path. See https://cwiki.apache.org/confluence/display/REEF/Compiling+REEF for details." Condition="'$(ErrorCode)' > '0'" />
+ </Target>
+
<!--
Executes 'mvn install', if the JAR does not exist.
-->
- <Target Name="Build" DependsOnTargets="CheckMavenInstall">
+ <Target Name="Build" DependsOnTargets="CheckMavenInstall;CheckJavaInstall;CheckProtocInstall">
<PropertyGroup>
<!--The shaded jar of the bridge -->
<Bridge_JAR_Name>reef-bridge-java-$(REEF_Version)-shaded.jar</Bridge_JAR_Name>
@@ -46,12 +63,12 @@ under the License.
<!--
Executes 'mvn clean', if the JAR exists.
-->
- <Target Name="Clean" DependsOnTargets="CheckMavenInstall">
+ <Target Name="Clean" DependsOnTargets="CheckMavenInstall;CheckJavaInstall;CheckProtocInstall">
<PropertyGroup>
<!--The shaded jar of the bridge -->
<Bridge_JAR_Name>reef-bridge-java-$(REEF_Version)-shaded.jar</Bridge_JAR_Name>
<Bridge_JAR>$(REEF_Source_Folder)\lang\java\reef-bridge-java\target\$(Bridge_JAR_Name)</Bridge_JAR>
- </PropertyGroup>
+ </PropertyGroup>
<Exec Command="$(M2_HOME)\bin\mvn -TC1 -DskipTests clean" Condition="Exists('$(Bridge_JAR)')" WorkingDirectory="$(REEF_Source_Folder)" />
<Delete Files="$(OutputPath)\$(Bridge_JAR_Name)" />
</Target>
@@ -59,4 +76,8 @@ under the License.
Standard Rebuild target: Clean, then build
-->
<Target Name="Rebuild" DependsOnTargets="Clean;Build"/>
+ <Target Name="GetNativeManifest">
+ </Target>
+ <Target Name="GetCopyToOutputDirectoryItems">
+</Target>
</Project>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/ActiveContextClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/ActiveContextClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/ActiveContextClr2Java.cpp
new file mode 100644
index 0000000..6e56806
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/ActiveContextClr2Java.cpp
@@ -0,0 +1,110 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ private ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
+ };
+
+ ActiveContextClr2Java::ActiveContextClr2Java(JNIEnv *env, jobject jobjectActiveContext) {
+ ManagedLog::LOGGER->LogStart("ActiveContextClr2Java::ActiveContextClr2Java");
+ pin_ptr<JavaVM*> pJavaVm = &_jvm;
+ if (env->GetJavaVM(pJavaVm) != 0) {
+ ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
+ }
+
+ _jobjectActiveContext = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectActiveContext));
+
+ jclass jclassActiveContext = env->GetObjectClass(_jobjectActiveContext);
+
+ jfieldID jidContextId = env->GetFieldID(jclassActiveContext, "contextId", "Ljava/lang/String;");
+ _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectActiveContext, jidContextId)));
+
+ jfieldID jidEvaluatorId = env->GetFieldID(jclassActiveContext, "evaluatorId", "Ljava/lang/String;");
+ _jstringEvaluatorId = (jstring)env->GetObjectField(_jobjectActiveContext, jidEvaluatorId);
+ _jstringEvaluatorId = reinterpret_cast<jstring>(env->NewGlobalRef(_jstringEvaluatorId));
+
+ ManagedLog::LOGGER->LogStop("ActiveContextClr2Java::ActiveContextClr2Java");
+ }
+
+ void ActiveContextClr2Java::SubmitTask(String^ taskConfigStr) {
+ ManagedLog::LOGGER->LogStart("ActiveContextClr2Java::SubmitTask");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclassActiveContext = env->GetObjectClass(_jobjectActiveContext);
+ jmethodID jmidSubmitTask = env->GetMethodID(jclassActiveContext, "submitTaskString", "(Ljava/lang/String;)V");
+
+ if (jmidSubmitTask == NULL) {
+ ManagedLog::LOGGER->Log("jmidSubmitTask is NULL");
+ return;
+ }
+ env->CallObjectMethod(
+ _jobjectActiveContext,
+ jmidSubmitTask,
+ JavaStringFromManagedString(env, taskConfigStr));
+ ManagedLog::LOGGER->LogStop("ActiveContextClr2Java::SubmitTask");
+ }
+
+ void ActiveContextClr2Java::OnError(String^ message) {
+ JNIEnv *env = RetrieveEnv(_jvm);
+ HandleClr2JavaError(env, message, _jobjectActiveContext);
+ }
+
+ void ActiveContextClr2Java::Close() {
+ ManagedLog::LOGGER->LogStart("ActiveContextClr2Java::Close");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclassActiveContext = env->GetObjectClass(_jobjectActiveContext);
+ jmethodID jmidClose = env->GetMethodID(jclassActiveContext, "close", "()V");
+
+ if (jmidClose == NULL) {
+ ManagedLog::LOGGER->Log("jmidClose is NULL");
+ return;
+ }
+ env->CallObjectMethod(
+ _jobjectActiveContext,
+ jmidClose);
+ ManagedLog::LOGGER->LogStop("ActiveContextClr2Java::Close");
+ }
+
+ String^ ActiveContextClr2Java::GetId() {
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringId);
+ }
+
+ String^ ActiveContextClr2Java::GetEvaluatorId() {
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringEvaluatorId);
+ }
+
+ IEvaluatorDescriptor^ ActiveContextClr2Java::GetEvaluatorDescriptor() {
+ ManagedLog::LOGGER->LogStart("ActiveContextClr2Java::GetEvaluatorDescriptor");
+ return CommonUtilities::RetrieveEvaluatorDescriptor(_jobjectActiveContext, _jvm);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/AllocatedEvaluatorClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/AllocatedEvaluatorClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/AllocatedEvaluatorClr2Java.cpp
new file mode 100644
index 0000000..4dabd96
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/AllocatedEvaluatorClr2Java.cpp
@@ -0,0 +1,168 @@
+/**
+ * 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 Org {
+ namespace Apache {
+ namespace REEF {
+ namespace Driver {
+ namespace Bridge {
+ namespace Clr2java {
+ ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
+ };
+
+ AllocatedEvaluatorClr2Java::AllocatedEvaluatorClr2Java(JNIEnv *env, jobject jallocatedEvaluator) {
+
+ ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::AllocatedEvaluatorClr2Java");
+
+ pin_ptr<JavaVM*> pJavaVm = &_jvm;
+ if (env->GetJavaVM(pJavaVm) != 0) {
+ ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
+ }
+ _jobjectAllocatedEvaluator = reinterpret_cast<jobject>(env->NewGlobalRef(jallocatedEvaluator));
+
+ jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
+ jfieldID jidEvaluatorId = env->GetFieldID(jclassAllocatedEvaluator, "evaluatorId", "Ljava/lang/String;");
+ _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectAllocatedEvaluator, jidEvaluatorId)));
+
+ jfieldID jidNameServerInfo = env->GetFieldID(jclassAllocatedEvaluator, "nameServerInfo", "Ljava/lang/String;");
+ _jstringNameServerInfo = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectAllocatedEvaluator, jidNameServerInfo)));
+
+ ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::AllocatedEvaluatorClr2Java");
+ }
+
+ void AllocatedEvaluatorClr2Java::SubmitContext(String^ contextConfigStr) {
+ ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::SubmitContext");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
+ jmethodID jmidSubmitContext = env->GetMethodID(jclassAllocatedEvaluator, "submitContextString", "(Ljava/lang/String;)V");
+
+ if (jmidSubmitContext == NULL) {
+ ManagedLog::LOGGER->Log("jmidSubmitContext is NULL");
+ return;
+ }
+ env->CallObjectMethod(
+ _jobjectAllocatedEvaluator,
+ jmidSubmitContext,
+ JavaStringFromManagedString(env, contextConfigStr));
+ ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::SubmitContext");
+ }
+
+ void AllocatedEvaluatorClr2Java::SubmitContextAndTask(String^ contextConfigStr, String^ taskConfigStr) {
+ ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::SubmitContextAndTask");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
+ jmethodID jmidSubmitContextAndTask = env->GetMethodID(jclassAllocatedEvaluator, "submitContextAndTaskString", "(Ljava/lang/String;Ljava/lang/String;)V");
+
+ if (jmidSubmitContextAndTask == NULL) {
+ ManagedLog::LOGGER->Log("jmidSubmitContextAndTask is NULL");
+ return;
+ }
+ env->CallObjectMethod(
+ _jobjectAllocatedEvaluator,
+ jmidSubmitContextAndTask,
+ JavaStringFromManagedString(env, contextConfigStr),
+ JavaStringFromManagedString(env, taskConfigStr));
+ ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::SubmitContextAndTask");
+ }
+
+ void AllocatedEvaluatorClr2Java::SubmitContextAndService(String^ contextConfigStr, String^ serviceConfigStr) {
+ ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::SubmitContextAndService");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
+ jmethodID jmidSubmitContextAndService = env->GetMethodID(jclassAllocatedEvaluator, "submitContextAndServiceString", "(Ljava/lang/String;Ljava/lang/String;)V");
+
+ if (jmidSubmitContextAndService == NULL) {
+ ManagedLog::LOGGER->Log("jmidSubmitContextAndService is NULL");
+ return;
+ }
+ env->CallObjectMethod(
+ _jobjectAllocatedEvaluator,
+ jmidSubmitContextAndService,
+ JavaStringFromManagedString(env, contextConfigStr),
+ JavaStringFromManagedString(env, serviceConfigStr));
+ ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::SubmitContextAndService");
+ }
+
+ void AllocatedEvaluatorClr2Java::SubmitContextAndServiceAndTask(String^ contextConfigStr, String^ serviceConfigStr, String^ taskConfigStr) {
+ ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::SubmitContextAndServiceAndTask");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
+ jmethodID jmidSubmitContextAndServiceAndTask = env->GetMethodID(jclassAllocatedEvaluator, "submitContextAndServiceAndTaskString", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
+
+ if (jmidSubmitContextAndServiceAndTask == NULL) {
+ ManagedLog::LOGGER->Log("jmidSubmitContextAndServiceAndTask is NULL");
+ return;
+ }
+ env->CallObjectMethod(
+ _jobjectAllocatedEvaluator,
+ jmidSubmitContextAndServiceAndTask,
+ JavaStringFromManagedString(env, contextConfigStr),
+ JavaStringFromManagedString(env, serviceConfigStr),
+ JavaStringFromManagedString(env, taskConfigStr));
+ ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::SubmitContextAndServiceAndTask");
+ }
+
+ void AllocatedEvaluatorClr2Java::OnError(String^ message) {
+ JNIEnv *env = RetrieveEnv(_jvm);
+ HandleClr2JavaError(env, message, _jobjectAllocatedEvaluator);
+ }
+
+ void AllocatedEvaluatorClr2Java::Close() {
+ ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::Close");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
+ jmethodID jmidClose = env->GetMethodID(jclassAllocatedEvaluator, "close", "()V");
+
+ if (jmidClose == NULL) {
+ ManagedLog::LOGGER->Log("jmidClose is NULL");
+ return;
+ }
+ env->CallObjectMethod(
+ _jobjectAllocatedEvaluator,
+ jmidClose);
+ ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::Close");
+ }
+
+ String^ AllocatedEvaluatorClr2Java::GetId() {
+ ManagedLog::LOGGER->Log("AllocatedEvaluatorClr2Java::GetId");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringId);
+ }
+
+ String^ AllocatedEvaluatorClr2Java::GetNameServerInfo() {
+ ManagedLog::LOGGER->Log("AllocatedEvaluatorClr2Java::GetNameServerInfo");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringNameServerInfo);
+ }
+
+ IEvaluatorDescriptor^ AllocatedEvaluatorClr2Java::GetEvaluatorDescriptor() {
+ ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::GetEvaluatorDescriptor");
+ return CommonUtilities::RetrieveEvaluatorDescriptor(_jobjectAllocatedEvaluator, _jvm);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/AssemblyInfo.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/AssemblyInfo.cpp b/lang/cs/Org.Apache.REEF.Bridge/AssemblyInfo.cpp
new file mode 100644
index 0000000..d91c459
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/AssemblyInfo.cpp
@@ -0,0 +1,57 @@
+/**
+ * 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 "stdafx.h"
+
+using namespace System;
+using namespace System::Reflection;
+using namespace System::Runtime::CompilerServices;
+using namespace System::Runtime::InteropServices;
+using namespace System::Security::Permissions;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly:AssemblyTitleAttribute(L"OrgApacheREEFJavaClrBridge")];
+[assembly:AssemblyDescriptionAttribute(L"")];
+[assembly:AssemblyConfigurationAttribute(L"")];
+[assembly:AssemblyCompanyAttribute(L"")];
+[assembly:AssemblyProductAttribute(L"OrgApacheREEFJavaClrBridge")];
+[assembly:AssemblyCopyrightAttribute(L"Copyright (c) 2015")];
+[assembly:AssemblyTrademarkAttribute(L"")];
+[assembly:AssemblyCultureAttribute(L"")];
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the value or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly:AssemblyVersionAttribute("1.0.*")];
+
+[assembly:ComVisible(false)];
+
+[assembly:CLSCompliantAttribute(true)];
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/AssemblyUtil.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/AssemblyUtil.cpp b/lang/cs/Org.Apache.REEF.Bridge/AssemblyUtil.cpp
new file mode 100644
index 0000000..ce9239c
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/AssemblyUtil.cpp
@@ -0,0 +1,53 @@
+/**
+ * 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 "InteropAssemblies.h"
+
+
+void AssemblyUtil::Add(Assembly^ myasm) {
+ if (0 == _asmCount) {
+ //asm1 = myasm;
+ AppDomain^ currentDomain = AppDomain::CurrentDomain;
+ currentDomain->AssemblyResolve += gcnew ResolveEventHandler(&MyResolveEventHandler);
+ }
+ String^ asmName = myasm->FullName->ToLower();
+ Assembly^ existingAsm = nullptr;
+ if (!asms2->TryGetValue(asmName, existingAsm)) {
+ Console::WriteLine ("AssemblyUtil:: Adding " + asmName);
+ asms2->Add(asmName , myasm);
+ ++_asmCount;
+ }
+}
+
+Assembly^ AssemblyUtil::FindAsm (String^ myasm) {
+ Assembly^ returnAsm = nullptr;
+ if (!asms2->TryGetValue(myasm->ToLower(), returnAsm)) {
+ Console::WriteLine ("AssemblyUtil:: FindAsm_Not_Found " + myasm->ToString());
+ }
+ return returnAsm;
+}
+
+Assembly^ AssemblyUtil::MyResolveEventHandler(Object^ sender, ResolveEventArgs^ args) {
+ Console::WriteLine ("AssemblyUtil:: Resolving " + args->Name);
+ Assembly^ myAsm = AssemblyUtil::FindAsm(args->Name);
+ if (nullptr != myAsm) {
+ Console::WriteLine ("AssemblyUtil:: Found " + args->Name);
+ }
+ return myAsm ;
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/BinaryUtil.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/BinaryUtil.cpp b/lang/cs/Org.Apache.REEF.Bridge/BinaryUtil.cpp
new file mode 100644
index 0000000..b7c3a2e
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/BinaryUtil.cpp
@@ -0,0 +1,102 @@
+/**
+ * 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 "BinaryUtil.h"
+
+DWORD GetActualAddressFromRVA(IMAGE_SECTION_HEADER* pSectionHeader, IMAGE_NT_HEADERS* pNTHeaders, DWORD dwRVA) {
+ DWORD dwRet = 0;
+
+ for (int j = 0; j < pNTHeaders->FileHeader.NumberOfSections; j++, pSectionHeader++) {
+ DWORD cbMaxOnDisk = min( pSectionHeader->Misc.VirtualSize, pSectionHeader->SizeOfRawData );
+
+ DWORD startSectRVA, endSectRVA;
+
+ startSectRVA = pSectionHeader->VirtualAddress;
+ endSectRVA = startSectRVA + cbMaxOnDisk;
+
+ if ( (dwRVA >= startSectRVA) && (dwRVA < endSectRVA)) {
+ dwRet = (pSectionHeader->PointerToRawData ) + (dwRVA - startSectRVA);
+ break;
+ }
+
+ }
+
+ return dwRet;
+}
+
+
+BINARY_TYPE IsManagedBinary(const wchar_t* lpszImageName) {
+ BINARY_TYPE binaryType = BINARY_TYPE_NONE;
+ HANDLE hFile = CreateFile(lpszImageName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+
+ if (INVALID_HANDLE_VALUE != hFile) {
+ //succeeded
+ HANDLE hOpenFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+ if (hOpenFileMapping) {
+ BYTE* lpBaseAddress = NULL;
+
+ lpBaseAddress = (BYTE*)MapViewOfFile(hOpenFileMapping, FILE_MAP_READ, 0, 0, 0);
+
+ if (lpBaseAddress) {
+ //having mapped the executable to our process space, now start navigating through the sections
+
+ //DOS header is straightforward. It is the topmost structure in the PE file
+ //i.e. the one at the lowest offset into the file
+ IMAGE_DOS_HEADER* pDOSHeader = (IMAGE_DOS_HEADER*)lpBaseAddress;
+
+ //the only important data in the DOS header is the e_lfanew
+ //the e_lfanew points to the offset of the beginning of NT Headers data
+ IMAGE_NT_HEADERS* pNTHeaders = (IMAGE_NT_HEADERS*)((BYTE*)pDOSHeader + pDOSHeader->e_lfanew);
+
+ IMAGE_SECTION_HEADER* pSectionHeader = (IMAGE_SECTION_HEADER*)((BYTE*)pNTHeaders + sizeof(IMAGE_NT_HEADERS));
+
+ //Now, start parsing
+ //check if it is a PE file
+
+ if (pNTHeaders->Signature == IMAGE_NT_SIGNATURE) {
+ //start parsing COM table
+
+ DWORD dwNETHeaderTableLocation = pNTHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress;
+
+ if (dwNETHeaderTableLocation) {
+ //import data does exist for this module
+ IMAGE_COR20_HEADER* pNETHeader = (IMAGE_COR20_HEADER*)((BYTE*)pDOSHeader + GetActualAddressFromRVA(pSectionHeader, pNTHeaders, dwNETHeaderTableLocation));
+
+ if (pNETHeader) {
+ binaryType = BINARY_TYPE_CLR;
+ }
+ else {
+ binaryType = BINARY_TYPE_NATIVE;
+ }
+ }
+ else {
+ binaryType = BINARY_TYPE_NATIVE;
+ }
+ }
+ else {
+ binaryType = BINARY_TYPE_NONE;
+ }
+ UnmapViewOfFile(lpBaseAddress);
+ }
+ CloseHandle(hOpenFileMapping);
+ }
+ CloseHandle(hFile);
+ }
+ return binaryType;
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/BinaryUtil.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/BinaryUtil.h b/lang/cs/Org.Apache.REEF.Bridge/BinaryUtil.h
new file mode 100644
index 0000000..dc946a6
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/BinaryUtil.h
@@ -0,0 +1,26 @@
+/**
+ * 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.
+ */
+typedef enum BINARY_TYPE {
+ BINARY_TYPE_NONE = 0,
+ BINARY_TYPE_NATIVE = 1,
+ BINARY_TYPE_CLR = 2,
+} BINARY_TYPE ;
+
+
+BINARY_TYPE IsManagedBinary(const wchar_t* lpszImageName);
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/ClosedContextClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/ClosedContextClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/ClosedContextClr2Java.cpp
new file mode 100644
index 0000000..6584abe
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/ClosedContextClr2Java.cpp
@@ -0,0 +1,90 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
+ };
+ ClosedContextClr2Java::ClosedContextClr2Java(JNIEnv *env, jobject jobjectClosedContext) {
+ ManagedLog::LOGGER->LogStart("ClosedContextClr2Java::ClosedContextClr2Java");
+
+ pin_ptr<JavaVM*> pJavaVm = &_jvm;
+ if (env->GetJavaVM(pJavaVm) != 0) {
+ ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
+ }
+ _jobjectClosedContext = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectClosedContext));
+ jclass jclassClosedContext = env->GetObjectClass(_jobjectClosedContext);
+
+ jfieldID jidContextId = env->GetFieldID(jclassClosedContext, "contextId", "Ljava/lang/String;");
+ jfieldID jidEvaluatorId = env->GetFieldID(jclassClosedContext, "evaluatorId", "Ljava/lang/String;");
+
+ _jstringContextId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectClosedContext, jidContextId)));
+ _jstringEvaluatorId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectClosedContext, jidEvaluatorId)));
+
+ ManagedLog::LOGGER->LogStop("ClosedContextClr2Java::ClosedContextClr2Java");
+ }
+
+ IActiveContextClr2Java^ ClosedContextClr2Java::GetParentContext() {
+ ManagedLog::LOGGER->LogStart("ClosedContextClr2Java::GetParentContext");
+
+ JNIEnv *env = RetrieveEnv(_jvm);
+
+ jclass jclassClosedContext = env->GetObjectClass(_jobjectClosedContext);
+ jfieldID jidParentContext = env->GetFieldID(jclassClosedContext, "parentContext", "Lorg/apache/reef/javabridge/ActiveContextBridge;");
+ jobject jobjectParentContext = env->GetObjectField(_jobjectClosedContext, jidParentContext);
+ ManagedLog::LOGGER->LogStop("ClosedContextClr2Java::GetParentContext");
+
+ return gcnew ActiveContextClr2Java(env, jobjectParentContext);
+ }
+
+ String^ ClosedContextClr2Java::GetId() {
+ ManagedLog::LOGGER->Log("ClosedContextClr2Java::GetId");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringContextId);
+ }
+
+ String^ ClosedContextClr2Java::GetEvaluatorId() {
+ ManagedLog::LOGGER->Log("ClosedContextClr2Java::GetEvaluatorId");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringEvaluatorId);
+ }
+
+ IEvaluatorDescriptor^ ClosedContextClr2Java::GetEvaluatorDescriptor() {
+ ManagedLog::LOGGER->LogStart("ClosedContextClr2Java::GetEvaluatorDescriptor");
+ return CommonUtilities::RetrieveEvaluatorDescriptor(_jobjectClosedContext, _jvm);
+ }
+
+ void ClosedContextClr2Java::OnError(String^ message) {
+ ManagedLog::LOGGER->Log("ClosedContextClr2Java::OnError");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ HandleClr2JavaError(env, message, _jobjectClosedContext);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/Clr2JavaImpl.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/Clr2JavaImpl.h b/lang/cs/Org.Apache.REEF.Bridge/Clr2JavaImpl.h
new file mode 100644
index 0000000..b1e4491
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/Clr2JavaImpl.h
@@ -0,0 +1,223 @@
+/**
+ * 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 "Org.Apache.REEF.Driver.dll"
+
+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;
+using namespace Org::Apache::REEF::Driver::Evaluator;
+
+namespace Org {
+ namespace Apache {
+ namespace REEF {
+ namespace Driver {
+ namespace Bridge {
+ namespace Clr2java {
+ public ref class CommonUtilities {
+ public:
+ static IEvaluatorDescriptor^ RetrieveEvaluatorDescriptor(jobject object, JavaVM* jvm);
+ };
+
+ public ref class AllocatedEvaluatorClr2Java : public IAllocatedEvaluaotrClr2Java {
+ jobject _jobjectAllocatedEvaluator;
+ JavaVM* _jvm;
+ jstring _jstringId;
+ jstring _jstringNameServerInfo;
+ public:
+ AllocatedEvaluatorClr2Java(JNIEnv *env, jobject jallocatedEvaluator);
+ virtual void SubmitContextAndTask(String^ contextConfigStr, String^ taskConfigStr);
+ virtual void SubmitContext(String^ contextConfigStr);
+ virtual void SubmitContextAndService(String^ contextConfigStr, String^ serviceConfigStr);
+ virtual void SubmitContextAndServiceAndTask(String^ contextConfigStr, String^ serviceConfigStr, String^ taskConfigStr);
+ virtual void OnError(String^ message);
+ virtual void Close();
+ virtual String^ GetId();
+ virtual String^ GetNameServerInfo();
+ virtual IEvaluatorDescriptor^ GetEvaluatorDescriptor();
+ };
+
+ public ref class ActiveContextClr2Java : public IActiveContextClr2Java {
+ jobject _jobjectActiveContext;
+ jstring _jstringId;
+ jstring _jstringEvaluatorId;
+ JavaVM* _jvm;
+ public:
+ ActiveContextClr2Java(JNIEnv *env, jobject jallocatedEvaluator);
+ virtual void SubmitTask(String^ taskConfigStr);
+ virtual void Close();
+ virtual void OnError(String^ message);
+ virtual String^ GetId();
+ virtual String^ GetEvaluatorId();
+ virtual IEvaluatorDescriptor^ GetEvaluatorDescriptor();
+ };
+
+ public ref class EvaluatorRequestorClr2Java : public IEvaluatorRequestorClr2Java {
+ jobject _jobjectEvaluatorRequestor;
+ JavaVM* _jvm;
+ public:
+ EvaluatorRequestorClr2Java(JNIEnv *env, jobject jevaluatorRequestor);
+ virtual void OnError(String^ message);
+ virtual void Submit(IEvaluatorRequest^ request);
+ };
+
+ public ref class TaskMessageClr2Java : public ITaskMessageClr2Java {
+ jobject _jobjectTaskMessage;
+ JavaVM* _jvm;
+ jstring _jstringId;
+ public:
+ TaskMessageClr2Java(JNIEnv *env, jobject jtaskMessage);
+ virtual void OnError(String^ message);
+ virtual String^ GetId();
+ };
+
+ public ref class FailedTaskClr2Java : public IFailedTaskClr2Java {
+ jobject _jobjectFailedTask;
+ JavaVM* _jvm;
+ public:
+ FailedTaskClr2Java(JNIEnv *env, jobject jfailedTask);
+ virtual void OnError(String^ message);
+ virtual IActiveContextClr2Java^ GetActiveContext();
+ virtual String^ GetString();
+ };
+
+ public ref class RunningTaskClr2Java : public IRunningTaskClr2Java {
+ jobject _jobjectRunningTask;
+ JavaVM* _jvm;
+ jstring _jstringId;
+ public:
+ RunningTaskClr2Java(JNIEnv *env, jobject jrunningTask);
+ virtual void OnError(String^ message);
+ virtual IActiveContextClr2Java^ GetActiveContext();
+ virtual String^ GetId();
+ virtual void Send(array<byte>^ message);
+ };
+
+ public ref class FailedEvaluatorClr2Java : public IFailedEvaluatorClr2Java {
+ jobject _jobjectFailedEvaluator;
+ JavaVM* _jvm;
+ jstring _jstringId;
+ public:
+ FailedEvaluatorClr2Java(JNIEnv *env, jobject jfailedEvaluator);
+ virtual void OnError(String^ message);
+ virtual IEvaluatorRequestorClr2Java^ GetEvaluatorRequestor();
+ virtual String^ GetId();
+ };
+
+ public ref class HttpServerClr2Java : public IHttpServerBridgeClr2Java {
+ jobject _jhttpServerEventBridge;
+ JavaVM* _jvm;
+ public:
+ HttpServerClr2Java(JNIEnv *env, jobject jhttpServerEventBridge);
+ virtual void OnError(String^ message);
+ virtual String^ GetQueryString();
+ virtual void SetUriSpecification(String^ uriSpecification);
+ virtual void SetQueryResult(String^ queryResult);
+ virtual array<byte>^ GetQueryRequestData();
+ virtual void SetQueryResponseData(array<byte>^ responseData);
+ };
+
+ public ref class CompletedTaskClr2Java : public ICompletedTaskClr2Java {
+ jobject _jobjectCompletedTask;
+ JavaVM* _jvm;
+ jstring _jstringId;
+ public:
+ CompletedTaskClr2Java(JNIEnv *env, jobject jcompletedTask);
+ virtual void OnError(String^ message);
+ virtual IActiveContextClr2Java^ GetActiveContext();
+ virtual String^ GetId();
+ };
+
+ public ref class SuspendedTaskClr2Java : public ISuspendedTaskClr2Java {
+ jobject _jobjectSuspendedTask;
+ JavaVM* _jvm;
+ jstring _jstringId;
+ public:
+ SuspendedTaskClr2Java(JNIEnv *env, jobject jobjectSuspendedTask);
+ virtual void OnError(String^ message);
+ virtual IActiveContextClr2Java^ GetActiveContext();
+ virtual String^ GetId();
+ virtual array<byte>^ Get();
+ };
+
+ public ref class CompletedEvaluatorClr2Java : public ICompletedEvaluatorClr2Java {
+ jobject _jobjectCompletedEvaluator;
+ JavaVM* _jvm;
+ jstring _jstringId;
+ public:
+ CompletedEvaluatorClr2Java(JNIEnv *env, jobject jobjectCompletedEvaluator);
+ virtual void OnError(String^ message);
+ virtual String^ GetId();
+ };
+
+ public ref class ClosedContextClr2Java : public IClosedContextClr2Java {
+ jobject _jobjectClosedContext;
+ JavaVM* _jvm;
+ jstring _jstringContextId;
+ jstring _jstringEvaluatorId;
+ public:
+ ClosedContextClr2Java(JNIEnv *env, jobject jobjectClosedContext);
+ virtual void OnError(String^ message);
+ virtual String^ GetId();
+ virtual String^ GetEvaluatorId();
+ virtual IEvaluatorDescriptor^ GetEvaluatorDescriptor();
+ virtual IActiveContextClr2Java^ GetParentContext();
+ };
+
+ public ref class FailedContextClr2Java : public IFailedContextClr2Java {
+ jobject _jobjectFailedContext;
+ JavaVM* _jvm;
+ jstring _jstringContextId;
+ jstring _jstringEvaluatorId;
+ jstring _jstringParentContextId;
+ public:
+ FailedContextClr2Java(JNIEnv *env, jobject jobjectFailedContext);
+ virtual void OnError(String^ message);
+ virtual String^ GetId();
+ virtual String^ GetEvaluatorId();
+ virtual String^ GetParentId();
+ virtual IEvaluatorDescriptor^ GetEvaluatorDescriptor();
+ virtual IActiveContextClr2Java^ GetParentContext();
+ };
+
+ public ref class ContextMessageClr2Java : public IContextMessageClr2Java {
+ jobject _jobjectContextMessage;
+ JavaVM* _jvm;
+ jbyteArray _jarrayMessage;
+ jstring _jstringId;
+ jstring _jstringSourceId;
+ public:
+ ContextMessageClr2Java(JNIEnv *env, jobject jobjectContextMessage);
+ virtual void OnError(String^ message);
+ virtual array<byte>^ Get();
+ virtual String^ GetId();
+ virtual String^ GetMessageSourceId();
+ };
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/CommonUtilities.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/CommonUtilities.cpp b/lang/cs/Org.Apache.REEF.Bridge/CommonUtilities.cpp
new file mode 100644
index 0000000..5de6e75
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/CommonUtilities.cpp
@@ -0,0 +1,55 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>CommonUtilities");
+ };
+
+ IEvaluatorDescriptor^ CommonUtilities::RetrieveEvaluatorDescriptor(jobject object, JavaVM* jvm) {
+ ManagedLog::LOGGER->LogStart("CommonUtilities::GetEvaluatorDescriptor");
+ JNIEnv *env = RetrieveEnv(jvm);
+ jclass jclassActiveContext = env->GetObjectClass(object);
+ jmethodID jmidGetEvaluatorDescriptor = env->GetMethodID(jclassActiveContext, "getEvaluatorDescriptorSring", "()Ljava/lang/String;");
+
+ if (jmidGetEvaluatorDescriptor == NULL) {
+ ManagedLog::LOGGER->Log("jmidGetEvaluatorDescriptor is NULL");
+ return nullptr;
+ }
+ jstring jevaluatorDescriptorString = (jstring)env->CallObjectMethod(
+ object,
+ jmidGetEvaluatorDescriptor);
+ String^ evaluatorDescriptorString = ManagedStringFromJavaString(env, jevaluatorDescriptorString);
+ ManagedLog::LOGGER->LogStop("InteropUtil::GetEvaluatorDescriptor");
+
+ return gcnew EvaluatorDescriptorImpl(evaluatorDescriptorString);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/CompletedEvaluatorClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/CompletedEvaluatorClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/CompletedEvaluatorClr2Java.cpp
new file mode 100644
index 0000000..c961881
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/CompletedEvaluatorClr2Java.cpp
@@ -0,0 +1,62 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
+ };
+
+ CompletedEvaluatorClr2Java::CompletedEvaluatorClr2Java(JNIEnv *env, jobject jCompletedEvaluator) {
+ ManagedLog::LOGGER->LogStart("CompletedEvaluatorClr2Java::CompletedEvaluatorClr2Java");
+ pin_ptr<JavaVM*> pJavaVm = &_jvm;
+ if (env->GetJavaVM(pJavaVm) != 0) {
+ ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
+ }
+ _jobjectCompletedEvaluator = reinterpret_cast<jobject>(env->NewGlobalRef(jCompletedEvaluator));
+
+ jclass jclassCompletedEvaluator = env->GetObjectClass(_jobjectCompletedEvaluator);
+ jfieldID jidEvaluatorId = env->GetFieldID(jclassCompletedEvaluator, "evaluatorId", "Ljava/lang/String;");
+ _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectCompletedEvaluator, jidEvaluatorId)));
+ ManagedLog::LOGGER->LogStop("CompletedEvaluatorClr2Java::CompletedEvaluatorClr2Java");
+ }
+
+ void CompletedEvaluatorClr2Java::OnError(String^ message) {
+ ManagedLog::LOGGER->Log("CompletedEvaluatorClr2Java::OnError");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ HandleClr2JavaError(env, message, _jobjectCompletedEvaluator);
+ }
+
+ String^ CompletedEvaluatorClr2Java::GetId() {
+ ManagedLog::LOGGER->Log("CompletedEvaluatorClr2Java::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/492da34a/lang/cs/Org.Apache.REEF.Bridge/CompletedTaskClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/CompletedTaskClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/CompletedTaskClr2Java.cpp
new file mode 100644
index 0000000..be9fe31
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/CompletedTaskClr2Java.cpp
@@ -0,0 +1,73 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
+ };
+
+ CompletedTaskClr2Java::CompletedTaskClr2Java(JNIEnv *env, jobject jobjectCompletedTask) {
+ ManagedLog::LOGGER->LogStart("CompletedTaskClr2Java::CompletedTaskClr2Java");
+ pin_ptr<JavaVM*> pJavaVm = &_jvm;
+ if (env->GetJavaVM(pJavaVm) != 0) {
+ ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
+ }
+ _jobjectCompletedTask = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectCompletedTask));
+
+ jclass jclassCompletedTask = env->GetObjectClass(_jobjectCompletedTask);
+ jfieldID jidTaskId = env->GetFieldID(jclassCompletedTask, "taskId", "Ljava/lang/String;");
+ _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectCompletedTask, jidTaskId)));
+ ManagedLog::LOGGER->LogStop("CompletedTaskClr2Java::CompletedTaskClr2Java");
+ }
+
+ void CompletedTaskClr2Java::OnError(String^ message) {
+ ManagedLog::LOGGER->Log("CompletedTaskClr2Java::OnError");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ HandleClr2JavaError(env, message, _jobjectCompletedTask);
+ }
+
+ IActiveContextClr2Java^ CompletedTaskClr2Java::GetActiveContext() {
+ ManagedLog::LOGGER->LogStart("CompletedTaskClr2Java::GetActiveContext");
+ JNIEnv *env = RetrieveEnv(_jvm);
+
+ jclass jclassCompletedTask = env->GetObjectClass(_jobjectCompletedTask);
+ jfieldID jidActiveContext = env->GetFieldID(jclassCompletedTask, "jactiveContext", "Lorg/apache/reef/javabridge/ActiveContextBridge;");
+ jobject jobjectActiveContext = env->GetObjectField(_jobjectCompletedTask, jidActiveContext);
+ ManagedLog::LOGGER->LogStop("CompletedTaskClr2Java::GetActiveContext");
+ return gcnew ActiveContextClr2Java(env, jobjectActiveContext);
+ }
+
+ String^ CompletedTaskClr2Java::GetId() {
+ ManagedLog::LOGGER->Log("CompletedTaskClr2Java::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/492da34a/lang/cs/Org.Apache.REEF.Bridge/ContextMessageClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/ContextMessageClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/ContextMessageClr2Java.cpp
new file mode 100644
index 0000000..c385e46
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/ContextMessageClr2Java.cpp
@@ -0,0 +1,80 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
+ };
+ ContextMessageClr2Java::ContextMessageClr2Java(JNIEnv *env, jobject jobjectContextMessage) {
+ ManagedLog::LOGGER->LogStart("ContextMessageClr2Java::ContextMessageClr2Java");
+
+ pin_ptr<JavaVM*> pJavaVm = &_jvm;
+ if (env->GetJavaVM(pJavaVm) != 0) {
+ ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
+ }
+ _jobjectContextMessage = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectContextMessage));
+ jclass jclassContextMessage = env->GetObjectClass(_jobjectContextMessage);
+
+ jfieldID jidId = env->GetFieldID(jclassContextMessage, "contextMessageId", "Ljava/lang/String;");
+ jfieldID jidSourceId = env->GetFieldID(jclassContextMessage, "messageSourceId", "Ljava/lang/String;");
+ jfieldID jidMessage = env->GetFieldID(jclassContextMessage, "message", "()[B");
+
+ _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectContextMessage, jidId)));
+ _jstringSourceId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectContextMessage, jidSourceId)));
+ _jarrayMessage = reinterpret_cast<jbyteArray>(env->NewGlobalRef(env->GetObjectField(_jobjectContextMessage, jidMessage)));
+
+ ManagedLog::LOGGER->LogStop("ContextMessageClr2Java::ContextMessageClr2Java");
+ }
+
+ String^ ContextMessageClr2Java::GetId() {
+ ManagedLog::LOGGER->Log("ContextMessageClr2Java::GetId");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringId);
+ }
+
+ String^ ContextMessageClr2Java::GetMessageSourceId() {
+ ManagedLog::LOGGER->Log("ContextMessageClr2Java::GetMessageSourceId");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringSourceId);
+ }
+
+ array<byte>^ ContextMessageClr2Java::Get() {
+ ManagedLog::LOGGER->Log("ContextMessageClr2Java::Get");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedByteArrayFromJavaByteArray(env, _jarrayMessage);
+ }
+
+ void ContextMessageClr2Java::OnError(String^ message) {
+ ManagedLog::LOGGER->Log("ContextMessageClr2Java::OnError");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ HandleClr2JavaError(env, message, _jobjectContextMessage);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/EvaluatorRequestorClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/EvaluatorRequestorClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/EvaluatorRequestorClr2Java.cpp
new file mode 100644
index 0000000..2daed9e
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/EvaluatorRequestorClr2Java.cpp
@@ -0,0 +1,73 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
+ };
+
+ EvaluatorRequestorClr2Java::EvaluatorRequestorClr2Java(JNIEnv *env, jobject jevaluatorRequestor) {
+ ManagedLog::LOGGER->LogStart("EvaluatorRequestorClr2Java::EvaluatorRequestorClr2Java");
+ pin_ptr<JavaVM*> pJavaVm = &_jvm;
+ if (env->GetJavaVM(pJavaVm) != 0) {
+ ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
+ }
+ _jobjectEvaluatorRequestor = reinterpret_cast<jobject>(env->NewGlobalRef(jevaluatorRequestor));
+ ManagedLog::LOGGER->LogStop("EvaluatorRequestorClr2Java::EvaluatorRequestorClr2Java");
+ }
+
+ void EvaluatorRequestorClr2Java::Submit(IEvaluatorRequest^ request) {
+ ManagedLog::LOGGER->LogStart("EvaluatorRequestorClr2Java::Submit");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclassEvaluatorRequestor = env->GetObjectClass(_jobjectEvaluatorRequestor);
+ jmethodID jmidSubmit = env->GetMethodID(jclassEvaluatorRequestor, "submit", "(IIILjava/lang/String;)V");
+
+ if (jmidSubmit == NULL) {
+ fprintf(stdout, " jmidSubmit is NULL\n");
+ fflush(stdout);
+ return;
+ }
+ env->CallObjectMethod(
+ _jobjectEvaluatorRequestor,
+ jmidSubmit,
+ request->Number,
+ request->MemoryMegaBytes,
+ request->VirtualCore,
+ JavaStringFromManagedString(env, request->Rack));
+ ManagedLog::LOGGER->LogStop("EvaluatorRequestorClr2Java::Submit");
+ }
+
+ void EvaluatorRequestorClr2Java::OnError(String^ message) {
+ ManagedLog::LOGGER->Log("EvaluatorRequestorClr2Java::OnError");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ HandleClr2JavaError(env, message, _jobjectEvaluatorRequestor);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/FailedContextClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/FailedContextClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/FailedContextClr2Java.cpp
new file mode 100644
index 0000000..5a96202
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/FailedContextClr2Java.cpp
@@ -0,0 +1,98 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
+ };
+ FailedContextClr2Java::FailedContextClr2Java(JNIEnv *env, jobject jobjectFailedContext) {
+ ManagedLog::LOGGER->LogStart("FailedContextClr2Java::FailedContextClr2Java");
+
+ pin_ptr<JavaVM*> pJavaVm = &_jvm;
+ if (env->GetJavaVM(pJavaVm) != 0) {
+ ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
+ }
+ _jobjectFailedContext = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectFailedContext));
+ jclass jclassFailedContext = env->GetObjectClass(_jobjectFailedContext);
+
+ jfieldID jidContextId = env->GetFieldID(jclassFailedContext, "contextId", "Ljava/lang/String;");
+ jfieldID jidEvaluatorId = env->GetFieldID(jclassFailedContext, "evaluatorId", "Ljava/lang/String;");
+ jfieldID jidParentId = env->GetFieldID(jclassFailedContext, "parentContextId", "Ljava/lang/String;");
+
+ _jstringContextId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectFailedContext, jidContextId)));
+ _jstringEvaluatorId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectFailedContext, jidEvaluatorId)));
+ _jstringParentContextId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectFailedContext, jidParentId)));
+
+ ManagedLog::LOGGER->LogStop("FailedContextClr2Java::FailedContextClr2Java");
+ }
+
+ IActiveContextClr2Java^ FailedContextClr2Java::GetParentContext() {
+ ManagedLog::LOGGER->LogStart("FailedContextClr2Java::GetParentContext");
+
+ JNIEnv *env = RetrieveEnv(_jvm);
+
+ jclass jclassFailedContext = env->GetObjectClass(_jobjectFailedContext);
+ jfieldID jidParentContext = env->GetFieldID(jclassFailedContext, "parentContext", "Lorg/apache/reef/javabridge/ActiveContextBridge;");
+ jobject jobjectParentContext = env->GetObjectField(_jobjectFailedContext, jidParentContext);
+ ManagedLog::LOGGER->LogStop("FailedContextClr2Java::GetParentContext");
+
+ return gcnew ActiveContextClr2Java(env, jobjectParentContext);
+ }
+
+ String^ FailedContextClr2Java::GetId() {
+ ManagedLog::LOGGER->Log("FailedContextClr2Java::GetId");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringContextId);
+ }
+
+ String^ FailedContextClr2Java::GetEvaluatorId() {
+ ManagedLog::LOGGER->Log("FailedContextClr2Java::GetEvaluatorId");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringEvaluatorId);
+ }
+
+ String^ FailedContextClr2Java::GetParentId() {
+ ManagedLog::LOGGER->Log("FailedContextClr2Java::GetParentId");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringParentContextId);
+ }
+
+ IEvaluatorDescriptor^ FailedContextClr2Java::GetEvaluatorDescriptor() {
+ ManagedLog::LOGGER->LogStart("FailedContextClr2Java::GetEvaluatorDescriptor");
+ return CommonUtilities::RetrieveEvaluatorDescriptor(_jobjectFailedContext, _jvm);
+ }
+
+ void FailedContextClr2Java::OnError(String^ message) {
+ ManagedLog::LOGGER->Log("FailedContextClr2Java::OnError");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ HandleClr2JavaError(env, message, _jobjectFailedContext);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/FailedEvaluatorClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/FailedEvaluatorClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/FailedEvaluatorClr2Java.cpp
new file mode 100644
index 0000000..615e09f
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/FailedEvaluatorClr2Java.cpp
@@ -0,0 +1,76 @@
+/**
+ * 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 Org {
+ namespace Apache {
+ namespace REEF {
+ namespace Driver {
+ namespace Bridge {
+ namespace Clr2java {
+ ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
+ };
+
+ FailedEvaluatorClr2Java::FailedEvaluatorClr2Java(JNIEnv *env, jobject jobjectFailedEvaluator) {
+ ManagedLog::LOGGER->LogStart("FailedEvaluatorClr2Java::FailedEvaluatorClr2Java");
+ pin_ptr<JavaVM*> pJavaVm = &_jvm;
+ if (env->GetJavaVM(pJavaVm) != 0) {
+ ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
+ }
+ _jobjectFailedEvaluator = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectFailedEvaluator));
+
+ jclass jclassFailedEvaluator = env->GetObjectClass(_jobjectFailedEvaluator);
+ jfieldID jidEvaluatorId = env->GetFieldID(jclassFailedEvaluator, "evaluatorId", "Ljava/lang/String;");
+ _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectFailedEvaluator, jidEvaluatorId)));
+ ManagedLog::LOGGER->LogStop("FailedEvaluatorClr2Java::FailedEvaluatorClr2Java");
+ }
+
+ IEvaluatorRequestorClr2Java^ FailedEvaluatorClr2Java::GetEvaluatorRequestor() {
+ ManagedLog::LOGGER->LogStart("FailedEvaluatorClr2Java::GetEvaluatorRequestor");
+ JNIEnv *env = RetrieveEnv(_jvm);
+
+ jclass jclassFailedEvaluator = env->GetObjectClass(_jobjectFailedEvaluator);
+ jfieldID jidEvaluatorRequestor = env->GetFieldID(jclassFailedEvaluator, "evaluatorRequestorBridge", "Lorg/apache/reef/javabridge/EvaluatorRequestorBridge;");
+ jobject jobjectEvaluatorRequestor = env->GetObjectField(_jobjectFailedEvaluator, jidEvaluatorRequestor);
+ ManagedLog::LOGGER->LogStop("FailedEvaluatorClr2Java::GetEvaluatorRequestor");
+ return gcnew EvaluatorRequestorClr2Java(env, jobjectEvaluatorRequestor);
+ }
+
+ String^ FailedEvaluatorClr2Java::GetId() {
+ ManagedLog::LOGGER->Log("FailedEvaluatorClr2Java::GetId");
+
+ JNIEnv *env = RetrieveEnv(_jvm);
+ return ManagedStringFromJavaString(env, _jstringId);
+ }
+
+ void FailedEvaluatorClr2Java::OnError(String^ message) {
+ ManagedLog::LOGGER->Log("FailedEvaluatorClr2Java::OnError");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ HandleClr2JavaError(env, message, _jobjectFailedEvaluator);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/FailedTaskClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/FailedTaskClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/FailedTaskClr2Java.cpp
new file mode 100644
index 0000000..b27b13d
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/FailedTaskClr2Java.cpp
@@ -0,0 +1,83 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
+ };
+
+ FailedTaskClr2Java::FailedTaskClr2Java(JNIEnv *env, jobject jobjectFailedTask) {
+ ManagedLog::LOGGER->LogStart("FailedTaskClr2Java::AllocatedEvaluatorClr2Java");
+ pin_ptr<JavaVM*> pJavaVm = &_jvm;
+ if (env->GetJavaVM(pJavaVm) != 0) {
+ ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
+ }
+ _jobjectFailedTask = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectFailedTask));
+ ManagedLog::LOGGER->LogStop("FailedTaskClr2Java::AllocatedEvaluatorClr2Java");
+ }
+
+ IActiveContextClr2Java^ FailedTaskClr2Java::GetActiveContext() {
+ ManagedLog::LOGGER->LogStart("FailedTaskClr2Java::GetActiveContext");
+
+ JNIEnv *env = RetrieveEnv(_jvm);
+
+ jclass jclassFailedTask = env->GetObjectClass(_jobjectFailedTask);
+ jfieldID jidActiveContext = env->GetFieldID(jclassFailedTask, "jactiveContext", "Lorg/apache/reef/javabridge/ActiveContextBridge;");
+ jobject jobjectActiveContext = env->GetObjectField(_jobjectFailedTask, jidActiveContext);
+
+ ManagedLog::LOGGER->LogStop("FailedTaskClr2Java::GetActiveContext");
+ return gcnew ActiveContextClr2Java(env, jobjectActiveContext);
+ }
+
+ String^ FailedTaskClr2Java::GetString() {
+ ManagedLog::LOGGER->LogStart("FailedTaskClr2Java::GetString");
+ JNIEnv *env = RetrieveEnv(_jvm);
+
+ jclass jclassFailedTask = env->GetObjectClass(_jobjectFailedTask);
+ jmethodID jmidGetFailedTaskString = env->GetMethodID(jclassFailedTask, "getFailedTaskString", "()Ljava/lang/String;");
+
+ if (jmidGetFailedTaskString == NULL) {
+ ManagedLog::LOGGER->LogStart("jmidGetFailedTaskString is NULL");
+ return nullptr;
+ }
+ jstring jFailedTaskString = (jstring)env->CallObjectMethod(
+ _jobjectFailedTask,
+ jmidGetFailedTaskString);
+ ManagedLog::LOGGER->LogStop("FailedTaskClr2Java::GetString");
+ return ManagedStringFromJavaString(env, jFailedTaskString);
+ }
+
+ void FailedTaskClr2Java::OnError(String^ message) {
+ ManagedLog::LOGGER->Log("FailedTaskClr2Java::OnError");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ HandleClr2JavaError(env, message, _jobjectFailedTask);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/HttpServerClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/HttpServerClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/HttpServerClr2Java.cpp
new file mode 100644
index 0000000..f8a819d
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/HttpServerClr2Java.cpp
@@ -0,0 +1,139 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ ref class ManagedLog {
+ internal:
+ static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
+ };
+
+ HttpServerClr2Java::HttpServerClr2Java(JNIEnv *env, jobject jhttpServerEventBridge) {
+ ManagedLog::LOGGER->LogStart("HttpServerClr2Java::HttpServerClr2Java");
+ pin_ptr<JavaVM*> pJavaVm = &_jvm;
+ if (env->GetJavaVM(pJavaVm) != 0) {
+ ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
+ }
+ _jhttpServerEventBridge = reinterpret_cast<jobject>(env->NewGlobalRef(jhttpServerEventBridge));
+ ManagedLog::LOGGER->LogStop("HttpServerClr2Java::HttpServerClr2Java");
+ }
+
+ String^ HttpServerClr2Java::GetQueryString() {
+ ManagedLog::LOGGER->LogStart("HttpServerClr2Java::GetQueryString");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclasshttpServerEventBridge = env->GetObjectClass(_jhttpServerEventBridge);
+ jmethodID jmidgetQueryString = env->GetMethodID(jclasshttpServerEventBridge, "getQueryString", "()Ljava/lang/String;");
+ if (jmidgetQueryString == NULL) {
+ fprintf(stdout, " jmidgetQueryString is NULL\n");
+ fflush(stdout);
+ return nullptr;
+ }
+ jstring jQueryString = (jstring)env->CallObjectMethod(
+ _jhttpServerEventBridge,
+ jmidgetQueryString);
+
+ ManagedLog::LOGGER->LogStop("HttpServerClr2Java::GetQueryString");
+ return ManagedStringFromJavaString(env, jQueryString);
+ }
+
+ array<byte>^ HttpServerClr2Java::GetQueryRequestData() {
+ ManagedLog::LOGGER->LogStart("HttpServerClr2Java::GetQueryRequestData");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclasshttpServerEventBridge = env->GetObjectClass(_jhttpServerEventBridge);
+ jmethodID jmidgetQueryBytes = env->GetMethodID(jclasshttpServerEventBridge, "getQueryRequestData", "()[B");
+
+ if (jmidgetQueryBytes == NULL) {
+ ManagedLog::LOGGER->Log("jmidgetQueryBytes is NULL");
+ return nullptr;
+ }
+ jbyteArray jQueryBytes = (jbyteArray)env->CallObjectMethod(
+ _jhttpServerEventBridge,
+ jmidgetQueryBytes);
+
+ ManagedLog::LOGGER->LogStop("HttpServerClr2Java::GetQueryRequestData");
+ return ManagedByteArrayFromJavaByteArray(env, jQueryBytes);
+ }
+
+ void HttpServerClr2Java::SetQueryResult(String^ queryResult) {
+ ManagedLog::LOGGER->LogStart("HttpServerClr2Java::SetQueryResult");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclasshttpServerEventBridge = env->GetObjectClass(_jhttpServerEventBridge);
+ jmethodID jmidsetQueryResult = env->GetMethodID(jclasshttpServerEventBridge, "setQueryResult", "(Ljava/lang/String;)V");
+
+ if (jmidsetQueryResult == NULL) {
+ ManagedLog::LOGGER->Log("jmidsetQueryResult is NULL");
+ return;
+ }
+ env->CallObjectMethod(
+ _jhttpServerEventBridge,
+ jmidsetQueryResult,
+ JavaStringFromManagedString(env, queryResult));
+ ManagedLog::LOGGER->LogStop("HttpServerClr2Java::SetQueryResult");
+ }
+
+ void HttpServerClr2Java::SetQueryResponseData(array<byte>^ queryResponseData) {
+ ManagedLog::LOGGER->LogStart("HttpServerClr2Java::SetQueryResponseData");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclasshttpServerEventBridge = env->GetObjectClass(_jhttpServerEventBridge);
+ jmethodID jmidsetQueryResult = env->GetMethodID(jclasshttpServerEventBridge, "setQueryResponseData", "([B)V");
+
+ if (jmidsetQueryResult == NULL) {
+ ManagedLog::LOGGER->Log("jmidsetQueryResult is NULL");
+ return;
+ }
+ env->CallObjectMethod(
+ _jhttpServerEventBridge,
+ jmidsetQueryResult,
+ JavaByteArrayFromManagedByteArray(env, queryResponseData));
+ ManagedLog::LOGGER->LogStop("HttpServerClr2Java::SetQueryResponseData");
+ }
+
+ void HttpServerClr2Java::SetUriSpecification(String^ uriSpecification) {
+ ManagedLog::LOGGER->LogStart("HttpServerClr2Java::SetUriSpecification");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ jclass jclasshttpServerEventBridge = env->GetObjectClass(_jhttpServerEventBridge);
+ jmethodID jmidsetUriSpecification = env->GetMethodID(jclasshttpServerEventBridge, "setUriSpecification", "(Ljava/lang/String;)V");
+
+ if (jmidsetUriSpecification == NULL) {
+ ManagedLog::LOGGER->Log("jmidsetUriSpecification is NULL");
+ return;
+ }
+ env->CallObjectMethod(
+ _jhttpServerEventBridge,
+ jmidsetUriSpecification,
+ JavaStringFromManagedString(env, uriSpecification));
+ ManagedLog::LOGGER->LogStop("HttpServerClr2Java::SetUriSpecification");
+ }
+
+ void HttpServerClr2Java::OnError(String^ message) {
+ ManagedLog::LOGGER->Log("HttpServerClr2Java::OnError");
+ JNIEnv *env = RetrieveEnv(_jvm);
+ HandleClr2JavaError(env, message, _jhttpServerEventBridge);
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/InteropAssemblies.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropAssemblies.h b/lang/cs/Org.Apache.REEF.Bridge/InteropAssemblies.h
new file mode 100644
index 0000000..2e80d71
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/InteropAssemblies.h
@@ -0,0 +1,40 @@
+/**
+ * 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);
+};
[2/5] incubator-reef git commit: [REEF-194] Merge the bridge into a
single DLL
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/InteropLogger.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropLogger.cpp b/lang/cs/Org.Apache.REEF.Bridge/InteropLogger.cpp
new file mode 100644
index 0000000..418bd55
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/InteropLogger.cpp
@@ -0,0 +1,50 @@
+/**
+ * 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/492da34a/lang/cs/Org.Apache.REEF.Bridge/InteropLogger.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropLogger.h b/lang/cs/Org.Apache.REEF.Bridge/InteropLogger.h
new file mode 100644
index 0000000..0c0d162
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/InteropLogger.h
@@ -0,0 +1,47 @@
+/**
+ * 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 "Org.Apache.REEF.Driver.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/492da34a/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.cpp b/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.cpp
new file mode 100644
index 0000000..821c0d1
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.cpp
@@ -0,0 +1,88 @@
+/**
+ * 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/492da34a/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.h b/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.h
new file mode 100644
index 0000000..a79e85e
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/InteropReturnInfo.h
@@ -0,0 +1,57 @@
+/**
+ * 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 "Org.Apache.REEF.Driver.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/492da34a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp
new file mode 100644
index 0000000..be24f32
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp
@@ -0,0 +1,129 @@
+/**
+ * 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/492da34a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h
new file mode 100644
index 0000000..2d95bcc
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h
@@ -0,0 +1,65 @@
+/**
+ * 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/492da34a/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp b/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp
new file mode 100644
index 0000000..2b8c7da
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp
@@ -0,0 +1,492 @@
+/**
+ * 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::Clr2java;
+
+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/492da34a/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.h b/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.h
new file mode 100644
index 0000000..61d9d0a
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.h
@@ -0,0 +1,33 @@
+/**
+ * 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/492da34a/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.nuspec
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.nuspec b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.nuspec
new file mode 100644
index 0000000..2c869e2
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.nuspec
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<package >
+ <metadata>
+ <id>Org.Apache.REEF.Bridge</id>
+ <version>$version$</version>
+ <title>Org.Apache.REEF.Bridge</title>
+ <authors>The Apache REEF project</authors>
+ <owners>The Apache REEF project</owners>
+ <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <projectUrl>http://reef.incubator.apache.org/</projectUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <description>Clr Bridge for REEF.NET</description>
+ <copyright>The Apache Software Foundation</copyright>
+ <dependencies>
+ <dependency id="Org.Apache.REEF.Driver" version="$version$" />
+ </dependencies>
+ </metadata>
+ <files>
+ <file src="..\bin\$Platform$\$Configuration$\Org.Apache.REEF.Bridge\Org.Apache.REEF.Bridge.dll" target="lib\net45" />
+ <file src="..\bin\$Platform$\$Configuration$\Org.Apache.REEF.Bridge\Org.Apache.REEF.Bridge.pdb" target="lib\net45" />
+ </files>
+</package>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj
new file mode 100644
index 0000000..88446b6
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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 DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <BuildInParallel>false</BuildInParallel>
+ <Configuration Condition="'$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition="'$(Platform)' == ''">x64</Platform>
+ <SolutionDir Condition="'$(SolutionDir)' == ''">..</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ </PropertyGroup>
+ <Import Project="$(SolutionDir)\build.props" />
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{4E69D40A-26D6-4D4A-B96D-729946C07FE1}</ProjectGuid>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <Keyword>ManagedCProj</Keyword>
+ <RootNamespace>OrgApacheREEFBridge</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CLRSupport>true</CLRSupport>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v120</PlatformToolset>
+ <CLRSupport>true</CLRSupport>
+ <CharacterSet>Unicode</CharacterSet>
+ <RestorePackages>true</RestorePackages>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </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 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|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <ReferencePath>..\bin\$(Platform)\$(Configuration)\Org.Apache.REEF.Driver;..\bin\x64\Release\Org.Apache.REEF.Driver;$(ReferencePath)</ReferencePath>
+ <OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <ReferencePath>..\bin\$(Platform)\$(Configuration)\Org.Apache.REEF.Driver;..\bin\x64\Release\Org.Apache.REEF.Driver;$(ReferencePath)</ReferencePath>
+ <OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <AdditionalIncludeDirectories>..\..\java\reef-bridge-java\target\classes;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>
+ </AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\bin\$(Platform)\$(Configuration)\Org.Apache.REEF.Driver;..\bin\x64\$(Configuration)\Org.Apache.REEF.Driver;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalOptions>/ignore:4248 %(AdditionalOptions)</AdditionalOptions>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <AdditionalIncludeDirectories>..\..\java\reef-bridge-java\target\classes;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>
+ </AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\bin\$(Platform)\$(Configuration)\Org.Apache.REEF.Driver;..\bin\x64\$(Configuration)\Org.Apache.REEF.Driver;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalOptions>/ignore:4248 %(AdditionalOptions)</AdditionalOptions>
+ </Link>
+ </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" />
+ <ClInclude Include="JavaClrBridge.h" />
+ <ClInclude Include="resource.h" />
+ <ClInclude Include="Stdafx.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="Stdafx.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="SuspendedTaskClr2Java.cpp" />
+ <ClCompile Include="TaskMessageClr2Java.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <Text Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="app.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="app.ico" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Org.Apache.REEF.Bridge.JAR\Org.Apache.REEF.Bridge.JAR.csproj">
+ <Project>{62905c7c-1a7e-4923-b78d-1bf42d7fad40}</Project>
+ <Private>false</Private>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
+ <LinkLibraryDependencies>false</LinkLibraryDependencies>
+ <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
+ </ProjectReference>
+ <ProjectReference Include="..\Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj">
+ <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj.filters
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj.filters b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj.filters
new file mode 100644
index 0000000..2bb0932
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj.filters
@@ -0,0 +1,136 @@
+<?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;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="Org.Apache.REEF.JavaClrBridge.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="Stdafx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="BinaryUtil.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="Clr2JavaImpl.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="InteropAssemblies.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="InteropLogger.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="InteropReturnInfo.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="InteropUtil.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="JavaClrBridge.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="Org.Apache.REEF.JavaClrBridge.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="AssemblyInfo.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="Stdafx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ActiveContextClr2Java.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="AllocatedEvaluatorClr2Java.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="AssemblyUtil.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="BinaryUtil.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="CompletedEvaluatorClr2Java.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="CompletedTaskClr2Java.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ContextMessageClr2Java.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="EvaluatorRequestorClr2Java.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="FailedContextClr2Java.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="FailedEvaluatorClr2Java.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="FailedTaskClr2Java.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="HttpServerClr2Java.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="InteropLogger.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="InteropReturnInfo.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="InteropUtil.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="JavaClrBridge.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="TaskMessageClr2Java.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <Text Include="ReadMe.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="app.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <Image Include="app.ico">
+ <Filter>Resource Files</Filter>
+ </Image>
+ </ItemGroup>
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/ReadMe.txt
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/ReadMe.txt b/lang/cs/Org.Apache.REEF.Bridge/ReadMe.txt
new file mode 100644
index 0000000..804fb33
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/ReadMe.txt
@@ -0,0 +1,57 @@
+/**
+ * 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 : Org.Apache.REEF.JavaClrBridge Project Overview
+========================================================================
+
+AppWizard has created this Org.Apache.REEF.JavaClrBridge DLL for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your Org.Apache.REEF.JavaClrBridge application.
+
+Org.Apache.REEF.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.
+
+Org.Apache.REEF.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).
+
+Org.Apache.REEF.JavaClrBridge.cpp
+ This is the main DLL source file.
+
+Org.Apache.REEF.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/492da34a/lang/cs/Org.Apache.REEF.Bridge/RunningTaskClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/RunningTaskClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/RunningTaskClr2Java.cpp
new file mode 100644
index 0000000..dfc8ae3
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/RunningTaskClr2Java.cpp
@@ -0,0 +1,94 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ 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/492da34a/lang/cs/Org.Apache.REEF.Bridge/Stdafx.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/Stdafx.cpp b/lang/cs/Org.Apache.REEF.Bridge/Stdafx.cpp
new file mode 100644
index 0000000..9a10a6e
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/Stdafx.cpp
@@ -0,0 +1,24 @@
+/**
+* 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.
+*/
+
+// stdafx.cpp : source file that includes just the standard includes
+// Org.Apache.REEF.JavaClrBridge.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/Stdafx.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/Stdafx.h b/lang/cs/Org.Apache.REEF.Bridge/Stdafx.h
new file mode 100644
index 0000000..add9279
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/Stdafx.h
@@ -0,0 +1,25 @@
+/**
+* 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.
+*/
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/SuspendedTaskClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/SuspendedTaskClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/SuspendedTaskClr2Java.cpp
new file mode 100644
index 0000000..e052d24
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/SuspendedTaskClr2Java.cpp
@@ -0,0 +1,87 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ 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/492da34a/lang/cs/Org.Apache.REEF.Bridge/TaskMessageClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/TaskMessageClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/TaskMessageClr2Java.cpp
new file mode 100644
index 0000000..1ee79e9
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/TaskMessageClr2Java.cpp
@@ -0,0 +1,62 @@
+/**
+ * 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 {
+ namespace Clr2java {
+ 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/492da34a/lang/cs/Org.Apache.REEF.Bridge/app.ico
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/app.ico b/lang/cs/Org.Apache.REEF.Bridge/app.ico
new file mode 100644
index 0000000..d06d92b
Binary files /dev/null and b/lang/cs/Org.Apache.REEF.Bridge/app.ico differ
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/app.rc
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/app.rc b/lang/cs/Org.Apache.REEF.Bridge/app.rc
new file mode 100644
index 0000000..eab4306
Binary files /dev/null and b/lang/cs/Org.Apache.REEF.Bridge/app.rc differ
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Bridge/resource.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/resource.h b/lang/cs/Org.Apache.REEF.Bridge/resource.h
new file mode 100644
index 0000000..a0daa2a
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Bridge/resource.h
@@ -0,0 +1,22 @@
+/**
+* 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.
+*/
+
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by app.rc
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Client/CLRBridgeClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/CLRBridgeClient.cs b/lang/cs/Org.Apache.REEF.Client/CLRBridgeClient.cs
index 00b0a9a..5ec77c6 100644
--- a/lang/cs/Org.Apache.REEF.Client/CLRBridgeClient.cs
+++ b/lang/cs/Org.Apache.REEF.Client/CLRBridgeClient.cs
@@ -36,8 +36,8 @@ namespace Org.Apache.REEF.Client
public class CLRBridgeClient
{
public const string ReefHome = "REEF_HOME";
- public const string DefaultClrFolder = @"lang\reef-bridge\dotnetHello";
- public const string DefaultReefJar = @"lang\reef-bridge\target\" + Constants.BridgeJarFileName;
+ public const string DefaultClrFolder = @"lang\java\reef-bridge-java\dotnetHello";
+ public const string DefaultReefJar = @"lang\java\reef-bridge-java\target\" + Constants.JavaBridgeJarFileName;
public const string DefaultRunCommand = "run.cmd";
private static string _clrFolder = null;
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj b/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
index 9eac07f..9410aea 100644
--- a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
+++ b/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj
@@ -74,6 +74,10 @@ under the License.
<Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
<Name>Org.Apache.REEF.Examples</Name>
</ProjectReference>
+ <ProjectReference Include="..\Org.Apache.REEF.Bridge\Org.Apache.REEF.Bridge.vcxproj">
+ <Project>{4e69d40a-26d6-4d4a-b96d-729946c07fe1}</Project>
+ <Name>Org.Apache.REEF.Bridge</Name>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrClientHelper.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrClientHelper.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrClientHelper.cs
index 8ccade9..d032241 100644
--- a/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrClientHelper.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/ClrClientHelper.cs
@@ -32,7 +32,7 @@ namespace Org.Apache.REEF.Driver.Bridge
{
private static readonly Logger LOGGER = Logger.GetLogger(typeof(ClrClientHelper));
- public static void Run(HashSet<string> appDlls, IConfiguration driverBridgeConfig, DriverSubmissionSettings driverSubmissionSettings, string reefJar = Constants.BridgeJarFileName, string runCommand = "run.cmd", string clrFolder = ".", string className = Constants.BridgeLaunchClass)
+ public static void Run(HashSet<string> appDlls, IConfiguration driverBridgeConfig, DriverSubmissionSettings driverSubmissionSettings, string reefJar = Constants.JavaBridgeJarFileName, string runCommand = "run.cmd", string clrFolder = ".", string className = Constants.BridgeLaunchClass)
{
using (LOGGER.LogFunction("ClrHandlerHelper::Run"))
{
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Driver/Constants.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Constants.cs b/lang/cs/Org.Apache.REEF.Driver/Constants.cs
index efbe999..0ec5659 100644
--- a/lang/cs/Org.Apache.REEF.Driver/Constants.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/Constants.cs
@@ -71,7 +71,7 @@ namespace Org.Apache.REEF.Driver
public const string DriverAppDirectory = "ReefDriverAppDlls";
- public const string BridgeJarFileName = "reef-bridge-0.11.0-incubating-SNAPSHOT-shaded.jar";
+ public const string JavaBridgeJarFileName = "reef-bridge-java-0.11.0-incubating-SNAPSHOT-shaded.jar";
public const string BridgeLaunchClass = "org.apache.reef.javabridge.generic.Launch";
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Driver/DriverConfigGenerator.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/DriverConfigGenerator.cs b/lang/cs/Org.Apache.REEF.Driver/DriverConfigGenerator.cs
index ec4aa37..c0e1691 100644
--- a/lang/cs/Org.Apache.REEF.Driver/DriverConfigGenerator.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/DriverConfigGenerator.cs
@@ -140,7 +140,7 @@ namespace Org.Apache.REEF.Driver
private static void ExtractConfigFromJar(string jarfileFolder)
{
- string jarfile = jarfileFolder + Constants.BridgeJarFileName;
+ string jarfile = jarfileFolder + Constants.JavaBridgeJarFileName;
List<string> files = new List<string>();
files.Add(DriverConfigGenerator.HttpServerConfigFile);
files.Add(DriverConfigGenerator.JobDriverConfigFile);
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Driver/InteropInterface/IInteropReturnInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/InteropInterface/IInteropReturnInfo.cs b/lang/cs/Org.Apache.REEF.Driver/InteropInterface/IInteropReturnInfo.cs
new file mode 100644
index 0000000..b3b930a
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/InteropInterface/IInteropReturnInfo.cs
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+using System;
+
+namespace Microsoft.Reef.Interop
+{
+ public interface IInteropReturnInfo
+ {
+ void AddExceptionString(String exceptionString);
+ Boolean HasExceptions();
+ void SetReturnCode(int rc);
+ int GetReturnCode();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Driver/InteropInterface/ILogger.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/InteropInterface/ILogger.cs b/lang/cs/Org.Apache.REEF.Driver/InteropInterface/ILogger.cs
new file mode 100644
index 0000000..4a7f9b2
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Driver/InteropInterface/ILogger.cs
@@ -0,0 +1,37 @@
+/**
+ * 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.
+ */
+using System;
+
+namespace Microsoft.Reef.Interop
+{
+ public enum TraceLevel : int
+ {
+ NoTrace = Int32.MaxValue,
+
+ Error = 1000,
+ Warning = 900,
+ Info = 800,
+ Verbose = 300,
+ }
+
+ public interface ILogger
+ {
+ void Log(TraceLevel traceLevel, String message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj b/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj
index c50dab8..443a3d5 100644
--- a/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj
+++ b/lang/cs/Org.Apache.REEF.Driver/Org.Apache.REEF.Driver.csproj
@@ -135,6 +135,8 @@ under the License.
<Compile Include="Evaluator\IFailedEvaluator.cs" />
<Compile Include="FailedJob.cs" />
<Compile Include="IDriver.cs" />
+ <Compile Include="InteropInterface\IInteropReturnInfo.cs" />
+ <Compile Include="InteropInterface\ILogger.cs" />
<Compile Include="IStartHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Task\ICompletedTask.cs" />
[5/5] incubator-reef git commit: [REEF-194] Merge the bridge into a
single DLL
Posted by we...@apache.org.
[REEF-194] Merge the bridge into a single DLL
This merges the native and managed parts of the bridge into a single
DLL: `Org.Apache.REEF.Bridge.dll`. There is a NuGet for it
The change covers:
* Move files in lang\cpp module into Org.Apache.REEF.sln as a project
Org.Apache.REEF.Bridge. The dependency on Driver.dll should be set
within Org.Apache.REEF.Bridge.sln
* Create NuGet for the Org.Apache.REEF.Bridge.dll
* From REEF.Client, reference jar file from lang\java\reef-bridge-java
to remove the dependency on lang\reef-bridge
* As the jar file doesn't contain the clr dll any more, modify libLoader to load clr dll properly.
* Remove lang\cpp and lang\reef-bridge
* Update and test REEF.client for E2E.
JIRA:
[REEF-194] https://issues.apache.org/jira/browse/REEF-194
[REEF-209] https://issues.apache.org/jira/browse/REEF-209
Pull Request:
This closes #117
Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/492da34a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/492da34a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/492da34a
Branch: refs/heads/master
Commit: 492da34a0d666f8374c550fc7dab9ca2029e2bcb
Parents: 722d8c4
Author: Julia Wang <jw...@yahoo.com>
Authored: Wed Mar 18 13:55:50 2015 -0700
Committer: Markus Weimer <we...@apache.org>
Committed: Thu Mar 19 17:25:14 2015 -0700
----------------------------------------------------------------------
lang/cpp/.gitignore | 7 -
lang/cpp/reef-bridge-clr/pom.xml | 150 ------
.../Org.Apache.REEF.Bridge.Clr.csproj | 66 ---
.../ClrHandler/Properties/AssemblyInfo.cs | 49 --
.../ClrHandler/interface/IInteropReturnInfo.cs | 30 --
.../CSharp/ClrHandler/interface/ILogger.cs | 37 --
.../JavaClrBridge/ActiveContextClr2Java.cpp | 110 -----
.../AllocatedEvaluatorClr2Java.cpp | 168 -------
.../CppBridge/JavaClrBridge/AssemblyInfo.cpp | 50 --
.../CppBridge/JavaClrBridge/AssemblyUtil.cpp | 53 --
.../Cpp/CppBridge/JavaClrBridge/BinaryUtil.cpp | 102 ----
.../Cpp/CppBridge/JavaClrBridge/BinaryUtil.h | 26 -
.../JavaClrBridge/ClosedContextClr2Java.cpp | 90 ----
.../CppBridge/JavaClrBridge/Clr2JavaImpl.cpp | 44 --
.../Cpp/CppBridge/JavaClrBridge/Clr2JavaImpl.h | 224 ---------
.../CppBridge/JavaClrBridge/CommonUtilities.cpp | 55 ---
.../CompletedEvaluatorClr2Java.cpp | 62 ---
.../JavaClrBridge/CompletedTaskClr2Java.cpp | 73 ---
.../JavaClrBridge/ContextMessageClr2Java.cpp | 80 ---
.../EvaluatorRequestorClr2Java.cpp | 73 ---
.../JavaClrBridge/FailedContextClr2Java.cpp | 98 ----
.../JavaClrBridge/FailedEvaluatorClr2Java.cpp | 76 ---
.../JavaClrBridge/FailedTaskClr2Java.cpp | 83 ----
.../JavaClrBridge/HttpServerClr2Java.cpp | 139 ------
.../CppBridge/JavaClrBridge/InteropAssemblies.h | 40 --
.../CppBridge/JavaClrBridge/InteropLogger.cpp | 50 --
.../Cpp/CppBridge/JavaClrBridge/InteropLogger.h | 47 --
.../JavaClrBridge/InteropReturnInfo.cpp | 88 ----
.../CppBridge/JavaClrBridge/InteropReturnInfo.h | 57 ---
.../Cpp/CppBridge/JavaClrBridge/InteropUtil.cpp | 129 -----
.../Cpp/CppBridge/JavaClrBridge/InteropUtil.h | 65 ---
.../CppBridge/JavaClrBridge/JavaClrBridge.cpp | 492 -------------------
.../Cpp/CppBridge/JavaClrBridge/JavaClrBridge.h | 33 --
.../CppBridge/JavaClrBridge/JavaClrBridge.sln | 58 ---
.../JavaClrBridge/JavaClrBridge.vcxproj | 174 -------
.../JavaClrBridge/JavaClrBridge.vcxproj.filters | 104 ----
.../CppBridge/JavaClrBridge/ManagedLogger.cpp | 47 --
.../main/Cpp/CppBridge/JavaClrBridge/ReadMe.txt | 57 ---
.../JavaClrBridge/RunningTaskClr2Java.cpp | 94 ----
.../JavaClrBridge/SuspendedTaskClr2Java.cpp | 87 ----
.../JavaClrBridge/TaskMessageClr2Java.cpp | 62 ---
lang/cs/.gitignore | 3 +
lang/cs/.nuget/finalizeNuspec.ps1 | 1 +
.../Org.Apache.REEF.Bridge.JAR.csproj | 27 +-
.../ActiveContextClr2Java.cpp | 110 +++++
.../AllocatedEvaluatorClr2Java.cpp | 168 +++++++
lang/cs/Org.Apache.REEF.Bridge/AssemblyInfo.cpp | 57 +++
lang/cs/Org.Apache.REEF.Bridge/AssemblyUtil.cpp | 53 ++
lang/cs/Org.Apache.REEF.Bridge/BinaryUtil.cpp | 102 ++++
lang/cs/Org.Apache.REEF.Bridge/BinaryUtil.h | 26 +
.../ClosedContextClr2Java.cpp | 90 ++++
lang/cs/Org.Apache.REEF.Bridge/Clr2JavaImpl.h | 223 +++++++++
.../Org.Apache.REEF.Bridge/CommonUtilities.cpp | 55 +++
.../CompletedEvaluatorClr2Java.cpp | 62 +++
.../CompletedTaskClr2Java.cpp | 73 +++
.../ContextMessageClr2Java.cpp | 80 +++
.../EvaluatorRequestorClr2Java.cpp | 73 +++
.../FailedContextClr2Java.cpp | 98 ++++
.../FailedEvaluatorClr2Java.cpp | 76 +++
.../FailedTaskClr2Java.cpp | 83 ++++
.../HttpServerClr2Java.cpp | 139 ++++++
.../Org.Apache.REEF.Bridge/InteropAssemblies.h | 40 ++
.../cs/Org.Apache.REEF.Bridge/InteropLogger.cpp | 50 ++
lang/cs/Org.Apache.REEF.Bridge/InteropLogger.h | 47 ++
.../InteropReturnInfo.cpp | 88 ++++
.../Org.Apache.REEF.Bridge/InteropReturnInfo.h | 57 +++
lang/cs/Org.Apache.REEF.Bridge/InteropUtil.cpp | 129 +++++
lang/cs/Org.Apache.REEF.Bridge/InteropUtil.h | 65 +++
.../cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp | 492 +++++++++++++++++++
lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.h | 33 ++
.../Org.Apache.REEF.Bridge.nuspec | 22 +
.../Org.Apache.REEF.Bridge.vcxproj | 180 +++++++
.../Org.Apache.REEF.Bridge.vcxproj.filters | 136 +++++
lang/cs/Org.Apache.REEF.Bridge/ReadMe.txt | 57 +++
.../RunningTaskClr2Java.cpp | 94 ++++
lang/cs/Org.Apache.REEF.Bridge/Stdafx.cpp | 24 +
lang/cs/Org.Apache.REEF.Bridge/Stdafx.h | 25 +
.../SuspendedTaskClr2Java.cpp | 87 ++++
.../TaskMessageClr2Java.cpp | 62 +++
lang/cs/Org.Apache.REEF.Bridge/app.ico | Bin 0 -> 11001 bytes
lang/cs/Org.Apache.REEF.Bridge/app.rc | Bin 0 -> 2558 bytes
lang/cs/Org.Apache.REEF.Bridge/resource.h | 22 +
.../Org.Apache.REEF.Client/CLRBridgeClient.cs | 4 +-
.../Org.Apache.REEF.Client.csproj | 4 +
.../Bridge/ClrClientHelper.cs | 2 +-
lang/cs/Org.Apache.REEF.Driver/Constants.cs | 2 +-
.../DriverConfigGenerator.cs | 2 +-
.../InteropInterface/IInteropReturnInfo.cs | 30 ++
.../InteropInterface/ILogger.cs | 37 ++
.../Org.Apache.REEF.Driver.csproj | 2 +
.../Functional/Bridge/TestBridgeClient.cs | 2 +-
.../Functional/ReefFunctionalTest.cs | 2 +-
.../Org.Apache.REEF.Tests.csproj | 6 +-
...bridge-0.11.0-incubating-SNAPSHOT-shaded.jar | Bin 12748678 -> 0 bytes
...e-java-0.11.0-incubating-SNAPSHOT-shaded.jar | Bin 0 -> 13268150 bytes
lang/cs/Org.Apache.REEF.sln | Bin 14450 -> 19860 bytes
lang/cs/build.props | 23 -
lang/cs/pom.xml | 27 +-
.../org/apache/reef/javabridge/LibLoader.java | 93 ++--
.../runtime/common/files/REEFFileNames.java | 40 +-
lang/reef-bridge/.gitignore | 3 -
lang/reef-bridge/pom.xml | 139 ------
pom.xml | 19 +-
103 files changed, 3476 insertions(+), 3899 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/.gitignore
----------------------------------------------------------------------
diff --git a/lang/cpp/.gitignore b/lang/cpp/.gitignore
deleted file mode 100644
index f0bf936..0000000
--- a/lang/cpp/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-**/*.sdf
-**/*.opensdf
-**/*.suo
-**/obj
-**/x64
-**/Debug
-reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/externals/Org.Apache.Reef.Driver.dll
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/pom.xml
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/pom.xml b/lang/cpp/reef-bridge-clr/pom.xml
deleted file mode 100644
index c66d11d..0000000
--- a/lang/cpp/reef-bridge-clr/pom.xml
+++ /dev/null
@@ -1,150 +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="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- 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-clr</artifactId>
- <name>REEF Bridge CLR</name>
- <description>Bridge between JVM and CLR.</description>
-
-
- <parent>
- <groupId>org.apache.reef</groupId>
- <artifactId>reef-project</artifactId>
- <version>0.11.0-incubating-SNAPSHOT</version>
- <relativePath>../../..</relativePath>
- </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-dotnet</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>reef-bridge-java</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.avro</groupId>
- <artifactId>avro</artifactId>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>Bridge</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <configuration>
- <executable>msbuild.exe</executable>
- </configuration>
- <executions>
- <execution>
- <id>clean</id>
- <phase>clean</phase>
- <configuration>
- <arguments>
- <argument>
- ${project.basedir}/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.sln
- </argument>
- <argument>/p:Configuration="Release"</argument>
- <argument>/p:Platform="x64"</argument>
- <argument>/t:Clean</argument>
- </arguments>
- </configuration>
- <goals>
- <goal>exec</goal>
- </goals>
- </execution>
- <execution>
- <id>build</id>
- <phase>compile</phase>
- <configuration>
- <arguments>
- <argument>
- ${project.basedir}/src/main/Cpp/CppBridge/JavaClrBridge/JavaClrBridge.sln
- </argument>
- <argument>/p:Configuration="Release"</argument>
- <argument>/p:Platform="x64"</argument>
- </arguments>
- </configuration>
- <goals>
- <goal>exec</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-resources-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-external-dlls</id>
- <phase>process-resources</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <overwrite>true</overwrite>
- <outputDirectory>${basedir}/target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/CSharp/CSharp/ClrHandler/externals</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/Org.Apache.REEF.Bridge.Clr.csproj
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/Org.Apache.REEF.Bridge.Clr.csproj b/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/Org.Apache.REEF.Bridge.Clr.csproj
deleted file mode 100644
index b8b1e56..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/Org.Apache.REEF.Bridge.Clr.csproj
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{443A7B61-5C91-4F67-9FCD-81BC6FABFDBD}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Org.Apache.REEF.Bridge.Clr</RootNamespace>
- <AssemblyName>Org.Apache.REEF.Bridge.Clr</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>..\..\..\..\..\target\classes\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>..\..\..\..\..\target\classes\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>false</SignAssembly>
- </PropertyGroup>
- <PropertyGroup>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Org.Apache.Reef.Driver">
- <HintPath>externals\Org.Apache.Reef.Driver</HintPath>
- <Private>true</Private>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Runtime.Serialization" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="interface\ILogger.cs" />
- <Compile Include="interface\IInteropReturnInfo.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/Properties/AssemblyInfo.cs b/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/Properties/AssemblyInfo.cs
deleted file mode 100644
index ffbe4dd..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,49 +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.
- */
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Org.Apache.REEF.Bridge.Clr")]
-[assembly: AssemblyDescription("The interface dll between CPP and CLR code")]
-[assembly: AssemblyProduct("Org.Apache.REEF.Bridge.Clr")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("3efe4d3c-087b-4076-b331-8f3e36c10016")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/interface/IInteropReturnInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/interface/IInteropReturnInfo.cs b/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/interface/IInteropReturnInfo.cs
deleted file mode 100644
index b3b930a..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/interface/IInteropReturnInfo.cs
+++ /dev/null
@@ -1,30 +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.
- */
-using System;
-
-namespace Microsoft.Reef.Interop
-{
- public interface IInteropReturnInfo
- {
- void AddExceptionString(String exceptionString);
- Boolean HasExceptions();
- void SetReturnCode(int rc);
- int GetReturnCode();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/interface/ILogger.cs
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/interface/ILogger.cs b/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/interface/ILogger.cs
deleted file mode 100644
index 4a7f9b2..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/CSharp/CSharp/ClrHandler/interface/ILogger.cs
+++ /dev/null
@@ -1,37 +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.
- */
-using System;
-
-namespace Microsoft.Reef.Interop
-{
- public enum TraceLevel : int
- {
- NoTrace = Int32.MaxValue,
-
- Error = 1000,
- Warning = 900,
- Info = 800,
- Verbose = 300,
- }
-
- public interface ILogger
- {
- void Log(TraceLevel traceLevel, String message);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ActiveContextClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ActiveContextClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ActiveContextClr2Java.cpp
deleted file mode 100644
index 6e56806..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ActiveContextClr2Java.cpp
+++ /dev/null
@@ -1,110 +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 {
- namespace Clr2java {
- private ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
- };
-
- ActiveContextClr2Java::ActiveContextClr2Java(JNIEnv *env, jobject jobjectActiveContext) {
- ManagedLog::LOGGER->LogStart("ActiveContextClr2Java::ActiveContextClr2Java");
- pin_ptr<JavaVM*> pJavaVm = &_jvm;
- if (env->GetJavaVM(pJavaVm) != 0) {
- ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
- }
-
- _jobjectActiveContext = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectActiveContext));
-
- jclass jclassActiveContext = env->GetObjectClass(_jobjectActiveContext);
-
- jfieldID jidContextId = env->GetFieldID(jclassActiveContext, "contextId", "Ljava/lang/String;");
- _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectActiveContext, jidContextId)));
-
- jfieldID jidEvaluatorId = env->GetFieldID(jclassActiveContext, "evaluatorId", "Ljava/lang/String;");
- _jstringEvaluatorId = (jstring)env->GetObjectField(_jobjectActiveContext, jidEvaluatorId);
- _jstringEvaluatorId = reinterpret_cast<jstring>(env->NewGlobalRef(_jstringEvaluatorId));
-
- ManagedLog::LOGGER->LogStop("ActiveContextClr2Java::ActiveContextClr2Java");
- }
-
- void ActiveContextClr2Java::SubmitTask(String^ taskConfigStr) {
- ManagedLog::LOGGER->LogStart("ActiveContextClr2Java::SubmitTask");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclassActiveContext = env->GetObjectClass(_jobjectActiveContext);
- jmethodID jmidSubmitTask = env->GetMethodID(jclassActiveContext, "submitTaskString", "(Ljava/lang/String;)V");
-
- if (jmidSubmitTask == NULL) {
- ManagedLog::LOGGER->Log("jmidSubmitTask is NULL");
- return;
- }
- env->CallObjectMethod(
- _jobjectActiveContext,
- jmidSubmitTask,
- JavaStringFromManagedString(env, taskConfigStr));
- ManagedLog::LOGGER->LogStop("ActiveContextClr2Java::SubmitTask");
- }
-
- void ActiveContextClr2Java::OnError(String^ message) {
- JNIEnv *env = RetrieveEnv(_jvm);
- HandleClr2JavaError(env, message, _jobjectActiveContext);
- }
-
- void ActiveContextClr2Java::Close() {
- ManagedLog::LOGGER->LogStart("ActiveContextClr2Java::Close");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclassActiveContext = env->GetObjectClass(_jobjectActiveContext);
- jmethodID jmidClose = env->GetMethodID(jclassActiveContext, "close", "()V");
-
- if (jmidClose == NULL) {
- ManagedLog::LOGGER->Log("jmidClose is NULL");
- return;
- }
- env->CallObjectMethod(
- _jobjectActiveContext,
- jmidClose);
- ManagedLog::LOGGER->LogStop("ActiveContextClr2Java::Close");
- }
-
- String^ ActiveContextClr2Java::GetId() {
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringId);
- }
-
- String^ ActiveContextClr2Java::GetEvaluatorId() {
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringEvaluatorId);
- }
-
- IEvaluatorDescriptor^ ActiveContextClr2Java::GetEvaluatorDescriptor() {
- ManagedLog::LOGGER->LogStart("ActiveContextClr2Java::GetEvaluatorDescriptor");
- return CommonUtilities::RetrieveEvaluatorDescriptor(_jobjectActiveContext, _jvm);
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AllocatedEvaluatorClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AllocatedEvaluatorClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AllocatedEvaluatorClr2Java.cpp
deleted file mode 100644
index 4dabd96..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AllocatedEvaluatorClr2Java.cpp
+++ /dev/null
@@ -1,168 +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 Org {
- namespace Apache {
- namespace REEF {
- namespace Driver {
- namespace Bridge {
- namespace Clr2java {
- ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
- };
-
- AllocatedEvaluatorClr2Java::AllocatedEvaluatorClr2Java(JNIEnv *env, jobject jallocatedEvaluator) {
-
- ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::AllocatedEvaluatorClr2Java");
-
- pin_ptr<JavaVM*> pJavaVm = &_jvm;
- if (env->GetJavaVM(pJavaVm) != 0) {
- ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
- }
- _jobjectAllocatedEvaluator = reinterpret_cast<jobject>(env->NewGlobalRef(jallocatedEvaluator));
-
- jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
- jfieldID jidEvaluatorId = env->GetFieldID(jclassAllocatedEvaluator, "evaluatorId", "Ljava/lang/String;");
- _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectAllocatedEvaluator, jidEvaluatorId)));
-
- jfieldID jidNameServerInfo = env->GetFieldID(jclassAllocatedEvaluator, "nameServerInfo", "Ljava/lang/String;");
- _jstringNameServerInfo = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectAllocatedEvaluator, jidNameServerInfo)));
-
- ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::AllocatedEvaluatorClr2Java");
- }
-
- void AllocatedEvaluatorClr2Java::SubmitContext(String^ contextConfigStr) {
- ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::SubmitContext");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
- jmethodID jmidSubmitContext = env->GetMethodID(jclassAllocatedEvaluator, "submitContextString", "(Ljava/lang/String;)V");
-
- if (jmidSubmitContext == NULL) {
- ManagedLog::LOGGER->Log("jmidSubmitContext is NULL");
- return;
- }
- env->CallObjectMethod(
- _jobjectAllocatedEvaluator,
- jmidSubmitContext,
- JavaStringFromManagedString(env, contextConfigStr));
- ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::SubmitContext");
- }
-
- void AllocatedEvaluatorClr2Java::SubmitContextAndTask(String^ contextConfigStr, String^ taskConfigStr) {
- ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::SubmitContextAndTask");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
- jmethodID jmidSubmitContextAndTask = env->GetMethodID(jclassAllocatedEvaluator, "submitContextAndTaskString", "(Ljava/lang/String;Ljava/lang/String;)V");
-
- if (jmidSubmitContextAndTask == NULL) {
- ManagedLog::LOGGER->Log("jmidSubmitContextAndTask is NULL");
- return;
- }
- env->CallObjectMethod(
- _jobjectAllocatedEvaluator,
- jmidSubmitContextAndTask,
- JavaStringFromManagedString(env, contextConfigStr),
- JavaStringFromManagedString(env, taskConfigStr));
- ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::SubmitContextAndTask");
- }
-
- void AllocatedEvaluatorClr2Java::SubmitContextAndService(String^ contextConfigStr, String^ serviceConfigStr) {
- ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::SubmitContextAndService");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
- jmethodID jmidSubmitContextAndService = env->GetMethodID(jclassAllocatedEvaluator, "submitContextAndServiceString", "(Ljava/lang/String;Ljava/lang/String;)V");
-
- if (jmidSubmitContextAndService == NULL) {
- ManagedLog::LOGGER->Log("jmidSubmitContextAndService is NULL");
- return;
- }
- env->CallObjectMethod(
- _jobjectAllocatedEvaluator,
- jmidSubmitContextAndService,
- JavaStringFromManagedString(env, contextConfigStr),
- JavaStringFromManagedString(env, serviceConfigStr));
- ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::SubmitContextAndService");
- }
-
- void AllocatedEvaluatorClr2Java::SubmitContextAndServiceAndTask(String^ contextConfigStr, String^ serviceConfigStr, String^ taskConfigStr) {
- ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::SubmitContextAndServiceAndTask");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
- jmethodID jmidSubmitContextAndServiceAndTask = env->GetMethodID(jclassAllocatedEvaluator, "submitContextAndServiceAndTaskString", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
-
- if (jmidSubmitContextAndServiceAndTask == NULL) {
- ManagedLog::LOGGER->Log("jmidSubmitContextAndServiceAndTask is NULL");
- return;
- }
- env->CallObjectMethod(
- _jobjectAllocatedEvaluator,
- jmidSubmitContextAndServiceAndTask,
- JavaStringFromManagedString(env, contextConfigStr),
- JavaStringFromManagedString(env, serviceConfigStr),
- JavaStringFromManagedString(env, taskConfigStr));
- ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::SubmitContextAndServiceAndTask");
- }
-
- void AllocatedEvaluatorClr2Java::OnError(String^ message) {
- JNIEnv *env = RetrieveEnv(_jvm);
- HandleClr2JavaError(env, message, _jobjectAllocatedEvaluator);
- }
-
- void AllocatedEvaluatorClr2Java::Close() {
- ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::Close");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclassAllocatedEvaluator = env->GetObjectClass(_jobjectAllocatedEvaluator);
- jmethodID jmidClose = env->GetMethodID(jclassAllocatedEvaluator, "close", "()V");
-
- if (jmidClose == NULL) {
- ManagedLog::LOGGER->Log("jmidClose is NULL");
- return;
- }
- env->CallObjectMethod(
- _jobjectAllocatedEvaluator,
- jmidClose);
- ManagedLog::LOGGER->LogStop("AllocatedEvaluatorClr2Java::Close");
- }
-
- String^ AllocatedEvaluatorClr2Java::GetId() {
- ManagedLog::LOGGER->Log("AllocatedEvaluatorClr2Java::GetId");
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringId);
- }
-
- String^ AllocatedEvaluatorClr2Java::GetNameServerInfo() {
- ManagedLog::LOGGER->Log("AllocatedEvaluatorClr2Java::GetNameServerInfo");
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringNameServerInfo);
- }
-
- IEvaluatorDescriptor^ AllocatedEvaluatorClr2Java::GetEvaluatorDescriptor() {
- ManagedLog::LOGGER->LogStart("AllocatedEvaluatorClr2Java::GetEvaluatorDescriptor");
- return CommonUtilities::RetrieveEvaluatorDescriptor(_jobjectAllocatedEvaluator, _jvm);
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AssemblyInfo.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AssemblyInfo.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AssemblyInfo.cpp
deleted file mode 100644
index f6c3178..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AssemblyInfo.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.
- */
-using namespace System;
-using namespace System::Reflection;
-using namespace System::Runtime::CompilerServices;
-using namespace System::Runtime::InteropServices;
-using namespace System::Security::Permissions;
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly:AssemblyTitleAttribute("JavaClrBridge")];
-[assembly:AssemblyProductAttribute("JavaClrBridge")];
-[assembly:AssemblyCopyrightAttribute("Copyright (c) 2014")];
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the value or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly:AssemblyVersionAttribute("1.0.*")];
-
-[assembly:ComVisible(false)];
-
-[assembly:CLSCompliantAttribute(true)];
-
-[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AssemblyUtil.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AssemblyUtil.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AssemblyUtil.cpp
deleted file mode 100644
index ce9239c..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/AssemblyUtil.cpp
+++ /dev/null
@@ -1,53 +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 "InteropAssemblies.h"
-
-
-void AssemblyUtil::Add(Assembly^ myasm) {
- if (0 == _asmCount) {
- //asm1 = myasm;
- AppDomain^ currentDomain = AppDomain::CurrentDomain;
- currentDomain->AssemblyResolve += gcnew ResolveEventHandler(&MyResolveEventHandler);
- }
- String^ asmName = myasm->FullName->ToLower();
- Assembly^ existingAsm = nullptr;
- if (!asms2->TryGetValue(asmName, existingAsm)) {
- Console::WriteLine ("AssemblyUtil:: Adding " + asmName);
- asms2->Add(asmName , myasm);
- ++_asmCount;
- }
-}
-
-Assembly^ AssemblyUtil::FindAsm (String^ myasm) {
- Assembly^ returnAsm = nullptr;
- if (!asms2->TryGetValue(myasm->ToLower(), returnAsm)) {
- Console::WriteLine ("AssemblyUtil:: FindAsm_Not_Found " + myasm->ToString());
- }
- return returnAsm;
-}
-
-Assembly^ AssemblyUtil::MyResolveEventHandler(Object^ sender, ResolveEventArgs^ args) {
- Console::WriteLine ("AssemblyUtil:: Resolving " + args->Name);
- Assembly^ myAsm = AssemblyUtil::FindAsm(args->Name);
- if (nullptr != myAsm) {
- Console::WriteLine ("AssemblyUtil:: Found " + args->Name);
- }
- return myAsm ;
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/BinaryUtil.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/BinaryUtil.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/BinaryUtil.cpp
deleted file mode 100644
index b7c3a2e..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/BinaryUtil.cpp
+++ /dev/null
@@ -1,102 +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 "BinaryUtil.h"
-
-DWORD GetActualAddressFromRVA(IMAGE_SECTION_HEADER* pSectionHeader, IMAGE_NT_HEADERS* pNTHeaders, DWORD dwRVA) {
- DWORD dwRet = 0;
-
- for (int j = 0; j < pNTHeaders->FileHeader.NumberOfSections; j++, pSectionHeader++) {
- DWORD cbMaxOnDisk = min( pSectionHeader->Misc.VirtualSize, pSectionHeader->SizeOfRawData );
-
- DWORD startSectRVA, endSectRVA;
-
- startSectRVA = pSectionHeader->VirtualAddress;
- endSectRVA = startSectRVA + cbMaxOnDisk;
-
- if ( (dwRVA >= startSectRVA) && (dwRVA < endSectRVA)) {
- dwRet = (pSectionHeader->PointerToRawData ) + (dwRVA - startSectRVA);
- break;
- }
-
- }
-
- return dwRet;
-}
-
-
-BINARY_TYPE IsManagedBinary(const wchar_t* lpszImageName) {
- BINARY_TYPE binaryType = BINARY_TYPE_NONE;
- HANDLE hFile = CreateFile(lpszImageName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-
- if (INVALID_HANDLE_VALUE != hFile) {
- //succeeded
- HANDLE hOpenFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
- if (hOpenFileMapping) {
- BYTE* lpBaseAddress = NULL;
-
- lpBaseAddress = (BYTE*)MapViewOfFile(hOpenFileMapping, FILE_MAP_READ, 0, 0, 0);
-
- if (lpBaseAddress) {
- //having mapped the executable to our process space, now start navigating through the sections
-
- //DOS header is straightforward. It is the topmost structure in the PE file
- //i.e. the one at the lowest offset into the file
- IMAGE_DOS_HEADER* pDOSHeader = (IMAGE_DOS_HEADER*)lpBaseAddress;
-
- //the only important data in the DOS header is the e_lfanew
- //the e_lfanew points to the offset of the beginning of NT Headers data
- IMAGE_NT_HEADERS* pNTHeaders = (IMAGE_NT_HEADERS*)((BYTE*)pDOSHeader + pDOSHeader->e_lfanew);
-
- IMAGE_SECTION_HEADER* pSectionHeader = (IMAGE_SECTION_HEADER*)((BYTE*)pNTHeaders + sizeof(IMAGE_NT_HEADERS));
-
- //Now, start parsing
- //check if it is a PE file
-
- if (pNTHeaders->Signature == IMAGE_NT_SIGNATURE) {
- //start parsing COM table
-
- DWORD dwNETHeaderTableLocation = pNTHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress;
-
- if (dwNETHeaderTableLocation) {
- //import data does exist for this module
- IMAGE_COR20_HEADER* pNETHeader = (IMAGE_COR20_HEADER*)((BYTE*)pDOSHeader + GetActualAddressFromRVA(pSectionHeader, pNTHeaders, dwNETHeaderTableLocation));
-
- if (pNETHeader) {
- binaryType = BINARY_TYPE_CLR;
- }
- else {
- binaryType = BINARY_TYPE_NATIVE;
- }
- }
- else {
- binaryType = BINARY_TYPE_NATIVE;
- }
- }
- else {
- binaryType = BINARY_TYPE_NONE;
- }
- UnmapViewOfFile(lpBaseAddress);
- }
- CloseHandle(hOpenFileMapping);
- }
- CloseHandle(hFile);
- }
- return binaryType;
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/BinaryUtil.h
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/BinaryUtil.h b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/BinaryUtil.h
deleted file mode 100644
index dc946a6..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/BinaryUtil.h
+++ /dev/null
@@ -1,26 +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.
- */
-typedef enum BINARY_TYPE {
- BINARY_TYPE_NONE = 0,
- BINARY_TYPE_NATIVE = 1,
- BINARY_TYPE_CLR = 2,
-} BINARY_TYPE ;
-
-
-BINARY_TYPE IsManagedBinary(const wchar_t* lpszImageName);
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ClosedContextClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ClosedContextClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ClosedContextClr2Java.cpp
deleted file mode 100644
index 6584abe..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ClosedContextClr2Java.cpp
+++ /dev/null
@@ -1,90 +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 {
- namespace Clr2java {
- ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
- };
- ClosedContextClr2Java::ClosedContextClr2Java(JNIEnv *env, jobject jobjectClosedContext) {
- ManagedLog::LOGGER->LogStart("ClosedContextClr2Java::ClosedContextClr2Java");
-
- pin_ptr<JavaVM*> pJavaVm = &_jvm;
- if (env->GetJavaVM(pJavaVm) != 0) {
- ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
- }
- _jobjectClosedContext = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectClosedContext));
- jclass jclassClosedContext = env->GetObjectClass(_jobjectClosedContext);
-
- jfieldID jidContextId = env->GetFieldID(jclassClosedContext, "contextId", "Ljava/lang/String;");
- jfieldID jidEvaluatorId = env->GetFieldID(jclassClosedContext, "evaluatorId", "Ljava/lang/String;");
-
- _jstringContextId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectClosedContext, jidContextId)));
- _jstringEvaluatorId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectClosedContext, jidEvaluatorId)));
-
- ManagedLog::LOGGER->LogStop("ClosedContextClr2Java::ClosedContextClr2Java");
- }
-
- IActiveContextClr2Java^ ClosedContextClr2Java::GetParentContext() {
- ManagedLog::LOGGER->LogStart("ClosedContextClr2Java::GetParentContext");
-
- JNIEnv *env = RetrieveEnv(_jvm);
-
- jclass jclassClosedContext = env->GetObjectClass(_jobjectClosedContext);
- jfieldID jidParentContext = env->GetFieldID(jclassClosedContext, "parentContext", "Lorg/apache/reef/javabridge/ActiveContextBridge;");
- jobject jobjectParentContext = env->GetObjectField(_jobjectClosedContext, jidParentContext);
- ManagedLog::LOGGER->LogStop("ClosedContextClr2Java::GetParentContext");
-
- return gcnew ActiveContextClr2Java(env, jobjectParentContext);
- }
-
- String^ ClosedContextClr2Java::GetId() {
- ManagedLog::LOGGER->Log("ClosedContextClr2Java::GetId");
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringContextId);
- }
-
- String^ ClosedContextClr2Java::GetEvaluatorId() {
- ManagedLog::LOGGER->Log("ClosedContextClr2Java::GetEvaluatorId");
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringEvaluatorId);
- }
-
- IEvaluatorDescriptor^ ClosedContextClr2Java::GetEvaluatorDescriptor() {
- ManagedLog::LOGGER->LogStart("ClosedContextClr2Java::GetEvaluatorDescriptor");
- return CommonUtilities::RetrieveEvaluatorDescriptor(_jobjectClosedContext, _jvm);
- }
-
- void ClosedContextClr2Java::OnError(String^ message) {
- ManagedLog::LOGGER->Log("ClosedContextClr2Java::OnError");
- JNIEnv *env = RetrieveEnv(_jvm);
- HandleClr2JavaError(env, message, _jobjectClosedContext);
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/Clr2JavaImpl.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/Clr2JavaImpl.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/Clr2JavaImpl.cpp
deleted file mode 100644
index ebd1aa4..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/Clr2JavaImpl.cpp
+++ /dev/null
@@ -1,44 +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 Microsoft
-{
- namespace Reef
- {
- namespace Interop
- {
- Clr2JavaImpl::Clr2JavaImpl (JNIEnv* env, jobject jobjectEManager, jobject jobjectDriverManager)
- {
- _env = env;
- _jobjectEManager = jobjectEManager;
- _jclassEManager = env->GetObjectClass (_jobjectEManager);
- _jmidSubmit = env->GetMethodID(_jclassEManager, "submit", "([B)V");
- _jobjectDriverManager = jobjectDriverManager;
- _jclassDriverManager = env->GetObjectClass (_jobjectDriverManager);
-
- }
-
- void Clr2JavaImpl::AllocatedEvaluatorSubmitContextAndTask(String^ contextConfigStr, String^ taskConfigStr)
- {
- Console::WriteLine("AllocatedEvaluatorSubmitContextAndTask not implemented for Clr2JavaImpl");
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/Clr2JavaImpl.h
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/Clr2JavaImpl.h b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/Clr2JavaImpl.h
deleted file mode 100644
index 39a7bfa..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/Clr2JavaImpl.h
+++ /dev/null
@@ -1,224 +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 "Org.Apache.REEF.Bridge.Clr.dll"
-#using "Org.Apache.REEF.Driver.dll"
-
-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;
-using namespace Org::Apache::REEF::Driver::Evaluator;
-
-namespace Org {
- namespace Apache {
- namespace REEF {
- namespace Driver {
- namespace Bridge {
- namespace Clr2java {
- public ref class CommonUtilities {
- public:
- static IEvaluatorDescriptor^ RetrieveEvaluatorDescriptor(jobject object, JavaVM* jvm);
- };
-
- public ref class AllocatedEvaluatorClr2Java : public IAllocatedEvaluaotrClr2Java {
- jobject _jobjectAllocatedEvaluator;
- JavaVM* _jvm;
- jstring _jstringId;
- jstring _jstringNameServerInfo;
- public:
- AllocatedEvaluatorClr2Java(JNIEnv *env, jobject jallocatedEvaluator);
- virtual void SubmitContextAndTask(String^ contextConfigStr, String^ taskConfigStr);
- virtual void SubmitContext(String^ contextConfigStr);
- virtual void SubmitContextAndService(String^ contextConfigStr, String^ serviceConfigStr);
- virtual void SubmitContextAndServiceAndTask(String^ contextConfigStr, String^ serviceConfigStr, String^ taskConfigStr);
- virtual void OnError(String^ message);
- virtual void Close();
- virtual String^ GetId();
- virtual String^ GetNameServerInfo();
- virtual IEvaluatorDescriptor^ GetEvaluatorDescriptor();
- };
-
- public ref class ActiveContextClr2Java : public IActiveContextClr2Java {
- jobject _jobjectActiveContext;
- jstring _jstringId;
- jstring _jstringEvaluatorId;
- JavaVM* _jvm;
- public:
- ActiveContextClr2Java(JNIEnv *env, jobject jallocatedEvaluator);
- virtual void SubmitTask(String^ taskConfigStr);
- virtual void Close();
- virtual void OnError(String^ message);
- virtual String^ GetId();
- virtual String^ GetEvaluatorId();
- virtual IEvaluatorDescriptor^ GetEvaluatorDescriptor();
- };
-
- public ref class EvaluatorRequestorClr2Java : public IEvaluatorRequestorClr2Java {
- jobject _jobjectEvaluatorRequestor;
- JavaVM* _jvm;
- public:
- EvaluatorRequestorClr2Java(JNIEnv *env, jobject jevaluatorRequestor);
- virtual void OnError(String^ message);
- virtual void Submit(IEvaluatorRequest^ request);
- };
-
- public ref class TaskMessageClr2Java : public ITaskMessageClr2Java {
- jobject _jobjectTaskMessage;
- JavaVM* _jvm;
- jstring _jstringId;
- public:
- TaskMessageClr2Java(JNIEnv *env, jobject jtaskMessage);
- virtual void OnError(String^ message);
- virtual String^ GetId();
- };
-
- public ref class FailedTaskClr2Java : public IFailedTaskClr2Java {
- jobject _jobjectFailedTask;
- JavaVM* _jvm;
- public:
- FailedTaskClr2Java(JNIEnv *env, jobject jfailedTask);
- virtual void OnError(String^ message);
- virtual IActiveContextClr2Java^ GetActiveContext();
- virtual String^ GetString();
- };
-
- public ref class RunningTaskClr2Java : public IRunningTaskClr2Java {
- jobject _jobjectRunningTask;
- JavaVM* _jvm;
- jstring _jstringId;
- public:
- RunningTaskClr2Java(JNIEnv *env, jobject jrunningTask);
- virtual void OnError(String^ message);
- virtual IActiveContextClr2Java^ GetActiveContext();
- virtual String^ GetId();
- virtual void Send(array<byte>^ message);
- };
-
- public ref class FailedEvaluatorClr2Java : public IFailedEvaluatorClr2Java {
- jobject _jobjectFailedEvaluator;
- JavaVM* _jvm;
- jstring _jstringId;
- public:
- FailedEvaluatorClr2Java(JNIEnv *env, jobject jfailedEvaluator);
- virtual void OnError(String^ message);
- virtual IEvaluatorRequestorClr2Java^ GetEvaluatorRequestor();
- virtual String^ GetId();
- };
-
- public ref class HttpServerClr2Java : public IHttpServerBridgeClr2Java {
- jobject _jhttpServerEventBridge;
- JavaVM* _jvm;
- public:
- HttpServerClr2Java(JNIEnv *env, jobject jhttpServerEventBridge);
- virtual void OnError(String^ message);
- virtual String^ GetQueryString();
- virtual void SetUriSpecification(String^ uriSpecification);
- virtual void SetQueryResult(String^ queryResult);
- virtual array<byte>^ GetQueryRequestData();
- virtual void SetQueryResponseData(array<byte>^ responseData);
- };
-
- public ref class CompletedTaskClr2Java : public ICompletedTaskClr2Java {
- jobject _jobjectCompletedTask;
- JavaVM* _jvm;
- jstring _jstringId;
- public:
- CompletedTaskClr2Java(JNIEnv *env, jobject jcompletedTask);
- virtual void OnError(String^ message);
- virtual IActiveContextClr2Java^ GetActiveContext();
- virtual String^ GetId();
- };
-
- public ref class SuspendedTaskClr2Java : public ISuspendedTaskClr2Java {
- jobject _jobjectSuspendedTask;
- JavaVM* _jvm;
- jstring _jstringId;
- public:
- SuspendedTaskClr2Java(JNIEnv *env, jobject jobjectSuspendedTask);
- virtual void OnError(String^ message);
- virtual IActiveContextClr2Java^ GetActiveContext();
- virtual String^ GetId();
- virtual array<byte>^ Get();
- };
-
- public ref class CompletedEvaluatorClr2Java : public ICompletedEvaluatorClr2Java {
- jobject _jobjectCompletedEvaluator;
- JavaVM* _jvm;
- jstring _jstringId;
- public:
- CompletedEvaluatorClr2Java(JNIEnv *env, jobject jobjectCompletedEvaluator);
- virtual void OnError(String^ message);
- virtual String^ GetId();
- };
-
- public ref class ClosedContextClr2Java : public IClosedContextClr2Java {
- jobject _jobjectClosedContext;
- JavaVM* _jvm;
- jstring _jstringContextId;
- jstring _jstringEvaluatorId;
- public:
- ClosedContextClr2Java(JNIEnv *env, jobject jobjectClosedContext);
- virtual void OnError(String^ message);
- virtual String^ GetId();
- virtual String^ GetEvaluatorId();
- virtual IEvaluatorDescriptor^ GetEvaluatorDescriptor();
- virtual IActiveContextClr2Java^ GetParentContext();
- };
-
- public ref class FailedContextClr2Java : public IFailedContextClr2Java {
- jobject _jobjectFailedContext;
- JavaVM* _jvm;
- jstring _jstringContextId;
- jstring _jstringEvaluatorId;
- jstring _jstringParentContextId;
- public:
- FailedContextClr2Java(JNIEnv *env, jobject jobjectFailedContext);
- virtual void OnError(String^ message);
- virtual String^ GetId();
- virtual String^ GetEvaluatorId();
- virtual String^ GetParentId();
- virtual IEvaluatorDescriptor^ GetEvaluatorDescriptor();
- virtual IActiveContextClr2Java^ GetParentContext();
- };
-
- public ref class ContextMessageClr2Java : public IContextMessageClr2Java {
- jobject _jobjectContextMessage;
- JavaVM* _jvm;
- jbyteArray _jarrayMessage;
- jstring _jstringId;
- jstring _jstringSourceId;
- public:
- ContextMessageClr2Java(JNIEnv *env, jobject jobjectContextMessage);
- virtual void OnError(String^ message);
- virtual array<byte>^ Get();
- virtual String^ GetId();
- virtual String^ GetMessageSourceId();
- };
- }
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CommonUtilities.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CommonUtilities.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CommonUtilities.cpp
deleted file mode 100644
index 5de6e75..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CommonUtilities.cpp
+++ /dev/null
@@ -1,55 +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 {
- namespace Clr2java {
- ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>CommonUtilities");
- };
-
- IEvaluatorDescriptor^ CommonUtilities::RetrieveEvaluatorDescriptor(jobject object, JavaVM* jvm) {
- ManagedLog::LOGGER->LogStart("CommonUtilities::GetEvaluatorDescriptor");
- JNIEnv *env = RetrieveEnv(jvm);
- jclass jclassActiveContext = env->GetObjectClass(object);
- jmethodID jmidGetEvaluatorDescriptor = env->GetMethodID(jclassActiveContext, "getEvaluatorDescriptorSring", "()Ljava/lang/String;");
-
- if (jmidGetEvaluatorDescriptor == NULL) {
- ManagedLog::LOGGER->Log("jmidGetEvaluatorDescriptor is NULL");
- return nullptr;
- }
- jstring jevaluatorDescriptorString = (jstring)env->CallObjectMethod(
- object,
- jmidGetEvaluatorDescriptor);
- String^ evaluatorDescriptorString = ManagedStringFromJavaString(env, jevaluatorDescriptorString);
- ManagedLog::LOGGER->LogStop("InteropUtil::GetEvaluatorDescriptor");
-
- return gcnew EvaluatorDescriptorImpl(evaluatorDescriptorString);
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CompletedEvaluatorClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CompletedEvaluatorClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CompletedEvaluatorClr2Java.cpp
deleted file mode 100644
index c961881..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CompletedEvaluatorClr2Java.cpp
+++ /dev/null
@@ -1,62 +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 {
- namespace Clr2java {
- ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
- };
-
- CompletedEvaluatorClr2Java::CompletedEvaluatorClr2Java(JNIEnv *env, jobject jCompletedEvaluator) {
- ManagedLog::LOGGER->LogStart("CompletedEvaluatorClr2Java::CompletedEvaluatorClr2Java");
- pin_ptr<JavaVM*> pJavaVm = &_jvm;
- if (env->GetJavaVM(pJavaVm) != 0) {
- ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
- }
- _jobjectCompletedEvaluator = reinterpret_cast<jobject>(env->NewGlobalRef(jCompletedEvaluator));
-
- jclass jclassCompletedEvaluator = env->GetObjectClass(_jobjectCompletedEvaluator);
- jfieldID jidEvaluatorId = env->GetFieldID(jclassCompletedEvaluator, "evaluatorId", "Ljava/lang/String;");
- _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectCompletedEvaluator, jidEvaluatorId)));
- ManagedLog::LOGGER->LogStop("CompletedEvaluatorClr2Java::CompletedEvaluatorClr2Java");
- }
-
- void CompletedEvaluatorClr2Java::OnError(String^ message) {
- ManagedLog::LOGGER->Log("CompletedEvaluatorClr2Java::OnError");
- JNIEnv *env = RetrieveEnv(_jvm);
- HandleClr2JavaError(env, message, _jobjectCompletedEvaluator);
- }
-
- String^ CompletedEvaluatorClr2Java::GetId() {
- ManagedLog::LOGGER->Log("CompletedEvaluatorClr2Java::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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CompletedTaskClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CompletedTaskClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CompletedTaskClr2Java.cpp
deleted file mode 100644
index be9fe31..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/CompletedTaskClr2Java.cpp
+++ /dev/null
@@ -1,73 +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 {
- namespace Clr2java {
- ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
- };
-
- CompletedTaskClr2Java::CompletedTaskClr2Java(JNIEnv *env, jobject jobjectCompletedTask) {
- ManagedLog::LOGGER->LogStart("CompletedTaskClr2Java::CompletedTaskClr2Java");
- pin_ptr<JavaVM*> pJavaVm = &_jvm;
- if (env->GetJavaVM(pJavaVm) != 0) {
- ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
- }
- _jobjectCompletedTask = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectCompletedTask));
-
- jclass jclassCompletedTask = env->GetObjectClass(_jobjectCompletedTask);
- jfieldID jidTaskId = env->GetFieldID(jclassCompletedTask, "taskId", "Ljava/lang/String;");
- _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectCompletedTask, jidTaskId)));
- ManagedLog::LOGGER->LogStop("CompletedTaskClr2Java::CompletedTaskClr2Java");
- }
-
- void CompletedTaskClr2Java::OnError(String^ message) {
- ManagedLog::LOGGER->Log("CompletedTaskClr2Java::OnError");
- JNIEnv *env = RetrieveEnv(_jvm);
- HandleClr2JavaError(env, message, _jobjectCompletedTask);
- }
-
- IActiveContextClr2Java^ CompletedTaskClr2Java::GetActiveContext() {
- ManagedLog::LOGGER->LogStart("CompletedTaskClr2Java::GetActiveContext");
- JNIEnv *env = RetrieveEnv(_jvm);
-
- jclass jclassCompletedTask = env->GetObjectClass(_jobjectCompletedTask);
- jfieldID jidActiveContext = env->GetFieldID(jclassCompletedTask, "jactiveContext", "Lorg/apache/reef/javabridge/ActiveContextBridge;");
- jobject jobjectActiveContext = env->GetObjectField(_jobjectCompletedTask, jidActiveContext);
- ManagedLog::LOGGER->LogStop("CompletedTaskClr2Java::GetActiveContext");
- return gcnew ActiveContextClr2Java(env, jobjectActiveContext);
- }
-
- String^ CompletedTaskClr2Java::GetId() {
- ManagedLog::LOGGER->Log("CompletedTaskClr2Java::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/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ContextMessageClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ContextMessageClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ContextMessageClr2Java.cpp
deleted file mode 100644
index c385e46..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/ContextMessageClr2Java.cpp
+++ /dev/null
@@ -1,80 +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 {
- namespace Clr2java {
- ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
- };
- ContextMessageClr2Java::ContextMessageClr2Java(JNIEnv *env, jobject jobjectContextMessage) {
- ManagedLog::LOGGER->LogStart("ContextMessageClr2Java::ContextMessageClr2Java");
-
- pin_ptr<JavaVM*> pJavaVm = &_jvm;
- if (env->GetJavaVM(pJavaVm) != 0) {
- ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
- }
- _jobjectContextMessage = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectContextMessage));
- jclass jclassContextMessage = env->GetObjectClass(_jobjectContextMessage);
-
- jfieldID jidId = env->GetFieldID(jclassContextMessage, "contextMessageId", "Ljava/lang/String;");
- jfieldID jidSourceId = env->GetFieldID(jclassContextMessage, "messageSourceId", "Ljava/lang/String;");
- jfieldID jidMessage = env->GetFieldID(jclassContextMessage, "message", "()[B");
-
- _jstringId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectContextMessage, jidId)));
- _jstringSourceId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectContextMessage, jidSourceId)));
- _jarrayMessage = reinterpret_cast<jbyteArray>(env->NewGlobalRef(env->GetObjectField(_jobjectContextMessage, jidMessage)));
-
- ManagedLog::LOGGER->LogStop("ContextMessageClr2Java::ContextMessageClr2Java");
- }
-
- String^ ContextMessageClr2Java::GetId() {
- ManagedLog::LOGGER->Log("ContextMessageClr2Java::GetId");
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringId);
- }
-
- String^ ContextMessageClr2Java::GetMessageSourceId() {
- ManagedLog::LOGGER->Log("ContextMessageClr2Java::GetMessageSourceId");
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringSourceId);
- }
-
- array<byte>^ ContextMessageClr2Java::Get() {
- ManagedLog::LOGGER->Log("ContextMessageClr2Java::Get");
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedByteArrayFromJavaByteArray(env, _jarrayMessage);
- }
-
- void ContextMessageClr2Java::OnError(String^ message) {
- ManagedLog::LOGGER->Log("ContextMessageClr2Java::OnError");
- JNIEnv *env = RetrieveEnv(_jvm);
- HandleClr2JavaError(env, message, _jobjectContextMessage);
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/EvaluatorRequestorClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/EvaluatorRequestorClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/EvaluatorRequestorClr2Java.cpp
deleted file mode 100644
index 2daed9e..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/EvaluatorRequestorClr2Java.cpp
+++ /dev/null
@@ -1,73 +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 {
- namespace Clr2java {
- ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
- };
-
- EvaluatorRequestorClr2Java::EvaluatorRequestorClr2Java(JNIEnv *env, jobject jevaluatorRequestor) {
- ManagedLog::LOGGER->LogStart("EvaluatorRequestorClr2Java::EvaluatorRequestorClr2Java");
- pin_ptr<JavaVM*> pJavaVm = &_jvm;
- if (env->GetJavaVM(pJavaVm) != 0) {
- ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
- }
- _jobjectEvaluatorRequestor = reinterpret_cast<jobject>(env->NewGlobalRef(jevaluatorRequestor));
- ManagedLog::LOGGER->LogStop("EvaluatorRequestorClr2Java::EvaluatorRequestorClr2Java");
- }
-
- void EvaluatorRequestorClr2Java::Submit(IEvaluatorRequest^ request) {
- ManagedLog::LOGGER->LogStart("EvaluatorRequestorClr2Java::Submit");
- JNIEnv *env = RetrieveEnv(_jvm);
- jclass jclassEvaluatorRequestor = env->GetObjectClass(_jobjectEvaluatorRequestor);
- jmethodID jmidSubmit = env->GetMethodID(jclassEvaluatorRequestor, "submit", "(IIILjava/lang/String;)V");
-
- if (jmidSubmit == NULL) {
- fprintf(stdout, " jmidSubmit is NULL\n");
- fflush(stdout);
- return;
- }
- env->CallObjectMethod(
- _jobjectEvaluatorRequestor,
- jmidSubmit,
- request->Number,
- request->MemoryMegaBytes,
- request->VirtualCore,
- JavaStringFromManagedString(env, request->Rack));
- ManagedLog::LOGGER->LogStop("EvaluatorRequestorClr2Java::Submit");
- }
-
- void EvaluatorRequestorClr2Java::OnError(String^ message) {
- ManagedLog::LOGGER->Log("EvaluatorRequestorClr2Java::OnError");
- JNIEnv *env = RetrieveEnv(_jvm);
- HandleClr2JavaError(env, message, _jobjectEvaluatorRequestor);
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/492da34a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedContextClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedContextClr2Java.cpp b/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedContextClr2Java.cpp
deleted file mode 100644
index 5a96202..0000000
--- a/lang/cpp/reef-bridge-clr/src/main/Cpp/CppBridge/JavaClrBridge/FailedContextClr2Java.cpp
+++ /dev/null
@@ -1,98 +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 {
- namespace Clr2java {
- ref class ManagedLog {
- internal:
- static BridgeLogger^ LOGGER = BridgeLogger::GetLogger("<C++>");
- };
- FailedContextClr2Java::FailedContextClr2Java(JNIEnv *env, jobject jobjectFailedContext) {
- ManagedLog::LOGGER->LogStart("FailedContextClr2Java::FailedContextClr2Java");
-
- pin_ptr<JavaVM*> pJavaVm = &_jvm;
- if (env->GetJavaVM(pJavaVm) != 0) {
- ManagedLog::LOGGER->LogError("Failed to get JavaVM", nullptr);
- }
- _jobjectFailedContext = reinterpret_cast<jobject>(env->NewGlobalRef(jobjectFailedContext));
- jclass jclassFailedContext = env->GetObjectClass(_jobjectFailedContext);
-
- jfieldID jidContextId = env->GetFieldID(jclassFailedContext, "contextId", "Ljava/lang/String;");
- jfieldID jidEvaluatorId = env->GetFieldID(jclassFailedContext, "evaluatorId", "Ljava/lang/String;");
- jfieldID jidParentId = env->GetFieldID(jclassFailedContext, "parentContextId", "Ljava/lang/String;");
-
- _jstringContextId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectFailedContext, jidContextId)));
- _jstringEvaluatorId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectFailedContext, jidEvaluatorId)));
- _jstringParentContextId = reinterpret_cast<jstring>(env->NewGlobalRef(env->GetObjectField(_jobjectFailedContext, jidParentId)));
-
- ManagedLog::LOGGER->LogStop("FailedContextClr2Java::FailedContextClr2Java");
- }
-
- IActiveContextClr2Java^ FailedContextClr2Java::GetParentContext() {
- ManagedLog::LOGGER->LogStart("FailedContextClr2Java::GetParentContext");
-
- JNIEnv *env = RetrieveEnv(_jvm);
-
- jclass jclassFailedContext = env->GetObjectClass(_jobjectFailedContext);
- jfieldID jidParentContext = env->GetFieldID(jclassFailedContext, "parentContext", "Lorg/apache/reef/javabridge/ActiveContextBridge;");
- jobject jobjectParentContext = env->GetObjectField(_jobjectFailedContext, jidParentContext);
- ManagedLog::LOGGER->LogStop("FailedContextClr2Java::GetParentContext");
-
- return gcnew ActiveContextClr2Java(env, jobjectParentContext);
- }
-
- String^ FailedContextClr2Java::GetId() {
- ManagedLog::LOGGER->Log("FailedContextClr2Java::GetId");
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringContextId);
- }
-
- String^ FailedContextClr2Java::GetEvaluatorId() {
- ManagedLog::LOGGER->Log("FailedContextClr2Java::GetEvaluatorId");
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringEvaluatorId);
- }
-
- String^ FailedContextClr2Java::GetParentId() {
- ManagedLog::LOGGER->Log("FailedContextClr2Java::GetParentId");
- JNIEnv *env = RetrieveEnv(_jvm);
- return ManagedStringFromJavaString(env, _jstringParentContextId);
- }
-
- IEvaluatorDescriptor^ FailedContextClr2Java::GetEvaluatorDescriptor() {
- ManagedLog::LOGGER->LogStart("FailedContextClr2Java::GetEvaluatorDescriptor");
- return CommonUtilities::RetrieveEvaluatorDescriptor(_jobjectFailedContext, _jvm);
- }
-
- void FailedContextClr2Java::OnError(String^ message) {
- ManagedLog::LOGGER->Log("FailedContextClr2Java::OnError");
- JNIEnv *env = RetrieveEnv(_jvm);
- HandleClr2JavaError(env, message, _jobjectFailedContext);
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file