@Test public void testAddArc() throws Exception { ArcVO arc = null; try{ arc = storage.getArcByID(arcFile1); fail(); } catch (Exception e){ } storage.addARC(arcFile1); arc = storage.getArcByID("arcfile1"); assertEquals(arcFile1, arc.getFileName()); assertEquals("NEW", arc.getArcState()); assertEquals(5, arc.getPriority()); assertEquals(null, arc.getShardId()); int arcCount = storage.getArcCount(); assertEquals(1,arcCount); }
public void addARC(String arcPath) throws Exception { log.info("Persisting new arc-file: " + arcPath); String[] splitPath = splitPath(arcPath); String folder = splitPath[0]; String arcId = splitPath[1]; boolean aRCIDExist = aRCIDExist(arcId); if (aRCIDExist){ throw new IllegalArgumentException("ArcID already exist:"+arcId); } PreparedStatement stmt = null; try { stmt = connection.prepareStatement(addArcStatement); long now = System.currentTimeMillis(); stmt.setString(1, arcId); stmt.setString(2, folder); stmt.setLong(3, now); stmt.setInt(4,5); stmt.setString(5,"NEW"); stmt.setLong(6,now); stmt.execute(); } catch (Exception e) { log.error("SQL Exception in addFile:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } }
ArchonStorage { public void addARC(String arcPath) throws Exception { log.info("Persisting new arc-file: " + arcPath); String[] splitPath = splitPath(arcPath); String folder = splitPath[0]; String arcId = splitPath[1]; boolean aRCIDExist = aRCIDExist(arcId); if (aRCIDExist){ throw new IllegalArgumentException("ArcID already exist:"+arcId); } PreparedStatement stmt = null; try { stmt = connection.prepareStatement(addArcStatement); long now = System.currentTimeMillis(); stmt.setString(1, arcId); stmt.setString(2, folder); stmt.setLong(3, now); stmt.setInt(4,5); stmt.setString(5,"NEW"); stmt.setLong(6,now); stmt.execute(); } catch (Exception e) { log.error("SQL Exception in addFile:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } }
ArchonStorage { public void addARC(String arcPath) throws Exception { log.info("Persisting new arc-file: " + arcPath); String[] splitPath = splitPath(arcPath); String folder = splitPath[0]; String arcId = splitPath[1]; boolean aRCIDExist = aRCIDExist(arcId); if (aRCIDExist){ throw new IllegalArgumentException("ArcID already exist:"+arcId); } PreparedStatement stmt = null; try { stmt = connection.prepareStatement(addArcStatement); long now = System.currentTimeMillis(); stmt.setString(1, arcId); stmt.setString(2, folder); stmt.setLong(3, now); stmt.setInt(4,5); stmt.setString(5,"NEW"); stmt.setLong(6,now); stmt.execute(); } catch (Exception e) { log.error("SQL Exception in addFile:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } ArchonStorage(); }
ArchonStorage { public void addARC(String arcPath) throws Exception { log.info("Persisting new arc-file: " + arcPath); String[] splitPath = splitPath(arcPath); String folder = splitPath[0]; String arcId = splitPath[1]; boolean aRCIDExist = aRCIDExist(arcId); if (aRCIDExist){ throw new IllegalArgumentException("ArcID already exist:"+arcId); } PreparedStatement stmt = null; try { stmt = connection.prepareStatement(addArcStatement); long now = System.currentTimeMillis(); stmt.setString(1, arcId); stmt.setString(2, folder); stmt.setLong(3, now); stmt.setInt(4,5); stmt.setString(5,"NEW"); stmt.setLong(6,now); stmt.execute(); } catch (Exception e) { log.error("SQL Exception in addFile:" + 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 void addARC(String arcPath) throws Exception { log.info("Persisting new arc-file: " + arcPath); String[] splitPath = splitPath(arcPath); String folder = splitPath[0]; String arcId = splitPath[1]; boolean aRCIDExist = aRCIDExist(arcId); if (aRCIDExist){ throw new IllegalArgumentException("ArcID already exist:"+arcId); } PreparedStatement stmt = null; try { stmt = connection.prepareStatement(addArcStatement); long now = System.currentTimeMillis(); stmt.setString(1, arcId); stmt.setString(2, folder); stmt.setLong(3, now); stmt.setInt(4,5); stmt.setString(5,"NEW"); stmt.setLong(6,now); stmt.execute(); } catch (Exception e) { log.error("SQL Exception in addFile:" + 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; }