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 <[EMAIL PROTECTED]>:
>> 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 <[EMAIL PROTECTED]> 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:
>>> [EMAIL PROTECTED]
>>> For additional commands, e-mail:
>>> [EMAIL PROTECTED]
>>>
>>>
>>
>> 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: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> --
> Welcome to China Java Users Group(CNJUG).
> http://cnjug.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]