Java 类org.apache.catalina.startup.Bootstrap 实例源码

项目:tomcat7    文件:SpnegoAuthenticator.java   
@Override
protected void initInternal() throws LifecycleException {
    super.initInternal();

    // Kerberos configuration file location
    String krb5Conf = System.getProperty(Constants.KRB5_CONF_PROPERTY);
    if (krb5Conf == null) {
        // System property not set, use the Tomcat default
        File krb5ConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_KRB5_CONF);
        System.setProperty(Constants.KRB5_CONF_PROPERTY,
                krb5ConfFile.getAbsolutePath());
    }

    // JAAS configuration file location
    String jaasConf = System.getProperty(Constants.JAAS_CONF_PROPERTY);
    if (jaasConf == null) {
        // System property not set, use the Tomcat default
        File jaasConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_JAAS_CONF);
        System.setProperty(Constants.JAAS_CONF_PROPERTY,
                jaasConfFile.getAbsolutePath());
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:SpnegoAuthenticator.java   
@Override
protected void initInternal() throws LifecycleException {
    super.initInternal();

    // Kerberos configuration file location
    String krb5Conf = System.getProperty(Constants.KRB5_CONF_PROPERTY);
    if (krb5Conf == null) {
        // System property not set, use the Tomcat default
        File krb5ConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_KRB5_CONF);
        System.setProperty(Constants.KRB5_CONF_PROPERTY,
                krb5ConfFile.getAbsolutePath());
    }

    // JAAS configuration file location
    String jaasConf = System.getProperty(Constants.JAAS_CONF_PROPERTY);
    if (jaasConf == null) {
        // System property not set, use the Tomcat default
        File jaasConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_JAAS_CONF);
        System.setProperty(Constants.JAAS_CONF_PROPERTY,
                jaasConfFile.getAbsolutePath());
    }
}
项目:lazycat    文件:SpnegoAuthenticator.java   
@Override
protected void initInternal() throws LifecycleException {
    super.initInternal();

    // Kerberos configuration file location
    String krb5Conf = System.getProperty(Constants.KRB5_CONF_PROPERTY);
    if (krb5Conf == null) {
        // System property not set, use the Tomcat default
        File krb5ConfFile = new File(Bootstrap.getCatalinaBase(), Constants.DEFAULT_KRB5_CONF);
        System.setProperty(Constants.KRB5_CONF_PROPERTY, krb5ConfFile.getAbsolutePath());
    }

    // JAAS configuration file location
    String jaasConf = System.getProperty(Constants.JAAS_CONF_PROPERTY);
    if (jaasConf == null) {
        // System property not set, use the Tomcat default
        File jaasConfFile = new File(Bootstrap.getCatalinaBase(), Constants.DEFAULT_JAAS_CONF);
        System.setProperty(Constants.JAAS_CONF_PROPERTY, jaasConfFile.getAbsolutePath());
    }
}
项目:lazycat    文件:WebApp.java   
public void stopConext() {
    int port = this.getTomcat().getPort();
    Bootstrap b = BootstrapManager.getBoostrap(port);

    if (null == b) {
        return;
    }
    List<Context> cs = b.listContexts();

    Context matchedContext = null;
    for (Context c : cs) {
        if (this.nameMatch(c)) {
            try {
                c.stop();
                matchedContext = c;
            } catch (LifecycleException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            break;
        }
    }
    if (matchedContext != null)
        cs.remove(matchedContext);
}
项目:lazycat    文件:BootstrapManager.java   
public synchronized static void stopTomcat(Tomcat t) {
    Bootstrap b = bs.get(t.getPort());
    if (null != b) {
        b.setStatus(Bootstrap.status_stopping);
        List<WebApp> ws = MapperUtil.webAppMapper.listByTomcat(t);
        for (WebApp w : ws) {
            w.getXMLFile().delete();
        }

        stopBootstrap(b);
        bs.remove(t.getPort());

        // �Ӹ��ӳ٣��Եú�Ŭ������ֹͣtomcat
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        b.setStatus(Bootstrap.status_stopped);
        bs.remove(b);
    }
}
项目:lazycat    文件:TomcatPanel.java   
public void syncStatus() {
    if (0 == ctm.cs.size()) {
        GUIUtil.setEnable(false, buttons);
        GUIUtil.setEnable(true, bAdd);
    } else {
        Tomcat t = getSelectedTomcat();
        if (t.getStatus().equals(Bootstrap.status_stopped)) {
            GUIUtil.setEnable(true, buttons);
            GUIUtil.setEnable(false, bStop);
        } else if (t.getStatus().equals(Bootstrap.status_started)) {
            GUIUtil.setEnable(false, buttons);
            GUIUtil.setEnable(true, bStop);
            GUIUtil.setEnable(true, bAdd);
        } else {
            GUIUtil.setEnable(true, buttons);
            GUIUtil.setEnable(false, bStop);

        }
    }
}
项目:lazycat    文件:TomcatTableStatusRender.java   
public void setValue(Object value) { // ��дsetValue�������Ӷ����Զ�̬�����е�Ԫ������ɫ

        switch (value.toString()) {
        case Bootstrap.status_started:
            setForeground(Color.decode("#006400"));
            break;

        case Bootstrap.status_stopped:
            setForeground(Color.darkGray);
            break;
        case Bootstrap.status_starting:
            setForeground(Color.decode("#CD853F"));
            break;
        case Bootstrap.status_stopping:
            setForeground(Color.decode("#CD853F"));
            break;
        default:
            setForeground(Color.decode("#F08080"));
            break;

        }
        Font f = new Font(Font.SANS_SERIF, Font.BOLD, 12);
        setFont(f);
        setText(value.toString());

    }
项目:class-guard    文件:SpnegoAuthenticator.java   
@Override
protected void initInternal() throws LifecycleException {
    super.initInternal();

    // Kerberos configuration file location
    String krb5Conf = System.getProperty(Constants.KRB5_CONF_PROPERTY);
    if (krb5Conf == null) {
        // System property not set, use the Tomcat default
        File krb5ConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_KRB5_CONF);
        System.setProperty(Constants.KRB5_CONF_PROPERTY,
                krb5ConfFile.getAbsolutePath());
    }

    // JAAS configuration file location
    String jaasConf = System.getProperty(Constants.JAAS_CONF_PROPERTY);
    if (jaasConf == null) {
        // System property not set, use the Tomcat default
        File jaasConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_JAAS_CONF);
        System.setProperty(Constants.JAAS_CONF_PROPERTY,
                jaasConfFile.getAbsolutePath());
    }
}
项目:apache-tomcat-7.0.57    文件:SpnegoAuthenticator.java   
@Override
protected void initInternal() throws LifecycleException {
    super.initInternal();

    // Kerberos configuration file location
    String krb5Conf = System.getProperty(Constants.KRB5_CONF_PROPERTY);
    if (krb5Conf == null) {
        // System property not set, use the Tomcat default
        File krb5ConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_KRB5_CONF);
        System.setProperty(Constants.KRB5_CONF_PROPERTY,
                krb5ConfFile.getAbsolutePath());
    }

    // JAAS configuration file location
    String jaasConf = System.getProperty(Constants.JAAS_CONF_PROPERTY);
    if (jaasConf == null) {
        // System property not set, use the Tomcat default
        File jaasConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_JAAS_CONF);
        System.setProperty(Constants.JAAS_CONF_PROPERTY,
                jaasConfFile.getAbsolutePath());
    }
}
项目:apache-tomcat-7.0.57    文件:SpnegoAuthenticator.java   
@Override
protected void initInternal() throws LifecycleException {
    super.initInternal();

    // Kerberos configuration file location
    String krb5Conf = System.getProperty(Constants.KRB5_CONF_PROPERTY);
    if (krb5Conf == null) {
        // System property not set, use the Tomcat default
        File krb5ConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_KRB5_CONF);
        System.setProperty(Constants.KRB5_CONF_PROPERTY,
                krb5ConfFile.getAbsolutePath());
    }

    // JAAS configuration file location
    String jaasConf = System.getProperty(Constants.JAAS_CONF_PROPERTY);
    if (jaasConf == null) {
        // System property not set, use the Tomcat default
        File jaasConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_JAAS_CONF);
        System.setProperty(Constants.JAAS_CONF_PROPERTY,
                jaasConfFile.getAbsolutePath());
    }
}
项目:dacapobench    文件:Control.java   
/**
 * This method gets invoked reflectively from the Tomcat harness so as to
 * avoid classloader strangeness. It would be more correct to use an enum for
 * the 'function' parameter, but we have classloader issues, so a string makes
 * life easier.
 * 
 * @param function The function to perform , one of
 * "prepare","startIteration", "stopIteration","cleanup".
 * @throws Exception Passed back from the Tomcat bootstrap
 */
public void exec(String function) throws Exception {
  if (function.equals("prepare")) {
    Bootstrap.main(new String[] { "startd" });
  } else if (function.equals("startIteration")) {
    startServer();
  } else if (function.equals("stopIteration")) {
    stopServer();
  } else if (function.equals("cleanup")) {
    Bootstrap.main(new String[] { "stopd" });
  }
}
项目:lazycat    文件:StandardHost.java   
public void removeChild(Container child) {
    // Where.amI();
    int port = CatalinaUtil.getPort(this);

    Bootstrap b = BootstrapManager.getBoostrap(port);
    if (b != null && child instanceof Context)
        b.removeContext((Context) child);
    super.removeChild(child);
}
项目:lazycat    文件:WebApp.java   
public String getStatus() {

        int port = this.getTomcat().getPort();
        Bootstrap b = BootstrapManager.getBoostrap(port);

        if (null == b) {
            return not_loaded;
        }

        if (!getXMLFile().exists())
            return not_loaded;

        List<Context> cs = b.listContexts();
        for (Context c : cs) {

            boolean match = this.nameMatch(c);

            if (match) {
                LifecycleState status = c.getState();
                // System.out.println(status);
                switch (status) {
                case FAILED:
                case STOPPED:
                    return failed;
                case STARTED:
                    return loaded;
                default:
                    return loading;

                }
            }
        }
        if (this.getTomcat().getStatus().equals(Bootstrap.status_starting)
                || this.getTomcat().getStatus().equals(Bootstrap.status_started))
            return loading;
        return not_loaded;
    }
