@Override public Set<ResourceMeta> getAll(String name) throws IOException { try { Connection conn = dbConnectionPool.getConnection(); try { PreparedStatement statement = conn.prepareStatement( "SELECT name, version, slated, live FROM pluginMeta " + "WHERE tenant_id=? AND plugin_type=? AND plugin_name=? AND resource_type=? AND name=? AND deleted=false"); try { setConstantFields(statement); statement.setString(5, name); return getResourceMetaSet(statement); } finally { statement.close(); } } finally { conn.close(); } } catch (SQLException e) { LOG.error("Exception getting all metadata for resource {}.", name, e); throw new IOException(e); } }
@Override public Set<ResourceMeta> getResourcesToSync() throws IOException { try { Connection conn = dbConnectionPool.getConnection(); try { PreparedStatement statement = conn.prepareStatement( "SELECT name, version, slated, live FROM pluginMeta WHERE tenant_id=? AND plugin_type=? AND " + "plugin_name=? AND resource_type=? AND slated=true AND deleted=false"); try { setConstantFields(statement); return getResourceMetaSet(statement); } finally { statement.close(); } } finally { conn.close(); } } catch (SQLException e) { LOG.error("Exception getting metadata of all resources slated to be active.", e); throw new IOException(e); } }
@Override public Set<ResourceMeta> getLiveResources() throws IOException { try { Connection conn = dbConnectionPool.getConnection(); try { PreparedStatement statement = conn.prepareStatement( "SELECT name, version, slated, live FROM pluginMeta WHERE tenant_id=? AND plugin_type=? AND " + "plugin_name=? AND resource_type=? AND live=true AND deleted=false"); try { setConstantFields(statement); return getResourceMetaSet(statement); } finally { statement.close(); } } finally { conn.close(); } } catch (SQLException e) { LOG.error("Exception getting metadata of all resources slated to be active.", e); throw new IOException(e); } }
@Override public Set<ResourceMeta> getAll(String name, ResourceStatus status) throws IOException { try { Connection conn = dbConnectionPool.getConnection(); try { PreparedStatement statement = conn.prepareStatement( "SELECT name, version, slated, live FROM pluginMeta " + "WHERE tenant_id=? AND plugin_type=? AND plugin_name=? AND " + "resource_type=? AND name=? AND slated=? AND live=? AND deleted=false"); try { setConstantFields(statement); statement.setString(5, name); statement.setBoolean(6, status.isLiveAfterSync()); statement.setBoolean(7, status.isLive()); return getResourceMetaSet(statement); } finally { statement.close(); } } finally { conn.close(); } } catch (SQLException e) { LOG.error("Exception getting all metadata for resource {}.", name, e); throw new IOException(e); } }