at.spardat.xma.datasource
Class RessourceBundleProviderServer

java.lang.Object
  extended byat.spardat.xma.datasource.RessourceBundleProviderServer
All Implemented Interfaces:
ITableProvider

public class RessourceBundleProviderServer
extends java.lang.Object
implements ITableProvider

Provides tabular data from a RessourceBundle. The specification of these kind of data sources must follow the syntax

 type=rsc,bundle=at.spardat. ... .MyBundle
 
i.e., the type must be the reserverd word rsc and a second attribute named bundle indicates the name of the ressource bundle where the values are extracted from.

The most typical usage are properties-files to implement ressource bundles. The following paragraph defines how properties files are mapped to TabularData objects, which are used from the XMA application to programmatically access the tabular data. We start with an example. Suppose our table should have the following columns:

 column name         column type
 ----------------------------------------
 lastName            String
 datBirth            Date
 ynMarried           Boolean
 betIncome           Numeric
 
then a properties file providing the actual data looks like:
 COLS  = lastName,datBirth,ynMarried,betIncome
 10    = "Huber",D19720101,BY,N100000.23
 20    = "Maier",D19661110,BN,N20000.00
 50    = "Lilly",D20030101,B ,N
 
There must be one line with the key COLS that provides the name of the columns. The remaining lines must have a numeric key that indicates the order of the lines (since the lines in property files are unordered).

Each value (the part after the equal sign) contains the cells of the table rows, separated by comma. String types are delimited with quotes. If the string value should contain a quote, praefix it with double backslash (i.e., \\"). Date values start with a D and a date followed in the ISO-format, i.e., YYYYMMDD. Booleans start with a B as type sign, followed by Y or N. Numeric values start with N, followed by a numeric string as defined by Double.parseDouble(java.lang.String).

Empty Strings must be specified via double quotes, i.e., quotes with no text in between. All other empty types must start with the type character without following text, e.g., N with no trailing text denotes an empty numeric.

If the provided table holds domain data, a property file must look like this:

 COLS  = COD_KEY,SHORT_VALUE,LONG_VALUE,VALID_FROM,VALID_TO
 10    = "ab",   "ab",       "abgetreten",D20030101,D20030720
 20    = "we",   "we",       "weggetreten",D20030101,D20030719
 


Constructor Summary
RessourceBundleProviderServer()
           
 
Method Summary
 int getExpireDurationClientSecs(java.lang.String type)
          Returns 30 days, which de facto means never.
 int getExpireDurationServerSecs(java.lang.String type)
          Returns 30 days, which de facto means never.
 ProviderResultServer provideTable(XMASession session, TableSpec spec, long lastModified)
          This method is requested to provide a table in the form of a ITabularData.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RessourceBundleProviderServer

public RessourceBundleProviderServer()
Method Detail

provideTable

public ProviderResultServer provideTable(XMASession session,
                                         TableSpec spec,
                                         long lastModified)
Description copied from interface: ITableProvider
This method is requested to provide a table in the form of a ITabularData. If lastModified is not specified (if it is ITabularDataSource.UNKNOWN_TIMESTAMP), the callee must return the table. If lastModified is defined, the callee must provide a table if and only if the modification time changed. If the time of the last modification is still lastModified, the returned table in the result data may be null. The latter form has the semantics of an HTTP conditional get where the ressource is unchanged.

This method is intended to be overwritten (extended) by XMA projects that must handle their own types of data sources.

Specified by:
provideTable in interface ITableProvider
Parameters:
session - the active XMASession
spec - a table specification as defined in ITabularDataSource. The following properties are always contained in spec:
  • type indicates the table type.
  • _loc indicates the Locale of the XMA context.
  • _man indicates the mandant of the XMA context.
  • _env indicates the environment of the XMA context.
The attributes with leading underscore are drawn from XMAContext and are included because they are needed as keys in any cache.
lastModified - may be either UNKNOWN_TIMESTAMP to unconditionally request the data or a timestamp which indicates a lastModified timestamp which has been delivered (presumably some time ago) and the callee is requested to provide the table if it has changed since that time. The units are number of milliseconds since 1.1.1970 UTC.
Returns:
a newly created value object or null. Also see the javadoc of the getter methods there. If the lastModified parameter was XMATabularDataSourceServer.UNKNOWN_TIMESTAMP, the returned object must not be null. Otherwise null may be returned which indicates that the table did not change with respect to lastModified. If the callee returns a table, the value objects last modified timestamp may be set or not, depending on whether the callee is able to compute a last modified timestamp.
See Also:
ITableProvider.provideTable(at.spardat.xma.session.XMASession, at.spardat.xma.datasource.TableSpec, long)

getExpireDurationClientSecs

public int getExpireDurationClientSecs(java.lang.String type)
Returns 30 days, which de facto means never. However, it requires that some application id is included in the cache keys to ignore cached resources if a new version is deployed at the server.

Specified by:
getExpireDurationClientSecs in interface ITableProvider
Returns:
number of seconds a table remains valid in the XMA clients cache without contacting the server for an uptodate check. The implementor must provide a number greater than 60. The maximum of the returned value and 60 will be used.
See Also:
ITableProvider.getExpireDurationClientSecs(java.lang.String)

getExpireDurationServerSecs

public int getExpireDurationServerSecs(java.lang.String type)
Returns 30 days, which de facto means never. As long as the application is running, the bundle cannot change.

Specified by:
getExpireDurationServerSecs in interface ITableProvider
See Also:
ITableProvider.getExpireDurationServerSecs(java.lang.String)