Search in sources :

Example 1 with OutputInstanceFilterStreamFactory

use of org.xwiki.filter.instance.output.OutputInstanceFilterStreamFactory in project xwiki-platform by xwiki.

the class InstanceOutputFilterStream method setProperties.

@Override
public void setProperties(InstanceOutputProperties properties) throws FilterException {
    super.setProperties(properties);
    List<OutputInstanceFilterStreamFactory> factories;
    try {
        factories = this.componentManager.get().getInstanceList(OutputInstanceFilterStreamFactory.class);
    } catch (ComponentLookupException e) {
        throw new FilterException("Failed to get regsitered instance of OutputInstanceFilterStreamFactory components", e);
    }
    Object[] filters = new Object[factories.size()];
    int i = 0;
    for (OutputInstanceFilterStreamFactory factory : factories) {
        filters[i++] = factory.createOutputFilterStream(properties).getFilter();
    }
    this.filter = this.filterManager.createCompositeFilter(filters);
}
Also used : OutputInstanceFilterStreamFactory(org.xwiki.filter.instance.output.OutputInstanceFilterStreamFactory) ComponentLookupException(org.xwiki.component.manager.ComponentLookupException) FilterException(org.xwiki.filter.FilterException)

Example 2 with OutputInstanceFilterStreamFactory

use of org.xwiki.filter.instance.output.OutputInstanceFilterStreamFactory in project xwiki-platform by xwiki.

the class InstanceOutputFilterStreamFactory method initialize.

@Override
public void initialize() throws InitializationException {
    super.initialize();
    List<OutputInstanceFilterStreamFactory> factories;
    try {
        factories = this.componentManagerProvider.get().getInstanceList(OutputInstanceFilterStreamFactory.class);
    } catch (ComponentLookupException e) {
        throw new InitializationException("Failed to get registered instance of OutputInstanceFilterStreamFactory components", e);
    }
    FilterStreamDescriptor[] descriptors = new FilterStreamDescriptor[factories.size() + 1];
    descriptors[0] = this.descriptor;
    for (int i = 0; i < factories.size(); ++i) {
        descriptors[i + 1] = factories.get(i).getDescriptor();
    }
    setDescriptor(new CompositeFilterStreamDescriptor(this.descriptor.getName(), this.descriptor.getDescription(), descriptors));
}
Also used : CompositeFilterStreamDescriptor(org.xwiki.filter.descriptor.CompositeFilterStreamDescriptor) OutputInstanceFilterStreamFactory(org.xwiki.filter.instance.output.OutputInstanceFilterStreamFactory) CompositeFilterStreamDescriptor(org.xwiki.filter.descriptor.CompositeFilterStreamDescriptor) FilterStreamDescriptor(org.xwiki.filter.descriptor.FilterStreamDescriptor) ComponentLookupException(org.xwiki.component.manager.ComponentLookupException) InitializationException(org.xwiki.component.phase.InitializationException)

Example 3 with OutputInstanceFilterStreamFactory

use of org.xwiki.filter.instance.output.OutputInstanceFilterStreamFactory in project xwiki-platform by xwiki.

the class InstanceOutputFilterStreamFactory method getFilterInterfaces.

@Override
public Collection<Class<?>> getFilterInterfaces() throws FilterException {
    List<OutputInstanceFilterStreamFactory> factories;
    try {
        factories = this.componentManagerProvider.get().getInstanceList(OutputInstanceFilterStreamFactory.class);
    } catch (ComponentLookupException e) {
        throw new FilterException("Failed to get regsitered instance of OutputInstanceFilterStreamFactory components", e);
    }
    Set<Class<?>> filters = new HashSet<Class<?>>();
    filters.addAll(super.getFilterInterfaces());
    for (OutputInstanceFilterStreamFactory factory : factories) {
        filters.addAll(factory.getFilterInterfaces());
    }
    return filters;
}
Also used : OutputInstanceFilterStreamFactory(org.xwiki.filter.instance.output.OutputInstanceFilterStreamFactory) ComponentLookupException(org.xwiki.component.manager.ComponentLookupException) FilterException(org.xwiki.filter.FilterException) HashSet(java.util.HashSet)

Aggregations

ComponentLookupException (org.xwiki.component.manager.ComponentLookupException)3 OutputInstanceFilterStreamFactory (org.xwiki.filter.instance.output.OutputInstanceFilterStreamFactory)3 FilterException (org.xwiki.filter.FilterException)2 HashSet (java.util.HashSet)1 InitializationException (org.xwiki.component.phase.InitializationException)1 CompositeFilterStreamDescriptor (org.xwiki.filter.descriptor.CompositeFilterStreamDescriptor)1 FilterStreamDescriptor (org.xwiki.filter.descriptor.FilterStreamDescriptor)1