try {
try {
resolver = (org.apache.excalibur.source.SourceResolver) this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE);
source = resolver.resolveURI(configurationFile);
} catch (IOException ioe) {
throw new ParameterException("Unable to read configuration from " + configurationFile, ioe);
} catch (ServiceException se) {
throw new ParameterException("Unable to lookup source resolver.", se);
}
SourceValidity newValidity = source.getValidity();
if ( this.oldValidity == null
|| this.oldValidity.isValid() == SourceValidity.INVALID
|| this.oldValidity.isValid(newValidity) == SourceValidity.INVALID) {
this.oldValidity = newValidity;
try {
SAXConfigurationHandler handler = new SAXConfigurationHandler();
SourceUtil.toSAX(source, handler);
config = handler.getConfiguration();
} catch (ProcessingException se) {
throw new ParameterException("Unable to read configuration from " + configurationFile, se);
} catch (SAXException se) {
throw new ParameterException("Unable to read configuration from " + configurationFile, se);
} catch (IOException ioe) {
throw new ParameterException("Unable to read configuration from " + configurationFile, ioe);
}
Configuration[] events = config.getChild("events").getChildren("event");
if ( events != null ) {
for(int i=0; i<events.length;i++) {
try {
final String type = events[i].getAttribute("type");
final String id = events[i].getAttribute("id");
if ( "jxpath".equals(type) ) {
if ( this.eventMap.containsKey(id)) {
throw new ParameterException("The id for the event " + id + " is not unique.");
}
final String targetType = events[i].getChild("targettype").getValue();
final String targetId = events[i].getChild("targetid").getValue();
final String path = events[i].getChild("path").getValue();
if ( "layout".equals(targetType) ) {
LayoutMapping mapping = new LayoutMapping();
mapping.layoutId = targetId;
mapping.path = path;
this.eventMap.put(id, mapping);
} else if ( "coplet".equals(targetType) ) {
CopletMapping mapping = new CopletMapping();
mapping.copletId = targetId;
mapping.path = path;
this.eventMap.put(id, mapping);
} else {
throw new ParameterException("Unknown target type " + targetType);
}
} else if ( "fullscreen".equals(type) ) {
if ( this.eventMap.containsKey(id)) {
throw new ParameterException("The id for the event " + id + " is not unique.");
}
final String targetId = events[i].getChild("targetid").getValue();
final String layoutId = events[i].getChild("layoutid").getValue();
FullScreenMapping mapping = new FullScreenMapping();
mapping.copletId = targetId;
mapping.layoutId = layoutId;
this.eventMap.put(id, mapping);
} else {
throw new ParameterException("Unknown event type for event " + id + ": " + type);
}
} catch (ConfigurationException ce) {
throw new ParameterException("Configuration exception" ,ce);
}
}
}
}
} finally {