Examples of ScriptManager


Examples of org.geoserver.script.ScriptManager

    public List<FunctionName> getFunctionNames() {
        LOGGER.fine("Performing filter lookup");

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);

        ScriptManager scriptMgr = scriptMgr();
        List<FunctionName> names = new ArrayList<FunctionName>();

        try {
            File filterRoot = scriptMgr.getFunctionRoot();
            for (String file : filterRoot.list()) {
                File f = new File(filterRoot, file);

                FunctionHook hook = scriptMgr.lookupFilterHook(f);
                if (hook == null) {
                    LOGGER.fine("Skipping " + f.getName() + ", no hook found");
                }

                //TODO: support multiple functions in one file
View Full Code Here

Examples of org.geoserver.script.ScriptManager

        if (function == null) {
            synchronized(this) {
                function = functions.get(name);
                if (function == null) {
                    try {
                        ScriptManager scriptMgr = scriptMgr();

                        File filterRoot = scriptMgr.getFunctionRoot();
                        File f = null;
                        if (name.getNamespaceURI() != null) {
                            f = new File(filterRoot, name.getLocalPart()+"."+name.getNamespaceURI());
                        }
                        else {
View Full Code Here

Examples of org.geoserver.script.ScriptManager

    }

    public Set<Name> getNames() {
        LOGGER.fine("Performing process lookup");

        ScriptManager scriptMgr = scriptMgr();
        Set<Name> names = new TreeSet<Name>();

        try {
            // load the scripts in the root, the extension is the namespace
            File wpsRoot = scriptMgr.getWpsRoot();
            new CollectProcessNames(wpsRoot, scriptMgr, names) {

                @Override
                String getScriptNamespace(File f) {
                    return getExtension(f.getName());
View Full Code Here

Examples of org.geoserver.script.ScriptManager

        if (process == null) {
            synchronized(this) {
                process = processes.get(name);
                if (process == null) {
                    try {
                        ScriptManager scriptMgr = scriptMgr();

                        // see if the process is a root level one
                        String localName = name.getLocalPart();
                        String namespace = name.getNamespaceURI();
                        File f = new File(scriptMgr.getWpsRoot(), localName + "." + namespace);
                        if (!f.exists()) {
                            // see if it's nested in a directory then
                            File directory = new File(scriptMgr.getWpsRoot(),
                                    namespace);
                            if (!directory.exists()) {
                                throw new FileNotFoundException("Could not find script file "
                                        + f.getName() + " nor a directory of scripts named "
                                        + directory.getName());
View Full Code Here

Examples of org.geoserver.script.ScriptManager

        form.submit();

        tester.assertRenderedPage(ScriptPage.class);
        tester.assertNoErrorMessage();

        ScriptManager scriptManager = GeoServerExtensions.bean(ScriptManager.class);
        File file = new File(new File(scriptManager.getAppRoot(), "hello"), "main.js");
        assertTrue(file.exists());

        assertEquals("console.log('Hi');", FileUtils.readFileToString(file));
    }
View Full Code Here

Examples of org.geoserver.script.ScriptManager

public class ScriptEditPageTest extends GeoServerWicketTestSupport {

    @Before
    public void init() throws IOException {
        // Add a few scripts
        ScriptManager scriptManager = GeoServerExtensions.bean(ScriptManager.class);
        File wpsDir = scriptManager.findOrCreateScriptDir("wps");
        File wpsScript = new File(wpsDir, "buffer.groovy");
        FileUtils.writeStringToFile(wpsScript, "buffer");
        Script script = new Script(wpsScript);
        // Login and load the page
        login();
View Full Code Here

Examples of org.jbpm.pvm.internal.script.ScriptManager

      }
    }
  }

  private String evaluateExpression(String expression, Execution execution) {
    ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
    Object value = scriptManager.evaluateExpression(expression, template.getLanguage());
    if (!(value instanceof String)) {
      throw new JbpmException("expected expression '"
          + expression
          + "' to return string, but was: "
          + value);
View Full Code Here

Examples of org.jbpm.pvm.internal.script.ScriptManager

    // loop over all variable definitions
    if (hasVariableOutDefinitions()) {
      for (VariableOutDefinitionImpl variableOutDefinition: variableOutDefinitions) {
        String variableName = variableOutDefinition.getName();
        if (variableName!=null) {
          ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
         
          // TODO update evaluateExpression so that scopeInstance can be passed in directly
          String expression = variableOutDefinition.getExpression();
          String language = variableOutDefinition.getLanguage();

          Object value = scriptManager.evaluateExpression(expression, language);
          outerExecution.setVariable(variableName, value);
        }
      }
    }
  }
View Full Code Here

Examples of org.jbpm.pvm.internal.script.ScriptManager

      object = wireContext.create(factoryDescriptor, false);
      if (object==null) {
        throw new WireException("created factory object is null, can't invoke method '"+methodName+"' on it");
      }
    } else if (expr!=null) {
      ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
      object = scriptManager.evaluateExpression(expr, lang);
    }

    if (methodName!=null) {
      // method invocation on object or static method invocation in case object is null
      if (object!=null) {
View Full Code Here

Examples of org.jbpm.pvm.internal.script.ScriptManager

  public Object getInitValue(ExecutionImpl execution) {
    if (initDescriptor!=null) {
      return WireContext.create(initDescriptor);
    }
    if (initExpression!=null) {
      ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
      return scriptManager.evaluateExpression(initExpression, initLanguage);
    }
    return null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.