|
using XML (for BERSERK V1.0 RC2 and earlier)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. configuration differencesIn 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> <idInternal>1</idInternal> <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> <idInternal>1</idInternal> <name>AccessControl</name> <expression>OnlyIntegers</expression> <description>Access Control Chain</description> <invocationTiming>1</invocationTiming> <filterClass>filters.AccessControlFilter</filterClass> </filterChain> <filterChain> <idInternal>2</idInternal> <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> <idInternal>1</idInternal> <name>StdoutWriter</name> <implementationClass>services.StdoutWriter</implementationClass> <description>Prints a string to the standard output</description> <isTransactional>false</isTransactional> <filterChains> <chain id="1"/> <chain id="2"/> </filterChains> </service> </serviceDefinitions> |