Moved extensions to separate directory.
This commit is contained in:
parent
fcbfb8ace9
commit
4236304e84
7 changed files with 16 additions and 62 deletions
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
// Modified to use Helma database connections, Hannes Wallnöfer 2000-2003
|
// Modified to use Helma database connections, Hannes Wallnöfer 2000-2003
|
||||||
|
|
||||||
package helma.scripting.rhino;
|
package helma.scripting.rhino.extensions;
|
||||||
|
|
||||||
import helma.framework.core.Application;
|
import helma.framework.core.Application;
|
||||||
import helma.objectmodel.db.DbSource;
|
import helma.objectmodel.db.DbSource;
|
||||||
|
@ -46,7 +46,7 @@ public class DatabaseObject {
|
||||||
* @param dbsource The name of the DB source
|
* @param dbsource The name of the DB source
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DatabaseObject(DbSource dbsource, int flag) {
|
public DatabaseObject(DbSource dbsource, int flag) {
|
||||||
try {
|
try {
|
||||||
connection = dbsource.getConnection ();
|
connection = dbsource.getConnection ();
|
||||||
driverName = dbsource.getDriverName ();
|
driverName = dbsource.getDriverName ();
|
|
@ -15,7 +15,7 @@
|
||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
package helma.scripting.rhino;
|
package helma.scripting.rhino.extensions;
|
||||||
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
|
@ -14,7 +14,7 @@
|
||||||
* $Date$
|
* $Date$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package helma.scripting.rhino;
|
package helma.scripting.rhino.extensions;
|
||||||
|
|
||||||
import com.oroinc.net.ftp.*;
|
import com.oroinc.net.ftp.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
|
@ -14,7 +14,7 @@
|
||||||
* $Date$
|
* $Date$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package helma.scripting.rhino;
|
package helma.scripting.rhino.extensions;
|
||||||
|
|
||||||
import helma.image.*;
|
import helma.image.*;
|
||||||
import helma.util.*;
|
import helma.util.*;
|
|
@ -14,7 +14,7 @@
|
||||||
* $Date$
|
* $Date$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package helma.scripting.rhino;
|
package helma.scripting.rhino.extensions;
|
||||||
|
|
||||||
import helma.util.*;
|
import helma.util.*;
|
||||||
import org.mozilla.javascript.*;
|
import org.mozilla.javascript.*;
|
|
@ -14,8 +14,9 @@
|
||||||
* $Date$
|
* $Date$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package helma.scripting.rhino;
|
package helma.scripting.rhino.extensions;
|
||||||
|
|
||||||
|
import helma.scripting.rhino.*;
|
||||||
import helma.framework.core.Application;
|
import helma.framework.core.Application;
|
||||||
import helma.framework.core.RequestEvaluator;
|
import helma.framework.core.RequestEvaluator;
|
||||||
import helma.objectmodel.INode;
|
import helma.objectmodel.INode;
|
||||||
|
@ -58,7 +59,7 @@ public class XmlObject {
|
||||||
INode node = null;
|
INode node = null;
|
||||||
|
|
||||||
if (hopObject instanceof HopObject) {
|
if (hopObject instanceof HopObject) {
|
||||||
node = ((HopObject) hopObject).node;
|
node = ((HopObject) hopObject).getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// we definitly need a node
|
// we definitly need a node
|
||||||
|
@ -95,7 +96,7 @@ public class XmlObject {
|
||||||
INode node = null;
|
INode node = null;
|
||||||
|
|
||||||
if (hopObject instanceof HopObject) {
|
if (hopObject instanceof HopObject) {
|
||||||
node = ((HopObject) hopObject).node;
|
node = ((HopObject) hopObject).getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// we definitly need a node
|
// we definitly need a node
|
||||||
|
@ -149,7 +150,7 @@ public class XmlObject {
|
||||||
INode node = null;
|
INode node = null;
|
||||||
|
|
||||||
if (hopObject instanceof HopObject) {
|
if (hopObject instanceof HopObject) {
|
||||||
node = ((HopObject) hopObject).node;
|
node = ((HopObject) hopObject).getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
|
@ -202,7 +203,7 @@ public class XmlObject {
|
||||||
INode node = null;
|
INode node = null;
|
||||||
|
|
||||||
if (hopObject instanceof HopObject) {
|
if (hopObject instanceof HopObject) {
|
||||||
node = ((HopObject) hopObject).node;
|
node = ((HopObject) hopObject).getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
|
@ -223,52 +224,4 @@ public class XmlObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* class XmlGet extends BuiltinFunctionObject {
|
|
||||||
XmlGet(String name, Evaluator evaluator, FunctionPrototype fp) {
|
|
||||||
super(fp, evaluator, name, 1);
|
|
||||||
}
|
|
||||||
public ESValue callFunction(ESObject thisObject, ESValue[] arguments) throws EcmaScriptException {
|
|
||||||
if ( arguments==null || arguments.length==0 )
|
|
||||||
throw new EcmaScriptException("Xml.get() needs a location as an argument");
|
|
||||||
try {
|
|
||||||
XmlConverter converter;
|
|
||||||
if ( arguments.length>1 ) {
|
|
||||||
converter = new XmlConverter (arguments[1].toString());
|
|
||||||
} else {
|
|
||||||
converter = new XmlConverter ();
|
|
||||||
}
|
|
||||||
INode node = new helma.objectmodel.db.Node ( (String)null, (String)null, this.evaluator.engine.getApplication().getWrappedNodeManager() );
|
|
||||||
INode result = converter.convert (arguments[0].toString(),node);
|
|
||||||
return this.evaluator.engine.getNodeWrapper(result);
|
|
||||||
} catch ( NoClassDefFoundError e ) {
|
|
||||||
throw new EcmaScriptException("Can't load dom-capable xml parser.");
|
|
||||||
} catch ( RuntimeException f ) {
|
|
||||||
throw new EcmaScriptException(f.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
class XmlGetFromString extends BuiltinFunctionObject {
|
|
||||||
XmlGetFromString(String name, Evaluator evaluator, FunctionPrototype fp) {
|
|
||||||
super(fp, evaluator, name, 1);
|
|
||||||
}
|
|
||||||
public ESValue callFunction(ESObject thisObject, ESValue[] arguments) throws EcmaScriptException {
|
|
||||||
if ( arguments==null || arguments.length==0 )
|
|
||||||
throw new EcmaScriptException("Xml.getFromString() needs an XML string as parameter");
|
|
||||||
try {
|
|
||||||
XmlConverter converter;
|
|
||||||
if ( arguments.length>1 ) {
|
|
||||||
converter = new XmlConverter (arguments[1].toString());
|
|
||||||
} else {
|
|
||||||
converter = new XmlConverter ();
|
|
||||||
}
|
|
||||||
INode node = new helma.objectmodel.db.Node ( (String)null, (String)null, this.evaluator.engine.getApplication().getWrappedNodeManager() );
|
|
||||||
INode result = converter.convertFromString (arguments[0].toString(),node);
|
|
||||||
return this.evaluator.engine.getNodeWrapper(result);
|
|
||||||
} catch ( NoClassDefFoundError e ) {
|
|
||||||
throw new EcmaScriptException("Can't load dom-capable xml parser.");
|
|
||||||
} catch ( RuntimeException f ) {
|
|
||||||
throw new EcmaScriptException(f.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
}
|
}
|
|
@ -14,8 +14,9 @@
|
||||||
* $Date$
|
* $Date$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package helma.scripting.rhino;
|
package helma.scripting.rhino.extensions;
|
||||||
|
|
||||||
|
import helma.scripting.rhino.*;
|
||||||
import org.mozilla.javascript.*;
|
import org.mozilla.javascript.*;
|
||||||
import org.apache.xmlrpc.*;
|
import org.apache.xmlrpc.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
@ -108,11 +109,11 @@ public class XmlRpcObject extends BaseFunction {
|
||||||
}
|
}
|
||||||
|
|
||||||
RhinoEngine engine = (RhinoEngine) cx.getThreadLocal("engine");
|
RhinoEngine engine = (RhinoEngine) cx.getThreadLocal("engine");
|
||||||
RhinoCore c = engine.core;
|
RhinoCore c = engine.getCore();
|
||||||
Scriptable retval = null;
|
Scriptable retval = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
retval = Context.getCurrentContext().newObject(c.global);
|
retval = Context.getCurrentContext().newObject(c.getScope());
|
||||||
XmlRpcClient client = new XmlRpcClient(url);
|
XmlRpcClient client = new XmlRpcClient(url);
|
||||||
|
|
||||||
// long now = System.currentTimeMillis ();
|
// long now = System.currentTimeMillis ();
|
Loading…
Add table
Reference in a new issue