You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jun Tsai <ju...@gmail.com> on 2006/02/06 02:06:59 UTC

How to get service?

hi all,
    I find cycle.getEngine().getService(BlobService.SERVICE_NAME);
gerService method was deprected.I didn't find another method to get service?

How to ?

Thanks.

Jun Tsai
--
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net

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


Re: How to get service?

Posted by Ron Piterman <rp...@gmx.net>.
where does it come from? who instanciates it? whats its role? "asset" is
in tapestry a localized resource such as images

Jun Tsai wrote:
> Thank your reply.
> 
> My class is asset,not page ,not component,not service.How to inject service?
> 
> Thanks.
> 
> Jun Tsai
> 
> �� 06-2-6��Raul Raja Martinez<do...@estudiowebs.com> ���
> 
>>Hi Jun Tsai
>>
>>If the class where you want your service to be injected is not a page or
>>a component you can't inject it using annotations.
>>
>>If your class is another service you can get it injected declaring a
>>setter in your class that takes the interface of the service that you
>>want to inject as parameter:
>>
>>private ServiceToInject serviceToInject;
>>
>>public void setServiceToInject(ServiceToInject service) {
>>        serviceToInject = service;
>>}
>>
>>
>>On the other hand if you want to inject services into POJOS you can use
>>HiveUtils (formerly Hivetranse) for doing so.
>>http://hivetranse.sourceforge.net/quickstart.html#start.objectbuilder
>>
>>best regards.
>>
>>Raul Raja.
>>
>>Jun Tsai wrote:
>>
>>>Thank you.
>>>I want to inject the service in an asset class.
>>>
>>>Please look tapestry\examples\Workbench\src\java\org\apache\tapestry\workbench\chart\ChartAsset.java
>>>
>>>
>>>Thanks
>>>
>>>Jun Tsai
>>>
>>>
>>>2006/2/6, Shing Hing Man <ma...@yahoo.com>:
>>>
>>>>You can inject a service into your page :
>>>>
>>>>@InjectObject("engine-service:chart")
>>>>public abstract IEngineService getChartService();
>>>>
>>>>where chart is a custom service defined in
>>>>hivemind.xml . Something like :
>>>> <service-point id="chart"
>>>>interface="org.apache.tapestry.engine.IEngineService">
>>>>    <invoke-factory>
>>>>      <construct class="services.ChartService">
>>>>        <set-object property="exceptionReporter"
>>>>value="infrastructure:requestExceptionReporter"/>
>>>>        <set-object property="response"
>>>>value="infrastructure:response"/>
>>>>        <set-object property="linkFactory"
>>>>value="infrastructure:linkFactory"/>
>>>>                 <set-object property="daoFactory"
>>>>value="service:daoFactory"/>
>>>>       </construct>
>>>>    </invoke-factory>
>>>>  </service-point>
>>>>
>>>>InjectObject is documented here :
>>>>http://jakarta.apache.org/tapestry/UsersGuide/hivemind.html#hivemind.inject
>>>>
>>>>
>>>>
>>>>--- Jun Tsai <ju...@gmail.com> wrote:
>>>>
>>>>
>>>>>hi all,
>>>>>    I find
>>>>>
>>>>
>>>>cycle.getEngine().getService(BlobService.SERVICE_NAME);
>>>>
>>>>>gerService method was deprected.I didn't find
>>>>>another method to get service?
>>>>>
>>>>>How to ?
>>>>>
>>>>>Thanks.
>>>>>
>>>>>Jun Tsai
>>>>>--
>>>>>Welcome to China Java Users Group(CNJUG).
>>>>>http://cnjug.dev.java.net
>>>>>
>>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>
>>>>>To unsubscribe, e-mail:
>>>>>tapestry-user-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail:
>>>>>tapestry-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>
>>>>Home page :
>>>>  http://uk.geocities.com/matmsh/index.html
>>>>
>>>>
>>>>
>>>>___________________________________________________________
>>>>Yahoo! Photos �C NEW, now offering a quality print service from just 8p a photo http://uk.photos.yahoo.com
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>>--
>>>Welcome to China Java Users Group(CNJUG).
>>>http://cnjug.dev.java.net
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> --
> Welcome to China Java Users Group(CNJUG).
> http://cnjug.dev.java.net


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


Re: How to get service?

Posted by Norbert Sándor <de...@erinors.com>.
Why can't you use ObjectBuilder?

On the other hand you can subclass ApplicationServlet and make the Hivemind 
registry accessible to your application, so you can access services from 
anywhere and any way you want. Of course this is not as clean solution as 
injection...

Regards,
Norbi

