Revision 7794
Added by Jing Tao over 11 years ago
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/event/IndexEvent.java | ||
---|---|---|
1 |
/** |
|
2 |
* '$RCSfile$' |
|
3 |
* Purpose: A class that gets Accession Number, check for uniqueness |
|
4 |
* and register it into db |
|
5 |
* Copyright: 2000 Regents of the University of California and the |
|
6 |
* National Center for Ecological Analysis and Synthesis |
|
7 |
* Authors: Jivka Bojilova, Matt Jones |
|
8 |
* |
|
9 |
* '$Author: leinfelder $' |
|
10 |
* '$Date: 2011-11-02 20:40:12 -0700 (Wed, 02 Nov 2011) $' |
|
11 |
* '$Revision: 6595 $' |
|
12 |
* |
|
13 |
* This program is free software; you can redistribute it and/or modify |
|
14 |
* it under the terms of the GNU General Public License as published by |
|
15 |
* the Free Software Foundation; either version 2 of the License, or |
|
16 |
* (at your option) any later version. |
|
17 |
* |
|
18 |
* This program is distributed in the hope that it will be useful, |
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
* GNU General Public License for more details. |
|
22 |
* |
|
23 |
* You should have received a copy of the GNU General Public License |
|
24 |
* along with this program; if not, write to the Free Software |
|
25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
26 |
*/ |
|
27 |
package edu.ucsb.nceas.metacat.index.event; |
|
28 |
|
|
29 |
import java.util.Date; |
|
30 |
|
|
31 |
import org.dataone.service.types.v1.Identifier; |
|
32 |
|
|
33 |
|
|
34 |
/** |
|
35 |
* A class represents an event for solr index. |
|
36 |
* @author tao |
|
37 |
* |
|
38 |
*/ |
|
39 |
public class IndexEvent { |
|
40 |
|
|
41 |
public static final int SUCCESSINSERT = 0; |
|
42 |
public static final int FAILUREINSERT = 6; |
|
43 |
public static final int SUCCESSDELETE = 12; |
|
44 |
public static final int FAILUREDELETE = 18; |
|
45 |
public static final int STARTTIMEDINDEX = 24; |
|
46 |
public static final int FINISHTIMEDINDEX = 30; |
|
47 |
private int type = -1; |
|
48 |
private Date date = null; |
|
49 |
private Identifier pid = null; |
|
50 |
private String description = null; |
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
/** |
|
55 |
* Get the type of the event. |
|
56 |
* @return the type of the event |
|
57 |
*/ |
|
58 |
public int getType() { |
|
59 |
return this.type; |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Set the type of the event |
|
64 |
* @param type |
|
65 |
*/ |
|
66 |
public void setType(int type) { |
|
67 |
this.type = type; |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* Get the date when the event happened |
|
72 |
* @return |
|
73 |
*/ |
|
74 |
public Date getDate() { |
|
75 |
return date; |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* Set the date when the event happened |
|
80 |
* @param date |
|
81 |
*/ |
|
82 |
public void setDate(Date date) { |
|
83 |
this.date = date; |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* Get the identifier of the data object involving the event |
|
88 |
* @return |
|
89 |
*/ |
|
90 |
public Identifier getPid() { |
|
91 |
return pid; |
|
92 |
} |
|
93 |
|
|
94 |
/** |
|
95 |
* Set the identifier of the data object involving the event. |
|
96 |
* @param pid |
|
97 |
*/ |
|
98 |
public void setPid(Identifier pid) { |
|
99 |
this.pid = pid; |
|
100 |
} |
|
101 |
|
|
102 |
/** |
|
103 |
* Get the description of the event |
|
104 |
* @return |
|
105 |
*/ |
|
106 |
public String getDescription() { |
|
107 |
return description; |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* Set the description of the event |
|
112 |
* @param description |
|
113 |
*/ |
|
114 |
public void setDescription(String description) { |
|
115 |
this.description = description; |
|
116 |
} |
|
117 |
} |
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/event/IndexEventLogException.java | ||
---|---|---|
1 |
package edu.ucsb.nceas.metacat.index.event; |
|
2 |
|
|
3 |
/** |
|
4 |
* A class represents the exception in the IndexEventLog process. |
|
5 |
* @author tao |
|
6 |
* |
|
7 |
*/ |
|
8 |
public class IndexEventLogException extends Exception{ |
|
9 |
|
|
10 |
/** |
|
11 |
* Constructor |
|
12 |
* @param message |
|
13 |
*/ |
|
14 |
public IndexEventLogException (String message) { |
|
15 |
super(message); |
|
16 |
} |
|
17 |
/** |
|
18 |
* Constructor |
|
19 |
* @param message |
|
20 |
* @param cause |
|
21 |
*/ |
|
22 |
public IndexEventLogException (String message, Exception cause) { |
|
23 |
super(message, cause); |
|
24 |
} |
|
25 |
} |
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/event/IndexEventLog.java | ||
---|---|---|
1 |
package edu.ucsb.nceas.metacat.index.event; |
|
2 |
|
|
3 |
import java.util.Date; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
import org.dataone.service.types.v1.Identifier; |
|
7 |
|
|
8 |
/** |
|
9 |
* An interface to store and query the IndexEvent. |
|
10 |
* @author tao |
|
11 |
* |
|
12 |
*/ |
|
13 |
public interface IndexEventLog { |
|
14 |
|
|
15 |
/** |
|
16 |
* Write an IndexEvent into a storage |
|
17 |
* @param event |
|
18 |
* @throws IndexEventLogException |
|
19 |
*/ |
|
20 |
public void write(IndexEvent event) throws IndexEventLogException; |
|
21 |
|
|
22 |
|
|
23 |
/** |
|
24 |
* Gets the list of IndexEvent matching the specified set of filters. The filter parameters can be null |
|
25 |
* @param type the type of the event |
|
26 |
* @param pid the identifier of the data object in the event |
|
27 |
* @param start the start time of the time range for query |
|
28 |
* @param end the end time of the time range for query |
|
29 |
* @return |
|
30 |
* @throws IndexEventLogException |
|
31 |
*/ |
|
32 |
public List<IndexEvent> getEvents(int type, Identifier pid, Date start, Date end) throws IndexEventLogException; |
|
33 |
} |
Also available in: Unified diff
Add a event and eventlog for the index.