Expresso 5-6

com.jcorporate.expresso.kernel
Class DataContext

java.lang.Object
  extended bycom.jcorporate.expresso.kernel.ComponentBase
      extended bycom.jcorporate.expresso.kernel.ContainerComponentBase
          extended bycom.jcorporate.expresso.kernel.DataContext
All Implemented Interfaces:
ComponentLifecycle, Containable, Describable, ExpressoComponent, Serializable

public class DataContext
extends ContainerComponentBase
implements ComponentLifecycle

This class is the code equivilant of the original <context> tag in the older expresso-config files. It is basically a container used to map components to their underlying data sources.

Each data context will have at most one Persistence engine. It could be JDBC, or in the future, EJB, or even CSV files for persistence.

Each data context can use other data contexts for security. This is set via the securityContext property.

Since:
Expresso 5.1
Author:
Michael Rimov
See Also:
Serialized Form

Constructor Summary
DataContext()
          The default constructor.
 
Method Summary
 void configure(Configuration newConfig)
          This is the implementation of the ExpressoComponent configure() component event lifecycle.
 void destroy()
          Destroy event of the ComponentLifecycle interface.
 String getContextDescription()
          Retrieves the context description
 Map getCustomProperties()
          Custom Properties Map that was identical to that of the customProperties in the old Expresso 5 config file.
 String getCustomProperty(String key)
          Retrieves the custom property by key.
 Boolean getHasSetupTables()
          Returns a Boolean object value equivilant to the tranditional javabean naming convention.
 String getSecurityContext()
          Retrieve the name of the security context to use for objects in this data context.
 String getSetupValue(String key)
          Retrieve a 'setup value'.
 Map getSetupValues()
          Retrieves a map of all setup values for this data context.
 void initialize()
          Implementation of the ExpressoComponent initialize() component lifecycle event.
 boolean isMailDebug()
           
 boolean isSetupTables()
          Returns a boolean value equivilant to the tranditional javabean naming convention.
 void reconfigure(Configuration newConfig)
          Reconfiguration implementation of the Expresso event lifecycles.
 void setContextDescription(String contextDescription)
          Sets the context description.
 void setHasSetupTables(Boolean hasSetupTables)
          Sets the 'Has Setup Tables' parameter.
 void setMailDebug(boolean mailDebug)
           
 void setMailDebug(Boolean mailDebug)
          Sets whether emailings performed from the system should be debugged or not.
 void setSecurityContext(String newValue)
          Sets the security context for this data context.
 void setSetupValue(String key, String object)
          Sets the particular setup value to the specified string.
 
Methods inherited from class com.jcorporate.expresso.kernel.ContainerComponentBase
getContainerImplementation, locateComponent, setContainerImplementation
 
Methods inherited from class com.jcorporate.expresso.kernel.ComponentBase
getMetaData, getMetadataLocation, getParent, setMetaData, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jcorporate.expresso.kernel.ExpressoComponent
getMetaData, getParent, setParent
 

Constructor Detail

DataContext

public DataContext()
The default constructor. Should do nothing.

Method Detail

getSetupValue

public String getSetupValue(String key)
Retrieve a 'setup value'. This is a String property identical to the old Setup table, but any setup values here are context-wide... as opposed to Setup values for the root container have runtime scope.

Parameters:
key - the key of the context.
Returns:
java.lang.String, the value of the property

setSetupValue

public void setSetupValue(String key,
                          String object)
Sets the particular setup value to the specified string.

Parameters:
key - the key of the setup value
object - the value of the setup value.

getSetupValues

public Map getSetupValues()
Retrieves a map of all setup values for this data context. The setup values map is read only and will not allow any modifications.

Returns:
java.util.Map that is unmodifiable.

setSecurityContext

public void setSecurityContext(String newValue)
Sets the security context for this data context. The security context is the context used for any of the traditional 'setup tables'

Parameters:
newValue - The name of the Security Context to map to

getSecurityContext

public String getSecurityContext()
Retrieve the name of the security context to use for objects in this data context.

Returns:
java.lang.String

initialize

public void initialize()
Implementation of the ExpressoComponent initialize() component lifecycle event.

Specified by:
initialize in interface ComponentLifecycle

configure

public void configure(Configuration newConfig)
               throws ConfigurationException
This is the implementation of the ExpressoComponent configure() component event lifecycle.

Specified by:
configure in interface ComponentLifecycle
Parameters:
newConfig - The 'read only' configuration bean that provides all the seutp values.
Throws:
ConfigurationException - upon error.

reconfigure

public void reconfigure(Configuration newConfig)
                 throws ConfigurationException
Reconfiguration implementation of the Expresso event lifecycles.

Specified by:
reconfigure in interface ComponentLifecycle
Parameters:
newConfig - The 'read only' configuration bean that provides all the seutp values.
Throws:
ConfigurationException - upon error

destroy

public void destroy()
Destroy event of the ComponentLifecycle interface. The underlying container implementation does the acutal destroying of all subcomponents before this component is itself destroyed.

Specified by:
destroy in interface ComponentLifecycle

setHasSetupTables

public void setHasSetupTables(Boolean hasSetupTables)
Sets the 'Has Setup Tables' parameter. This may disappear in the future since it merely designates that the ExpressoSchema should be included in this particular data context.

Parameters:
hasSetupTables - Boolean value if it does.

isSetupTables

public boolean isSetupTables()
Returns a boolean value equivilant to the tranditional javabean naming convention.

Returns:
boolean true if this context has setup tables in it.

getHasSetupTables

public Boolean getHasSetupTables()
Returns a Boolean object value equivilant to the tranditional javabean naming convention.

Returns:
Boolean.

setContextDescription

public void setContextDescription(String contextDescription)
Sets the context description.

Parameters:
contextDescription - The name of the context

getContextDescription

public String getContextDescription()
Retrieves the context description

Returns:
java.lang.String

getCustomProperties

public Map getCustomProperties()
Custom Properties Map that was identical to that of the customProperties in the old Expresso 5 config file. It is recommended that you no longer use this.

Returns:
java.util.Map

getCustomProperty

public String getCustomProperty(String key)
Retrieves the custom property by key.

Parameters:
key - the key of the property name to look up
Returns:
java.lang.String, the value of the key.

setMailDebug

public void setMailDebug(Boolean mailDebug)
Sets whether emailings performed from the system should be debugged or not.

Parameters:
mailDebug - boolean if mail should be debugged

setMailDebug

public void setMailDebug(boolean mailDebug)

isMailDebug

public boolean isMailDebug()

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.