Search in sources :

Example 1 with CharacterStreamStatementParameter

use of com.adaptris.core.services.jdbc.CharacterStreamStatementParameter in project interlok by adaptris.

the class JdbcRawDataCaptureServiceTest method createServiceNamedParameters.

private JdbcRawDataCaptureService createServiceNamedParameters(boolean createConnection) {
    JdbcRawDataCaptureService service = new JdbcRawDataCaptureService();
    if (createConnection) {
        JdbcConnection connection = new JdbcConnection();
        connection.setConnectUrl(PROPERTIES.getProperty(JDBC_CAPTURE_SERVICE_URL));
        connection.setDriverImp(PROPERTIES.getProperty(JDBC_CAPTURE_SERVICE_DRIVER));
        service.setConnection(connection);
    }
    service.setParameterApplicator(new NamedParameterApplicator());
    StatementParameter param1 = new StatementParameter(METADATA_KEY, "java.lang.String", StatementParameter.QueryType.metadata);
    param1.setName("param1");
    service.addStatementParameter(param1);
    DateStatementParameter param2 = new DateStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
    param2.setName("param2");
    service.addStatementParameter(param2);
    TimestampStatementParameter param3 = new TimestampStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
    param3.setName("param3");
    service.addStatementParameter(param3);
    TimeStatementParameter param4 = new TimeStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
    param4.setName("param4");
    service.addStatementParameter(param4);
    StatementParameter param5 = new StatementParameter(null, "java.lang.String", StatementParameter.QueryType.payload);
    param5.setName("param5");
    service.addStatementParameter(param5);
    BytePayloadStatementParameter param6 = new BytePayloadStatementParameter();
    param6.setName("param6");
    service.addStatementParameter(param6);
    CharacterStreamStatementParameter param7 = new CharacterStreamStatementParameter();
    param7.setName("param7");
    service.addStatementParameter(param7);
    BinaryStreamStatementParameter param8 = new BinaryStreamStatementParameter();
    param8.setName("param8");
    service.addStatementParameter(param8);
    StatementParameter param9 = new StatementParameter(null, "java.lang.String", StatementParameter.QueryType.id);
    param9.setName("param9");
    service.addStatementParameter(param9);
    StatementParameter param10 = new StatementParameter(CONSTANT_VALUE, "java.lang.String", StatementParameter.QueryType.constant);
    param10.setName("param10");
    service.addStatementParameter(param10);
    service.setStatement("insert into jdbc_raw_data_capture_basic " + "(string_value, date_value, timestamp_value, time_value, payload_clob, payload_blob, payload_clob2, payload_blob2, id_value, constant_value) " + "values (#param1, #param2, #param3, #param4, #param5, #param6, #param7, #param8, #param9, #param10)");
    return service;
}
Also used : BytePayloadStatementParameter(com.adaptris.core.services.jdbc.BytePayloadStatementParameter) CharacterStreamStatementParameter(com.adaptris.core.services.jdbc.CharacterStreamStatementParameter) DateStatementParameter(com.adaptris.core.services.jdbc.DateStatementParameter) BinaryStreamStatementParameter(com.adaptris.core.services.jdbc.BinaryStreamStatementParameter) TimeStatementParameter(com.adaptris.core.services.jdbc.TimeStatementParameter) TimestampStatementParameter(com.adaptris.core.services.jdbc.TimestampStatementParameter) BinaryStreamStatementParameter(com.adaptris.core.services.jdbc.BinaryStreamStatementParameter) TimestampStatementParameter(com.adaptris.core.services.jdbc.TimestampStatementParameter) DateStatementParameter(com.adaptris.core.services.jdbc.DateStatementParameter) BytePayloadStatementParameter(com.adaptris.core.services.jdbc.BytePayloadStatementParameter) TimeStatementParameter(com.adaptris.core.services.jdbc.TimeStatementParameter) StatementParameter(com.adaptris.core.services.jdbc.StatementParameter) CharacterStreamStatementParameter(com.adaptris.core.services.jdbc.CharacterStreamStatementParameter) JdbcConnection(com.adaptris.core.jdbc.JdbcConnection) NamedParameterApplicator(com.adaptris.core.services.jdbc.NamedParameterApplicator) SimpleDateFormat(java.text.SimpleDateFormat)

