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 @@
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-am</artifactId>
<version>1.6-SNAPSHOT</version>
<name>ace-am</name>
<packaging>war</packaging>
<url>http://maven.apache.org</url>
......@@ -18,35 +18,13 @@
<netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
</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>
<!-- local ace deps -->
<dependency>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-api</artifactId>
<version>1.0-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
......@@ -162,7 +140,7 @@
<dependency>
<groupId>edu.umiacs</groupId>
<artifactId>irods-api</artifactId>
<version>1.0</version>
<version>1.1</version>
</dependency>
</dependencies>
</project>
......
......@@ -51,15 +51,23 @@ public class IrodsHandler implements BulkFileHandler {
private LinkedBlockingQueue<FileBean> readyList;
private PathFilter filter;
private MessageDigest digest;
// private boolean ignore = false;
private String workingFile;
private long fileSize;
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,
PathFilter filter, String digestAlgorithm ) {
this.readyList = readyList;
this.filter = filter;
this.root = "";
try {
digest = MessageDigest.getInstance(digestAlgorithm);
} catch ( NoSuchAlgorithmException ex ) {
......@@ -67,6 +75,10 @@ public class IrodsHandler implements BulkFileHandler {
}
}
public void setRoot(String root) {
this.root = root;
}
@Override
public void openFile( String path, long length ) throws IOException {
LOG.trace("Opening file for digesting: " + path);
......@@ -130,7 +142,8 @@ public class IrodsHandler implements BulkFileHandler {
* @return
*/
private String[] extractPathList( String file ) {
String[] tmpPathList = file.split("/");
String completefile = root + file;
String[] tmpPathList = completefile.split("/");
if ( tmpPathList.length == 1 ) {
return tmpPathList;
......
......@@ -60,11 +60,11 @@ public class IrodsIterator implements Iterator<FileBean> {
private ConnectOperation co;
private String root;
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,
String digestAlgorithm ) {
String digestAlgorithm) {
this.co = new ConnectOperation(ic.getServer(), ic.getPort(),
ic.getUsername(), ic.getPassword(), ic.getZone());
this.stateBean = new DriverStateBean();
......@@ -75,31 +75,50 @@ public class IrodsIterator implements Iterator<FileBean> {
handler = new IrodsHandler(readyList, filter, digestAlgorithm);
MyListener listener = new MyListener();
if ( startPathList != null ) {
String startPath;
for ( MonitoredItem mi : startPathList ) {
startPath = root + mi.getPath();
bfs = new BulkFileSaver(co, handler, startPath);
bfs.addListener(listener);
saverList.add(bfs);
if (startPathList != null) {
// String startPath;
for (MonitoredItem mi : startPathList) {
saverList.offer(mi);
}
runNextItem();
// saverList.poll();
} else {
MyListener listener = new MyListener();
bfs = new BulkFileSaver(co, handler, root);
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);
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() {
saverList.clear();
bfs.cancel();
}
......@@ -117,10 +136,10 @@ public class IrodsIterator implements Iterator<FileBean> {
takingThread = Thread.currentThread();
try {
return readyList.take();
} catch ( InterruptedException ie ) {
} catch (InterruptedException ie) {
if ( readyList.isEmpty() ) {
if (readyList.isEmpty()) {
LOG.error("Interrupted Exception in next, return null");
return null;
}
......@@ -147,14 +166,14 @@ public class IrodsIterator implements Iterator<FileBean> {
}
@Override
public void startFile( String fullPath ) {
public void startFile(String fullPath) {
bytes = 0;
stateBean.setStateAndReset(State.READING);
stateBean.setFile(fullPath);
}
@Override
public void bytesWritten( int bytesWritten ) {
public void bytesWritten(int bytesWritten) {
bytes += bytesWritten;
stateBean.setRead(bytes);
......@@ -162,7 +181,7 @@ public class IrodsIterator implements Iterator<FileBean> {
}
@Override
public void endFile( String fullPath ) {
public void endFile(String fullPath) {
stateBean.setStateAndReset(State.LISTING);
}
......@@ -171,22 +190,23 @@ public class IrodsIterator implements Iterator<FileBean> {
public void endTransfer() {
stateBean.setRunningThread(null);
LOG.debug("endTransfer called on irods iterator");
if ( !saverList.isEmpty() ) {
saverList.poll().execute(true);
if (!saverList.isEmpty()) {
runNextItem();
// saverList.poll().execute(true);
return;
} else {
handler = null;
if ( takingThread != null && readyList.isEmpty() ) {
if (takingThread != null && readyList.isEmpty()) {
takingThread.interrupt();
}
}
}
@Override
public void handleException( Throwable t ) {
public void handleException(Throwable t) {
cancel();
handler = null;
if ( takingThread != null && readyList.isEmpty() ) {
if (takingThread != null && readyList.isEmpty()) {
takingThread.interrupt();
}
LOG.error("Error in bulk saver", t);
......
......@@ -486,12 +486,20 @@ public final class AuditThread extends Thread implements CancelCallback {
trans.commit();
} else {
// OK, no registered item, do the registration
LogEvent event = addNewFile(currentFile, fileName,
LogEvent[] event = addNewFile(currentFile, fileName,
parentName, mim);
EntityTransaction trans = em.getTransaction();
trans.begin();
em.persist(event);
trans.commit();
// transaction inside loop to ensure order of commits
// default, jpa ignores order of persist calls
for (LogEvent le : event) {
if (le != null) {
EntityTransaction trans = em.getTransaction();
trans.begin();
em.persist(le);
trans.commit();
}
}
}
} finally {
em.close();
......@@ -587,25 +595,27 @@ public final class AuditThread extends Thread implements CancelCallback {
return event;
}
private LogEvent addNewFile(FileBean currentFile, String fileName,
private LogEvent[] addNewFile(FileBean currentFile, String fileName,
final String parentName, final MonitoredItemManager mim) {
newFilesFound++;
LogEvent event;
LogEvent[] event = new LogEvent[2];
LOG.trace("Registering new item " + fileName);
event[0] = logManager.createItemEvent(LogEnum.FILE_NEW, fileName,
coll.getDirectory() + fileName);
if (currentFile.isError()) {
mim.addItem(fileName, parentName, false, coll, 'M', 0);
// lem.errorReading(fileName, coll,
// currentFile.getErrorMessage());
event = logManager.createItemEvent(LogEnum.ERROR_READING, fileName,
event[1] = logManager.createItemEvent(LogEnum.ERROR_READING, fileName,
currentFile.getErrorMessage());
totalErrors++;
} else {
// create new item with state of missing token
mim.addItem(fileName, parentName, false, coll, 'T',
currentFile.getFileSize());
event = logManager.createItemEvent(LogEnum.FILE_NEW, fileName,
coll.getDirectory() + fileName);
event[1] = null;
// lem.foundNewFile(fileName, coll);
TokenRequest request = new TokenRequest();
request.setName(fileName);
......
......@@ -50,7 +50,7 @@
<Parameter name="log4j.rootLogger" value="FATAL, A1"/>
<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.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.irods.api.IRodsConnection" value="TRACE"/>-->
</Context>
......@@ -5,5 +5,5 @@
"http://www.w3.org/TR/html4/loose.dtd">
<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>
......@@ -134,7 +134,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
</c:choose>
</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>
</c:forEach>
<tr><td colspan="5">
......
......@@ -9,7 +9,6 @@
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-common</artifactId>
<version>1.6-SNAPSHOT</version>
<name>ace-common</name>
<url>http://maven.apache.org</url>
<properties>
......
......@@ -6,10 +6,10 @@
<artifactId>ace</artifactId>
<groupId>edu.umiacs.ace</groupId>
<version>1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-api</artifactId>
<version>1.0-SNAPSHOT</version>
<name>ace-ims-api</name>
<url>http://maven.apache.org</url>
<properties>
......@@ -26,12 +26,12 @@
<dependency>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-ws</artifactId>
<version>1.0-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-common</artifactId>
<version>1.6-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<dependency>
......
......@@ -9,7 +9,6 @@
</parent>
<groupId>edu.umiacs.ace</groupId>
<artifactId>ace-ims-ws</artifactId>
<version>1.0-SNAPSHOT</version>
<name>ace-ims-ws</name>
<url>http://maven.apache.org</url>
<build>
......
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