made XML-RPC encoding/decoding methods static and public
This commit is contained in:
parent
dc399d0953
commit
016ed7a0f5
1 changed files with 9 additions and 9 deletions
|
@ -14,12 +14,12 @@ import helma.objectmodel.db.DbMapping;
|
||||||
import helma.objectmodel.db.Relation;
|
import helma.objectmodel.db.Relation;
|
||||||
import helma.main.Server;
|
import helma.main.Server;
|
||||||
import helma.util.Updatable;
|
import helma.util.Updatable;
|
||||||
|
import helma.util.CacheMap;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import FESI.Data.*;
|
import FESI.Data.*;
|
||||||
import FESI.Interpreter.*;
|
import FESI.Interpreter.*;
|
||||||
import FESI.Exceptions.*;
|
import FESI.Exceptions.*;
|
||||||
import Acme.LruHashtable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the implementation of ScriptingEnvironment for the FESI EcmaScript interpreter.
|
* This is the implementation of ScriptingEnvironment for the FESI EcmaScript interpreter.
|
||||||
|
@ -36,7 +36,7 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
final GlobalObject global;
|
final GlobalObject global;
|
||||||
|
|
||||||
// caching table for JavaScript object wrappers
|
// caching table for JavaScript object wrappers
|
||||||
LruHashtable wrappercache;
|
CacheMap wrappercache;
|
||||||
|
|
||||||
// table containing JavaScript prototypes
|
// table containing JavaScript prototypes
|
||||||
Hashtable prototypes;
|
Hashtable prototypes;
|
||||||
|
@ -48,7 +48,7 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
static String[] extensions = new String[] {
|
static String[] extensions = new String[] {
|
||||||
"FESI.Extensions.BasicIO",
|
"FESI.Extensions.BasicIO",
|
||||||
"FESI.Extensions.FileIO",
|
"FESI.Extensions.FileIO",
|
||||||
"helma.xmlrpc.fesi.FesiRpcExtension",
|
"helma.scripting.fesi.extensions.XmlRpcExtension",
|
||||||
"helma.scripting.fesi.extensions.ImageExtension",
|
"helma.scripting.fesi.extensions.ImageExtension",
|
||||||
"helma.scripting.fesi.extensions.FtpExtension",
|
"helma.scripting.fesi.extensions.FtpExtension",
|
||||||
"FESI.Extensions.JavaAccess",
|
"FESI.Extensions.JavaAccess",
|
||||||
|
@ -69,7 +69,7 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
public FesiEvaluator (Application app, RequestEvaluator reval) {
|
public FesiEvaluator (Application app, RequestEvaluator reval) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.reval = reval;
|
this.reval = reval;
|
||||||
wrappercache = new LruHashtable (100, .80f);
|
wrappercache = new CacheMap (200, .75f);
|
||||||
prototypes = new Hashtable ();
|
prototypes = new Hashtable ();
|
||||||
try {
|
try {
|
||||||
evaluator = new Evaluator();
|
evaluator = new Evaluator();
|
||||||
|
@ -392,7 +392,7 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
for (int i=0; i<esv.length; i++) {
|
for (int i=0; i<esv.length; i++) {
|
||||||
// XML-RPC requires special argument conversion
|
// XML-RPC requires special argument conversion
|
||||||
if (xmlrpc)
|
if (xmlrpc)
|
||||||
esv[i] = processXmlRpcArgument (args[i]);
|
esv[i] = processXmlRpcArgument (args[i], evaluator);
|
||||||
// for java.util.Map objects, we use the special "tight" wrapper
|
// for java.util.Map objects, we use the special "tight" wrapper
|
||||||
// that makes the Map look like a native object
|
// that makes the Map look like a native object
|
||||||
else if (args[i] instanceof Map)
|
else if (args[i] instanceof Map)
|
||||||
|
@ -511,7 +511,7 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
* Convert an input argument from Java to the scripting runtime
|
* Convert an input argument from Java to the scripting runtime
|
||||||
* representation.
|
* representation.
|
||||||
*/
|
*/
|
||||||
private ESValue processXmlRpcArgument (Object what) throws Exception {
|
public static ESValue processXmlRpcArgument (Object what, Evaluator evaluator) throws Exception {
|
||||||
if (what == null)
|
if (what == null)
|
||||||
return ESNull.theNull;
|
return ESNull.theNull;
|
||||||
if (what instanceof Vector) {
|
if (what instanceof Vector) {
|
||||||
|
@ -519,7 +519,7 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
ArrayPrototype retval = new ArrayPrototype (evaluator.getArrayPrototype (), evaluator);
|
ArrayPrototype retval = new ArrayPrototype (evaluator.getArrayPrototype (), evaluator);
|
||||||
int l = v.size ();
|
int l = v.size ();
|
||||||
for (int i=0; i<l; i++)
|
for (int i=0; i<l; i++)
|
||||||
retval.putProperty (i, processXmlRpcArgument (v.elementAt (i)));
|
retval.putProperty (i, processXmlRpcArgument (v.elementAt (i), evaluator));
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
if (what instanceof Hashtable) {
|
if (what instanceof Hashtable) {
|
||||||
|
@ -527,7 +527,7 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
ESObject retval = new ObjectPrototype (evaluator.getObjectPrototype (), evaluator);
|
ESObject retval = new ObjectPrototype (evaluator.getObjectPrototype (), evaluator);
|
||||||
for (Enumeration e=t.keys(); e.hasMoreElements(); ) {
|
for (Enumeration e=t.keys(); e.hasMoreElements(); ) {
|
||||||
String next = (String) e.nextElement ();
|
String next = (String) e.nextElement ();
|
||||||
retval.putProperty (next, processXmlRpcArgument (t.get (next)), next.hashCode ());
|
retval.putProperty (next, processXmlRpcArgument (t.get (next), evaluator), next.hashCode ());
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -546,7 +546,7 @@ public final class FesiEvaluator implements ScriptingEngine {
|
||||||
/**
|
/**
|
||||||
* convert a JavaScript Object object to a generic Java object stucture.
|
* convert a JavaScript Object object to a generic Java object stucture.
|
||||||
*/
|
*/
|
||||||
public Object processXmlRpcResponse (ESValue what) throws EcmaScriptException {
|
public static Object processXmlRpcResponse (ESValue what) throws EcmaScriptException {
|
||||||
if (what == null || what instanceof ESNull)
|
if (what == null || what instanceof ESNull)
|
||||||
return null;
|
return null;
|
||||||
if (what instanceof ArrayPrototype) {
|
if (what instanceof ArrayPrototype) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue