public synchronized RegistryHandler getInstance() { if (!initialized) { try { // Load the system dependant handler. registryHandler = factory.makeObject(RegistryHandler.class); } catch (Throwable exception) { log.log(Level.WARNING, "Failed to create RegistryHandler: " + exception.getMessage(), exception); } initialized = true; } return (registryHandler); } }
/** * Constructs a <tt>Librarian</tt>. * * @param factory the factory * @param housekeeper the house keeper */ public Librarian(TargetFactory factory, Housekeeper housekeeper) { housekeeper.registerForCleanup(this); extension = '.' + factory.getNativeLibraryExtension(); }
Platforms platforms = new Platforms(); Platform platform = platforms.getCurrentPlatform(); TargetFactory factory = new TargetFactory(new DefaultTargetPlatformFactory(dummy, platform, platforms)); Librarian librarian = new Librarian(factory, new Housekeeper()); System.out.println("(Java) Opening new file queue...");
try shortcutSpec = resources.getInputStream(TargetFactory.getCurrentOSPrefix() + SPEC_FILE_NAME);
/** * This method returns an OS specific instance of the requested class. * <p/> * This implementation delegates to {@link DefaultTargetPlatformFactory}, falling back to {@link #makeObject(String)} * if the call fails. * * @param clazz the * @return an OS specific instance of <tt>clazz</tt> * @throws Exception for any error */ @SuppressWarnings("unchecked") public <T> T makeObject(Class<T> clazz) throws Exception { T result; try { result = factory.create(clazz); } catch (Exception e) { logger.log(Level.WARNING, e.getMessage(), e); result = (T) makeObject(clazz.getName()); } return result; } /*--------------------------------------------------------------------------*/
/** * Constructs a <tt>ShortcutPanelLogic</tt>. * * @param installData the installation data * @param resources the resources * @param uninstallData the uninstallation data * @param housekeeper the house keeper * @param factory the factory for platform-specific implementations * @param matcher the platform-model matcher * @throws Exception for any error */ public ShortcutPanelLogic(InstallData installData, Resources resources, UninstallData uninstallData, Housekeeper housekeeper, TargetFactory factory, InstallerListeners listeners, PlatformModelMatcher matcher) throws Exception { this.matcher = matcher; this.resources = resources; this.installData = installData; this.uninstallData = uninstallData; this.shortcut = factory.makeObject(Shortcut.class); this.shortcut.initialize(Shortcut.APPLICATIONS, "-"); if (!isCreateShortcutsImmediately()) { listeners.add(new LateShortcutInstallListener()); } this.defaultGroup = new Vector<String>(); defaultGroup.add(DEFAULT_FOLDER); housekeeper.registerForCleanup(this); }