From 6f96481c2b925b50c1d2db324f7bbd8644337462 Mon Sep 17 00:00:00 2001 From: hns Date: Tue, 1 Oct 2002 15:49:36 +0000 Subject: [PATCH] Made remove() public since it is now part of the Updatable interface. Removed old obsolete code. --- src/helma/scripting/FunctionFile.java | 42 ++----------------- src/helma/scripting/Template.java | 58 +-------------------------- 2 files changed, 4 insertions(+), 96 deletions(-) diff --git a/src/helma/scripting/FunctionFile.java b/src/helma/scripting/FunctionFile.java index 79d8c44e..8ee37bbd 100644 --- a/src/helma/scripting/FunctionFile.java +++ b/src/helma/scripting/FunctionFile.java @@ -97,48 +97,12 @@ public class FunctionFile implements Updatable { } - void remove () { + public void remove () { prototype.removeFunctionFile (name); - prototype.removeUpdatable (file.getName()); - - // if we did not add anything to any evaluator, we're done - /* if (declaredProps == null || declaredProps.size() == 0) - return; - - removeProperties (declaredProps); */ + if (file != null) + prototype.removeUpdatable (file.getName()); } - /** - * Remove the properties in the HashMap iff they're still the same as declared by this file. - * This method is called by remove() with the latest props, and by update with the prior props - * after the file has been reevaluated. - */ - void removeProperties (HashSet props) { - // first loop through other function files in this prototype to make a set of properties - // owned by other files. -/* HashSet otherFiles = new HashSet (); - for (Iterator it=prototype.functions.values ().iterator (); it.hasNext (); ) { - FunctionFile other = (FunctionFile) it.next (); - if (other != this && other.declaredProps != null) - otherFiles.addAll (other.declaredProps); - } - - Iterator evals = app.typemgr.getRegisteredRequestEvaluators (); - while (evals.hasNext ()) { - try { - RequestEvaluator reval = (RequestEvaluator) evals.next (); - ObjectPrototype op = reval.getPrototype (prototype.getName()); - for (Iterator it = props.iterator (); it.hasNext (); ) { - String fname = (String) it.next (); - // check if this property has been declared by some other function file in the meantime - if (otherFiles.contains (fname)) - continue; - op.deleteProperty (fname, fname.hashCode()); - // System.err.println ("REMOVING PROP: "+fname); - } - } catch (Exception ignore) {} - } */ - } public String toString () { if (file == null) diff --git a/src/helma/scripting/Template.java b/src/helma/scripting/Template.java index 2d393cb6..e8e0d7f1 100644 --- a/src/helma/scripting/Template.java +++ b/src/helma/scripting/Template.java @@ -26,9 +26,6 @@ import helma.framework.core.*; public class Template extends ActionFile { - // this is the *_as_string function, which is in addition to the normal one - // TypeUpdater psfunc; - public Template (File file, String name, Prototype proto) { super (file, name, proto); @@ -42,7 +39,6 @@ public class Template extends ActionFile { public String getContent () { - // IServer.getLogger().log ("Reading text template " + name); Vector partBuffer = new Vector (); int l = content.length (); @@ -147,67 +143,15 @@ public class Template extends ActionFile { return templateBody.toString (); - /* - String fname = name+"_as_string"; - String body = templateBody.toString (); - - try { - pfunc = parseFunction (name, - "arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10", - body+"\r\nreturn null;\r\n"); - } catch (Throwable x) { - String message = x.getMessage (); - pfunc = new ErrorFeedback (name, message); - } - try { - psfunc = parseFunction (fname, - "arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10", - "res.pushStringBuffer(); "+body+"\r\nreturn res.popStringBuffer();\r\n"); - } catch (Throwable x) { - String message = x.getMessage (); - psfunc = new ErrorFeedback (fname, message); - } - - Iterator evals = app.typemgr.getRegisteredRequestEvaluators (); - while (evals.hasNext ()) { - try { - RequestEvaluator reval = (RequestEvaluator) evals.next (); - updateRequestEvaluator (reval); - } catch (Exception ignore) {} - } */ } - protected void remove () { + public void remove () { prototype.removeTemplate (name); if (file != null) prototype.removeUpdatable (file.getName()); - - /* Iterator evals = app.typemgr.getRegisteredRequestEvaluators (); - while (evals.hasNext ()) { - try { - RequestEvaluator reval = (RequestEvaluator) evals.next (); - ObjectPrototype op = reval.getPrototype (prototype.getName()); - functionName = name; - ESValue esv = (ESValue) op.getProperty (functionName, functionName.hashCode()); - if (esv instanceof ConstructedFunctionObject || esv instanceof ThrowException) { - op.deleteProperty (functionName, functionName.hashCode()); - } - String fname = name+"_as_string"; - esv = (ESValue) op.getProperty (fname, fname.hashCode()); - if (esv instanceof ConstructedFunctionObject || esv instanceof ThrowException) { - op.deleteProperty (fname, fname.hashCode()); - } - } catch (Exception ignore) {} - } */ } - /* public synchronized void updateRequestEvaluator (RequestEvaluator reval) throws EcmaScriptException { - if (pfunc != null) - pfunc.updateRequestEvaluator (reval); - if (psfunc != null) - psfunc.updateRequestEvaluator (reval); - } */ class Part {