Skip to content

Commit

Permalink
Fix #60 by ensuring we are loading existing resources instead of call…
Browse files Browse the repository at this point in the history
…ing "create()" on them again.
  • Loading branch information
tdonohue committed Nov 10, 2017
1 parent ed6a9eb commit 9d23f4c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ target
*.war
*.ear

# Don't ignore gradle-wrapper distributed in project
!/gradle/wrapper/gradle-wrapper.jar

# Serverless directories
.serverless
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ public BinaryServiceImpl(final ResourceTripleDao dao) {
protected FedoraBinary create(final URI identifier) {
return new FedoraBinaryImpl(identifier, getResourceTripleDao());
}

@Override
protected FedoraBinary load(final URI identifier) {
return new FedoraBinaryImpl(identifier, getResourceTripleDao());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ protected Container create(final URI identifier) {
return new ContainerImpl(identifier, dao);
}

@Override
protected Container load(final URI identifier) {
LOGGER.debug("Load: {}", identifier);
final ResourceTripleDao dao = getResourceTripleDao();
return new ContainerImpl(identifier, dao);
}

/**
* Get system generated triples for this resource
* @param identifier resource URI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public boolean exists(final URI identifier) {
@Override
public T find(final URI identifier) {
if (exists(identifier)) {
return create(identifier);
return load(identifier);
} else {
return null;
}
Expand Down Expand Up @@ -63,4 +63,13 @@ protected ResourceTripleDao getResourceTripleDao() {
* @return
*/
abstract protected T create(final URI identifier);


/**
* load existing resource
*
* @param identifier
* @return
*/
abstract protected T load(final URI identifier);
}

0 comments on commit 9d23f4c

Please sign in to comment.