Coverage Report - org.mule.components.script.jsr223.AbstractScriptComponent
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractScriptComponent
100%
12/12
N/A
1
 
 1  
 /*
 2  
  * $Id: AbstractScriptComponent.java 10430 2008-01-21 16:28:22Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.components.script.jsr223;
 12  
 
 13  
 import org.mule.MuleManager;
 14  
 import org.mule.umo.UMOEventContext;
 15  
 import org.mule.umo.lifecycle.InitialisationException;
 16  
 import org.mule.util.MuleLogger;
 17  
 
 18  
 import javax.script.Bindings;
 19  
 
 20  6
 public class AbstractScriptComponent extends Scriptable
 21  
 {
 22  
     private Bindings bindings;
 23  
 
 24  
     public void initialise() throws InitialisationException
 25  
     {
 26  6
         super.initialise();
 27  6
         bindings = getScriptEngine().createBindings();
 28  6
     }
 29  
 
 30  
     protected void populateBindings(Bindings namespace, UMOEventContext context)
 31  
     {
 32  6
         namespace.put("eventContext", context);
 33  6
         namespace.put("managementContext", MuleManager.getInstance());
 34  6
         namespace.put("message", context.getMessage());
 35  6
         namespace.put("descriptor", context.getComponentDescriptor());
 36  6
         namespace.put("componentNamespace", this.bindings);
 37  6
         namespace.put("log", new MuleLogger(logger));
 38  6
     }
 39  
 
 40  
     public Bindings getBindings()
 41  
     {
 42  6
         return bindings;
 43  
     }
 44  
 }
 45  
 
 46