@SuppressWarnings("unchecked")
    @Override
    protected void setup(
        final Mapper<GeoWaveInputKey, ObjectWritable, Text, CountofDoubleWritable>.Context context)
        throws IOException, InterruptedException {
      super.setup(context);
      final ScopedJobConfiguration config =
          new ScopedJobConfiguration(
              context.getConfiguration(),
              KMeansDistortionMapReduce.class,
              KMeansDistortionMapReduce.LOGGER);

      try {
        nestedGroupCentroidAssigner =
            new NestedGroupCentroidAssignment<Object>(
                context, KMeansDistortionMapReduce.class, KMeansDistortionMapReduce.LOGGER);
      } catch (final Exception e1) {
        throw new IOException(e1);
      }

      try {
        centroidExtractor =
            config.getInstance(
                CentroidParameters.Centroid.EXTRACTOR_CLASS,
                CentroidExtractor.class,
                SimpleFeatureCentroidExtractor.class);
      } catch (final Exception e1) {
        throw new IOException(e1);
      }

      try {
        itemWrapperFactory =
            config.getInstance(
                CentroidParameters.Centroid.WRAPPER_FACTORY_CLASS,
                AnalyticItemWrapperFactory.class,
                SimpleFeatureItemWrapperFactory.class);
      } catch (final Exception e1) {
        throw new IOException(e1);
      }
    }
 @Override
 public Object getValue(
     final JobContext context, final Class<?> scope, final Object defaultValue) {
   final ScopedJobConfiguration scopedConfig =
       new ScopedJobConfiguration(context.getConfiguration(), scope);
   if (baseClass.isAssignableFrom(Integer.class)) {
     return Integer.valueOf(
         scopedConfig.getInt(parent.self(), ((Integer) defaultValue).intValue()));
   } else if (baseClass.isAssignableFrom(String.class)) {
     return scopedConfig.getString(parent.self(), defaultValue.toString());
   } else if (baseClass.isAssignableFrom(Double.class)) {
     return scopedConfig.getDouble(parent.self(), (Double) defaultValue);
   } else if (baseClass.isAssignableFrom(byte[].class)) {
     return scopedConfig.getBytes(parent.self());
   } else if ((defaultValue == null) || (defaultValue instanceof Class)) {
     try {
       return scopedConfig.getInstance(parent.self(), baseClass, (Class) defaultValue);
     } catch (InstantiationException | IllegalAccessException e) {
       LOGGER.error("Unable to get instance from job context", e);
     }
   }
   return null;
 }