Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package edu.jhuapl.tinkerpop.mapreduce;
  
  import java.util.Iterator;
  
 import  org.apache.hadoop.io.Text;
 import  org.apache.hadoop.mapreduce.InputSplit;
 import  org.apache.hadoop.mapreduce.Job;
 import  org.apache.hadoop.mapreduce.RecordReader;
 import  org.apache.hadoop.mapreduce.TaskAttemptContext;
 
 
 
 public class EdgeInputFormat extends InputFormatBase<Text, Edge> {
 	
 	public RecordReader<Text, EdgecreateRecordReader(InputSplit split,
 			TaskAttemptContext attemptthrows IOException,
 		return new EdgeRecordReader();
 	}
 
 	private class EdgeRecordReader extends RecordReaderBase<Text, Edge> {
 
 		
 		}
 
 		public void initialize(InputSplit inSplit, TaskAttemptContext attempt)
 				throws IOException {
 			
 			super.initialize(inSplitattempt);
 		
 			 = new Text();
 		
 			try {
 				.setZookeeperHosts(EdgeInputFormat.getInstance(attempt).getZooKeepers());
 				.setInstanceName(EdgeInputFormat.getInstance(attempt).getInstanceName());
 				.setUser(EdgeInputFormat.getPrincipal(attempt));
 				.setPassword(EdgeInputFormat.getToken(attempt));
 				.setGraphName(attempt.getConfiguration().get(.));
 				if(EdgeInputFormat.getInstance(attemptinstanceof MockInstance){
 				}
 				 = AccumuloGraph.open(.getConfiguration());
 			} catch (AccumuloException e) {
 				// TODO Auto-generated catch block
 			}
 
 		}
 
 		public boolean nextKeyValue() throws IOExceptionInterruptedException {
 			if (.hasNext()) {
 
 				while (it.hasNext()) {
 					Entry<KeyValueentry = it.next();
 
 					 = entry.getKey();
 					String eid = .getRow().toString();
 					String colf = .getColumnFamily().toString();
 					switch (colf) {
 						.set(eid);
 						edge.prepareId(eid);
 						String[] ids = .getColumnQualifier().toString().split(.);
 						edge.setSourceId(ids[1]);
 						edge.setDestId(ids[0]);
 						edge.setLabel( AccumuloByteSerializer
 								.desserialize(entry.getValue().get()).toString());
 						break;
 					default:
 						String propertyKey = .getColumnFamily()
 								.toString();
 						Object propertyValue = AccumuloByteSerializer
						edge.prepareProperty(propertyKeypropertyValue);
					}
				}
				 = edge;
				return true;
			}
			return false;
		}
	}
		EdgeInputFormat.setConnectorInfo(jobcfg.getUser(), new PasswordToken(cfg.getPassword()));
		EdgeInputFormat.setInputTableName(job,cfg.getEdgeTable());
		    EdgeInputFormat.setMockInstance(jobcfg.getInstance());
		}else{
		    EdgeInputFormat.setZooKeeperInstance(jobcfg.getInstance(), cfg.getZooKeeperHosts());
		}
		job.getConfiguration().set(.cfg.getName());
	}
New to GrepCode? Check out our FAQ X