use of org.apache.catalina.Service in project tomee by apache.
the class OpenEJBListener method tryToFindAndExtractWar.
private static File tryToFindAndExtractWar(final StandardServer source) {
if (System.getProperties().containsKey("openejb.war")) {
return new File(System.getProperty("openejb.war"));
}
for (final Service service : source.findServices()) {
final Container container = service.getContainer();
if (container instanceof StandardEngine) {
final StandardEngine engine = (StandardEngine) container;
for (final Container child : engine.findChildren()) {
if (child instanceof StandardHost) {
final StandardHost host = (StandardHost) child;
final File base = hostDir(System.getProperty("catalina.base"), host.getAppBase());
final File[] files = base.listFiles();
if (files != null) {
for (final File file : files) {
if (isTomEEWar(file)) {
return file;
}
}
}
}
}
}
}
return null;
}
use of org.apache.catalina.Service in project tomee by apache.
the class OpenEJBListener method findOpenEjbWar.
private static File findOpenEjbWar() {
// in Tomcat 5.5 the OpenEjb war is in the server/webapps director
final String catalinaBase = System.getProperty("catalina.base");
final File serverWebapps = new File(catalinaBase, "server/webapps");
File openEjbWar = findOpenEjbWar(serverWebapps);
if (openEjbWar != null) {
return openEjbWar;
}
try {
// scan all hosts directories
for (final Service service : TomcatHelper.getServer().findServices()) {
final Container container = service.getContainer();
if (container instanceof StandardEngine) {
final StandardEngine engine = (StandardEngine) container;
for (final Container child : engine.findChildren()) {
if (child instanceof StandardHost) {
final StandardHost host = (StandardHost) child;
final File hostDir = hostDir(catalinaBase, host.getAppBase());
openEjbWar = findOpenEjbWar(hostDir);
if (openEjbWar != null) {
return openEjbWar;
} else {
return findOpenEjbWar(host);
}
}
}
}
}
} catch (final Exception e) {
LOGGER.log(Level.WARNING, "OpenEJBListener.findOpenEjbWar: " + e.getMessage());
}
return null;
}
use of org.apache.catalina.Service in project tomee by apache.
the class GlobalListenerSupport method start.
/**
* Starts operation.
*/
public void start() {
// hook the hosts so we get notified before contexts are started
standardServer.addPropertyChangeListener(this);
standardServer.addLifecycleListener(this);
for (final Service service : standardServer.findServices()) {
serviceAdded(service);
}
}
use of org.apache.catalina.Service in project tomcat70 by apache.
the class ThreadLocalLeakPreventionListener method registerListenersForServer.
private void registerListenersForServer(Server server) {
for (Service service : server.findServices()) {
Engine engine = (Engine) service.getContainer();
if (engine != null) {
engine.addContainerListener(this);
registerListenersForEngine(engine);
}
}
}
use of org.apache.catalina.Service in project tomcat70 by apache.
the class ApplicationContext method populateSessionTrackingModes.
private void populateSessionTrackingModes() {
// URL re-writing is always enabled by default
defaultSessionTrackingModes = EnumSet.of(SessionTrackingMode.URL);
supportedSessionTrackingModes = EnumSet.of(SessionTrackingMode.URL);
if (context.getCookies()) {
defaultSessionTrackingModes.add(SessionTrackingMode.COOKIE);
supportedSessionTrackingModes.add(SessionTrackingMode.COOKIE);
}
// SSL not enabled by default as it can only used on its own
// Context > Host > Engine > Service
Service s = ((Engine) context.getParent().getParent()).getService();
Connector[] connectors = s.findConnectors();
// Need at least one SSL enabled connector to use the SSL session ID.
for (Connector connector : connectors) {
if (Boolean.TRUE.equals(connector.getAttribute("SSLEnabled"))) {
supportedSessionTrackingModes.add(SessionTrackingMode.SSL);
break;
}
}
}
Aggregations