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 VertexInputFormat extends InputFormatBase<Text, Vertex> {
 	
 	public RecordReader<Text, VertexcreateRecordReader(InputSplit split,
 			TaskAttemptContext attemptthrows IOException,
 		return new VertexRecordReader();
 	}
 
 	private class VertexRecordReader extends RecordReaderBase<Text, Vertex> {
 
 		
 		}
 
 		public void initialize(InputSplit inSplit, TaskAttemptContext attempt)
 				throws IOException {
 			
 			super.initialize(inSplitattempt);
 			 = new RowIterator(scannerIterator);
 		
 			currentK = new Text();
 		
 			try {
 				.setZookeeperHosts(VertexInputFormat.getInstance(attempt).getZooKeepers());
 				.setInstanceName(VertexInputFormat.getInstance(attempt).getInstanceName());
 				.setUser(VertexInputFormat.getPrincipal(attempt));
 				.setPassword(VertexInputFormat.getToken(attempt));
 				.setGraphName(attempt.getConfiguration().get(.));
 				if(VertexInputFormat.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();
 					numKeysRead++;
 
 					currentKey = entry.getKey();
 					String vid = currentKey.getRow().toString();
 					String colf = currentKey.getColumnFamily().toString();
 					switch (colf) {
 						currentK.set(vid);
 						vertex.prepareId(vid);
 						break;
 						String[] parts = currentKey.getColumnQualifier()
 								.toString().split(.);
 						String label = new String(entry.getValue().get());
 						vertex.prepareEdge(parts[1], parts[0], labelvid);
 						break;
						parts = currentKey.getColumnQualifier().toString()
						label = new String(entry.getValue().get());
						vertex.prepareEdge(parts[1], vidlabelparts[0]);
						break;
					default:
						String propertyKey = currentKey.getColumnFamily()
								.toString();
						Object propertyValue = AccumuloByteSerializer
						vertex.prepareProperty(propertyKeypropertyValue);
					}
				}
				currentV = vertex;
				return true;
			}
			return false;
		}
	}
		VertexInputFormat.setConnectorInfo(jobcfg.getUser(), new PasswordToken(cfg.getPassword()));
		VertexInputFormat.setInputTableName(job,cfg.getVertexTable());
			VertexInputFormat.setMockInstance(jobcfg.getInstance());
		}else{
			VertexInputFormat.setZooKeeperInstance(jobcfg.getInstance(), cfg.getZooKeeperHosts());
		}
		job.getConfiguration().set("blueprints.accumulo.name"cfg.getName());
	}
New to GrepCode? Check out our FAQ X