DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
Hivemind for Beginners
hivemind configuration file location
Hivemind is configured through an xml file called hivemodule.xml. Tapestry configures hivemind to look for this file in three different places. All can be used simultaniously or alternatively:
- hivemind will load all
/META-INF
on the classpath. this includes all classes directories and jar files./META-INF/hivemodule.xml
<context>/WEB-INF/
- practical if you have more than one tapestry application in the same context and you don't wish them to share certain hivemind configuration.
<context>/WEB-INF/<app-name>/
creating a service
Here is a simple example of the
hivemodule.xml
.
<?xml version="1.0"?>
<module id="moduleid" version ="1.0.0" package="package.name">
<service-point id="ServiceId"
interface="interface.name.relative.to.package.or.absolute">
<invoke-factory>
<construct
class="implementation.class.name.relative.to.package.or.absolute"/>
</invoke-factory>
</service-point>
</module>
alternativley, you can separate <service-point> as an empty element, and use the <invoke-factory> element in an...
<implementation service-id="ServiceId"> <invoke-factory... </implementation>
To use your service in tapestry components or pages you "inject" it, using the following syntax (in the .jwc or .page file)
<inject object="service:moduleid.ServiceId" property="nameOfProperty"/>
If you want to use annotations, use:
@InjectObject("service:moduleid.ServiceId")
public abstract ServiceInterface getXXX();
notes
- the above syntax creates a singleton service, which means, your service will be instanciated once and will be used from all threads of the application. Hivemind offers 4 instaciation models. To use them, use the
modelattribute of the<invoke-factory>element. See here for details. - All module/services names are case sensitive.
Referencing other files from hivemodule.xml
<sub-module descriptor="relative.path.to.another.module.description.xml"/>