Commit c271179d authored by toaster's avatar toaster
Browse files

report jsp fix, corrected missing newfile log entry, pom cleanup, irods 1.1 update

git-svn-id: https://subversion.umiacs.umd.edu/ace/trunk@68 f1b3a171-7291-4a19-a512-95ad0ad9394a
parent ffb10983
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
<artifactId>ace</artifactId> <artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId> <groupId>edu.umiacs.ace</groupId>
<version>1.6-SNAPSHOT</version> <version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent> </parent>
<groupId>edu.umiacs.ace</groupId> <groupId>edu.umiacs.ace</groupId>
<artifactId>ace-am</artifactId> <artifactId>ace-am</artifactId>
<version>1.6-SNAPSHOT</version>
<name>ace-am</name> <name>ace-am</name>
<packaging>war</packaging> <packaging>war</packaging>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
...@@ -18,35 +18,13 @@ ...@@ -18,35 +18,13 @@
<netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server> <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
</properties> </properties>
<repositories>
<repository>
<id>EclipseLink Repo</id>
<url>http://www.eclipse.org/downloads/download.php?r=1&amp;nf=1&amp;file=/rt/eclipselink/maven.repo</url>
<!-- use this for javax.persistence
<snapshots>
<enabled>true</enabled>
</snapshots> -->
</repository>
<repository>
<url>http://www.umiacs.umd.edu/~toaster/mavenrepo</url>
<id>local</id>
<layout>default</layout>
<name>Local scratch repo</name>
</repository>
<repository>
<url>http://ftp.ing.umu.se/mirror/eclipse/rt/eclipselink/maven.repo</url>
<id>eclipselink</id>
<layout>default</layout>
<name>Repository for library Library[eclipselink]</name>
</repository>
</repositories>
<dependencies> <dependencies>
<!-- local ace deps --> <!-- local ace deps -->
<dependency> <dependency>
<groupId>edu.umiacs.ace</groupId> <groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-api</artifactId> <artifactId>ace-ims-api</artifactId>
<version>1.0-SNAPSHOT</version> <version>${project.version}</version>
</dependency> </dependency>
...@@ -162,7 +140,7 @@ ...@@ -162,7 +140,7 @@
<dependency> <dependency>
<groupId>edu.umiacs</groupId> <groupId>edu.umiacs</groupId>
<artifactId>irods-api</artifactId> <artifactId>irods-api</artifactId>
<version>1.0</version> <version>1.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
......
...@@ -51,15 +51,23 @@ public class IrodsHandler implements BulkFileHandler { ...@@ -51,15 +51,23 @@ public class IrodsHandler implements BulkFileHandler {
private LinkedBlockingQueue<FileBean> readyList; private LinkedBlockingQueue<FileBean> readyList;
private PathFilter filter; private PathFilter filter;
private MessageDigest digest; private MessageDigest digest;
// private boolean ignore = false;
private String workingFile; private String workingFile;
private long fileSize; private long fileSize;
private static final Logger LOG = Logger.getLogger(IrodsHandler.class); private static final Logger LOG = Logger.getLogger(IrodsHandler.class);
private String root;
/**
*
* @param readyList
* @param filter
* @param digestAlgorithm
* @param base prefix to add to returned files (no trailing /)
*/
public IrodsHandler( LinkedBlockingQueue<FileBean> readyList, public IrodsHandler( LinkedBlockingQueue<FileBean> readyList,
PathFilter filter, String digestAlgorithm ) { PathFilter filter, String digestAlgorithm ) {
this.readyList = readyList; this.readyList = readyList;
this.filter = filter; this.filter = filter;
this.root = "";
try { try {
digest = MessageDigest.getInstance(digestAlgorithm); digest = MessageDigest.getInstance(digestAlgorithm);
} catch ( NoSuchAlgorithmException ex ) { } catch ( NoSuchAlgorithmException ex ) {
...@@ -67,6 +75,10 @@ public class IrodsHandler implements BulkFileHandler { ...@@ -67,6 +75,10 @@ public class IrodsHandler implements BulkFileHandler {
} }
} }
public void setRoot(String root) {
this.root = root;
}
@Override @Override
public void openFile( String path, long length ) throws IOException { public void openFile( String path, long length ) throws IOException {
LOG.trace("Opening file for digesting: " + path); LOG.trace("Opening file for digesting: " + path);
...@@ -130,7 +142,8 @@ public class IrodsHandler implements BulkFileHandler { ...@@ -130,7 +142,8 @@ public class IrodsHandler implements BulkFileHandler {
* @return * @return
*/ */
private String[] extractPathList( String file ) { private String[] extractPathList( String file ) {
String[] tmpPathList = file.split("/"); String completefile = root + file;
String[] tmpPathList = completefile.split("/");
if ( tmpPathList.length == 1 ) { if ( tmpPathList.length == 1 ) {
return tmpPathList; return tmpPathList;
......
...@@ -60,11 +60,11 @@ public class IrodsIterator implements Iterator<FileBean> { ...@@ -60,11 +60,11 @@ public class IrodsIterator implements Iterator<FileBean> {
private ConnectOperation co; private ConnectOperation co;
private String root; private String root;
private BulkFileSaver bfs; private BulkFileSaver bfs;
private Queue<BulkFileSaver> saverList = new LinkedList<BulkFileSaver>(); private Queue<MonitoredItem> saverList = new LinkedList<MonitoredItem>();
public IrodsIterator( Collection c, IrodsSetting ic, public IrodsIterator(Collection c, IrodsSetting ic,
MonitoredItem[] startPathList, PathFilter filter, MonitoredItem[] startPathList, PathFilter filter,
String digestAlgorithm ) { String digestAlgorithm) {
this.co = new ConnectOperation(ic.getServer(), ic.getPort(), this.co = new ConnectOperation(ic.getServer(), ic.getPort(),
ic.getUsername(), ic.getPassword(), ic.getZone()); ic.getUsername(), ic.getPassword(), ic.getZone());
this.stateBean = new DriverStateBean(); this.stateBean = new DriverStateBean();
...@@ -75,31 +75,50 @@ public class IrodsIterator implements Iterator<FileBean> { ...@@ -75,31 +75,50 @@ public class IrodsIterator implements Iterator<FileBean> {
handler = new IrodsHandler(readyList, filter, digestAlgorithm); handler = new IrodsHandler(readyList, filter, digestAlgorithm);
MyListener listener = new MyListener();
if ( startPathList != null ) {
String startPath;
for ( MonitoredItem mi : startPathList ) { if (startPathList != null) {
startPath = root + mi.getPath(); // String startPath;
bfs = new BulkFileSaver(co, handler, startPath);
bfs.addListener(listener); for (MonitoredItem mi : startPathList) {
saverList.add(bfs); saverList.offer(mi);
} }
runNextItem();
// saverList.poll();
} else { } else {
MyListener listener = new MyListener();
bfs = new BulkFileSaver(co, handler, root); bfs = new BulkFileSaver(co, handler, root);
bfs.addListener(listener); bfs.addListener(listener);
saverList.add(bfs); // saverList.add(bfs);
handler.setRoot("");
bfs.execute(true);
} }
saverList.poll().execute(true);
} catch ( IOException ioe ) { } catch (IOException ioe) {
LOG.error("Could not connect to irods", ioe); LOG.error("Could not connect to irods", ioe);
throw new RuntimeException("Could not connect to irods", ioe); throw new RuntimeException("Could not connect to irods", ioe);
} }
} }
private void runNextItem() {
String startPath;
MonitoredItem mi = saverList.poll();
if (mi == null) {
bfs = null;
return;
}
MyListener listener = new MyListener();
startPath = root + mi.getPath();
handler.setRoot(mi.getPath());
bfs = new BulkFileSaver(co, handler, startPath);
bfs.addListener(listener);
bfs.execute(true);
// saverList.add(bfs);
}
public void cancel() { public void cancel() {
saverList.clear();
bfs.cancel(); bfs.cancel();
} }
...@@ -117,10 +136,10 @@ public class IrodsIterator implements Iterator<FileBean> { ...@@ -117,10 +136,10 @@ public class IrodsIterator implements Iterator<FileBean> {
takingThread = Thread.currentThread(); takingThread = Thread.currentThread();
try { try {
return readyList.take(); return readyList.take();
} catch ( InterruptedException ie ) { } catch (InterruptedException ie) {
if ( readyList.isEmpty() ) { if (readyList.isEmpty()) {
LOG.error("Interrupted Exception in next, return null"); LOG.error("Interrupted Exception in next, return null");
return null; return null;
} }
...@@ -147,14 +166,14 @@ public class IrodsIterator implements Iterator<FileBean> { ...@@ -147,14 +166,14 @@ public class IrodsIterator implements Iterator<FileBean> {
} }
@Override @Override
public void startFile( String fullPath ) { public void startFile(String fullPath) {
bytes = 0; bytes = 0;
stateBean.setStateAndReset(State.READING); stateBean.setStateAndReset(State.READING);
stateBean.setFile(fullPath); stateBean.setFile(fullPath);
} }
@Override @Override
public void bytesWritten( int bytesWritten ) { public void bytesWritten(int bytesWritten) {
bytes += bytesWritten; bytes += bytesWritten;
stateBean.setRead(bytes); stateBean.setRead(bytes);
...@@ -162,7 +181,7 @@ public class IrodsIterator implements Iterator<FileBean> { ...@@ -162,7 +181,7 @@ public class IrodsIterator implements Iterator<FileBean> {
} }
@Override @Override
public void endFile( String fullPath ) { public void endFile(String fullPath) {
stateBean.setStateAndReset(State.LISTING); stateBean.setStateAndReset(State.LISTING);
} }
...@@ -171,22 +190,23 @@ public class IrodsIterator implements Iterator<FileBean> { ...@@ -171,22 +190,23 @@ public class IrodsIterator implements Iterator<FileBean> {
public void endTransfer() { public void endTransfer() {
stateBean.setRunningThread(null); stateBean.setRunningThread(null);
LOG.debug("endTransfer called on irods iterator"); LOG.debug("endTransfer called on irods iterator");
if ( !saverList.isEmpty() ) { if (!saverList.isEmpty()) {
saverList.poll().execute(true); runNextItem();
// saverList.poll().execute(true);
return; return;
} else { } else {
handler = null; handler = null;
if ( takingThread != null && readyList.isEmpty() ) { if (takingThread != null && readyList.isEmpty()) {
takingThread.interrupt(); takingThread.interrupt();
} }
} }
} }
@Override @Override
public void handleException( Throwable t ) { public void handleException(Throwable t) {
cancel(); cancel();
handler = null; handler = null;
if ( takingThread != null && readyList.isEmpty() ) { if (takingThread != null && readyList.isEmpty()) {
takingThread.interrupt(); takingThread.interrupt();
} }
LOG.error("Error in bulk saver", t); LOG.error("Error in bulk saver", t);
......
...@@ -486,12 +486,20 @@ public final class AuditThread extends Thread implements CancelCallback { ...@@ -486,12 +486,20 @@ public final class AuditThread extends Thread implements CancelCallback {
trans.commit(); trans.commit();
} else { } else {
// OK, no registered item, do the registration // OK, no registered item, do the registration
LogEvent event = addNewFile(currentFile, fileName, LogEvent[] event = addNewFile(currentFile, fileName,
parentName, mim); parentName, mim);
EntityTransaction trans = em.getTransaction();
trans.begin(); // transaction inside loop to ensure order of commits
em.persist(event); // default, jpa ignores order of persist calls
trans.commit(); for (LogEvent le : event) {
if (le != null) {
EntityTransaction trans = em.getTransaction();
trans.begin();
em.persist(le);
trans.commit();
}
}
} }
} finally { } finally {
em.close(); em.close();
...@@ -587,25 +595,27 @@ public final class AuditThread extends Thread implements CancelCallback { ...@@ -587,25 +595,27 @@ public final class AuditThread extends Thread implements CancelCallback {
return event; return event;
} }
private LogEvent addNewFile(FileBean currentFile, String fileName, private LogEvent[] addNewFile(FileBean currentFile, String fileName,
final String parentName, final MonitoredItemManager mim) { final String parentName, final MonitoredItemManager mim) {
newFilesFound++; newFilesFound++;
LogEvent event; LogEvent[] event = new LogEvent[2];
LOG.trace("Registering new item " + fileName); LOG.trace("Registering new item " + fileName);
event[0] = logManager.createItemEvent(LogEnum.FILE_NEW, fileName,
coll.getDirectory() + fileName);
if (currentFile.isError()) { if (currentFile.isError()) {
mim.addItem(fileName, parentName, false, coll, 'M', 0); mim.addItem(fileName, parentName, false, coll, 'M', 0);
// lem.errorReading(fileName, coll, // lem.errorReading(fileName, coll,
// currentFile.getErrorMessage()); // currentFile.getErrorMessage());
event = logManager.createItemEvent(LogEnum.ERROR_READING, fileName, event[1] = logManager.createItemEvent(LogEnum.ERROR_READING, fileName,
currentFile.getErrorMessage()); currentFile.getErrorMessage());
totalErrors++; totalErrors++;
} else { } else {
// create new item with state of missing token // create new item with state of missing token
mim.addItem(fileName, parentName, false, coll, 'T', mim.addItem(fileName, parentName, false, coll, 'T',
currentFile.getFileSize()); currentFile.getFileSize());
event = logManager.createItemEvent(LogEnum.FILE_NEW, fileName, event[1] = null;
coll.getDirectory() + fileName);
// lem.foundNewFile(fileName, coll); // lem.foundNewFile(fileName, coll);
TokenRequest request = new TokenRequest(); TokenRequest request = new TokenRequest();
request.setName(fileName); request.setName(fileName);
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<Parameter name="log4j.rootLogger" value="FATAL, A1"/> <Parameter name="log4j.rootLogger" value="FATAL, A1"/>
<Parameter name="log4j.appender.A1.layout" value="org.apache.log4j.PatternLayout"/> <Parameter name="log4j.appender.A1.layout" value="org.apache.log4j.PatternLayout"/>
<Parameter name="log4j.appender.A1.layout.ConversionPattern" value="%d{[dd/MMM/yyyy:HH:mm:ss]} %x%m%n"/> <Parameter name="log4j.appender.A1.layout.ConversionPattern" value="%d{[dd/MMM/yyyy:HH:mm:ss]} %x%m%n"/>
<Parameter name="log4j.logger.edu.umiacs.irods" value="TRACE"/> <Parameter name="log4j.logger.edu.umiacs.irods" value="INFO"/>
<Parameter name="log4j.logger.edu.umiacs" value="TRACE"/> <Parameter name="log4j.logger.edu.umiacs" value="TRACE"/>
<!--<Parameter name="log4j.logger.edu.umiacs.irods.api.IRodsConnection" value="TRACE"/>--> <!--<Parameter name="log4j.logger.edu.umiacs.irods.api.IRodsConnection" value="TRACE"/>-->
</Context> </Context>
...@@ -5,5 +5,5 @@ ...@@ -5,5 +5,5 @@
"http://www.w3.org/TR/html4/loose.dtd"> "http://www.w3.org/TR/html4/loose.dtd">
<div class="footer"> <div class="footer">
Version 1.6beta &copy; 2010, University of Maryland Institute for Advanced Computer Studies. All Rights Reserved. <a href="http://adapt.umiacs.umd.edu/ace">ACE Website</a> Version 1.6beta2 &copy; 2010, University of Maryland Institute for Advanced Computer Studies. All Rights Reserved. <a href="http://adapt.umiacs.umd.edu/ace">ACE Website</a>
</div> </div>
...@@ -134,7 +134,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library. ...@@ -134,7 +134,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
</c:choose> </c:choose>
</td> </td>
<td class="datecol"><span>${fn:replace(item.lastSeen, " ", "&nbsp;")}</span></td> <td class="datecol"><span>${fn:replace(item.lastSeen, " ", "&nbsp;")}</span></td>
<td><a href="EventLog?logpath=${item.path}">log</a> <a href="RemoveItem?itemid=${item.id}&amp;redirect=Report">remove</a> </td> <td><a href="EventLog?logpath=${item.path}">log</a> <a href="RemoveItem?itemid=${item.id}&amp;redirect=Report%3Fcollectionid=${collection.collection.id}">remove</a> </td>
</tr> </tr>
</c:forEach> </c:forEach>
<tr><td colspan="5"> <tr><td colspan="5">
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
</parent> </parent>
<groupId>edu.umiacs.ace</groupId> <groupId>edu.umiacs.ace</groupId>
<artifactId>ace-common</artifactId> <artifactId>ace-common</artifactId>
<version>1.6-SNAPSHOT</version>
<name>ace-common</name> <name>ace-common</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<properties> <properties>
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
<artifactId>ace</artifactId> <artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId> <groupId>edu.umiacs.ace</groupId>
<version>1.6-SNAPSHOT</version> <version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent> </parent>
<groupId>edu.umiacs.ace</groupId> <groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-api</artifactId> <artifactId>ace-ims-api</artifactId>
<version>1.0-SNAPSHOT</version>
<name>ace-ims-api</name> <name>ace-ims-api</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<properties> <properties>
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
<dependency> <dependency>
<groupId>edu.umiacs.ace</groupId> <groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-ws</artifactId> <artifactId>ace-ims-ws</artifactId>
<version>1.0-SNAPSHOT</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>edu.umiacs.ace</groupId> <groupId>edu.umiacs.ace</groupId>
<artifactId>ace-common</artifactId> <artifactId>ace-common</artifactId>
<version>1.6-SNAPSHOT</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
</parent> </parent>
<groupId>edu.umiacs.ace</groupId> <groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-ws</artifactId> <artifactId>ace-ims-ws</artifactId>
<version>1.0-SNAPSHOT</version>
<name>ace-ims-ws</name> <name>ace-ims-ws</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<build> <build>
......
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