Created
October 8, 2010 02:48
-
-
Save brianhsu/616295 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void swapIndex(String server) throws Exception { | |
| SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHH"); | |
| // 取得152端的檔案清單 | |
| File Lucenelocal = new File(dataStore.getLuceneIndex()); | |
| LinkedHashSet<String> LuceneIndex152Set = new LinkedHashSet<String>(); | |
| for (String file : Lucenelocal.list()) { | |
| LuceneIndex152Set.add(file); | |
| } | |
| // 取得152端的檔案清單 | |
| File CatalogLocal = new File(dataStore.getCatalogIndex()); | |
| LinkedHashSet<String> CatalogIndex152Set = new LinkedHashSet<String>(); | |
| for (String file : CatalogLocal.list()) { | |
| CatalogIndex152Set.add(file); | |
| } | |
| // 取得Server端的檔案清單 | |
| client.setWorkingDirectory(dataStore.getRMTIndexTemp()); | |
| String[] LuceneIndexServer = client.getFileNames(); | |
| // 取得Server端的檔案清單 | |
| client.setWorkingDirectory(dataStore.getRMTCatIndexTMP()); | |
| String[] CatalogIndexServer = client.getFileNames(); | |
| boolean lucene = false; | |
| boolean catalog = false; | |
| // 比對Lucene Index是否相同 | |
| if (LuceneIndex152Set.size() == LuceneIndexServer.length | |
| && LuceneIndexServer.length != 0) { | |
| for (String file : LuceneIndexServer) { | |
| if (!LuceneIndex152Set.contains(file)) { | |
| lucene = false; | |
| break; | |
| } | |
| lucene = true; | |
| } | |
| } | |
| // 比對CatalogIndex是否相同 | |
| if (CatalogIndex152Set.size() == CatalogIndexServer.length | |
| && CatalogIndexServer.length != 0) { | |
| for (String file : CatalogIndexServer) { | |
| if (!CatalogIndex152Set.contains(file)) { | |
| lucene = false; | |
| break; | |
| } | |
| catalog = true; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment