Hello all, I've been spinning my wheels over this all day. I have 2 things I'm trying to accomplish: 1- Wire up Hivemind to get singleton and inject it into my page. 2- If necessary, since I can not serialize my providers, data squeeze the singleton.
Essentially, I call a synchronized current() method on a provider (with a private constructor), which returns the singleton. My provider implements a factory interface used to build the object returned. This is where I'm at...please see if you can help! hivemodule.xml <service-point id="report" interface="com.myApp.ReportFactory"/> <implementation service-id="reportMap"> <invoke-factory model="singleton"> <construct class="com.myApp.ReportProvider" initialize-method="current"/> </invoke-factory> </implementation> MyPage.page <inject object="service:myReportingApp.reportMap" property="provider"/> MyPage.java public abstract AdminReportMapFactory getProvider(); ReportProvider .java public class ReportProvider implements ReportFactory { private static ReportProvider current = null; private ReportProvider() { // default constructor - needs to be private to enforce singleton nature super(); } /** * Get the singleton instance * @return ReportProvider */ public static synchronized ReportProvider current() { if (current == null) { current = new ReportProvider(); } return current; } public List lookup(String name, String reportID) { return getFactory().lookupReportID(name, reportID); } private ReportFactory getFactory() { return ReportFactoryImpl.getInstance(); }