Get a specific script

@param model
@param scriptIdentifier
@return
@throws Exception
420639
@RequestMapping(value = "/api/scripts/{scriptIdentifier}", method = RequestMethod.GET)
    public
    @ResponseBody
    Script getScript(Model model, @PathVariable String scriptIdentifier) throws Exception {
        return ScriptService.getInstance().getScript(Integer.parseInt(scriptIdentifier));
    }
845217
private static String getScriptVarImpl(String scriptName, String key) {
		Map<String, String> scVars = scriptVars.get(scriptName);
		if (scVars == null) {
			// No vars have been associated with this script
			return null;
		}
		
		return scVars.get(key);
	}
244222
protected ScriptEngine getEngine()
    {
        if (engine == null)
        {
            ScriptEngineManager factory = new ScriptEngineManager();
            engine = factory.getEngineByName("JavaScript");
            engine.put("proc", this);
            
            //rhino compatibility workaround, println should be replaced by print in all occurences
            try
            {
                engine.eval("if (typeof println == 'undefined') this.println = print;");
            } catch (ScriptException e) {
                e.printStackTrace();
            }
            
            Map<String, ScriptObject> scriptObjects = ServiceManager.findScriptObjects();
            for (Map.Entry<String, ScriptObject> obj : scriptObjects.entrySet())
            {
                engine.put(obj.getKey(), obj.getValue());
            }
        }
        return engine;
    }
751364
public static Object eval(String script) {
        try {
            return getScriptEngine().eval(script);
        } catch (Exception e) {
            return JMExceptionManager
                    .handleExceptionAndReturnNull(log, e, "eval", script);
        }
    }
1101635
@Override
	public <T> T getInterface(Object thiz, Class<T> clasz) {
		return ((Invocable) scriptEngine).getInterface(thiz, clasz);
	}
1237648
def get_script(name=None):  # noqa: E501
    

    if(not hasAccess()):
        return redirectUnauthorized()

    driver = LoadedDrivers.getDefaultBaseDriver()
    return Response(status=200, body=driver.readScript(name))
82648
public CompiledScript compile(String scriptSource) throws ScriptException {
        try {
            return new GroovyCompiledScript(this,
                    getScriptClass(scriptSource));
        } catch (CompilationFailedException ee) {
            throw new ScriptException(ee);
        }
    }
197697
@RequestMapping(value = "/api/profile/{profileIdentifier}/clients/{clientUUID}", method = RequestMethod.GET)
    public
    @ResponseBody
    HashMap<String, Object> getClient(Model model,
                                      @PathVariable("profileIdentifier") String profileIdentifier,
                                      @PathVariable("clientUUID") String clientUUID) throws Exception {
        Integer profileId = ControllerUtils.convertProfileIdentifier(profileIdentifier);
        HashMap<String, Object> valueHash = new HashMap<String, Object>();
        valueHash.put("client", clientService.findClient(clientUUID, profileId));
        return valueHash;
    }
423632
public static <T> T executeScriptEngine(final String scriptFile, final Object[] args, final Class<T> clazz) {
        try {
            val engineName = getScriptEngineName(scriptFile);
            val engine = new ScriptEngineManager().getEngineByName(engineName);
            if (engine == null || StringUtils.isBlank(engineName)) {
                LOGGER.warn("Script engine is not available for [{}]", engineName);
                return null;
            }

            val resourceFrom = ResourceUtils.getResourceFrom(scriptFile);
            val theScriptFile = resourceFrom.getFile();
            if (theScriptFile.exists()) {
                LOGGER.debug("Created object instance from class [{}]", theScriptFile.getCanonicalPath());

                try (val reader = Files.newBufferedReader(theScriptFile.toPath(), StandardCharsets.UTF_8)) {
                    engine.eval(reader);
                }
                val invocable = (Invocable) engine;
                LOGGER.debug("Executing script's run method, with parameters [{}]", args);
                val result = invocable.invokeFunction("run", args);
                LOGGER.debug("Groovy script result is [{}]", result);
                return getGroovyScriptExecutionResultOrThrow(clazz, result);
            }
            LOGGER.warn("[{}] script [{}] does not exist, or cannot be loaded", StringUtils.capitalize(engineName), scriptFile);
        } catch (final Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }
189020
@Help(
    help =
        "Executes a script at runtime for a VNFR of a defined VNFD in a running NSR with specific id"
  )
  public void executeScript(final String idNsr, final String idVnfr, String script)
      throws SDKException {
    String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/execute-script";
    requestPost(url, script);
  }
89661
@Override
	public CompiledScript compile(String script) throws ScriptException {
		return ((Compilable) engine).compile(script);
	}
278981
public Script getScriptSigWithSignature(Script scriptSig, byte[] sigBytes, int index) {
        int sigsPrefixCount = 0;
        int sigsSuffixCount = 0;
        if (ScriptPattern.isP2SH(this)) {
            sigsPrefixCount = 1; // OP_0 <sig>* <redeemScript>
            sigsSuffixCount = 1;
        } else if (ScriptPattern.isSentToMultisig(this)) {
            sigsPrefixCount = 1; // OP_0 <sig>*
        } else if (ScriptPattern.isP2PKH(this)) {
            sigsSuffixCount = 1; // <sig> <pubkey>
        }
        return ScriptBuilder.updateScriptWithSignature(scriptSig, sigBytes, index, sigsPrefixCount, sigsSuffixCount);
    }
786743
public String getJavaScriptForRedirect(String reqUrlCookieName, String redirectUrl) throws Exception {
        return getJavaScriptForRedirect(reqUrlCookieName, redirectUrl, null);
    }
260206
private Map<Integer, Class<? extends T>> findInstanceAbleScript(Set<Class<? extends T>> scriptClazzs)
			throws InstantiationException, IllegalAccessException {
		Map<Integer, Class<? extends T>> codeMap = new ConcurrentHashMap<Integer, Class<? extends T>>();
		for (Class<? extends T> scriptClazz : scriptClazzs) 
		{
			T script = getInstacne(scriptClazz);
			if(script==null)
			{
				continue;
			}
			if(skipRegistScript(script))
			{
				_log.warn("skil regist script,code="+script.getMessageCode()+",class=" + script.getClass());
				continue;
			}
			int code = script.getMessageCode();
			if (codeMap.containsKey(script.getMessageCode())) {// 重复脚本code定义
				_log.error("find Repeat ScriptClass,code="+code+",addingScript:" + script.getClass() + ",existScript:"
						+ codeMap.get(code));
			} else {
				codeMap.put(code, scriptClazz);
				_log.info("regist ScriptClass:code="+code+",class=" + scriptClazz);
			}
		}
		return codeMap;
	}
1112521
private void loadScript(Node node) throws Exception
   {
      ResourceId key = new NodeScriptKey(repository.getConfiguration().getName(), workspaceName, node);
      ObjectFactory<AbstractResourceDescriptor> resource =
         groovyScript2RestLoader.groovyPublisher.unpublishResource(key);
      if (resource != null)
      {
         groovyScript2RestLoader.groovyPublisher.publishPerRequest(node.getProperty("jcr:data").getStream(), key,
            resource.getObjectModel().getProperties());
      }
      else
      {
         groovyScript2RestLoader.groovyPublisher.publishPerRequest(node.getProperty("jcr:data").getStream(), key, null);
      }
   }
794374
protected Set<Class<? extends S>> findInstanceAbleScript(Set<Class<? extends S>> scriptClazzs)
			throws InstantiationException, IllegalAccessException {
		Set<Class<? extends S>> result=new HashSet<>();
		for (Class<? extends S> scriptClazz : scriptClazzs) 
		{
			if(isInstanceAble(scriptClazz))
			{
				result.add(scriptClazz);
			}
		}
		return result;
	}
547959
public com.google.appengine.v1.ScriptHandlerOrBuilder getScriptOrBuilder() {
    if (handlerTypeCase_ == 3) {
       return (com.google.appengine.v1.ScriptHandler) handlerType_;
    }
    return com.google.appengine.v1.ScriptHandler.getDefaultInstance();
  }