src/org/ohmage/domain/Observer.java
public JsonNode validateData(JsonNode data) throws DomainException {
			Context context = Context.enter();
			try {
				Scriptable scope = context.initStandardObjects();
				Function concordiaConstructor =
					context.compileFunction(
						scope, 
						JS_SCHEMA, 
						"Concordia.js", 
						1, 
						null);
				
				Scriptable concordia =
					concordiaConstructor.construct(
						context, 
						scope, 
						new Object[] { schemaString }
					);
				
				Object validateData = 
					concordia.get("validateData", concordia);
				if(validateData instanceof Function) {
					Function validateDataFunction = (Function) validateData;
					
					validateDataFunction.call(
						context, 
						scope, 
						validateDataFunction, 
						new Object[] { data.toString() }
					);
				}
				else {
					throw new DomainException(
						"The 'validateData' function is missing.");
				}
			}
			catch(JavaScriptException e) {
				throw new DomainException(
					ErrorCode.OBSERVER_INVALID_STREAM_DATA,
					"The data does not conform to the schema: " + 
						e.getMessage(),
					e);
			}
			finally {
				Context.exit();
			}
			
			return data;
		}
/**
		 * Validates that some data conforms to the schema used when creating
		 * this stream.
		 * 
		 * @param data The data to validate.
		 * 
		 * @return The JsonNode as passed into this function.
		 * 
		 * @throws DomainException The data does not conform to the schema.
		 */
Validates that some data conforms to the schema used when creating
this stream.

@param data The data to validate.

@return The JsonNode as passed into this function.

@throws DomainException The data does not conform to the schema.
Validates that some data conforms to the schema used when creating this stream . @param data The data to validate . @return The JsonNode as passed into this function . @throws DomainException The data does not conform to the schema .
public JsonNode validateData(JsonNode data) throws DomainException {
			Context context = Context.enter();
			try {
				Scriptable scope = context.initStandardObjects();
				Function concordiaConstructor =
					context.compileFunction(
						scope, 
						JS_SCHEMA, 
						"Concordia.js", 
						1, 
						null);
				Scriptable concordia =
					concordiaConstructor.construct(
						context, 
						scope, 
						new Object[] { schemaString }
					);
				Object validateData = 
					concordia.get("validateData", concordia);
				if(validateData instanceof Function) {
					Function validateDataFunction = (Function) validateData;
					validateDataFunction.call(
						context, 
						scope, 
						validateDataFunction, 
						new Object[] { data.toString() }
					);
				}
				else {
					throw new DomainException(
						"The 'validateData' function is missing.");
				}
			}
			catch(JavaScriptException e) {
				throw new DomainException(
					ErrorCode.OBSERVER_INVALID_STREAM_DATA,
					"The data does not conform to the schema: " + 
						e.getMessage(),
					e);
			}
			finally {
				Context.exit();
			}
			return data;
		}
public JsonNode validateData ( JsonNode data ) throws DomainException { Context context = Context . enter ( ) ; try { Scriptable scope = context . initStandardObjects ( ) ; Function concordiaConstructor = context . compileFunction ( scope , JS_SCHEMA , "Concordia.js" , 1 , null ) ; Scriptable concordia = concordiaConstructor . construct ( context , scope , new Object [ ] { schemaString } ) ; Object validateData = concordia . get ( "validateData" , concordia ) ; if ( validateData instanceof Function ) { Function validateDataFunction = ( Function ) validateData ; validateDataFunction . call ( context , scope , validateDataFunction , new Object [ ] { data . toString ( ) } ) ; } else { throw new DomainException ( "The 'validateData' function is missing." ) ; } } catch ( JavaScriptException e ) { throw new DomainException ( ErrorCode . OBSERVER_INVALID_STREAM_DATA , "The data does not conform to the schema: " + e . getMessage ( ) , e ) ; } finally { Context . exit ( ) ; } return data ; }
Validates that some data conforms to the schema used when creating
 this stream.
Validates that some data conforms to the schema used when creating this stream .