diff --git a/.gitignore b/.gitignore index d294b63f..309fa722 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ /ontology/public/catalog-v0001.xml rdf/auth/firsttime/test-user-model.owl -utilities/rdbmigration/.work diff --git a/build.xml b/build.xml index 8e93c6d0..9c22fa3f 100644 --- a/build.xml +++ b/build.xml @@ -134,14 +134,4 @@ - - - - - - - - diff --git a/doc/README.txt b/doc/README.txt index 561f6a3e..93084c2c 100644 --- a/doc/README.txt +++ b/doc/README.txt @@ -8,12 +8,12 @@ find these files in this directory: Instructions for installing VIVO on your machine, including a simple installation and several options. - Upgrade Instructions for VIVO release 1.6.pdf + Upgrade Instructions for VIVO release 1.7.pdf Instructions for migrating a VIVO installation from release - 1.5 to release 1.6 + 1.6 to release 1.7 If these files are not present, or to obtain the latest version of the instructions, go to: - https://wiki.duraspace.org/display/VIVO/VIVO+Documentation + https://wiki.duraspace.org/display/VIVO/ \ No newline at end of file diff --git a/productMods/config/listViewConfig-informationResourceInAuthorship.xml b/productMods/config/listViewConfig-informationResourceInAuthorship.xml index 762b3b7c..b2d8181a 100644 --- a/productMods/config/listViewConfig-informationResourceInAuthorship.xml +++ b/productMods/config/listViewConfig-informationResourceInAuthorship.xml @@ -12,7 +12,7 @@ PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> - SELECT DISTINCT ?subclass + SELECT DISTINCT ?subclass ?authorship ?author ?authorName WHERE { @@ -21,13 +21,12 @@ OPTIONAL { ?authorship core:relates ?author . ?author a foaf:Agent . ?author rdfs:label ?authorName - + OPTIONAL { ?authorship core:relates ?author . ?author a foaf:Agent . ?author vitro:mostSpecificType ?subclass . ?subclass rdfs:subClassOf foaf:Agent } - } OPTIONAL { ?authorship core:relates ?author . ?author a vcard:Kind . @@ -39,13 +38,12 @@ bind ( COALESCE(?middleName, "") As ?middleName1) . bind ( COALESCE(?lastName, "") As ?lastName1) . bind (concat(str(?lastName1 + ", "),str(?middleName1 + " "),str(?firstName1)) as ?authorName) . - + OPTIONAL { ?authorship core:relates ?author . ?author a vcard:Kind . ?author vitro:mostSpecificType ?subclass . ?subclass rdfs:subClassOf vcard:Kind } - } FILTER ( bound(?author) ) diff --git a/productMods/config/listViewConfig-scopusId.xml b/productMods/config/listViewConfig-scopusId.xml index 41cfe453..8358b74c 100644 --- a/productMods/config/listViewConfig-scopusId.xml +++ b/productMods/config/listViewConfig-scopusId.xml @@ -14,7 +14,7 @@ ?subject ?property ?value FILTER isLiteral(?value) - } ORDER BY ?object + } ORDER BY ?value diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-hasRole.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-hasRole.ftl index c89de407..2f49ef7e 100644 --- a/productMods/templates/freemarker/body/partials/individual/propStatement-hasRole.ftl +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-hasRole.ftl @@ -17,8 +17,8 @@   diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-informationResourceInAuthorship.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-informationResourceInAuthorship.ftl index 78581373..67a810a2 100644 --- a/productMods/templates/freemarker/body/partials/individual/propStatement-informationResourceInAuthorship.ftl +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-informationResourceInAuthorship.ftl @@ -13,7 +13,11 @@ next statement --> <#macro showAuthorship statement> <#if statement.author??> - ${statement.authorName} + <#if statement.subclass?? && statement.subclass?contains("vcard")> + ${statement.authorName} + <#else> + ${statement.authorName} + <#else> <#-- This shouldn't happen, but we must provide for it --> ${i18n().missing_author} diff --git a/productMods/templates/freemarker/edit/forms/js/addAuthorsToInformationResource.js b/productMods/templates/freemarker/edit/forms/js/addAuthorsToInformationResource.js index 83f2c5be..55151aba 100644 --- a/productMods/templates/freemarker/edit/forms/js/addAuthorsToInformationResource.js +++ b/productMods/templates/freemarker/edit/forms/js/addAuthorsToInformationResource.js @@ -581,6 +581,10 @@ var addAuthorForm = { this.labelField.val(name); } + // If user selected org via autocomplete, clear the org name field + if ( this.orgUriField.val() != '' ) { + this.orgName.val(""); + } }, @@ -765,6 +769,7 @@ var addAuthorForm = { if ( authType == "org" ) { this.personSection.hide(); this.orgSection.show(); + this.orgNameWrapper.show(); // person fields this.personRadio.attr('checked', false); // needed for reset when cancel button is clicked this.acSelector.removeClass("acSelector"); diff --git a/productMods/templates/freemarker/edit/forms/js/manageGrantsForIndividual.js b/productMods/templates/freemarker/edit/forms/js/manageHideShowStatus.js similarity index 63% rename from productMods/templates/freemarker/edit/forms/js/manageGrantsForIndividual.js rename to productMods/templates/freemarker/edit/forms/js/manageHideShowStatus.js index 36eb16e8..fac2d15b 100644 --- a/productMods/templates/freemarker/edit/forms/js/manageGrantsForIndividual.js +++ b/productMods/templates/freemarker/edit/forms/js/manageHideShowStatus.js @@ -1,6 +1,6 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ -var manageGrants = { +var manageHideShowStatus = { /* *** Initial page setup *** */ @@ -20,7 +20,7 @@ var manageGrants = { // Initial page setup. Called only at page load. initPage: function() { - this.initGrantData(); + this.initItemData(); this.bindEventListeners(); @@ -29,28 +29,28 @@ var manageGrants = { // On page load, associate data with each list item. Then we don't // have to keep retrieving data from or modifying the DOM as we manipulate the // items. - initGrantData: function() { - $('.grantCheckbox').each(function(index) { - $(this).data(grantData[index]); + initItemData: function() { + $('.itemCheckbox').each(function(index) { + $(this).data(itemData[index]); }); }, bindEventListeners: function() { - $('.grantCheckbox').click(function() { - manageGrants.processGrant(this); + $('.itemCheckbox').click(function() { + manageHideShowStatus.processItem(this); //return false; }); }, - processGrant: function(grant) { + processItem: function(item) { var add = ""; var retract = ""; - var n3String = "<" + $(grant).data('roleUri') + "> \"true\" ." ; + var n3String = "<" + $(item).data('relatedUri') + "> \"true\" ." ; - if ( $(grant).is(':checked') ) { + if ( $(item).is(':checked') ) { add = n3String; } else { @@ -58,22 +58,22 @@ var manageGrants = { } $.ajax({ - url: manageGrants.processingUrl, + url: manageHideShowStatus.processingUrl, type: 'POST', data: { additions: add, retractions: retract }, dataType: 'json', - context: grant, // context for callback + context: item, // context for callback complete: function(request, status) { if (status === 'success') { - window.status = manageGrants.grantSuccessfullyExcluded; + window.status = manageHideShowStatus.itemSuccessfullyExcluded; } else { - alert(manageGrants.errorExcludingGrant); - $(grant).removeAttr('checked'); + alert(manageHideShowStatus.errorExcludingItem); + $(item).removeAttr('checked'); } } }); @@ -82,5 +82,5 @@ var manageGrants = { }; $(document).ready(function() { - manageGrants.onLoad(); + manageHideShowStatus.onLoad(); }); diff --git a/productMods/templates/freemarker/edit/forms/js/managePeopleForOrganization.js b/productMods/templates/freemarker/edit/forms/js/managePeopleForOrganization.js deleted file mode 100644 index 672ee820..00000000 --- a/productMods/templates/freemarker/edit/forms/js/managePeopleForOrganization.js +++ /dev/null @@ -1,86 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -var managePeople = { - - /* *** Initial page setup *** */ - - onLoad: function() { - - this.mixIn(); - this.initPage(); - }, - - mixIn: function() { - - // Get the custom form data from the page - $.extend(this, customFormData); - $.extend(this, i18nStrings); - }, - - // Initial page setup. Called only at page load. - initPage: function() { - - this.initPeopleData(); - - this.bindEventListeners(); - - }, - - // On page load, associate data with each list item. Then we don't - // have to keep retrieving data from or modifying the DOM as we manipulate the - // items. - initPeopleData: function() { - $('.pubCheckbox').each(function(index) { - $(this).data(peopleData[index]); - }); - }, - - bindEventListeners: function() { - - $('.pubCheckbox').click(function() { - managePeople.processPeople(this); - //return false; - }); - - }, - - processPeople: function(person) { - - var add = ""; - var retract = ""; - var n3String = "<" + $(person).data('positionUri') + "> \"true\" ." ; - - if ( $(person).is(':checked') ) { - add = n3String; - } - else { - retract = n3String; - } - - $.ajax({ - url: managePeople.processingUrl, - type: 'POST', - data: { - additions: add, - retractions: retract - }, - dataType: 'json', - context: person, // context for callback - complete: function(request, status) { - - if (status === 'success') { - window.status = managePeople.personSuccessfullyExcluded; - - } else { - alert(managePeople.errorExcludingPerson); - $(person).removeAttr('checked'); - } - } - }); - }, - -}; - -$(document).ready(function() { - managePeople.onLoad(); -}); diff --git a/productMods/templates/freemarker/edit/forms/js/managePublicationsForIndividual.js b/productMods/templates/freemarker/edit/forms/js/managePublicationsForIndividual.js deleted file mode 100644 index 5d39f2e9..00000000 --- a/productMods/templates/freemarker/edit/forms/js/managePublicationsForIndividual.js +++ /dev/null @@ -1,86 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -var managePublications = { - - /* *** Initial page setup *** */ - - onLoad: function() { - - this.mixIn(); - this.initPage(); - }, - - mixIn: function() { - - // Get the custom form data from the page - $.extend(this, customFormData); - $.extend(this, i18nStrings); - }, - - // Initial page setup. Called only at page load. - initPage: function() { - - this.initPublicationData(); - - this.bindEventListeners(); - - }, - - // On page load, associate data with each list item. Then we don't - // have to keep retrieving data from or modifying the DOM as we manipulate the - // items. - initPublicationData: function() { - $('.pubCheckbox').each(function(index) { - $(this).data(publicationData[index]); - }); - }, - - bindEventListeners: function() { - - $('.pubCheckbox').click(function() { - managePublications.processPublication(this); - //return false; - }); - - }, - - processPublication: function(publication) { - - var add = ""; - var retract = ""; - var n3String = "<" + $(publication).data('authorshipUri') + "> \"true\" ." ; - - if ( $(publication).is(':checked') ) { - add = n3String; - } - else { - retract = n3String; - } - - $.ajax({ - url: managePublications.processingUrl, - type: 'POST', - data: { - additions: add, - retractions: retract - }, - dataType: 'json', - context: publication, // context for callback - complete: function(request, status) { - - if (status === 'success') { - window.status = managePublications.publicationSuccessfullyExcluded; - - } else { - alert(managePublications.errorExcludingPublication); - $(publication).removeAttr('checked'); - } - } - }); - }, - -}; - -$(document).ready(function() { - managePublications.onLoad(); -}); diff --git a/productMods/templates/freemarker/edit/forms/manageGrantsForIndividual.ftl b/productMods/templates/freemarker/edit/forms/manageGrantsForIndividual.ftl index 7bb30d3f..97787a1e 100644 --- a/productMods/templates/freemarker/edit/forms/manageGrantsForIndividual.ftl +++ b/productMods/templates/freemarker/edit/forms/manageGrantsForIndividual.ftl @@ -13,7 +13,7 @@

