/*
(non-Javadoc)

@see com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor#
getStaticFileWrapper(com.ibm.wsspi.webcontainer.servlet.IServletContext,
com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor, java.io.File)
500824
protected com.ibm.ws.webcontainer.servlet.FileServletWrapper getStaticFileWrapper(IServletContext _webapp, com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor processor,
                                                                                    File file)
  {
    // TODO Auto-generated method stub
    return new StaticFileServletWrapper(_webapp, processor, file);
  }
1011708
public static String getStaticPath() {
        if (null == staticPath) {
            staticPath = getLatkeProperty("staticPath");

            if (null == staticPath) {
                staticPath = getContextPath();
            }
        }

        return staticPath;
    }
498362
public static<T extends Object> T getWrapper(Class<T> clientType){
        return getWrapper(clientType,generateClientId(clientType));
    }
343246
public long getFilePointer() throws UnsupportedOperationException,
			IOException {

		if (raf != null) {
			return raf.getFilePointer();
		} else if (otherLineReader != null) {
			return ((BufferedFileLineReader) otherLineReader).getFilePointer();
		} else {
			throw new UnsupportedOperationException(
					"Cannot get a file pointer without randon access file");
		}
	}
185928
public static URLClassLoader getClassLoaderForExtension(File extension, boolean useExtensionClassloaderFirst)
  {
    return loadersMap.computeIfAbsent(
        extension,
        theExtension -> makeClassLoaderForExtension(theExtension, useExtensionClassloaderFirst)
    );
  }
609908
@javax.annotation.Nonnull
  public File getResourceDir() {
    @javax.annotation.Nonnull final File etc = new File(workingDir, "etc");
    etc.mkdirs();
    return etc;
  }
789559
@Override public RecordWriter<K,VariantContextWritable> getRecordWriter(
			TaskAttemptContext ctx)
		throws IOException
	{
		Configuration conf = ctx.getConfiguration();
		boolean isCompressed = getCompressOutput(ctx);
		CompressionCodec codec = null;
		String extension = "";
		if (isCompressed) {
			Class<? extends CompressionCodec> codecClass =
					getOutputCompressorClass(ctx, BGZFCodec.class);
			codec = ReflectionUtils.newInstance(codecClass, conf);
			extension = codec.getDefaultExtension();
		}
		Path file = getDefaultWorkFile(ctx, extension);
		if (!isCompressed) {
			return getRecordWriter(ctx, file);
		} else {
			FileSystem fs = file.getFileSystem(conf);
			return getRecordWriter(ctx, codec.createOutputStream(fs.create(file)));
		}
	}
1321662
public static File  withDefaultType( File file, Type defaultType)
    {
    return
      file != null && FilenameUtils.getExtension( file.getName()).isEmpty()
      ? new File( String.format( "%s.%s", file.getPath(), String.valueOf( defaultType).toLowerCase()))
      : file;
    }
1248042
static File getTargetFile(final File root, final MiscContentItem item) {
        return PatchContentLoader.getMiscPath(root, item);
    }
1009598
public String findSourceFile(StackTraceElement[] target, String defaultValue) {
        for (StackTraceElement e : target) {
            if (CLEANER.isIn(e)) {
                return e.getFileName();
            }
        }
        return defaultValue;
    }
732731
@VisibleForTesting
	List<File> getProcessConfigFiles() {
		// TODO : should use a FileVisitor (Once we update to Java 7)
		File[] files;
		File configurationDirOrFile = configuration.getProcessConfigDirOrFile();
		if (configurationDirOrFile == null) {
			throw new IllegalStateException("Configuration should specify configuration directory or file, with -j of -f option");
		}
		if (configurationDirOrFile.isFile()) {
			files = new File[1];
			files[0] = configurationDirOrFile;
		} else {
			files = firstNonNull(configurationDirOrFile.listFiles(), new File[0]);
		}

		List<File> result = new ArrayList<>();
		for (File file : files) {
			if (this.isProcessConfigFile(file)) {
				result.add(file);
			}
		}
		return result;
	}
1181202
private static File getCodeSourceArchive() {
        try {
            CodeSource codeSource = DocumentRootHelper.class.getProtectionDomain().getCodeSource();
            URL location = (codeSource == null ? null : codeSource.getLocation());
            if (location == null) {
                return null;
            }
            String path = location.getPath();
            URLConnection connection = location.openConnection();
            if (connection instanceof JarURLConnection) {
                path = ((JarURLConnection) connection).getJarFile().getName();
            }
            if (path.indexOf("!/") != -1) {
                path = path.substring(0, path.indexOf("!/"));
            }
            return new File(path);
        } catch (IOException ex) {
            return null;
        }
    }
1132416
def get_handler(self, *args, **options):
        '''
        
        '''
        handler = super().get_handler(*args, **options)
        use_static_handler = options['use_static_handler']
        insecure_serving = options['insecure_serving']
        if use_static_handler and (settings.DEBUG or insecure_serving):
            return CRAStaticFilesHandler(handler)
        return handler
1087504
protected FileWrapper handleGetFileContentWithMetaData(Class<? extends FileEntity> type, Integer entityId, Integer fileId) {
        FileWrapper fileWrapper = null;
        try {
            FileContent fileContent = this.handleGetFileContent(type, entityId, fileId);

            List<FileMeta> metaDataList = this.handleGetEntityMetaFiles(type, entityId);
            FileMeta correctMetaData = null;
            for (FileMeta metaData : metaDataList) {
                if (fileId.equals(metaData.getId())) {
                    correctMetaData = metaData;
                    break;
                }
            }

            fileWrapper = new StandardFileWrapper(fileContent, correctMetaData);
        } catch (Exception e) {
            log.error("Error getting file with id: " + fileId + " for " + type.getSimpleName() + " with id:" + entityId);
        }

        return fileWrapper;
    }
702103
private static File getWarLocation() {
        URL resource = JettyConsoleBootstrapMainClass.class.getResource("/META-INF/jettyconsole/jettyconsole.properties");
        String file = resource.getFile();
        file = file.substring("file:".length(), file.indexOf("!"));
        try {
            file = URLDecoder.decode(file, "utf-8");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        return new File(file);
    }
1126479
private static IFile getUserPreferencesFile(IProject project) {
        IFile defaultFile = project.getFile(DEFAULT_PREFS_PATH);
        IFile oldFile = project.getFile(DEPRECATED_PREFS_PATH);
        if (defaultFile.isAccessible() || !oldFile.isAccessible()) {
            return defaultFile;
        }
        return oldFile;
    }
887260
private static FileResource getFileResourceProto(final String fileName, final FileType type) throws IOException {
    File file = new File(fileName);
    if (file.exists()) {
      // It is a local file and can be added.
      if (file.isDirectory()) {
        // If it is a directory, create a JAR file of it and add that instead.
        file = toJar(file);
      }
      return FileResourceImpl.newBuilder()
          .setName(file.getName())
          .setPath(file.getPath())
          .setType(type)
          .build();
    } else {
      // The file isn't in the local filesytem. Assume that the file is actually a URI.
      // We then assume that the underlying resource manager knows how to deal with it.
      try {
        final URI uri = new URI(fileName);
        final String path = uri.getPath();
        final String name = path.substring(path.lastIndexOf('/') + 1);
        return FileResourceImpl.newBuilder()
            .setName(name)
            .setPath(uri.toString())
            .setType(type)
            .build();
      } catch (final URISyntaxException e) {
        throw new IOException("Unable to parse URI.", e);
      }
    }
  }