src/com/vordel/circuit/script/ExtendedScriptFilterProcessor.java
@Override
	public void filterAttached(ConfigContext ctx, Entity entity) throws EntityStoreException {
		super.filterAttached(ctx, entity);

		try {
			ScriptEngineManager mgr = new ScriptEngineManager();

			/* retrieve and create a script engine */
			engine = mgr.getEngineByName(getEngineName(entity));
			
			/* execute the script, this will create script functions */
			engine.eval(getEntityScript(entity));

			try {
				/* try to invoke the attach function */
				invokeFunction(engine, ATTACH_FUNCTION_NAME, ctx, entity);
			} catch (NoSuchMethodException ex) {
				Trace.error(String.format("can't invoke the quick filter '%s' method", ATTACH_FUNCTION_NAME), ex);
			}
		} catch (ScriptException ex) {
			Throwable cause = ex.getCause();

			if (cause instanceof EntityStoreException) {
				/* if an entity store exception has been recognised, throw it */
				throw (EntityStoreException) cause;
			} else {
				/* otherwise, juste trace the error */
				Trace.error("There was a problem loading the script: " + ex.getMessage());
				Trace.debug(ex);
			}
		}
	}
/**
	 * Evaluate the script and try to invoke the 'attach' function.
	 * 
	 * @param ctx
	 * @param entity
	 * @throws EntityStoreException
	 */
Evaluate the script and try to invoke the 'attach' function.

@param ctx
@param entity
@throws EntityStoreException
Evaluate the script and try to invoke the ' attach ' function . @param ctx @param entity @throws EntityStoreException
@Override
	public void filterAttached(ConfigContext ctx, Entity entity) throws EntityStoreException {
		super.filterAttached(ctx, entity);
		try {
			ScriptEngineManager mgr = new ScriptEngineManager();
			/* retrieve and create a script engine */
			engine = mgr.getEngineByName(getEngineName(entity));
			/* execute the script, this will create script functions */
			engine.eval(getEntityScript(entity));
			try {
				/* try to invoke the attach function */
				invokeFunction(engine, ATTACH_FUNCTION_NAME, ctx, entity);
			} catch (NoSuchMethodException ex) {
				Trace.error(String.format("can't invoke the quick filter '%s' method", ATTACH_FUNCTION_NAME), ex);
			}
		} catch (ScriptException ex) {
			Throwable cause = ex.getCause();
			if (cause instanceof EntityStoreException) {
				/* if an entity store exception has been recognised, throw it */
				throw (EntityStoreException) cause;
			} else {
				/* otherwise, juste trace the error */
				Trace.error("There was a problem loading the script: " + ex.getMessage());
				Trace.debug(ex);
			}
		}
	}
@ Override public void filterAttached ( ConfigContext ctx , Entity entity ) throws EntityStoreException { super . filterAttached ( ctx , entity ) ; try { ScriptEngineManager mgr = new ScriptEngineManager ( ) ; /* retrieve and create a script engine */ engine = mgr . getEngineByName ( getEngineName ( entity ) ) ; /* execute the script, this will create script functions */ engine . eval ( getEntityScript ( entity ) ) ; try { /* try to invoke the attach function */ invokeFunction ( engine , ATTACH_FUNCTION_NAME , ctx , entity ) ; } catch ( NoSuchMethodException ex ) { Trace . error ( String . format ( "can't invoke the quick filter '%s' method" , ATTACH_FUNCTION_NAME ) , ex ) ; } } catch ( ScriptException ex ) { Throwable cause = ex . getCause ( ) ; if ( cause instanceof EntityStoreException ) { /* if an entity store exception has been recognised, throw it */ throw ( EntityStoreException ) cause ; } else { /* otherwise, juste trace the error */ Trace . error ( "There was a problem loading the script: " + ex . getMessage ( ) ) ; Trace . debug ( ex ) ; } } }
Evaluate the script and try to invoke the 'attach' function.
Evaluate the script and try to invoke the ' attach ' function .