Project

General

Profile

Revision 8017

Added by Jing Tao over 7 years ago

Write the ids from metacat into a temporary file.

View differences:

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/IndexGenerator.java
314 314
        }*/
315 315
        
316 316
        log.info("the metacat ids (except the resource map ids)-----------------------------"+otherMetacatIds);
317
        logFile(otherMetacatIds);
317
        logFile(otherMetacatIds, "ids-for-timed-indexing-log");
318 318
        log.info("the deleted metacat ids (except the resource map ids)-----------------------------"+otherDeletedMetacatIds);
319 319
        log.info("the metacat resroucemap ids -----------------------------"+resourceMapIds);
320
        logFile(resourceMapIds);
320
        logFile(resourceMapIds, "ids-for-timed-indexing-log");
321 321
        log.info("the deleted metacat resroucemap ids -----------------------------"+resourceMapDeletedIds);
322 322
        index(otherMetacatIds);
323 323
        removeIndex(otherDeletedMetacatIds);
......
334 334
    /*
335 335
     * Write the docids which will be indexed into a file. 
336 336
     */
337
    private void logFile(List<String> ids)  {
337
    private void logFile(List<String> ids, String fileName)  {
338 338
        if(ids != null) {
339 339
            try {
340 340
                String tempDir = System.getProperty("java.io.tmpdir");
341 341
                log.info("the temp dir is ===================== "+tempDir);
342
                File idsForIndex = new File(tempDir, "ids-for-timed-indexing-log");
342
                File idsForIndex = new File(tempDir, fileName);
343 343
                if(!idsForIndex.exists()) {
344 344
                    idsForIndex.createNewFile();
345
                }
345
                } 
346
                
346 347
                Date date = Calendar.getInstance().getTime();
347 348
                SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd G 'at' HH:mm:ss z");
348 349
                String dateStr = format.format(date);
......
521 522
     */
522 523
    private List[] getMetacatIds(Date since, Date until) throws InvalidRequest, 
523 524
                        InvalidToken, NotAuthorized, NotImplemented, ServiceFailure, FileNotFoundException {
524
        
525
        String fileName = "ids-from-hazelcast";
525 526
        List<String> resourceMapIds = new ArrayList();
526 527
        List<String> resourceMapDeletedIds = new ArrayList();
527 528
        List<String> otherIds = new ArrayList();
......
539 540
        if(metacatIds != null) {
540 541
            for(Identifier identifier : metacatIds) {
541 542
                if(identifier != null && identifier.getValue() != null && !identifier.getValue().equals("")) {
543
                    List<String> idLog = new ArrayList<String>();
544
                    idLog.add(identifier.getValue());
545
                    logFile(idLog, fileName);
542 546
                    SystemMetadata sysmeta = getSystemMetadata(identifier.getValue());
543 547
                    if(sysmeta != null) {
544 548
                        ObjectFormatIdentifier formatId =sysmeta.getFormatId();

Also available in: Unified diff