}
ApplicationContext context = new ClassPathXmlApplicationContext(
"classpath:/org/apache/droids/dynamic/droids-core-context.xml");
DroidsConfig config = (DroidsConfig) context.getBean("org.apache.droids.dynamic.DroidsConfig");
Droid droid = config.getDroid(name);
if (droid == null) {
log.error("Droid " + name + " is not defined");
log.error(getUsage());
return;
}
log.info("A p a c h e D r o i d s - an intelligent robot framework");
if (droid instanceof CrawlingDroid) {
List<String> locations = new ArrayList<String>();
if (location == null) {
log.error("Droid " + name + " is a crawler, however you have not defined a starting location.");
log.error(getUsage());
return;
}
locations.add(location);
((CrawlingDroid) droid).setInitialLocations(locations);
}
droid.init();
droid.start();
droid.getTaskMaster().awaitTermination(0, TimeUnit.MILLISECONDS);
}