Design Hub developer guide - real time plugins example implementations

    Existing plugin implementations

    You can find a brief selection of plugins in on our Github repository for: ChemAxon calculator plugins, ChemAxon 3D Alignment and Conformations, eMolecules, Reaxys, KNIME Server, Pipeline Pilot, ChemAxon Madfast Similarity search, PubChem or UniChem. These mix SOAP, REST APIs and direct database connections, such as to a JChem Postgres Cartridge.

    Java real time plugin example implementation

    Example Java real time plugin implementation can be found bellow. This implementation uses dependency to prepared utility which handles the server side (Design hub) communication. See full documentation here. Pull requests welcome!

    public class PluginLogic implements RealtimePluginInterface<PluginSettings> {
        final PluginSettings myDefaultSettings = new PluginSettings(
                new BooleanPluginSetting("Enable report data", true),
                new StringPluginSetting("Put some nice string here", ""),
                new NumberPluginSetting("Custom atom count", 4));
        ElementalAnalyser elementalAnalyser = new ElementalAnalyser();
        final Logger logger = LoggerFactory.getLogger(PluginLogic.class);
        public ResultSet getResultSet(String structure, String pinnedStructure, PluginSettings settings, Object context) {
            logger.debug("We just received some data!");
            try {
                MolImporter mi = new MolImporter(new ByteArrayInputStream(structure.getBytes()));
                Molecule mol = null;
                mol =;
                double exactMass = elementalAnalyser.exactMass();
                double mass = elementalAnalyser.mass();
                int massPrecision = elementalAnalyser.massPrecision();
                int atomCount1 = elementalAnalyser.atomCount(8); // oxygen atom count
                int atomCount2 = elementalAnalyser.atomCount(8, 0); // non-isotope oxygen count
                int atomCount3 = elementalAnalyser.atomCount(8, 16); // oxygen isotope count with massno=16
                String formula = elementalAnalyser.formula();
                String isotopeFormula = elementalAnalyser.isotopeFormula();
                String composition = elementalAnalyser.composition(2); // precision=2
                String isotopeComposition = elementalAnalyser.isotopeComposition(2); // precision=2
                // now use the results...
                ClientData clientData = new ClientData();
                // using settings
                int customAtomCountSetting = settings.getAtomCount().getValue().intValue();
                if (settings.getReportEnabled().getValue()) {
                    HashMap<String, Object> reportData = new HashMap<>();
                    reportData.put("Oxygen atom count", atomCount1);
                    reportData.put("Non-isotope oxygen count", atomCount2);
                    reportData.put("Some boolean data", true);
                    reportData.put("Some string data", "Report data!");
                    return new ResultSet(clientData, reportData);
                //Return null in the case this plugin should not provide any report data
                return new ResultSet(clientData, null);
            } catch (Exception e) {
                logger.error("There was an error processing this calculation structure: {}", structure);
                return new ResultSet(null, null);
        public PluginSettings getSettings() {
            return myDefaultSettings;
        public String getLabel() {
            return "Example plugin label";
        public String getName() {
            return "example-java-plugin-name";
        public String getTemplate() {
            // For more details see docs:
            return "<div>\n" +
                    "  <p>Oxygen atom count: {{client.atomCount1}}</p>\n" +
                    "  <p>Non-isotope oxygen count: {{client.atomCount2}}</p>\n" +
                    "  <p>Oxygen isotope count with massno=16: {{client.atomCount3}}</p>\n" +
                    "  <p>Custom set ({{client.settingOfCustomAtomCount}}) atom count: {{client.customAtomCount}}</p>\n" +
                    "  <p>Formula: {{client.formula}}</p>\n" +
                    "  <p>Isotope formula: {{client.isotopeFormula}}</p>\n" +
                    "  <p>Composition: {{client.composition}}</p>\n" +
                    "  <p>Isotope composition: {{client.isotopeComposition}}</p>\n" +
        public boolean hasReport() {
            return true;