You let HiveMind inject stuff into your service that runs at startup:

public class MyStartupClass implements Runnable
{
 private MyService myService;

 public void setMyService( MyService myService )
 {
   this.myService = myService;
 }

 public void run()
 {
   myService.doSomethingThatMyServiceDoes();
 }
}



HiveMind will "autowire" the MyService object into your MyStartupClass object (unless there is more than one service point within your HiveMind registry which implements the MyService interface). Then, declare your service point in the HiveMind module:

<service-point id="SomeIdYouChoose" interface="java.lang.Runnable">
 <invoke-factory>
   <construct class="com.myco.somepackage.MyStartupClass" />
 </invoke-factory>
</service-point>


Then, register your service with the startup configuration point:

<contribution configuration-id="hivemind.Startup">
 <startup object="service:SomeIdYouChoose" />
</contribution>

That's it! Your Runnable class will now run upon registry startup (creation), which happens in a Tapestry application when the application servlet starts up.

From James Carman(james@carmanconsulting.com)
评论
发表评论

您还没有登录,请登录后发表评论

tapestry
搜索本博客
最近加入圈子
存档
最新评论