On Wed, Sep 24, 2008 at 9:17 PM, Ilya Sterin <[EMAIL PROTECTED]> wrote:
> I'm using ivy embedded in a library. Great! > Because the library encapsulates > everything, we wanted to remove all logging... > > Doing this... > > Ivy ivy = Ivy.newInstance(); > MessageLogger logger = new DefaultMessageLogger(0); > ivy.getLoggerEngine().setDefaultLogger(logger); > > Removes the logging, but the transfer listeners are currently not > removable from what I can see. Because the default transfer handler > is pushed into the transfer handlers as an anonymous inner class, > there is no way to remove it, Indeed, but I'm not sure you really need to remove it, at least for your use case. The only thing this anonymous transfer listener do is call Message.progress() and Message.endProgress(...). You can even disable this during resolve by using the quiet resolve option. But even if you don't disable it, all you need to prevent output is to override the progress and endProgress methods in your own MessageLogger. as all remove methods requires an > instance of the transfer listener to remove it. > > public void removeAllTransferListeners() { > for (TransferListener tl : > listeners.getListeners(TransferListener.class)) { > removeTransferListener(tl); > } > } Well, I'd prefer adding a getTransferListeners() method, so that you can do the removeAll yourself, because I'm not sure remove all is really required (as I explained above).. > > > I then just use... > > ivy.getEventManager().removeAllTransferListeners(); > > which removes the transfer download progress notifications. > > To be able to remove all listeners if needed. This is a nice > solution, but I'm not sure if there is a better way to configure this. > > Can this or a similar solution be added to ivy? > > I'd also like to discuss refining an ivy API for external use. I can > imagine systems using ivy to resolve deps outside of ant as we're > doing. We are open to discussion, Ivy architecture supports external use, the API is not well designed though, and we'd be happy to accept contributions in this area! Xavier > > > Thanks. > > Ilya > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Xavier Hanin - Independent Java Consultant BordeauxJUG co leader - http://www.bordeauxjug.org/ Blogger - http://xhab.blogspot.com/ Apache Ivy Creator - http://ant.apache.org/ivy/