Last updated April 06, 2010 02:32, by Andy Gibson

10 ways Spigot Helps Developers

1) Lets you turn anything into a data provider, an xml file, a binary file, a web service, anything. Because Spigot provides a common interface to data providers, you can bind a paginated and/or sorted grid to a comma delimited file or a database table without having to change the client view code.

2) Lets you use EL expressions in database queries with parameters being resolved to the values. In fact, you can use EL expression, reflection or a plain old map to provide parameter values. You can even write your own parameter resolvers to translate a parameter to a value.

3) For SQL based data providers, Spigot can remove parts of the WHERE clause when the parameter values are null. This allows developers to bind the query to the actual search parameters object (using a reflection parameter resolver) and any values not entered on the search form are automatically not included in the search.

4) Lets you iterate over a list of objects and if the page size is set, it will load the items in batches as needed while you iterate through them.

5) Provides an easy mechanism to have a JDBC query return a list of objects, again, using the same interfaces, you can just connect it to the same client code.

6) Lets you switch out data provider implementations. If you have a query that returns a set of data that might benefit from using direct SQL instead of hibernate or JPA, you can change that data provider to use JDBC and still get to use the same view code to connect to the dataset.

7) Provides paginated lazy loading for any kind of data provider. Whether it is a database source, or a text file, Spigot will only load on demand or if you don't want pagination, it can load it all at once.

8) Allows you to convert any kind of data source into an in memory data source so you can have quick access to common data which may be application scoped and shared across each user.

9) Because there is a separation between the state of the data view and the fetching of the data, you can have multiple views of the same information. This can allow you to have multiple paginated views of the same data which can be shared across a web application.

10) We have an indexed data provider cache that allows random access to any data provider (again, database, file based, in memory it doesn't matter) which means you can connect a Swing data table to a data set with a million rows and it still only loads the rows it needs as it needs them but with cached results so it keeps a hold of the most recent objects. We have a demo for this in the distribution.

Overall, it's the ability to know that you can use your existing code to access diverse data sources, or if you do need to suddenly provide a sorted paginated list from some exotic file or location, you can take the same code you use for accessing MySQL and use it against your new data source. Even if you don't plan on switching data access tools, it also provides a jump start to software development because you have a reusable library to manage data access and querying which gets you up and running very quickly. Later, should you need to access an obscure data source, you already have view code that can be used to paginate the result sets to the data provider.

  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20100521.d19488a)
 
 
loading
Please Confirm