Project

General

Profile

« Previous | Next » 

Revision 7805

Added by Jing Tao about 11 years ago

Add set and get the lastprocessedDate in the IndexEventLog.
Remove the code to write the successful event.

View differences:

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/event/IndexEvent.java
43 43
    private Date date = null;
44 44
    private Identifier pid = null;
45 45
    private String description = null;
46
    private boolean isArchived = false;
47
    private long serialNumber;
48 46
    
49 47
    
50
    
51
    /**
52
     * Get the serial number of this event
53
     * @return
54
     */
55
    public long getSerialNumber() {
56
        return serialNumber;
57
    }
48
  
58 49

  
59 50
    /**
60
     * Set the serial number for this event
61
     * @param serialNumber
62
     */
63
    public void setSerialNumber(long serialNumber) {
64
        this.serialNumber = serialNumber;
65
    }
66

  
67
    /**
68 51
     * Get the type of the event.
69 52
     * @return the type of the event
70 53
     */
......
128 111
        this.description = description;
129 112
    }
130 113
    
131
    /**
132
     * If the event has been archived.
133
     * @return true if it has been archived; otherwise false.
134
     */
135
    public boolean isArchived() {
136
        return isArchived;
137
    }
138

  
139
    /**
140
     * Set the event to be archived
141
     * @param isArchived
142
     */
143
    public void setArchived(boolean isArchived) {
144
        this.isArchived = isArchived;
145
    }
114
   
146 115
}
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/event/IndexEventFileLog.java
122 122
     * @return
123 123
     * @throws IndexEventLogException
124 124
     */
