    public void onMessage(Message message) {
        DSBIngestMessage ingestMessage = null;
        StudyVersion sv = null;
        List successfulFiles = new ArrayList();
        List problemFiles = new ArrayList();
        try {           
            ObjectMessage om = (ObjectMessage) message;
            ingestMessage = (DSBIngestMessage) om.getObject();
            sv = studyService.getStudyVersionById( ingestMessage.getStudyVersionId() );
            String detail = "Ingest processing for " +ingestMessage.getFileBeans().size() + " file(s).";
            Iterator iter = ingestMessage.getFileBeans().iterator();
            while (iter.hasNext()) {
                StudyFileEditBean fileBean = (StudyFileEditBean) iter.next();
                try {
                    if (fileBean.getStudyFile() instanceof NetworkDataFile ) {
                        Context ctx = new InitialContext();
                        networkDataService = (NetworkDataServiceLocal) ctx.lookup("java:comp/env/networkData");
                        networkDataService.ingest(fileBean);
                        successfulFiles.add(fileBean);
                    } else {
                        parseXML( new DSBWrapper().ingest(fileBean) , fileBean.getFileMetadata() );
                        successfulFiles.add(fileBean);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                    problemFiles.add(fileBean);
                }
            }
            if (!successfulFiles.isEmpty()) {
                studyFileService.addIngestedFiles(ingestMessage.getStudyId(), ingestMessage.getVersionNote(), successfulFiles, ingestMessage.getIngestUserId());
            }
            if ( ingestMessage.sendInfoMessage() || ( problemFiles.size() >= 0 && ingestMessage.sendErrorMessage() ) ) {
                mailService.sendIngestCompletedNotification(ingestMessage.getIngestEmail(), sv, successfulFiles, problemFiles);
            }
        } catch (JMSException ex) {
            ex.printStackTrace(); 
        } catch (Exception ex) { 
            ex.printStackTrace();
            if (ingestMessage.sendErrorMessage()) {
                mailService.sendIngestCompletedNotification(ingestMessage.getIngestEmail(), sv, null, ingestMessage.getFileBeans());
            }
        } finally {
            try {
                studyService.removeStudyLock( ingestMessage.getStudyId() );
            } catch (Exception ex) {
                ex.printStackTrace(); 
            }
        }
    }

    public void onMessage(Message message) {
        DSBIngestMessage ingestMessage = null;
        StudyVersion sv = null;
        List successfulFiles = new ArrayList();
        List problemFiles = new ArrayList();
        try {           
            ObjectMessage om = (ObjectMessage) message;
            ingestMessage = (DSBIngestMessage) om.getObject();
            String detail = "Ingest processing for " +ingestMessage.getFileBeans().size() + " file(s).";
            Iterator iter = ingestMessage.getFileBeans().iterator();
            while (iter.hasNext()) {
                StudyFileEditBean fileBean = (StudyFileEditBean) iter.next();
                try {
                    if (fileBean.getStudyFile() instanceof NetworkDataFile ) {
                        Context ctx = new InitialContext();
                        networkDataService = (NetworkDataServiceLocal) ctx.lookup("java:comp/env/networkData");
                        networkDataService.ingest(fileBean);
                        successfulFiles.add(fileBean);
                    } else {
                        parseXML( new DSBWrapper().ingest(fileBean) , fileBean.getFileMetadata() );
                        successfulFiles.add(fileBean);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                    problemFiles.add(fileBean);
                }
            }
            if (!successfulFiles.isEmpty()) {
                studyFileService.addIngestedFiles(ingestMessage.getStudyId(), ingestMessage.getVersionNote(), successfulFiles, ingestMessage.getIngestUserId());
            }
            if ( ingestMessage.sendInfoMessage() || ( problemFiles.size() >= 0 && ingestMessage.sendErrorMessage() ) ) {
                mailService.sendIngestCompletedNotification(ingestMessage, successfulFiles, problemFiles);
            }
        } catch (JMSException ex) {
            ex.printStackTrace(); 
        } catch (Exception ex) { 
            ex.printStackTrace();
            if (ingestMessage.sendErrorMessage()) {
                mailService.sendIngestCompletedNotification(ingestMessage, null, ingestMessage.getFileBeans());
            }
        } finally {
            try {
                studyService.removeStudyLock( ingestMessage.getStudyId() );
            } catch (Exception ex) {
                ex.printStackTrace(); 
            }
        }
    }
