org.drupal.project.async_command
Class DrupletConfig

java.lang.Object
  extended by org.drupal.project.async_command.DrupletConfig

public class DrupletConfig
extends java.lang.Object

This class encapsulate the config.properties file. It is intended to work with only one Drupal instance and one Drupal database (DrupalConnection). If multiple Drupal instance/database is needed, use a separate DrupletConfig object. It also maps to only one type of Druplet. You can extends this class to map to different types of Druplet.


Field Summary
protected  java.util.Properties config
           
protected static java.util.logging.Logger logger
           
 
Constructor Summary
DrupletConfig(java.io.File configFile)
           
DrupletConfig(java.util.Properties config)
          Default constructor that construct the config object.
DrupletConfig(java.lang.String configString)
           
 
Method Summary
protected  java.util.Properties generateDefault()
           
 Druplet.AccessMode getAccessMode()
           
 DrupalConnection.DatabaseType getDatabaseType()
           
 java.lang.String getDrupalDbPrefix()
           
 java.io.File getDrupalHome()
          DRUPAL_HOME is valid only when access_mode is local.
 java.net.URL getDrupalSiteUrl()
          drupal_site_url should be valid when drupal_access_mode is 'remote' so that Druplet can access drupal instance.
 int getDrupalVersion()
           
 int getIntProperty(java.lang.String name, int defaultValue)
           
 int getMaxBatchSize()
           
 java.util.Properties getProperties()
           
static DrupletConfig load()
          No configuration file.
protected  void prepare()
          Prepare config properties, e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

protected java.util.Properties config

logger

protected static java.util.logging.Logger logger
Constructor Detail

DrupletConfig

public DrupletConfig(java.util.Properties config)
Default constructor that construct the config object.

Parameters:
config -
See Also:
DBCP configurations, MySQL configurations

DrupletConfig

public DrupletConfig(java.lang.String configString)

DrupletConfig

public DrupletConfig(java.io.File configFile)
Method Detail

load

public static DrupletConfig load()
No configuration file. Needs to locate and find it.


generateDefault

protected java.util.Properties generateDefault()

prepare

protected void prepare()
Prepare config properties, e.g. make driverClassName based on database_type. This is the central piece of code to process config properties and make necessary changes.


getDrupalVersion

public int getDrupalVersion()

getDatabaseType

public DrupalConnection.DatabaseType getDatabaseType()

getDrupalDbPrefix

public java.lang.String getDrupalDbPrefix()

getMaxBatchSize

public int getMaxBatchSize()

getProperties

public java.util.Properties getProperties()

getAccessMode

public Druplet.AccessMode getAccessMode()

getDrupalHome

public java.io.File getDrupalHome()
DRUPAL_HOME is valid only when access_mode is local. Caller is responsible to check whether drupal_access_mode == local.

Returns:
Drupal_home as a File or null if not set correctly.

getDrupalSiteUrl

public java.net.URL getDrupalSiteUrl()
drupal_site_url should be valid when drupal_access_mode is 'remote' so that Druplet can access drupal instance.

Returns:

getIntProperty

public int getIntProperty(java.lang.String name,
                          int defaultValue)