Skip to content

Commit

Permalink
Merge pull request #8 from archivesspace/version2.2
Browse files Browse the repository at this point in the history
Version2.2
  • Loading branch information
lmcglohon authored Oct 26, 2017
2 parents b66609d + feaaa8f commit c163b0a
Show file tree
Hide file tree
Showing 17 changed files with 7,475 additions and 476 deletions.
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,42 @@ NOTES ON RUNNING THE PLUGIN IN COMMAND LINE MODE
1. Edit the dbcopy.properties to point to the desired AT database and ASpace Instance
2. Run the "dbCopyCLI" class making sure all the *.jar files in "lib" are in the Classpath.

NOTES ON DATA MIGRATION DEFAULTS
NOTES ON DATA MIGRATION AND DEFAULTS

1. If a date is missing in AT but is required for AS the default date will be set to 1/1/1900 or 0 for integer dates.
2. Many containers including all of those for accessions do not have meaningful identifiers in AT. Any such
2. The start date specified for a container location is the creation date of the associated resource/accession.
3. Many containers including all of those for accessions do not have meaningful identifiers in AT. Any such
container will be assigned a default container indication which will include the words "unknown container" as
well as information about it's content.
3. Some IDs are checked for uniqueness in AS but not AT. In these cases if an ID is not unique the problem will be
3. Sometimes AT records will have an indicator but no container type for either container 2 or 3. This is not
allowed in AS so the default for AS will be "unknown_item" so that the indicator is not lost. The same goes for if
a container 3 is specified without a container 2.
4. Some IDs are checked for uniqueness in AS but not AT. In these cases if an ID is not unique the problem will be
corrected by adding ## along with some random string to the ID.
5. If an assessment is linked to records from multiple repositories, duplicate assessments are created - one for
each linked repository.

CONTINUING A PREVIOUS MIGRATION

1. If a problem occurs during migration, URI maps should be saved and allow you to continue from where you left
off by checking the 'continue previous migration' box.
2. If you are running the migration tool as an Archivist's Toolkit plugin and a connection problem occurs and
causes the migration to stop, restart AT before attempting to continue migration.
2. You can also continue a migration if you manually cancel it.
3. This should work fairly seamlessly, but you should check the record the migration stopped at as the migrator
may correct for a duplicate ID where there is not actually one.
4. It is not necessary to run the repository check again when continuing a migration.
5. You should save your error log and repository check report even if you plan to continue a migration, as these
logs reset when you continue a migration.

HOW TOP CONTAINER UNIQUENESS IS DETERMINED

Archivist's Toolkit does not include the concept of distinct top containers but rather the same container may
be entered many times for multiple instances. For this reason it was necessary to determine a set of rules for
determining what constitutes a unique top container. For top containers created from instances, they are considered
to be the same if either the repository and barcode match or if the repository, indicator, and container type
match. As for accessions, no instances exist in Archivist's Toolkit. In stead, a top container is created for each
location the accession is linked to.

NOTE ON CPU AND MEMORY USAGE

Expand Down
8 changes: 4 additions & 4 deletions dbcopy.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ clientThreads=1
checkRepositoryMismatch=false

# specify whether to continue from resource records in case the data migration was cut short
continueFromResources=false
continueFromURIMaps=false

# specify the reset password for all user record
resetPassword=archive
Expand Down Expand Up @@ -43,9 +43,9 @@ checkISODates=false

# AT database connection information
databaseType=MySQL
atUrl=jdbc:mysql://dev.archiviststoolkit.org:3306/AT_SANDBOX2_0
atUsername=atuser
atPassword=cr4ckA1t
atUrl=jdbc:mysql://localhost:3306/AT_copy
atUsername=root
atPassword=

# parameters used to connect to an ASpace instance
aspaceHost=http://localhost:8089
Expand Down
Binary file added lib/hamcrest-core-1.3.jar
Binary file not shown.
15 changes: 6 additions & 9 deletions makep
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
#!/bin/sh
#This must be run from the at-migration directory

# get current working directory
cwd=$(pwd)

# copy the plugin.xml file
cp -v plugin.xml out/production/ScriptAT
cp -v plugin.xml out/production/at-migration
cp -v README.md out/production/at-migration

cd out/production/ScriptAT
cd out/production/at-migration

zip -rv scriptAT.zip . -i \*.class *.bsh *.xml -x test/*
zip -rv scriptAT.zip . -i \*.class *.bsh *.xml *.md -x test/*

mv -v scriptAT.zip C:/"Program Files"/"Archivists Toolkit 2.0"/plugins #This should be wherever AT is installed
mv -v scriptAT.zip C:/"Program Files (x86)"/"Archivists Toolkit 2.0"/plugins

# create a zip of the source code
cd $cwd
cd ../../..

zip -vr scriptAT_src.zip src -x "*.svn*" "*.DS_Store*"
61 changes: 37 additions & 24 deletions src/org/archiviststoolkit/plugin/dbCopyCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.archiviststoolkit.plugin.dbdialog.RemoteDBConnectDialogLight;
import org.archiviststoolkit.plugin.utils.aspace.ASpaceClient;
import org.archiviststoolkit.plugin.utils.aspace.ASpaceCopyUtil;
import org.archiviststoolkit.plugin.utils.aspace.IntentionalExitException;
import org.hibernate.Session;

import java.io.*;
Expand All @@ -25,7 +26,7 @@ public class dbCopyCLI {

private int clientThreads = 1;

private boolean continueFromResources = false;
private boolean continueFromURIMaps = false;

private String resetPassword = "archive";

Expand Down Expand Up @@ -90,7 +91,7 @@ public dbCopyCLI(Properties properties) throws Exception {
tracerDatabase = properties.getProperty("tracerDatabase");
clientThreads = new Integer(properties.getProperty("clientThreads"));
checkRepositoryMismatch = new Boolean(properties.getProperty("checkRepositoryMismatch"));
continueFromResources = new Boolean(properties.getProperty("continueFromResources"));
continueFromURIMaps = new Boolean(properties.getProperty("continueFromURIMaps"));
resetPassword = properties.getProperty("resetPassword");
simulateRESTCalls = new Boolean(properties.getProperty("simulateRESTCalls"));
ignoreUnlinkedNames = new Boolean(properties.getProperty("ignoreUnlinkedNames"));
Expand Down Expand Up @@ -236,28 +237,32 @@ private void startASpaceCopyProcess() {
} else {
System.out.println("Administrator authenticated ...\n");
}
//
// // first load the notes etc types and resource from the destination database
// ascopy.loadRepositories();

// first load the notes etc types and resource from the destination database
ascopy.loadRepositories();

if (continueFromResources && ascopy.uriMapFileExist()) {
if (continueFromURIMaps && ascopy.uriMapFileExist()) {
ascopy.loadURIMaps();
} else {
if(!copyOnlyResources) {
ascopy.copyLookupList();
ascopy.copyRepositoryRecords();
ascopy.mapRepositoryGroups();
ascopy.copyLocationRecords();
ascopy.copyUserRecords();
ascopy.copySubjectRecords();
ascopy.copyNameRecords();
ascopy.copyAccessionRecords();
ascopy.copyDigitalObjectRecords();

// save the record maps for possible future use
ascopy.saveURIMaps();
}
ascopy.loadRepositories();
}
// if(!copyOnlyResources) {
ascopy.copyLookupList();
ascopy.copyRepositoryRecords();
ascopy.mapRepositoryGroups();
ascopy.copyLocationRecords();
//just so it gets removed from recordsToCopy
ascopy.addAdminUser(null, null, null);
ascopy.copyUserRecords();
ascopy.copySubjectRecords();
ascopy.copyNameRecords();
ascopy.copyAccessionRecords();
ascopy.copyDigitalObjectRecords();

// save the record maps for possible future use
// ascopy.saveURIMaps();
// }
// }

// set the number of resources to copy
int numberOfResourcesToCopy = 1000000;
Expand All @@ -269,10 +274,12 @@ private void startASpaceCopyProcess() {

ascopy.copyResourceRecords(numberOfResourcesToCopy, clientThreads);

ascopy.addContainerData();
// ascopy.addContainerData();

ascopy.addAssessments();

// DEBUG code which checks to see that all ISO dates are valid
if(checkISODates) {
if (checkISODates) {
ascopy.checkISODates();
}

Expand All @@ -284,13 +291,19 @@ private void startASpaceCopyProcess() {

// now save the migration log
saveLogFile("migration_log-" + getDatabaseNameFromURL(atUrl) + ".txt", migrationErrors);
} catch (IntentionalExitException e) {
System.out.println(e.getMessage());
if (ascopy != null) ascopy.saveURIMaps();
else System.out.println("Could not save URI maps ...\nMigration will need to be restarted ...");
} catch (Exception e) {
System.out.println("Unrecoverable exception, migration stopped ...\n\n");

if (ascopy != null) {
if(ascopy != null) {
ascopy.saveURIMaps();
System.out.println(ascopy.getCurrentRecordInfo() + "\n\n");
} else {
System.out.println("Could not save URI maps ...\nMigration will need to be restarted ...");
}
e.printStackTrace();
}
}

Expand Down
Loading

0 comments on commit c163b0a

Please sign in to comment.