<?xml version="1.0"?>
<!-- 
   Copyright 2005 Howard M. Lewis Ship

   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="com.javaforge.tapestry.prop" version="0.1.1">
    
    A Tapestry extension that adds a new binding prefix, "prop:".  The expression
    is just a simple property name.  The advantage of this over the default "ognl:"
    binding prefix is that a new Java class is created, via bytecode enhancement,
    and access to the property does not use any Java reflection.
    
    <service-point id="PropertyAccessorClassFactory">
        
        Creates PropertyAccessor classes, given a target class, and a property
        of that class (which may be read/write, read-only, or write-only).
        
        <invoke-factory>
            <construct class="PropertyAccessorClassFactoryImpl">
                <set-object property="classFactory" value="service:hivemind.ClassFactory"/>
            </construct>
        </invoke-factory>
    </service-point>
    
    <service-point id="PropertyAccessorSource">
        
        Builds upon PropertyAccessorClassFactory to find and instantiate
        instances of PropertyAccessor for a specific object instance and property name.
        Manages a cache of PropertyAccessor classes.

        <invoke-factory>
            <construct class="PropertyAccessorSourceImpl">
                <set-object property="accessorClassFactory" value="service:PropertyAccessorClassFactory"/>
                <event-listener service-id="tapestry.ResetEventHub"/>
                <event-listener service-id="tapestry.describe.ReportStatusHub"/>
            </construct>
        </invoke-factory>        
    </service-point>
    
    <service-point id="PropertyAccessorBindingFactory" interface="org.apache.tapestry.binding.BindingFactory">
        
        Implementation of the "prop:" binding prefix, which is built around PropertyAccessor
        instances provided by the PropertyAccessorSource.
        
        <invoke-factory>
            <construct class="PropertyAccessorBindingFactory">
                <set-object property="valueConverter" value="infrastructure:valueConverter"/>
                <set-object property="source" value="service:PropertyAccessorSource"/>
            </construct>
        </invoke-factory>
    </service-point>
    
    <contribution configuration-id="tapestry.bindings.BindingFactories">
        <binding prefix="prop" service-id="PropertyAccessorBindingFactory"/>
    </contribution>
    
</module>
