Commit 665b6cb2 authored by shake's avatar shake
Browse files

Updated settings page

Fixed a bug which caused an items state to not change if a token was previously set invalid.

git-svn-id: https://subversion.umiacs.umd.edu/ace/trunk@164 f1b3a171-7291-4a19-a512-95ad0ad9394a
parent 9b81d61a
...@@ -57,14 +57,14 @@ public final class TokenAuditCallback implements ValidationCallback { ...@@ -57,14 +57,14 @@ public final class TokenAuditCallback implements ValidationCallback {
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<AceToken, 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;
// this.collection = collection; // this.collection = collection;
logManager = new LogEventManager(session, collection); logManager = new LogEventManager(session, collection);
} }
...@@ -85,7 +85,7 @@ public final class TokenAuditCallback implements ValidationCallback { ...@@ -85,7 +85,7 @@ public final class TokenAuditCallback implements ValidationCallback {
// trans.begin(); // trans.begin();
String msg = "Exception in batch thread" + Strings.exceptionAsString(throwable); String msg = "Exception in batch thread" + Strings.exceptionAsString(throwable);
logManager.persistCollectionEvent(LogEnum.SYSTEM_ERROR, msg, em); logManager.persistCollectionEvent(LogEnum.SYSTEM_ERROR, msg, em);
// lem.abortSite(collection, "Exception in batch thread", throwable); // lem.abortSite(collection, "Exception in batch thread", throwable);
// trans.commit(); // trans.commit();
em.close(); em.close();
cancel.cancel(); cancel.cancel();
...@@ -107,14 +107,15 @@ public final class TokenAuditCallback implements ValidationCallback { ...@@ -107,14 +107,15 @@ 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, item.getPath())); 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' ) { }
item.setState('A');
item.setStateChange(new Date()); if ( item.getState() == 'I' ) {
} item.setState('A');
item.setStateChange(new Date());
} }
validTokens++; validTokens++;
...@@ -140,19 +141,19 @@ public final class TokenAuditCallback implements ValidationCallback { ...@@ -140,19 +141,19 @@ public final class TokenAuditCallback implements ValidationCallback {
EntityManager em = PersistUtil.getEntityManager(); EntityManager em = PersistUtil.getEntityManager();
// token.setLastValidated(new Date()); // token.setLastValidated(new Date());
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, item.getPath(), message)); em.persist(logManager.createItemEvent(LogEnum.TOKEN_INVALID, item.getPath(), message));
if ( item.getState() == 'A' ) {
item.setState('I');
item.setStateChange(new Date());
}
} }
if ( item.getState() == 'A' ) {
item.setState('I');
item.setStateChange(new Date());
}
validTokens++; validTokens++;
EntityTransaction trans = em.getTransaction(); EntityTransaction trans = em.getTransaction();
trans.begin(); trans.begin();
......
...@@ -216,7 +216,7 @@ public class IngestThread extends Thread { ...@@ -216,7 +216,7 @@ public class IngestThread extends Thread {
identifier, coll.getDirectory() + identifier); identifier, coll.getDirectory() + identifier);
em.persist(token); em.persist(token);
item.setToken(token); item.setToken(token);
item.setState('A'); item.setState('I');
em.merge(item); em.merge(item);
em.persist(event); em.persist(event);
numTransactions += 3; numTransactions += 3;
......
...@@ -57,6 +57,16 @@ ...@@ -57,6 +57,16 @@
<div class="settingsVal"><input type=text name="ims" value="${currSettings['ims']}"/></div> <div class="settingsVal"><input type=text name="ims" value="${currSettings['ims']}"/></div>
<div class="settingsHelp"><img src="images/help.png" title="IMS hostname to use. Unless you deployed your own IMS, this should probably not be changed"></div> <div class="settingsHelp"><img src="images/help.png" title="IMS hostname to use. Unless you deployed your own IMS, this should probably not be changed"></div>
</div> </div>
<div class="settingsRow">
<div class="settingsName">IMS Port:</div>
<div class="settingsVal"><input type=text name="ims.port" value="${currSettings['ims.port']}"/></div>
<div class="settingsHelp"><img src="images/help.png" title="Port the IMS Host runs on."></div>
</div>
<div class="settingsRow">
<div class="settingsName">IMS Token Class:</div>
<div class="settingsVal"><input type=text name="ims.tokenclass" value="${currSettings['ims.tokenclass']}"/></div>
<div class="settingsHelp"><img src="images/help.png" title="Token class for the IMS host to use."></div>
</div>
<div class="settingsRow"> <div class="settingsRow">
<div class="settingsName">User Management:</div> <div class="settingsName">User Management:</div>
<div class="settingsVal"><input type=text name="auth.management" value="${currSettings['auth.management']}"/></div> <div class="settingsVal"><input type=text name="auth.management" value="${currSettings['auth.management']}"/></div>
......
Supports Markdown
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