Skip to content

Commit

Permalink
Merge pull request #1367 from NCEAS/dev-2.10
Browse files Browse the repository at this point in the history
Dev 2.10 for 2.10.4 release
  • Loading branch information
taojing2002 authored Jul 16, 2019
2 parents 0f1e2ff + b0fcc64 commit cf15c3e
Show file tree
Hide file tree
Showing 14 changed files with 803 additions and 56 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Metacat: Data Preservation and Discovery System

Version: 2.10.3 Release
Version: 2.10.4 Release

Send feedback and bugs to: [email protected]
http://github.com/NCEAS/metacat
Expand Down Expand Up @@ -67,6 +67,11 @@ for the next release.

## Release Notes

### Release Notes for 2.10.4:
Bugs fixed in this release:
* Publishing dataset with provenance loses all provenance relationships
* Publish call fails after adding provenance information

### Release Notes for 2.10.3:
New features and bugs fixed in this release:
* Update DOI registrations for EML objects with complete metadata
Expand Down
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#Version of this build. This needs to be a dotted numeric version. For
#instance 1.9.1 is okay. 1.9.1_rc1 is not.
metacat.version=2.10.3
metacat.version=2.10.4

#This is for packaging purposes. leave it blank for final production release.
metacat.releaseCandidate=
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<project name="metacat" default="jar" basedir="."
xmlns:artifact="antlib:org.apache.maven.artifact.ant">

<property name="metacatui-tag" value="2.6.2" />
<property name="metacatui-tag" value="2.6.4" />
<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_1_2" />
<property name="seek-tag" value="tags/ECOGRID_1_2_3" />

Expand Down
2 changes: 0 additions & 2 deletions lib/admin/metacat-configuration.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@
%>
<div class="alert alert-success"><i class="icon-thumbs-up"></i>Configuration of Metacat is complete. Please restart Tomcat so that the webapps are initialized with these settings.
Note that this may take some time while the system initializes with the new configuration values.</div>
<div class="alert alert-success">All objects on this server need to be re-indexed because this Metacat release modified the schema file of the Solr server.
The details of re-indexing can be found in the documentation.</div>
<%
}
}
Expand Down
3 changes: 2 additions & 1 deletion lib/metacat.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ server.internalPort=80
############### Application Values ############

## one of the few places where we use ANT tokens
application.metacatVersion=2.10.3
application.metacatVersion=2.10.4
application.metacatReleaseInfo=-1
application.readOnlyMode=false

Expand Down Expand Up @@ -113,6 +113,7 @@ database.upgradeVersion.2.10.0=upgrade-db-to-2.10.0
database.upgradeVersion.2.10.1=upgrade-db-to-2.10.1
database.upgradeVersion.2.10.2=upgrade-db-to-2.10.2
database.upgradeVersion.2.10.3=upgrade-db-to-2.10.3
database.upgradeVersion.2.10.4=upgrade-db-to-2.10.4
## for running java-based utilities
database.upgradeUtility.1.5.0=edu.ucsb.nceas.metacat.admin.upgrade.Upgrade1_5_0
database.upgradeUtility.2.0.0=edu.ucsb.nceas.metacat.admin.upgrade.Upgrade2_0_0
Expand Down
2 changes: 1 addition & 1 deletion metacat-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>edu.ucsb.nceas.metacat.common</groupId>
<artifactId>metacat-common</artifactId>
<packaging>jar</packaging>
<version>2.10.3</version>
<version>2.10.4</version>
<name>metacat-common</name>
<url>http://maven.apache.org</url>
<properties>
Expand Down
4 changes: 2 additions & 2 deletions metacat-index/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<groupId>edu.ucsb.nceas.metacat.index</groupId>
<artifactId>metacat-index</artifactId>
<packaging>war</packaging>
<version>2.10.3</version>
<version>2.10.4</version>
<name>metacat-index</name>
<url>http://maven.apache.org</url>

<properties>
<d1_cn_index_processor_version>2.3.8</d1_cn_index_processor_version>
<metacat_common_version>2.10.3</metacat_common_version>
<metacat_common_version>2.10.4</metacat_common_version>
</properties>

