Java Code Examples for org.apache.catalina.Host#getXmlBase()

The following examples show how to use org.apache.catalina.Host#getXmlBase() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestHostConfigAutomaticDeployment.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
private static File getConfigBaseFile(Host host) {
    String path = null;
    if (host.getXmlBase() != null) {
        path = host.getXmlBase();
    } else {
        StringBuilder xmlDir = new StringBuilder("conf");
        Container parent = host.getParent();
        if (parent instanceof Engine) {
            xmlDir.append('/');
            xmlDir.append(parent.getName());
        }
        xmlDir.append('/');
        xmlDir.append(host.getName());
        path = xmlDir.toString();
    }
    
    return getCanonicalPath(path);
}
 
Example 2
Source File: TestHostConfigAutomaticDeployment.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
private static File getConfigBaseFile(Host host) {
    String path = null;
    if (host.getXmlBase() != null) {
        path = host.getXmlBase();
    } else {
        StringBuilder xmlDir = new StringBuilder("conf");
        Container parent = host.getParent();
        if (parent instanceof Engine) {
            xmlDir.append('/');
            xmlDir.append(parent.getName());
        }
        xmlDir.append('/');
        xmlDir.append(host.getName());
        path = xmlDir.toString();
    }
    
    return getCanonicalPath(path);
}
 
Example 3
Source File: FarmWarDeployer.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
@Override
public void start() throws Exception {
    if (started)
        return;
    Container hcontainer = getCluster().getContainer();
    if(!(hcontainer instanceof Host)) {
        log.error(sm.getString("farmWarDeployer.hostOnly"));
        return ;
    }
    host = (Host) hcontainer;

    // Check to correct engine and host setup
    Container econtainer = host.getParent();
    if(!(econtainer instanceof Engine)) {
        log.error(sm.getString("farmWarDeployer.hostParentEngine",
                host.getName())); 
        return ;
    }
    Engine engine = (Engine) econtainer;
    String hostname = null;
    hostname = host.getName();
    try {
        oname = new ObjectName(engine.getName() + ":type=Deployer,host="
                + hostname);
    } catch (Exception e) {
        log.error(sm.getString("farmWarDeployer.mbeanNameFail",
                engine.getName(), hostname),e);
        return;
    }
    if (watchEnabled) {
        watcher = new WarWatcher(this, getWatchDirFile());
        if (log.isInfoEnabled()) {
            log.info(sm.getString(
                    "farmWarDeployer.watchDir", getWatchDir()));
        }
    }

    if (host.getXmlBase()!=null) {
        configBase = getAbsolutePath(host.getXmlBase());
    } else {
        StringBuilder xmlDir = new StringBuilder("conf");
        xmlDir.append('/');
        xmlDir.append(engine.getName());
        xmlDir.append('/');
        xmlDir.append(host.getName());
        configBase = getAbsolutePath(xmlDir.toString());
    }

    // Retrieve the MBean server
    mBeanServer = Registry.getRegistry(null, null).getMBeanServer();

    started = true;
    count = 0;

    getCluster().addClusterListener(this);

    if (log.isInfoEnabled())
        log.info(sm.getString("farmWarDeployer.started"));
}
 
Example 4
Source File: FarmWarDeployer.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
@Override
public void start() throws Exception {
    if (started)
        return;
    Container hcontainer = getCluster().getContainer();
    if(!(hcontainer instanceof Host)) {
        log.error(sm.getString("farmWarDeployer.hostOnly"));
        return ;
    }
    host = (Host) hcontainer;

    // Check to correct engine and host setup
    Container econtainer = host.getParent();
    if(!(econtainer instanceof Engine)) {
        log.error(sm.getString("farmWarDeployer.hostParentEngine",
                host.getName())); 
        return ;
    }
    Engine engine = (Engine) econtainer;
    String hostname = null;
    hostname = host.getName();
    try {
        oname = new ObjectName(engine.getName() + ":type=Deployer,host="
                + hostname);
    } catch (Exception e) {
        log.error(sm.getString("farmWarDeployer.mbeanNameFail",
                engine.getName(), hostname),e);
        return;
    }
    if (watchEnabled) {
        watcher = new WarWatcher(this, getWatchDirFile());
        if (log.isInfoEnabled()) {
            log.info(sm.getString(
                    "farmWarDeployer.watchDir", getWatchDir()));
        }
    }

    if (host.getXmlBase()!=null) {
        configBase = getAbsolutePath(host.getXmlBase());
    } else {
        StringBuilder xmlDir = new StringBuilder("conf");
        xmlDir.append('/');
        xmlDir.append(engine.getName());
        xmlDir.append('/');
        xmlDir.append(host.getName());
        configBase = getAbsolutePath(xmlDir.toString());
    }

    // Retrieve the MBean server
    mBeanServer = Registry.getRegistry(null, null).getMBeanServer();

    started = true;
    count = 0;

    getCluster().addClusterListener(this);

    if (log.isInfoEnabled())
        log.info(sm.getString("farmWarDeployer.started"));
}