----- Original Message ----- 
From: "Jun Tsai" <ju...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Monday, February 06, 2006 6:51 AM
Subject: Re: How to get service?


> Thank your reply.
>
> My class is asset,not page ,not component,not service.How to inject 
> service?
>
> Thanks.
>
> Jun Tsai
>
> 在 06-2-6,Raul Raja Martinez<do...@estudiowebs.com> 写道:
>> Hi Jun Tsai
>>
>> If the class where you want your service to be injected is not a page or
>> a component you can't inject it using annotations.
>>
>> If your class is another service you can get it injected declaring a
>> setter in your class that takes the interface of the service that you
>> want to inject as parameter:
>>
>> private ServiceToInject serviceToInject;
>>
>> public void setServiceToInject(ServiceToInject service) {
>>         serviceToInject = service;
>> }
>>
>>
>> On the other hand if you want to inject services into POJOS you can use
>> HiveUtils (formerly Hivetranse) for doing so.
>> http://hivetranse.sourceforge.net/quickstart.html#start.objectbuilder
>>
>> best regards.
>>
>> Raul Raja.
>>
>> Jun Tsai wrote:
>> > Thank you.
>> > I want to inject the service in an asset class.
>> >
>> > Please look 
>> > tapestry\examples\Workbench\src\java\org\apache\tapestry\workbench\chart\ChartAsset.java
>> >
>> >
>> > Thanks
>> >
>> > Jun Tsai
>> >
>> >
>> > 2006/2/6, Shing Hing Man <ma...@yahoo.com>:
>> >> You can inject a service into your page :
>> >>
>> >> @InjectObject("engine-service:chart")
>> >> public abstract IEngineService getChartService();
>> >>
>> >> where chart is a custom service defined in
>> >> hivemind.xml . Something like :
>> >>  <service-point id="chart"
>> >> interface="org.apache.tapestry.engine.IEngineService">
>> >>     <invoke-factory>
>> >>       <construct class="services.ChartService">
>> >>         <set-object property="exceptionReporter"
>> >> value="infrastructure:requestExceptionReporter"/>
>> >>         <set-object property="response"
>> >> value="infrastructure:response"/>
>> >>         <set-object property="linkFactory"
>> >> value="infrastructure:linkFactory"/>
>> >>                  <set-object property="daoFactory"
>> >> value="service:daoFactory"/>
>> >>        </construct>
>> >>     </invoke-factory>
>> >>   </service-point>
>> >>
>> >> InjectObject is documented here :
>> >> http://jakarta.apache.org/tapestry/UsersGuide/hivemind.html#hivemind.inject
>> >>
>> >>
>> >>
>> >> --- Jun Tsai <ju...@gmail.com> wrote:
>> >>
>> >>> hi all,
>> >>>     I find
>> >>>
>> >> cycle.getEngine().getService(BlobService.SERVICE_NAME);
>> >>> gerService method was deprected.I didn't find
>> >>> another method to get service?
>> >>>
>> >>> How to ?
>> >>>
>> >>> Thanks.
>> >>>
>> >>> Jun Tsai
>> >>> --
>> >>> Welcome to China Java Users Group(CNJUG).
>> >>> http://cnjug.dev.java.net
>> >>>
>> >>>
>> >> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail:
>> >>> tapestry-user-unsubscribe@jakarta.apache.org
>> >>> For additional commands, e-mail:
>> >>> tapestry-user-help@jakarta.apache.org
>> >>>
>> >>>
>> >>
>> >> Home page :
>> >>   http://uk.geocities.com/matmsh/index.html
>> >>
>> >>
>> >>
>> >> ___________________________________________________________
>> >> Yahoo! Photos – NEW, now offering a quality print service from just 8p 
>> >> a photo http://uk.photos.yahoo.com
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > Welcome to China Java Users Group(CNJUG).
>> > http://cnjug.dev.java.net
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> --
> Welcome to China Java Users Group(CNJUG).
> http://cnjug.dev.java.net
>


--------------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.0/249 - Release Date: 2006. 02. 
02.


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


Re: How to get service?

Posted by Jun Tsai <ju...@gmail.com>.
Thank your reply.

My class is asset,not page ,not component,not service.How to inject service?

Thanks.

Jun Tsai

