Package org.springframework.scripting

Examples of org.springframework.scripting.ScriptFactory


    BeanDefinition bd = this.beanFactory.getMergedBeanDefinition(beanName);
    String scriptFactoryBeanName = SCRIPT_FACTORY_NAME_PREFIX + beanName;
    String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName;
    prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName);

    ScriptFactory scriptFactory =
        (ScriptFactory) this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
    ScriptSource scriptSource =
        getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
    Class[] interfaces = scriptFactory.getScriptInterfaces();

    Class scriptedType = null;
    try {
      scriptedType = scriptFactory.getScriptedObjectType(scriptSource);
    }
    catch (Exception ex) {
      if (logger.isDebugEnabled()) {
        logger.debug("Could not determine the scripted object type for script factory [" + scriptFactory + "]", ex);
      }
View Full Code Here


    BeanDefinition bd = this.beanFactory.getMergedBeanDefinition(beanName);
    String scriptFactoryBeanName = SCRIPT_FACTORY_NAME_PREFIX + beanName;
    String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName;
    prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName);

    ScriptFactory scriptFactory =
        (ScriptFactory) this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
    ScriptSource scriptSource =
        getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
    boolean isFactoryBean = false;
    try {
      Class scriptedObjectType = scriptFactory.getScriptedObjectType(scriptSource);
      // returned type may be null if the factory is unable to determine
      if (scriptedObjectType != null) {
        isFactoryBean = FactoryBean.class.isAssignableFrom(scriptedObjectType);
      }
    }
    catch (Exception e) {
      throw new BeanCreationException("Unable to create scripted object: " + beanName, e);
    }

    long refreshCheckDelay = resolveRefreshCheckDelay(bd);
    if (refreshCheckDelay >= 0) {
      Class[] interfaces = scriptFactory.getScriptInterfaces();
      RefreshableScriptTargetSource ts =
          new RefreshableScriptTargetSource(this.scriptBeanFactory, scriptedObjectBeanName, scriptSource, isFactoryBean);
      ts.setRefreshCheckDelay(refreshCheckDelay);
      return createRefreshableProxy(ts, interfaces);
    }
