Commit 27f12f3e authored by Michael Ritter's avatar Michael Ritter

Merge 1.13-RELEASE changes into develop

parents ad392fa7 28d133ab
......@@ -4,7 +4,7 @@
<parent>
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>ace-am</artifactId>
......@@ -243,7 +243,7 @@
<dependency>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-ws</artifactId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
<type>jar</type>
</dependency>
<dependency>
......
......@@ -273,15 +273,12 @@ public final class AuditTokens extends Thread implements CancelCallback {
interrupted = true;
} finally {
validator.close();
LOG.trace("Validator closed");
if (em != null) {
em.close();
}
LOG.trace("Validator closed");
synchronized (runningThreads) {
runningThreads.remove(collection);
}
setCollectionState();
if (interrupted) {
em = PersistUtil.getEntityManager();
......@@ -296,6 +293,10 @@ public final class AuditTokens extends Thread implements CancelCallback {
em.close();
LOG.trace("Token Audit ending successfully for " + collection.getName());
}
synchronized (runningThreads) {
runningThreads.remove(collection);
}
}
}
......
......@@ -129,6 +129,18 @@ public class RemoveItemServlet extends EntityManagerServlet {
dispatcher.forward(request, response);
}
/**
* Remove all MonitoredItems for a collection depending on the type which is passed in. As this
* is a query parameter, we allow it to be either 'C' for corrupt items or 'M' for missing
* items. Upon completion, return the Collection owning the MonitoredItems so that we can
* update the cached values in the CollectionCountContext.
*
* @param collection the Collection owning the MonitoredItems
* @param type the type (state) of MonitoredItem to remove
* @param em the EntityManager to query/update the database
* @param eventSession the session id to use for log entries
* @return A Set of all Collections affected
*/
private Set<Collection> removeForType(Collection collection,
String type,
EntityManager em,
......@@ -148,7 +160,7 @@ public class RemoveItemServlet extends EntityManagerServlet {
state = 'M';
break;
default:
LOG.warn("Not remove type of " + type + "; needs to be corrupt or missing");
LOG.warn("Unable to remove type " + type + "; needs to be corrupt or missing");
}
if (state != 0) {
......@@ -162,8 +174,8 @@ public class RemoveItemServlet extends EntityManagerServlet {
// items at once time which can be very slow when iterating each item individually
PreparedStatement logStatement = connection.prepareStatement(
"INSERT INTO logevent(session, path, date, logtype, collection_id) " +
"SELECT ?, path, NOW(), ?, parentcollection_id FROM monitored_item m " +
"WHERE m.parentcollection_id = ? AND m.state = ?");
"SELECT ?, path, NOW(), ?, parentcollection_id FROM monitored_item m " +
"WHERE m.parentcollection_id = ? AND m.state = ?");
connection.setAutoCommit(false);
logStatement.setLong(1, eventSession);
logStatement.setInt(2, LogEnum.REMOVE_ITEM.getType());
......@@ -193,6 +205,11 @@ public class RemoveItemServlet extends EntityManagerServlet {
return ImmutableSet.of(collection);
}
/**
* Rollback a transaction on a Connection
*
* @param connection the Connection whose transaction to rollback
*/
private void rollback(@Nullable Connection connection) {
try {
if (connection != null) {
......@@ -203,6 +220,16 @@ public class RemoveItemServlet extends EntityManagerServlet {
}
}
/**
* Query the Database and get a reference for an Entity. If the Entity cannot be found, return
* and empty Optional.
*
* @param clazz the class to query on
* @param id the id of the entity
* @param em the EntityManager to query with
* @param <T> the Type, matching the Class being queried
* @return the reference for the entity wrapped in an Optional
*/
private <T> Optional<T> referenceFor(Class<T> clazz, Long id, EntityManager em) {
try {
return Optional.of(em.getReference(clazz, id));
......@@ -212,6 +239,16 @@ public class RemoveItemServlet extends EntityManagerServlet {
}
}
/**
* Remove an individual MonitoredItem from the database and return the affected Collection so we
* know if its CollectionCountContext cache should be updated
*
* @param item the MonitoredItem to remove
* @param em the EntityManager to access the db
* @param session the id of the session for LogEvents
* @param dt the DirectoryTree of the MonitoredItem
* @return the Collection which owns the MonitoredItem
*/
private Collection removeItem(MonitoredItem item, EntityManager em, Long session, DirectoryTree dt) {
Collection c = null;
if (item != null) {
......@@ -297,8 +334,7 @@ public class RemoveItemServlet extends EntityManagerServlet {
private void clearDir(MonitoredItem item) {
LOG.trace("Removing dir: " + item.getPath());
for (MonitoredItem mi : mim.listChildren(item.getParentCollection(),
item.getPath())) {
for (MonitoredItem mi : mim.listChildren(item.getParentCollection(), item.getPath())) {
if (mi.isDirectory()) {
clearDir(mi);
} else {
......
......@@ -26,19 +26,18 @@ public class ImportStatusServlet extends EntityManagerServlet {
long id = getParameter(request, ACTIVE_PARAM, -1);
if (id > 0) {
LOG.info("Querying for collection " + id);
EntityManager manager = PersistUtil.getEntityManager();
Collection collection = manager.find(Collection.class, id);
if (collection != null) {
LOG.info("Found collection " + id);
KSFuture<IngestSupervisor> ksSupervisor = pool.getCache().get(collection);
if (ksSupervisor != null) {
request.setAttribute(ACTIVE_PARAM, ksSupervisor.getKnownResult());
request.setAttribute(ACTIVE_PARAM, ksSupervisor.getKnownResult().getThread());
} else {
LOG.debug("Collection has a null supervisor!");
}
} else {
LOG.info("Unable to get collection " + id);
LOG.debug("Collection " + id + " does not exist");
}
}
......
......@@ -150,7 +150,6 @@ public class IngestThread extends RecursiveAction {
em.persist(item);
numTransactions += 3;
// stateMap.put(identifier, IngestState.NEW);
states.get(IngestState.NEW).add(identifier);
} else {
LOG.debug("[Ingest Thread " + Thread.currentThread().getId()
......@@ -204,10 +203,8 @@ public class IngestThread extends RecursiveAction {
numTransactions += 2;
states.get(IngestState.UPDATED).add(identifier);
// stateMap.put(identifier, IngestState.UPDATED);
} else {
states.get(IngestState.MATCH).add(identifier);
// stateMap.put(identifier, IngestState.MATCH);
}
}
......
......@@ -56,25 +56,25 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<a class="nav-link active" id="pills-queued-tab" role="tab"
href="#pills-queued" data-toggle="pill"
aria-controls="pills-queued" aria-selected="true">Queued
(${supervisor.queuedSize})</a>
(${active.queuedSize})</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-new-tab" role="tab"
href="#pills-new" data-toggle="pill"
aria-controls="pills-new" aria-selected="false">New
(${supervisor.newSize})</a>
(${active.newSize})</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-updated-tab" role="tab"
href="#pills-updated" data-toggle="pill"
aria-controls="pills-updated" aria-selected="false">Updated
(${supervisor.updatedSize})</a>
(${active.updatedSize})</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-match-tab" role="tab"
href="#pills-match" data-toggle="pill"
aira-controls="pills-match" aria-selected="false">
Matched (${supervisor.matchSize})</a>
Matched (${active.matchSize})</a>
</li>
<%-- Maybe in the future
......@@ -91,7 +91,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
role="tabpanel"
aria-labelledby="pills-queued-tab">
<ul class="list-group list-group-flush">
<c:forEach items="${supervisor.queued}" var="identifier">
<c:forEach items="${active.queued}" var="identifier">
<li class="list-group-item">${identifier}</li>
</c:forEach>
</ul>
......@@ -99,7 +99,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<div class="tab-pane fade" id="pills-new" role="tabpanel"
aria-labelledby="pills-new-tab">
<ul class="list-group list-group-flush">
<c:forEach items="${supervisor.newItems}" var="identifier">
<c:forEach items="${active.newItems}" var="identifier">
<li class="list-group-item">${identifier}</li>
</c:forEach>
</ul>
......@@ -107,7 +107,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<div class="tab-pane fade" id="pills-updated" role="tabpanel"
aria-labelledby="pills-updated-tab">
<ul class="list-group list-group-flush">
<c:forEach items="${supervisor.updated}" var="identifier">
<c:forEach items="${active.updated}" var="identifier">
<li class="list-group-item">${identifier}</li>
</c:forEach>
</ul>
......@@ -115,7 +115,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<div class="tab-pane fade" id="pills-match" role="tabpanel"
aria-labelledby="pills-match-tab">
<ul class="list-group list-group-flush">
<c:forEach items="${supervisor.matched}" var="identifier">
<c:forEach items="${active.matched}" var="identifier">
<li class="list-group-item">${identifier}</li>
</c:forEach>
</ul>
......
......@@ -97,7 +97,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
success="${collection.missingFiles}" failure="0"/>
<c:if test="${collection.missingFiles > 0}">
<a class="badge badge-danger text-white"
data-toggle="modal" data-target="#missingModal"
data-toggle="modal" data-target="#mutableModal"
data-href="RemoveItem?redirect=Report&collectionid=${collection.collection.id}&type=missing">
Remove All
</a>
......@@ -280,16 +280,6 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
</div>
<jsp:include page="footer.jsp"/>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"
integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T"
crossorigin="anonymous"></script>
<script type="text/javascript">
$("#selectall").click(function () {
$("input[name=removal]").prop('checked', $(this).prop("checked"));
......
......@@ -4,9 +4,8 @@
<parent>
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-common</artifactId>
<name>ace-common</name>
<packaging>jar</packaging>
......
......@@ -4,9 +4,8 @@
<parent>
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-dist</artifactId>
<name>ace-dist</name>
<url>http://adapt.umiacs.umd.edu/ace</url>
......
......@@ -4,10 +4,9 @@
<parent>
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-api</artifactId>
<name>ace-ims-api</name>
<packaging>jar</packaging>
......
......@@ -5,11 +5,10 @@
<parent>
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
</parent>
<packaging>ear</packaging>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-ear</artifactId>
<name>ace-ims-ear</name>
<url>http://maven.apache.org</url>
......
......@@ -4,9 +4,8 @@
<parent>
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-ejb</artifactId>
<name>ace-ims-ejb</name>
<packaging>ejb</packaging>
......
......@@ -4,9 +4,8 @@
<parent>
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-server</artifactId>
<name>ace-ims-server</name>
<url>http://maven.apache.org</url>
......
......@@ -4,9 +4,8 @@
<parent>
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-war</artifactId>
<name>ace-ims-war</name>
<packaging>war</packaging>
......
......@@ -5,9 +5,8 @@
<parent>
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-ws</artifactId>
<name>ace-ims-ws</name>
<url>http://maven.apache.org</url>
......
......@@ -4,9 +4,8 @@
<parent>
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>audit-core</artifactId>
<name>Core audit queue</name>
<url>http://maven.apache.org</url>
......
......@@ -4,7 +4,7 @@
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace</artifactId>
<version>1.13-SNAPSHOT</version>
<version>1.13-RELEASE</version>
<packaging>pom</packaging>
<scm>
<connection>scm:svn:https://subversion.umiacs.umd.edu/ace/tags/ace-1.9</connection>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment