if (host != null) {
for (Route route : host.getRoutes()) {
Restlet next = route.getNext();
if (next instanceof Application) {
Application application = (Application) next;
if (application.getConnectorService() != null) {
if (application.getConnectorService()
.getClientProtocols() != null) {
for (Protocol clientProtocol : application
.getConnectorService().getClientProtocols()) {
boolean clientFound = false;
// Try to find a client connector matching the
// client protocol
Client client;
for (Iterator<Client> iter = getHelped()
.getClients().iterator(); !clientFound
&& iter.hasNext();) {
client = iter.next();
clientFound = client.getProtocols()
.contains(clientProtocol);
}
if (!clientFound) {
getLogger()
.severe("Unable to start the application \""
+ application.getName()
+ "\". Client connector for protocol "
+ clientProtocol.getName()
+ " is missing.");
result = false;
}
}
}
if (application.getConnectorService()
.getServerProtocols() != null) {
for (Protocol serverProtocol : application
.getConnectorService().getServerProtocols()) {
boolean serverFound = false;
// Try to find a server connector matching the
// server protocol
Server server;
for (Iterator<Server> iter = getHelped()
.getServers().iterator(); !serverFound
&& iter.hasNext();) {
server = iter.next();
serverFound = server.getProtocols()
.contains(serverProtocol);
}
if (!serverFound) {
getLogger()
.severe("Unable to start the application \""
+ application.getName()
+ "\". Server connector for protocol "
+ serverProtocol.getName()
+ " is missing.");
result = false;
}
}
}
}
if (result && application.isStopped()) {
application.start();
}
}
}
}