Commit 601c94b0 authored by toaster's avatar toaster
Browse files

token to acetoken conversion, first steps.

git-svn-id: https://subversion.umiacs.umd.edu/ace/trunk@31 f1b3a171-7291-4a19-a512-95ad0ad9394a
parent 78e6e1be
...@@ -38,6 +38,7 @@ import edu.umiacs.ace.util.EntityManagerServlet; ...@@ -38,6 +38,7 @@ import edu.umiacs.ace.util.EntityManagerServlet;
import edu.umiacs.ace.util.PersistUtil; import edu.umiacs.ace.util.PersistUtil;
import edu.umiacs.ace.monitor.core.Collection; import edu.umiacs.ace.monitor.core.Collection;
import edu.umiacs.ace.monitor.core.Token; import edu.umiacs.ace.monitor.core.Token;
import edu.umiacs.ace.util.DbTokenWriter;
import edu.umiacs.sql.SQL; import edu.umiacs.sql.SQL;
import java.io.IOException; import java.io.IOException;
import java.sql.Connection; import java.sql.Connection;
...@@ -113,8 +114,9 @@ public class ListContentsServlet extends EntityManagerServlet { ...@@ -113,8 +114,9 @@ public class ListContentsServlet extends EntityManagerServlet {
os.println("#Filename | Algorithm | Digest"); os.println("#Filename | Algorithm | Digest");
} }
TokenResponseStoreWriter writer = // TokenResponseStoreWriter writer =
new TokenResponseStoreWriter(os, AuditThreadFactory.getIMS()); // new TokenResponseStoreWriter(os, AuditThreadFactory.getIMS());
DbTokenWriter writer = new DbTokenWriter(AuditThreadFactory.getIMS(),os);
// query for items // query for items
try { try {
db = PersistUtil.getDataSource(); db = PersistUtil.getDataSource();
...@@ -162,7 +164,7 @@ public class ListContentsServlet extends EntityManagerServlet { ...@@ -162,7 +164,7 @@ public class ListContentsServlet extends EntityManagerServlet {
} else if ( TYPE_STORE.equals(output) ) { } else if ( TYPE_STORE.equals(output) ) {
Token tok = em.getReference(Token.class, rs.getLong(3)); Token tok = em.getReference(Token.class, rs.getLong(3));
if ( tok != null ) { if ( tok != null ) {
writer.startToken((TokenResponse) tok.getToken()); writer.startToken(tok);
writer.addIdentifier(formatPath(rs.getString(1))); writer.addIdentifier(formatPath(rs.getString(1)));
writer.writeTokenEntry(); writer.writeTokenEntry();
} }
......
...@@ -31,14 +31,16 @@ ...@@ -31,14 +31,16 @@
package edu.umiacs.ace.monitor.access.browse; package edu.umiacs.ace.monitor.access.browse;
import edu.umiacs.ace.ims.api.TokenValidator; import edu.umiacs.ace.hashtree.Proof;
import edu.umiacs.ace.ims.ws.TokenResponse; import edu.umiacs.ace.hashtree.ProofValidator;
import edu.umiacs.ace.monitor.core.MonitoredItem; import edu.umiacs.ace.monitor.core.MonitoredItem;
import edu.umiacs.ace.util.EntityManagerServlet; import edu.umiacs.ace.util.EntityManagerServlet;
import edu.umiacs.ace.monitor.audit.AuditThreadFactory; import edu.umiacs.ace.monitor.audit.AuditThreadFactory;
import edu.umiacs.ace.monitor.audit.AuditTokens; import edu.umiacs.ace.monitor.audit.AuditTokens;
import edu.umiacs.ace.monitor.access.browse.DirectoryTree.DirectoryNode; import edu.umiacs.ace.monitor.access.browse.DirectoryTree.DirectoryNode;
import edu.umiacs.ace.monitor.core.Collection; import edu.umiacs.ace.monitor.core.Collection;
import edu.umiacs.ace.util.HashValue;
import edu.umiacs.ace.util.TokenUtil;
import java.io.IOException; import java.io.IOException;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
...@@ -138,9 +140,13 @@ public class BrowseServlet extends EntityManagerServlet { ...@@ -138,9 +140,13 @@ public class BrowseServlet extends EntityManagerServlet {
if (master.getToken() != null) if (master.getToken() != null)
{ {
TokenResponse resp = (TokenResponse)master.getToken().getToken(); // TokenResponse resp = (TokenResponse)master.getToken().getToken();
MessageDigest digest = MessageDigest.getInstance(resp.getDigestService()); MessageDigest digest = MessageDigest.getInstance(master.getToken().getProofAlgorithm());
retBean.itemProof = TokenValidator.calculateRoot(digest, master.getFileDigest(), resp.getProofElements());
ProofValidator pv = new ProofValidator();
Proof proof = TokenUtil.extractProof(master.getToken());
byte[] root = pv.rootHash(digest, proof, HashValue.asBytes(master.getFileDigest()));
retBean.itemProof = HashValue.asHexString(root);
} }
return retBean; return retBean;
} catch ( EntityNotFoundException e ) { } catch ( EntityNotFoundException e ) {
......
...@@ -40,7 +40,6 @@ import edu.umiacs.ace.ims.api.IMSService; ...@@ -40,7 +40,6 @@ import edu.umiacs.ace.ims.api.IMSService;
import edu.umiacs.ace.ims.api.TokenRequestBatch; import edu.umiacs.ace.ims.api.TokenRequestBatch;
import edu.umiacs.ace.ims.api.TokenValidator; import edu.umiacs.ace.ims.api.TokenValidator;
import edu.umiacs.ace.ims.ws.TokenRequest; import edu.umiacs.ace.ims.ws.TokenRequest;
import edu.umiacs.ace.ims.ws.TokenResponse;
import edu.umiacs.ace.monitor.access.CollectionCountContext; import edu.umiacs.ace.monitor.access.CollectionCountContext;
import edu.umiacs.ace.util.PersistUtil; import edu.umiacs.ace.util.PersistUtil;
import edu.umiacs.ace.monitor.compare.CollectionCompare; import edu.umiacs.ace.monitor.compare.CollectionCompare;
...@@ -56,6 +55,8 @@ import edu.umiacs.ace.monitor.core.Collection; ...@@ -56,6 +55,8 @@ import edu.umiacs.ace.monitor.core.Collection;
import edu.umiacs.ace.monitor.log.LogEnum; import edu.umiacs.ace.monitor.log.LogEnum;
import edu.umiacs.ace.monitor.log.LogEvent; import edu.umiacs.ace.monitor.log.LogEvent;
import edu.umiacs.ace.monitor.peers.PeerCollection; import edu.umiacs.ace.monitor.peers.PeerCollection;
import edu.umiacs.ace.token.AceToken;
import edu.umiacs.ace.util.TokenUtil;
import edu.umiacs.util.Strings; import edu.umiacs.util.Strings;
import java.io.InputStream; import java.io.InputStream;
import java.security.MessageDigest; import java.security.MessageDigest;
...@@ -78,8 +79,8 @@ import org.apache.log4j.NDC; ...@@ -78,8 +79,8 @@ import org.apache.log4j.NDC;
public final class AuditThread extends Thread implements CancelCallback { public final class AuditThread extends Thread implements CancelCallback {
private static final Logger LOG = Logger.getLogger(AuditThread.class); private static final Logger LOG = Logger.getLogger(AuditThread.class);
private Map<TokenResponse, MonitoredItem> itemMap = private Map<AceToken, MonitoredItem> itemMap =
new ConcurrentHashMap<TokenResponse, MonitoredItem>(); new ConcurrentHashMap<AceToken, MonitoredItem>();
private String imsHost; private String imsHost;
private int imsport; private int imsport;
private Collection coll; private Collection coll;
...@@ -213,7 +214,8 @@ public final class AuditThread extends Thread implements CancelCallback { ...@@ -213,7 +214,8 @@ public final class AuditThread extends Thread implements CancelCallback {
validator.close(); validator.close();
validator = null; validator = null;
} }
lastFileSeen = "Setting collection state";
setCollectionState();
logAuditFinish(); logAuditFinish();
generateAuditReport(); generateAuditReport();
NDC.pop(); NDC.pop();
...@@ -327,6 +329,7 @@ public final class AuditThread extends Thread implements CancelCallback { ...@@ -327,6 +329,7 @@ public final class AuditThread extends Thread implements CancelCallback {
// let token batch finish before processing or items waiting tokens // let token batch finish before processing or items waiting tokens
// will appear as errors. // will appear as errors.
// Thread.sleep(2000);
if ( batch != null ) { if ( batch != null ) {
batch.close(); batch.close();
batch = null; batch = null;
...@@ -338,8 +341,7 @@ public final class AuditThread extends Thread implements CancelCallback { ...@@ -338,8 +341,7 @@ public final class AuditThread extends Thread implements CancelCallback {
// harvest remote collections // harvest remote collections
lastFileSeen = "comparing to peer sites"; lastFileSeen = "comparing to peer sites";
compareToPeers(); compareToPeers();
lastFileSeen = "Setting collection state";
setCollectionState();
} }
...@@ -537,14 +539,15 @@ public final class AuditThread extends Thread implements CancelCallback { ...@@ -537,14 +539,15 @@ public final class AuditThread extends Thread implements CancelCallback {
} }
item.setLastSeen(new Date()); item.setLastSeen(new Date());
item.setSize(currentFile.getFileSize()); item.setSize(currentFile.getFileSize());
AceToken token = TokenUtil.convertToAceToken(item.getToken());
// add to token check queue // add to token check queue
if ( validator != null ) { if ( validator != null ) {
TokenResponse tResp = (TokenResponse) item.getToken(). // TokenResponse tResp = (TokenResponse) item.getToken().
getToken(); // getToken();
itemMap.put(tResp, item); itemMap.put(token, item);
try { try {
validator.add( validator.add(
item.getFileDigest(), tResp); item.getFileDigest(), token);
} catch ( InterruptedException e ) { } catch ( InterruptedException e ) {
abortException = e; abortException = e;
} }
......
...@@ -36,10 +36,11 @@ import edu.umiacs.ace.ims.ws.TokenResponse; ...@@ -36,10 +36,11 @@ import edu.umiacs.ace.ims.ws.TokenResponse;
import edu.umiacs.ace.util.PersistUtil; import edu.umiacs.ace.util.PersistUtil;
import edu.umiacs.ace.monitor.core.MonitoredItem; import edu.umiacs.ace.monitor.core.MonitoredItem;
import edu.umiacs.ace.monitor.core.MonitoredItemManager; import edu.umiacs.ace.monitor.core.MonitoredItemManager;
import edu.umiacs.ace.monitor.core.Token;
import edu.umiacs.ace.monitor.log.LogEventManager; import edu.umiacs.ace.monitor.log.LogEventManager;
import edu.umiacs.ace.monitor.core.Collection; import edu.umiacs.ace.monitor.core.Collection;
import edu.umiacs.ace.monitor.log.LogEnum; import edu.umiacs.ace.monitor.log.LogEnum;
import edu.umiacs.ace.token.AceToken;
import edu.umiacs.ace.util.TokenUtil;
import edu.umiacs.util.Strings; import edu.umiacs.util.Strings;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.Date; import java.util.Date;
...@@ -60,8 +61,8 @@ public class AuditTokens extends Thread implements CancelCallback { ...@@ -60,8 +61,8 @@ public class AuditTokens extends Thread implements CancelCallback {
private static final Map<Collection, AuditTokens> runningThreads = private static final Map<Collection, AuditTokens> runningThreads =
new HashMap<Collection, AuditTokens>(); new HashMap<Collection, AuditTokens>();
// private Map<TokenResponse, Token> tokenMap = new ConcurrentHashMap<TokenResponse, Token>(); // private Map<TokenResponse, Token> tokenMap = new ConcurrentHashMap<TokenResponse, Token>();
private Map<TokenResponse, MonitoredItem> itemMap = private Map<AceToken, MonitoredItem> itemMap =
new ConcurrentHashMap<TokenResponse, MonitoredItem>(); new ConcurrentHashMap<AceToken, MonitoredItem>();
private static final Logger LOG = Logger.getLogger(AuditTokens.class); private static final Logger LOG = Logger.getLogger(AuditTokens.class);
private Collection collection; private Collection collection;
private boolean cancel = false; private boolean cancel = false;
...@@ -234,12 +235,12 @@ public class AuditTokens extends Thread implements CancelCallback { ...@@ -234,12 +235,12 @@ public class AuditTokens extends Thread implements CancelCallback {
for ( Object o : q.getResultList() ) { for ( Object o : q.getResultList() ) {
MonitoredItem item = (MonitoredItem) o; MonitoredItem item = (MonitoredItem) o;
Token t = item.getToken(); AceToken t = TokenUtil.convertToAceToken(item.getToken());
if ( t != null ) { if ( t != null ) {
TokenResponse response = (TokenResponse) t.getToken(); // TokenResponse response = IMSUtil.c;
itemMap.put(response, item); itemMap.put(t, item);
tokensSeen++; tokensSeen++;
validator.add(item.getFileDigest(), response); validator.add(item.getFileDigest(), t);
} }
if ( cancel ) { if ( cancel ) {
break; break;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
package edu.umiacs.ace.monitor.audit; package edu.umiacs.ace.monitor.audit;
import edu.umiacs.ace.exception.StatusCode; import edu.umiacs.ace.exception.StatusCode;
import edu.umiacs.ace.ims.api.IMSUtil;
import edu.umiacs.ace.ims.api.RequestBatchCallback; import edu.umiacs.ace.ims.api.RequestBatchCallback;
import edu.umiacs.ace.util.PersistUtil; import edu.umiacs.ace.util.PersistUtil;
import edu.umiacs.ace.monitor.core.MonitoredItem; import edu.umiacs.ace.monitor.core.MonitoredItem;
...@@ -41,6 +42,7 @@ import edu.umiacs.ace.ims.ws.TokenRequest; ...@@ -41,6 +42,7 @@ import edu.umiacs.ace.ims.ws.TokenRequest;
import edu.umiacs.ace.ims.ws.TokenResponse; import edu.umiacs.ace.ims.ws.TokenResponse;
import edu.umiacs.ace.monitor.core.Collection; import edu.umiacs.ace.monitor.core.Collection;
import edu.umiacs.ace.monitor.log.LogEnum; import edu.umiacs.ace.monitor.log.LogEnum;
import edu.umiacs.ace.token.AceToken;
import edu.umiacs.util.Strings; import edu.umiacs.util.Strings;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -100,10 +102,18 @@ public class FileAuditCallback implements RequestBatchCallback { ...@@ -100,10 +102,18 @@ public class FileAuditCallback implements RequestBatchCallback {
item = mim.getItemByPath(tr.getName(), coll); item = mim.getItemByPath(tr.getName(), coll);
Token token = new Token(); Token token = new Token();
token.setCreateDate(new Date()); // token.setCreateDate(new Date());
token.setValid(true); token.setValid(true);
token.setLastValidated(new Date());
token.setToken((Serializable) tr); // AceToken at = IMSUtil.convertResponse(tr, AuditThreadFactory.getIMS());
// token.setLastValidated();
// token.setToken((Serializable) tr);
token.setImsService(tr.getTokenClassName());
token.setProofText(IMSUtil.formatProof(tr));
token.setRound(tr.getRoundId());
token.setProofAlgorithm(tr.getDigestService());
token.setCreateDate(tr.getTimestamp().toGregorianCalendar().getTime());
token.setParentCollection(coll); token.setParentCollection(coll);
if ( !map.containsKey(tr.getName()) || item == null ) { if ( !map.containsKey(tr.getName()) || item == null ) {
LOG.error("No request for response: " + tr.getName() + " or item null, item: " LOG.error("No request for response: " + tr.getName() + " or item null, item: "
......
...@@ -40,6 +40,7 @@ import java.util.Map; ...@@ -40,6 +40,7 @@ import java.util.Map;
import edu.umiacs.ace.ims.ws.TokenResponse; import edu.umiacs.ace.ims.ws.TokenResponse;
import edu.umiacs.ace.monitor.core.Collection; import edu.umiacs.ace.monitor.core.Collection;
import edu.umiacs.ace.monitor.log.LogEnum; import edu.umiacs.ace.monitor.log.LogEnum;
import edu.umiacs.ace.token.AceToken;
import edu.umiacs.util.Strings; import edu.umiacs.util.Strings;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction; import javax.persistence.EntityTransaction;
...@@ -52,14 +53,14 @@ import org.apache.log4j.Logger; ...@@ -52,14 +53,14 @@ import org.apache.log4j.Logger;
public final class TokenAuditCallback implements ValidationCallback { public final class TokenAuditCallback implements ValidationCallback {
private static final Logger LOG = Logger.getLogger(ValidationCallback.class); private static final Logger LOG = Logger.getLogger(ValidationCallback.class);
private Map<TokenResponse, MonitoredItem> itemMap; private Map<AceToken, MonitoredItem> itemMap;
private long totalErrors = 0; private long totalErrors = 0;
private long validTokens = 0; private long validTokens = 0;
private CancelCallback cancel; private CancelCallback cancel;
// private Collection collection; // private Collection collection;
LogEventManager logManager; LogEventManager logManager;
public TokenAuditCallback( Map<TokenResponse, MonitoredItem> itemMap, public TokenAuditCallback( Map<AceToken, MonitoredItem> itemMap,
CancelCallback callback, Collection collection, long session ) { CancelCallback callback, Collection collection, long session ) {
this.itemMap = itemMap; this.itemMap = itemMap;
this.cancel = callback; this.cancel = callback;
...@@ -92,7 +93,7 @@ public final class TokenAuditCallback implements ValidationCallback { ...@@ -92,7 +93,7 @@ public final class TokenAuditCallback implements ValidationCallback {
} }
@Override @Override
public void validToken( TokenResponse response ) { public void validToken( AceToken response ) {
MonitoredItem item = itemMap.get(response); MonitoredItem item = itemMap.get(response);
if ( item == null ) { if ( item == null ) {
return; return;
...@@ -107,8 +108,8 @@ public final class TokenAuditCallback implements ValidationCallback { ...@@ -107,8 +108,8 @@ public final class TokenAuditCallback implements ValidationCallback {
if ( !token.getValid() ) { if ( !token.getValid() ) {
token.setValid(true); token.setValid(true);
// LogEventManager lem = new LogEventManager(session, collection); // LogEventManager lem = new LogEventManager(session, collection);
String path = response.getName(); // String path = response.getName();
em.persist(logManager.createItemEvent(LogEnum.TOKEN_VALID, path)); em.persist(logManager.createItemEvent(LogEnum.TOKEN_VALID, item.getPath()));
// em.persist(lem.validToken(path, collection)); // em.persist(lem.validToken(path, collection));
if ( item.getState() == 'I' ) { if ( item.getState() == 'I' ) {
item.setState('A'); item.setState('A');
...@@ -123,11 +124,11 @@ public final class TokenAuditCallback implements ValidationCallback { ...@@ -123,11 +124,11 @@ public final class TokenAuditCallback implements ValidationCallback {
em.merge(item); em.merge(item);
trans.commit(); trans.commit();
em.close(); em.close();
LOG.trace("Token valid: " + response.getName()); LOG.trace("Token valid: " + item.getPath());
} }
@Override @Override
public void invalidToken( TokenResponse response, String correctCSI, public void invalidToken( AceToken response, String correctCSI,
String calculatedCSI ) { String calculatedCSI ) {
MonitoredItem item = itemMap.get(response); MonitoredItem item = itemMap.get(response);
...@@ -143,9 +144,9 @@ public final class TokenAuditCallback implements ValidationCallback { ...@@ -143,9 +144,9 @@ public final class TokenAuditCallback implements ValidationCallback {
if ( token.getValid() ) { if ( token.getValid() ) {
token.setValid(false); token.setValid(false);
String path = response.getName(); // String path = response.getName();
String message = "Generated CSI: " + calculatedCSI + " IMS (correct) CSI: " + correctCSI; String message = "Generated CSI: " + calculatedCSI + " IMS (correct) CSI: " + correctCSI;
em.persist(logManager.createItemEvent(LogEnum.TOKEN_INVALID, path, message)); em.persist(logManager.createItemEvent(LogEnum.TOKEN_INVALID, item.getPath(), message));
if ( item.getState() == 'A' ) { if ( item.getState() == 'A' ) {
item.setState('I'); item.setState('I');
item.setStateChange(new Date()); item.setStateChange(new Date());
...@@ -161,6 +162,6 @@ public final class TokenAuditCallback implements ValidationCallback { ...@@ -161,6 +162,6 @@ public final class TokenAuditCallback implements ValidationCallback {
em.close(); em.close();
totalErrors++; totalErrors++;
LOG.trace("Token invalid: " + response.getName()); LOG.trace("Token invalid: " + item.getPath());
} }
} }
...@@ -28,13 +28,11 @@ ...@@ -28,13 +28,11 @@
* Maryland Institute for Advanced Computer Study. * Maryland Institute for Advanced Computer Study.
*/ */
// $Id$ // $Id$
package edu.umiacs.ace.monitor.core; package edu.umiacs.ace.monitor.core;
import edu.umiacs.ace.ims.api.XMLTokenWriter; import edu.umiacs.ace.monitor.audit.AuditThreadFactory;
import edu.umiacs.ace.ims.ws.TokenResponse; import edu.umiacs.ace.util.DbTokenWriter;
import edu.umiacs.ace.util.EntityManagerServlet; import edu.umiacs.ace.util.EntityManagerServlet;
import edu.umiacs.util.Strings;
import java.io.IOException; import java.io.IOException;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.servlet.ServletException; import javax.servlet.ServletException;
...@@ -52,20 +50,16 @@ public class DownloadTokenServlet extends EntityManagerServlet { ...@@ -52,20 +50,16 @@ public class DownloadTokenServlet extends EntityManagerServlet {
protected void processRequest( HttpServletRequest request, protected void processRequest( HttpServletRequest request,
HttpServletResponse response, EntityManager em ) HttpServletResponse response, EntityManager em )
throws ServletException, IOException { throws ServletException, IOException {
String idStr = request.getParameter(PARAM_TOKEN_ID); Token token = getToken(request, em);
if ( !Strings.isValidLong(idStr) ) {
throw new ServletException("Must supply id");
}
long id = Long.parseLong(idStr);
Token token = em.getReference(Token.class, id);
if ( token == null ) { if ( token == null ) {
throw new ServletException("No token for id: " + id); throw new ServletException("No valid token ID specified");
} }
XMLTokenWriter writer = new XMLTokenWriter(); DbTokenWriter writer =
new DbTokenWriter(AuditThreadFactory.getIMS(), response.getOutputStream());
response.setContentType("text/xml"); writer.startToken(token);
writer.write(response.getOutputStream(), (TokenResponse) token.getToken()); response.setContentType("text/plain");
writer.writeTokenEntry();
} }
} }
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
package edu.umiacs.ace.monitor.core; package edu.umiacs.ace.monitor.core;
import edu.umiacs.ace.monitor.core.Collection;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.Column; import javax.persistence.Column;
...@@ -39,7 +38,6 @@ import javax.persistence.Entity; ...@@ -39,7 +38,6 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
...@@ -53,7 +51,7 @@ import javax.persistence.TemporalType; ...@@ -53,7 +51,7 @@ import javax.persistence.TemporalType;
* @author toaster * @author toaster
*/ */
@Entity @Entity
@Table(name = "token") @Table(name = "acetoken")
@NamedQueries({ @NamedQueries({
@NamedQuery(name = "Token.listByCollection", query = @NamedQuery(name = "Token.listByCollection", query =
"SELECT t FROM MonitoredItem i, Token t WHERE i.parentCollection = :coll AND i.token = t"), "SELECT t FROM MonitoredItem i, Token t WHERE i.parentCollection = :coll AND i.token = t"),
...@@ -71,17 +69,20 @@ public class Token implements Serializable { ...@@ -71,17 +69,20 @@ public class Token implements Serializable {
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date createDate; private Date createDate;
private boolean valid; private boolean valid;
@Column(name = "java_token_response") // @Column(name = "java_token_response")
@Lob // @Lob
private Serializable token; // private Serializable token;
@ManyToOne @ManyToOne
private Collection parentCollection; private Collection parentCollection;
// private String fileDigest;
// New items, from token itself // New items, from token itself
// private String proofText; @Column(name = "PROOFTEXT")
// private String imsService; private String proofText;
// private String proofAlgorithm; @Column(name = "IMSSERVICE")
// private long round; private String imsService;
@Column(name = "PROOFALGORITHM")
private String proofAlgorithm;
@Column(name = "ROUND")
private long round;
public void setId( Long id ) { public void setId( Long id ) {
this.id = id; this.id = id;
...@@ -115,6 +116,38 @@ public class Token implements Serializable { ...@@ -115,6 +116,38 @@ public class Token implements Serializable {
return "edu.umiacs.ace.monitor.items.Token[id=" + id + "]"; return "edu.umiacs.ace.monitor.items.Token[id=" + id + "]";
} }
public String getImsService() {
return imsService;
}
public String getProofAlgorithm() {
return proofAlgorithm;
}
public String getProofText() {
return proofText;
}
public long getRound() {
return round;
}