@Test public void testSetARCState() throws Exception { Date d = new Date(1477303834757L); try{ storage.setARCState(arcFile1,ArchonConnector.ARC_STATE.RUNNING); fail(); } catch(Exception e){ } storage.addARC(arcFile1); storage.setARCState(arcFile1,ArchonConnector.ARC_STATE.RUNNING); ArcVO arc = storage.getArcByID("arcfile1"); assertEquals("RUNNING",arc.getArcState()); }
public void setARCState(String arcPath, ArchonConnector.ARC_STATE arcState) throws Exception{ String[] splitPath = splitPath(arcPath); String folder = splitPath[0]; String arcId = splitPath[1]; log.info("setARCState: " + arcId +" new state:"+arcState); PreparedStatement stmt = null; try { boolean aRCIDExist = aRCIDExist(arcId); if (!aRCIDExist){ throw new IllegalArgumentException("ArcID does not exist:"+arcId); } stmt = connection.prepareStatement(setArcStateStatement); stmt.setString(1, arcState.toString()); stmt.setLong(2, System.currentTimeMillis()); stmt.setString(3, arcId); int updated = stmt.executeUpdate(); if (updated == 0){ throw new IllegalArgumentException("Arcfile not found with id:"+arcId); } } catch (Exception e) { log.error("SQL Exception in setARCState:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } }
ArchonStorage { public void setARCState(String arcPath, ArchonConnector.ARC_STATE arcState) throws Exception{ String[] splitPath = splitPath(arcPath); String folder = splitPath[0]; String arcId = splitPath[1]; log.info("setARCState: " + arcId +" new state:"+arcState); PreparedStatement stmt = null; try { boolean aRCIDExist = aRCIDExist(arcId); if (!aRCIDExist){ throw new IllegalArgumentException("ArcID does not exist:"+arcId); } stmt = connection.prepareStatement(setArcStateStatement); stmt.setString(1, arcState.toString()); stmt.setLong(2, System.currentTimeMillis()); stmt.setString(3, arcId); int updated = stmt.executeUpdate(); if (updated == 0){ throw new IllegalArgumentException("Arcfile not found with id:"+arcId); } } catch (Exception e) { log.error("SQL Exception in setARCState:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } }
ArchonStorage { public void setARCState(String arcPath, ArchonConnector.ARC_STATE arcState) throws Exception{ String[] splitPath = splitPath(arcPath); String folder = splitPath[0]; String arcId = splitPath[1]; log.info("setARCState: " + arcId +" new state:"+arcState); PreparedStatement stmt = null; try { boolean aRCIDExist = aRCIDExist(arcId); if (!aRCIDExist){ throw new IllegalArgumentException("ArcID does not exist:"+arcId); } stmt = connection.prepareStatement(setArcStateStatement); stmt.setString(1, arcState.toString()); stmt.setLong(2, System.currentTimeMillis()); stmt.setString(3, arcId); int updated = stmt.executeUpdate(); if (updated == 0){ throw new IllegalArgumentException("Arcfile not found with id:"+arcId); } } catch (Exception e) { log.error("SQL Exception in setARCState:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } ArchonStorage(); }
ArchonStorage { public void setARCState(String arcPath, ArchonConnector.ARC_STATE arcState) throws Exception{ String[] splitPath = splitPath(arcPath); String folder = splitPath[0]; String arcId = splitPath[1]; log.info("setARCState: " + arcId +" new state:"+arcState); PreparedStatement stmt = null; try { boolean aRCIDExist = aRCIDExist(arcId); if (!aRCIDExist){ throw new IllegalArgumentException("ArcID does not exist:"+arcId); } stmt = connection.prepareStatement(setArcStateStatement); stmt.setString(1, arcState.toString()); stmt.setLong(2, System.currentTimeMillis()); stmt.setString(3, arcId); int updated = stmt.executeUpdate(); if (updated == 0){ throw new IllegalArgumentException("Arcfile not found with id:"+arcId); } } catch (Exception e) { log.error("SQL Exception in setARCState:" + 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 setARCState(String arcPath, ArchonConnector.ARC_STATE arcState) throws Exception{ String[] splitPath = splitPath(arcPath); String folder = splitPath[0]; String arcId = splitPath[1]; log.info("setARCState: " + arcId +" new state:"+arcState); PreparedStatement stmt = null; try { boolean aRCIDExist = aRCIDExist(arcId); if (!aRCIDExist){ throw new IllegalArgumentException("ArcID does not exist:"+arcId); } stmt = connection.prepareStatement(setArcStateStatement); stmt.setString(1, arcState.toString()); stmt.setLong(2, System.currentTimeMillis()); stmt.setString(3, arcId); int updated = stmt.executeUpdate(); if (updated == 0){ throw new IllegalArgumentException("Arcfile not found with id:"+arcId); } } catch (Exception e) { log.error("SQL Exception in setARCState:" + 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; }