Esempio n. 1
0
 /**
  * Return a KijiDataRequest that describes which input columns need to be available.
  *
  * @return A kiji data request.
  */
 public KijiDataRequest getDataRequest() {
   final KijiDataRequest dataRequest = mProducer.getDataRequest();
   if (dataRequest.isEmpty()) {
     throw new JobConfigurationException(
         mProducer.getClass().getName()
             + " returned an empty KijiDataRequest, which is not allowed.");
   }
   return dataRequest;
 }
Esempio n. 2
0
  /** {@inheritDoc} */
  @Override
  protected void setup(Context context) throws IOException {
    super.setup(context);
    Preconditions.checkState(mProducerContext == null);
    final Configuration conf = context.getConfiguration();
    mProducer = KijiProducers.create(conf);

    final String column = Preconditions.checkNotNull(mProducer.getOutputColumn());
    mOutputColumn = new KijiColumnName(column);

    mProducerContext = InternalProducerContext.create(context, mOutputColumn);
    mProducer.setup(mProducerContext);
  }
Esempio n. 3
0
 /** {@inheritDoc} */
 @Override
 protected void cleanup(Context context) throws IOException {
   Preconditions.checkState(mProducerContext != null);
   mProducer.cleanup(mProducerContext);
   mProducerContext.close();
   mProducerContext = null;
   super.cleanup(context);
 }
Esempio n. 4
0
 /** {@inheritDoc} */
 @Override
 protected void map(KijiRowData input, Context mapContext) throws IOException {
   mProducerContext.setEntityId(input.getEntityId());
   mProducer.produce(input, mProducerContext);
   mapContext.getCounter(JobHistoryCounters.PRODUCER_ROWS_PROCESSED).increment(1);
 }