125
    public List<IndexEvent> getEvents(int type, Identifier pid, boolean archvied, Date start, Date end) throws IndexEventLogException {
125
    public List<IndexEvent> getEvents(int type, Identifier pid, Date start, Date end) throws IndexEventLogException {
126 126
        List<IndexEvent> list = null;
127 127
        return list;
128 128
    }
129 129
    
130
   
130 131
    /**
131
     * Set the event with the specified serial number to be archived
132
     * @param serialNumber
132
     * Get the list of identifiers which were failed to build the solr index since the 
133
     * previous timed indexing (including the ones in the timed indexing).
134
     * @return the list of failure identifiers. The null will be returned if no failure. 
133 135
     */
134
    public void setArchived(long serialNumber) throws IndexEventLogException {
135
        
136
    public List<Identifier> getFailedPids() throws IndexEventLogException {
137
        return null;
136 138
    }
137 139
    
140
    
138 141
    /**
139
     * Set the all events with the specified identifier to be archived
140
     * @param pid
142
     * Get the latest SystemMetadata modification Date of the objects that were built
143
     * the solr index during the previous timed indexing process.
144
     * @return the date. The null will be returned if there is no such date.
145
     * @throws IndexEventLogException
141 146
     */
142
    public void setArchived(Identifier pid) throws IndexEventLogException {
147
    public Date getLastProcessDate() throws IndexEventLogException {
148
        return null;
149
    }
150
    
151
    
152
    /**
153
     * Set the SystemMetadata modification Date of the objects that were built
154
     * the solr index during the previous timed indexing process.
155
     * @throws IndexEventLogException
156
     */
157
    public void setLastProcessDate(Date date) throws IndexEventLogException {
143 158
        
144 159
    }
145 160
}
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/event/IndexEventLog.java
51 51
     * @return
52 52
     * @throws IndexEventLogException
53 53
     */
54
    public List<IndexEvent> getEvents(int type, Identifier pid, boolean archvied, Date start, Date end) throws IndexEventLogException;
54
    public List<IndexEvent> getEvents(int type, Identifier pid, Date start, Date end) throws IndexEventLogException;
55 55
    
56 56
    /**
57
     * Set the event with the specified serial number to be archived
58
     * @param serialNumber
57
     * Get the list of identifiers which were failed to build the solr index since the 
58
     * previous timed indexing (including the ones in the timed indexing).
59
     * @return the list of failure identifiers. The null will be returned if no failure. 
59 60
     */
60
    public void setArchived(long serialNumber) throws IndexEventLogException;
61
    public List<Identifier> getFailedPids() throws IndexEventLogException;
61 62
    
63
    
62 64
    /**
63
     * Set the all events with the specified identifier to be archived
64
     * @param pid
65
     * Get the latest SystemMetadata modification Date of the objects that were built
66
     * the solr index during the previous timed indexing process.
67
     * @return the date. The null will be returned if there is no such date.
68
     * @throws IndexEventLogException
65 69
     */
66
    public void setArchived(Identifier pid) throws IndexEventLogException;
70
    public Date getLastProcessDate() throws IndexEventLogException;
71
    
72
    
73
    /**
74
     * Set the SystemMetadata modification Date of the objects that were built
75
     * the solr index during the previous timed indexing process.
76
     * @throws IndexEventLogException
77
     */
78
    public void setLastProcessDate(Date date) throws IndexEventLogException;
79
 
67 80
}
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/SolrIndex.java
401 401
                try {
402 402
                    UpdateResponse response = solrServer.add(solrDoc);
403 403
                    solrServer.commit();
404
                    event.setType(IndexEvent.SUCCESSINSERT);
404
                    /*event.setType(IndexEvent.SUCCESSINSERT);
405 405
                    event.setDescription("Successfully insert the solr index for the id "+pid.getValue());
406 406
                    try {
407 407
                        EventlogFactory.createIndexEventLog().write(event);
408 408
                    } catch (Exception e) {
409 409
                        log.error("SolrIndex.insertToIndex - IndexEventLog can't log the index inserting event :"+e.getMessage());
410
                    }
410
                    }*/
411 411
                } catch (SolrServerException e) {
412 412
                    event.setType(IndexEvent.FAILUREINSERT);
413 413
                    event.setDescription("Failed to insert the solr index for the id "+pid.getValue()+" since "+e.getMessage());
......
632 632
            try {
633 633
                solrServer.deleteById(pid);
634 634
                solrServer.commit();
635
                event.setType(IndexEvent.SUCCESSDELETE);
635
                /*event.setType(IndexEvent.SUCCESSDELETE);
636 636
                event.setDescription("Successfully remove the solr index for the id "+identifier.getValue());
637 637
                try {
638 638
                    EventlogFactory.createIndexEventLog().write(event);
639 639
                } catch (Exception e) {
640 640
                    log.error("SolrIndex.removeFromIndex - IndexEventLog can't log the index deleting event :"+e.getMessage());
641
                }
641
                }*/
642 642
            } catch (SolrServerException e) {
643 643
                event.setType(IndexEvent.FAILUREDELETE);
644 644
                event.setDescription("Failurely remove the solr index for the id "+identifier.getValue()+" since "+e.getMessage());
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/IndexGenerator.java
220 220
    }
221 221
    
222 222
    public void run() {
223
        IndexEvent event = new IndexEvent();
223
        /*IndexEvent event = new IndexEvent();
224 224
        event.setDate(Calendar.getInstance().getTime());
225 225
        event.setType(IndexEvent.STARTTIMEDINDEX);
226 226
        event.setDescription("Start the timed index job");
......
228 228
            EventlogFactory.createIndexEventLog().write(event);
229 229
        } catch (Exception e) {
230 230
            log.error("IndexGenerator.run - IndexEventLog can't log the timed indexing start event :"+e.getMessage());
231
        }
231
        }*/
232 232
        try {
233 233
            
234 234
            indexAll();
......
258 258
        } catch (FileNotFoundException e) {
259 259
            log.error("IndexGenerator.run - Metadata-Index couldn't generate indexes for those documents which haven't been indexed : "+e.getMessage());
260 260
        }
261
        event.setDate(Calendar.getInstance().getTime());
261
        /*event.setDate(Calendar.getInstance().getTime());
262 262
        event.setType(IndexEvent.FINISHTIMEDINDEX);
263 263
        event.setDescription("Finish the timed index job");
264 264
        try {
265 265
            EventlogFactory.createIndexEventLog().write(event);
266 266
        } catch (Exception e) {
267 267
            log.error("IndexGenerator.run - IndexEventLog can't log the timed indexing finish event :"+e.getMessage());
268
        }
268
        }*/
269 269
    }
270 270
    
271 271
    /*

Also available in: Unified diff