subfilter proposal....

0 views
Skip to first unread message

Jimbo

unread,
Feb 13, 2012, 11:39:28 AM2/13/12
to okapi...@googlegroups.com
We will need to add these methods to IFilter. Personally I think all
filters should also implement AbstractFilter where we can add common code.

New IFilter methods:

openAsSubfilter(RawDocument input, IFilter parentFilter, FilterState
parentFilterState)
openAsSubfilter(RawDocument input, IFilter parentFilter)
openAsSubfilter(RawDocument input, boolean generateSkeleton, IFilter
parentFilter, FilterState parentFilterState)
openAsSubfilter(RawDocument input, boolean generateSkeleton, IFilter
parentFilter)
isSubFilter()


FilterState holds any information that may be useful for the subfilter,
for example is the parent filter inside an attribute? Is there special
decoding needed? In what order should the decoding happen?

There are cases with mixed content that will be tricky - for example
when calling the subfilter for HTML in Java Properties files you will
normally need to encode html *and* Java prop together even though the
mime type is only HTML for the subfiltered content.

I don't think we need any special methods on other interfaces like the
writers. The writers should look at the mime types, subfilter flag and
parent FilterState to do the right thing. We may need to add some more
fields to some of the resources.

The most work in all of this will be in defining FilterState and using
it during merge.

Jim

Jim Hargrave

unread,
Feb 19, 2012, 3:21:10 PM2/19/12
to okapi...@googlegroups.com
We could add some extra convenience methods:

openAsSubfilter(String input, IFilter parentFilter, FilterState
parentFilterState)
openAsSubfilter(String input, IFilter parentFilter)
openAsSubfilter(String input, boolean generateSkeleton, IFilter
parentFilter, FilterState parentFilterState)
openAsSubfilter(String input, boolean generateSkeleton, IFilter
parentFilter)

but that is a lot of duplication IMHO - its not that hard to create a
RawDocument from a String.

Jim

Jim Hargrave

unread,
Feb 24, 2012, 4:16:51 PM2/24/12
to okapi...@googlegroups.com
Instead of adding these methods to IFilter it makes more sense to create a new interface ISubfilter. Any filter that can also act as a subfilter should implement both IFilter and ISubfilter. That way filters that could never be a subfilter (docx, archive, odf) do not have to implement the extra methods.

I will soon have a check in with the new interface - working on AbstractMarkupFilter as the first "subfilter"

You can test if a filter is a subfilter using "instance instanceof ISubfilter"

Jim
Reply all
Reply to author
Forward
0 new messages