1 |
7800
|
tao
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Purpose: A class which creates a instance of an IndexEventLog.
|
4 |
|
|
* Copyright: 2013 Regents of the University of California and the
|
5 |
|
|
* National Center for Ecological Analysis and Synthesis
|
6 |
|
|
* Authors: Jing Tao
|
7 |
|
|
*
|
8 |
|
|
* This program is free software; you can redistribute it and/or modify
|
9 |
|
|
* it under the terms of the GNU General Public License as published by
|
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
11 |
|
|
* (at your option) any later version.
|
12 |
|
|
*
|
13 |
|
|
* This program is distributed in the hope that it will be useful,
|
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
* GNU General Public License for more details.
|
17 |
|
|
*
|
18 |
|
|
* You should have received a copy of the GNU General Public License
|
19 |
|
|
* along with this program; if not, write to the Free Software
|
20 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
21 |
|
|
*/
|
22 |
|
|
package edu.ucsb.nceas.metacat.index.event;
|
23 |
|
|
|
24 |
|
|
import org.dataone.configuration.Settings;
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
/**
|
28 |
|
|
* A class which creates a instance of an IndexEventLog.
|
29 |
|
|
* This class will read the metacat.properties file and create a instance of the EventLog.
|
30 |
|
|
* @author tao
|
31 |
|
|
*
|
32 |
|
|
*/
|
33 |
|
|
public class EventlogFactory {
|
34 |
|
|
private static IndexEventLog eventLog = null;
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
/**
|
38 |
|
|
* Create an IndexEventLog. This is a singleton object.
|
39 |
|
|
* @return
|
40 |
|
|
* @throws ClassNotFoundException
|
41 |
|
|
* @throws IllegalAccessException
|
42 |
|
|
* @throws InstantiationException
|
43 |
|
|
*/
|
44 |
|
|
public static IndexEventLog createIndexEventLog() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
|
45 |
|
|
if(eventLog == null) {
|
46 |
7813
|
leinfelder
|
String className = Settings.getConfiguration().getString("index.eventlog.classname");
|
47 |
7800
|
tao
|
Class<?> classObj = Class.forName(className);
|
48 |
|
|
eventLog = (IndexEventLog)classObj.newInstance();
|
49 |
|
|
}
|
50 |
|
|
return eventLog;
|
51 |
|
|
}
|
52 |
|
|
}
|