You let HiveMind inject stuff into your service that runs at startup:
[code]public class MyStartupClass implements Runnable
{
private MyService myService;
public void setMyService( MyService myService )
{
this.myService = myService;
}
public void run()
{
myService.doSomethingThatMyServiceDoes();
}
}[/code]
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:
[code]<service-point id="SomeIdYouChoose" interface="java.lang.Runnable">
<invoke-factory>
<construct class="com.myco.somepackage.MyStartupClass" />
</invoke-factory>
</service-point>[/code]
Then, register your service with the startup configuration point:
[code]<contribution configuration-id="hivemind.Startup">
<startup object="service:SomeIdYouChoose" />
</contribution>[/code]
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)
[code]public class MyStartupClass implements Runnable
{
private MyService myService;
public void setMyService( MyService myService )
{
this.myService = myService;
}
public void run()
{
myService.doSomethingThatMyServiceDoes();
}
}[/code]
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:
[code]<service-point id="SomeIdYouChoose" interface="java.lang.Runnable">
<invoke-factory>
<construct class="com.myco.somepackage.MyStartupClass" />
</invoke-factory>
</service-point>[/code]
Then, register your service with the startup configuration point:
[code]<contribution configuration-id="hivemind.Startup">
<startup object="service:SomeIdYouChoose" />
</contribution>[/code]
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)