> As you described there is a registerListener(Properties) method that is
> essentially an initialization method. It takes the Properties defined in the
> user's Configuration. The Listener may or may not need those Properties in
> order to initialize itself. So, yes, each Listener would have to know how to
> initialize itself. There is also the terminateListener method that would be
> responsible for cleaning up its resources and finishing any job that it was
> responsible for. The use case for this is the ReportListener will need to
> actually write the report in the terminate method. The ReportListener will
> use the properties to determine the path output the report and the type of
> report to output (ie xml, html, csv (only xml for the upcomming 3.0
> milestone)). So thats the use case that I trying to implement.
Totally with you on that. I was suggesting that it be two separate
interfaces because there will be use-cases where listeners have no
resources to setup or clean up and forcing every listener to take on
that responsibility seems misplaced. Hiding it in an abstract base
class is rough since external developers may want to implement their
own listener hierarchy and forcing them to code away those methods or
use our base classes wouldn't be nice. lol
> Can you describe this further? You're talking about a new entity that knows
> its event type and has some arbitrary properties that it may or may not
> contain. It passes this entity to the Listener implementation, and each
> implementation either knows about this type of event and may handle it, or
> does not even know about the type of event and disregards it. Is that right?
Dead on. The listener Interface would basically just be "public void
onEvent(AbstractEvent event)". Implementations of the interface would
be responsible for handling the exact event sub-classes they're
interested in. For example, a listener may have a "private void
process(SourceDirectoryNotFoundEvent event)" method that is calls from
the "onEvent". But if we suddendly added say
"SourceDirectoryInPigLatinEvent" it wouldn't break all the listeners
already written because they'd just ignore it. When the developer
decided they wanted to pay attention to the new event they could.
They just wouldn't be on our time schedule.
> Thanks for reviewing that API. Now is the time to do that sort of thing. As
> you said, its stone-like after its released. However, on that note, I will
> share that this 3.0 release IS going to break backwards compatability
> becuase we are moving from com.seventytwomiles.architecturerules to
> org.architecturerules.
I don't mind breaking backward compat when its needed. Just wanted to
make sure we thought a bit about future compat too. :)
> > written. Thoughts?- Hide quoted text -
>
> - Show quoted text -