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)
分享到:
相关推荐
When you work with a computer, you can do several things at once. You can hear music while you edit a document in a word processor and read your e-mail. This can be done because your operating system ...
It's analogous to editing a document by hand when you'd like to write a script to do the work for you. Graphical browsers require you to navigate the Web manually. In an effort to diminish the ...
This book is written for anyone who needs to know how to analyze data using Hadoop. It is a good book for both Hadoop beginners and those in need of advancing their Hadoop skills. The author has ...
The benefit of a column maker is that it can help you to format your text/code, or in some cases to make it easier to read in complex nested logic. Quick Open UltraEdit and UEStudio provide multiple ...
Why spend months or years discovering the best ways to design and code C# when this book will show you how to do things the right way from the start? * Comprehensively and concisely explains both C#...
14. If the two ISPs do not peer with each other, then when they send traffic to each other they have to send the traffic through a provider ISP (intermediary), to which they have to pay for carrying ...
* When TDropFileTarget.GetDataOnEnter is set to True, the component doesn't work with WinZip. Although the file names are received correctly by TDropFileTarget, WinZip doesn't extract the files and...
the management of what data to store and how to keep it consistent with the applicable rules is usually performed by the application code itself. Therefore, very little management activity that is ...
Grunt, along with its wide range of plugins, provides a simple way of managing the large number of build tasks required to maintain a sophisticated web application. Getting Started with Grunt: The ...
Why spend months or years discovering the best ways to design and code C# when this book will show you how to do things the right way from the start? Comprehensively and concisely explains both C# ...
The ggplot section notes the library’s historical relationship with R and the Grammar of Graphics and illustrates how to use ggplot to build some common statistical plots. Finally, the seaborn ...
The vision is “To produce the best UNIX-like operating system package possible, with due respect to the original software tools ideology as well as usability, performance and stability.” The ...
Why spend months or years discovering the best ways to design and code C# when this book will show you how to do things the right way, right from the start? Comprehensively and concisely explains ...
The first part of the API is the focus of this course --basically, how to send and receive messages independent of the provider/protocol. * The second part speaks the protocol-specific languages, ...
Ideally, one should check VsIsReady() using a timer or the like to wait efficiently, so that the host PC is free to do other tasks while waiting for the VariSpec. The VariSpec always processes each ...
Discover how much easier and more fun iOS development is when you know the secrets of the tools. About the Pragmatic Bookshelf Contents What Readers Are Saying About Xcode Treasures Acknowledgments ...
you will learn When to use a distributed architecture When and how to use EJB How to develop an efficient data access strategy How to design a clean and maintainable web interface How to design J2EE ...