/** * Constructs a server manager. * * @param store * @param rscManager */ public EntryStore(final IdvObjectStore store, final IdvResourceManager rscManager) { notNull(store); notNull(rscManager); this.idvStore = store; this.trie = new PatriciaTrie<>(new CharSequenceKeyAnalyzer()); this.ADDE_DIRECTORY = getAddeRootDirectory(); this.ADDE_BIN = ADDE_DIRECTORY + File.separator + "bin"; this.ADDE_DATA = ADDE_DIRECTORY + File.separator + "data"; this.localPort = Constants.LOCAL_ADDE_PORT; this.restartingMcserv = false; this.lastAdded = arrList(); AnnotationProcessor.process(this); McIDASV mcv = McIDASV.getStaticMcv(); USER_DIRECTORY = mcv.getUserDirectory(); ADDE_RESOLV = mcv.getUserFile("RESOLV.SRV"); MCTRACE = "0"; if (McIDASV.isWindows()) { ADDE_MCSERVL = ADDE_BIN + "\\mcservl.exe"; } else { ADDE_MCSERVL = ADDE_BIN + "/mcservl"; } try { Set<LocalAddeEntry> locals = EntryTransforms.readResolvFile(ADDE_RESOLV); putEntries(trie, locals); } catch (IOException e) { logger.warn("EntryStore: RESOLV.SRV missing; expected=\"" + ADDE_RESOLV + '"'); } XmlResourceCollection userResource = rscManager.getXmlResources(ResourceManager.RSC_NEW_USERSERVERS); XmlResourceCollection sysResource = rscManager.getXmlResources(IdvResourceManager.RSC_ADDESERVER); Set<AddeEntry> systemEntries = extractResourceEntries(EntrySource.SYSTEM, sysResource); Set<AddeEntry> prefEntries = extractPreferencesEntries(store); prefEntries = removeDeletedSystemEntries(prefEntries, systemEntries); Set<AddeEntry> userEntries = extractUserEntries(userResource); userEntries = removeDeletedSystemEntries(userEntries, systemEntries); putEntries(trie, prefEntries); putEntries(trie, userEntries); putEntries(trie, systemEntries); saveEntries(); }
/** * Attempts to launch the browser pointed at by the {@literal "idv.browser.path"} IDV property, if * it has been set. * * @param url URL to open. * @return Either {@code true} if the command-line was executed, {@code false} if either the * command-line wasn't launched or {@literal "idv.browser.path"} was not set. */ private static boolean tryUserSpecifiedBrowser(final String url) { McIDASV mcv = McIDASV.getStaticMcv(); boolean retVal = false; if (mcv != null) { String browserPath = mcv.getProperty("idv.browser.path", (String) null); if ((browserPath != null) && !browserPath.trim().isEmpty()) { try { Runtime.getRuntime().exec(browserPath + ' ' + url); retVal = true; } catch (Exception e) { LogUtil.logException("Executing browser: " + browserPath, e); } } } return retVal; }