Revision 6178
Added by Chris Jones over 13 years ago
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java | ||
---|---|---|
26 | 26 |
import java.io.InputStream; |
27 | 27 |
import java.util.Date; |
28 | 28 |
|
29 |
import org.apache.log4j.Logger; |
|
29 | 30 |
import org.dataone.service.cn.CNAuthorization; |
30 | 31 |
import org.dataone.service.cn.CNCore; |
31 | 32 |
import org.dataone.service.cn.CNIdentity; |
... | ... | |
75 | 76 |
public class CNodeService extends D1NodeService implements CNAuthorization, |
76 | 77 |
CNCore, CNIdentity, CNRead, CNRegister, CNReplication { |
77 | 78 |
|
79 |
/* the instance of the CNodeService object */ |
|
80 |
private static CNodeService instance = null; |
|
81 |
|
|
82 |
/* the logger instance */ |
|
83 |
private Logger logMetacat = null; |
|
78 | 84 |
|
79 |
/** |
|
80 |
* Constructor: create a CNodeService instance |
|
81 |
* TODO: should we make this a singleton class like CNCoreImpl? |
|
82 |
*/ |
|
83 |
public CNodeService() { |
|
84 |
super(); |
|
85 |
/** |
|
86 |
* singleton accessor |
|
87 |
*/ |
|
88 |
public static CNodeService getInstance() |
|
89 |
{ |
|
90 |
if (instance == null) { |
|
91 |
instance = new CNodeService(); |
|
92 |
} |
|
85 | 93 |
|
86 |
} |
|
87 |
|
|
88 |
|
|
94 |
return instance; |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* Constructor, private for singleton access |
|
99 |
*/ |
|
100 |
private CNodeService() { |
|
101 |
super(); |
|
102 |
logMetacat = Logger.getLogger(CNodeService.class); |
|
103 |
|
|
104 |
} |
|
105 |
|
|
89 | 106 |
/** |
90 | 107 |
* Set the replication policy for an object given the object identifier |
91 | 108 |
* |
Also available in: Unified diff
Add a static getInstance() method to CNodeService and make CNodeService a singleton.