Commit 0896e36b authored by shake's avatar shake
Browse files

Basic handling for file registered state

git-svn-id: https://subversion.umiacs.umd.edu/ace/trunk@147 f1b3a171-7291-4a19-a512-95ad0ad9394a
parent 9f2b15f0
......@@ -562,8 +562,7 @@ public final class AuditThread extends Thread implements CancelCallback {
if (validator != null) {
itemMap.put(token, item);
try {
validator.add(
item.getFileDigest(), token);
validator.add(item.getFileDigest(), token);
} catch (InterruptedException e) {
abortException = e;
}
......
......@@ -60,7 +60,7 @@ import javax.persistence.TemporalType;
* P - partner does not have this file
* D - partner file has different digest
* @author toaster
* 1.6+
* 1.6b+
* R - file registered but not ready for auditing
*/
@Entity
......
......@@ -45,6 +45,7 @@ import javax.persistence.NoResultException;
import javax.persistence.Query;
/**
* Class to register directories from a token store
*
* @author shake
*/
......
......@@ -76,7 +76,8 @@ public class IngestStore extends EntityManagerServlet {
Map<String, Token> batchTokens = new HashMap<String, Token>();
if (item != null && !item.isDirectory())
throw new ServletException("Selected item is not a directory " + item.getPath());
throw new ServletException( "Selected item is not a directory "
+ item.getPath() );
if (!ServletFileUpload.isMultipartContent(request)) {
throw new ServletException("No file attached");
......
......@@ -170,7 +170,7 @@ public class IngestThread extends Thread {
updateToken(em, token, item, coll, identifier);
}
// With large Token Stores, we can get a large number of transactions
// With large Token Stores, we get a large number of transactions
// Flusing and Clearing the EM helps to clear some memory
if ( numTransactions > 7000 ) {
em.flush();
......@@ -184,7 +184,6 @@ public class IngestThread extends Thread {
trans = null;
em = null;
finished();
// System.out.println("Thread finished: " + numTransactions);
}
}
......
......@@ -32,6 +32,7 @@ package edu.umiacs.ace.monitor.register;
import edu.umiacs.ace.monitor.core.Collection;
import edu.umiacs.ace.monitor.core.Token;
import edu.umiacs.ace.util.PersistUtil;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashSet;
......@@ -40,6 +41,8 @@ import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
/**
*
......@@ -49,12 +52,14 @@ public class IngestThreadFactory extends Thread{
private Map<String, Token> tokens;
private List<IngestThread> threads;
private IngestDirectory idThread;
private Collection coll;
// private EntityTransaction trans;
// private EntityManager em = PersistUtil.getEntityManager();
public IngestThreadFactory(Map<String, Token> tokens, Collection coll){
this.tokens = tokens;
this.coll = coll;
//this.trans = em.getTransaction();
threads = new ArrayList<IngestThread>();
......@@ -95,7 +100,16 @@ public class IngestThreadFactory extends Thread{
Logger.getLogger(
IngestThreadFactory.class.getName()).log(Level.SEVERE, null, ex);
}finally{
// System.out.println("All threads finished");
if ( !getNewTokens().isEmpty() ) {
System.out.println("Setting collection to errrrr");
coll.setState('E');
EntityManager em = PersistUtil.getEntityManager();
EntityTransaction trans = em.getTransaction();
trans.begin();
em.merge(coll);
trans.commit();
trans = null;
}
}
}
......@@ -118,13 +132,6 @@ public class IngestThreadFactory extends Thread{
joinThreads();
}
private void removeThreads() {
for ( IngestThread it: threads ) {
threads.remove(it);
it = null;
}
}
public Set<String> getUpdatedTokens() {
Set<String> updated = new HashSet<String>();
for (IngestThread it: threads) {
......
......@@ -135,6 +135,9 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
<c:when test="${selectedFile.root.state eq 'M'}">
File Missing
</c:when>
<c:when test="${selectedFile.root.state eq 'R'}">
File Registered
</c:when>
<c:when test="${selectedFile.root.state eq 'P'}">
Remote File Missing
</c:when>
......
......@@ -130,6 +130,9 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
<c:when test="${item.state eq 'D'}">
Remote Corrupt
</c:when>
<c:when test="${item.state eq 'R'}">
File Registered
</c:when>
<c:otherwise>
${item.state}
</c:otherwise>
......
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