${i18n().check_grants_to_exclude}

<@lvf.unsupportedBrowser urls.base /> @@ -25,11 +25,11 @@ ${i18n().check_grants_to_exclude}
    <#list grantList as grant>
  • - checked />${grant.label!grant.activity!} + checked />${grant.label!grant.activity!}
  • @@ -48,8 +48,8 @@ var customFormData = { processingUrl: '${urls.base}/edit/primitiveRdfEdit' }; var i18nStrings = { - grantSuccessfullyExcluded: '${i18n().grant_successfully_excluded}', - errorExcludingGrant: '${i18n().error_excluding_grant}' + itemSuccessfullyExcluded: '${i18n().grant_successfully_excluded}', + errorExcludingItem: '${i18n().error_excluding_grant}' }; @@ -59,5 +59,5 @@ ${stylesheets.add('', '', '', - '')} + '')} diff --git a/productMods/templates/freemarker/edit/forms/managePeopleForOrganization.ftl b/productMods/templates/freemarker/edit/forms/managePeopleForOrganization.ftl index e02dd101..6e55598e 100644 --- a/productMods/templates/freemarker/edit/forms/managePeopleForOrganization.ftl +++ b/productMods/templates/freemarker/edit/forms/managePeopleForOrganization.ftl @@ -7,7 +7,7 @@

    ${i18n().check_people_to_exclude}

    @@ -21,11 +21,11 @@ ${i18n().check_people_to_exclude}
      <#list peeps as person>
    • - checked />${person.name} + checked />${person.name}
    • @@ -44,8 +44,8 @@ var customFormData = { processingUrl: '${urls.base}/edit/primitiveRdfEdit' }; var i18nStrings = { - personSuccessfullyExcluded: '${i18n().person_successfully_excluded}', - errorExcludingPerson: '${i18n().error_excluding_person}' + itemSuccessfullyExcluded: '${i18n().person_successfully_excluded}', + errorExcludingItem: '${i18n().error_excluding_person}' }; @@ -55,5 +55,5 @@ ${stylesheets.add('', '', '', - '')} + '')} diff --git a/productMods/templates/freemarker/edit/forms/managePublicationsForIndividual.ftl b/productMods/templates/freemarker/edit/forms/managePublicationsForIndividual.ftl index bc188ef9..e1c8b036 100644 --- a/productMods/templates/freemarker/edit/forms/managePublicationsForIndividual.ftl +++ b/productMods/templates/freemarker/edit/forms/managePublicationsForIndividual.ftl @@ -13,7 +13,7 @@

      ${i18n().check_pubs_to_exclude}

      @@ -37,12 +37,12 @@ ${i18n().check_pubs_to_exclude}
        <#list pubs as pub>
      • - checked /> + checked /> <#if pub.title?has_content>${pub.title!}<#else>${i18n().title_not_found}
      • @@ -61,8 +61,8 @@ var customFormData = { processingUrl: '${urls.base}/edit/primitiveRdfEdit' }; var i18nStrings = { - publicationSuccessfullyExcluded: '${i18n().publication_successfully_excluded}', - errorExcludingPublication: '${i18n().error_excluding_publication}' + itemSuccessfullyExcluded: '${i18n().publication_successfully_excluded}', + errorExcludingItem: '${i18n().error_excluding_publication}' }; @@ -72,5 +72,5 @@ ${stylesheets.add('', '', '', - '')} + '')} diff --git a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonBody.ftl b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonBody.ftl index cbc8dca3..18f5f782 100644 --- a/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonBody.ftl +++ b/productMods/templates/freemarker/visualization/entitycomparison/entityComparisonBody.ftl @@ -53,7 +53,7 @@
        -

        #{title}

        +

        #{title!}

        #{text}

        ${i18n().close_me}

        @@ -61,7 +61,7 @@
        x -

        #{title}

        +

        #{title!}

        #{text}

        diff --git a/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl b/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl index f0ac7b22..95bfdef9 100644 --- a/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl +++ b/productMods/templates/freemarker/visualization/mapOfScience/mapOfScienceStandalone.ftl @@ -27,7 +27,7 @@ corresponding changes in the included Templates. -->
        -

        #{title}

        +

        #{title!}

        #{text}

        ${i18n().close_me}

        @@ -35,7 +35,7 @@ corresponding changes in the included Templates. -->
        x -

        #{title}

        +

        #{title!}

        #{text}

        diff --git a/src/edu/cornell/mannlib/semservices/util/XMLUtils.java b/src/edu/cornell/mannlib/semservices/util/XMLUtils.java index f4735ea4..faa2c913 100644 --- a/src/edu/cornell/mannlib/semservices/util/XMLUtils.java +++ b/src/edu/cornell/mannlib/semservices/util/XMLUtils.java @@ -28,21 +28,16 @@ import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.xml.serialize.XMLSerializer; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; -import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import edu.cornell.mannlib.semservices.util.MetadataNamespaceContext; - /** * Convenience Class to parse XML strings to DOM Document for XML contents * retrieval. @@ -117,14 +112,16 @@ public class XMLUtils { * @param doc * @throws IOException */ + @SuppressWarnings("deprecation") public static void serializeDoc(Document doc) throws IOException { - XMLSerializer serializer = new XMLSerializer(); + org.apache.xml.serialize.XMLSerializer serializer = new org.apache.xml.serialize.XMLSerializer(); serializer.setOutputByteStream(System.out); serializer.serialize(doc); } + @SuppressWarnings("deprecation") public static String serializeDoctoString(Document doc) throws IOException { - XMLSerializer serializer = new XMLSerializer(); + org.apache.xml.serialize.XMLSerializer serializer = new org.apache.xml.serialize.XMLSerializer(); ByteArrayOutputStream bout = new ByteArrayOutputStream(); serializer.setOutputByteStream(bout); diff --git a/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ManagePeopleForOrganizationController.java b/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ManagePeopleForOrganizationController.java index 9c26b70f..c3861cd9 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ManagePeopleForOrganizationController.java +++ b/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ManagePeopleForOrganizationController.java @@ -72,8 +72,11 @@ public class ManagePeopleForOrganizationController extends FreemarkerHttpServlet + " OPTIONAL { ?position core:relates ?person . " + " ?person a foaf:Person . \n" + " ?person rdfs:label ?label } \n" - + " OPTIONAL { ?position vitro:mostSpecificType ?subclass } \n" + + " OPTIONAL { ?position vitro:mostSpecificType ?subclass . \n" + + " OPTIONAL { ?subclass vitro:displayRankAnnot ?displayRank } \n" + + " } \n " + " OPTIONAL { ?position core:hideFromDisplay ?hideThis } \n " + + " FILTER ( ?displayRank < 500 )" + "} ORDER BY ?subclass ?name"; HashMap>> getPeople(String subjectUri, VitroRequest vreq) { diff --git a/themes/wilma/templates/gadgetDetails.ftl b/themes/wilma/templates/gadgetDetails.ftl index a3fa8ea4..50ba92a9 100644 --- a/themes/wilma/templates/gadgetDetails.ftl +++ b/themes/wilma/templates/gadgetDetails.ftl @@ -2,7 +2,7 @@ <#-- Template for the body of the GadgetDetails page --> -

        ${title}

        +

        ${title!}

        <#-- VIVO OpenSocial Extension by UCSF --> <#if openSocial??> diff --git a/themes/wilma/templates/gadgetLogin.ftl b/themes/wilma/templates/gadgetLogin.ftl index f66bce4b..69c75cca 100644 --- a/themes/wilma/templates/gadgetLogin.ftl +++ b/themes/wilma/templates/gadgetLogin.ftl @@ -11,7 +11,7 @@ th { } -

        ${title}

        +

        ${title!}

        <#-- VIVO OpenSocial Extension by UCSF --> <#if openSocial??> diff --git a/themes/wilma/templates/head.ftl b/themes/wilma/templates/head.ftl index eef17c30..15381e75 100644 --- a/themes/wilma/templates/head.ftl +++ b/themes/wilma/templates/head.ftl @@ -4,7 +4,7 @@ -${title} +${siteName!} <#-- VIVO OpenSocial Extension by UCSF --> <#if openSocial??> diff --git a/utilities/rdbmigration/build.xml b/utilities/rdbmigration/build.xml deleted file mode 100644 index 3611dace..00000000 --- a/utilities/rdbmigration/build.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - all - Compiles and runs the RDB migration tool. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/utilities/rdbmigration/lib/arq-2.8.5.jar b/utilities/rdbmigration/lib/arq-2.8.5.jar deleted file mode 100644 index f89b6937..00000000 Binary files a/utilities/rdbmigration/lib/arq-2.8.5.jar and /dev/null differ diff --git a/utilities/rdbmigration/lib/icu4j-3.4.4.jar b/utilities/rdbmigration/lib/icu4j-3.4.4.jar deleted file mode 100644 index f5e8c167..00000000 Binary files a/utilities/rdbmigration/lib/icu4j-3.4.4.jar and /dev/null differ diff --git a/utilities/rdbmigration/lib/iri-0.8.jar b/utilities/rdbmigration/lib/iri-0.8.jar deleted file mode 100644 index f096c689..00000000 Binary files a/utilities/rdbmigration/lib/iri-0.8.jar and /dev/null differ diff --git a/utilities/rdbmigration/lib/jena-2.6.4.jar b/utilities/rdbmigration/lib/jena-2.6.4.jar deleted file mode 100644 index efc64a94..00000000 Binary files a/utilities/rdbmigration/lib/jena-2.6.4.jar and /dev/null differ diff --git a/utilities/rdbmigration/lib/log4j-1.2.14.jar b/utilities/rdbmigration/lib/log4j-1.2.14.jar deleted file mode 100644 index 62513071..00000000 Binary files a/utilities/rdbmigration/lib/log4j-1.2.14.jar and /dev/null differ diff --git a/utilities/rdbmigration/lib/mysql-connector-java-5.1.16-bin.jar b/utilities/rdbmigration/lib/mysql-connector-java-5.1.16-bin.jar deleted file mode 100644 index e62f2cb7..00000000 Binary files a/utilities/rdbmigration/lib/mysql-connector-java-5.1.16-bin.jar and /dev/null differ diff --git a/utilities/rdbmigration/lib/slf4j-api-1.5.6.jar b/utilities/rdbmigration/lib/slf4j-api-1.5.6.jar deleted file mode 100644 index 9b422169..00000000 Binary files a/utilities/rdbmigration/lib/slf4j-api-1.5.6.jar and /dev/null differ diff --git a/utilities/rdbmigration/lib/slf4j-log4j12-1.5.6.jar b/utilities/rdbmigration/lib/slf4j-log4j12-1.5.6.jar deleted file mode 100644 index 0c40e9c8..00000000 Binary files a/utilities/rdbmigration/lib/slf4j-log4j12-1.5.6.jar and /dev/null differ diff --git a/utilities/rdbmigration/lib/tdb-0.8.7.jar b/utilities/rdbmigration/lib/tdb-0.8.7.jar deleted file mode 100644 index 5b7965d6..00000000 Binary files a/utilities/rdbmigration/lib/tdb-0.8.7.jar and /dev/null differ diff --git a/utilities/rdbmigration/lib/xercesImpl.jar b/utilities/rdbmigration/lib/xercesImpl.jar deleted file mode 100644 index eac75ae8..00000000 Binary files a/utilities/rdbmigration/lib/xercesImpl.jar and /dev/null differ diff --git a/utilities/rdbmigration/src/edu/cornell/mannlib/vivo/utilities/rdbmigration/RdbMigrator.java b/utilities/rdbmigration/src/edu/cornell/mannlib/vivo/utilities/rdbmigration/RdbMigrator.java deleted file mode 100644 index f40ccc02..00000000 --- a/utilities/rdbmigration/src/edu/cornell/mannlib/vivo/utilities/rdbmigration/RdbMigrator.java +++ /dev/null @@ -1,303 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vivo.utilities.rdbmigration; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.Date; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Properties; - -import com.hp.hpl.jena.db.DBConnection; -import com.hp.hpl.jena.db.GraphRDB; -import com.hp.hpl.jena.db.IDBConnection; -import com.hp.hpl.jena.graph.Graph; -import com.hp.hpl.jena.graph.Node; -import com.hp.hpl.jena.query.Dataset; -import com.hp.hpl.jena.sparql.core.DatasetGraph; -import com.hp.hpl.jena.tdb.TDBFactory; - -/** - * TODO - */ -public class RdbMigrator { - private static final String TABLE_RDB = "jena_graph"; - private static final String TABLE_MIGRATED = "vivo_rdb_migrated"; - private final String vivoHomeDir; - private final String jdbcUrl; - private final String username; - private final String password; - - private File targetDir; - private boolean alreadyMigrated; - - public RdbMigrator(String vivoHomeDir, String jdbcUrl, String username, - String password) throws UserDeclinedException, IOException, SQLException { - this.vivoHomeDir = vivoHomeDir; - this.jdbcUrl = jdbcUrl; - this.username = username; - this.password = password; - - confirmTargetDirectory(); - - if (doesTdbExist()) { - askContinueOverTdb(); - } - - testDbConnection(); - - checkThatRdbExists(); - - if (isAlreadyMigrated()) { - askMigrateAgain(); - } - - askApprovalForMigrationPlan(); - } - - private void confirmTargetDirectory() { - File vivoHome = new File(vivoHomeDir); - if (!vivoHome.isDirectory()) { - quit("'" + vivoHome + "' is not a directory."); - } - if (!vivoHome.canWrite()) { - quit("Can't write to '" + vivoHome + "'."); - } - targetDir = new File(vivoHome, "tdbmodels"); - } - - private boolean doesTdbExist() { - if (!targetDir.exists()) { - return false; - } - - if (!targetDir.isDirectory()) { - quit("'" + targetDir + "' is not a directory."); - } - if (!targetDir.canWrite()) { - quit("Can't write to '" + targetDir + "'."); - } - - String[] filenames = targetDir.list(); - if (filenames == null || filenames.length == 0) { - return false; - } - - return true; - } - - private void askContinueOverTdb() throws UserDeclinedException, IOException { - ask("A directory of TDB files exists at '" + targetDir + "'.\n" - + " Migration will replace the existing triples.\n" - + "Continue? (y/n)"); - } - - private void testDbConnection() { - try (Connection conn = getSqlConnection()) { - // Just open and close it. - } catch (SQLException e) { - quit("Can't log in to database: '" + jdbcUrl + "', '" + username - + "', '" + password + "'\n" + e.getMessage()); - } - } - - private void checkThatRdbExists() throws SQLException { - try (Connection conn = getSqlConnection()) { - DatabaseMetaData md = conn.getMetaData(); - try (ResultSet rs = md.getTables(null, null, TABLE_RDB, null);) { - if (!rs.next()) { - quit("The database at '" + jdbcUrl - + "' contains no RDB tables."); - } - } - } - } - - private boolean isAlreadyMigrated() throws SQLException { - try (Connection conn = getSqlConnection()) { - DatabaseMetaData md = conn.getMetaData(); - try (ResultSet rs = md.getTables(null, null, TABLE_MIGRATED, null);) { - if (rs.next()) { - alreadyMigrated = true; - announceMigrationDate(conn); - return true; - } else { - return false; - } - } - } - } - - private void announceMigrationDate(Connection conn) { - String migrationDate = "UNKNOWN DATE"; - String query = String.format("SELECT date FROM %s LIMIT 1", - TABLE_MIGRATED); - - try (Statement stmt = conn.createStatement(); - java.sql.ResultSet rs = stmt.executeQuery(query)) { - if (rs.next()) { - migrationDate = rs.getString("DATE"); - } - } catch (SQLException e) { - // go with default answer. - } - - System.out.println("It looks like this RDB data has already been " - + "migrated to TDB, on " + migrationDate - + "\n (found a table named '" + TABLE_MIGRATED + "')"); - } - - private void askMigrateAgain() throws UserDeclinedException, IOException { - ask("Migrate again? (y/n)"); - } - - private void askApprovalForMigrationPlan() throws SQLException, - UserDeclinedException, IOException { - int modelCount = 0; - int tripleCount = 0; - try (Connection conn = getSqlConnection()) { - IDBConnection rdb = null; - try { - rdb = getRdbConnection(conn); - for (String modelName : rdb.getAllModelNames().toList()) { - modelCount++; - Graph graph = new GraphRDB( - rdb, - modelName, - null, - GraphRDB.OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING, - false); - tripleCount += graph.size(); - graph.close(); - } - } finally { - if (rdb != null) { - rdb.close(); - } - } - } - String warning = alreadyMigrated ? " Existing triples will be over-written.\n" - : ""; - String question = String.format("Migrating %d triples in %d models " - + "to TDB files in '%s'\n%sContinue? (y/n)", tripleCount, - modelCount, targetDir, warning); - ask(question); - } - - public void migrate() throws SQLException { - copyData(); - writeMigratedRecord(); - } - - private void copyData() throws SQLException { - try (Connection conn = getSqlConnection()) { - IDBConnection rdbConnection = null; - try { - rdbConnection = getRdbConnection(conn); - Dataset tdbDataset = TDBFactory.createDataset(targetDir - .getAbsolutePath()); - copyGraphs(rdbConnection, tdbDataset); - } finally { - if (rdbConnection != null) { - rdbConnection.close(); - } - } - } - } - - @SuppressWarnings("deprecation") - private void copyGraphs(IDBConnection rdbConnection, Dataset tdbDataset) { - DatasetGraph tdbDsGraph = tdbDataset.asDatasetGraph(); - for (String modelName : rdbConnection.getAllModelNames().toList()) { - Graph graph = null; - try { - graph = new GraphRDB(rdbConnection, modelName, null, - GraphRDB.OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING, - false); - tdbDsGraph.addGraph(Node.createURI(modelName), graph); - System.out - .println(String.format(" copied %4d triples from %s", - graph.size(), modelName)); - } finally { - if (graph != null) { - graph.close(); - } - } - } - } - - private void writeMigratedRecord() throws SQLException { - String createTable = String.format("CREATE TABLE %s (date DATE)", - TABLE_MIGRATED); - String deleteOldDates = String.format("DELETE FROM %s", TABLE_MIGRATED); - String insertDate = String.format("INSERT INTO %s (date) VALUES (?)", - TABLE_MIGRATED); - try (Connection conn = getSqlConnection(); - Statement stmt = conn.createStatement(); - PreparedStatement pstmt = conn.prepareStatement(insertDate)) { - if (alreadyMigrated) { - stmt.executeUpdate(deleteOldDates); - } else { - stmt.executeUpdate(createTable); - } - pstmt.setDate(1, new Date(System.currentTimeMillis())); - pstmt.executeUpdate(); - } - } - - private void quit(String message) { - throw new IllegalArgumentException(message); - } - - private void ask(String string) throws UserDeclinedException, IOException { - System.out.println(string); - BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); - String s = br.readLine(); - if ((s == null) || (!s.trim().toLowerCase().equals("y"))) { - throw new UserDeclinedException("OK."); - } - } - - private static class UserDeclinedException extends Exception { - public UserDeclinedException(String message) { - super(message); - } - } - - private Connection getSqlConnection() throws SQLException { - Properties connectionProps; - connectionProps = new Properties(); - connectionProps.put("user", username); - connectionProps.put("password", password); - return DriverManager.getConnection(jdbcUrl, connectionProps); - } - - private IDBConnection getRdbConnection(Connection sqlConnection) { - return new DBConnection(sqlConnection, "MySQL"); - } - - public static void main(String[] args) throws SQLException { - if (args.length != 4) { - System.out.println("Usage: RdbMigrator vivoHomeDir, jdbcUrl, " - + "username, password"); - } - - try { - RdbMigrator rdbm = new RdbMigrator(args[0], args[1], args[2], args[3]); - rdbm.migrate(); - } catch (IllegalArgumentException | UserDeclinedException e) { - System.out.println(e.getMessage()); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/utilities/releaseScripts/6_insert_documentation.rb b/utilities/releaseScripts/6_insert_documentation.rb new file mode 100644 index 00000000..d14c1d96 --- /dev/null +++ b/utilities/releaseScripts/6_insert_documentation.rb @@ -0,0 +1,15 @@ +=begin +-------------------------------------------------------------------------------- + +Create PDF versions of the Installation Instructions and the Upgrade Guide, +from the VIVONEXT Wiki space. + +Store them in the docs directory. + +-------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- +=end +puts "-------------------------------------------------------------------" +puts " Not automated yet. Get Installation and Upgrade PDFs and put " +puts " them into the /doc directory. " +puts "-------------------------------------------------------------------" \ No newline at end of file diff --git a/utilities/releaseScripts/6_create_distribution_files.rb b/utilities/releaseScripts/7_create_distribution_files.rb similarity index 100% rename from utilities/releaseScripts/6_create_distribution_files.rb rename to utilities/releaseScripts/7_create_distribution_files.rb diff --git a/utilities/releaseScripts/7_merge_to_master.rb b/utilities/releaseScripts/8_merge_to_master.rb similarity index 100% rename from utilities/releaseScripts/7_merge_to_master.rb rename to utilities/releaseScripts/8_merge_to_master.rb diff --git a/utilities/releaseScripts/8_push_changes.rb b/utilities/releaseScripts/9_push_changes.rb similarity index 100% rename from utilities/releaseScripts/8_push_changes.rb rename to utilities/releaseScripts/9_push_changes.rb