MCPcopy Create free account
hub / github.com/apache/tomcat / Bootstrap

Class Bootstrap

java/org/apache/catalina/startup/Bootstrap.java:44–616  ·  view source on GitHub ↗

Bootstrap loader for Catalina. This application constructs a class loader for use in loading the Catalina internal classes (by accumulating all of the JAR files found in the "server" directory under "catalina.home"), and starts the regular execution of the container. The purpose of this roundabout a

Source from the content-addressed store, hash-verified

42 * to application level classes.
43 */
44public final class Bootstrap {
45
46 /**
47 * Default constructor.
48 */
49 public Bootstrap() {
50 }
51
52 private static final Log log = LogFactory.getLog(Bootstrap.class);
53
54 /**
55 * Daemon object used by main.
56 */
57 private static final Object daemonLock = new Object();
58 private static volatile Bootstrap daemon = null;
59
60 private static final File catalinaBaseFile;
61 private static final File catalinaHomeFile;
62
63 private static final Pattern PATH_PATTERN = Pattern.compile("(\"[^\"]*\")|(([^,])*)");
64
65 static {
66 // Will always be non-null
67 String userDir = System.getProperty("user.dir");
68
69 // Home first
70 String home = System.getProperty(Constants.CATALINA_HOME_PROP);
71 File homeFile = null;
72
73 if (home != null) {
74 File f = new File(home);
75 try {
76 homeFile = f.getCanonicalFile();
77 } catch (IOException ioe) {
78 homeFile = f.getAbsoluteFile();
79 }
80 }
81
82 if (homeFile == null) {
83 // First fall-back. See if current directory is a bin directory
84 // in a normal Tomcat install
85 File bootstrapJar = new File(userDir, "bootstrap.jar");
86
87 if (bootstrapJar.exists()) {
88 File f = new File(userDir, "..");
89 try {
90 homeFile = f.getCanonicalFile();
91 } catch (IOException ioe) {
92 homeFile = f.getAbsoluteFile();
93 }
94 }
95 }
96
97 if (homeFile == null) {
98 // Second fall-back. Use current directory
99 File f = new File(userDir);
100 try {
101 homeFile = f.getCanonicalFile();

Callers

nothing calls this directly

Calls 6

getLogMethod · 0.95
getPropertyMethod · 0.65
existsMethod · 0.65
getPathMethod · 0.65
compileMethod · 0.45
setPropertyMethod · 0.45

Tested by

no test coverage detected