Hitachi

uCosminexus Application Server XML Processor User Guide


3.3.3 Setting up the schema cache

To use the schema cache functionality, you must decide a schema document for cache in advance and set up a schema cache. Therefore, set up the following property file appropriately:

The above mentioned file corresponds to the Java property file. Therefore, for basic syntax rules, follow the rules used in the Java property file. Note that for details about the syntax rules of the property files, see Javadoc of the java.util.Properties class.

This subsection described the property files.

Organization of this subsection

(1) Schema definition file

You can define the following items in a schema definition file:

You can specify any file name and save location for the schema definition file.

The following schema documents will be cached:

The following table lists the properties that you can code in a schema definition file. If you specify any other property, that property will be ignored.

Table 3‒2: Properties that can be coded in a schema definition file

No.

Property name

Specified value

1

schema_path

Specifies an absolute path that indicates a directory where the schema document exists.

2

diskcache_path

Specifies an absolute path that indicates a directory where the disk cache is saved.

3

schema_xxx

(xxx is any character string that has more than one character)

Specifies a relative path that indicates a file of the schema document to be cached and the disk cache specifier. You can omit the disk cache specifier.

For the disk cache specifier, code D at the end of the relative path of the schema document. The schema document cache specified by the disk cache specifier is created on the disk.

If there is no coding of the disk cache specifier, a cache is created in the memory.

A space or a tab that is connected to the file name and the disk cache will be ignored.

Use a forward slash (/) as a delimiter in a path specified for each property, in Windows and UNIX. Using a forward slash (/) at the end of an absolute path for the directory name is optional.

If the same property name is specified more than once, the last specified value of the property will be valid.

The following are the examples of schema definition files:

In Windows
shema_path=C:/usr/app/xmlparser/schemafiles
diskcache_path=C:/usr/app/xmlparser
schema_01=schema/type1.xsd
schema_02=schema/type2.xsd,D
In UNIX
shema_path=/usr/app/xmlparser/schemafiles
diskcache_path=/usr/app/xmlparser
schema_01=schema/type1.xsd
schema_02=schema/type2.xsd,D

When schema_01=schema/type1.xsd is specified, the disk cache specifier has not been coded, so cache of the schema document will be performed in the memory.

When schema_02=schema/type2.xsd,D is specified, the disk cache specifier has been coded, and therefore, the schema document is cached on the disk.

The following are the operations for specifying the schema definition files:

For details about the precautions related to the schema definition files, see the subsection 6.18.3 Precautions related to schema definition files.

(2) J2EE server user-defined file

The user-defined file (usrconf.properties) of the J2EE server defines a class, to be initialized when the J2EE server starts, and a system property to be set up.

For details about the user-defined files of J2EE servers, see 2. Files Used in J2EE Servers in the uCosminexus Application Server Definition Reference Guide.

The following table lists the properties coded in the user-defined file of the J2EE server, when the schema cache functionality is used.

Table 3‒3: Properties coded in the user-defined file of the J2EE server

No.

Property name

Specified value

1

ejbserver.application.InitTermProcessClasses

Specifies the initialization and termination class of the J2EE extended container.

Specify com.cosminexus.jaxp.impl.parsers.util.XMLGrammarCaching that is required to set up a schema cache, using the schema cache functionality.

2

com.cosminexus.jaxp.grammar_caching.preload

Specifies whether to use the schema cache functionality or not. You can specify either ON or OFF. The default value is OFF.

If you specify ON, the schema cache functionality can be used. The XML parser executes the schema validation using the schema cache.

If you specify OFF, the schema cache functionality cannot be used. The XML parser executes the schema validation without using the schema cache.

Note that this property controls all the schema cache functionality. You must specify ON to use the schema cache functionality for J2EE server. If you specify OFF, the schema cache functionality will not be enabled after the J2EE server starts.

3

com.cosminexus.jaxp.grammar_caching.config

Specifies an absolute path of the schema definition file.

You can use the schema cache functionality only when corresponding to all the following conditions:

The following is an example of the user-defined files for J2EE servers:

# Specifies the class to be initialized when Cosminexus starts
ejbserver.application.InitTermProcessClasses=com.cosminexus.jaxp.impl.parsers.util.XMLGrammarCaching
# Enables the cache functionality
com.cosminexus.jaxp.grammar_caching.preload=ON
# Absolute path of schema definition file defined in the schema document to be maintained in the cache
com.cosminexus.jaxp.grammar_caching.config=C:/usr/app/xmlparser/config.properties

The following are the operations for specifying the user-defined files for J2EE servers: