Official | HULFT IoT EdgeStreaming Plugin SDK Getting Started Third Edition: July 1, 2021
Implementation of SampleSourceOperationFactory
SampleSourceOperationFactory is a class holding the following information:
Superclass |
BQLPluginSourceOperationFactory class |
Description |
A Factory class that returns an object holding the properties of Source Operation and returns an operation object |
Implementation of SampleSourceOperationFactory is as follows:
package com.appresso.ds.dp.modules.adapter.sample; import com.appresso.ds.common.spi.constraint.NumberFillin; import com.appresso.ds.common.spi.param.SimpleParameter; import com.appresso.ds.common.xmlfw.xml.XmlHandler; import com.appresso.ds.dp.share.adapter.bql.common.BQLPluginSourceOperationFactory; import com.appresso.ds.dp.spi.OperationConfiguration; import com.appresso.ds.dp.spi.OperationConfigurator; import org.xml.sax.SAXException; import static com.appresso.ds.common.bql.BQLSimpleParameterType.FLOAT; public class SampleSourceOperationFactory extends BQLPluginSourceOperationFactory { @Override protected String getLabel() { return Messages.getString("Sample.Source.Label"); } @Override protected String getPluginName() { return "sample_plugin"; } @Override public String getOperationName() { return "sample_source"; } @Override protected String getTypeName() { return "sample_source"; } @Override protected void setupOperationConfigurator(OperationConfigurator operationConfigurator) { operationConfigurator.addSimpleParameter(createIntervalParameter()); } @Override protected void setupOutputSchema(XmlHandler handler, OperationConfiguration conf) throws Exception { handler.startElement("", "payload", "payload", EMPTY_ATTRIBUTE); writeElement(handler, "value"); handler.endElement("", "payload", "payload"); } private void writeElement(XmlHandler handler, String name) throws SAXException { handler.startElement("", name, name, EMPTY_ATTRIBUTE); handler.endElement("", name, name); } private static SimpleParameter createIntervalParameter() { NumberFillin fillin = new NumberFillin(); fillin.setMinValue(0.001); fillin.setMaxValue(1314000); fillin.setAllowMin(true); fillin.setAllowMax(true); fillin.setPrecision(10); fillin.setDecimal(3); fillin.setAllowDouble(true); fillin.setLabel(Messages.getString("Sample.Source.Interval.Label")); fillin.setRequired(true); return new SimpleParameter(FLOAT.toParameterKey("interval"), fillin); } }
Official | HULFT IoT EdgeStreaming Plugin SDK Getting Started Third Edition: July 1, 2021