public TimeCharacteristic getTimeCharacteristic() { int ordinal = config.getInteger(TIME_CHARACTERISTIC, -1); if (ordinal >= 0) { return TimeCharacteristic.values()[ordinal]; } else { throw new CorruptConfigurationException("time characteristic is not set"); } }
public <S extends Function, OT> Class<? extends Driver<S, OT>> getDriver() { final String className = this.config.getString(DRIVER_CLASS, null); if (className == null) { throw new CorruptConfigurationException("The pact driver class is missing."); } try { @SuppressWarnings("unchecked") final Class<Driver<S, OT>> pdClazz = (Class<Driver<S, OT>>) (Class<?>) Driver.class; return Class.forName(className).asSubclass(pdClazz); } catch (ClassNotFoundException cnfex) { throw new CorruptConfigurationException("The given driver class cannot be found."); } catch (ClassCastException ccex) { throw new CorruptConfigurationException("The given driver class does not implement the pact driver interface."); } }
public <S extends Function, OT> Class<? extends Driver<S, OT>> getDriver() { final String className = this.config.getString(DRIVER_CLASS, null); if (className == null) { throw new CorruptConfigurationException("The pact driver class is missing."); } try { @SuppressWarnings("unchecked") final Class<Driver<S, OT>> pdClazz = (Class<Driver<S, OT>>) (Class<?>) Driver.class; return Class.forName(className).asSubclass(pdClazz); } catch (ClassNotFoundException cnfex) { throw new CorruptConfigurationException("The given driver class cannot be found."); } catch (ClassCastException ccex) { throw new CorruptConfigurationException("The given driver class does not implement the pact driver interface."); } }
public <S extends Function, OT> Class<? extends Driver<S, OT>> getDriver() { final String className = this.config.getString(DRIVER_CLASS, null); if (className == null) { throw new CorruptConfigurationException("The pact driver class is missing."); } try { @SuppressWarnings("unchecked") final Class<Driver<S, OT>> pdClazz = (Class<Driver<S, OT>>) (Class<?>) Driver.class; return Class.forName(className).asSubclass(pdClazz); } catch (ClassNotFoundException cnfex) { throw new CorruptConfigurationException("The given driver class cannot be found."); } catch (ClassCastException ccex) { throw new CorruptConfigurationException("The given driver class does not implement the pact driver interface."); } }
public <S extends Function, OT> Class<? extends Driver<S, OT>> getDriver() { final String className = this.config.getString(DRIVER_CLASS, null); if (className == null) { throw new CorruptConfigurationException("The pact driver class is missing."); } try { @SuppressWarnings("unchecked") final Class<Driver<S, OT>> pdClazz = (Class<Driver<S, OT>>) (Class<?>) Driver.class; return Class.forName(className).asSubclass(pdClazz); } catch (ClassNotFoundException cnfex) { throw new CorruptConfigurationException("The given driver class cannot be found."); } catch (ClassCastException ccex) { throw new CorruptConfigurationException("The given driver class does not implement the pact driver interface."); } }
@SuppressWarnings("unchecked") public <T> UserCodeWrapper<T> getStubWrapper(ClassLoader cl) { try { return (UserCodeWrapper<T>) InstantiationUtil.readObjectFromConfig(this.config, STUB_OBJECT, cl); } catch (ClassNotFoundException | IOException e) { throw new CorruptConfigurationException("Could not read the user code wrapper: " + e.getMessage(), e); } }
@SuppressWarnings("unchecked") public <T> UserCodeWrapper<T> getStubWrapper(ClassLoader cl) { try { return (UserCodeWrapper<T>) InstantiationUtil.readObjectFromConfig(this.config, STUB_OBJECT, cl); } catch (ClassNotFoundException | IOException e) { throw new CorruptConfigurationException("Could not read the user code wrapper: " + e.getMessage(), e); } }
@SuppressWarnings("unchecked") public <T> UserCodeWrapper<T> getStubWrapper(ClassLoader cl) { try { return (UserCodeWrapper<T>) InstantiationUtil.readObjectFromConfig(this.config, STUB_OBJECT, cl); } catch (ClassNotFoundException | IOException e) { throw new CorruptConfigurationException("Could not read the user code wrapper: " + e.getMessage(), e); } }
public void setStubWrapper(UserCodeWrapper<?> wrapper) { try { InstantiationUtil.writeObjectToConfig(wrapper, this.config, STUB_OBJECT); } catch (IOException e) { throw new CorruptConfigurationException("Could not write the user code wrapper " + wrapper.getClass() + " : " + e.toString(), e); } }
public int getIterationId() { int id = this.config.getInteger(ITERATION_HEAD_ID, -1); if (id == -1) { throw new CorruptConfigurationException("Iteration head ID is missing."); } return id; }
@SuppressWarnings("unchecked") public <T> UserCodeWrapper<T> getStubWrapper(ClassLoader cl) { try { return (UserCodeWrapper<T>) InstantiationUtil.readObjectFromConfig(this.config, STUB_OBJECT, cl); } catch (ClassNotFoundException | IOException e) { throw new CorruptConfigurationException("Could not read the user code wrapper: " + e.getMessage(), e); } }
public int getIterationId() { int id = this.config.getInteger(ITERATION_HEAD_ID, -1); if (id == -1) { throw new CorruptConfigurationException("Iteration head ID is missing."); } return id; }
public void setStubWrapper(UserCodeWrapper<?> wrapper) { try { InstantiationUtil.writeObjectToConfig(wrapper, this.config, STUB_OBJECT); } catch (IOException e) { throw new CorruptConfigurationException("Could not write the user code wrapper " + wrapper.getClass() + " : " + e.toString(), e); } }
public int getIterationId() { int id = this.config.getInteger(ITERATION_HEAD_ID, -1); if (id == -1) { throw new CorruptConfigurationException("Iteration head ID is missing."); } return id; }
public int getIterationId() { int id = this.config.getInteger(ITERATION_HEAD_ID, -1); if (id == -1) { throw new CorruptConfigurationException("Iteration head ID is missing."); } return id; }
public void setStubWrapper(UserCodeWrapper<?> wrapper) { try { InstantiationUtil.writeObjectToConfig(wrapper, this.config, STUB_OBJECT); } catch (IOException e) { throw new CorruptConfigurationException("Could not write the user code wrapper " + wrapper.getClass() + " : " + e.toString(), e); } }
public void setStubWrapper(UserCodeWrapper<?> wrapper) { try { InstantiationUtil.writeObjectToConfig(wrapper, this.config, STUB_OBJECT); } catch (IOException e) { throw new CorruptConfigurationException("Could not write the user code wrapper " + wrapper.getClass() + " : " + e.toString(), e); } }
public ShipStrategyType getOutputShipStrategy(int outputNum) { // check how many outputs are encoded in the config final int outputCnt = this.config.getInteger(OUTPUTS_NUM, -1); if (outputCnt < 1) { throw new CorruptConfigurationException("No output ship strategies are specified in the configuration."); } // sanity range checks if (outputNum < 0 || outputNum >= outputCnt) { throw new IllegalArgumentException("Invalid index for output shipping strategy."); } final int strategy = this.config.getInteger(OUTPUT_SHIP_STRATEGY_PREFIX + outputNum, -1); if (strategy == -1) { throw new CorruptConfigurationException("No output shipping strategy in configuration for output " + outputNum); } else if (strategy < 0 || strategy >= ShipStrategyType.values().length) { throw new CorruptConfigurationException("Illegal output shipping strategy in configuration for output " + outputNum + ": " + strategy); } else { return ShipStrategyType.values()[strategy]; } }
public ShipStrategyType getOutputShipStrategy(int outputNum) { // check how many outputs are encoded in the config final int outputCnt = this.config.getInteger(OUTPUTS_NUM, -1); if (outputCnt < 1) { throw new CorruptConfigurationException("No output ship strategies are specified in the configuration."); } // sanity range checks if (outputNum < 0 || outputNum >= outputCnt) { throw new IllegalArgumentException("Invalid index for output shipping strategy."); } final int strategy = this.config.getInteger(OUTPUT_SHIP_STRATEGY_PREFIX + outputNum, -1); if (strategy == -1) { throw new CorruptConfigurationException("No output shipping strategy in configuration for output " + outputNum); } else if (strategy < 0 || strategy >= ShipStrategyType.values().length) { throw new CorruptConfigurationException("Illegal output shipping strategy in configuration for output " + outputNum + ": " + strategy); } else { return ShipStrategyType.values()[strategy]; } }
public ShipStrategyType getOutputShipStrategy(int outputNum) { // check how many outputs are encoded in the config final int outputCnt = this.config.getInteger(OUTPUTS_NUM, -1); if (outputCnt < 1) { throw new CorruptConfigurationException("No output ship strategies are specified in the configuration."); } // sanity range checks if (outputNum < 0 || outputNum >= outputCnt) { throw new IllegalArgumentException("Invalid index for output shipping strategy."); } final int strategy = this.config.getInteger(OUTPUT_SHIP_STRATEGY_PREFIX + outputNum, -1); if (strategy == -1) { throw new CorruptConfigurationException("No output shipping strategy in configuration for output " + outputNum); } else if (strategy < 0 || strategy >= ShipStrategyType.values().length) { throw new CorruptConfigurationException("Illegal output shipping strategy in configuration for output " + outputNum + ": " + strategy); } else { return ShipStrategyType.values()[strategy]; } }