�� 06-2-6��Raul Raja Martinez<do...@estudiowebs.com> ���
> Hi Jun Tsai
>
> If the class where you want your service to be injected is not a page or
> a component you can't inject it using annotations.
>
> If your class is another service you can get it injected declaring a
> setter in your class that takes the interface of the service that you
> want to inject as parameter:
>
> private ServiceToInject serviceToInject;
>
> public void setServiceToInject(ServiceToInject service) {
>         serviceToInject = service;
> }
>
>
> On the other hand if you want to inject services into POJOS you can use
> HiveUtils (formerly Hivetranse) for doing so.
> http://hivetranse.sourceforge.net/quickstart.html#start.objectbuilder
>
> best regards.
>
> Raul Raja.
>
> Jun Tsai wrote:
> > Thank you.
> > I want to inject the service in an asset class.
> >
> > Please look tapestry\examples\Workbench\src\java\org\apache\tapestry\workbench\chart\ChartAsset.java
> >
> >
> > Thanks
> >
> > Jun Tsai
> >
> >
> > 2006/2/6, Shing Hing Man <ma...@yahoo.com>:
> >> You can inject a service into your page :
> >>
> >> @InjectObject("engine-service:chart")
> >> public abstract IEngineService getChartService();
> >>
> >> where chart is a custom service defined in
> >> hivemind.xml . Something like :
> >>  <service-point id="chart"
> >> interface="org.apache.tapestry.engine.IEngineService">
> >>     <invoke-factory>
> >>       <construct class="services.ChartService">
> >>         <set-object property="exceptionReporter"
> >> value="infrastructure:requestExceptionReporter"/>
> >>         <set-object property="response"
> >> value="infrastructure:response"/>
> >>         <set-object property="linkFactory"
> >> value="infrastructure:linkFactory"/>
> >>                  <set-object property="daoFactory"
> >> value="service:daoFactory"/>
> >>        </construct>
> >>     </invoke-factory>
> >>   </service-point>
> >>
> >> InjectObject is documented here :
> >> http://jakarta.apache.org/tapestry/UsersGuide/hivemind.html#hivemind.inject
> >>
> >>
> >>
> >> --- Jun Tsai <ju...@gmail.com> wrote:
> >>
> >>> hi all,
> >>>     I find
> >>>
> >> cycle.getEngine().getService(BlobService.SERVICE_NAME);
> >>> gerService method was deprected.I didn't find
> >>> another method to get service?
> >>>
> >>> How to ?
> >>>
> >>> Thanks.
> >>>
> >>> Jun Tsai
> >>> --
> >>> Welcome to China Java Users Group(CNJUG).
> >>> http://cnjug.dev.java.net
> >>>
> >>>
> >> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail:
> >>> tapestry-user-unsubscribe@jakarta.apache.org
> >>> For additional commands, e-mail:
> >>> tapestry-user-help@jakarta.apache.org
> >>>
> >>>
> >>
> >> Home page :
> >>   http://uk.geocities.com/matmsh/index.html
> >>
> >>
> >>
> >> ___________________________________________________________
> >> Yahoo! Photos �C NEW, now offering a quality print service from just 8p a photo http://uk.photos.yahoo.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >>
> >
> >
> > --
> > Welcome to China Java Users Group(CNJUG).
> > http://cnjug.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net

Re: How to get service?

Posted by Raul Raja Martinez <do...@estudiowebs.com>.
Hi Jun Tsai

If the class where you want your service to be injected is not a page or
a component you can't inject it using annotations.

If your class is another service you can get it injected declaring a
setter in your class that takes the interface of the service that you
want to inject as parameter:

private ServiceToInject serviceToInject;

public void setServiceToInject(ServiceToInject service) {
	serviceToInject = service;
}


On the other hand if you want to inject services into POJOS you can use
HiveUtils (formerly Hivetranse) for doing so.
http://hivetranse.sourceforge.net/quickstart.html#start.objectbuilder

best regards.

Raul Raja.

Jun Tsai wrote:
> Thank you.
> I want to inject the service in an asset class.
> 
> Please look tapestry\examples\Workbench\src\java\org\apache\tapestry\workbench\chart\ChartAsset.java
> 
> 
> Thanks
> 
> Jun Tsai
> 
> 
> 2006/2/6, Shing Hing Man <ma...@yahoo.com>:
>> You can inject a service into your page :
>>
>> @InjectObject("engine-service:chart")
>> public abstract IEngineService getChartService();
>>
>> where chart is a custom service defined in
>> hivemind.xml . Something like :
>>  <service-point id="chart"
>> interface="org.apache.tapestry.engine.IEngineService">
>>     <invoke-factory>
>>       <construct class="services.ChartService">
>>         <set-object property="exceptionReporter"
>> value="infrastructure:requestExceptionReporter"/>
>>         <set-object property="response"
>> value="infrastructure:response"/>
>>         <set-object property="linkFactory"
>> value="infrastructure:linkFactory"/>
>>                  <set-object property="daoFactory"
>> value="service:daoFactory"/>
>>        </construct>
>>     </invoke-factory>
>>   </service-point>
>>
>> InjectObject is documented here :
>> http://jakarta.apache.org/tapestry/UsersGuide/hivemind.html#hivemind.inject
>>
>>
>>
>> --- Jun Tsai <ju...@gmail.com> wrote:
>>
>>> hi all,
>>>     I find
>>>
>> cycle.getEngine().getService(BlobService.SERVICE_NAME);
>>> gerService method was deprected.I didn't find
>>> another method to get service?
>>>
>>> How to ?
>>>
>>> Thanks.
>>>
>>> Jun Tsai
>>> --
>>> Welcome to China Java Users Group(CNJUG).
>>> http://cnjug.dev.java.net
>>>
>>>
>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:
>>> tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:
>>> tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>> Home page :
>>   http://uk.geocities.com/matmsh/index.html
>>
>>
>>
>> ___________________________________________________________
>> Yahoo! Photos �C NEW, now offering a quality print service from just 8p a photo http://uk.photos.yahoo.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> --
> Welcome to China Java Users Group(CNJUG).
> http://cnjug.dev.java.net


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


Re: How to get service?

Posted by Jun Tsai <ju...@gmail.com>.
Thank you.
I want to inject the service in an asset class.

Please look tapestry\examples\Workbench\src\java\org\apache\tapestry\workbench\chart\ChartAsset.java


Thanks

Jun Tsai


2006/2/6, Shing Hing Man <ma...@yahoo.com>:
> You can inject a service into your page :
>
> @InjectObject("engine-service:chart")
> public abstract IEngineService getChartService();
>
> where chart is a custom service defined in
> hivemind.xml . Something like :
>  <service-point id="chart"
> interface="org.apache.tapestry.engine.IEngineService">
>     <invoke-factory>
>       <construct class="services.ChartService">
>         <set-object property="exceptionReporter"
> value="infrastructure:requestExceptionReporter"/>
>         <set-object property="response"
> value="infrastructure:response"/>
>         <set-object property="linkFactory"
> value="infrastructure:linkFactory"/>
>                  <set-object property="daoFactory"
> value="service:daoFactory"/>
>        </construct>
>     </invoke-factory>
>   </service-point>
>
> InjectObject is documented here :
> http://jakarta.apache.org/tapestry/UsersGuide/hivemind.html#hivemind.inject
>
>
>
> --- Jun Tsai <ju...@gmail.com> wrote:
>
> > hi all,
> >     I find
> >
> cycle.getEngine().getService(BlobService.SERVICE_NAME);
> > gerService method was deprected.I didn't find
> > another method to get service?
> >
> > How to ?
> >
> > Thanks.
> >
> > Jun Tsai
> > --
> > Welcome to China Java Users Group(CNJUG).
> > http://cnjug.dev.java.net
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > tapestry-user-help@jakarta.apache.org
> >
> >
>
>
> Home page :
>   http://uk.geocities.com/matmsh/index.html
>
>
>
> ___________________________________________________________
> Yahoo! Photos �C NEW, now offering a quality print service from just 8p a photo http://uk.photos.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


--
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net

Re: How to get service?

Posted by Shing Hing Man <ma...@yahoo.com>.
You can inject a service into your page :

@InjectObject("engine-service:chart")
public abstract IEngineService getChartService();

where chart is a custom service defined in
hivemind.xml . Something like : 
 <service-point id="chart"
interface="org.apache.tapestry.engine.IEngineService">
    <invoke-factory>
      <construct class="services.ChartService">
        <set-object property="exceptionReporter"
value="infrastructure:requestExceptionReporter"/>
        <set-object property="response"
value="infrastructure:response"/>
        <set-object property="linkFactory"
value="infrastructure:linkFactory"/>
		 <set-object property="daoFactory"
value="service:daoFactory"/> 
       </construct>
    </invoke-factory>
  </service-point>

InjectObject is documented here :
http://jakarta.apache.org/tapestry/UsersGuide/hivemind.html#hivemind.inject



--- Jun Tsai <ju...@gmail.com> wrote:

> hi all,
>     I find
>
cycle.getEngine().getService(BlobService.SERVICE_NAME);
> gerService method was deprected.I didn't find
> another method to get service?
> 
> How to ?
> 
> Thanks.
> 
> Jun Tsai
> --
> Welcome to China Java Users Group(CNJUG).
> http://cnjug.dev.java.net
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 


Home page :
  http://uk.geocities.com/matmsh/index.html


		
___________________________________________________________ 
Yahoo! Photos – NEW, now offering a quality print service from just 8p a photo http://uk.photos.yahoo.com

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