org.drupal.project.computing
Class DConfig

java.lang.Object
  extended by org.drupal.project.computing.DConfig

public class DConfig
extends java.lang.Object

This is the config class to help initialize DSite and DApplication. Note that there's no file that maps to it. This is purely internal.


Nested Class Summary
static class DConfig.UnitTest
           
 
Field Summary
protected  java.util.logging.Logger logger
           
protected  java.util.Properties properties
          This is the main place we save configurations.
 
Constructor Summary
DConfig()
           
DConfig(java.util.Properties properties)
          Default constructor that construct the config object.
 
Method Summary
 java.lang.String getDbPrefix()
          Deprecated. 
 java.util.Properties getDbProperties()
          Returns the database configuration to initialize Drupal database configuration.
 java.io.File getDrupalRoot()
          Find the Drupal root.
 java.lang.String getDrushExec()
          Get the "drush" executable from either -Ddrupal.drush, or DRUSH_EXEC string.
 int getMaxBatchSize()
          Deprecated. 
 java.lang.String getPhpExec()
          Get the PHP executable from either -Ddrupal.php, or PHP_EXEC system variable.
 java.lang.String getProperty(java.lang.String propertyName, java.lang.String defaultValue)
           
 java.io.File locateFile(java.lang.String fileName)
          Try to find a file in this order: 1.
 void setProperty(java.lang.String propertyName, java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected java.util.logging.Logger logger

properties

protected java.util.Properties properties
This is the main place we save configurations. We don't use hard coded fields because we don't know which are needed.

Constructor Detail

DConfig

public DConfig()

DConfig

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

Parameters:
properties -
Method Detail

getProperty

public java.lang.String getProperty(java.lang.String propertyName,
                                    java.lang.String defaultValue)

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.String value)

getDbProperties

public java.util.Properties getDbProperties()
                                     throws DConfigException
Returns the database configuration to initialize Drupal database configuration.

Returns:
Properties for DBCP BasicDataSourceFactory.createDataSource()
Throws:
DConfigException
See Also:
DBCP configurations, MySQL configurations

locateFile

public java.io.File locateFile(java.lang.String fileName)
                        throws java.io.FileNotFoundException
Try to find a file in this order: 1. the working directory, 2. the same directory as the jar file located. 3. drush "drupal_root"/"site_path" 4. DRUPAL_ROOT/sites/default 5. user home directory

Parameters:
fileName - File name to look for.
Returns:
Throws:
java.io.FileNotFoundException

getDbPrefix

@Deprecated
public java.lang.String getDbPrefix()
Deprecated. 

Return the Drupal database prefix string, or null if not valid.

Returns:
Drupal database prefix string, or null if not valid.

getMaxBatchSize

@Deprecated
public int getMaxBatchSize()
Deprecated. 

Get the max_batch_size from db configuration.

Returns:

getDrushExec

public java.lang.String getDrushExec()
Get the "drush" executable from either -Ddrupal.drush, or DRUSH_EXEC string.

Returns:
The drush executable if set, or "drush".

getPhpExec

public java.lang.String getPhpExec()
Get the PHP executable from either -Ddrupal.php, or PHP_EXEC system variable.

Returns:
PHP executable if set, or "php".

getDrupalRoot

public java.io.File getDrupalRoot()
                           throws DConfigException
Find the Drupal root. Or throws exception if can't find it.

Returns:
The location of Drupal root. Only local Drupal root is permitted. Remote drupal site will throw exception.
Throws:
DConfigException