You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ja...@usitc.gov on 2007/07/05 21:15:56 UTC

TAP 4: How to override asset service.

Hello,

We're a Tapestry 4 shop.  I need to override the asset service within
the  tapestry.services.FactoryServices contribution point with my own
asset service.  

My wrinkle is that I also need to inject the existing asset service as a
property during construction of my own asset service.

How may I do this?

This is my configuration, nonfunctional, today:

	<contribution
configuration-id="tapestry.services.FactoryServices">
		<service name="asset"
object="service:SecuredAssetService" />    
	</contribution>
    
    <service-point id="SecuredAssetService"
    	interface="org.apache.tapestry.engine.IEngineService">
    	<invoke-factory>
    		<construct
 
class="gov.usitc.tapestry.asset.SecuredAssetService">
    			<set-object property="authorizer"
    				value="service:LinkAuthorizer" />
    			<set-object property="identifier"
    				value="service:LinkTargetIdentifier" />
    			<set-object property="authenticationDelegate"
value="service:edis3.cas.acegi.warppers.AuthenticationDelegate" />
    			<set-object property="inner"
    			    value="service:tapestry.services.Asset"/>
    		</construct>
    	</invoke-factory>
    </service-point>

The error I'm receiving is:

org.apache.hivemind.ApplicationRuntimeException: Element service (at
jar:file:/C:/containers/presentation/tomcat-5.5.17/temp/2-edis3-central/
WEB-INF/lib/tapestry-4.0.2.patched.jar!/META-INF/tapestry.services.xml,
line 59, column 51) contains errors: Value for attribute 'name'
('asset') duplicates a prior instance at
jar:file:/C:/containers/presentation/tomcat-5.5.17/temp/2-edis3-central/
WEB-INF/lib/UsitcTapestryLibrary-1.0-SNAPSHOT.jar!/META-INF/gov.usitc.en
hance.xml, line 19, column 64.
[jar:file:/C:/containers/presentation/tomcat-5.5.17/temp/2-edis3-central
/WEB-INF/lib/tapestry-4.0.2.patched.jar!/META-INF/tapestry.services.xml,
line 59, column 51]

Thanks,

-jason

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: TAP 4: How to override asset service.

Posted by Marcus Schulte <et...@googlemail.com>.
try to override the existing service like that:

<implementation service-id="tapestry.services.Asset" >
  <invoke-factory> ....</invokefactory>
</implementation>

In the invoke-factory element, you'd reference the original tapestry
implementation under a different service-id, under which you'd make it
available by copying the original stuff from the tapestry hivemodules.
hth, Marcus

2007/7/5, Jason.Yankus@usitc.gov <Ja...@usitc.gov>:
>
> Hello,
>
> We're a Tapestry 4 shop.  I need to override the asset service within
> the  tapestry.services.FactoryServices contribution point with my own
> asset service.
>
> My wrinkle is that I also need to inject the existing asset service as a
> property during construction of my own asset service.
>
> How may I do this?
>
> This is my configuration, nonfunctional, today:
>
>         <contribution
> configuration-id="tapestry.services.FactoryServices">
>                 <service name="asset"
> object="service:SecuredAssetService" />
>         </contribution>
>
>     <service-point id="SecuredAssetService"
>         interface="org.apache.tapestry.engine.IEngineService">
>         <invoke-factory>
>                 <construct
>
> class="gov.usitc.tapestry.asset.SecuredAssetService">
>                         <set-object property="authorizer"
>                                 value="service:LinkAuthorizer" />
>                         <set-object property="identifier"
>                                 value="service:LinkTargetIdentifier" />
>                         <set-object property="authenticationDelegate"
> value="service:edis3.cas.acegi.warppers.AuthenticationDelegate" />
>                         <set-object property="inner"
>                             value="service:tapestry.services.Asset"/>
>                 </construct>
>         </invoke-factory>
>     </service-point>
>
> The error I'm receiving is:
>
> org.apache.hivemind.ApplicationRuntimeException: Element service (at
> jar:file:/C:/containers/presentation/tomcat-5.5.17/temp/2-edis3-central/
> WEB-INF/lib/tapestry-4.0.2.patched.jar!/META-INF/tapestry.services.xml,
> line 59, column 51) contains errors: Value for attribute 'name'
> ('asset') duplicates a prior instance at
> jar:file:/C:/containers/presentation/tomcat-5.5.17/temp/2-edis3-central/
> WEB-INF/lib/UsitcTapestryLibrary-1.0-SNAPSHOT.jar!/META-INF/gov.usitc.en
> hance.xml, line 19, column 64.
> [jar:file:/C:/containers/presentation/tomcat-5.5.17/temp/2-edis3-central
> /WEB-INF/lib/tapestry-4.0.2.patched.jar!/META-INF/tapestry.services.xml,
> line 59, column 51]
>
> Thanks,
>
> -jason
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Marcus Schulte
http://marcus-schulte.blogspot.com