void registerListener(POIFSReaderListener listener,
POIFSDocumentPath path,
String documentName) {
if (!omnivorousListeners.contains(listener))
{
// not an omnivorous listener (if it was, this method is a
// no-op)
Set descriptors = ( Set ) selectiveListeners.get(listener);
if (descriptors == null)
{
// this listener has not registered before
descriptors = new HashSet();
selectiveListeners.put(listener, descriptors);
}
DocumentDescriptor descriptor = new DocumentDescriptor(path,
documentName);
if (descriptors.add(descriptor))
{
// this listener wasn't already listening for this
// document -- add the listener to the set of
// listeners for this document
Set listeners =
( Set ) chosenDocumentDescriptors.get(descriptor);
if (listeners == null)
{
// nobody was listening for this document before
listeners = new HashSet();
chosenDocumentDescriptors.put(descriptor, listeners);
}
listeners.add(listener);
}
}
}
register a POIFSReaderListener for a particular document |