001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.reef.javabridge; 020 021import org.apache.reef.annotations.audience.Interop; 022import org.apache.reef.annotations.audience.Private; 023import org.apache.reef.javabridge.generic.DriverRestartCompletedBridge; 024 025/** 026 * Java interfaces of CLR/Java bridge. 027 * Implementations of the methods can be found at lang/cs/Org.Apache.REEF.Bridge/JavaClrBridge.cpp. 028 */ 029@Private 030@Interop(CppFiles = { "JavaClrBridge.h", "JavaClrBridge.cpp" }) 031public final class NativeInterop { 032 public static final String GLOBAL_LIBRARIES_FILENAME = "userSuppliedGlobalLibraries.txt"; 033 034 public static native void loadClrAssembly(final String filePath); 035 036 public static native void clrBufferedLog(final int level, final String message); 037 038 public static native void callClrSystemOnStartHandler(); 039 040 public static native void clrSystemAllocatedEvaluatorHandlerOnNext( 041 final long handle, 042 final AllocatedEvaluatorBridge javaEvaluatorBridge, 043 final InteropLogger interopLogger 044 ); 045 046 public static native void clrSystemActiveContextHandlerOnNext( 047 final long handle, 048 final ActiveContextBridge javaActiveContextBridge, 049 final InteropLogger interopLogger 050 ); 051 052 public static native void clrSystemTaskMessageHandlerOnNext( 053 final long handle, 054 final byte[] message, 055 final TaskMessageBridge javaTaskMessageBridge, 056 final InteropLogger interopLogger 057 ); 058 059 public static native void clrSystemFailedTaskHandlerOnNext( 060 final long handle, 061 final FailedTaskBridge failedTaskBridge, 062 final InteropLogger interopLogger 063 ); 064 065 public static native void clrSystemHttpServerHandlerOnNext( 066 final long handle, 067 final HttpServerEventBridge httpServerEventBridge, 068 final InteropLogger interopLogger 069 ); 070 071 public static native void clrSystemFailedEvaluatorHandlerOnNext( 072 final long handle, 073 final FailedEvaluatorBridge failedEvaluatorBridge, 074 final InteropLogger interopLogger 075 ); 076 077 public static native void clrSystemCompletedTaskHandlerOnNext( 078 final long handle, 079 final CompletedTaskBridge completedTaskBridge, 080 final InteropLogger interopLogger 081 ); 082 083 public static native void clrSystemRunningTaskHandlerOnNext( 084 final long handle, 085 final RunningTaskBridge runningTaskBridge, 086 final InteropLogger interopLogger 087 ); 088 089 public static native void clrSystemSuspendedTaskHandlerOnNext( 090 final long handle, 091 final SuspendedTaskBridge suspendedTaskBridge 092 ); 093 094 public static native void clrSystemCompletedEvaluatorHandlerOnNext( 095 final long handle, 096 final CompletedEvaluatorBridge completedEvaluatorBridge 097 ); 098 099 public static native void clrSystemClosedContextHandlerOnNext( 100 final long handle, 101 final ClosedContextBridge closedContextBridge 102 ); 103 104 public static native void clrSystemFailedContextHandlerOnNext( 105 final long handle, 106 final FailedContextBridge failedContextBridge 107 ); 108 109 public static native void clrSystemContextMessageHandlerOnNext( 110 final long handle, 111 final ContextMessageBridge contextMessageBridge 112 ); 113 114 public static native void callClrSystemOnRestartHandler( 115 final DriverRestartedBridge driverRestartedBridge 116 ); 117 118 public static native void clrSystemDriverRestartActiveContextHandlerOnNext( 119 final long handle, 120 final ActiveContextBridge activeContextBridge 121 ); 122 123 public static native void clrSystemDriverRestartRunningTaskHandlerOnNext( 124 final long handle, 125 final RunningTaskBridge runningTaskBridge 126 ); 127 128 public static native void clrSystemDriverRestartCompletedHandlerOnNext( 129 final long handle, 130 final DriverRestartCompletedBridge driverRestartCompletedBridge 131 ); 132 133 public static native void clrSystemDriverRestartFailedEvaluatorHandlerOnNext( 134 final long handle, 135 final FailedEvaluatorBridge failedEvaluatorBridge, 136 final InteropLogger interopLogger 137 ); 138 139 public static native float clrSystemProgressProviderGetProgress(final long handle); 140 141 public static native void clrSystemSetupBridgeHandlerManager( 142 final String httpServerPortNumber, 143 final BridgeHandlerManager bridgeHandlerManager, 144 final EvaluatorRequestorBridge javaEvaluatorRequestorBridge 145 ); 146 147 /** 148 * Empty private constructor to prohibit instantiation of utility class. 149 */ 150 private NativeInterop() { 151 } 152}