You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Patrick Moore <tr...@gmail.com> on 2006/11/24 04:16:35 UTC

how to wrap tapestry.services.FactoryServices?

Hi --

I am trying to wrap some engine service by replacing the configuration
point, tapestry.services.FactoryServices with this definition:

    <contribution configuration-id="service:tapestry.services.FactoryServices">
        <service name="home" object="service:tapestry.services.Home" />
        <service name="direct" object="service:transactionalDirectService" />
        <service name="page" object="service:transactionalPageService" />
        <service name="reset" object="service:tapestry.services.Reset" />
        <service name="restart" object="service:tapestry.services.Restart" />
        <service name="asset" object="service:tapestry.services.Asset" />
        <service name="external" object="service:tapestry.services.External" />
    </contribution>

I did something similiar to this to replace
tapestry.services.ResponseContributors:

    <contribution configuration-id="tapestry.services.ResponseContributors">
        <invoker object="service:ScriptResponseContributor" />
        <invoker object="service:tapestry.services.JSONResponseContributor" />
        <invoker
object="service:tapestry.services.DojoAjaxResponseContributor" />
        <invoker
object="service:tapestry.services.DefaultResponseContributor" />
    </contribution>

but for the factoryservices I get :

Error building service transparentpolitics.sessionFactory: Error at
context:/WEB-INF/hivemodule.xml, line 76, column 87: Unable to
construct service tapestry.services.ServiceMap: Error building service
tapestry.services.ServiceMap: Error at
jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml,
line 159, column 81: Unable to initialize service
tapestry.services.ServiceMap (by invoking method initializeService on
org.apache.tapestry.services.impl.ServiceMapImpl): Unable to construct
configuration tapestry.services.FactoryServices: Element service (at
context:/WEB-INF/transpol.persistence.xml, line 47, column 72)
contains errors: Value for attribute 'name' ('home') duplicates a
prior instance at
jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml,
line 53, column 54.


Does anyone have any ideas on how I can do this service wrapping?

-Pat

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


Re: how to wrap tapestry.services.FactoryServices?

Posted by Francesco Degrassi <fr...@emaze.net>.
The following snippet of tapestry.services.xml (from
Tapestry-framework-4.1.jar) suggests that to override the factory
services you should add services with the same ID of the ones you want
to override to the configuration point
tapestry.services.ApplicationServices.

Maybe an interceptor is more appropriate for your needs, i don't know
much about interceptors (yet).

----- snippet from tapestry.services.xml ---------

<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>

----- snip -------

Francesco Degrassi

Jesse Kuhnert wrote:
> It sounds like you are not allowed to "contribute" more than one
> service name with the same id for this particular configuration point.
> 
> Maybe what you need to do is define what object is returned from the
> tapestry.services.Home service point via
> http://hivemind.apache.org/descriptor.html#implementation .
> 
> Of course it sounds like a much easier option might be to use an
> interceptor to just wrap all of the core services, if that's all you
> needed to do. http://hivemind.apache.org/descriptor.html#interceptor
> 
> On 11/23/06, Patrick Moore <tr...@gmail.com> wrote:
>> Hi --
>>
>> I am trying to wrap some engine service by replacing the configuration
>> point, tapestry.services.FactoryServices with this definition:
>>
>>     <contribution
>> configuration-id="service:tapestry.services.FactoryServices">
>>         <service name="home" object="service:tapestry.services.Home" />
>>         <service name="direct"
>> object="service:transactionalDirectService" />
>>         <service name="page" object="service:transactionalPageService" />
>>         <service name="reset" object="service:tapestry.services.Reset" />
>>         <service name="restart"
>> object="service:tapestry.services.Restart" />
>>         <service name="asset" object="service:tapestry.services.Asset" />
>>         <service name="external"
>> object="service:tapestry.services.External" />
>>     </contribution>
>>
>> I did something similiar to this to replace
>> tapestry.services.ResponseContributors:
>>
>>     <contribution
>> configuration-id="tapestry.services.ResponseContributors">
>>         <invoker object="service:ScriptResponseContributor" />
>>         <invoker
>> object="service:tapestry.services.JSONResponseContributor" />
>>         <invoker
>> object="service:tapestry.services.DojoAjaxResponseContributor" />
>>         <invoker
>> object="service:tapestry.services.DefaultResponseContributor" />
>>     </contribution>
>>
>> but for the factoryservices I get :
>>
>> Error building service transparentpolitics.sessionFactory: Error at
>> context:/WEB-INF/hivemodule.xml, line 76, column 87: Unable to
>> construct service tapestry.services.ServiceMap: Error building service
>> tapestry.services.ServiceMap: Error at
>> jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml,
>>
>> line 159, column 81: Unable to initialize service
>> tapestry.services.ServiceMap (by invoking method initializeService on
>> org.apache.tapestry.services.impl.ServiceMapImpl): Unable to construct
>> configuration tapestry.services.FactoryServices: Element service (at
>> context:/WEB-INF/transpol.persistence.xml, line 47, column 72)
>> contains errors: Value for attribute 'name' ('home') duplicates a
>> prior instance at
>> jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml,
>>
>> line 53, column 54.
>>
>>
>> Does anyone have any ideas on how I can do this service wrapping?
>>
>> -Pat
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 


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


