Package com.esri.gpt.framework.sql

Examples of com.esri.gpt.framework.sql.ConnectionBroker


  protected void loadCatalog(RequestContext context, IFeedRecords records) throws SQLException {
    if (!isCatalogMetaAllowed()) {
      return;
    }

    ConnectionBroker connectionBroker = context.getConnectionBroker();
    ManagedConnection managedConnection = connectionBroker.returnConnection("");
    Connection conn = managedConnection.getJdbcConnection();

    boolean firstRecord = true;

    for (IFeedRecord record : records) {
View Full Code Here


      if (nForceFrequency==1) {
        LOG.info("{HARVEST POLICY] Attempting to enforce 'Full harvest' for the record: "+record.getUuid());
        return true;
      }
     
      ConnectionBroker connectionBroker = new ConnectionBroker();
      PreparedStatement st = null;
      ResultSet rs = null;
      try {
        ManagedConnection managedConnection = connectionBroker.returnConnection("");
        Connection connection = managedConnection.getJdbcConnection();
        st = connection.prepareStatement("SELECT COUNT(*) JOB_TYPE FROM GPT_HARVESTING_JOBS_COMPLETED WHERE HARVEST_ID=?");
        st.setString(1, record.getUuid());
       
        rs = st.executeQuery();
        if (rs.next()) {
          int count = rs.getInt(1);
          if (count % nForceFrequency != 0) {
            return false;
          }
        }
       
        LOG.info("{HARVEST POLICY] Attempting to enforce 'Full harvest' for the record: "+record.getUuid());
        return true;
      } catch (SQLException ex) {
        LOG.log(Level.SEVERE, "[HARVEST POLICY] Error evaluating policy for the record: "+record.getUuid(), ex);
      } finally {
        if (rs!=null) {
          try {
            rs.close();
          } catch (SQLException ex) {}
        }
        if (st!=null) {
          try {
            st.close();
          } catch (SQLException ex) {}
        }
        connectionBroker.closeAll();
      }
    }
    return false;
  }
View Full Code Here

  if (requestContext == null) {
    throw new SearchException("Could not get a request context so as "
        + " to make a" + " connection to the repository.");
  }

  ConnectionBroker connectionBroker = requestContext.getConnectionBroker();
  if (connectionBroker == null) {
    throw new SearchException("Could not get a Connection Broker so as"
        + " to make a" + " connection to the repository.");
  }

 
  ManagedConnection managedConnection = connectionBroker.returnConnection("");
  Connection connection = managedConnection.getJdbcConnection();
  if (connection == null) {
    throw new SearchException("Got null connection to repository "
        + "for save search");
  }
View Full Code Here

  _servletRequest = request;
  _timeStarted = new Timestamp(System.currentTimeMillis());
  _timeCompleted = null;
  setApplicationContext(ApplicationContext.getInstance());
  ApplicationConfiguration config = getApplicationContext().getConfiguration();
  setConnectionBroker(new ConnectionBroker(config.getDatabaseReferences()));
  setUser(new User());
  boolean bWasUserInSession = false;
 
  if (request instanceof HttpServletRequest) {
    HttpServletRequest httpReq = (HttpServletRequest)request;
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.sql.ConnectionBroker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.