SourceForge.net Logo

using XML

This section presents the Tutorial Application's components that differ with storage mechanism choice.

This page is about using XML storage. Tutorial Application's common parts are shown in Tutorial Application page of this site. 

Because of the highly generic BERSERK architecture, the only difference programers feel is the configuration. All the developing is done calling the very same methods of the very same objects. BERSERK itself is responsible to use the appropriate storage object.

For details on BERSERK's configuration, please see the berserk.properties page of User Documentation section.

This page has changed since V1.0 RC2. Now it is not necessary to associate an integer to each entity (chain, filter or service). All the relationships are, from now on, made based on entities' names.

There are migration scripts from V1.0 RC3 release on. So if you are using V1.0 RC2 or earlier and want to migrate your XML configurations to V1.0 RC3 please use the provided XML transformation scripts (runnable via an ANT target). However, if you want to keep using V1.0 RC2 you still can find the previous version of this page with former configuration examples here.

configuration differences

In this application no transaction environment is available, neither to application nor to BERSERK. Thus, both brokers are TransactionBrokerEmpty. Below is the complete configuration file:

#storageBroker=pt.utl.ist.berserk.storage.ojb.StorageBrokerOJB
storageBroker=pt.utl.ist.berserk.storage.digester.StorageBrokerDigester
#berserk.databaseName=BERSERK_OJB
berserk.filterDefinitions=conf/fd.xml
berserk.serviceDefinitions=conf/sd.xml
berserk.filterChainsDefinitions=conf/fcd.xml
#berserk.transactionManager = pt.utl.ist.berserk.storage.ojb.TransactionBrokerOJB
berserk.transactionManager = pt.utl.ist.berserk.storage.empty.TransactionBrokerEmpty
application.transactionManager=pt.utl.ist.berserk.storage.empty.TransactionBrokerEmpty

In this case filter, services and filter chains definitions are configured as it is shown below. Filter Definitions:

	<filterDefinitions>
		<filter>
		<name>OnlyIntegers</name>
		<implementationClass>filters.RequesterIsIntegerFilter</implementationClass>
		<description>Checks if the requester can be converted to a java.lang.Integer</description>
		<isTransactional>false</isTransactional>
	</filter>
	<filter>
		<idInternal>2</idInternal>
		<name>LogAccess</name>
		<implementationClass>filters.AccessLogger</implementationClass>
		<description>Writes accesses to a file</description>
		<isTransactional>false</isTransactional>
	</filter>
</filterDefinitions>
 

Please remember, when you are building filter chain expressions, that XML parsers interpret & as a special character and, thus, & special sequence must be used. Below is the filter chain configuration file:

<filterChainsDefinitions>
		<filterChain>
		<name>AccessControl</name>
		<expression>OnlyIntegers</expression> <description>Access Control
		Chain</description>
		<invocationTiming>1</invocationTiming>
		<filterClass>filters.AccessControlFilter</filterClass>
	</filterChain>
		<filterChain>
		<name>Logger</name>
		<expression>LogAccess</expression>
		<description>Access Control Chain</description>
		<invocationTiming>2</invocationTiming>
		<filterClass>filters.LoggingFilter</filterClass>
	</filterChain>
</filterChainsDefinitions>
													
Finally the services configuration file:
<serviceDefinitions>
	<service>
		<name>StdoutWriter</name>
		<implementationClass>services.StdoutWriter</implementationClass>
		<description>Prints
		a
		string to the standard output</description> <isTransactional>false</isTransactional> <filterChains>
			<chain
		name=
			"AccessControl"/> <chain
			name= "Logger"/>
		</filterChains>
	</service>
</serviceDefinitions>