public class LoadService
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
LoadService.LoadPathMethods |
static class |
LoadService.SuffixType |
| Modifier and Type | Field and Description |
|---|---|
protected static java.util.regex.Pattern |
extensionPattern |
protected java.util.Map<java.lang.String,java.util.jar.JarFile> |
jarFiles |
protected LibrarySearcher |
librarySearcher |
protected StringArraySet |
loadedFeatures |
protected RubyArray |
loadPath |
protected Ruby |
runtime |
protected static java.util.regex.Pattern |
sourcePattern |
| Constructor and Description |
|---|
LoadService(Ruby runtime) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addPath(java.lang.String path) |
void |
addPaths(java.util.List<java.lang.String> additionalDirectories)
Add additional directories to the load path.
|
void |
addPaths(java.lang.String... additionalDirectories)
Add additional directories to the load path.
|
boolean |
autoloadRequire(RubyString requireName) |
protected void |
checkEmptyLoad(java.lang.String file) |
static java.lang.String |
classpathFilenameFromURL(java.lang.String name,
java.net.URL loc,
boolean isClasspathScheme)
Given a URL to a classloader resource, build an appropriate load string.
|
protected Library |
createLibrary(java.lang.String baseName,
java.lang.String loadName,
LoadServiceResource resource) |
protected void |
debugLogFound(LoadServiceResource resource) |
protected void |
debugLogFound(java.lang.String what,
java.lang.String msg) |
protected void |
debugLogTry(java.lang.String what,
java.lang.String msg) |
boolean |
featureAlreadyLoaded(java.lang.String feature) |
boolean |
featureAlreadyLoaded(java.lang.String feature,
java.lang.String[] loading) |
protected LoadServiceResource |
findFileInClasspath(java.lang.String name)
this method uses the appropriate lookup strategy to find a file.
|
protected LibrarySearcher.FoundLibrary |
findLibraryWithClassloaders(java.lang.String baseName,
LoadService.SuffixType suffixType) |
LoadServiceResource |
getClassPathResource(java.lang.ClassLoader classLoader,
java.lang.String name) |
IRubyObject |
getLoadedFeatures() |
IRubyObject |
getLoadPath() |
protected java.lang.String |
getLoadPathEntry(IRubyObject entry) |
RubyModule |
getWrapperSelf() |
void |
init(java.util.List<java.lang.String> prependDirectories)
Called to initialize the load path with a set of optional prepended
directories and then the standard set of dirs.
|
protected boolean |
isJarfileLibrary(Library library,
java.lang.String file) |
protected static boolean |
isRequireable(java.net.URL loc) |
void |
load(java.lang.String file,
boolean wrap) |
void |
load(java.lang.String file,
IRubyObject wrapWith) |
void |
loadFromClassLoader(java.lang.ClassLoader classLoader,
java.lang.String file,
boolean wrap) |
void |
provide(java.lang.String name) |
static void |
reflectedLoad(Ruby runtime,
java.lang.String libraryName,
java.lang.String className,
java.lang.ClassLoader classLoader,
boolean wrap)
Load the org.jruby.runtime.load.Library implementation specified by
className.
|
boolean |
require(java.lang.String requireName) |
protected java.lang.String |
resolveLoadName(LoadServiceResource foundResource,
java.lang.String previousPath) |
protected LibrarySearcher.FoundLibrary |
searchForLoad(java.lang.String file)
Replaces findLibraryBySearchState but split off for load.
|
char |
searchForRequire(java.lang.String file,
LibrarySearcher.FoundLibrary[] path)
Replaces findLibraryBySearchState but split off for require.
|
protected boolean |
tryLoadingLibraryOrScript(Ruby runtime,
Library library,
java.lang.String searchFile) |
protected void |
warnCircularRequire(java.lang.String requireName) |
protected static final java.util.regex.Pattern sourcePattern
protected static final java.util.regex.Pattern extensionPattern
protected RubyArray loadPath
protected StringArraySet loadedFeatures
protected final java.util.Map<java.lang.String,java.util.jar.JarFile> jarFiles
protected final Ruby runtime
protected LibrarySearcher librarySearcher
public LoadService(Ruby runtime)
public void init(java.util.List<java.lang.String> prependDirectories)
prependDirectories - public void addPaths(java.util.List<java.lang.String> additionalDirectories)
additionalDirectories - a List of additional dirs to append to the load pathpublic void addPaths(java.lang.String... additionalDirectories)
additionalDirectories - an array of additional dirs to append to the load pathpublic void provide(java.lang.String name)
protected void addPath(java.lang.String path)
public RubyModule getWrapperSelf()
public void load(java.lang.String file,
IRubyObject wrapWith)
public void load(java.lang.String file,
boolean wrap)
public void loadFromClassLoader(java.lang.ClassLoader classLoader,
java.lang.String file,
boolean wrap)
public boolean require(java.lang.String requireName)
public boolean autoloadRequire(RubyString requireName)
protected void warnCircularRequire(java.lang.String requireName)
public static void reflectedLoad(Ruby runtime, java.lang.String libraryName, java.lang.String className, java.lang.ClassLoader classLoader, boolean wrap)
runtime - The runtime in which to loadlibraryName - The name of the library, to use for error messagesclassName - The class of the libraryclassLoader - The classloader to use to load itwrap - Whether to wrap top-level in an anonymous modulepublic IRubyObject getLoadPath()
public IRubyObject getLoadedFeatures()
protected boolean isJarfileLibrary(Library library, java.lang.String file)
protected boolean tryLoadingLibraryOrScript(Ruby runtime, Library library, java.lang.String searchFile)
protected void checkEmptyLoad(java.lang.String file)
throws RaiseException
RaiseExceptionprotected final void debugLogTry(java.lang.String what,
java.lang.String msg)
protected final void debugLogFound(LoadServiceResource resource)
protected final void debugLogFound(java.lang.String what,
java.lang.String msg)
public char searchForRequire(java.lang.String file,
LibrarySearcher.FoundLibrary[] path)
protected LibrarySearcher.FoundLibrary searchForLoad(java.lang.String file)
public boolean featureAlreadyLoaded(java.lang.String feature)
public boolean featureAlreadyLoaded(java.lang.String feature,
java.lang.String[] loading)
protected LibrarySearcher.FoundLibrary findLibraryWithClassloaders(java.lang.String baseName, LoadService.SuffixType suffixType)
protected Library createLibrary(java.lang.String baseName, java.lang.String loadName, LoadServiceResource resource)
protected java.lang.String getLoadPathEntry(IRubyObject entry)
protected LoadServiceResource findFileInClasspath(java.lang.String name)
MRI: rb_find_file
name - the file to find, this is a path nameprotected static boolean isRequireable(java.net.URL loc)
public LoadServiceResource getClassPathResource(java.lang.ClassLoader classLoader, java.lang.String name)
public static java.lang.String classpathFilenameFromURL(java.lang.String name,
java.net.URL loc,
boolean isClasspathScheme)
name - the original filename requestedloc - the URL to the resourceisClasspathScheme - whether we're using the classpath: scehemeprotected java.lang.String resolveLoadName(LoadServiceResource foundResource, java.lang.String previousPath)
Copyright © 2001-2023 JRuby. All Rights Reserved.