Long nr = new Long( result.getEntryNr() ); scope.put( "errors", scope, errors ); scope.put( "lines_input", scope, lines_input ); scope.put( "lines_output", scope, lines_output ); scope.put( "lines_updated", scope, lines_updated ); scope.put( "lines_rejected", scope, lines_rejected ); scope.put( "lines_read", scope, lines_read ); scope.put( "lines_written", scope, lines_written ); scope.put( "files_retrieved", scope, files_retrieved ); scope.put( "exit_status", scope, exit_status ); scope.put( "nr", scope, nr ); scope.put( "is_windows", scope, Boolean.valueOf( Const.isWindows() ) ); scope.put( "_entry_", scope, this ); scope.put( "rows", scope, array ); scope.put( "parent_job", scope, parentJob ); scope.put( "previous_result", scope, prev_result );
jsscope.put( jsScripts[i].getScriptName(), jsscope, jsR ); jsscope.put( "SKIP_TRANSFORMATION", jsscope, Integer.valueOf( ScriptValuesMod.SKIP_TRANSFORMATION ) ); jsscope.put( "ABORT_TRANSFORMATION", jsscope, Integer.valueOf( ScriptValuesMod.ABORT_TRANSFORMATION ) ); jsscope.put( "ERROR_TRANSFORMATION", jsscope, Integer.valueOf( ScriptValuesMod.ERROR_TRANSFORMATION ) ); jsscope .put( "CONTINUE_TRANSFORMATION", jsscope, Integer.valueOf( ScriptValuesMod.CONTINUE_TRANSFORMATION ) ); } catch ( Exception ex ) { error_message = "Couldn't add Transformation Constants! Error:" + Const.CR + ex.toString(); ScriptValuesModDummy dummyStep = new ScriptValuesModDummy( prev, transMeta.getStepFields( stepMeta ) ); Scriptable jsvalue = Context.toObject( dummyStep, jsscope ); jsscope.put( "_step_", jsscope, jsvalue ); jsscope.put( "rowMeta", jsscope, jsRowMeta ); for ( int i = 0; i < prev.size(); i++ ) { ValueMetaInterface valueMeta = prev.getValueMeta( i ); Value value = valueMeta.createOriginalValue( valueData ); Scriptable jsarg = Context.toObject( value, jsscope ); jsscope.put( valueMeta.getName(), jsscope, jsarg ); } else { Scriptable jsarg = Context.toObject( valueData, jsscope ); jsscope.put( valueMeta.getName(), jsscope, jsarg ); jsscope.put( "Value", jsscope, jsval ); Row v2Row = RowMeta.createOriginalRow( prev, row ); Scriptable jsV2Row = Context.toObject( v2Row, jsscope );
StyledTextComp sItem = getStyledTextComp( folder.getItem( i ) ); Scriptable jsR = Context.toObject( sItem.getText(), jsscope ); jsscope.put( folder.getItem( i ).getText(), jsscope, jsR ); jsscope.put( "_TransformationName_", jsscope, this.stepname ); jsscope.put( "_step_", jsscope, jsvalue ); jsscope.put( "SKIP_TRANSFORMATION", jsscope, Integer.valueOf( SKIP_TRANSFORMATION ) ); jsscope.put( "ABORT_TRANSFORMATION", jsscope, Integer.valueOf( ABORT_TRANSFORMATION ) ); jsscope.put( "ERROR_TRANSFORMATION", jsscope, Integer.valueOf( ERROR_TRANSFORMATION ) ); jsscope.put( "CONTINUE_TRANSFORMATION", jsscope, Integer.valueOf( CONTINUE_TRANSFORMATION ) ); } catch ( Exception ex ) { testException = Object[] row = new Object[rowMeta.size()]; Scriptable jsRowMeta = Context.toObject( rowMeta, jsscope ); jsscope.put( "rowMeta", jsscope, jsRowMeta ); for ( int i = 0; i < rowMeta.size(); i++ ) { ValueMetaInterface valueMeta = rowMeta.getValueMeta( i ); Value value = valueMeta.createOriginalValue( valueData ); Scriptable jsarg = Context.toObject( value, jsscope ); jsscope.put( valueMeta.getName(), jsscope, jsarg ); } else { Scriptable jsarg = Context.toObject( valueData, jsscope ); jsscope.put( valueMeta.getName(), jsscope, jsarg ); jsscope.put( "Value", jsscope, jsval );
StyledTextComp sItem = getStyledTextComp( folder.getItem( i ) ); Scriptable jsR = Context.toObject( sItem.getText(), jsscope ); jsscope.put( folder.getItem( i ).getText(), jsscope, jsR ); jsscope.put( "_TransformationName_", jsscope, this.stepname ); jsscope.put( "_step_", jsscope, jsvalue ); jsscope.put( "SKIP_TRANSFORMATION", jsscope, Integer.valueOf( SKIP_TRANSFORMATION ) ); jsscope.put( "ABORT_TRANSFORMATION", jsscope, Integer.valueOf( ABORT_TRANSFORMATION ) ); jsscope.put( "ERROR_TRANSFORMATION", jsscope, Integer.valueOf( ERROR_TRANSFORMATION ) ); jsscope.put( "CONTINUE_TRANSFORMATION", jsscope, Integer.valueOf( CONTINUE_TRANSFORMATION ) ); } catch ( Exception ex ) { testException = Object[] row = new Object[rowMeta.size()]; Scriptable jsRowMeta = Context.toObject( rowMeta, jsscope ); jsscope.put( "rowMeta", jsscope, jsRowMeta ); for ( int i = 0; i < rowMeta.size(); i++ ) { ValueMetaInterface valueMeta = rowMeta.getValueMeta( i ); jsscope.put( valueMeta.getName(), jsscope, jsarg ); jsscope.put( "Value", jsscope, jsval ); jsscope.put( "row", jsscope, jsRow );
data.scope.put( "_step_", data.scope, jsvalue ); data.scope.put( jsScripts[ i ].getScriptName(), data.scope, jsR ); data.scope.put( "_TransformationName_", data.scope, getTransMeta().getName() ); Row v2Row = RowMeta.createOriginalRow( rowMeta, row ); Scriptable jsV2Row = Context.toObject( v2Row, data.scope ); data.scope.put( "row", data.scope, jsV2Row ); } else { Scriptable jsrow = Context.toObject( row, data.scope ); data.scope.put( "row", data.scope, jsrow ); data.scope.put( valueMeta.getName(), data.scope, jsarg ); } else { Object normalStorageValueData = valueMeta.convertToNormalStorageType( valueData ); data.scope.put( valueMeta.getName(), data.scope, jsarg ); data.scope.put( "rowMeta", data.scope, jsrowMeta ); data.scope.put( "SKIP_TRANSFORMATION", data.scope, Integer.valueOf( SKIP_TRANSFORMATION ) ); data.scope.put( "ABORT_TRANSFORMATION", data.scope, Integer.valueOf( ABORT_TRANSFORMATION ) ); data.scope.put( "ERROR_TRANSFORMATION", data.scope, Integer.valueOf( ERROR_TRANSFORMATION ) ); data.scope.put( "CONTINUE_TRANSFORMATION", data.scope, Integer.valueOf( CONTINUE_TRANSFORMATION ) ); Row v2Row = RowMeta.createOriginalRow( rowMeta, row ); Scriptable jsV2Row = Context.toObject( v2Row, data.scope ); data.scope.put( "row", data.scope, jsV2Row );
/** * @see org.mozilla.javascript.Scriptable#put(String, Scriptable, Object) */ public void put(String name, Scriptable start, Object value) { obj.put(name,start,value); } /**
public void put(String id, Scriptable start, Object value) { if (start == this) start = prototype; prototype.put(id, start, value); }
public void put(int index, Scriptable start, Object value) { if (start == this) start = prototype; prototype.put(index, start, value); }
/** * @see org.mozilla.javascript.Scriptable#put(int, Scriptable, Object) */ public void put(int index, Scriptable start, Object value) { obj.put(index,start,value); } /**
/** * @see org.mozilla.javascript.Scriptable#put(int, Scriptable, Object) */ public void put(int index, Scriptable start, Object value) { obj.put(index,start,value); } /**
public void put(int index, Scriptable start, Object value) { if (start == this) start = prototype; prototype.put(index, start, value); }
public void put(String id, Scriptable start, Object value) { if (start == this) start = prototype; prototype.put(id, start, value); }
/** * put a value in the current scope * @param name the name of the variable * @param value its value */ public void jsPut(String name, Object value) { scope.put(name, scope, value); }
// Rhino setup Context jsContext = Context.enter(); Scriptable globalScope = jsContext.initStandardObjects(); // Define global variable Object globalVarValue = "my value"; globalScope.put("globalVarName", globalScope, globalVarValue);
public static Object setConst(Scriptable bound, Object value, Context cx, String id) { if (bound instanceof XMLObject) { bound.put(id, bound, value); } else { ScriptableObject.putConstProperty(bound, id, value); } return value; }
public void put(String name, Scriptable start, Object value) { // We could be asked to modify the value of a property in the // prototype. Since we can't add a property to a Java object, // we modify it in the prototype rather than copy it down. if (prototype == null || members.has(name, false)) members.put(this, name, javaObject, value, false); else prototype.put(name, prototype, value); }
public void put(String name, Scriptable start, Object value) { // We could be asked to modify the value of a property in the // prototype. Since we can't add a property to a Java object, // we modify it in the prototype rather than copy it down. if (prototype == null || members.has(name, false)) members.put(this, name, javaObject, value, false); else prototype.put(name, prototype, value); }
private static void match_glob(GlobData mdata, Context cx, Scriptable scope, int count, RegExpImpl reImpl) { if (mdata.arrayobj == null) { mdata.arrayobj = cx.newArray(scope, 0); } SubString matchsub = reImpl.lastMatch; String matchstr = matchsub.toString(); mdata.arrayobj.put(count, mdata.arrayobj, matchstr); }
private static void match_glob(GlobData mdata, Context cx, Scriptable scope, int count, RegExpImpl reImpl) { if (mdata.arrayobj == null) { Scriptable s = ScriptableObject.getTopLevelScope(scope); mdata.arrayobj = ScriptRuntime.newObject(cx, s, "Array", null); } SubString matchsub = reImpl.lastMatch; String matchstr = matchsub.toString(); mdata.arrayobj.put(count, mdata.arrayobj, matchstr); }
public static Object parse(Context cx, Scriptable scope, String jtext, Callable reviver) { Object unfiltered = parse(cx, scope, jtext); Scriptable root = cx.newObject(scope); root.put("", root, unfiltered); return walk(cx, scope, reviver, root, ""); }