Example usage for org.springframework.dao DataAccessResourceFailureException printStackTrace

List of usage examples for org.springframework.dao DataAccessResourceFailureException printStackTrace

Introduction

In this page you can find the example usage for org.springframework.dao DataAccessResourceFailureException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:net.cit.tetrad.rrd.dao.MongoStatusToMonitorImpl.java

public Set<String> readMongoCollectionName(Mongo mongo, String dbName) throws MongoException, Exception {
    Set<String> collNameLst = null;
    try {/*ww  w .j  a v a 2  s.  c om*/
        DB db = mongo.getDB(dbName);
        collNameLst = db.getCollectionNames();
    } catch (DataAccessResourceFailureException e) {
        e.printStackTrace();
        throw new MongoException(e.getMessage());
    } catch (MongoException e) {
        e.printStackTrace();
        throw e;
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    } finally {

    }
    return collNameLst;
}

From source file:net.cit.tetrad.rrd.dao.MongoStatusToMonitorImpl.java

public CommandResult getCommandResult(Mongo mongo, Device device, String command, String databaseName)
        throws MongoException, Exception {
    CommandResult commandResult = null;//from w ww.  ja v  a 2s  .c  om
    try {
        DB db = mongo.getDB(databaseName);
        commandResult = db.command(command);
    } catch (DataAccessResourceFailureException e) {
        e.printStackTrace();
        throw new MongoException(e.getMessage());
    } catch (MongoException e) {
        // alarm  ?
        e.printStackTrace();
        throw e;
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    } finally {

    }

    return commandResult;
}

From source file:net.cit.tetrad.rrd.dao.MongoStatusToMonitorImpl.java

public String getAllServerStatus(Mongo mongo, Device device, String command, String databaseName)
        throws MongoException, Exception {
    String objtoString;//from   ww w . j av a 2s. c o  m
    try {
        DB db = mongo.getDB(databaseName);
        CommandResult commandResult = db.command(command);
        objtoString = commandResult.toString();
    } catch (DataAccessResourceFailureException e) {
        e.printStackTrace();
        throw new MongoException(e.getMessage());
    } catch (MongoException e) {
        // alarm  ?
        e.printStackTrace();
        throw e;
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    } finally {

    }
    return objtoString;
}

From source file:net.cit.tetrad.rrd.dao.MongoStatusToMonitorImpl.java

public Map<String, Object> readMongoStatus(Mongo mongo, Device device, String command, String databaseName)
        throws MongoException, Exception {
    Map<String, Object> deviceStatus = new HashMap<String, Object>();

    try {/*from   w w w .j a va  2s.com*/
        DB db = mongo.getDB(databaseName);
        CommandResult commandResult = db.command(command);
        deviceStatus = JasonUtil.getEntryValue(commandResult, "", deviceStatus);
    } catch (DataAccessResourceFailureException e) {
        e.printStackTrace();
        throw new MongoException(e.getMessage());
    } catch (MongoException e) {
        // alarm  ?
        e.printStackTrace();
        throw e;
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    } finally {

    }

    return deviceStatus;
}

From source file:net.cit.tetrad.rrd.dao.MongoStatusToMonitorImpl.java

public List<Object> readMongoShards(Mongo mongo, String collection, String databaseName)
        throws MongoException, Exception {
    List<Object> dboLst = new ArrayList<Object>();
    try {/*  w w w .ja  va2 s  .co m*/
        DB db = mongo.getDB(databaseName);
        DBCollection dbcollection = db.getCollectionFromString(collection);
        DBCursor cr = dbcollection.find();
        Iterator<DBObject> it = cr.iterator();
        DBObject dbo;
        while (it.hasNext()) {
            dbo = it.next();
            Map<String, Object> deviceStatus = new HashMap<String, Object>();
            deviceStatus = JasonUtil.getEntryValue(dbo, "", deviceStatus);
            dboLst.add(deviceStatus);
        }
    } catch (DataAccessResourceFailureException e) {
        e.printStackTrace();
        throw new MongoException(e.getMessage());
    } catch (MongoException e) {
        e.printStackTrace();
        throw e;
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    } finally {

    }
    return dboLst;
}

From source file:net.cit.tetrad.rrd.dao.MongoStatusToMonitorImpl.java

