Coinjema
1.7

org.coinjema.context.source
Class JdbcContextSource

java.lang.Object
  extended by org.coinjema.context.source.JdbcContextSource
All Implemented Interfaces:
ContextSource

public class JdbcContextSource
extends Object
implements ContextSource

Retrieves configuration data from a database, given a DataSource from which to get Connection objects. The name of the table to talk to can be given as well. The Database table's structure needs to be as follows: name (string): the name of the context represented by the row. The first context path name is "root". data (long string): script file that represents the configuration data. resource (String): name of the resource (like filename). resource_type (String): type of resource (like file extension). metatypes (String, comma separated) : list of metatypes to apply to the resource.

Author:
mstover

Constructor Summary
JdbcContextSource(DataSource db)
           
JdbcContextSource(DataSource db, String table)
           
JdbcContextSource(DataSource db, String table, String name)
           
 
Method Summary
 String getName()
          The relative name of this context.
 Resource getResource(String resourceName)
           
 Resource getResource(String resourceName, String extension)
          A more optimized way to find a specific resource if the caller knows the extension (resource type).
 Collection<ContextSource> getSubContexts()
          Retrieve a collection of direct subcontexts of this context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcContextSource

public JdbcContextSource(DataSource db)

JdbcContextSource

public JdbcContextSource(DataSource db,
                         String table)

JdbcContextSource

public JdbcContextSource(DataSource db,
                         String table,
                         String name)
Method Detail

getSubContexts

public Collection<ContextSource> getSubContexts()
Description copied from interface: ContextSource
Retrieve a collection of direct subcontexts of this context.

Specified by:
getSubContexts in interface ContextSource
Returns:

getName

public String getName()
Description copied from interface: ContextSource
The relative name of this context. The name of this context without the parent context names attached. If the context is file based, this would be the name of the last directory in the path.

Specified by:
getName in interface ContextSource
Returns:

getResource

public Resource getResource(String resourceName,
                            String extension)
Description copied from interface: ContextSource
A more optimized way to find a specific resource if the caller knows the extension (resource type).

Specified by:
getResource in interface ContextSource
Returns:

getResource

public Resource getResource(String resourceName)
Specified by:
getResource in interface ContextSource

Coinjema
1.7

Public Domain Software.