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