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.runtime.common.files; 020 021import net.jcip.annotations.Immutable; 022 023import javax.inject.Inject; 024import java.io.File; 025 026/** 027 * Access to the various places things go according to the REEF file system standard. 028 */ 029@Immutable 030public final class REEFFileNames { 031 032 private static final String REEF_BASE_FOLDER = "reef"; 033 private static final String GLOBAL_FOLDER = "global"; 034 private static final String GLOBAL_FOLDER_PATH = REEF_BASE_FOLDER + '/' + GLOBAL_FOLDER; 035 private static final String LOCAL_FOLDER = "local"; 036 private static final String LOCAL_FOLDER_PATH = REEF_BASE_FOLDER + '/' + LOCAL_FOLDER; 037 private static final String DRIVER_CONFIGURATION_NAME = "driver.conf"; 038 private static final String DRIVER_CONFIGURATION_PATH = 039 LOCAL_FOLDER_PATH + '/' + DRIVER_CONFIGURATION_NAME; 040 private static final String EVALUATOR_CONFIGURATION_NAME = "evaluator.conf"; 041 private static final String EVALUATOR_CONFIGURATION_PATH = 042 LOCAL_FOLDER_PATH + '/' + EVALUATOR_CONFIGURATION_NAME; 043 private static final String JAR_FILE_SUFFIX = ".jar"; 044 private static final String JOB_FOLDER_PREFIX = "reef-job-"; 045 private static final String EVALUATOR_FOLDER_PREFIX = "reef-evaluator-"; 046 private static final String DRIVER_STDERR = "driver.stderr"; 047 private static final String DRIVER_STDOUT = "driver.stdout"; 048 private static final String EVALUATOR_STDERR = "evaluator.stderr"; 049 private static final String EVALUATOR_STDOUT = "evaluator.stdout"; 050 @Deprecated 051 private static final String REEF_DRIVER_APPDLL_DIR = "/ReefDriverAppDlls/"; 052 @Deprecated 053 private static final String TMP_LOAD_DIR = "/reef/CLRLoadingDirectory"; 054 private static final String BRIDGE_DLL_NAME = "Org.Apache.REEF.Bridge.dll"; 055 056 057 @Inject 058 public REEFFileNames() { 059 } 060 061 062 /** 063 * @return the filename of the CPP DLL for the bridge. 064 */ 065 public String getBridgeDLLName() { 066 return BRIDGE_DLL_NAME; 067 } 068 069 /** 070 * reef/local/BRIDGE_DLL_NAME 071 * 072 * @return the File pointing to the DLL containing the DLL for the bridge. 073 */ 074 public File getBridgeDLLInLocalFolderFile() { 075 return new File(getLocalFolder(), getBridgeDLLName()); 076 } 077 078 /** 079 * @return a File pointing to the Bridge DLL in the global folder. 080 */ 081 public File getBridgeDLLInGlobalFolderFile() { 082 return new File(getGlobalFolder(), getBridgeDLLName()); 083 } 084 085 086 /** 087 * The name of the REEF folder inside of the working directory of an Evaluator or Driver 088 */ 089 public String getREEFFolderName() { 090 return REEF_BASE_FOLDER; 091 } 092 093 /** 094 * @return the folder und which all REEF files are stored. 095 */ 096 public File getREEFFolder() { 097 return new File(getREEFFolderName()); 098 } 099 100 101 /** 102 * @return the name of the folder inside of REEF_BASE_FOLDER that houses the global files. 103 */ 104 public String getGlobalFolderName() { 105 return GLOBAL_FOLDER; 106 } 107 108 /** 109 * @return the path to the global folder: REEF_BASE_FOLDER/GLOBAL_FOLDER 110 */ 111 public String getGlobalFolderPath() { 112 return GLOBAL_FOLDER_PATH; 113 } 114 115 /** 116 * @return the folder holding the files global to all containers. 117 */ 118 public File getGlobalFolder() { 119 return new File(getREEFFolder(), getGlobalFolderName()); 120 } 121 122 123 /** 124 * @return the name of the folder inside of REEF_BASE_FOLDER that houses the local files. 125 */ 126 public String getLocalFolderName() { 127 return LOCAL_FOLDER; 128 } 129 130 /** 131 * @return the path to the local folder: REEF_BASE_FOLDER/LOCAL_FOLDER 132 */ 133 public String getLocalFolderPath() { 134 return LOCAL_FOLDER_PATH; 135 } 136 137 /** 138 * @return the folder holding the files local to this container. 139 */ 140 public File getLocalFolder() { 141 return new File(getREEFFolder(), getLocalFolderName()); 142 } 143 144 145 /** 146 * The name under which the driver configuration will be stored in REEF_BASE_FOLDER/LOCAL_FOLDER 147 */ 148 public String getDriverConfigurationName() { 149 return DRIVER_CONFIGURATION_NAME; 150 } 151 152 /** 153 * @return The path to the driver configuration: GLOBAL_FOLDER/LOCAL_FOLDER/DRIVER_CONFIGURATION_NAME 154 */ 155 public String getDriverConfigurationPath() { 156 return DRIVER_CONFIGURATION_PATH; 157 } 158 159 /** 160 * @return The name under which the driver configuration will be stored in REEF_BASE_FOLDER/LOCAL_FOLDER 161 */ 162 public String getEvaluatorConfigurationName() { 163 return EVALUATOR_CONFIGURATION_NAME; 164 } 165 166 /** 167 * @return the path to the evaluator configuration. 168 */ 169 public String getEvaluatorConfigurationPath() { 170 return EVALUATOR_CONFIGURATION_PATH; 171 } 172 173 /** 174 * @return The suffix used for JAR files, including the "." 175 */ 176 public String getJarFileSuffix() { 177 return JAR_FILE_SUFFIX; 178 } 179 180 /** 181 * The prefix used whenever REEF is asked to create a job folder, on (H)DFS or locally. 182 * <p/> 183 * This prefix is also used with JAR files created to represent a job. 184 */ 185 public String getJobFolderPrefix() { 186 return JOB_FOLDER_PREFIX; 187 } 188 189 /** 190 * @return The name used within the current working directory of the driver to redirect standard error to. 191 */ 192 public String getDriverStderrFileName() { 193 return DRIVER_STDERR; 194 } 195 196 /** 197 * @return The name used within the current working directory of the driver to redirect standard out to. 198 */ 199 public String getDriverStdoutFileName() { 200 return DRIVER_STDOUT; 201 } 202 203 /** 204 * @return The prefix used whenever REEF is asked to create an Evaluator folder, e.g. for staging. 205 */ 206 public String getEvaluatorFolderPrefix() { 207 return EVALUATOR_FOLDER_PREFIX; 208 } 209 210 /** 211 * @return The name used within the current working directory of the driver to redirect standard error to. 212 */ 213 public String getEvaluatorStderrFileName() { 214 return EVALUATOR_STDERR; 215 } 216 217 /** 218 * @return The name used within the current working directory of the driver to redirect standard out to. 219 */ 220 public String getEvaluatorStdoutFileName() { 221 return EVALUATOR_STDOUT; 222 } 223 224 225 /** 226 * @return reef driver app dll directory 227 */ 228 @Deprecated 229 public String getReefDriverAppDllDir() { 230 return REEF_DRIVER_APPDLL_DIR; 231 } 232 233 /** 234 * @return temp load directory 235 */ 236 @Deprecated 237 public String getLoadDir() { 238 return TMP_LOAD_DIR; 239 } 240}