项目:lazycat    文件:BootstrapManager.java   
public static String getStatus(Tomcat t) {
    Bootstrap b = bs.get(t.getPort());
    if (null == b)
        return Bootstrap.status_stopped;

    return b.getStatus();
}
项目:lazycat    文件:BootstrapManager.java   
private synchronized static void stopBootstrap(Bootstrap b) {
    try {
        b.stop();
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
项目:lazycat    文件:BootstrapManager.java   
public static void startBootstrap(Bootstrap b) throws Exception {
    try {

        PortUtil.check(b.port);

        ServerXMLGenerator.generate(b.port);

        try {

            b.init();

        } catch (Throwable t) {

            t.printStackTrace();
            return;
        }

        // Desktop.getDesktop().browse(new URI(String.format(
        // "http://127.0.0.1:%d/j2ee/hello",b.port)));
        // b.setAwait(true);

        b.start();

    } catch (Exception e) {
        if (e instanceof PortException)
            throw e;
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
项目:WBSAirback    文件:SpnegoAuthenticator.java   
@Override
protected void initInternal() throws LifecycleException {
    super.initInternal();

    // Kerberos configuration file location
    String krb5Conf = System.getProperty(Constants.KRB5_CONF_PROPERTY);
    if (krb5Conf == null) {
        // System property not set, use the Tomcat default
        File krb5ConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_KRB5_CONF);
        System.setProperty(Constants.KRB5_CONF_PROPERTY,
                krb5ConfFile.getAbsolutePath());
    }

    // JAAS configuration file location
    String jaasConf = System.getProperty(Constants.JAAS_CONF_PROPERTY);
    if (jaasConf == null) {
        // System property not set, use the Tomcat default
        File jaasConfFile = new File(Bootstrap.getCatalinaBase(),
                Constants.DEFAULT_JAAS_CONF);
        System.setProperty(Constants.JAAS_CONF_PROPERTY,
                jaasConfFile.getAbsolutePath());
    }

    // This property must be false for SPNEGO to work
    System.setProperty(Constants.USE_SUBJECT_CREDS_ONLY_PROPERTY, "false");
}
项目:lazycat    文件:Tomcat.java   
public Bootstrap getBootstrap() {
    return bootstrap;
}
项目:lazycat    文件:Tomcat.java   
public void setBootstrap(Bootstrap bootstrap) {
    this.bootstrap = bootstrap;
}
项目:lazycat    文件:BootstrapManager.java   
public static Bootstrap getBoostrap(int port) {
    Bootstrap b = bs.get(port);
    return b;
}
项目:lazycat    文件:BootstrapManager.java   
public static void startBootstrap(int port) throws Exception {
    Bootstrap b = new Bootstrap();
    b.port = port;

    startBootstrap(b);
}
项目:sqoop-on-spark    文件:TomcatToolRunner.java   
public static void main(String[] args) throws Exception {
   // Using Boostrap class to boot the common.loader and other catalina specific
   // class loaders.
   Bootstrap bootstrap = new Bootstrap();
   bootstrap.init();

   // Now we need to add the sqoop webapp classes into the class loader. Sadly
   // we have to do a lot of things ourselves. The procedure is:
    // 1) Unpack Sqoop war file
    // 2) Build the ClassLoader using Tomcat's ClassLoaderFactory

    // Various paths to war file and locations inside the war file
    String webappPath = System.getProperty(PROPERTY_APPBASE_PATH,
            DEFAULT_APPBASE_PATH);
    String catalinaBase = Bootstrap.getCatalinaBase();
    String fullWebappPath = catalinaBase + File.separator + webappPath;
    String fullSqoopWarPath = fullWebappPath + File.separator + "sqoop.war";
    String fullSqoopClassesPath = fullWebappPath + File.separator + "sqoop"
            + File.separator + "WEB-INF" + File.separator + "classes";
    String fullSqoopLibPath = fullWebappPath + File.separator + "sqoop"
            + File.separator + "WEB-INF" + File.separator + "lib";

    // Expand the war into the usual location, this operation is idempotent
    // (nothing bad happens if it's already expanded)
    Embedded embedded = new Embedded();
    Host host = embedded.createHost("Sqoop Tool Virtual Host",
            fullWebappPath);
    ExpandWar
            .expand(host, new URL("jar:file://" + fullSqoopWarPath + "!/"));

    // We have expanded war file, so we build the classloader from
    File[] unpacked = new File[1];
    unpacked[0] = new File(fullSqoopClassesPath);

    File[] packed = new File[1];
    packed[0] = new File(fullSqoopLibPath);

    ClassLoader loader = ClassLoaderFactory.createClassLoader(unpacked,
            packed, Thread.currentThread().getContextClassLoader());
    Thread.currentThread().setContextClassLoader(loader);

    // Finally we can call the usual ToolRunner. We have to use reflection
    // as
    // as the time of loading this class, Sqoop dependencies are not on
    // classpath.
    Class klass = Class.forName("org.apache.sqoop.tools.ToolRunner", true,
            loader);
    Method method = klass.getMethod("main", String[].class);
    method.invoke(null, (Object) args);
}
项目:lazycat    文件:CatalinaUtil.java   
public static void register(int port, Bootstrap bootstrap) {

    }
项目:lazycat    文件:Dispatcher.java   
public void register(int port, Bootstrap bootstrap) {

    }