|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectat.spardat.xma.datasource.XMATabularDataSourceServer
The purpose of this class if twofold. First, it implements ITabularDataSource at
the server side of XMA. Second, it is responsible for querying the origin data source
at the server side (database, legacy system or something else).
If a XMA application defines additional data source types, it must subclass this
class and call the method addTableProvider(String, ITableProvider) in the
derived class's constructor to add additional handler objects that must implement ITableProvider.
Basically, ITableProvider is responsible for querying tables for
a particular type and has the methods
provideTable, getExpireDurationClientSecs and
getExpireDurationServerSecs. The first method actually gathers the data
and the other control caching behaviour.
getExpireDurationClientSecs defines how long the returned table may stay in the XMA client cache without querying the XMA server again. getExpireDurationServerSecs defines how long the table may reside in the server cache without calling provideTable again. Values of zero indicate that caches effectively are ignored.
Note that the expiration mechanism effectively avoids requests to next higher cache for the specified amount of time, even if the ressource has changed at the origin server in the meantime. Therefore, in the worst case, a XMA client might see a ressource that has been changed getExpireDurationClientSecs + getExpireDurationServerSecs seconds ago. A XMA server might see a ressource that has been changed getExpireDurationServerSecs seconds ago in the worst case.
If a table is considered to be expired at the client, the client validates the table by issuing an HTTP conditional get. The recipient of the HTTP get, the XMA server, itself looks up its cache. If the table is also expired in the server cache, provideTable is called.
This class registers only an ITableProvider for type 'rsc', i.e. resource bundles.
| Field Summary | |
static long |
UNKNOWN_TIMESTAMP
Constant for a timestamp that is unknown. |
| Constructor Summary | |
XMATabularDataSourceServer()
Constructs and installs predefined table providers. |
|
| Method Summary | |
void |
addTableProvider(java.lang.String type,
ITableProvider provider)
Installs a ITableProvider for a given type. |
ITabularDomData |
getDomTable(java.lang.String spec,
XMASession session)
Convenience method to retrieve a table that contains domain values. |
int |
getExpireDurationClientSecs(java.lang.String type)
The default implemententation is to consult the installed table providers. |
int |
getExpireDurationServerSecs(java.lang.String type)
The default implemententation is to consult the installed table providers. |
ITabularData |
getTable(java.lang.String spec,
XMASession session)
This method is not indented to be overwritten. |
protected ITableProvider |
getTableProviderSafe(java.lang.String type)
Returns the ITableProvider for a given tabular datasource type. |
void |
invalidate(java.lang.String spec)
Removes the resource specified by spec from memory. |
ProviderResultServer |
provideTable(XMASession session,
TableSpec spec,
long lastModified)
The default implemententation is to consult the installed table providers. |
protected static long |
tableHash2randomTimeStamp(int hashCode)
Maps a given hash code to a timestamp ranging from 1.1.1970 up to 1.7.2003. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final long UNKNOWN_TIMESTAMP
| Constructor Detail |
public XMATabularDataSourceServer()
| Method Detail |
public void addTableProvider(java.lang.String type,
ITableProvider provider)
public ITabularData getTable(java.lang.String spec,
XMASession session)
getTable in interface ITabularDataSourcespec - identifies a table as defined above.session - XMASession
ITabularDataSource.getTable(java.lang.String, at.spardat.xma.session.XMASession)
public ITabularDomData getDomTable(java.lang.String spec,
XMASession session)
ITabularDataSourceITableProvider-implementor that decides
on this.
getDomTable in interface ITabularDataSourcespec - identifies a table as defined above.session - XMASession
ITabularDataSource.getDomTable(java.lang.String, at.spardat.xma.session.XMASession)public void invalidate(java.lang.String spec)
spec -
public ProviderResultServer provideTable(XMASession session,
TableSpec spec,
long lastModified)
provideTable in interface ITableProvidersession - the active XMASessionspec - a table specification as defined in ITabularDataSource.
The following properties are always contained in spec:
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.
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.
at.spardat.enterprise.exc.SysException - if no provider for the type can be found.ITableProvider.provideTable(XMASession, at.spardat.xma.datasource.TableSpec, long)public int getExpireDurationClientSecs(java.lang.String type)
getExpireDurationClientSecs in interface ITableProviderat.spardat.enterprise.exc.SysException - if no provider for the type can be found.ITableProvider.getExpireDurationClientSecs(java.lang.String)public int getExpireDurationServerSecs(java.lang.String type)
getExpireDurationServerSecs in interface ITableProviderat.spardat.enterprise.exc.SysException - if no provider for the type can be found.ITableProvider.getExpireDurationServerSecs(java.lang.String)protected ITableProvider getTableProviderSafe(java.lang.String type)
type - the requested type
at.spardat.enterprise.exc.SysException - if there is no provider for type.protected static long tableHash2randomTimeStamp(int hashCode)
hashCode - the input hashCode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||