dion        2003/01/07 21:02:54

  Added:       jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf
                        package.html BSFExpressionFactory.java
                        PNutsTagLibrary.java BSFTagLibrary.java
                        JPythonTagLibrary.java BSFExpression.java
                        JavaScriptTagLibrary.java JellyContextRegistry.java
               jelly/jelly-tags/bsf/src/test/org/apache/commons/jelly/tags/bsf
                        example.jelly
               jelly/jelly-tags/bsf .cvsignore project.properties maven.xml
                        project.xml
  Log:
  Remove bsf from core
  
  Revision  Changes    Path
  1.1                  
jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/package.html
  
  Index: package.html
  ===================================================================
  <html>
  <head>
  </head>
  <body>
  
    <p>A collection of tag libraries for working with BSF based scripting languages 
like JavaScript, Jython and PNuts</p>
    
  </body>
  </html>
  
  
  
  1.1                  
jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/BSFExpressionFactory.java
  
  Index: BSFExpressionFactory.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/BSFExpressionFactory.java,v
 1.1 2003/01/08 05:02:47 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/08 05:02:47 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: BSFExpressionFactory.java,v 1.1 2003/01/08 05:02:47 dion Exp $
   */
  package org.apache.commons.jelly.tags.bsf;
  
  import org.apache.commons.jelly.expression.Expression;
  import org.apache.commons.jelly.expression.ExpressionFactory;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  import com.ibm.bsf.BSFEngine;
  import com.ibm.bsf.BSFException;
  import com.ibm.bsf.BSFManager;
  
  /** Represents a factory of BSF expressions
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class BSFExpressionFactory implements ExpressionFactory {
  
      /** The logger of messages */
      private Log log = LogFactory.getLog( getClass() );
      
      private String language = "javascript";
      private BSFManager manager;
      private BSFEngine engine;
      private JellyContextRegistry registry = new JellyContextRegistry();
      
      public BSFExpressionFactory() {
      }
      
      // Properties
      //------------------------------------------------------------------------- 
  
      /** @return the BSF language to be used */
      public String getLanguage() {
          return language;
      }
      
      public void setLanguage(String language) {
          this.language = language;
      }
      
      /** @return the BSF Engine to be used by this expression factory */
      public BSFEngine getBSFEngine() throws BSFException {
          if ( engine == null ) {
              engine = createBSFEngine();
          }
          return engine;
      }
      
      public void setBSFEngine(BSFEngine engine) {
          this.engine = engine;
      }
      
      public BSFManager getBSFManager() {
          if ( manager == null ) {
              manager = createBSFManager();
              manager.setObjectRegistry( registry );
          }
          return manager;
      }
      
      public void setBSFManager(BSFManager manager) {
          this.manager = manager;
          manager.setObjectRegistry( registry );
      }
      
      // ExpressionFactory interface
      //------------------------------------------------------------------------- 
      public Expression createExpression(String text) throws Exception {
          return new BSFExpression( text, getBSFEngine(), getBSFManager(), registry );
      }
      
      // Implementation methods
      //------------------------------------------------------------------------- 
      
      /** Factory method */
      protected BSFEngine createBSFEngine() throws BSFException {        
          return getBSFManager().loadScriptingEngine( getLanguage() );
      }
      
      /** Factory method */
      protected BSFManager createBSFManager() {
          BSFManager answer = new BSFManager();
          return answer;
      }
  }
  
  
  
  1.1                  
jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/PNutsTagLibrary.java
  
  Index: PNutsTagLibrary.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/PNutsTagLibrary.java,v
 1.1 2003/01/08 05:02:47 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/08 05:02:47 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: PNutsTagLibrary.java,v 1.1 2003/01/08 05:02:47 dion Exp $
   */
  package org.apache.commons.jelly.tags.bsf;
  
  import com.ibm.bsf.BSFManager;
  
  /** Describes the Taglib. This class could be generated by XDoclet
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class PNutsTagLibrary extends BSFTagLibrary {
  
      public PNutsTagLibrary() {
          BSFManager.registerScriptingEngine(
              "pnuts", 
              "pnuts.ext.PnutsBSFEngine", 
              new String[]{"pnut"}
          );
          setLanguage( "pnuts" );
      }
      
  }
  
  
  
  1.1                  
jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/BSFTagLibrary.java
  
  Index: BSFTagLibrary.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/BSFTagLibrary.java,v
 1.1 2003/01/08 05:02:47 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/08 05:02:47 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: BSFTagLibrary.java,v 1.1 2003/01/08 05:02:47 dion Exp $
   */
  package org.apache.commons.jelly.tags.bsf;
  
  import org.apache.commons.jelly.expression.ExpressionFactory;
  import org.apache.commons.jelly.tags.core.CoreTagLibrary;
  
  
  /** Describes the Taglib. This class could be generated by XDoclet
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class BSFTagLibrary extends CoreTagLibrary {
  
      private BSFExpressionFactory expressionFactory = new BSFExpressionFactory();
      
      public void setLanguage(String language) {
          expressionFactory.setLanguage(language);
      }
      
      /** Allows derived tag libraries to use their own factory */
      protected ExpressionFactory getExpressionFactory() {
          return expressionFactory;
      }
  
  }
  
  
  
  1.1                  
jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/JPythonTagLibrary.java
  
  Index: JPythonTagLibrary.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/JPythonTagLibrary.java,v
 1.1 2003/01/08 05:02:48 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/08 05:02:48 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: JPythonTagLibrary.java,v 1.1 2003/01/08 05:02:48 dion Exp $
   */
  package org.apache.commons.jelly.tags.bsf;
  
  /** Describes the Taglib. This class could be generated by XDoclet
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class JPythonTagLibrary extends BSFTagLibrary {
  
      public JPythonTagLibrary() {
          setLanguage( "jpython" );
      }
  }
  
  
  
  1.1                  
jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/BSFExpression.java
  
  Index: BSFExpression.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/BSFExpression.java,v
 1.1 2003/01/08 05:02:48 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/08 05:02:48 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: BSFExpression.java,v 1.1 2003/01/08 05:02:48 dion Exp $
   */
  package org.apache.commons.jelly.tags.bsf;
  
  import com.ibm.bsf.BSFEngine;
  import com.ibm.bsf.BSFManager;
  
  import java.util.Iterator;
  
  import org.apache.commons.jelly.JellyContext;
  import org.apache.commons.jelly.expression.ExpressionSupport;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  
  /** Represents a BSF expression
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class BSFExpression extends ExpressionSupport {
  
      /** The Log to which logging calls will be made. */
      private static final Log log = LogFactory.getLog( BSFExpression.class );
  
      /** The expression */
      private String text;
      
      /** The BSF Engine to evaluate expressions */
      private BSFEngine engine;
      /** The BSF Manager to evaluate expressions */
      private BSFManager manager;
      
      /** The adapter to BSF's ObjectRegistry that uses the JellyContext */
      private JellyContextRegistry registry;
      
      public BSFExpression(String text, BSFEngine engine, BSFManager manager, 
JellyContextRegistry registry) {
          this.text = text;
          this.engine = engine;
          this.manager = manager;
          this.registry = registry;
      }
  
      // Expression interface
      //------------------------------------------------------------------------- 
      public String getExpressionText() {
          return "${" + text + "}";
      }
      
      public Object evaluate(JellyContext context) {
          // XXXX: unfortunately we must sychronize evaluations
          // so that we can swizzle in the context.
          // maybe we could create an expression from a context
          // (and so create a BSFManager for a context)
          synchronized (registry) {
              registry.setJellyContext(context);
              
              try {
                  // XXXX: hack - there must be a better way!!!
                  for ( Iterator iter = context.getVariableNames(); iter.hasNext(); ) {
                      String name = (String) iter.next();
                      Object value = context.getVariable( name );
                      manager.declareBean( name, value, value.getClass() );
                  }
                  return engine.eval( text, -1, -1, text );
              }
              catch (Exception e) {
                  log.warn( "Caught exception evaluating: " + text + ". Reason: " + e, 
e );
                  return null;
              }
          }
      }
  }
  
  
  
  1.1                  
jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/JavaScriptTagLibrary.java
  
  Index: JavaScriptTagLibrary.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/JavaScriptTagLibrary.java,v
 1.1 2003/01/08 05:02:48 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/08 05:02:48 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: JavaScriptTagLibrary.java,v 1.1 2003/01/08 05:02:48 dion Exp $
   */
  package org.apache.commons.jelly.tags.bsf;
  
  /** Describes the Taglib. This class could be generated by XDoclet
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class JavaScriptTagLibrary extends BSFTagLibrary {
  
      public JavaScriptTagLibrary() {
          setLanguage( "javascript" );
      }
  }
  
  
  
  1.1                  
jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/JellyContextRegistry.java
  
  Index: JellyContextRegistry.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/java/org/apache/commons/jelly/tags/bsf/JellyContextRegistry.java,v
 1.1 2003/01/08 05:02:48 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/08 05:02:48 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  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 acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: JellyContextRegistry.java,v 1.1 2003/01/08 05:02:48 dion Exp $
   */
  package org.apache.commons.jelly.tags.bsf;
  
  import com.ibm.bsf.util.ObjectRegistry;
  
  import org.apache.commons.jelly.JellyContext;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /** A BSF ObjectRegistry which uses the Context to find and
    * register objects
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class JellyContextRegistry extends ObjectRegistry {
  
      /** The Log to which logging calls will be made. */
      private static final Log log = LogFactory.getLog(JellyContextRegistry.class);
  
      /** The context */
      private JellyContext context;
  
      public JellyContextRegistry() {
      }
  
      public JellyContext getJellyContext() {
          return context;
      }
  
      public void setJellyContext(JellyContext context) {
          this.context = context;
      }
  
      // ObjectRegistry interface
      //------------------------------------------------------------------------- 
      public Object lookup(String name) {
          return context.getVariable(name);
      }
  
      public void register(String name, Object value) {
          context.setVariable(name, value);
      }
  
      public void unregister(String name) {
          context.removeVariable(name);
      }
  }
  
  
  
  1.1                  
jakarta-commons-sandbox/jelly/jelly-tags/bsf/src/test/org/apache/commons/jelly/tags/bsf/example.jelly
  
  Index: example.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:pnuts">
    <j:forEach var="arg" items="args"><j:expr value="arg"/> </j:forEach>
  </j:jelly>
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/bsf/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  maven.log
  target
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/bsf/project.properties
  
  Index: project.properties
  ===================================================================
  # -------------------------------------------------------------------
  # P R O J E C T  P R O P E R T I E S
  # -------------------------------------------------------------------
  
  maven.junit.fork=true
  
  maven.compile.deprecation = on
  
  # Installation dir
  maven.dist.install.dir = /usr/local/jelly
  
  maven.checkstyle.properties=../tag-checkstyle.properties
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/bsf/maven.xml
  
  Index: maven.xml
  ===================================================================
  <project default="java:jar">
  
  </project>
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/bsf/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE project [
    <!-- see file for description -->
    <!ENTITY commonDeps SYSTEM "file:../../commonDependencies.ent">
  ]>
  <project>
    <extend>../tag-project.xml</extend>
    <id>commons-jelly-tags-bsf</id>
    <name>commons-jelly-tags-bsf</name>
    <package>org.apache.commons.jelly.tags.bsf</package>
  
    <description>
        This is a Jelly interface for the Bean Scripting Framework
    </description>
    <shortDescription>Commons Jelly BSF Tag Library</shortDescription>
    
    
<siteDirectory>/www/jakarta.apache.org/commons/sandbox/jelly/tags/bsf</siteDirectory>
    
<distributionDirectory>/www/jakarta.apache.org/builds/jakarta-commons-sandbox/jelly/tags/bsf</distributionDirectory>
    <repository>
      
<connection>scm:cvs:pserver:[EMAIL PROTECTED]:/home/cvspublic:jakarta-commons-sandbox/jelly/jelly-tags/bsf/</connection>
      
<url>http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/jelly/jelly-tags/bsf/</url>
    </repository>
    
      
    <dependencies>
    
      &commonDeps;
    
      <!-- START for compilation -->
      <dependency>
        <id>commons-jelly</id>
        <version>SNAPSHOT</version>
      </dependency>
  
      <dependency>
        <id>bsf</id>
        <version>2.2</version>
        <url>http://jakarta.apache.org/bsf</url>
      </dependency>
      <!-- END for compilation -->
      
  
      
    </dependencies>
    
  </project>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to