[infinispan-issues] [JBoss JIRA] (ISPN-2449) 5.1.x and 5.2.x API differences
Tristan Tarrant (JIRA)
jira-events at lists.jboss.org
Fri Nov 2 10:20:18 EDT 2012
[ https://issues.jboss.org/browse/ISPN-2449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tristan Tarrant updated ISPN-2449:
----------------------------------
Status: Pull Request Sent (was: Coding In Progress)
Git Pull Request: https://github.com/infinispan/infinispan/pull/1448
> 5.1.x and 5.2.x API differences
> -------------------------------
>
> Key: ISPN-2449
> URL: https://issues.jboss.org/browse/ISPN-2449
> Project: Infinispan
> Issue Type: Bug
> Components: Configuration
> Affects Versions: 5.2.0.Beta2
> Reporter: Randall Hauch
> Assignee: Tristan Tarrant
> Fix For: 5.2.0.CR1
>
>
> Programmatically configuring a cache store in 5.1.x makes use of the LoaderConfigurationBuilder:
> {code:java}
> LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new JdbcBinaryCacheStore());
> lb.addProperty("dropTableOnExit", "false")
> .addProperty("createTableOnStart", "true")
> .addProperty("connectionFactoryClass", "org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory")
> .addProperty("connectionUrl", "jdbc:h2:file:/abs/path/string_based_db;DB_CLOSE_DELAY=1")
> .addProperty("driverClass", "org.h2.Driver")
> .addProperty("userName", "sa")
> .addProperty("idColumnName", "ID_COLUMN")
> .addProperty("idColumnType", "VARCHAR(255)")
> .addProperty("timestampColumnName", "TIMESTAMP_COLUMN")
> .addProperty("timestampColumnType", "BIGINT")
> .addProperty("dataColumnName", "DATA_COLUMN")
> .addProperty("dataColumnType", "BINARY")
> .addProperty("bucketTableNamePrefix", "MODE")
> .addProperty("cacheName", "default");
> {code}
> This code does not compile with 5.2.0.Beta2 because {{LoaderConfigurationBuilder}} now is parameterized by the type of LoaderConfiguration and builder, and the return type of {{addProperty(...)}} is {{LoaderConfigurationBuilder<T,S>}}. When the above 5.1.x-compatible code is used (as a raw type), the return type of {{addProperty(...)}} becomes {{Object}} and this breaks the fluent-API style code above.
> For code that needs to compile against 5.1.x and 5.2.x, the workaround is to change the above code to remove the fluent-API usage:
> {code:java}
> LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new JdbcBinaryCacheStore());
> lb.addProperty("dropTableOnExit", "false");
> lb.addProperty("createTableOnStart", "true");
> lb.addProperty("connectionFactoryClass", "org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory");
> lb.addProperty("connectionUrl", "jdbc:h2:file:/abs/path/string_based_db;DB_CLOSE_DELAY=1");
> lb.addProperty("driverClass", "org.h2.Driver");
> lb.addProperty("userName", "sa");
> lb.addProperty("idColumnName", "ID_COLUMN");
> lb.addProperty("idColumnType", "VARCHAR(255)");
> lb.addProperty("timestampColumnName", "TIMESTAMP_COLUMN");
> lb.addProperty("timestampColumnType", "BIGINT");
> lb.addProperty("dataColumnName", "DATA_COLUMN");
> lb.addProperty("dataColumnType", "BINARY");
> lb.addProperty("bucketTableNamePrefix", "MODE");
> lb.addProperty("cacheName", "default");
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the infinispan-issues
mailing list