/*
 * Copyright (c) 2000 jPOS.org.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *    "This product includes software developed by the jPOS project
 *    (http://www.jpos.org/)". Alternately, this acknowledgment may
 *    appear in the software itself, if and wherever such third-party
 *    acknowledgments normally appear.
 *
 * 4. The names "jPOS" and "jPOS.org" must not be used to endorse
 *    or promote products derived from this software without prior
 *    written permission. For written permission, please contact
 *    license@jpos.org.
 *
 * 5. Products derived from this software may not be called "jPOS",
 *    nor may "jPOS" appear in their name, without prior written
 *    permission of the jPOS project.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE JPOS PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the jPOS Project.  For more
 * information please see <http://www.jpos.org/>.
 */
package org.jpos.q2.qbean;

import org.jdom.Element;
import org.jpos.q2.QBeanSupport;
import bsh.Interpreter;

public class BSH extends QBeanSupport implements Runnable {
    Interpreter bsh;
    public void initService() {
        bsh = new Interpreter ();
    }
    public void startService() {
        new Thread (this).start ();
    }
    public void run () {
        Element config = getPersist();
        try {
            bsh.set  ("qbean", this);
            bsh.set  ("log", getLog());
            bsh.eval (config.getText());
            String source = config.getAttributeValue ("source");
            if (source != null)
                bsh.source (source);
        } catch (Throwable e) {
            getLog().warn (e);
        }
    }
}


@@ -16,17 +16,17 @@
  (c) 200
-0
+4
  jPOS.or
@@ -30,770 +30,47 @@
 .org
-.  All rights reserved.%0A *%0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted provided that the following conditions%0A * are met:%0A *%0A * 1. Redistributions of source code must retain the above copyright%0A *    notice, this list of conditions and the following disclaimer.%0A *%0A * 2. Redistributions in binary form must reproduce the above copyright%0A *    notice, this list of conditions and the following disclaimer in%0A *    the documentation and/or other materials provided with the%0A *    distribution.%0A *%0A * 3. The end-user documentation included with the redistribution,%0A *    if any, must include the following acknowledgment:%0A *    %22This product includes software developed by the jPOS project%0A *    (
+ %0A *%0A * See terms of license at 
 http://
-www.
 jpos
@@ -78,1562 +78,29 @@
 org/
-)%22. Alternately, this acknowledgment may%0A *    appear in the software itself, if and wherever such third-party%0A *    acknowledgments normally appear.%0A *%0A * 4. The names %22jPOS%22 and %22jPOS.org%22 must not be used to endorse%0A *    or promote products derived from this software without prior%0A *    written permission. For written permission, please contact%0A *    license@jpos.org.%0A *%0A * 5. Products derived from this software may not be called %22jPOS%22,%0A *    nor may %22jPOS%22 appear in their name, without prior written%0A *    permission of the jPOS project.%0A *%0A * THIS SOFTWARE IS PROVIDED %60%60AS IS'' AND ANY EXPRESSED OR IMPLIED%0A * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES%0A * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.%0A * IN NO EVENT SHALL THE JPOS PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR%0A * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL%0A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS%0A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)%0A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,%0A * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING%0A * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE%0A * POSSIBILITY OF SUCH DAMAGE.%0A * ====================================================================%0A *%0A * This software consists of voluntary contributions made by many%0A * individuals on behalf of the jPOS Project.  For more%0A * information please see %3Chttp://www.jpos.org/%3E.
+license.html%0A *
 %0A */%0A
+%0A
 pack
@@ -185,29 +185,84 @@
 rt;%0A
-import bsh.Interprete
+%0Aimport bsh.BshClassManager;%0Aimport bsh.Interpreter;%0Aimport bsh.UtilEvalErro
 r;%0A%0A
@@ -404,24 +404,288 @@
 rpreter ();%0A
+        BshClassManager bcm = bsh.getClassManager();%0A        try %7B%0A            bcm.setClassPath(getServer().getLoader().getURLs());%0A        %7D catch (UtilEvalError e) %7B%0A            e.printStackTrace();%0A        %7D%0A        bcm.setClassLoader(getServer().getLoader());%0A
     %7D%0A    pu

Add the server classloader URLS to that of the one BSH is executed with. Set classloader to that of the server.