On 3 August 2013 12:52, Egon Willighagen <egon.willighagen@gmail.com> wrote:
Hi Nina,

On Fri, Aug 2, 2013 at 1:22 PM, Nina Jeliazkova
<jeliazkova.nina@gmail.com> wrote:
> Adding my 2 cents - I also think the IOSettings way is a bit awkward and
> would vote for a simplification. Using the Properties class and storage is
> fine, but property listeners are effectively useless for a stateless server
> side application.

That's what the PropertiesListener is for...

I know this code is clunky:

SDFWriter sdf = new SDFWriter(out);
Properties prop = new Properties();
prop.setProperty("FieldsToWrite","cdk:Title");
PropertiesListener listener = new PropertiesListener(prop);
sdf.addChemObjectIOListener(listener);
sdf.customizeJob();


Yes, definitely it can be used this way (and it is :), just saying that in my case the "event listener" functionality is useless and is equivalent with just setting the properties directly to the writer. 

I'm not suggesting an alternative solution at the moment, of course the functionality should not be lost if it is used somewhere.

Best regards,
Nina
 
No one ever bothered writing a more Java-friendly
IChemObjectIOListener. Of course I am happy for simplicication, as
long as all functionality remains...

Suggestions/Options:
- simpler API for PropertiesListener
- an more Java friendly implementation of ChemObjectIOListener
- use of enum and generics in the API (those did not exist when the
API was designed)
- setting the listener in the ChemObjectIO class constructor

SDFWriter sdf = new SDFWriter(out,
  new JavaFriendlierListener().add(
    "FieldsToWrite", {
      CDKConstants.TITLE, "thisToo"
    }
  )
)

This can all simply be done with the current design, just by writing a
new IChemObjectIOListener implementation.

And I am happy to rename IChemObjectIOListener to IOSettingStore is
that makes people more comfortable.

Egon

--
Dr E.L. Willighagen
Postdoctoral Researcher
Department of Bioinformatics - BiGCaT
Maastricht University (http://www.bigcat.unimaas.nl/)
Homepage: http://egonw.github.com/
LinkedIn: http://se.linkedin.com/in/egonw
Blog: http://chem-bla-ics.blogspot.com/
PubList: http://www.citeulike.org/user/egonw/tag/papers

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Cdk-devel mailing list
Cdk-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-devel