kozchris / tmapix

Automatically exported from code.google.com/p/tmapix
0 stars 0 forks source link

Replace hard-coded implementation-specific classes in TMAPIChooser with SPI #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If an implementation could provide a specific IMapHandler via a factory or
something, the hard-coded values in the TMAPIChooser could be replaced.

I.e.:

interface IMapHandlerProvider {

    public IMapHandler createMapHandler(org.tmapi.core.TopicMap);

    public String[] getTopicMapClassNames();

}

class TMAPIChooser {

    [...]
    public IMapHandler createMapHandler(org.tmapi.core.TopicMap tm) {
        IMapHandlerProvider provider =
_class2Provider.get(tm.getClass().getName());
        return provider != null ? provider.createMapHandler(tm)
                                : new TMAPIMapHandler(tm);
    }

}

Original issue reported on code.google.com by lars.he...@gmail.com on 7 May 2010 at 12:29

GoogleCodeExporter commented 8 years ago
To be testable each implementation should also provide a CXTMWriter:

interface CXTMWriterProvider {

    public TopicMapWriter createCXTMWriter(org.tmapi.core.TopicMap);

    public String[] getTopicMapClassNames();

}

Original comment by lars.he...@gmail.com on 7 May 2010 at 12:33