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.page" version="4.0.0" package="org.apache.tapestry.pageload">

    Module for services related to page loading and pooling.

    <service-point id="PageSource" interface="org.apache.tapestry.engine.IPageSource">

        <invoke-factory>
            <construct class="PageSource" initialize-method="initializeService">
                <set-service property="pageSpecificationResolver" service-id="PageSpecificationResolver"/>
                <set-service property="loader" service-id="PageLoader"/>
                <set-service property="propertySource" service-id="tapestry.props.ApplicationPropertySource" />
                <event-listener service-id="tapestry.ResetEventHub"/>
                <event-listener service-id="tapestry.describe.ReportStatusHub"/>
            </construct>
        </invoke-factory>

    </service-point>

    <contribution configuration-id="hivemind.FactoryDefaults">
        <default symbol="org.apache.tapestry.page-pool-min-idle" value="1" />
        <default symbol="org.apache.tapestry.page-pool-max-active" value="-1" />
        <default symbol="org.apache.tapestry.page-pool-max-idle" value="-1" />
        <default symbol="org.apache.tapestry.page-pool-evict-thread-sleep-minutes" value="4" />
        <default symbol="org.apache.tapestry.page-pool-evict-idle-page-minutes" value="40" />
    </contribution>

    <service-point id="PageLoader" interface="org.apache.tapestry.engine.IPageLoader">

        <invoke-factory model="pooled">
            <construct class="PageLoader">
                <set-service property="componentConstructorFactory" service-id="tapestry.enhance.ComponentConstructorFactory"/>
                <set-service property="componentResolver" service-id="ComponentSpecificationResolver"/>
                <set-service property="bindingSource" service-id="tapestry.bindings.BindingSource"/>
                <set-service property="componentTemplateLoader" service-id="ComponentTemplateLoader"/>
                <set-service property="establishDefaultParameterValuesVisitor" service-id="EstablishDefaultParameterValuesVisitor"/>
                <set-service property="assetSource" service-id="tapestry.asset.AssetSource"/>
                <set-service property="pageClassProvider" service-id="PageClassProvider"/>
                <set-service property="componentClassProvider" service-id="ComponentClassProvider"/>
                <set-object property="componentPropertySource" value="infrastructure:componentPropertySource"/>
                <set-service property="threadLocale" service-id="hivemind.ThreadLocale"/>
                <set-service property="eventConnectionVisitor" service-id="EventConnectionVisitor" />
                <set-service property="componentTypeVisitor" service-id="ComponentTypeVisitor" />
            </construct>
        </invoke-factory>
    </service-point>

    <service-point id="EstablishDefaultParameterValuesVisitor" interface="IComponentVisitor">

        Visits all the components of a page, locates unbound parameters, and plugs in a default value (if available)
        for each. Used by the PageLoader.

        <invoke-factory>
            <construct class="EstablishDefaultParameterValuesVisitor">
                <set-service property="bindingSource" service-id="tapestry.bindings.BindingSource"/>
            </construct>
        </invoke-factory>

    </service-point>

    <service-point id="EventConnectionVisitor" interface="IComponentVisitor">

        Visits all the components of a page and wires up their @EventListener connections to the actual components
        targeted once a valid instance of the page is available to resolve them against.

        <invoke-factory model="pooled">
            <construct class="EventConnectionVisitor">
                <set-service property="eventInvoker" service-id="tapestry.event.EventInvoker"/>
            </construct>
        </invoke-factory>

    </service-point>

    <service-point id="ComponentTypeVisitor" interface="IComponentVisitor">

        Visits all components in the tree and inspects them for IWidget / or IForm instances
        so that the appropriate javascript libraries are included automatically.

        <invoke-factory model="pooled">
            <construct class="ComponentTypeVisitor" />
        </invoke-factory>

    </service-point>

    <service-point id="PageSpecificationResolver" interface="org.apache.tapestry.resolver.PageSpecificationResolver">

        <invoke-factory model="threaded">
            <construct class="org.apache.tapestry.resolver.PageSpecificationResolverImpl">
                <set-object property="specificationSource" value="infrastructure:specificationSource"/>
                <set-object property="componentPropertySource" value="infrastructure:componentPropertySource"/>
                <set-service property="delegate" service-id="SpecificationResolverDelegate"/>
                <set-object property="applicationId" value="infrastructure:applicationId"/>
                <set-object property="contextRoot" value="infrastructure:contextRoot"/>
            </construct>
        </invoke-factory>

    </service-point>

    <service-point id="SpecificationResolverDelegate" interface="org.apache.tapestry.resolver.ISpecificationResolverDelegate">

        <invoke-factory service-id="tapestry.ExtensionLookupFactory">
            <lookup extension-name="org.apache.tapestry.specification-resolver-delegate"/>
        </invoke-factory>
    </service-point>

    <service-point id="ComponentSpecificationResolver" interface="org.apache.tapestry.resolver.ComponentSpecificationResolver">

        Locates the specification for a component or page.

        <invoke-factory model="threaded">
            <construct class="org.apache.tapestry.resolver.ComponentSpecificationResolverImpl">
                <set-object property="specificationSource" value="infrastructure:specificationSource"/>
                <set-service property="delegate" service-id="SpecificationResolverDelegate"/>
                <set-object property="applicationId" value="infrastructure:applicationId"/>
                <set-object property="contextRoot" value="infrastructure:contextRoot"/>
                <set-object property="classFinder" value="infrastructure:classFinder"/>
            </construct>
        </invoke-factory>
    </service-point>

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

        Locates and loads the template for a component (or page).

        <invoke-factory>
            <construct class="org.apache.tapestry.services.impl.ComponentTemplateLoaderImpl">
                <set-object property="templateSource" value="infrastructure:templateSource"/>
                <set-service property="pageLoader" service-id="PageLoader"/>
                <set-service property="bindingSource" service-id="tapestry.bindings.BindingSource"/>
            </construct>
        </invoke-factory>

    </service-point>

    <service-point id="ComponentResourceResolver" interface="org.apache.tapestry.resolver.IComponentResourceResolver">

        Locates and loads resource relative to a component / page.

        <invoke-factory>
            <construct class="org.apache.tapestry.resolver.ComponentResourceResolverImpl">
                <set-object property="contextRoot" value="infrastructure:contextRoot"/>
                <set-object property="applicationId" value="infrastructure:applicationId"/>
                <set-service property="contextAssetFactory" service-id="tapestry.asset.ContextAssetFactory" />
                <set-service property="classpathAssetFactory" service-id="tapestry.asset.ClasspathAssetFactory" />
            </construct>
        </invoke-factory>

    </service-point>

    <configuration-point id="PageClassProviderChain" schema-id="hivemind.lib.ChainContribution">

        Chain of objects implementing ComponentClassProvider that are used to locate  the page class
        for a particular page.

    </configuration-point>

    <service-point id="PageClassProvider" interface="ComponentClassProvider">

        Chain built around thePgaeClassProviderChain configuration point, used to determine
        the class to instantiate for a particular page (within a namespace).

        <invoke-factory service-id="hivemind.lib.ChainFactory">
            <construct configuration-id="PageClassProviderChain"/>
        </invoke-factory>
    </service-point>

    <contribution configuration-id="PageClassProviderChain">
        <command id="specification" before="*" object="instance:SpecificationComponentClassProvider"/>
        <command id="namespace-class-search" object="service:NamespaceClassSearchPageClassProvider"/>
        <command id="namespace-default" object="instance:NamespaceDefaultPageClassProvider" after="namespace-class-search"/>
        <command id="global-default" object="service:GlobalDefaultPageClassProvider" after="*"/>
    </contribution>

    <service-point id="NamespaceClassSearchPageClassProvider" interface="ComponentClassProvider">

        Searches for a class with a name matching the page name in the default package
        (and in packages defined by the namespace's org.apache.tapestry.page-class-packages meta property).

        <invoke-factory>
            <construct class="NamespaceClassSearchComponentClassProvider">
                <set property="packagesName" value="org.apache.tapestry.page-class-packages"/>
                <set-object property="classFinder" value="infrastructure:classFinder"/>
            </construct>
        </invoke-factory>

    </service-point>

    <service-point id="GlobalDefaultPageClassProvider" interface="ComponentClassProvider">

        Final command in the chain; returns a fixed value based on a global property.

        <invoke-factory>
            <construct class="GlobalDefaultComponentClassProvider">
                <set-object property="componentClassName" value="global-property:org.apache.tapestry.default-page-class"/>
            </construct>
        </invoke-factory>
    </service-point>

    <configuration-point id="ComponentClassProviderChain" schema-id="hivemind.lib.ChainContribution">

        Chain of objects implement ComponentClassProvider that are used to locate the
        component class for a particular component.
    </configuration-point>

    <service-point id="ComponentClassProvider">

        Chain built around ComponentClassProviderChain configuration point, used to
        determine the class to instantiate for a particular component (within a namespace).

        <invoke-factory service-id="hivemind.lib.ChainFactory">
            <construct configuration-id="ComponentClassProviderChain"/>
        </invoke-factory>

    </service-point>

    <contribution configuration-id="ComponentClassProviderChain">
        <command id="specification" before="*" object="instance:SpecificationComponentClassProvider"/>
        <command id="namespace-class-search" object="service:NamespaceClassSearchComponentClassProvider"/>
        <command id="global-default" object="instance:GlobalDefaultComponentClassProvider,componentClassName=org.apache.tapestry.BaseComponent" after="*"/>
    </contribution>

    <service-point id="NamespaceClassSearchComponentClassProvider" interface="ComponentClassProvider">

        Searches for a class with a name matching the component type in the default package
        (and in packages defined by the namespace's org.apache.tapestry.component-class-packages meta property).

        <invoke-factory>
            <construct class="NamespaceClassSearchComponentClassProvider">
                <set property="packagesName" value="org.apache.tapestry.component-class-packages"/>
                <set-object property="classFinder" value="infrastructure:classFinder"/>
            </construct>
        </invoke-factory>

    </service-point>

    <contribution configuration-id="tapestry.Infrastructure">
        <property name="pageSource" object="service:PageSource"/>
    </contribution>
</module>
New to GrepCode? Check out our FAQ X