2020-02-07_databridge-drivers.html


001| #:name::DataBridge Drivers
002| #:link::https://thehardcorecoder.com/2020/02/07/databridge-drivers/
003| #:date::2020-02-07
004| #:code/java::
005| public interface IDisplayable
006| {
007|     public String  toString();
008|     public String  toHtml();
009|     public String  toXml();
010| }
011| 
012| #:code/java::
013| public interface IDataBridgeObject extends IDisplayable
014| {
015|     public boolean err();
016|     public String errmsg();
017| }
018| 
019| #:code/java::
020| public interface IDataChannel extends IDataBridgeObject
021| {
022|     public void initialize(AppProperties props)
023|         throws Exception;
024| 
025|     public void open() throws Exception;
026|     public void close();
027| 
028|     public boolean ready();
029| }
030| 
031| #:code/java::
032| public interface IDataInput extends IDataChannel
033| {
034|     static public final String GROUP_NAME = "Input";
035| 
036|     public int getColumnCount() throws Exception;
037| 
038|     public String[] getColumnNames() throws Exception;
039| 
040|     public Object[] getRecord() throws Exception;
041| }
042| 
043| #:code/java::
044| public interface IDataOutput extends IDataChannel
045| {
046|     static public final String GROUP_NAME = "Output";
047| 
048|     public void  setColumnNames(String[] hdrs)
049|         throws Exception;
050| 
051|     public void  putRecord(Object[] rcd)
052|         throws Exception;
053| }
054| 
055| #:code/java::
056| public interface IDataMap extends IDataBridgeObject
057| {
058|     static public final String  GROUP_NAME = "Mapper";
059| 
060|     public void initialize(AppProperties props)
061|         throws Exception;
062| 
063|     public void open(IDataInput inchan, IDataOutput outchan)
064|         throws Exception;
065| 
066|     public void  close();
067| 
068|     public Object[] mapRecord(String[] cols, Object[] fields)
069|         throws Exception;
070| }
071| 
072| #:end:code::
073|