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 final String dateTime, 040 final String httpServerPortNumber, 041 final BridgeHandlerManager bridgeHandlerManager, 042 final EvaluatorRequestorBridge javaEvaluatorRequestorBridge); 043 044 public static native void clrSystemAllocatedEvaluatorHandlerOnNext( 045 final long handle, 046 final AllocatedEvaluatorBridge javaEvaluatorBridge, 047 final InteropLogger interopLogger 048 ); 049 050 public static native void clrSystemActiveContextHandlerOnNext( 051 final long handle, 052 final ActiveContextBridge javaActiveContextBridge, 053 final InteropLogger interopLogger 054 ); 055 056 public static native void clrSystemTaskMessageHandlerOnNext( 057 final long handle, 058 final byte[] message, 059 final TaskMessageBridge javaTaskMessageBridge, 060 final InteropLogger interopLogger 061 ); 062 063 public static native void clrSystemFailedTaskHandlerOnNext( 064 final long handle, 065 final FailedTaskBridge failedTaskBridge, 066 final InteropLogger interopLogger 067 ); 068 069 public static native void clrSystemHttpServerHandlerOnNext( 070 final long handle, 071 final HttpServerEventBridge httpServerEventBridge, 072 final InteropLogger interopLogger 073 ); 074 075 public static native void clrSystemFailedEvaluatorHandlerOnNext( 076 final long handle, 077 final FailedEvaluatorBridge failedEvaluatorBridge, 078 final InteropLogger interopLogger 079 ); 080 081 public static native void clrSystemCompletedTaskHandlerOnNext( 082 final long handle, 083 final CompletedTaskBridge completedTaskBridge, 084 final InteropLogger interopLogger 085 ); 086 087 public static native void clrSystemRunningTaskHandlerOnNext( 088 final long handle, 089 final RunningTaskBridge runningTaskBridge, 090 final InteropLogger interopLogger 091 ); 092 093 public static native void clrSystemSuspendedTaskHandlerOnNext( 094 final long handle, 095 final SuspendedTaskBridge suspendedTaskBridge 096 ); 097 098 public static native void clrSystemCompletedEvaluatorHandlerOnNext( 099 final long handle, 100 final CompletedEvaluatorBridge completedEvaluatorBridge 101 ); 102 103 public static native void clrSystemClosedContextHandlerOnNext( 104 final long handle, 105 final ClosedContextBridge closedContextBridge 106 ); 107 108 public static native void clrSystemFailedContextHandlerOnNext( 109 final long handle, 110 final FailedContextBridge failedContextBridge 111 ); 112 113 public static native void clrSystemContextMessageHandlerOnNext( 114 final long handle, 115 final ContextMessageBridge contextMessageBridge 116 ); 117 118 public static native void callClrSystemOnRestartHandler( 119 final String httpServerPortNumber, 120 final BridgeHandlerManager bridgeHandlerManager, 121 final EvaluatorRequestorBridge javaEvaluatorRequestorBridge, 122 final DriverRestartedBridge driverRestartedBridge 123 ); 124 125 public static native void clrSystemDriverRestartActiveContextHandlerOnNext( 126 final long handle, 127 final ActiveContextBridge activeContextBridge 128 ); 129 130 public static native void clrSystemDriverRestartRunningTaskHandlerOnNext( 131 final long handle, 132 final RunningTaskBridge runningTaskBridge 133 ); 134 135 public static native void clrSystemDriverRestartCompletedHandlerOnNext( 136 final long handle, 137 final DriverRestartCompletedBridge driverRestartCompletedBridge 138 ); 139 140 public static native void clrSystemDriverRestartFailedEvaluatorHandlerOnNext( 141 final long handle, 142 final FailedEvaluatorBridge failedEvaluatorBridge, 143 final InteropLogger interopLogger 144 ); 145 146 public static native float clrSystemProgressProviderGetProgress(final long handle); 147 148 /** 149 * Empty private constructor to prohibit instantiation of utility class. 150 */ 151 private NativeInterop() { 152 } 153}