org.inria.ns.reflex.modules.io.xmldb
Class ActiveTagsAdapter

java.lang.Object
  extended by org.inria.ns.reflex.modules.io.xmldb.ActiveTagsAdapter

public abstract class ActiveTagsAdapter
extends Object

An ActiveTagsAdapter allows XML:DB providers to set additional dynamic attributes to XFiles (see XMLDBFileObject).

This is a convenient way to retrieve "attributes" which values have to be computed dynamically or which values are other than Strings. Actually, XML:DB can only supply String values.

The attributes returned by this adapter will be set automatically to the relevant XFile, making it accessible with XPath, as shown in this example :

<io:file name="file" uri="xmldb:provider://host:port/path/to/resource"/>
<xcl:transform output="{ $sys:out }" source="{ $file/@schema }"/>
 

...might return the XML schema of the resource if the adapter of the relevant provider had been designed to do so. For this purpose, the @schema attribute could return an InputStream.

This feature has not been implemented as an XML:DB service to keep as-is current XML:DB implementations. As it is a very lightweight class, implementors don't have great efforts to do. The only 2 things to write are :

Once done, RefleX must be invoked with the -driver option from the command line interface, or with the driver-class context parameter (<context-param>) of the servlet, or simply by invoking Class.forName( "org.acme.MyAdapter" ); when starting a RefleX application.

Author:
Philippe Poulard
See Also:
XMLDBFileObject

Constructor Summary
ActiveTagsAdapter()
           
 
Method Summary
static ActiveTagsAdapter getAdapter(String provider)
          Get the Active Tags adapter for the given provider.
abstract  Map getAttributes(XMLDBFileObject file)
          Get the set of dynamic attributes for a file.
static void register(String provider, ActiveTagsAdapter adapter)
          Register an XML:DB provider to the list of known adapters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveTagsAdapter

public ActiveTagsAdapter()
Method Detail

getAttributes

public abstract Map getAttributes(XMLDBFileObject file)
Get the set of dynamic attributes for a file.

Parameters:
file - The XML:DB file.
Returns:
The map of dynamic attributes, or null.

register

public static void register(String provider,
                            ActiveTagsAdapter adapter)
Register an XML:DB provider to the list of known adapters.

Parameters:
provider - The name of the provider.
adapter - The adapter bound to the given provider.

getAdapter

public static ActiveTagsAdapter getAdapter(String provider)
Get the Active Tags adapter for the given provider.

Parameters:
provider - The name of the provider.
Returns:
The adapter for the provider, or null.