Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using userspace last-modified property #917

Closed
wants to merge 9 commits into from
Closed

Using userspace last-modified property #917

wants to merge 9 commits into from

Conversation

escowles
Copy link
Contributor

  • Last-modified property and ETag based on it do not change with inbound references.

Fixes https://jira.duraspace.org/browse/FCREPO-1742

try {
getNode().setProperty(FEDORA_LASTMODIFIED, Calendar.getInstance(getTimeZone("UTC")));
} catch (final RepositoryException e) {
LOGGER.info("Exception caught when trying to update lastModified date", e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe LOGGER::error here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please do not dump the full exception (i.e. LOGGER.info("...", e)). Instead, just log the e.getMessage().

@escowles
Copy link
Contributor Author

I've made the logging changes suggested and updated the lastModified test to round the dates to the nearest second to avoid intermittent failures.

@awoods
Copy link

awoods commented Oct 19, 2015

@escowles, is there a reason why FedoraResourceImpl.updateProperties() does not call touch()?

@@ -347,7 +353,9 @@ public Date getCreatedDate() {
public Date getLastModifiedDate() {

try {
if (hasProperty(JCR_LASTMODIFIED)) {
if (hasProperty(FEDORA_LASTMODIFIED)) {
return new Date(getProperty(FEDORA_LASTMODIFIED).getDate().getTimeInMillis());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some logging could be nice to help debug where the date is coming from.

@escowles
Copy link
Contributor Author

FedoraResourceImpl.updateProperties() should have been calling touch(), but the jcr:lastModified property was still being output, so no tests were failing. In other cases, there were two fedora:lastModified properties in the output.

I've updated updateProperties() to call touch() and suppressed jcr:lastModified so now only the fedora:lastModified property is being used in the RDF generation.

@awoods
Copy link

awoods commented Oct 29, 2015

I am seeing some immediate, unexpected behavior:

  1. Whenever I create a resource, the fedora:lastModified date/time precedes the fedora:created value... that is strange
  2. When I add a child resource to a container, the fedora:lastModified does not change... I would have expected it to change, no?

@escowles, do you feel confident in this implementation? I am inclined to wait on further testing until you feel like all of the scenarios work as you would expect.

@escowles
Copy link
Contributor Author

I'm not surprised there are some additional places where we need to call touch(). The general whack-a-mole nature of this PR makes me think a little time writing up the expected behavior would be time well spent.

@acoburn
Copy link
Contributor

acoburn commented May 3, 2016

Closing this in favor of #1033

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants