use of org.apache.catalina.Service in project tomcat70 by apache.
the class ServiceMBean method findConnectors.
/**
* Find and return the set of Connectors associated with this Service.
* @throws MBeanException
*/
public String[] findConnectors() throws MBeanException {
Service service;
try {
service = (Service) getManagedResource();
} catch (InstanceNotFoundException e) {
throw new MBeanException(e);
} catch (RuntimeOperationsException e) {
throw new MBeanException(e);
} catch (InvalidTargetObjectTypeException e) {
throw new MBeanException(e);
}
Connector[] connectors = service.findConnectors();
String[] str = new String[connectors.length];
for (int i = 0; i < connectors.length; i++) {
str[i] = connectors[i].toString();
}
return str;
}
use of org.apache.catalina.Service in project tomcat70 by apache.
the class ConnectorCreateRule method begin.
// --------------------------------------------------------- Public Methods
/**
* Process the beginning of this element.
*
* @param namespace the namespace URI of the matching element, or an
* empty string if the parser is not namespace aware or the element has
* no namespace
* @param name the local name if the parser is namespace aware, or just
* the element name otherwise
* @param attributes The attribute list for this element
*/
@Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
Service svc = (Service) digester.peek();
Executor ex = null;
if (attributes.getValue("executor") != null) {
ex = svc.getExecutor(attributes.getValue("executor"));
}
Connector con = new Connector(attributes.getValue("protocol"));
if (ex != null)
_setExecutor(con, ex);
digester.push(con);
}
use of org.apache.catalina.Service in project tomcat70 by apache.
the class ContextConfig method getServer.
private Server getServer() {
Container c = context;
while (c != null && !(c instanceof Engine)) {
c = c.getParent();
}
if (c == null) {
return null;
}
Service s = ((Engine) c).getService();
if (s == null) {
return null;
}
return s.getServer();
}
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 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: {0}", e.getMessage());
}
return null;
}
Aggregations