<repositories>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.ecoinformatics</groupId>
<artifactId>metacat</artifactId>
<version>2.10.3</version>
<version>2.10.4</version>
<name>metacat</name>
<packaging>war</packaging>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<d1_libclient_version>2.3.1</d1_libclient_version>
<d1_portal_version>2.3.1</d1_portal_version>
<metacat_common_version>2.10.3</metacat_common_version>
<metacat_common_version>2.10.4</metacat_common_version>
</properties>
<repositories>
<repository>
Expand Down
71 changes: 27 additions & 44 deletions src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
import edu.ucsb.nceas.metacat.common.query.EnabledQueryEngines;
import edu.ucsb.nceas.metacat.common.query.stream.ContentTypeByteArrayInputStream;
import edu.ucsb.nceas.metacat.dataone.hazelcast.HazelcastService;
import edu.ucsb.nceas.metacat.dataone.resourcemap.ResourceMapModifier;
import edu.ucsb.nceas.metacat.index.MetacatSolrEngineDescriptionHandler;
import edu.ucsb.nceas.metacat.index.MetacatSolrIndex;
import edu.ucsb.nceas.metacat.properties.PropertyService;
Expand Down Expand Up @@ -2158,8 +2159,20 @@ public Identifier publish(Session session, Identifier originalIdentifier) throws
logMetacat.warn("No potential ORE map found for: " + potentialOreIdentifier.getValue()+" by the name convention.");
// try the SOLR index
List<Identifier> potentialOreIdentifiers = this.lookupOreFor(session, originalIdentifier);
if (potentialOreIdentifiers != null) {
potentialOreIdentifier = potentialOreIdentifiers.get(0);
if (potentialOreIdentifiers != null && potentialOreIdentifiers.size() >0) {
int size = potentialOreIdentifiers.size();
for (int i = size-1; i>=0; i--) {
Identifier id = potentialOreIdentifiers.get(i);
if (id != null && id.getValue() != null && !id.getValue().trim().equals("")) {
SystemMetadata sys = this.getSystemMetadata(session, id);
if(sys != null && sys.getObsoletedBy() == null) {
//found the non-obsoletedBy ore document.
logMetacat.debug("MNodeService.publish - found the ore map from the list when the index is " + i);
potentialOreIdentifier = id;
break;
}
}
}
try {
oreInputStream = this.get(session, potentialOreIdentifier);
} catch (NotFound nf2) {
Expand All @@ -2173,22 +2186,10 @@ public Identifier publish(Session session, Identifier originalIdentifier) throws
if (oreInputStream != null) {
logMetacat.info("MNodeService.publish - we find the old ore document "+potentialOreIdentifier+" for the metacat object "+originalIdentifier);
Identifier newOreIdentifier = MNodeService.getInstance(request).generateIdentifier(session, MNodeService.UUID_SCHEME, null);

Map<Identifier, Map<Identifier, List<Identifier>>> resourceMapStructure = ResourceMapFactory.getInstance().parseResourceMap(oreInputStream);
Map<Identifier, List<Identifier>> sciMetaMap = resourceMapStructure.get(potentialOreIdentifier);
List<Identifier> dataIdentifiers = sciMetaMap.get(originalIdentifier);

// reconstruct the ORE with the new identifiers
//the original identifier can be in the data object list, we should replace it if does exist.
if(dataIdentifiers.contains(originalIdentifier)) {
dataIdentifiers.remove(originalIdentifier);
dataIdentifiers.add(newIdentifier);
}
sciMetaMap.remove(originalIdentifier);
sciMetaMap.put(newIdentifier, dataIdentifiers);

ResourceMap resourceMap = ResourceMapFactory.getInstance().createResourceMap(newOreIdentifier, sciMetaMap);
String resourceMapString = ResourceMapFactory.getInstance().serializeResourceMap(resourceMap);
ResourceMapModifier modifier = new ResourceMapModifier(potentialOreIdentifier, oreInputStream, newOreIdentifier);
ByteArrayOutputStream out = new ByteArrayOutputStream();
modifier.replaceObsoletedId(originalIdentifier, newIdentifier, out, session.getSubject());
String resourceMapString = out.toString("UTF-8");

// get the original ORE SM and update the values
SystemMetadata originalOreSysMeta = this.getSystemMetadata(session, potentialOreIdentifier);
Expand All @@ -2209,17 +2210,19 @@ public Identifier publish(Session session, Identifier originalIdentifier) throws
oreSysMeta.setObsoletedBy(null);
oreSysMeta.setSize(BigInteger.valueOf(resourceMapString.getBytes("UTF-8").length));
oreSysMeta.setChecksum(ChecksumUtil.checksum(resourceMapString.getBytes("UTF-8"), oreSysMeta.getChecksum().getAlgorithm()));
oreSysMeta.setFileName("resourceMap_" + newOreIdentifier.getValue() + ".rdf.xml");

// ensure ORE is publicly readable
oreSysMeta = makePublicIfNot(oreSysMeta, potentialOreIdentifier);
oreSysMeta = makePublicIfNot(oreSysMeta, potentialOreIdentifier);
List<Identifier> dataIdentifiers = modifier.getSubjectsOfDocumentedBy(newIdentifier);
// ensure all data objects allow public read
List<String> pidsToSync = new ArrayList<String>();
for (Identifier dataId: dataIdentifiers) {
SystemMetadata dataSysMeta = this.getSystemMetadata(session, dataId);
dataSysMeta = makePublicIfNot(dataSysMeta, dataId);
this.updateSystemMetadata(dataSysMeta);
pidsToSync.add(dataId.getValue());
SystemMetadata dataSysMeta = this.getSystemMetadata(session, dataId);
dataSysMeta = makePublicIfNot(dataSysMeta, dataId);
this.updateSystemMetadata(dataSysMeta);
pidsToSync.add(dataId.getValue());

}
SyncAccessPolicy sap = new SyncAccessPolicy();
try {
Expand Down Expand Up @@ -2264,26 +2267,6 @@ public Identifier publish(Session session, Identifier originalIdentifier) throws
ServiceFailure sf = new ServiceFailure("1030", e.getMessage());
sf.initCause(e);
throw sf;
} catch (OREException e) {
// report as service failure
ServiceFailure sf = new ServiceFailure("1030", e.getMessage());
sf.initCause(e);
throw sf;
} catch (URISyntaxException e) {
// report as service failure
ServiceFailure sf = new ServiceFailure("1030", e.getMessage());
sf.initCause(e);
throw sf;
} catch (OREParserException e) {
// report as service failure
ServiceFailure sf = new ServiceFailure("1030", e.getMessage());
sf.initCause(e);
throw sf;
} catch (ORESerialiserException e) {
// report as service failure
ServiceFailure sf = new ServiceFailure("1030", e.getMessage());
sf.initCause(e);
throw sf;
} catch (NoSuchAlgorithmException e) {
// report as service failure
ServiceFailure sf = new ServiceFailure("1030", e.getMessage());
Expand Down
Loading

0 comments on commit cf15c3e

Please sign in to comment.