Hi Jeff,
the way you did it allows another developer to contribute the 'client'
strategy to your new configuration-point.
You may override the service tapestry.persist.
PropertyPersistenceStrategySource by adding an implementation to
one of your hivemodules:
<implementation service-point id="PropertyPersistenceStrategySource">
Used by other services to locate persistence strategies and run certain
operations across all strategies.
<invoke-factory>
<construct class="
org.apache.tapestry.record.PropertyPersistenceStrategySourceImpl">
<set-configuration property="contributions"
configuration-id="PersistenceStrategy"/>
</construct>
</invoke-factory>
</implementation >
in your class
org.apache.tapestry.record.PropertyPersistenceStrategySourceImpl
you can filter on those strategies you want to allow.
Mit freundlichen Grüßen
Michael Frericks
|---------+---------------------------->
| | |
| | |
| | "Jeff Lubetkin" |
| | <[EMAIL PROTECTED]|
| | om> |
| | |
| | 06.12.2005 19:46 |
| | Bitte antworten |
| | an "Tapestry |
| | users" |
| | |
|---------+---------------------------->
>------------------------------------------------------------------------------------------------------------------------------|
|
|
| An: "Tapestry users" <[email protected]>
|
| Kopie:
|
| Thema: Removing elements from configurations [Virus checked]
|
>------------------------------------------------------------------------------------------------------------------------------|
This is a bit more of a Hivemind question than a Tapestry question, but I
was hoping someone here could help.
I’d like to remove the “client” related persistence strategies from the
PersistenceStrategy configuration point. The only way I’ve figured out how
to do this is to effectively recreate a bunch of the tapestry configuration
so that I can construct a new instance of the RequestCycleFactory that has
my persistence config, then contribute that to InfrastructureOverrides. It
just feels like there must be a simpler way to do this, but I can’t figure
it out. Is there any way for a downstream config file to remove config
items from a configuration point, or override the list entirely?
I’ve included my version of this config from my hivemodule.xml below. If
anyone has any suggestions, I’d love to hear them.
Thanks,
jeff
<configuration-point id="SessionOnlyPersistenceStrategy">
Defines the different strategies for persisting page properties between
requests.
The names match against the persist attribute of the property element.
<schema>
<element name="strategy">
<attribute name="name" required="true" unique="true">
A unique name for the strategy.
</attribute>
<attribute name="object" required="true" translator="object">
The object implementing PropertyPersistenceStrategy.
</attribute>
<conversion class=
"org.apache.tapestry.record.PropertyPersistenceStrategyContribution">
<map attribute="object" property="strategy"/>
</conversion>
</element>
</schema>
</configuration-point>
<service-point id="SessionOnlyPropertyPersistenceStrategySource"
interface=
"org.apache.tapestry.record.PropertyPersistenceStrategySource">
Used by other services to locate persistence strategies and run certain
operations across all strategies.
<invoke-factory>
<construct class=
"org.apache.tapestry.record.PropertyPersistenceStrategySourceImpl">
<set-configuration property="contributions" configuration-id=
"SessionOnlyPersistenceStrategy"/>
</construct>
</invoke-factory>
</service-point>
<contribution configuration-id="SessionOnlyPersistenceStrategy">
<strategy name="session" object=
"service:tapestry.persist.SessionPropertyPersistenceStrategy"/>
</contribution>
<service-point id="MyRequestCycleFactory" interface=
"org.apache.tapestry.services.RequestCycleFactory">
Creates new IRequestCycle instances. This one uses a persistence
strategy source that doesn't
allow client strategies.
<invoke-factory>
<construct class=
"org.apache.tapestry.services.impl.RequestCycleFactoryImpl">
<set-object property="encoders"
value=
"service-property:tapestry.url.LinkFactory:serviceEncoders"/>
<set-service property="monitorFactory" service-id=
"tapestry.monitor.MonitorFactory"/>
<set-service property="strategySource" service-id=
"SessionOnlyPropertyPersistenceStrategySource"/>
<set-service property="infrastructure" service-id=
"tapestry.Infrastructure"/>
<set-service property="absoluteURLBuilder" service-id=
"tapestry.request.AbsoluteURLBuilder"/>
<set-service property="requestGlobals" service-id=
"tapestry.globals.RequestGlobals"/>
</construct>
</invoke-factory>
</service-point>
<contribution configuration-id="tapestry.InfrastructureOverrides">
<property name="requestCycleFactory" object=
"service:MyRequestCycleFactory"/>
</contribution>
____________________________________________________
Jeff Lubetkin
Development Lead
P (206) 470-7116
F (206) 470-7001
Zillow.com, Your Edge in Real Estate