use of org.apache.catalina.Service in project tomcat by apache.
the class StandardServer method getDomainInternal.
/**
* Obtain the MBean domain for this server. The domain is obtained using
* the following search order:
* <ol>
* <li>Name of first {@link org.apache.catalina.Engine}.</li>
* <li>Name of first {@link Service}.</li>
* </ol>
*/
@Override
protected String getDomainInternal() {
String domain = null;
Service[] services = findServices();
if (services.length > 0) {
Service service = services[0];
if (service != null) {
domain = service.getDomain();
}
}
return domain;
}
use of org.apache.catalina.Service in project tomcat 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;
String executorName = attributes.getValue("executor");
if (executorName != null) {
ex = svc.getExecutor(executorName);
}
String protocolName = attributes.getValue("protocol");
Connector con = new Connector(protocolName);
if (ex != null) {
setExecutor(con, ex);
}
String sslImplementationName = attributes.getValue("sslImplementationName");
if (sslImplementationName != null) {
setSSLImplementationName(con, sslImplementationName);
}
digester.push(con);
StringBuilder code = digester.getGeneratedCode();
if (code != null) {
code.append(System.lineSeparator());
code.append(Connector.class.getName()).append(' ').append(digester.toVariableName(con));
code.append(" = new ").append(Connector.class.getName());
code.append("(new ").append(con.getProtocolHandlerClassName()).append("());");
code.append(System.lineSeparator());
if (ex != null) {
code.append(digester.toVariableName(con)).append(".getProtocolHandler().setExecutor(");
code.append(digester.toVariableName(svc)).append(".getExecutor(").append(executorName);
code.append("));");
code.append(System.lineSeparator());
}
if (sslImplementationName != null) {
code.append("((").append(AbstractHttp11JsseProtocol.class.getName()).append("<?>) ");
code.append(digester.toVariableName(con)).append(".getProtocolHandler()).setSslImplementationName(\"");
code.append(sslImplementationName).append("\");");
code.append(System.lineSeparator());
}
}
}
use of org.apache.catalina.Service in project tomcat by apache.
the class TesterDigestAuthenticatorPerformance method setUp.
@Before
public void setUp() throws Exception {
ConcurrentMessageDigest.init("MD5");
// Configure the Realm
TesterMapRealm realm = new TesterMapRealm();
realm.addUser(USER, PWD);
realm.addUserRole(USER, ROLE);
// Add the Realm to the Context
Context context = new StandardContext();
context.setName(CONTEXT_PATH);
context.setRealm(realm);
Host host = new StandardHost();
context.setParent(host);
Engine engine = new StandardEngine();
host.setParent(engine);
Service service = new StandardService();
engine.setService(service);
// Configure the Login config
LoginConfig config = new LoginConfig();
config.setRealmName(REALM);
context.setLoginConfig(config);
// Make the Context and Realm visible to the Authenticator
authenticator.setContainer(context);
authenticator.setNonceCountWindowSize(8 * 1024);
authenticator.start();
}
use of org.apache.catalina.Service in project tomcat by apache.
the class ManagerServlet method getConnectors.
private Connector[] getConnectors() {
Engine e = (Engine) host.getParent();
Service s = e.getService();
return s.findConnectors();
}
use of org.apache.catalina.Service in project tomcat by apache.
the class Tomcat method getServer.
/**
* Get the server object. You can add listeners and few more
* customizations. JNDI is disabled by default.
* @return The Server
*/
public Server getServer() {
if (server != null) {
return server;
}
System.setProperty("catalina.useNaming", "false");
server = new StandardServer();
initBaseDir();
// Set configuration source
ConfigFileLoader.setSource(new CatalinaBaseConfigurationSource(new File(basedir), null));
server.setPort(-1);
Service service = new StandardService();
service.setName("Tomcat");
server.addService(service);
return server;
}
Aggregations