public DictionaryInfo getDictionaryInfo(String resourcePath) throws IOException { DictionaryInfo dictInfo = dictCache.get(resourcePath); if (dictInfo == null) { dictInfo = load(resourcePath, true); if (dictInfo == null) dictInfo = NONE_INDICATOR; dictCache.put(resourcePath, dictInfo); } return dictInfo == NONE_INDICATOR ? null : dictInfo; }
private String checkDupByContent(DictionaryInfo dictInfo, Dictionary<?> dict) throws IOException { ResourceStore store = MetadataManager.getInstance(config).getStore(); ArrayList<String> existings = store.listResources(dictInfo.getResourceDir()); if (existings == null) return null; for (String existing : existings) { logger.info("Checking dup dict :" + existing); DictionaryInfo existingInfo = load(existing, true); // skip cache, // direct load // from store if (existingInfo == null) logger.info("existingInfo is null"); if (existingInfo != null && dict.equals(existingInfo.getDictionaryObject())) return existing; } return null; }
private String checkDupByInfo(DictionaryInfo dictInfo) throws IOException { ResourceStore store = MetadataManager.getInstance(config).getStore(); ArrayList<String> existings = store.listResources(dictInfo.getResourceDir()); if (existings == null) return null; TableSignature input = dictInfo.getInput(); for (String existing : existings) { DictionaryInfo existingInfo = load(existing, false); // skip cache, // direct // load from // store if (input.equals(existingInfo.getInput())) return existing; } return null; }
@Override public DictionaryInfo load(String key) throws Exception { DictionaryInfo dictInfo = DictionaryManager.this.load(key, true); if (dictInfo == null) { return NONE_INDICATOR; } else { return dictInfo; } } });
private String checkDupByContent(DictionaryInfo dictInfo, Dictionary<?> dict) throws IOException { ResourceStore store = MetadataManager.getInstance(config).getStore(); ArrayList<String> existings = store.listResources(dictInfo.getResourceDir()); if (existings == null) return null; for (String existing : existings) { logger.info("Checking dup dict :" + existing); DictionaryInfo existingInfo = load(existing, true); // skip cache, direct load from store if (existingInfo == null) logger.info("existingInfo is null"); if (existingInfo != null && dict.equals(existingInfo.getDictionaryObject())) return existing; } return null; }
private String checkDupByInfo(DictionaryInfo dictInfo) throws IOException { ResourceStore store = MetadataManager.getInstance(config).getStore(); ArrayList<String> existings = store.listResources(dictInfo.getResourceDir()); if (existings == null) return null; TableSignature input = dictInfo.getInput(); for (String existing : existings) { DictionaryInfo existingInfo = load(existing, false); // skip cache, direct load from store if (input.equals(existingInfo.getInput())) return existing; } return null; }