@@ -0,0 +1,1528 @@
+package com.github.aureliano.evtbridge.output.jdbc;%0A%0Aimport java.sql.Connection;%0Aimport java.sql.PreparedStatement;%0Aimport java.sql.SQLException;%0Aimport java.util.Map;%0A%0Aimport org.apache.log4j.Logger;%0A%0Aimport com.github.aureliano.evtbridge.core.agent.AbstractDataWriter;%0Aimport com.github.aureliano.evtbridge.core.jdbc.ConnectionPool;%0Aimport com.github.aureliano.evtbridge.core.jdbc.JdbcConnectionModel;%0A%0Apublic class JdbcDataWriter extends AbstractDataWriter %7B%0A%0A%09private JdbcConnectionModel schemaConnection;%0A%09private Connection connection;%0A%09%0A%09private static final Logger logger = Logger.getLogger(JdbcDataWriter.class);%0A%09%0A%09public JdbcDataWriter() %7B%0A%09%09super();%0A%09%7D%0A%0A%09@Override%0A%09public void initializeResources() %7B%0A%09%09this.initialize();%0A%09%7D%0A%0A%09@Override%0A%09public void finalizeResources() %7B %7D%0A%0A%09@SuppressWarnings(%22unchecked%22)%0A%09@Override%0A%09public void write(Object data) %7B%0A%09%09this.insert((Map%3CString, Object%3E) data);%0A%09%7D%0A%09%0A%09private void initialize() %7B%0A%09%09this.schemaConnection = ((JdbcOutputConfig) super.outputConfiguration).getConnection();%0A%09%09logger.info(%22Table for inserting: %22 + this.schemaConnection.getTable());%0A%09%7D%0A%09%0A%09private void insert(Map%3CString, Object%3E data) %7B%0A%09%09try %7B%0A%09%09%09if (this.connection == null) %7B%0A%09%09%09%09this.connection = ConnectionPool.instance().getConnection(this.schemaConnection);%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09PreparedStatement stmt = JdbcHelper.createStatement(connection, this.schemaConnection.getTable(), data);%0A%09%09%09stmt.executeUpdate();%0A%09%09%09%0A%09%09%09stmt.close();%0A%09%09%7D catch (SQLException ex) %7B%0A%09%09%09throw new JdbcOutputException(ex);%0A%09%09%7D%0A%09%7D%0A%7D

Create jdbc data writer.