blob: c281eb2a80619794adf1afed24d4e9ed31faf762 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Copyright 2005 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<module id="tapestry.state" version="4.0.0" package="org.apache.tapestry.engine.state">
Management of application state objects.
<schema id="StateObjectContribution">
Schema used with the ApplicationObjects (and FactoryObjects)
configuration points, used to declare
application-wide state objects.
<element name="state-object" key-attribute="name">
An object that stores application wide state, referenced
by a unique name.
<attribute name="name">
The unique name by which the state object is accessed.
</attribute>
<attribute name="scope" required="true">
The scope of the attribute, which controls its lifecycle
and how it is persisted between requests. Matches
a contribution to the
StateObjectPersistenceManagers configuration point.
</attribute>
<rules>
<create-object class="StateObjectContribution"/>
<read-attribute attribute="name" property="name"/>
<read-attribute attribute="scope" property="scope"/>
<invoke-parent method="addElement"/>
</rules>
<element name="create-instance">
Defines a simple factory for the state object, by instantiating
an instance of a class.
<attribute name="class" translator="class" required="true">
The fully qualified name of the class to instantiate.
</attribute>
<conversion class="InstantiateClassStateObjectFactory"
parent-method="setFactory">
<map attribute="class" property="objectClass"/>
</conversion>
</element>
<element name="invoke-factory">
Defines a reference to a state object factory
(an object implementing StateObjectFactory).
<attribute name="object" translator="object" required="true">
The factory object that will create the state object as needed.
</attribute>
<rules>
<push-attribute attribute="object"/>
<invoke-parent method="setFactory"/>
</rules>
</element>
</element>
</schema>
<configuration-point id="FactoryObjects" schema-id="StateObjectContribution">
Contains factory default definitions of application state objects.
These definitions can be overriden by
contributing to the ApplicationObjects configuration point.
</configuration-point>
<contribution configuration-id="FactoryObjects">
<state-object name="global" scope="application">
<invoke-factory object="service:DefaultGlobalFactory"/>
</state-object>
<state-object name="visit" scope="session">
<invoke-factory object="service:DefaultVisitFactory"/>
</state-object>
</contribution>
<service-point id="DefaultGlobalFactory" interface="StateObjectFactory">
<invoke-factory>
<construct class="DefaultGlobalStateObjectFactory">
<set-object property="className" value="app-property:org.apache.tapestry.global-class"/>
</construct>
</invoke-factory>
Constructs the global state object, based on the org.apache.tapestry.global-class
configuration property, or a synchronized HashMap if not specified.
</service-point>
<service-point id="DefaultVisitFactory" interface="StateObjectFactory">
Constructs the visit state object, based on the org.apache.tapestry.visit-class
configuration property.
<invoke-factory>
<construct class="NamedClassStateObjectFactory">
<set-object property="className" value="app-property:org.apache.tapestry.visit-class"/>
</construct>
</invoke-factory>
</service-point>
<configuration-point id="ApplicationObjects" schema-id="StateObjectContribution">
Defines application state objects available to the application.
Definitions here override definitions with the same name
in the FactoryObjects configuration point.
</configuration-point>
<configuration-point id="StateObjectPersistenceManagers">
Defines different ways of persisting application
state objects between requests; this is the 'scope'
of a state object.
<schema>
<element name="manager" key-attribute="scope">
Defines a manager, which is referenced by its scope name.
<attribute name="scope">
The name of the manager.
</attribute>
<attribute name="object" translator="object" required="true">
The static object persistence manager, an object implementing the StateObjectPersistenceManager interface.
</attribute>
<rules>
<push-attribute attribute="object"/>
<invoke-parent method="addElement"/>
</rules>
</element>
</schema>
</configuration-point>
<contribution configuration-id="StateObjectPersistenceManagers">
<manager scope="application" object="instance:ApplicationScopeManager"/>
<manager scope="session" object="service:SessionScopeManager"/>
</contribution>
<service-point id="SessionScopeManager" interface="StateObjectPersistenceManager">
Manages application state objects in the session.
<invoke-factory>
<construct class="SessionScopeManager">
<set-object property="request" value="infrastructure:request"/>
<set-object property="applicationId" value="infrastructure:applicationId"/>
</construct>
</invoke-factory>
</service-point>
<service-point id="StateObjectManagerRegistry"
interface="StateObjectManagerRegistry">
Service that organizes the information from the
FactoryObjects, ApplicationObjects and StateObjectPersistenceManagers configuration
points into a set of StateObjectManagers.
<invoke-factory>
<construct class="SOMRegistryImpl">
<set-configuration property="factoryContributions"
configuration-id="FactoryObjects"/>
<set-configuration property="applicationContributions"
configuration-id="ApplicationObjects"/>
<set-configuration property="persistenceManagers"
configuration-id="StateObjectPersistenceManagers"/>
</construct>
</invoke-factory>
</service-point>
<service-point id="ApplicationStateManager">
<invoke-factory model="pooled">
<construct class="ApplicationStateManagerImpl">
<set-service property="registry" service-id="StateObjectManagerRegistry"/>
</construct>
</invoke-factory>
</service-point>
<contribution configuration-id="tapestry.Infrastructure">
<property name="applicationStateManager" object="service:ApplicationStateManager"/>
</contribution>
</module>