Project

General

Profile

« Previous | Next » 

Revision 7055

add an alternative method for loading system metadata identifiers but leave it commented out. We may find that using the ObjectList method is too much overhead, but it will always be consistent with what metacat reports for listObjects().

View differences:

src/edu/ucsb/nceas/metacat/dataone/hazelcast/SystemMetadataMap.java
3 3
import java.sql.SQLException;
4 4
import java.util.Collection;
5 5
import java.util.HashMap;
6
import java.util.List;
6 7
import java.util.Map;
7 8
import java.util.Set;
8 9

  
......
104 105
	@Override
105 106
	public Set<Identifier> loadAllKeys() {
106 107
	  
107
	    //Set<Identifier> pids = new HashSet<Identifier>();
108
	  String identifiersSet;
109
    try {
110
        identifiersSet = 
111
            PropertyService.getProperty("dataone.hazelcast.storageCluster.identifiersSet");
112
        
113
    } catch (PropertyNotFoundException e1) {
114
        identifiersSet = "hzIdentifiers";
115
        
116
    }
117
    Set<Identifier> pids = Hazelcast.getSet(identifiersSet);
108
		String identifiersSet;
109
		try {
110
			identifiersSet = 
111
				PropertyService.getProperty("dataone.hazelcast.storageCluster.identifiersSet");
112
		} catch (PropertyNotFoundException e1) {
113
		    identifiersSet = "hzIdentifiers";
114
		}
118 115
		
116
		Set<Identifier> pids = Hazelcast.getSet(identifiersSet);
117
		
119 118
		try {
119
			
120
			// this has more overhead than just looking at the GUIDs
120 121
			ObjectList ol = IdentifierManager.getInstance().querySystemMetadata(
121 122
					null, //startTime, 
122 123
					null, //endTime, 
......
128 129
			for (ObjectInfo o: ol.getObjectInfoList()) {
129 130
				Identifier pid = o.getIdentifier();
130 131
				if ( !pids.contains(pid) ) {
131
		        pids.add(pid);
132
		        
132
					pids.add(pid);
133 133
				}				
134 134
			}
135 135
			
136
			// ALTERNATIVE method: look up all the Identifiers from the table
137
//			List<String> guids = IdentifierManager.getInstance().getAllGUIDs();
138
//			for (String guid: guids){
139
//				Identifier pid = new Identifier();
140
//				pid.setValue(guid);
141
//				pids.add(pid);
142
//			}
143
			
136 144
		} catch (Exception e) {
137 145
			throw new RuntimeException(e.getMessage(), e);
138 146
			

Also available in: Unified diff