src/org/ohmage/service/ObserverServices.java
public Collection<DataStream> validateData(
			final Observer observer,
			final JsonParser data,
			final List<InvalidPoint> invalidPoints)
			throws ServiceException {
		
		JsonNode nodes;
		try {
			nodes = data.readValueAsTree();
		}
		catch(JsonProcessingException e) {
			throw new ServiceException(
				ErrorCode.OBSERVER_INVALID_STREAM_DATA,
				"The data was not well-formed JSON.",
				e);
		}
		catch(IOException e) {
			throw new ServiceException(
				ErrorCode.OBSERVER_INVALID_STREAM_DATA,
				"Could not read the data from the parser.",
				e);
		}
		int numNodes = nodes.size();
		
		Collection<DataStream> result = new ArrayList<DataStream>(numNodes);
		for(int i = 0; i < numNodes; i++) {
			JsonNode node = nodes.get(i);
			
			try {
				result.add(observer.getDataStream(node));
			}
			catch(DomainException e) {
				if(invalidPoints == null) {
					throw new ServiceException(
						ErrorCode.OBSERVER_INVALID_STREAM_DATA,
						"The data was malformed: " + e.getMessage(),
						e);
				}
				else {
					LOGGER
						.warn(
							"An invalid point was detected for observer '" +
								observer.getId() +
								"' with version '" +
								observer.getVersion() +
								"': " +
								e.getMessage());
					invalidPoints
						.add(
							new InvalidPoint(
								i, 
								node.toString(), 
								e.getMessage(), 
								e));
				}
			}
		}
		
		return result;
	}
/**
	 * Validates that the uploaded data is valid by comparing it to its stream
	 * schema and creating DataStream objects.
	 * 
	 * @param observer The observer that contains the streams.
	 * 
	 * @param data The data to validate.
	 * 
	 * @param invalidPoints A list of InvalidPoint objects that dictate which
	 * 						points are not entirely valid and why.
	 * 
	 * @return A collection of DataStreams where each stream represents a 
	 * 		   different piece of data.
	 * 
	 * @throws ServiceException The data was invalid.
	 */
Validates that the uploaded data is valid by comparing it to its stream
schema and creating DataStream objects.

@param observer The observer that contains the streams.

@param data The data to validate.

@param invalidPoints A list of InvalidPoint objects that dictate which
points are not entirely valid and why.

@return A collection of DataStreams where each stream represents a
different piece of data.

@throws ServiceException The data was invalid.
Validates that the uploaded data is valid by comparing it to its stream schema and creating DataStream objects . @param observer The observer that contains the streams . @param data The data to validate . @param invalidPoints A list of InvalidPoint objects that dictate which points are not entirely valid and why . @return A collection of DataStreams where each stream represents a different piece of data . @throws ServiceException The data was invalid .
public Collection<DataStream> validateData(
			final Observer observer,
			final JsonParser data,
			final List<InvalidPoint> invalidPoints)
			throws ServiceException {
		JsonNode nodes;
		try {
			nodes = data.readValueAsTree();
		}
		catch(JsonProcessingException e) {
			throw new ServiceException(
				ErrorCode.OBSERVER_INVALID_STREAM_DATA,
				"The data was not well-formed JSON.",
				e);
		}
		catch(IOException e) {
			throw new ServiceException(
				ErrorCode.OBSERVER_INVALID_STREAM_DATA,
				"Could not read the data from the parser.",
				e);
		}
		int numNodes = nodes.size();
		Collection<DataStream> result = new ArrayList<DataStream>(numNodes);
		for(int i = 0; i < numNodes; i++) {
			JsonNode node = nodes.get(i);
			try {
				result.add(observer.getDataStream(node));
			}
			catch(DomainException e) {
				if(invalidPoints == null) {
					throw new ServiceException(
						ErrorCode.OBSERVER_INVALID_STREAM_DATA,
						"The data was malformed: " + e.getMessage(),
						e);
				}
				else {
					LOGGER
						.warn(
							"An invalid point was detected for observer '" +
								observer.getId() +
								"' with version '" +
								observer.getVersion() +
								"': " +
								e.getMessage());
					invalidPoints
						.add(
							new InvalidPoint(
								i, 
								node.toString(), 
								e.getMessage(), 
								e));
				}
			}
		}
		return result;
	}
public Collection < DataStream > validateData ( final Observer observer , final JsonParser data , final List < InvalidPoint > invalidPoints ) throws ServiceException { JsonNode nodes ; try { nodes = data . readValueAsTree ( ) ; } catch ( JsonProcessingException e ) { throw new ServiceException ( ErrorCode . OBSERVER_INVALID_STREAM_DATA , "The data was not well-formed JSON." , e ) ; } catch ( IOException e ) { throw new ServiceException ( ErrorCode . OBSERVER_INVALID_STREAM_DATA , "Could not read the data from the parser." , e ) ; } int numNodes = nodes . size ( ) ; Collection < DataStream > result = new ArrayList < DataStream > ( numNodes ) ; for ( int i = 0 ; i < numNodes ; i ++ ) { JsonNode node = nodes . get ( i ) ; try { result . add ( observer . getDataStream ( node ) ) ; } catch ( DomainException e ) { if ( invalidPoints == null ) { throw new ServiceException ( ErrorCode . OBSERVER_INVALID_STREAM_DATA , "The data was malformed: " + e . getMessage ( ) , e ) ; } else { LOGGER . warn ( "An invalid point was detected for observer '" + observer . getId ( ) + "' with version '" + observer . getVersion ( ) + "': " + e . getMessage ( ) ) ; invalidPoints . add ( new InvalidPoint ( i , node . toString ( ) , e . getMessage ( ) , e ) ) ; } } } return result ; }
Validates that the uploaded data is valid by comparing it to its stream
 schema and creating DataStream objects.
Validates that the uploaded data is valid by comparing it to its stream schema and creating DataStream objects .