use of org.jdom2.filter.Filters in project jspwiki by apache.
the class DefaultFilterManager method parseConfigFile.
/**
* Parses the XML filters configuration file.
*
* @param xmlStream stream to parse
*/
private void parseConfigFile(InputStream xmlStream) {
List<Element> pageFilters = XmlUtil.parse(xmlStream, "/pagefilters/filter");
for (Iterator<Element> i = pageFilters.iterator(); i.hasNext(); ) {
Element f = i.next();
String filterClass = f.getChildText("class");
Properties props = new Properties();
List<Element> params = f.getChildren("param");
for (Iterator<Element> par = params.iterator(); par.hasNext(); ) {
Element p = par.next();
props.setProperty(p.getChildText("name"), p.getChildText("value"));
}
initPageFilter(filterClass, props);
}
}
use of org.jdom2.filter.Filters in project stdlib by petergeneric.
the class CarbonSource method setFilterGUIDs.
/**
* Set the filter GUID, replacing any filter that is currently defined
*
* @param filterGUIDs
*/
public void setFilterGUIDs(List<String> filterGUIDs) {
int i = 0;
for (String filterGUID : filterGUIDs) {
// Remove filters (we're replacing them)
removeFilter("Filter_" + i);
// Build a new Filter_0 element
Element filter = buildFilterElement("Filter_" + i, filterGUID);
element.addContent(filter);
i++;
}
}
use of org.jdom2.filter.Filters in project stdlib by petergeneric.
the class CarbonDestination method getVideoFilters.
public List<CarbonModule> getVideoFilters() {
List<CarbonModule> filters = new ArrayList<CarbonModule>();
final Element filterContainer = getVideoFilterElement();
if (filterContainer != null) {
for (Element element : filterContainer.getChildren()) {
filters.add(new CarbonModule(element));
}
}
return filters;
}
use of org.jdom2.filter.Filters in project stdlib by petergeneric.
the class CarbonDestination method addVideoFilter.
//
// Video filters
//
public void addVideoFilter(CarbonModule module) {
final Element filterContainer = getOrCreateVideoFilterElement();
// We should use lastModule number + 1 as the number for the new module
final int moduleNumber = filterContainer.getChildren().size();
final Element moduleElement = module.getElement();
moduleElement.detach();
moduleElement.setName("Module_" + moduleNumber);
filterContainer.addContent(moduleElement);
}
use of org.jdom2.filter.Filters in project jspwiki by apache.
the class DefaultFilterManager method registerFilters.
private void registerFilters() {
log.info("Registering filters");
List<Element> filters = XmlUtil.parse(PLUGIN_RESOURCE_LOCATION, "/modules/filter");
//
for (Iterator<Element> i = filters.iterator(); i.hasNext(); ) {
Element pluginEl = i.next();
String className = pluginEl.getAttributeValue("class");
PageFilterInfo filterInfo = PageFilterInfo.newInstance(className, pluginEl);
if (filterInfo != null) {
registerFilter(filterInfo);
}
}
}
Aggregations