Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
<?xml version="1.0"?>
<!-- 
    Copyright 2004, 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.services" version="4.0.0" package="org.apache.tapestry.engine">

    Contains the Tapestry engine services, and the configuration points for creating new ones (or
    overriding the factory defaults).

    <schema id="EngineServices">

        <element name="service" key-attribute="name">
            <attribute name="name">
                The name of the service; the service itself must provide the same name from its
                getName() method.
            </attribute>
            <attribute name="object" translator="object" required="true">

                Engine services are typically, but not definitively, HiveMind services (they can be
                simple objects as well).

            </attribute>

            <conversion class="org.apache.tapestry.services.impl.EngineServiceContribution">
                <map attribute="object" property="service" />
            </conversion>

        </element>

    </schema>

    <configuration-point id="FactoryServices" schema-id="EngineServices">

        Configuration point for the factory default services. Each contributed service must have a
        unique name.

    </configuration-point>

    <contribution configuration-id="FactoryServices">
        <service name="home" object="service:Home" />
        <service name="direct" object="service:Direct" />
        <service name="page" object="service:Page" />
        <service name="reset" object="service:Reset" />
        <service name="restart" object="service:Restart" />
        <service name="asset" object="service:Asset" />
        <service name="external" object="service:External" />
    </contribution>

    <service-point id="External" interface="IEngineService">
        <invoke-factory>
            <construct class="ExternalService">
                <set-object property="responseRenderer" value="infrastructure:responseRenderer" />
                <set-object property="linkFactory" value="infrastructure:linkFactory" />
            </construct>
        </invoke-factory>
    </service-point>

    <service-point id="Asset" interface="IEngineService">
        <invoke-factory>
            <construct class="org.apache.tapestry.asset.AssetService">
                <set-object property="exceptionReporter"
                    value="infrastructure:requestExceptionReporter" />
                <set-object property="linkFactory" value="infrastructure:linkFactory" />
                <set-service property="context" service-id="tapestry.globals.WebContext" />
                <set-object property="response" value="service:tapestry.globals.WebResponse" />
                <set-service property="digestSource" service-id="tapestry.asset.ResourceDigestSource" />
                <set-service property="unprotectedMatcher" service-id="tapestry.asset.UnprotectedResourceMatcher" />
            </construct>
        </invoke-factory>
    </service-point>

    <service-point id="Restart" interface="IEngineService">
        <invoke-factory>
            <construct class="RestartService">
                <set-service property="request" service-id="tapestry.globals.HttpServletRequest" />
                <set-service property="response" service-id="tapestry.globals.HttpServletResponse" />
                <set-object property="servletPath"
                    value="app-property:org.apache.tapestry.servlet-path" />
                <set-object property="linkFactory" value="infrastructure:linkFactory" />
            </construct>
        </invoke-factory>
    </service-point>

    <service-point id="Home" interface="IEngineService">
        <invoke-factory>
            <construct class="HomeService">
                <set-object property="responseRenderer" value="infrastructure:responseRenderer" />
                <set-object property="linkFactory" value="infrastructure:linkFactory" />
                <set-object property="pageName" value="app-property:org.apache.tapestry.home-page" />
            </construct>
        </invoke-factory>
    </service-point>

    <service-point id="Direct" interface="IEngineService">
        <invoke-factory>
            <construct class="DirectService">
                <set-object property="responseRenderer" value="infrastructure:responseRenderer" />
                <set-object property="request" value="infrastructure:request" />
                <set-object property="linkFactory" value="infrastructure:linkFactory" />
                <set-object property="requestCycle" value="infrastructure:requestCycle" />
            </construct>
        </invoke-factory>
    </service-point>

    <service-point id="Page" interface="IEngineService">
        <invoke-factory>
            <construct class="PageService">
                <set-object property="responseRenderer" value="infrastructure:responseRenderer" />
                <set-object property="linkFactory" value="infrastructure:linkFactory" />
            </construct>
        </invoke-factory>
    </service-point>

    <service-point id="Reset" interface="IEngineService">
        <invoke-factory>
            <construct class="ResetService">
                <set-object property="responseRenderer" value="infrastructure:responseRenderer" />
                <set-service property="resetEventHub" service-id="tapestry.ResetEventHub" />
                <set property="enabled" value="${org.apache.tapestry.enable-reset-service}" />
                <set-object property="linkFactory" value="infrastructure:linkFactory" />
                <set-object property="requestCycle" value="infrastructure:requestCycle" />
            </construct>
        </invoke-factory>
    </service-point>

    <contribution configuration-id="hivemind.FactoryDefaults">
        <default symbol="org.apache.tapestry.enable-reset-service" value="false" />
        <default symbol="org.apache.tapestry.home-page" value="Home" />
    </contribution>

    <configuration-point id="ApplicationServices" schema-id="EngineServices">

        Configuration point for application services. Each contributed service must have a unique
        name, but services contributed here will override services provided in the FactoryServices
        configuration point.

    </configuration-point>

    <service-point id="ServiceMap" interface="org.apache.tapestry.services.ServiceMap">

        Used to locate an engine service by name.

        <invoke-factory>
            <construct class="org.apache.tapestry.services.impl.ServiceMapImpl">
                <set-object property="factoryServices"
                    value="service-property:tapestry.globals.ApplicationGlobals:factoryServices" />
                <set-configuration property="applicationServices"
                    configuration-id="ApplicationServices" />
            </construct>
        </invoke-factory>

    </service-point>

    <service-point id="EngineServiceObjectProvider"
        interface="org.apache.hivemind.service.ObjectProvider">

        Implementation of the "engine-service:" object provider prefix.

        <invoke-factory>
            <construct class="org.apache.tapestry.services.impl.EngineServiceObjectProvider">
                <set-service property="serviceMap" service-id="ServiceMap" />
            </construct>
        </invoke-factory>

    </service-point>

    <contribution configuration-id="hivemind.ObjectProviders">
        <provider prefix="engine-service" service-id="EngineServiceObjectProvider" />
    </contribution>

    <contribution configuration-id="tapestry.Infrastructure">
        <property name="serviceMap" object="service:ServiceMap" />
    </contribution>

    <service-point id="ResponseDelegateFactory" interface="org.apache.tapestry.services.ResponseDelegateFactory">
        Delegates choosing an appropriate response to the configured response builder contributions.
        <invoke-factory>
            <construct class="org.apache.tapestry.services.impl.ResponseDelegateFactoryImpl">
                <set-configuration property="responseContributors"
                    configuration-id="ResponseContributors" />
            </construct>
        </invoke-factory>
    </service-point>
    
    <configuration-point id="ResponseContributors" occurs="1..n">
        Defines the available set of ComponentInvokerFactory services, where there should be a one
        to one relationship between a particular type of ajax request and the invoker that handles
        the response. More types of handlers may be created, like service invocation handlers..
        <schema>
            <element name="invoker">
                <attribute name="object" required="true" translator="object" />
                <rules>
                    <push-attribute attribute="object" />
                    <invoke-parent method="addElement" />
                </rules>
            </element>
        </schema>
    </configuration-point>
    
    <service-point id="JSONResponseContributor" interface="org.apache.tapestry.services.ResponseContributor">
        Defines the factory service that is responsible for determining if a particular request is
        one that should recieve a JSON response.
        <invoke-factory>
            <construct class="org.apache.tapestry.services.impl.JSONResponseContributorImpl" >
                <set-service property="localeManager" service-id="tapestry.request.RequestLocaleManager"/>
                <set-object property="markupWriterSource"  value="infrastructure:markupWriterSource"/>
                <set-object property="webResponse" value="infrastructure:response"/>
                <set-object property="webRequest" value="infrastructure:request"/>
                <set-object property="assetFactory" value="infrastructure:assetFactory" />
            </construct>
        </invoke-factory>
    </service-point>
    
    <service-point id="DojoAjaxResponseContributor" interface="org.apache.tapestry.services.ResponseContributor">
        Defines the factory service that is responsible for determining if a particular request is
        one that should recieve dojo ajax responses.
        <invoke-factory>
            <construct class="org.apache.tapestry.services.impl.DojoAjaxResponseContributorImpl" >
                <set-service property="localeManager" service-id="tapestry.request.RequestLocaleManager"/>
                <set-object property="markupWriterSource"  value="infrastructure:markupWriterSource"/>
                <set-object property="webResponse" value="infrastructure:response"/>
                <set-object property="webRequest" value="infrastructure:request"/>
                <set-object property="exceptionPageName" value="infrastructure:exceptionPageName"/>
                <set-object property="staleSessionPageName" value="infrastructure:staleSessionPageName" />
                <set-object property="staleLinkPageName" value="infrastructure:staleLinkPageName" />
                <set-object property="assetFactory" value="infrastructure:assetFactory" />
                <set-service property="pageService" service-id="tapestry.services.Page" />
            </construct>
        </invoke-factory>
    </service-point>
    
    <service-point id="DefaultResponseContributor" interface="org.apache.tapestry.services.ResponseContributor">
        Defines the factory service that is responsible for determining if a particular request is
        one that should recieve a normal Html response. This will probably be the one chosen in
        the majority of cases.
        <invoke-factory>
            <construct class="org.apache.tapestry.services.impl.DefaultResponseContributorImpl" >
                <set-service property="localeManager" service-id="tapestry.request.RequestLocaleManager"/>
                <set-object property="markupWriterSource"  value="infrastructure:markupWriterSource"/>
                <set-object property="webResponse" value="infrastructure:response"/>
                <set-object property="assetFactory" value="infrastructure:assetFactory" />
            </construct>
        </invoke-factory>
    </service-point>

    <service-point id="PrototypeResponseContributor" interface="org.apache.tapestry.services.ResponseContributor">

        Contributor responsible for sniffing out and building an appropriate ResponseBuilder object for handling
        prototype javascript XHR requests.

        <invoke-factory>
            <construct class="org.apache.tapestry.services.impl.PrototypeResponseContributorImpl" >
                <set-service property="localeManager" service-id="tapestry.request.RequestLocaleManager"/>
                <set-object property="markupWriterSource"  value="infrastructure:markupWriterSource"/>
                <set-object property="webResponse" value="infrastructure:response"/>
                <set-object property="webRequest" value="infrastructure:request"/>
                <set-object property="assetFactory" value="infrastructure:assetFactory" />
            </construct>
        </invoke-factory>
    </service-point>

    <contribution configuration-id="ResponseContributors">
        Order of addition is very important here, contributors may claim a particular response as
        belonging to a certain protocol, so no guarantees are made as to the
        friendlyness/compatibility between various implementations.
        <invoker object="service:JSONResponseContributor" />
        <invoker object="service:DojoAjaxResponseContributor" />
        <invoker object="service:PrototypeResponseContributor" />
        <invoker object="service:DefaultResponseContributor" />
    </contribution>

</module>
New to GrepCode? Check out our FAQ X