public List<Object> readMongoChunksGrp(Mongo mongo, String collName, List<Object> dboLst)
        throws MongoException, Exception {
    try {/*from w  w w. j a va2  s  .co  m*/
        DB db = mongo.getDB("config");
        DBCollection dbcollection = db.getCollectionFromString("chunks");
        DBObject dbo = dbcollection.group(new BasicDBObject("shard", true), new BasicDBObject("ns", collName),
                new BasicDBObject("nChunks", 0), "function (doc, out) {out.nChunks++;}");
        Iterator<String> keys = dbo.keySet().iterator();
        BasicDBObject getDbo;
        while (keys.hasNext()) {
            String key = keys.next();
            getDbo = (BasicDBObject) dbo.get(key);
            getDbo.put("collName", collName);
            dboLst.add(getDbo);
        }
    } catch (DataAccessResourceFailureException e) {
        e.printStackTrace();
        throw new MongoException(e.getMessage());
    } catch (MongoException e) {
        e.printStackTrace();
        throw e;
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    } finally {

    }
    return dboLst;
}

From source file:edu.duke.cabig.c3pr.infrastructure.interceptor.NotificationInterceptor.java

/**
 * Gets the planned notifications for the list of sites that are passed in.
 * This method access the db using a new session from the hibernate session factory.
 * /*from   ww w  . ja v a  2  s.  co  m*/
 * @param hcsList the hcs list
 * @return the planned notifications
 */
public List<PlannedNotification> getPlannedNotifications(List<HealthcareSite> hcsList) {
    List<PlannedNotification> result;
    List<String> nciCodeList = new ArrayList<String>();
    for (HealthcareSite hcs : hcsList) {
        if (hcs != null) {
            nciCodeList.add(hcs.getPrimaryIdentifier());
        }
    }

    SessionFactory sessionFactory = (SessionFactory) applicationContext.getBean("sessionFactory");
    Session session = sessionFactory.openSession(sessionFactory.getCurrentSession().connection());
    session.setFlushMode(FlushMode.MANUAL);
    result = new ArrayList<PlannedNotification>();
    try {
        Query query = session.createQuery(
                "select p from PlannedNotification p, HealthcareSite o, Identifier i where p = any elements(o.plannedNotificationsInternal) and "
                        + "i = any elements(o.identifiersAssignedToOrganization) and i.primaryIndicator = 'true' and "
                        + "i.value in (:nciCodeList)")
                .setParameterList("nciCodeList", nciCodeList);

        result = query.list();
    } catch (DataAccessResourceFailureException e) {
        log.error(e.getMessage());
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (HibernateException e) {
        log.error(e.getMessage());
    } catch (Exception e) {
        log.error(e.getMessage());
    } finally {
        session.close();
    }
    return result;
}

From source file:edu.duke.cabig.c3pr.infrastructure.interceptor.NotificationInterceptor.java

/**
 * Gets the planned notifications for the list of sites that are passed in.
 * This method access the db using a new session from the hibernate session factory.
 * /*from ww w . jav a 2s  .  co m*/
 * @param hcsList the hcs list
 * @return the planned notifications
 */
public List<PlannedNotification> getPlannedNotificationsForUpdateMasterSubject() {
    List<PlannedNotification> result;

    SessionFactory sessionFactory = (SessionFactory) applicationContext.getBean("sessionFactory");
    Session session = sessionFactory.openSession(sessionFactory.getCurrentSession().connection());
    session.setFlushMode(FlushMode.MANUAL);
    result = new ArrayList<PlannedNotification>();
    try {
        Query query = session.createQuery("from PlannedNotification p where p.eventName = :var")
                .setString("var", NotificationEventTypeEnum.MASTER_SUBJECT_UPDATED_EVENT.toString());

        result = query.list();
    } catch (DataAccessResourceFailureException e) {
        log.error(e.getMessage());
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (HibernateException e) {
        log.error(e.getMessage());
    } catch (Exception e) {
        log.error(e.getMessage());
    } finally {
        session.close();
    }
    return result;
}

From source file:edu.duke.cabig.c3pr.infrastructure.interceptor.NotificationInterceptor.java

public List<PlannedNotification> getPlannedNotificationsForCorrespondence() {
    List<PlannedNotification> result;

    SessionFactory sessionFactory = (SessionFactory) applicationContext.getBean("sessionFactory");
    Session session = sessionFactory.openSession(sessionFactory.getCurrentSession().connection());
    session.setFlushMode(FlushMode.MANUAL);
    result = new ArrayList<PlannedNotification>();
    try {//from  w  w w  . jav a  2 s .  c  o m
        Query query = session.createQuery(
                "from PlannedNotification p left join fetch p.userBasedRecipientInternal where p.eventName = :var")
                .setString("var", NotificationEventTypeEnum.CORRESPONDENCE_CREATED_OR_UPDATED_EVENT.toString());

        result = query.list().subList(0, 1);
    } catch (DataAccessResourceFailureException e) {
        log.error(e.getMessage());
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (HibernateException e) {
        log.error(e.getMessage());
    } catch (Exception e) {
        log.error(e.getMessage());
    } finally {
        session.close();
    }
    return result;
}