@Test public void testSetARCProperties() throws Exception { try{ storage.setARCProperties(arcFile1, "1", ArchonConnector.ARC_STATE.RUNNING, 9); fail(); } catch(Exception e){ } storage.addARC(arcFile1); storage.setARCProperties(arcFile1, "1", ArchonConnector.ARC_STATE.RUNNING, 9); ArcVO arc = storage.getArcByID("arcfile1"); assertEquals("RUNNING",arc.getArcState()); assertEquals(9,arc.getPriority()); }
public void setARCProperties(String fullPath, String shardID,ArchonConnector.ARC_STATE state, int priority) throws Exception{ String[] splitPath = splitPath(fullPath); String folder = splitPath[0]; String arcId = splitPath[1]; PreparedStatement stmt = null; try { boolean aRCIDExist = aRCIDExist(arcId); if (!aRCIDExist){ throw new IllegalArgumentException("ArcID does not exist:"+arcId); } stmt = connection.prepareStatement(setArcPropertiesStatement); stmt.setInt(1, Integer.parseInt(shardID)); stmt.setString(2, state.toString()); stmt.setInt(3, priority); stmt.setLong(4, System.currentTimeMillis()); stmt.setString(5, 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 setARCProperties:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } }
ArchonStorage { public void setARCProperties(String fullPath, String shardID,ArchonConnector.ARC_STATE state, int priority) throws Exception{ String[] splitPath = splitPath(fullPath); String folder = splitPath[0]; String arcId = splitPath[1]; PreparedStatement stmt = null; try { boolean aRCIDExist = aRCIDExist(arcId); if (!aRCIDExist){ throw new IllegalArgumentException("ArcID does not exist:"+arcId); } stmt = connection.prepareStatement(setArcPropertiesStatement); stmt.setInt(1, Integer.parseInt(shardID)); stmt.setString(2, state.toString()); stmt.setInt(3, priority); stmt.setLong(4, System.currentTimeMillis()); stmt.setString(5, 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 setARCProperties:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } }
ArchonStorage { public void setARCProperties(String fullPath, String shardID,ArchonConnector.ARC_STATE state, int priority) throws Exception{ String[] splitPath = splitPath(fullPath); String folder = splitPath[0]; String arcId = splitPath[1]; PreparedStatement stmt = null; try { boolean aRCIDExist = aRCIDExist(arcId); if (!aRCIDExist){ throw new IllegalArgumentException("ArcID does not exist:"+arcId); } stmt = connection.prepareStatement(setArcPropertiesStatement); stmt.setInt(1, Integer.parseInt(shardID)); stmt.setString(2, state.toString()); stmt.setInt(3, priority); stmt.setLong(4, System.currentTimeMillis()); stmt.setString(5, 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 setARCProperties:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } ArchonStorage(); }
ArchonStorage { public void setARCProperties(String fullPath, String shardID,ArchonConnector.ARC_STATE state, int priority) throws Exception{ String[] splitPath = splitPath(fullPath); String folder = splitPath[0]; String arcId = splitPath[1]; PreparedStatement stmt = null; try { boolean aRCIDExist = aRCIDExist(arcId); if (!aRCIDExist){ throw new IllegalArgumentException("ArcID does not exist:"+arcId); } stmt = connection.prepareStatement(setArcPropertiesStatement); stmt.setInt(1, Integer.parseInt(shardID)); stmt.setString(2, state.toString()); stmt.setInt(3, priority); stmt.setLong(4, System.currentTimeMillis()); stmt.setString(5, 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 setARCProperties:" + 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 setARCProperties(String fullPath, String shardID,ArchonConnector.ARC_STATE state, int priority) throws Exception{ String[] splitPath = splitPath(fullPath); String folder = splitPath[0]; String arcId = splitPath[1]; PreparedStatement stmt = null; try { boolean aRCIDExist = aRCIDExist(arcId); if (!aRCIDExist){ throw new IllegalArgumentException("ArcID does not exist:"+arcId); } stmt = connection.prepareStatement(setArcPropertiesStatement); stmt.setInt(1, Integer.parseInt(shardID)); stmt.setString(2, state.toString()); stmt.setInt(3, priority); stmt.setLong(4, System.currentTimeMillis()); stmt.setString(5, 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 setARCProperties:" + 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; }