Example 2 with CharacterStreamStatementParameter

use of com.adaptris.core.services.jdbc.CharacterStreamStatementParameter in project interlok by adaptris.

the class JdbcRawDataCaptureServiceTest method createResolveableStatement.

private JdbcRawDataCaptureService createResolveableStatement(boolean createConnection) {
    JdbcRawDataCaptureService service = new JdbcRawDataCaptureService();
    if (createConnection) {
        JdbcConnection connection = new JdbcConnection();
        connection.setConnectUrl(PROPERTIES.getProperty(JDBC_CAPTURE_SERVICE_URL));
        connection.setDriverImp(PROPERTIES.getProperty(JDBC_CAPTURE_SERVICE_DRIVER));
        service.setConnection(connection);
    }
    service.addStatementParameter(new DateStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")));
    service.addStatementParameter(new TimestampStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")));
    service.addStatementParameter(new TimeStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")));
    service.addStatementParameter(new StatementParameter(null, "java.lang.String", StatementParameter.QueryType.payload));
    service.addStatementParameter(new BytePayloadStatementParameter());
    service.addStatementParameter(new CharacterStreamStatementParameter());
    service.addStatementParameter(new BinaryStreamStatementParameter());
    service.addStatementParameter(new StatementParameter(null, "java.lang.String", StatementParameter.QueryType.id));
    service.addStatementParameter(new StatementParameter(CONSTANT_VALUE, "java.lang.String", StatementParameter.QueryType.constant));
    service.setStatement("insert into jdbc_raw_data_capture_basic " + "(string_value, date_value, timestamp_value, time_value, payload_clob, payload_blob, payload_clob2, payload_blob2, id_value, constant_value) " + "values ('%message{jdbcRawDataCaptureServiceTest}', ?, ?, ?, ?, ?, ?, ?, ?, ?)");
    return service;
}
Also used : BytePayloadStatementParameter(com.adaptris.core.services.jdbc.BytePayloadStatementParameter) CharacterStreamStatementParameter(com.adaptris.core.services.jdbc.CharacterStreamStatementParameter) DateStatementParameter(com.adaptris.core.services.jdbc.DateStatementParameter) BinaryStreamStatementParameter(com.adaptris.core.services.jdbc.BinaryStreamStatementParameter) TimeStatementParameter(com.adaptris.core.services.jdbc.TimeStatementParameter) TimestampStatementParameter(com.adaptris.core.services.jdbc.TimestampStatementParameter) BinaryStreamStatementParameter(com.adaptris.core.services.jdbc.BinaryStreamStatementParameter) TimestampStatementParameter(com.adaptris.core.services.jdbc.TimestampStatementParameter) DateStatementParameter(com.adaptris.core.services.jdbc.DateStatementParameter) BytePayloadStatementParameter(com.adaptris.core.services.jdbc.BytePayloadStatementParameter) TimeStatementParameter(com.adaptris.core.services.jdbc.TimeStatementParameter) StatementParameter(com.adaptris.core.services.jdbc.StatementParameter) CharacterStreamStatementParameter(com.adaptris.core.services.jdbc.CharacterStreamStatementParameter) JdbcConnection(com.adaptris.core.jdbc.JdbcConnection) SimpleDateFormat(java.text.SimpleDateFormat)

Example 3 with CharacterStreamStatementParameter

use of com.adaptris.core.services.jdbc.CharacterStreamStatementParameter in project interlok by adaptris.

the class JdbcRawDataCaptureServiceTest method createService.

private JdbcRawDataCaptureService createService(boolean createConnection) {
    JdbcRawDataCaptureService service = new JdbcRawDataCaptureService();
    if (createConnection) {
        JdbcConnection connection = new JdbcConnection();
        connection.setConnectUrl(PROPERTIES.getProperty(JDBC_CAPTURE_SERVICE_URL));
        connection.setDriverImp(PROPERTIES.getProperty(JDBC_CAPTURE_SERVICE_DRIVER));
        service.setConnection(connection);
    }
    service.addStatementParameter(new StatementParameter(METADATA_KEY, "java.lang.String", StatementParameter.QueryType.metadata));
    service.addStatementParameter(new DateStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")));
    service.addStatementParameter(new TimestampStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")));
    service.addStatementParameter(new TimeStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")));
    service.addStatementParameter(new StatementParameter(null, "java.lang.String", StatementParameter.QueryType.payload));
    service.addStatementParameter(new BytePayloadStatementParameter());
    service.addStatementParameter(new CharacterStreamStatementParameter());
    service.addStatementParameter(new BinaryStreamStatementParameter());
    service.addStatementParameter(new StatementParameter(null, "java.lang.String", StatementParameter.QueryType.id));
    service.addStatementParameter(new StatementParameter(CONSTANT_VALUE, "java.lang.String", StatementParameter.QueryType.constant));
    service.setStatement("insert into jdbc_raw_data_capture_basic " + "(string_value, date_value, timestamp_value, time_value, payload_clob, payload_blob, payload_clob2, payload_blob2, id_value, constant_value) " + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
    return service;
}
Also used : BytePayloadStatementParameter(com.adaptris.core.services.jdbc.BytePayloadStatementParameter) CharacterStreamStatementParameter(com.adaptris.core.services.jdbc.CharacterStreamStatementParameter) DateStatementParameter(com.adaptris.core.services.jdbc.DateStatementParameter) BinaryStreamStatementParameter(com.adaptris.core.services.jdbc.BinaryStreamStatementParameter) TimeStatementParameter(com.adaptris.core.services.jdbc.TimeStatementParameter) TimestampStatementParameter(com.adaptris.core.services.jdbc.TimestampStatementParameter) BinaryStreamStatementParameter(com.adaptris.core.services.jdbc.BinaryStreamStatementParameter) TimestampStatementParameter(com.adaptris.core.services.jdbc.TimestampStatementParameter) DateStatementParameter(com.adaptris.core.services.jdbc.DateStatementParameter) BytePayloadStatementParameter(com.adaptris.core.services.jdbc.BytePayloadStatementParameter) TimeStatementParameter(com.adaptris.core.services.jdbc.TimeStatementParameter) StatementParameter(com.adaptris.core.services.jdbc.StatementParameter) CharacterStreamStatementParameter(com.adaptris.core.services.jdbc.CharacterStreamStatementParameter) JdbcConnection(com.adaptris.core.jdbc.JdbcConnection) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

JdbcConnection (com.adaptris.core.jdbc.JdbcConnection)3 BinaryStreamStatementParameter (com.adaptris.core.services.jdbc.BinaryStreamStatementParameter)3 BytePayloadStatementParameter (com.adaptris.core.services.jdbc.BytePayloadStatementParameter)3 CharacterStreamStatementParameter (com.adaptris.core.services.jdbc.CharacterStreamStatementParameter)3 DateStatementParameter (com.adaptris.core.services.jdbc.DateStatementParameter)3 StatementParameter (com.adaptris.core.services.jdbc.StatementParameter)3 TimeStatementParameter (com.adaptris.core.services.jdbc.TimeStatementParameter)3 TimestampStatementParameter (com.adaptris.core.services.jdbc.TimestampStatementParameter)3 SimpleDateFormat (java.text.SimpleDateFormat)3 NamedParameterApplicator (com.adaptris.core.services.jdbc.NamedParameterApplicator)1