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
| 42 | * to application level classes. |
| 43 | */ |
| 44 | public 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(); |
nothing calls this directly
no test coverage detected