@Test public void testGetARCFiles() throws Exception { List<String> ids = storage.getARCFiles("10"); assertEquals(0, ids.size()); storage.addARC("arcfile1"); storage.setARCProperties(arcFile1, "1", ArchonConnector.ARC_STATE.NEW, 1); ids = storage.getARCFiles("2"); assertEquals(0, ids.size()); ids = storage.getARCFiles("1"); assertEquals(1, ids.size()); storage.addARC("arcfile2"); storage.setARCProperties(arcFile2, "2", ArchonConnector.ARC_STATE.NEW, 1); ids = storage.getARCFiles("1"); assertEquals(1, ids.size()); }
public List<String> getARCFiles(String shardID) throws Exception{ PreparedStatement stmt = null; ArrayList<String> arcs = new ArrayList<String>(); int shardIdInt = Integer.parseInt(shardID); try { stmt = connection.prepareStatement(getArcsByShardIDQuery); stmt.setInt(1, shardIdInt); ResultSet rs = stmt.executeQuery(); while(rs.next()){ String arc= rs.getString(ARC_FILE_ID_COLUMN); arcs.add(arc); } return arcs; } catch (SQLException e) { log.error("SQL Exception in getARCFiles:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } }
ArchonStorage { public List<String> getARCFiles(String shardID) throws Exception{ PreparedStatement stmt = null; ArrayList<String> arcs = new ArrayList<String>(); int shardIdInt = Integer.parseInt(shardID); try { stmt = connection.prepareStatement(getArcsByShardIDQuery); stmt.setInt(1, shardIdInt); ResultSet rs = stmt.executeQuery(); while(rs.next()){ String arc= rs.getString(ARC_FILE_ID_COLUMN); arcs.add(arc); } return arcs; } catch (SQLException e) { log.error("SQL Exception in getARCFiles:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } }
ArchonStorage { public List<String> getARCFiles(String shardID) throws Exception{ PreparedStatement stmt = null; ArrayList<String> arcs = new ArrayList<String>(); int shardIdInt = Integer.parseInt(shardID); try { stmt = connection.prepareStatement(getArcsByShardIDQuery); stmt.setInt(1, shardIdInt); ResultSet rs = stmt.executeQuery(); while(rs.next()){ String arc= rs.getString(ARC_FILE_ID_COLUMN); arcs.add(arc); } return arcs; } catch (SQLException e) { log.error("SQL Exception in getARCFiles:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } ArchonStorage(); }
ArchonStorage { public List<String> getARCFiles(String shardID) throws Exception{ PreparedStatement stmt = null; ArrayList<String> arcs = new ArrayList<String>(); int shardIdInt = Integer.parseInt(shardID); try { stmt = connection.prepareStatement(getArcsByShardIDQuery); stmt.setInt(1, shardIdInt); ResultSet rs = stmt.executeQuery(); while(rs.next()){ String arc= rs.getString(ARC_FILE_ID_COLUMN); arcs.add(arc); } return arcs; } catch (SQLException e) { log.error("SQL Exception in getARCFiles:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } ArchonStorage(); static void initialize(String driverName, String driverUrl, String userName, String password); int nextShardId(); void addARC(String arcPath); void addOrUpdateARC(String arcPath); List<String> getShardIDs(); String nextARC(String shardID); List<String> getARCFiles(String shardID); ArcVO getArcByID(String arcID); int getArcCount(); List<ArcVO> getLatest1000Arcs(); List<ArcVO> getAllRunningArcs(); void setARCState(String arcPath, ArchonConnector.ARC_STATE arcState); void setShardState(String shardID, ArchonConnector.ARC_STATE state, int priority); void setARCProperties(String fullPath, String shardID,ArchonConnector.ARC_STATE state, int priority); void setARCPriority(String fullPath, int priority); void resetArcWithPriorityStatement(String fullPath, int priority); void removeARC(String arcID); void clearIndexing(String shardID); void resetShardId(String shardID); void commit(); void rollback(); void close(); static void shutdown(); }
ArchonStorage { public List<String> getARCFiles(String shardID) throws Exception{ PreparedStatement stmt = null; ArrayList<String> arcs = new ArrayList<String>(); int shardIdInt = Integer.parseInt(shardID); try { stmt = connection.prepareStatement(getArcsByShardIDQuery); stmt.setInt(1, shardIdInt); ResultSet rs = stmt.executeQuery(); while(rs.next()){ String arc= rs.getString(ARC_FILE_ID_COLUMN); arcs.add(arc); } return arcs; } catch (SQLException e) { log.error("SQL Exception in getARCFiles:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } ArchonStorage(); static void initialize(String driverName, String driverUrl, String userName, String password); int nextShardId(); void addARC(String arcPath); void addOrUpdateARC(String arcPath); List<String> getShardIDs(); String nextARC(String shardID); List<String> getARCFiles(String shardID); ArcVO getArcByID(String arcID); int getArcCount(); List<ArcVO> getLatest1000Arcs(); List<ArcVO> getAllRunningArcs(); void setARCState(String arcPath, ArchonConnector.ARC_STATE arcState); void setShardState(String shardID, ArchonConnector.ARC_STATE state, int priority); void setARCProperties(String fullPath, String shardID,ArchonConnector.ARC_STATE state, int priority); void setARCPriority(String fullPath, int priority); void resetArcWithPriorityStatement(String fullPath, int priority); void removeARC(String arcID); void clearIndexing(String shardID); void resetShardId(String shardID); void commit(); void rollback(); void close(); static void shutdown(); static Date INITDATE; }