Project

General

Profile

« Previous | Next » 

Revision 4175

Added by daigle almost 16 years ago

Qualify harvester properties

View differences:

src/edu/ucsb/nceas/metacat/harvesterClient/Harvester.java
143 143

  
144 144
		// Parse the delay property. Use default if necessary.
145 145
		try {
146
			d = Integer.valueOf(PropertyService.getProperty("delay"));
146
			d = Integer.valueOf(PropertyService.getProperty("harvester.delay"));
147 147
			delay = d.intValue();
148 148
		} catch (NumberFormatException e) {
149 149
			System.out.println("NumberFormatException: Error parsing delay: "
......
159 159

  
160 160
		// Parse the maxHarvests property. Use default if necessary.
161 161
		try {
162
			mh = Integer.valueOf(PropertyService.getProperty("maxHarvests"));
162
			mh = Integer.valueOf(PropertyService.getProperty("harvester.maxHarvests"));
163 163
			maxHarvests = mh.intValue();
164 164
		} catch (NumberFormatException e) {
165 165
			System.out.println("NumberFormatException: Error parsing maxHarvests: "
......
175 175

  
176 176
		// Parse the period property. Use default if necessary.
177 177
		try {
178
			p = Integer.valueOf(PropertyService.getProperty("period"));
178
			p = Integer.valueOf(PropertyService.getProperty("harvester.period"));
179 179
			period = p.intValue();
180 180
		} catch (NumberFormatException e) {
181 181
			System.out.println("NumberFormatException: Error parsing period: "
......
960 960

  
961 961
    // Log shutdown operation
962 962
    System.out.println("Shutting Down Harvester");
963
    addLogEntry(0, "Shutting Down Harvester", "HarvesterShutdown", 0, null, "");
963
    addLogEntry(0, "Shutting Down Harvester", "harvester.HarvesterShutdown", 0, null, "");
964 964
    pruneHarvestLog();
965 965
    closeConnection();
966 966
    // Print log to standard output and then email the Harvester administrator
......
990 990
		}
991 991
		System.out.print("\n");
992 992
		try {
993
			ctm = Boolean.valueOf(PropertyService.getProperty("connectToMetacat"));
993
			ctm = Boolean.valueOf(PropertyService.getProperty("harvester.connectToMetacat"));
994 994
			connectToMetacat = ctm.booleanValue();
995 995
			harvesterAdministrator = PropertyService
996
					.getProperty("harvesterAdministrator");
997
			smtpServer = PropertyService.getProperty("smtpServer");
996
					.getProperty("harvester.administrator");
997
			smtpServer = PropertyService.getProperty("harvester.smtpServer");
998 998

  
999
			lp = Integer.valueOf(PropertyService.getProperty("logPeriod"));
999
			lp = Integer.valueOf(PropertyService.getProperty("harvester.logPeriod"));
1000 1000
			logPeriod = lp.intValue();
1001 1001
		} catch (NumberFormatException e) {
1002 1002
			System.err.println("NumberFormatException: Error parsing logPeriod "
......
1013 1013
		initLogIDs();
1014 1014
		setHarvestStartTime(now);
1015 1015
		// Log startup operation
1016
		addLogEntry(0, "Starting Up Harvester", "HarvesterStartup", 0, null, "");
1016
		addLogEntry(0, "Starting Up Harvester", "harvester.HarvesterStartup", 0, null, "");
1017 1017

  
1018 1018
		if (connectToMetacat()) {
1019 1019
			try {
src/edu/ucsb/nceas/metacat/harvesterClient/HarvestDocument.java
126 126
      stringReader = new StringReader(documentString);
127 127
      harvester.addLogEntry(0,
128 128
                            "Retrieved: " + documentURL, 
129
                            "GetDocSuccess", 
129
                            "harvester.GetDocSuccess", 
130 130
                            harvestSiteSchedule.siteScheduleID, 
131 131
                            null, 
132 132
                            "");
133 133
    }
134 134
    catch (MalformedURLException e) {
135 135
      accessError = true;
136
      harvester.addLogEntry(1, "MalformedURLException", "GetDocError", 
136
      harvester.addLogEntry(1, "MalformedURLException", "harvester.GetDocError", 
137 137
                            harvestSiteSchedule.siteScheduleID, this, 
138 138
                            "MalformedURLException: " + e.getMessage());
139 139
    }
140 140
    catch (IOException e) {
141 141
      accessError = true;
142
      harvester.addLogEntry(1, "IOException", "GetDocError", 
142
      harvester.addLogEntry(1, "IOException", "harvester.GetDocError", 
143 143
                            harvestSiteSchedule.siteScheduleID, this, 
144 144
                            "IOException: " + e.getMessage());
145 145
    }
......
180 180
                            "Attempting to update " + docid + " to revision " + 
181 181
                            revision + ". Metacat has document revision " +
182 182
                            highestRevision + ".", 
183
                            "MetacatHasDoc", 
183
                            "harvester.MetacatHasDoc", 
184 184
                            harvestSiteSchedule.siteScheduleID, 
185 185
                            null, 
186 186
                            "");
......
215 215
    if (insert) {
216 216
      harvester.addLogEntry(1, 
217 217
                            metacatReturnString,
218
                            "InsertDocError",
218
                            "harvester.InsertDocError",
219 219
                            harvestSiteSchedule.siteScheduleID,
220 220
                            this,
221 221
                            exceptionName + ": " + e.getMessage());
......
223 223
    else {
224 224
      harvester.addLogEntry(1, 
225 225
                            metacatReturnString,
226
                            "UpdateDocError",
226
                            "harvester.UpdateDocError",
227 227
                            harvestSiteSchedule.siteScheduleID,
228 228
                            this,
229 229
                            exceptionName + ": " + e.getMessage());
......
308 308
          metacatReturnString = metacat.insert(docidFull, stringReader, null);
309 309
          inserted = true;
310 310
          harvester.addLogEntry(0, docidFull + " : " + metacatReturnString, 
311
                                "InsertDocSuccess", 
311
                                "harvester.InsertDocSuccess", 
312 312
                                harvestSiteSchedule.siteScheduleID, 
313 313
                                null, "");
314 314
        }
......
316 316
          metacatReturnString = metacat.update(docidFull, stringReader, null);
317 317
          updated = true;
318 318
          harvester.addLogEntry(0, docidFull + " : " + metacatReturnString, 
319
                                "UpdateDocSuccess", 
319
                                "harvester.UpdateDocSuccess", 
320 320
                                harvestSiteSchedule.siteScheduleID, 
321 321
                                null, "");
322 322
        }
......
352 352
    /*if (success) {
353 353
      harvester.addLogEntry(0, 
354 354
                            "Validated: " + documentURL, 
355
                            "ValidateDocSuccess", 
355
                            "harvester.ValidateDocSuccess", 
356 356
                            harvestSiteSchedule.siteScheduleID, 
357 357
                            null, 
358 358
                            "");
359 359
    }
360 360
    else {
361
      harvester.addLogEntry(1, "Error validating document", "ValidateDocError", 
361
      harvester.addLogEntry(1, "Error validating document", "harvester.ValidateDocError", 
362 362
                            harvestSiteSchedule.siteScheduleID, this, "");
363 363
    }*/
364 364
    
src/edu/ucsb/nceas/metacat/harvesterClient/HarvestLog.java
349 349
      out.println("* harvestOperationCode: " + harvestOperationCode);
350 350
      out.println("* description:          " + explanation);
351 351

  
352
      if (harvestOperationCode.equals("GetHarvestListSuccess") ||
353
        harvestOperationCode.equals("GetHarvestListError")) {
352
      if (harvestOperationCode.equals("harvester.GetHarvestListSuccess") ||
353
        harvestOperationCode.equals("harvester.GetHarvestListError")) {
354 354
        if (siteScheduleID != 0) {
355 355
          harvester.printHarvestSiteSchedule(out, siteScheduleID);
356 356
        }
src/edu/ucsb/nceas/metacat/harvesterClient/HarvestSiteSchedule.java
332 332
      inputStream = url.openStream();
333 333
      harvester.addLogEntry(0,
334 334
                            "Retrieved: " + documentListURL,
335
                            "GetHarvestListSuccess",
335
                            "harvester.GetHarvestListSuccess",
336 336
                            siteScheduleID,
337 337
                            null,
338 338
                            "");
......
340 340
      documentListHandler.runParser(inputStreamReader, schemaLocation);
341 341
      harvester.addLogEntry(0,
342 342
                            "Validated: " + documentListURL,
343
                            "ValidateHarvestListSuccess",
343
                            "harvester.ValidateHarvestListSuccess",
344 344
                            siteScheduleID,
345 345
                            null,
346 346
                            "");
......
348 348
    }
349 349
    catch (MalformedURLException e){
350 350
      harvester.addLogEntry(1, "MalformedURLException: " + e.getMessage(), 
351
                            "GetHarvestListError", siteScheduleID, null, "");
351
                            "harvester.GetHarvestListError", siteScheduleID, null, "");
352 352
    }
353 353
    catch (FileNotFoundException e) {
354 354
      harvester.addLogEntry(1, "FileNotFoundException: " + e.getMessage(), 
355
                            "GetHarvestListError", siteScheduleID, null, "");
355
                            "harvester.GetHarvestListError", siteScheduleID, null, "");
356 356
    }
357 357
    catch (SAXException e) {
358 358
      harvester.addLogEntry(1, "SAXException: " + e.getMessage(), 
359
                          "ValidateHarvestListError", siteScheduleID, null, "");
359
                          "harvester.ValidateHarvestListError", siteScheduleID, null, "");
360 360
    }
361 361
    catch (ClassNotFoundException e) {
362 362
      harvester.addLogEntry(1, "ClassNotFoundException: " + e.getMessage(),
363
                          "ValidateHarvestListError", siteScheduleID, null, "");
363
                          "harvester.ValidateHarvestListError", siteScheduleID, null, "");
364 364
    }
365 365
    catch (IOException e) {
366 366
      harvester.addLogEntry(1, "IOException: " + e.getMessage(), 
367
                            "GetHarvestListError", siteScheduleID, null, "");
367
                            "harvester.GetHarvestListError", siteScheduleID, null, "");
368 368
    }
369 369
    
370 370
    return success;

Also available in: Unified diff