1 |
6398
|
cjones
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Purpose: Implements a service for managing a Hazelcast cluster member
|
4 |
|
|
* Copyright: 2011 Regents of the University of California and the
|
5 |
|
|
* National Center for Ecological Analysis and Synthesis
|
6 |
|
|
* Authors: Christopher Jones
|
7 |
|
|
*
|
8 |
|
|
* '$Author$'
|
9 |
|
|
* '$Date$'
|
10 |
|
|
* '$Revision$'
|
11 |
|
|
*
|
12 |
|
|
* This program is free software; you can redistribute it and/or modify
|
13 |
|
|
* it under the terms of the GNU General Public License as published by
|
14 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
15 |
|
|
* (at your option) any later version.
|
16 |
|
|
*
|
17 |
|
|
* This program is distributed in the hope that it will be useful,
|
18 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
|
|
* GNU General Public License for more details.
|
21 |
|
|
*
|
22 |
|
|
* You should have received a copy of the GNU General Public License
|
23 |
|
|
* along with this program; if not, write to the Free Software
|
24 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
25 |
|
|
*/
|
26 |
|
|
|
27 |
6399
|
leinfelder
|
package edu.ucsb.nceas.metacat.dataone.hazelcast;
|
28 |
6398
|
cjones
|
|
29 |
6489
|
leinfelder
|
import java.io.FileNotFoundException;
|
30 |
6459
|
leinfelder
|
import java.util.Collection;
|
31 |
|
|
import java.util.Date;
|
32 |
6859
|
cjones
|
import java.util.concurrent.locks.Lock;
|
33 |
6459
|
leinfelder
|
|
34 |
6398
|
cjones
|
import org.apache.log4j.Logger;
|
35 |
6446
|
leinfelder
|
import org.dataone.service.types.v1.Identifier;
|
36 |
|
|
import org.dataone.service.types.v1.Node;
|
37 |
|
|
import org.dataone.service.types.v1.NodeReference;
|
38 |
|
|
import org.dataone.service.types.v1.SystemMetadata;
|
39 |
6398
|
cjones
|
|
40 |
6401
|
cjones
|
import com.hazelcast.config.Config;
|
41 |
6437
|
leinfelder
|
import com.hazelcast.config.FileSystemXmlConfig;
|
42 |
6446
|
leinfelder
|
import com.hazelcast.core.EntryEvent;
|
43 |
|
|
import com.hazelcast.core.EntryListener;
|
44 |
6398
|
cjones
|
import com.hazelcast.core.Hazelcast;
|
45 |
6711
|
cjones
|
import com.hazelcast.core.HazelcastInstance;
|
46 |
6446
|
leinfelder
|
import com.hazelcast.core.IMap;
|
47 |
6398
|
cjones
|
import com.hazelcast.core.InstanceEvent;
|
48 |
|
|
import com.hazelcast.core.InstanceListener;
|
49 |
6446
|
leinfelder
|
import com.hazelcast.core.Member;
|
50 |
|
|
import com.hazelcast.partition.Partition;
|
51 |
|
|
import com.hazelcast.partition.PartitionService;
|
52 |
6459
|
leinfelder
|
import com.hazelcast.query.EntryObject;
|
53 |
|
|
import com.hazelcast.query.Predicate;
|
54 |
|
|
import com.hazelcast.query.PredicateBuilder;
|
55 |
6398
|
cjones
|
|
56 |
6446
|
leinfelder
|
import edu.ucsb.nceas.metacat.IdentifierManager;
|
57 |
|
|
import edu.ucsb.nceas.metacat.McdbDocNotFoundException;
|
58 |
|
|
import edu.ucsb.nceas.metacat.dataone.D1NodeService;
|
59 |
6401
|
cjones
|
import edu.ucsb.nceas.metacat.properties.PropertyService;
|
60 |
6398
|
cjones
|
import edu.ucsb.nceas.metacat.shared.BaseService;
|
61 |
|
|
import edu.ucsb.nceas.metacat.shared.ServiceException;
|
62 |
6489
|
leinfelder
|
import edu.ucsb.nceas.utilities.FileUtil;
|
63 |
6446
|
leinfelder
|
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
|
64 |
6398
|
cjones
|
/**
|
65 |
|
|
* The Hazelcast service enables Metacat as a Hazelcast cluster member
|
66 |
|
|
*/
|
67 |
|
|
public class HazelcastService extends BaseService
|
68 |
6446
|
leinfelder
|
implements InstanceListener, EntryListener<Identifier, SystemMetadata> {
|
69 |
6398
|
cjones
|
|
70 |
6490
|
leinfelder
|
private static final String SINCE_PROPERTY = "dateSysMetadataModified";
|
71 |
6459
|
leinfelder
|
|
72 |
|
|
/* The instance of the logging class */
|
73 |
6398
|
cjones
|
private static Logger logMetacat = Logger.getLogger(HazelcastService.class);
|
74 |
|
|
|
75 |
|
|
/* The singleton instance of the hazelcast service */
|
76 |
6401
|
cjones
|
private static HazelcastService hzService = null;
|
77 |
6398
|
cjones
|
|
78 |
6401
|
cjones
|
/* The Hazelcast configuration */
|
79 |
|
|
private Config hzConfig;
|
80 |
6398
|
cjones
|
|
81 |
6446
|
leinfelder
|
/* The instance of the Hazelcast client */
|
82 |
6483
|
cjones
|
// private HazelcastClient hzClient;
|
83 |
6446
|
leinfelder
|
|
84 |
|
|
/* The name of the DataONE Hazelcast cluster group */
|
85 |
|
|
private String groupName;
|
86 |
|
|
|
87 |
|
|
/* The name of the DataONE Hazelcast cluster password */
|
88 |
|
|
private String groupPassword;
|
89 |
|
|
|
90 |
|
|
/* The name of the DataONE Hazelcast cluster IP addresses */
|
91 |
|
|
private String addressList;
|
92 |
|
|
|
93 |
|
|
/* The name of the node map */
|
94 |
|
|
private String nodeMap;
|
95 |
|
|
|
96 |
|
|
/* The name of the system metadata map */
|
97 |
|
|
private String systemMetadataMap;
|
98 |
|
|
|
99 |
|
|
/* The Hazelcast distributed task id generator namespace */
|
100 |
|
|
private String taskIds;
|
101 |
|
|
|
102 |
6462
|
cjones
|
/* The Hazelcast distributed node map */
|
103 |
6446
|
leinfelder
|
private IMap<NodeReference, Node> nodes;
|
104 |
|
|
|
105 |
|
|
/* The Hazelcast distributed system metadata map */
|
106 |
|
|
private IMap<Identifier, SystemMetadata> systemMetadata;
|
107 |
6711
|
cjones
|
|
108 |
|
|
private HazelcastInstance hzInstance;
|
109 |
6702
|
cjones
|
|
110 |
6398
|
cjones
|
/*
|
111 |
|
|
* Constructor: Creates an instance of the hazelcast service. Since
|
112 |
|
|
* this uses a singleton pattern, use getInstance() to gain the instance.
|
113 |
|
|
*/
|
114 |
|
|
private HazelcastService() {
|
115 |
|
|
|
116 |
|
|
super();
|
117 |
|
|
_serviceName="HazelcastService";
|
118 |
|
|
|
119 |
|
|
try {
|
120 |
6401
|
cjones
|
init();
|
121 |
6398
|
cjones
|
|
122 |
|
|
} catch (ServiceException se) {
|
123 |
6437
|
leinfelder
|
logMetacat.error("There was a problem creating the HazelcastService. " +
|
124 |
6398
|
cjones
|
"The error message was: " + se.getMessage());
|
125 |
|
|
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
}
|
129 |
|
|
|
130 |
|
|
/**
|
131 |
|
|
* Get the instance of the HazelcastService that has been instantiated,
|
132 |
|
|
* or instantiate one if it has not been already.
|
133 |
|
|
*
|
134 |
|
|
* @return hazelcastService - The instance of the hazelcast service
|
135 |
|
|
*/
|
136 |
|
|
public static HazelcastService getInstance(){
|
137 |
|
|
|
138 |
6401
|
cjones
|
if ( hzService == null ) {
|
139 |
6398
|
cjones
|
|
140 |
6401
|
cjones
|
hzService = new HazelcastService();
|
141 |
6398
|
cjones
|
|
142 |
|
|
}
|
143 |
6401
|
cjones
|
return hzService;
|
144 |
6398
|
cjones
|
}
|
145 |
|
|
|
146 |
|
|
/**
|
147 |
6401
|
cjones
|
* Initializes the Hazelcast service
|
148 |
6398
|
cjones
|
*/
|
149 |
6401
|
cjones
|
public void init() throws ServiceException {
|
150 |
6398
|
cjones
|
|
151 |
|
|
logMetacat.debug("HazelcastService.doRefresh() called.");
|
152 |
|
|
|
153 |
6489
|
leinfelder
|
String configFileName = null;
|
154 |
|
|
Config config = null;
|
155 |
|
|
try {
|
156 |
|
|
configFileName = PropertyService.getProperty("dataone.hazelcast.configFilePath");
|
157 |
|
|
config = new FileSystemXmlConfig(configFileName);
|
158 |
|
|
} catch (Exception e) {
|
159 |
|
|
logMetacat.warn("Custom Hazelcast configuration not defined, using default.", e);
|
160 |
|
|
configFileName = PropertyService.CONFIG_FILE_DIR + FileUtil.getFS() + "hazelcast.xml";
|
161 |
|
|
// make sure we have the config
|
162 |
|
|
try {
|
163 |
|
|
config = new FileSystemXmlConfig(configFileName);
|
164 |
|
|
} catch (FileNotFoundException e1) {
|
165 |
|
|
String msg = e.getMessage();
|
166 |
|
|
logMetacat.error(msg);
|
167 |
|
|
throw new ServiceException(msg);
|
168 |
|
|
}
|
169 |
|
|
}
|
170 |
|
|
|
171 |
|
|
Hazelcast.init(config);
|
172 |
6711
|
cjones
|
this.hzInstance = Hazelcast.getDefaultInstance();
|
173 |
|
|
|
174 |
6446
|
leinfelder
|
// Get configuration properties on instantiation
|
175 |
|
|
try {
|
176 |
|
|
groupName =
|
177 |
|
|
PropertyService.getProperty("dataone.hazelcast.processCluster.groupName");
|
178 |
|
|
groupPassword =
|
179 |
|
|
PropertyService.getProperty("dataone.hazelcast.processCluster.password");
|
180 |
|
|
addressList =
|
181 |
|
|
PropertyService.getProperty("dataone.hazelcast.processCluster.instances");
|
182 |
6483
|
cjones
|
// nodeMap =
|
183 |
|
|
// PropertyService.getProperty("dataone.hazelcast.processCluster.nodesMap");
|
184 |
6446
|
leinfelder
|
systemMetadataMap =
|
185 |
|
|
PropertyService.getProperty("dataone.hazelcast.storageCluster.systemMetadataMap");
|
186 |
|
|
|
187 |
|
|
// Become a DataONE-process cluster client
|
188 |
6483
|
cjones
|
// String[] addresses = addressList.split(",");
|
189 |
|
|
// hzClient =
|
190 |
|
|
// HazelcastClient.newHazelcastClient(this.groupName, this.groupPassword, addresses);
|
191 |
|
|
// nodes = hzClient.getMap(nodeMap);
|
192 |
6446
|
leinfelder
|
|
193 |
|
|
// Get a reference to the shared system metadata map as a cluster member
|
194 |
|
|
systemMetadata = Hazelcast.getMap(systemMetadataMap);
|
195 |
|
|
|
196 |
|
|
// Listen for changes to the system metadata map
|
197 |
|
|
systemMetadata.addEntryListener(this, true);
|
198 |
|
|
|
199 |
|
|
} catch (PropertyNotFoundException e) {
|
200 |
|
|
|
201 |
|
|
String msg = "Couldn't find Hazelcast properties for the DataONE clusters. " +
|
202 |
|
|
"The error message was: " + e.getMessage();
|
203 |
|
|
logMetacat.error(msg);
|
204 |
|
|
|
205 |
6401
|
cjones
|
}
|
206 |
6459
|
leinfelder
|
|
207 |
|
|
// make sure we have all metadata locally
|
208 |
|
|
try {
|
209 |
|
|
// add index for resynch() method
|
210 |
6490
|
leinfelder
|
// can only be added once, TODO: figure out how this works
|
211 |
|
|
//systemMetadata.addIndex(SINCE_PROPERTY, true);
|
212 |
|
|
//resynch();
|
213 |
6459
|
leinfelder
|
} catch (Exception e) {
|
214 |
|
|
String msg = "Problem synchronizing system metadata. " + e.getMessage();
|
215 |
|
|
logMetacat.error(msg, e);
|
216 |
|
|
}
|
217 |
6446
|
leinfelder
|
|
218 |
6398
|
cjones
|
}
|
219 |
|
|
|
220 |
6462
|
cjones
|
/**
|
221 |
|
|
* Get the system metadata map
|
222 |
|
|
*
|
223 |
|
|
* @return systemMetadata - the hazelcast map of system metadata
|
224 |
6703
|
cjones
|
* @param identifier - the identifier of the object as a string
|
225 |
6462
|
cjones
|
*/
|
226 |
6446
|
leinfelder
|
public IMap<Identifier,SystemMetadata> getSystemMetadataMap() {
|
227 |
|
|
return systemMetadata;
|
228 |
|
|
}
|
229 |
6714
|
leinfelder
|
|
230 |
|
|
/**
|
231 |
|
|
* When Metacat changes the underlying store, we need to refresh the
|
232 |
|
|
* in-memory representation of it.
|
233 |
|
|
* @param guid
|
234 |
|
|
*/
|
235 |
|
|
public void refreshSystemMetadataEntry(String guid) {
|
236 |
|
|
Identifier identifier = new Identifier();
|
237 |
|
|
identifier.setValue(guid);
|
238 |
|
|
// force hazelcast to update system metadata in memory from the store
|
239 |
|
|
HazelcastService.getInstance().getSystemMetadataMap().evict(identifier);
|
240 |
|
|
|
241 |
|
|
}
|
242 |
6702
|
cjones
|
|
243 |
6859
|
cjones
|
public Lock getLock(String identifier) {
|
244 |
6702
|
cjones
|
|
245 |
6859
|
cjones
|
Lock lock = null;
|
246 |
6702
|
cjones
|
|
247 |
|
|
try {
|
248 |
6711
|
cjones
|
lock = getInstance().getHazelcastInstance().getLock(identifier);
|
249 |
6702
|
cjones
|
|
250 |
|
|
} catch (RuntimeException e) {
|
251 |
|
|
logMetacat.info("Couldn't get a lock for identifier " +
|
252 |
6703
|
cjones
|
identifier + " !!");
|
253 |
6702
|
cjones
|
}
|
254 |
|
|
return lock;
|
255 |
|
|
|
256 |
|
|
}
|
257 |
6446
|
leinfelder
|
|
258 |
6462
|
cjones
|
/**
|
259 |
|
|
* Get the DataONE hazelcast node map
|
260 |
|
|
* @return nodes - the hazelcast map of nodes
|
261 |
|
|
*/
|
262 |
6483
|
cjones
|
// public IMap<NodeReference, Node> getNodesMap() {
|
263 |
|
|
// return nodes;
|
264 |
|
|
// }
|
265 |
6446
|
leinfelder
|
|
266 |
6398
|
cjones
|
/**
|
267 |
|
|
* Indicate whether or not this service is refreshable.
|
268 |
|
|
*
|
269 |
|
|
* @return refreshable - the boolean refreshable status
|
270 |
|
|
*/
|
271 |
|
|
public boolean refreshable() {
|
272 |
6401
|
cjones
|
// TODO: Determine the consequences of restarting the Hazelcast instance
|
273 |
6407
|
cjones
|
// Set this to true if it's okay to drop from the cluster, lose the maps,
|
274 |
|
|
// and start back up again
|
275 |
|
|
return false;
|
276 |
6398
|
cjones
|
|
277 |
|
|
}
|
278 |
|
|
|
279 |
|
|
/**
|
280 |
|
|
* Stop the HazelcastService. When stopped, the service will no longer
|
281 |
|
|
* respond to requests.
|
282 |
|
|
*/
|
283 |
|
|
public void stop() throws ServiceException {
|
284 |
|
|
|
285 |
|
|
Hazelcast.getLifecycleService().shutdown();
|
286 |
|
|
|
287 |
|
|
}
|
288 |
|
|
|
289 |
|
|
/**
|
290 |
|
|
* Listen for new Hazelcast member events
|
291 |
|
|
*/
|
292 |
6471
|
jones
|
@Override
|
293 |
6398
|
cjones
|
public void instanceCreated(InstanceEvent event) {
|
294 |
6407
|
cjones
|
logMetacat.info("New Hazelcast instance created: " +
|
295 |
|
|
event.getInstance().getId() + ", " +
|
296 |
|
|
event.getInstance().getInstanceType());
|
297 |
|
|
|
298 |
6398
|
cjones
|
}
|
299 |
|
|
|
300 |
6471
|
jones
|
@Override
|
301 |
6398
|
cjones
|
public void instanceDestroyed(InstanceEvent event) {
|
302 |
6407
|
cjones
|
logMetacat.info("Hazelcast instance removed: " +
|
303 |
|
|
event.getInstance().getId() + ", " +
|
304 |
|
|
event.getInstance().getInstanceType());
|
305 |
|
|
|
306 |
6398
|
cjones
|
}
|
307 |
6711
|
cjones
|
|
308 |
|
|
public HazelcastInstance getHazelcastInstance() {
|
309 |
|
|
return this.hzInstance;
|
310 |
|
|
|
311 |
|
|
}
|
312 |
6407
|
cjones
|
|
313 |
|
|
/**
|
314 |
|
|
* Refresh the Hazelcast service by restarting it
|
315 |
|
|
*/
|
316 |
6471
|
jones
|
@Override
|
317 |
6401
|
cjones
|
protected void doRefresh() throws ServiceException {
|
318 |
|
|
|
319 |
6407
|
cjones
|
// TODO: verify that the correct config file is still used
|
320 |
6401
|
cjones
|
Hazelcast.getLifecycleService().restart();
|
321 |
6407
|
cjones
|
|
322 |
6401
|
cjones
|
}
|
323 |
6446
|
leinfelder
|
|
324 |
|
|
/**
|
325 |
|
|
* Implement the EntryListener interface for Hazelcast, reponding to entry
|
326 |
|
|
* added events in the hzSystemMetadata map. Evaluate the entry and create
|
327 |
|
|
* CNReplicationTasks as appropriate (for DATA, METADATA, RESOURCE)
|
328 |
|
|
*
|
329 |
|
|
* @param event - The EntryEvent that occurred
|
330 |
|
|
*/
|
331 |
6471
|
jones
|
@Override
|
332 |
6446
|
leinfelder
|
public void entryAdded(EntryEvent<Identifier, SystemMetadata> event) {
|
333 |
|
|
// handle as update - that method will create if necessary
|
334 |
|
|
entryUpdated(event);
|
335 |
|
|
}
|
336 |
6401
|
cjones
|
|
337 |
6446
|
leinfelder
|
/**
|
338 |
|
|
* Implement the EntryListener interface for Hazelcast, reponding to entry
|
339 |
|
|
* evicted events in the hzSystemMetadata map. Evaluate the entry and create
|
340 |
|
|
* CNReplicationTasks as appropriate (for DATA, METADATA, RESOURCE)
|
341 |
|
|
*
|
342 |
|
|
* @param event - The EntryEvent that occurred
|
343 |
|
|
*/
|
344 |
6471
|
jones
|
@Override
|
345 |
6446
|
leinfelder
|
public void entryEvicted(EntryEvent<Identifier, SystemMetadata> event) {
|
346 |
|
|
// nothing to do, entries are still in the backing store
|
347 |
|
|
|
348 |
|
|
}
|
349 |
|
|
|
350 |
|
|
/**
|
351 |
|
|
* Implement the EntryListener interface for Hazelcast, reponding to entry
|
352 |
|
|
* removed events in the hzSystemMetadata map. Evaluate the entry and create
|
353 |
|
|
* CNReplicationTasks as appropriate (for DATA, METADATA, RESOURCE)
|
354 |
|
|
*
|
355 |
|
|
* @param event - The EntryEvent that occurred
|
356 |
|
|
*/
|
357 |
6471
|
jones
|
@Override
|
358 |
6446
|
leinfelder
|
public void entryRemoved(EntryEvent<Identifier, SystemMetadata> event) {
|
359 |
6648
|
leinfelder
|
// we typically don't remove objects in Metacat, but can remove System Metadata
|
360 |
|
|
IdentifierManager.getInstance().deleteSystemMetadata(event.getValue().getIdentifier().getValue());
|
361 |
6446
|
leinfelder
|
|
362 |
|
|
}
|
363 |
|
|
|
364 |
|
|
/**
|
365 |
|
|
* Implement the EntryListener interface for Hazelcast, reponding to entry
|
366 |
|
|
* updated events in the hzSystemMetadata map. Evaluate the entry and create
|
367 |
|
|
* CNReplicationTasks as appropriate (for DATA, METADATA, RESOURCE)
|
368 |
|
|
*
|
369 |
|
|
* @param event - The EntryEvent that occurred
|
370 |
|
|
*/
|
371 |
6471
|
jones
|
@Override
|
372 |
6446
|
leinfelder
|
public void entryUpdated(EntryEvent<Identifier, SystemMetadata> event) {
|
373 |
|
|
|
374 |
|
|
logMetacat.debug("Entry added/updated to System Metadata map: " + event.getKey().getValue());
|
375 |
|
|
PartitionService partitionService = Hazelcast.getPartitionService();
|
376 |
|
|
Partition partition = partitionService.getPartition(event.getKey());
|
377 |
|
|
Member ownerMember = partition.getOwner();
|
378 |
|
|
if (!ownerMember.localMember()) {
|
379 |
|
|
// need to pull the entry into the local store
|
380 |
6459
|
leinfelder
|
saveLocally(event.getValue());
|
381 |
6446
|
leinfelder
|
}
|
382 |
|
|
|
383 |
|
|
// TODO evaluate the type of system metadata change, decide if it
|
384 |
|
|
// warrants a replication event, what type (DATA, METADATA, RESOURCE),
|
385 |
|
|
// iteratively lock the PID, create and submit the tasks, and expect a
|
386 |
|
|
// result back. Deal with exceptions.
|
387 |
6596
|
leinfelder
|
SystemMetadata sysmeta = event.getValue();
|
388 |
|
|
if (sysmeta != null) {
|
389 |
|
|
boolean isMetadata = D1NodeService.isScienceMetadata(event.getValue());
|
390 |
|
|
// TODO: do we need to do anything explicit here?
|
391 |
|
|
}
|
392 |
6446
|
leinfelder
|
|
393 |
|
|
}
|
394 |
6459
|
leinfelder
|
|
395 |
|
|
/**
|
396 |
|
|
* Save SystemMetadata to local store if needed
|
397 |
|
|
* @param sm
|
398 |
|
|
*/
|
399 |
|
|
private void saveLocally(SystemMetadata sm) {
|
400 |
|
|
logMetacat.debug("Saving entry locally: " + sm.getIdentifier().getValue());
|
401 |
|
|
try {
|
402 |
|
|
if (!IdentifierManager.getInstance().systemMetadataExists(sm.getIdentifier().getValue())) {
|
403 |
|
|
IdentifierManager.getInstance().createSystemMetadata(sm);
|
404 |
|
|
} else {
|
405 |
|
|
IdentifierManager.getInstance().updateSystemMetadata(sm);
|
406 |
|
|
}
|
407 |
|
|
} catch (McdbDocNotFoundException e) {
|
408 |
|
|
logMetacat.error(
|
409 |
|
|
"Could not save System Metadata to local store.", e);
|
410 |
|
|
}
|
411 |
|
|
}
|
412 |
|
|
|
413 |
|
|
public void resynch() throws Exception {
|
414 |
|
|
|
415 |
|
|
// get the CN that is online
|
416 |
|
|
// TODO: do we even need to use a specific CN?
|
417 |
|
|
// All the System Metadata records should be available via the shared map
|
418 |
|
|
// NodeList allNodes = CNodeService.getInstance().listNodes();
|
419 |
|
|
// Node onlineCN = null;
|
420 |
|
|
// for (Node node: allNodes.getNodeList()) {
|
421 |
|
|
// if (node.getType().equals(NodeType.CN)) {
|
422 |
|
|
// if (node.getState().equals(NodeState.UP)) {
|
423 |
|
|
// onlineCN = node;
|
424 |
|
|
// break;
|
425 |
|
|
// }
|
426 |
|
|
// }
|
427 |
|
|
// }
|
428 |
|
|
|
429 |
|
|
// get the list of items that have changed since X
|
430 |
|
|
Date since = IdentifierManager.getInstance().getLastModifiedDate();
|
431 |
|
|
EntryObject e = new PredicateBuilder().getEntryObject();
|
432 |
|
|
Predicate predicate = e.get(SINCE_PROPERTY).greaterEqual(since);
|
433 |
|
|
Collection<SystemMetadata> updatedSystemMetadata = getSystemMetadataMap().values(predicate);
|
434 |
|
|
for (SystemMetadata sm: updatedSystemMetadata) {
|
435 |
|
|
saveLocally(sm);
|
436 |
|
|
}
|
437 |
|
|
}
|
438 |
6446
|
leinfelder
|
|
439 |
6398
|
cjones
|
}
|