Made remove() public since it is now part of the Updatable interface.
Removed old obsolete code.
This commit is contained in:
parent
9a585f9b40
commit
6f96481c2b
2 changed files with 4 additions and 96 deletions
|
@ -97,48 +97,12 @@ public class FunctionFile implements Updatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void remove () {
|
public void remove () {
|
||||||
prototype.removeFunctionFile (name);
|
prototype.removeFunctionFile (name);
|
||||||
|
if (file != null)
|
||||||
prototype.removeUpdatable (file.getName());
|
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); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 () {
|
public String toString () {
|
||||||
if (file == null)
|
if (file == null)
|
||||||
|
|
|
@ -26,9 +26,6 @@ import helma.framework.core.*;
|
||||||
|
|
||||||
public class Template extends ActionFile {
|
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) {
|
public Template (File file, String name, Prototype proto) {
|
||||||
super (file, name, proto);
|
super (file, name, proto);
|
||||||
|
@ -42,7 +39,6 @@ public class Template extends ActionFile {
|
||||||
|
|
||||||
|
|
||||||
public String getContent () {
|
public String getContent () {
|
||||||
// IServer.getLogger().log ("Reading text template " + name);
|
|
||||||
|
|
||||||
Vector partBuffer = new Vector ();
|
Vector partBuffer = new Vector ();
|
||||||
int l = content.length ();
|
int l = content.length ();
|
||||||
|
@ -147,67 +143,15 @@ public class Template extends ActionFile {
|
||||||
|
|
||||||
return templateBody.toString ();
|
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 ();
|
public void remove () {
|
||||||
while (evals.hasNext ()) {
|
|
||||||
try {
|
|
||||||
RequestEvaluator reval = (RequestEvaluator) evals.next ();
|
|
||||||
updateRequestEvaluator (reval);
|
|
||||||
} catch (Exception ignore) {}
|
|
||||||
} */
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void remove () {
|
|
||||||
prototype.removeTemplate (name);
|
prototype.removeTemplate (name);
|
||||||
if (file != null)
|
if (file != null)
|
||||||
prototype.removeUpdatable (file.getName());
|
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 {
|
class Part {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue