...
Table of Contents |
---|
Related Documents
Service Engine Configuration Guide
Introduction
This document describes the configuration of the Entity Engine. It starts with an introduction of general ideas and then goes through each part of the entityengine.xml file and explains the available elements and their usage. The entityengine.xml file used for OFBiz applications has examples of a number of different options and is located in
ofbizframework/commonappentity/etcconfig/entityengine.xml.
The configuration of the Entity Engine is done through a simple XML file called entityengine.xml
that must exist somewhere on the classpath. This file is used to define parameters for persistence servers such as EJB server parameters or JDBC server parameters. It is also used to specify which XML entity model, entity group, and field type model files will be used for that server. The default file for the OFBiz distribution can be found in
ofbizframework/commonappentity/etcconfig/entityengine.xml.
Each application that uses the Entity Engine does so through a Delegator
instance. The delegator name must be passed to the static factory method that is then passed to the constructor if a new instance is needed. This delegator name is used to look up settings for that delegator in the entityengine.xml
file. Each delegator uses an entity model reader and an entity group reader that specifies a group name for each named entity in the entity model file. The entityengine.xml
file contains the settings that map each group name to a GenericHelper
for that group. GenericHelper
is an interface that must be implemented for each type of data source (i.e.: JDBC, EJB, SOAP, HTTP, et cetera).
...
The resource-loader
tag is used to configure a named resource loader that can be used elsewhere to load XML and other resources. It has the following attributes.
Attribute Name | Required? | Description |
---|---|---|
name | Y | The name of the resource loader. Used in other tags in the "loader" attribute. |
class | Y | The class to use that extends the abstract class org.ofbiz.entity.config.ResourceLoader. Available classes include FileLoader, UrlLoader, and ClasspathLoader, all in the same package as the ResourceLoader class. |
prepend-env | N | The name of a Java environment property to put at the very beginning of the full location, before the prefix. This is optional. |
prefix | N | A string to put before the location when making the full location. This is optional. If used will go after the prepended environment property and before the location specified for each resource. |
...
The GenericDelagator is created through a factory method that takes a String argument containing the delegator name. This delegator name is used to look up a delegator
tag in the entityengine.xml file.
Attribute Name | Required? | Description |
---|---|---|
name | Y | The name of the Delegator. Used to look up this tag by delegator name. |
entity-model-reader | Y | The name of the entity-model-reader to use for this delegator. |
entity-group-reader | Y | The name of the entity-group-reader to use for this delegator. |
entity-eca-reader | N | The name of the entity-eca-reader to use for this delegator. If not specified no Entity ECAs will be used. |
distributed-cache-clear-enabled | N | Used to specify if the distributed cache clear should be enabled. If not specified defaults to "false". If set to true the other DCC attributes will be used. |
distributed-cache-clear-class-name | N | Used to specify if the name of the class to use for DCC and that implements the distributed cache clear interface. If not specified defaults to "org.ofbiz.entityext.cache.EntityCacheServices", which is a good default for most cases that uses the Service Engine for configuration and remote calls. |
distributed-cache-clear-user-login-id | N | Used to specify if the userLoginId (to use for any security checks) is needed related to distributed cache clear operation. If not specified defaults to "admin". |
...
Each resource
tag has two required attributes: loader
which specifies which resource-loader to use and location
which specifies the location that the resource-loader will use inside itself to load the resource.
...
Entify Group XML Files
...
The entity-group-reader
tag is used to configure each named entity group reader. The tag has a name
attribute used to specify the entity group reader's name. The group reader uses XML files to get the entity-group mappings.
The tag has two optional attributes: loader
which specifies which resource-loader to use and location
which specifies the location that the resource-loader will use inside itself to load the resource. There is also a sub-element named "resource" that has these same attributes and can be used to specify addition resources for addition files.
Entity ECA XML Files
...
The entity-eca-reader
tag is used to configure each named entity ECA reader. The tag has a name
attribute used to specify the entity ECA reader's name. The ECA reader uses XML files to get the entity ECA rule definitions. Each reader may load from multiple resources that are each specified with a resource
tag inside the main tag.
Each resource
tag has two required attributes: loader
which specifies which resource-loader to use and location
which specifies the location that the resource-loader will use inside itself to load the resource.
Field Type XML Files
...
The field-type
tag is used to configure each named field type. The tag has a name
attribute used to specify the field type's name. The group reader uses a single XML file to get the field type information.
The tag has two required attributes: loader
which specifies which resource-loader to use and location
which specifies the location that the resource-loader will use inside itself to load the resource.
Data Source Elements
...
Many datasources can be configured using one datasource
tag for each datasource. This tag has the following attributes, and may contain the following sub-elements:
...
Sub-Element Name | How Many | Description |
---|---|---|
sql-load-path | 0 to many | Used to specify a list of full paths to directories that will be searched for XML and SQL files to import into the data source by the install page in the WebTools webapp. Each tag has two attributes: path for the path location, and prepend-env to optionally specify a Java environment property to prepend to the specified path. |
inline-jdbc | 0 or 1 | Used to specify the JDBC parameters to be used either by the connection pool or if no connection pool is available then by directly loading the driver (very slow). You must specify either inline-jdbc or jndi-jdbc, but not both, for the datasource. |
jndi-jdbc | 0 or 1 | Used to specify the jndi-server and jndi-name to get a Connection or XAConnection from JNDI. You must specify either inline-jdbc or jndi-jdbc, but not both, for the datasource. |
ANY | 0 or 1 | Any tag may go inside the datasource tag to specify parameters for other GenericHelper implementations. These will not be checked at load time unless the DTD is modified to describe them. |
The inline-jdbc
tag has the following attributes:
Attribute Name | Required? | Description |
---|---|---|
jdbc-driver | Y | The JDBC driver class for the database. |
jdbc-uri | Y | The URI used to specify the type and location of the database. |
jdbc-username | Y | The username to connect to the database as. |
jdbc-password | Y | The username's password. |
isolation-level | N | This is used by Tyrex to specify the transaction isolation level. The standard JDBC transaction isolation levels are available:
|
The jndi-jdbc
tag has the following attributes:
Attribute Name | Required? | Description |
---|---|---|
jndi-server-name | Y | The name of the JNDI Server to use as configured in this file with the jndi-server tag, described above. |
jndi-name | Y | The name of the Connection or XAConnection object in JNDI. |
The data source retrieved from JNDI should be pooled and transactional, with connections already enlisted if a JTA transaction has been started. It can be either a DataSource or an XADataSource object.
...