Re: how to wrap tapestry.services.FactoryServices?

Posted by Jesse Kuhnert <jk...@gmail.com>.
It sounds like you are not allowed to "contribute" more than one
service name with the same id for this particular configuration point.

Maybe what you need to do is define what object is returned from the
tapestry.services.Home service point via
http://hivemind.apache.org/descriptor.html#implementation .

Of course it sounds like a much easier option might be to use an
interceptor to just wrap all of the core services, if that's all you
needed to do. http://hivemind.apache.org/descriptor.html#interceptor

On 11/23/06, Patrick Moore <tr...@gmail.com> wrote:
> Hi --
>
> I am trying to wrap some engine service by replacing the configuration
> point, tapestry.services.FactoryServices with this definition:
>
>     <contribution configuration-id="service:tapestry.services.FactoryServices">
>         <service name="home" object="service:tapestry.services.Home" />
>         <service name="direct" object="service:transactionalDirectService" />
>         <service name="page" object="service:transactionalPageService" />
>         <service name="reset" object="service:tapestry.services.Reset" />
>         <service name="restart" object="service:tapestry.services.Restart" />
>         <service name="asset" object="service:tapestry.services.Asset" />
>         <service name="external" object="service:tapestry.services.External" />
>     </contribution>
>
> I did something similiar to this to replace
> tapestry.services.ResponseContributors:
>
>     <contribution configuration-id="tapestry.services.ResponseContributors">
>         <invoker object="service:ScriptResponseContributor" />
>         <invoker object="service:tapestry.services.JSONResponseContributor" />
>         <invoker
> object="service:tapestry.services.DojoAjaxResponseContributor" />
>         <invoker
> object="service:tapestry.services.DefaultResponseContributor" />
>     </contribution>
>
> but for the factoryservices I get :
>
> Error building service transparentpolitics.sessionFactory: Error at
> context:/WEB-INF/hivemodule.xml, line 76, column 87: Unable to
> construct service tapestry.services.ServiceMap: Error building service
> tapestry.services.ServiceMap: Error at
> jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml,
> line 159, column 81: Unable to initialize service
> tapestry.services.ServiceMap (by invoking method initializeService on
> org.apache.tapestry.services.impl.ServiceMapImpl): Unable to construct
> configuration tapestry.services.FactoryServices: Element service (at
> context:/WEB-INF/transpol.persistence.xml, line 47, column 72)
> contains errors: Value for attribute 'name' ('home') duplicates a
> prior instance at
> jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml,
> line 53, column 54.
>
>
> Does anyone have any ideas on how I can do this service wrapping?
>
> -Pat
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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


Re: how to wrap tapestry.services.FactoryServices?

Posted by Patrick Moore <tr...@gmail.com>.
Hi there --

Thanks for pointing out the ApplicationServices configuration point.
That did it.

I still don't understand why the method that I was trying failed.

The interceptor stuff seems like way overkill in the specification
department to really want to use.

-Pat

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


Re: how to wrap tapestry.services.FactoryServices?

Posted by Ron Piterman <rp...@gmx.net>.
Yes, thats probably a good way to do the "wrapping"...
Cheers,
Ron


