package com.onaro.sanscreen.client.help; /** * Class that instantiates HelpManager objects. This class looks for a system property that is set to the name of a implementation * of the IHelpManager interface. * * @author rnoel * */ public class HelpManagerFactory { /* The name of the system property holding the IHelpManager implementation class */ private static final String HELP_MANAGER_CLASS_NAME = "help.manager.class"; //$NON-NLS-1$ // Singleton private static final HelpManagerFactory INSTANCE = new HelpManagerFactory(); private IHelpManager helpManager;// Single help manager private HelpManagerFactory() { //TODO: make this an extension point of a new help plugin. String helpManagerClassName = System.getProperty(HELP_MANAGER_CLASS_NAME, "com.onaro.sanscreen.client.help.HelpManager"); //$NON-NLS-1$ if(helpManagerClassName != null) { try { @SuppressWarnings("unchecked") Class cl = (Class)Class.forName(helpManagerClassName); helpManager = cl.newInstance(); } catch(Exception e) { // Report and create default help manager that does nothing e.printStackTrace(); System.out.println("Online help will not be functional."); //$NON-NLS-1$ } } if(helpManager == null) { helpManager = new DefaultHelpManager(); } } public static IHelpManager getHelpManager() { return(INSTANCE.helpManager); } }