com.flexive.shared.configuration
Class DivisionData

java.lang.Object
  extended by com.flexive.shared.configuration.DivisionData
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DivisionDataEdit

public class DivisionData
extends java.lang.Object
implements java.io.Serializable

Container for division data read from the global configuration.

Author:
Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Field Summary
protected  boolean available
           
protected  java.lang.String dataSource
           
protected  java.lang.String dbDriverVersion
           
protected  java.lang.String dbVendor
           
protected  java.lang.String dbVersion
           
static int DIVISION_GLOBAL
          Global configuration division
static int DIVISION_TEST
          Division to be used for automated tests
protected  java.util.regex.Pattern domainPattern
           
protected  java.lang.String domainRegEx
           
protected  int id
           
 
Constructor Summary
DivisionData(int id, boolean available, java.lang.String dataSource, java.lang.String domainRegEx, java.lang.String dbVendor, java.lang.String dbVersion, java.lang.String dbDriverVersion)
          Constructor.
 
Method Summary
 DivisionDataEdit asEditable()
          Returns an editable division data object initialized with this instance.
 boolean equals(java.lang.Object o)
           
 java.lang.String getDataSource()
          Returns the JNDI path to this division's datasource.
 java.lang.String getDbDriverVersion()
          Get the database jdbc driver version
 java.lang.String getDbVendor()
          Get the DB Vendor
 java.lang.String getDbVersion()
          Get the DB Version
 java.lang.String getDomainRegEx()
          The regular expression describing matching domains for this division.
 int getId()
          Return the unique ID of this division.
 int hashCode()
           
 boolean isAvailable()
          Is this division available (ie can a connection be retrieved)
 boolean isMatchingDomain(java.lang.String domain)
          Returns true when the given domain matches, false otherwise.
static boolean isValidDivisionId(int divisionId)
          Checks if the given division ID is valid (i.e.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIVISION_TEST

public static final int DIVISION_TEST
Division to be used for automated tests

See Also:
Constant Field Values

DIVISION_GLOBAL

public static final int DIVISION_GLOBAL
Global configuration division

See Also:
Constant Field Values

id

protected int id

available

protected boolean available

dataSource

protected java.lang.String dataSource

domainRegEx

protected java.lang.String domainRegEx

domainPattern

protected java.util.regex.Pattern domainPattern

dbVendor

protected java.lang.String dbVendor

dbVersion

protected java.lang.String dbVersion

dbDriverVersion

protected java.lang.String dbDriverVersion
Constructor Detail

DivisionData

public DivisionData(int id,
                    boolean available,
                    java.lang.String dataSource,
                    java.lang.String domainRegEx,
                    java.lang.String dbVendor,
                    java.lang.String dbVersion,
                    java.lang.String dbDriverVersion)
Constructor.

Parameters:
id - the division ID
available - if division is available
dataSource - datasource JNDI path
domainRegEx - domain name matcher
dbVendor - database vendor
dbVersion - database version
dbDriverVersion - database jdbc driver version
Method Detail

asEditable

public DivisionDataEdit asEditable()
Returns an editable division data object initialized with this instance. Note that the edit object does not influence the original division data object, so it is safe to create edit objects from system division data entries without cloning them first.

Returns:
an editable division data object initialized with this instance

getDataSource

public java.lang.String getDataSource()
Returns the JNDI path to this division's datasource.

Returns:
the JNDI path to this division's datasource.

getDomainRegEx

public java.lang.String getDomainRegEx()
The regular expression describing matching domains for this division.

Returns:
the regular expression describing matching domains for this division.

isMatchingDomain

public boolean isMatchingDomain(java.lang.String domain)
Returns true when the given domain matches, false otherwise.

Parameters:
domain - the domain to be checked
Returns:
true when the given domain matches, false otherwise.

getDbVendor

public java.lang.String getDbVendor()
Get the DB Vendor

Returns:
DB Vendor

getDbVersion

public java.lang.String getDbVersion()
Get the DB Version

Returns:
DB Version

getDbDriverVersion

public java.lang.String getDbDriverVersion()
Get the database jdbc driver version

Returns:
database jdbc driver version

isAvailable

public boolean isAvailable()
Is this division available (ie can a connection be retrieved)

Returns:
available

getId

public int getId()
Return the unique ID of this division.

Returns:
the unique ID of this division.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isValidDivisionId

public static boolean isValidDivisionId(int divisionId)
Checks if the given division ID is valid (i.e. if the division parameter has been set). This method does not check if the given division is available, i.e. if corresponding entries exist in the global configuration.

Parameters:
divisionId - the division ID to be checked
Returns:
true for valid division IDs