Francesco Degrassi wrote:
> Actually, as i understand it, if you contribute to
> tapestry.services.ApplicationServices, you can override a specific
> service used by tapestry with your own and still have in the registry
> the original provided by tapestry.
> e.g.: I want to override Home service so it uses my own
> HomeServiceWrapper class...
> 
> In my hivemodule.xml i would put:
> <service-point id="HomeWrapper" interface="IEngineService">
>         <invoke-factory>
>             <construct class="HomeServiceWrapper">
>                 <set-object property="wrappedService"
> value="service:tapestry.services.Home" />
>             </construct>
>         </invoke-factory>
> </service-point>
> 
> <contribution configuration-id="tapestry.services.ApplicationServices">
>         <service name="home" object="service:HomeWrapper" />
> </contribution>
> 
> I did not test it, but i'm fairly confident it would work. Please
> correct me if i somehow forgot something, i'm still getting used to
> hivemind.
> 
> Ron Piterman wrote:
> 
>>I don't get exactly what you want to do by "wrapping".
>>You can replace an implementation of a service by providing another
>>implementation, but then the old one will not exist in the registry
>>anymore.
>>
>>But it sounds more what you need is to intercept the services - take a
>>look at hivemind interceptors...
>>
>>Cheers,
>>Ron
>>
>>
>>Patrick Moore wrote:
>>
>>>Hi --
>>>
>>>I am trying to wrap some engine service by replacing the configuration
>>>point, tapestry.services.FactoryServices with this definition:
>>>
>>>   <contribution
>>>configuration-id="service:tapestry.services.FactoryServices">
>>>       <service name="home" object="service:tapestry.services.Home" />
>>>       <service name="direct"
>>>object="service:transactionalDirectService" />
>>>       <service name="page" object="service:transactionalPageService" />
>>>       <service name="reset" object="service:tapestry.services.Reset" />
>>>       <service name="restart"
>>>object="service:tapestry.services.Restart" />
>>>       <service name="asset" object="service:tapestry.services.Asset" />
>>>       <service name="external"
>>>object="service:tapestry.services.External" />
>>>   </contribution>
>>>
>>>I did something similiar to this to replace
>>>tapestry.services.ResponseContributors:
>>>
>>>   <contribution
>>>configuration-id="tapestry.services.ResponseContributors">
>>>       <invoker object="service:ScriptResponseContributor" />
>>>       <invoker
>>>object="service:tapestry.services.JSONResponseContributor" />
>>>       <invoker
>>>object="service:tapestry.services.DojoAjaxResponseContributor" />
>>>       <invoker
>>>object="service:tapestry.services.DefaultResponseContributor" />
>>>   </contribution>
>>>
>>>but for the factoryservices I get :
>>>
>>>Error building service transparentpolitics.sessionFactory: Error at
>>>context:/WEB-INF/hivemodule.xml, line 76, column 87: Unable to
>>>construct service tapestry.services.ServiceMap: Error building service
>>>tapestry.services.ServiceMap: Error at
>>>jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml,
>>>
>>>line 159, column 81: Unable to initialize service
>>>tapestry.services.ServiceMap (by invoking method initializeService on
>>>org.apache.tapestry.services.impl.ServiceMapImpl): Unable to construct
>>>configuration tapestry.services.FactoryServices: Element service (at
>>>context:/WEB-INF/transpol.persistence.xml, line 47, column 72)
>>>contains errors: Value for attribute 'name' ('home') duplicates a
>>>prior instance at
>>>jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml,
>>>
>>>line 53, column 54.
>>>
>>>
>>>Does anyone have any ideas on how I can do this service wrapping?
>>>
>>>-Pat
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>For additional commands, e-mail: users-help@tapestry.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


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


Re: how to wrap tapestry.services.FactoryServices?

Posted by Francesco Degrassi <fr...@emaze.net>.
Actually, as i understand it, if you contribute to
tapestry.services.ApplicationServices, you can override a specific
service used by tapestry with your own and still have in the registry
the original provided by tapestry.
e.g.: I want to override Home service so it uses my own
HomeServiceWrapper class...

In my hivemodule.xml i would put:
<service-point id="HomeWrapper" interface="IEngineService">
        <invoke-factory>
            <construct class="HomeServiceWrapper">
                <set-object property="wrappedService"
value="service:tapestry.services.Home" />
            </construct>
        </invoke-factory>
</service-point>

<contribution configuration-id="tapestry.services.ApplicationServices">
        <service name="home" object="service:HomeWrapper" />
</contribution>

I did not test it, but i'm fairly confident it would work. Please
correct me if i somehow forgot something, i'm still getting used to
hivemind.

Ron Piterman wrote:
> I don't get exactly what you want to do by "wrapping".
> You can replace an implementation of a service by providing another
> implementation, but then the old one will not exist in the registry
> anymore.
> 
> But it sounds more what you need is to intercept the services - take a
> look at hivemind interceptors...
> 
> Cheers,
> Ron
> 
> 
> Patrick Moore wrote:
>> Hi --
>>
>> I am trying to wrap some engine service by replacing the configuration
>> point, tapestry.services.FactoryServices with this definition:
>>
>>    <contribution
>> configuration-id="service:tapestry.services.FactoryServices">
>>        <service name="home" object="service:tapestry.services.Home" />
>>        <service name="direct"
>> object="service:transactionalDirectService" />
>>        <service name="page" object="service:transactionalPageService" />
>>        <service name="reset" object="service:tapestry.services.Reset" />
>>        <service name="restart"
>> object="service:tapestry.services.Restart" />
>>        <service name="asset" object="service:tapestry.services.Asset" />
>>        <service name="external"
>> object="service:tapestry.services.External" />
>>    </contribution>
>>
>> I did something similiar to this to replace
>> tapestry.services.ResponseContributors:
>>
>>    <contribution
>> configuration-id="tapestry.services.ResponseContributors">
>>        <invoker object="service:ScriptResponseContributor" />
>>        <invoker
>> object="service:tapestry.services.JSONResponseContributor" />
>>        <invoker
>> object="service:tapestry.services.DojoAjaxResponseContributor" />
>>        <invoker
>> object="service:tapestry.services.DefaultResponseContributor" />
>>    </contribution>
>>
>> but for the factoryservices I get :
>>
>> Error building service transparentpolitics.sessionFactory: Error at
>> context:/WEB-INF/hivemodule.xml, line 76, column 87: Unable to
>> construct service tapestry.services.ServiceMap: Error building service
>> tapestry.services.ServiceMap: Error at
>> jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml,
>>
>> line 159, column 81: Unable to initialize service
>> tapestry.services.ServiceMap (by invoking method initializeService on
>> org.apache.tapestry.services.impl.ServiceMapImpl): Unable to construct
>> configuration tapestry.services.FactoryServices: Element service (at
>> context:/WEB-INF/transpol.persistence.xml, line 47, column 72)
>> contains errors: Value for attribute 'name' ('home') duplicates a
>> prior instance at
>> jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml,
>>
>> line 53, column 54.
>>
>>
>> Does anyone have any ideas on how I can do this service wrapping?
>>
>> -Pat
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


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


Re: how to wrap tapestry.services.FactoryServices?

Posted by Ron Piterman <rp...@gmx.net>.
I don't get exactly what you want to do by "wrapping".
You can replace an implementation of a service by providing another 
implementation, but then the old one will not exist in the registry anymore.

But it sounds more what you need is to intercept the services - take a 
look at hivemind interceptors...

Cheers,
Ron


Patrick Moore wrote:
> Hi --
> 
> I am trying to wrap some engine service by replacing the configuration
> point, tapestry.services.FactoryServices with this definition:
> 
>    <contribution 
> configuration-id="service:tapestry.services.FactoryServices">
>        <service name="home" object="service:tapestry.services.Home" />
>        <service name="direct" 
> object="service:transactionalDirectService" />
>        <service name="page" object="service:transactionalPageService" />
>        <service name="reset" object="service:tapestry.services.Reset" />
>        <service name="restart" 
> object="service:tapestry.services.Restart" />
>        <service name="asset" object="service:tapestry.services.Asset" />
>        <service name="external" 
> object="service:tapestry.services.External" />
>    </contribution>
> 
> I did something similiar to this to replace
> tapestry.services.ResponseContributors:
> 
>    <contribution configuration-id="tapestry.services.ResponseContributors">
>        <invoker object="service:ScriptResponseContributor" />
>        <invoker 
> object="service:tapestry.services.JSONResponseContributor" />
>        <invoker
> object="service:tapestry.services.DojoAjaxResponseContributor" />
>        <invoker
> object="service:tapestry.services.DefaultResponseContributor" />
>    </contribution>
> 
> but for the factoryservices I get :
> 
> Error building service transparentpolitics.sessionFactory: Error at
> context:/WEB-INF/hivemodule.xml, line 76, column 87: Unable to
> construct service tapestry.services.ServiceMap: Error building service
> tapestry.services.ServiceMap: Error at
> jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml, 
> 
> line 159, column 81: Unable to initialize service
> tapestry.services.ServiceMap (by invoking method initializeService on
> org.apache.tapestry.services.impl.ServiceMapImpl): Unable to construct
> configuration tapestry.services.FactoryServices: Element service (at
> context:/WEB-INF/transpol.persistence.xml, line 47, column 72)
> contains errors: Value for attribute 'name' ('home') duplicates a
> prior instance at
> jar:file:/C:/Documents%20and%20Settings/Owner/.m2/repository/org/apache/tapestry/tapestry-framework/4.1.1-SNAPSHOT/tapestry-framework-4.1.1-SNAPSHOT.jar!/META-INF/tapestry.services.xml, 
> 
> line 53, column 54.
> 
> 
> Does anyone have any ideas on how I can do this service wrapping?
> 
> -Pat
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 


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