View Full Code Here

    synchronized (this.scriptBeanFactory) {
      if (!this.scriptBeanFactory.containsBeanDefinition(scriptedObjectBeanName)) {

        this.scriptBeanFactory.registerBeanDefinition(
            scriptFactoryBeanName, createScriptFactoryBeanDefinition(bd));
        ScriptFactory scriptFactory =
            (ScriptFactory) this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
        ScriptSource scriptSource =
            getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
        Class[] interfaces = scriptFactory.getScriptInterfaces();

        Class[] scriptedInterfaces = interfaces;
        if (scriptFactory.requiresConfigInterface() && !bd.getPropertyValues().isEmpty()) {
          Class configInterface = createConfigInterface(bd, interfaces);
          scriptedInterfaces = (Class[]) ObjectUtils.addObjectToArray(interfaces, configInterface);
        }

        BeanDefinition objectBd = createScriptedObjectBeanDefinition(
View Full Code Here

    try {
      String scriptFactoryBeanName = SCRIPT_FACTORY_NAME_PREFIX + beanName;
      String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName;
      prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName);

      ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
      ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
      Class[] interfaces = scriptFactory.getScriptInterfaces();

      Class scriptedType = scriptFactory.getScriptedObjectType(scriptSource);
      if (scriptedType != null) {
        return scriptedType;
      } else if (!ObjectUtils.isEmpty(interfaces)) {
        return (interfaces.length == 1 ? interfaces[0] : createCompositeInterface(interfaces));
      } else {
View Full Code Here

    BeanDefinition bd = this.beanFactory.getMergedBeanDefinition(beanName);
    String scriptFactoryBeanName = SCRIPT_FACTORY_NAME_PREFIX + beanName;
    String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName;
    prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName);

    ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
    ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
    boolean isFactoryBean = false;
    try {
      Class scriptedObjectType = scriptFactory.getScriptedObjectType(scriptSource);
      // Returned type may be null if the factory is unable to determine the type.
      if (scriptedObjectType != null) {
        isFactoryBean = FactoryBean.class.isAssignableFrom(scriptedObjectType);
      }
    } catch (Exception ex) {
      throw new BeanCreationException(beanName, "Could not determine scripted object type for " + scriptFactory,
          ex);
    }

    long refreshCheckDelay = resolveRefreshCheckDelay(bd);
    if (refreshCheckDelay >= 0) {
      Class[] interfaces = scriptFactory.getScriptInterfaces();
      RefreshableScriptTargetSource ts = new RefreshableScriptTargetSource(this.scriptBeanFactory,
          scriptedObjectBeanName, scriptFactory, scriptSource, isFactoryBean);
      boolean proxyTargetClass = resolveProxyTargetClass(bd);
      String language = (String) bd.getAttribute(LANGUAGE_ATTRIBUTE);
      if (proxyTargetClass && (language==null || !language.equals("groovy"))) {
View Full Code Here

    synchronized (this.scriptBeanFactory) {
      if (!this.scriptBeanFactory.containsBeanDefinition(scriptedObjectBeanName)) {

        this.scriptBeanFactory.registerBeanDefinition(scriptFactoryBeanName,
            createScriptFactoryBeanDefinition(bd));
        ScriptFactory scriptFactory = this.scriptBeanFactory
            .getBean(scriptFactoryBeanName, ScriptFactory.class);
        ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName,
            scriptFactory.getScriptSourceLocator());
        Class<?>[] interfaces = scriptFactory.getScriptInterfaces();

        Class<?>[] scriptedInterfaces = interfaces;
        if (scriptFactory.requiresConfigInterface() && !bd.getPropertyValues().isEmpty()) {
          Class<?> configInterface = createConfigInterface(bd, interfaces);
          scriptedInterfaces = ObjectUtils.addObjectToArray(interfaces, configInterface);
        }

        BeanDefinition objectBd = createScriptedObjectBeanDefinition(bd, scriptFactoryBeanName, scriptSource,
View Full Code Here

    try {
      String scriptFactoryBeanName = SCRIPT_FACTORY_NAME_PREFIX + beanName;
      String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName;
      prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName);

      ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
      ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
      Class[] interfaces = scriptFactory.getScriptInterfaces();

      Class scriptedType = scriptFactory.getScriptedObjectType(scriptSource);
      if (scriptedType != null) {
        return scriptedType;
      } else if (!ObjectUtils.isEmpty(interfaces)) {
        return (interfaces.length == 1 ? interfaces[0] : createCompositeInterface(interfaces));
      } else {
View Full Code Here

    BeanDefinition bd = this.beanFactory.getMergedBeanDefinition(beanName);
    String scriptFactoryBeanName = SCRIPT_FACTORY_NAME_PREFIX + beanName;
    String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName;
    prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName);

    ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
    ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
    boolean isFactoryBean = false;
    try {
      Class scriptedObjectType = scriptFactory.getScriptedObjectType(scriptSource);
      // Returned type may be null if the factory is unable to determine the type.
      if (scriptedObjectType != null) {
        isFactoryBean = FactoryBean.class.isAssignableFrom(scriptedObjectType);
      }
    } catch (Exception ex) {
      throw new BeanCreationException(beanName, "Could not determine scripted object type for " + scriptFactory,
          ex);
    }

    long refreshCheckDelay = resolveRefreshCheckDelay(bd);
    if (refreshCheckDelay >= 0) {
      Class[] interfaces = scriptFactory.getScriptInterfaces();
      RefreshableScriptTargetSource ts = new RefreshableScriptTargetSource(this.scriptBeanFactory,
          scriptedObjectBeanName, scriptFactory, scriptSource, isFactoryBean);
      boolean proxyTargetClass = resolveProxyTargetClass(bd);
      String language = (String) bd.getAttribute(LANGUAGE_ATTRIBUTE);
      if (proxyTargetClass && (language==null || !language.equals("groovy"))) {
View Full Code Here

    synchronized (this.scriptBeanFactory) {
      if (!this.scriptBeanFactory.containsBeanDefinition(scriptedObjectBeanName)) {

        this.scriptBeanFactory.registerBeanDefinition(scriptFactoryBeanName,
            createScriptFactoryBeanDefinition(bd));
        ScriptFactory scriptFactory = this.scriptBeanFactory
            .getBean(scriptFactoryBeanName, ScriptFactory.class);
        ScriptSource scriptSource = getScriptSource(scriptFactoryBeanName,
            scriptFactory.getScriptSourceLocator());
        Class<?>[] interfaces = scriptFactory.getScriptInterfaces();

        Class<?>[] scriptedInterfaces = interfaces;
        if (scriptFactory.requiresConfigInterface() && !bd.getPropertyValues().isEmpty()) {
          Class<?> configInterface = createConfigInterface(bd, interfaces);
          scriptedInterfaces = ObjectUtils.addObjectToArray(interfaces, configInterface);
        }

        BeanDefinition objectBd = createScriptedObjectBeanDefinition(bd, scriptFactoryBeanName, scriptSource,
View Full Code Here

    try {
      String scriptFactoryBeanName = SCRIPT_FACTORY_NAME_PREFIX + beanName;
      String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName;
      prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName);

      ScriptFactory scriptFactory =
          (ScriptFactory) this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
      ScriptSource scriptSource =
          getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
      Class[] interfaces = scriptFactory.getScriptInterfaces();

      Class scriptedType = scriptFactory.getScriptedObjectType(scriptSource);
      if (scriptedType != null) {
        return scriptedType;
      }
      else if (!ObjectUtils.isEmpty(interfaces)) {
        return (interfaces.length == 1 ? interfaces[0] : createCompositeInterface(interfaces));
View Full Code Here

TOP

Related Classes of org.springframework.scripting.ScriptFactory

Copyright © 2018 www.massapicom. 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.