Revision 7175
Added by ben leinfelder over 12 years ago
src/edu/ucsb/nceas/metacat/admin/upgrade/dataone/GenerateORE.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
private static Log log = LogFactory.getLog(GenerateORE.class); |
46 | 46 |
|
47 |
private int serverLocation = 1; |
|
48 |
|
|
47 | 49 |
public boolean upgrade() throws AdminException { |
48 | 50 |
boolean success = true; |
49 | 51 |
|
50 | 52 |
// include ORE, data, for this server only |
51 | 53 |
boolean includeOre = true; |
52 | 54 |
boolean downloadData = false; |
53 |
int serverLocation = 1; |
|
54 | 55 |
|
55 | 56 |
try { |
56 | 57 |
// get only local ids for this server |
... | ... | |
81 | 82 |
return success; |
82 | 83 |
} |
83 | 84 |
|
84 |
public static void main(String [] ags){ |
|
85 |
public int getServerLocation() { |
|
86 |
return serverLocation; |
|
87 |
} |
|
85 | 88 |
|
89 |
public void setServerLocation(int serverLocation) { |
|
90 |
this.serverLocation = serverLocation; |
|
91 |
} |
|
92 |
|
|
93 |
public static void main(String [] ags){ |
|
94 |
|
|
86 | 95 |
try { |
87 | 96 |
// set up the properties based on the test/deployed configuration of the workspace |
88 | 97 |
SortedProperties testProperties = |
src/edu/ucsb/nceas/metacat/admin/D1Admin.java | ||
---|---|---|
337 | 337 |
} |
338 | 338 |
|
339 | 339 |
// dataone system metadata generation |
340 |
boolean smGenerated = Boolean.parseBoolean(PropertyService.getProperty("dataone.systemmetadata.generated")); |
|
341 |
if (!smGenerated) { |
|
342 |
GenerateSystemMetadata systemMetadataUpgrade = new GenerateSystemMetadata(); |
|
343 |
systemMetadataUpgrade.upgrade(); |
|
344 |
// NOTE: this runs in a thread and marks SM generated when thatthread completes |
|
345 |
} |
|
346 |
|
|
347 |
// Generate ORE, if we haven't |
|
348 |
boolean oreGenerated = Boolean.parseBoolean(PropertyService.getProperty("dataone.ore.generated")); |
|
349 |
if (!oreGenerated) { |
|
350 |
GenerateORE gore = new GenerateORE(); |
|
351 |
gore.upgrade(); |
|
352 |
PropertyService.setProperty("dataone.ore.generated", Boolean.TRUE.toString()); |
|
353 |
} |
|
340 |
// NOTE: commented this out - we can generate this after the registration/configuration |
|
341 |
// it will be more controlled and deliberate that way -BRL |
|
342 |
// boolean smGenerated = Boolean.parseBoolean(PropertyService.getProperty("dataone.systemmetadata.generated")); |
|
343 |
// if (!smGenerated) { |
|
344 |
// GenerateSystemMetadata systemMetadataUpgrade = new GenerateSystemMetadata(); |
|
345 |
// systemMetadataUpgrade.upgrade(); |
|
346 |
// // NOTE: this runs in a thread and marks SM generated when thatthread completes |
|
347 |
// } |
|
348 |
// |
|
349 |
// // Generate ORE, if we haven't |
|
350 |
// boolean oreGenerated = Boolean.parseBoolean(PropertyService.getProperty("dataone.ore.generated")); |
|
351 |
// if (!oreGenerated) { |
|
352 |
// GenerateORE gore = new GenerateORE(); |
|
353 |
// gore.upgrade(); |
|
354 |
// PropertyService.setProperty("dataone.ore.generated", Boolean.TRUE.toString()); |
|
355 |
// } |
|
354 | 356 |
|
355 | 357 |
// write the backup properties to a location outside the |
356 | 358 |
// application directories so they will be available after |
src/edu/ucsb/nceas/metacat/replication/ReplicationService.java | ||
---|---|---|
80 | 80 |
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlForSingleFile; |
81 | 81 |
import edu.ucsb.nceas.metacat.accesscontrol.PermOrderException; |
82 | 82 |
import edu.ucsb.nceas.metacat.accesscontrol.XMLAccessDAO; |
83 |
import edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateORE; |
|
83 | 84 |
import edu.ucsb.nceas.metacat.admin.upgrade.dataone.GenerateSystemMetadata; |
84 | 85 |
import edu.ucsb.nceas.metacat.client.InsufficientKarmaException; |
85 | 86 |
import edu.ucsb.nceas.metacat.database.DBConnection; |
... | ... | |
370 | 371 |
gsm.multiThreadUpgrade(); |
371 | 372 |
out.write("System Metadata generated for server " + serverid); |
372 | 373 |
|
374 |
} else if (subaction.equals("generateore")) { |
|
375 |
GenerateORE gore = new GenerateORE(); |
|
376 |
int serverLocation = -1; |
|
377 |
String serverid = ((String[]) params.get("serverid"))[0]; |
|
378 |
serverLocation = Integer.parseInt(serverid); |
|
379 |
gore.setServerLocation(serverLocation ); |
|
380 |
gore.upgrade(); |
|
381 |
out.write("Generated ORE maps for server " + serverid); |
|
382 |
|
|
373 | 383 |
} else { |
374 | 384 |
|
375 | 385 |
out.write("<error>Unkonwn subaction</error>"); |
... | ... | |
391 | 401 |
out.write("<td><b>datareplicate</b></td>"); |
392 | 402 |
out.write("<td><b>hub</b></td>"); |
393 | 403 |
if (showGenerateSystemMetadata) { |
394 |
out.write("<td><b>Action</b></td>"); |
|
404 |
out.write("<td><b>System Metadata</b></td>"); |
|
405 |
out.write("<td><b>ORE Maps</b></td>"); |
|
395 | 406 |
} |
396 | 407 |
out.write("</tr>"); |
397 | 408 |
|
... | ... | |
406 | 417 |
out.write(rs.getString(5) + "</td><td>"); |
407 | 418 |
out.write(rs.getString(6) + "</td>"); |
408 | 419 |
if (showGenerateSystemMetadata) { |
409 |
//request.getContextPath() %>/admin?configureType=replication&action=servercontrol&subaction=list"
|
|
420 |
// for SM
|
|
410 | 421 |
out.write("<td><form action='" + request.getContextPath() + "/admin'>"); |
411 | 422 |
out.write("<input name='serverid' type='hidden' value='" + rs.getString(1) + "'/>"); |
412 | 423 |
out.write("<input name='configureType' type='hidden' value='replication'/>"); |
... | ... | |
414 | 425 |
out.write("<input name='subaction' type='hidden' value='generatesystemmetadata'/>"); |
415 | 426 |
out.write("<input type='submit' value='Generate System Metadata'/>"); |
416 | 427 |
out.write("</form></td>"); |
428 |
|
|
429 |
// for ORE maps |
|
430 |
out.write("<td><form action='" + request.getContextPath() + "/admin'>"); |
|
431 |
out.write("<input name='serverid' type='hidden' value='" + rs.getString(1) + "'/>"); |
|
432 |
out.write("<input name='configureType' type='hidden' value='replication'/>"); |
|
433 |
out.write("<input name='action' type='hidden' value='servercontrol'/>"); |
|
434 |
out.write("<input name='subaction' type='hidden' value='generateore'/>"); |
|
435 |
out.write("<input type='submit' value='Generate ORE'/>"); |
|
436 |
out.write("</form></td>"); |
|
417 | 437 |
} |
418 | 438 |
out.write("</tr>"); |
419 | 439 |
|
Also available in: Unified diff
instead of generating SM and ORE maps during dataone configuration/MN registration, moved this all to the replication admin screen where we can target generation for specific nodes. That way it's more controlled as to when and where we generate DataONE required content.
https://redmine.dataone.org/issues/2740