|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jlf.dataMap.DataLocation
This class is used as the base of all data locations in the data
mapping framework. A data location could be a JDBC data source,
an XML file, a properties file, or any other source/sink of data.
Data Locations are configured in a separate property file with the
same name as the data location alias. You can override the
name of the property file in the main application property file with
a key of org.jlf.dataMap.DataLocation.
org.jlf.dataMap.DataLocation.DefaultDataLocation.DataMapPropertyFile=c:\properties\DefaultDataLocation.propertiesAn example data map property file for a JDBC data mapper to an Oracle database follows:
########################################################## # Properties to connect to a default data location # using a JDBC Data Source/Sink. # Using an Oracle database, the thin type 4 driver, on # machine testHost, database SID testdb # user scott, password tiger # Identify which framework class will create this type of mapper DataMapperClass=org.jlf.dataMap.JDBCDataMapper # Identify properties to connect to that location ConnectionProperties.DriverClass=oracle.jdbc.driver.OracleDriver ConnectionProperties.DatabaseURL=jdbc:oracle:thin:@testhost:1521:testdb ConnectionProperties.user=scott ConnectionProperties.password=tiger # Add properties here to map attributes and relationships to the data location
DataMapper
,
DataMappedObject
Field Summary | |
protected static java.lang.String |
ATTRIBUTE_ALIAS_PROPERTY_QUALIFIER
Property qualifier to find an attribute alias if one is defined for a specific DataMappedObject
class. |
protected static boolean |
CASCADE_WRITE_RELATIONSHIP_PROPERTY_DEFAULT
|
protected static java.lang.String |
CASCADE_WRITE_RELATIONSHIP_PROPERTY_QUALIFIER
Property qualifier to see if, when writing a data mapped object, that a particular relationship of that data mapped object should be written in the same unit of work. |
protected java.util.Properties |
connectionProperties
Holds properties used to configure a connection to the data location. |
static java.lang.String |
DATA_LOCATION_PROPERTY_FILE_PREFIX_PROPERTY
All properties in the main property file must have this property file prefix in order to get connection information to the data location. |
protected static java.lang.String |
DATA_MAP_CONNECTION_PROPERTY_PREFIX
Property qualifier to find all of the connection properties in the data map property file. |
static java.lang.String |
DATA_MAP_PROPERTY_FILE_SUFFIX_PROPERTY
Property suffix for retrieving the DataLocation
subclass of the requested data location. |
protected static java.lang.String |
DATA_MAPPER_CLASS_PROPERTY
Property key for the subclass of DataMapper which implements the data mapping capabilities for this data location. |
protected static boolean |
INLINE_RELATIONSHIP_PROPERTY_DEFAULT
|
protected static java.lang.String |
INLINE_RELATIONSHIP_PROPERTY_QUALIFIER
Property qualifier to find relationship inline read mapping information for a specific DataMappedObject
class/relationship. |
protected static boolean |
LAZY_READ_RELATIONSHIP_PROPERTY_DEFAULT
|
protected static java.lang.String |
LAZY_READ_RELATIONSHIP_PROPERTY_QUALIFIER
Property qualifier to find relationship lazy read information for a specific DataMappedObject
class/relationship. |
protected DataLocationProperties |
mappingProperties
Holds properties used to map objects to/from the data location. |
protected java.lang.String |
name
Name of the data location, used as the key into the main properties file to find the location's set of properties. |
static java.lang.String |
RELATIONSHIP_PROPERTY_QUALIFIER
Property qualifier to find relationship mapping information for a specific DataMappedObject
class. |
Constructor Summary | |
protected |
DataLocation()
Please use the parameterized constructor! |
|
DataLocation(java.lang.String name,
DataLocationProperties mappingProperties)
Typical constructor for a new DataLocation, taking the name of the DataLocation and a property file containing all of its properties. |
Method Summary | |
java.lang.String |
getAttributeAlias(DataMappedObject dmo,
java.lang.String attributeName,
Relationship relationship)
Retrieves an attribute alias if one is defined in the data location mapping properties under the context of a particular relationship if available. |
java.util.Properties |
getConnectionProperties()
Retrieves properties used to configure a connection to the data location. |
DataMapper |
getDataMapper()
Obtains a DataMapper so data can be mapped
back and forth to DataMappedObject s. |
DataLocationProperties |
getMappingProperties()
Retrieves properties used to configure a connection to the data location. |
java.lang.String |
getName()
Retrieves the key name of the data location. |
boolean |
isInlineReadRelationship(DataMappedObject dmo,
Relationship relationship)
Retrieves boolean flag telling whether the relationship is to be read inline (that is, in the same query) as the parent object governing the relationship. |
boolean |
isRelationshipLazyRead(DataMappedObject dmo,
Relationship relationship)
Retrieves a boolean flag as to whether the data mapped object relationship is to be lazy read or not. |
static DataLocation |
retrieveLocationForKey(java.lang.String locationKey)
Retrieves a DataLocation for a key, looking at the main properties file to see what type it is, then instantiating based on that type. |
protected void |
setConnectionProperties(java.util.Properties connectionProperties)
Sets the key name of the data location. |
protected void |
setMappingProperties(DataLocationProperties mappingProperties)
Sets the key name of the data location. |
protected void |
setName(java.lang.String name)
Sets the key name of the data location. |
boolean |
shouldCascadeWriteRelationship(DataMappedObject dmo,
Relationship relationship)
Retrieves boolean flag telling whether the relationship should do an automatic cascade write. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DATA_LOCATION_PROPERTY_FILE_PREFIX_PROPERTY
public static final java.lang.String DATA_MAP_PROPERTY_FILE_SUFFIX_PROPERTY
DataLocation
subclass of the requested data location.
protected static final java.lang.String DATA_MAPPER_CLASS_PROPERTY
protected static final java.lang.String DATA_MAP_CONNECTION_PROPERTY_PREFIX
protected static final java.lang.String ATTRIBUTE_ALIAS_PROPERTY_QUALIFIER
DataMappedObject
class.
public static final java.lang.String RELATIONSHIP_PROPERTY_QUALIFIER
DataMappedObject
class.
protected java.lang.String name
protected java.util.Properties connectionProperties
protected DataLocationProperties mappingProperties
protected static final java.lang.String INLINE_RELATIONSHIP_PROPERTY_QUALIFIER
DataMappedObject
class/relationship. If this property is set to false (the default), this
relationship will be read as a separate query. If true, the
relationship will be populated from information in the same
query as the primary object.
protected static final boolean INLINE_RELATIONSHIP_PROPERTY_DEFAULT
protected static final java.lang.String LAZY_READ_RELATIONSHIP_PROPERTY_QUALIFIER
DataMappedObject
class/relationship. This property only takes effect if the above
property, inline reads, is set to false. If the relationship
requires a new read from the data location, for performance
you may wish to do this read lazy (unless the object is cached).
If this property is set to true (the default), this
relationship will be read in the first time it is accessed. If false, the
relationship will be populated before the object holding the
relationship is returned as being read.
protected static final boolean LAZY_READ_RELATIONSHIP_PROPERTY_DEFAULT
protected static final java.lang.String CASCADE_WRITE_RELATIONSHIP_PROPERTY_QUALIFIER
protected static final boolean CASCADE_WRITE_RELATIONSHIP_PROPERTY_DEFAULT
Constructor Detail |
protected DataLocation()
public DataLocation(java.lang.String name, DataLocationProperties mappingProperties)
Method Detail |
public static DataLocation retrieveLocationForKey(java.lang.String locationKey)
public java.lang.String getName()
protected void setName(java.lang.String name)
public java.util.Properties getConnectionProperties()
protected void setConnectionProperties(java.util.Properties connectionProperties)
public DataLocationProperties getMappingProperties()
protected void setMappingProperties(DataLocationProperties mappingProperties)
public DataMapper getDataMapper()
DataMapper
so data can be mapped
back and forth to DataMappedObject
s. Uses a
data mapped location property file setting to determine which
subclass of DataMapper is the correct class to retrieve
a mapper to the data location.
public java.lang.String getAttributeAlias(DataMappedObject dmo, java.lang.String attributeName, Relationship relationship)
public boolean isInlineReadRelationship(DataMappedObject dmo, Relationship relationship)
public boolean isRelationshipLazyRead(DataMappedObject dmo, Relationship relationship)
public boolean shouldCascadeWriteRelationship(DataMappedObject dmo, Relationship relationship)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |