Package railo.runtime.type

Examples of railo.runtime.type.UDF


    }
   
    private static String castToJson(PageContext pc,Component cfc, String defaultValue) throws ConverterException {
    Object o=cfc.get(TO_JSON,null);
    if(!(o instanceof UDF)) return defaultValue;
    UDF udf=(UDF) o;
    if(udf.getReturnType()!=CFTypes.TYPE_VOID && udf.getFunctionArguments().length==0) {
      try {
        return Caster.toString(cfc.call(pc, TO_JSON, new Object[0]));
      } catch (PageException e) {
        e.printStackTrace();
        throw toConverterException(e);
View Full Code Here


   
   
    Iterator<Entry<Key, Object>> it = component.entryIterator();
    Entry<Key, Object> e;
    Object value;
    UDF udf;
    Struct meta;
    int status=404;
    MimeType bestP,bestC;
    while(it.hasNext()){
      e = it.next();
      value=e.getValue();
      if(value instanceof UDF){
        udf=(UDF)value;
        try {
          meta = udf.getMetaData(pc);
         
          // check if http method match
          String httpMethod = Caster.toString(meta.get(KeyConstants._httpmethod,null),null);
          if(StringUtil.isEmpty(httpMethod) || !httpMethod.equalsIgnoreCase(method)) continue;
         
View Full Code Here

    ComponentScope scope = cw.getComponentScope();
    Struct udfs=new StructImpl(),sctUDF,sctArg;
    Array arrArg;
    Iterator<Object> it = scope.valueIterator();
    Object v;
    UDF udf;
    FunctionArgument[] args;
    while(it.hasNext()){
        v=it.next();
          // UDF
        if(v instanceof UDF) {
          udf=(UDF) v;
            sctUDF=new StructImpl();
            arrArg=new ArrayImpl();
            udfs.setEL(udf.getFunctionName(), sctUDF);
            args = udf.getFunctionArguments();
            for(int i=0;i<args.length;i++){
              sctArg=new StructImpl();
              arrArg.appendEL(sctArg);
              sctArg.setEL(KeyConstants._name, args[i].getName().getString());
              sctArg.setEL(KeyConstants._type, args[i].getTypeAsString());
              sctArg.setEL(KeyConstants._required, args[i].isRequired());
              if(!StringUtil.isEmpty(args[i].getHint()))sctArg.setEL(KeyConstants._hint, args[i].getHint());
            }
            sctUDF.set(KeyConstants._arguments, arrArg);
            sctUDF.set(KeyConstants._returntype, udf.getReturnTypeAsString());
           
          }
    }
    Struct rtn=new StructImpl();
    rtn.set(KeyConstants._functions, udfs);
View Full Code Here

    catch(MissingIncludeException mie){
      ApplicationContext ac = pc.getApplicationContext();
      boolean rethrow=true;
      if(ac instanceof ClassicApplicationContext) {
        ClassicApplicationContext cfc=(ClassicApplicationContext) ac;
        UDF udf = cfc.getOnMissingTemplate();
        if(udf!=null) {
          String targetPage=requestedPage.getFullRealpath();
          rethrow=(!Caster.toBooleanValue(udf.call(pc, new Object[]{targetPage}, true),true));
        }
      }
      if(rethrow)throw mie;
    }
   
View Full Code Here

    String filename=Caster.toString((((FunctionValue) objArr[0]).getValue()));
    Collection.Key name=KeyImpl.toKey((((FunctionValue) objArr[1]).getValue()));
    boolean isweb=Caster.toBooleanValue((((FunctionValue) objArr[2]).getValue()));
   
   
    UDF udf=loadUDF(pc, filename, name, isweb);
    Struct meta = udf.getMetaData(pc);
    boolean caller=meta==null?false:Caster.toBooleanValue(meta.get(KeyConstants._caller,Boolean.FALSE),false);
   
    Struct namedArguments=null;
    Object[] arguments=null;
    if(objArr.length<=3)arguments=ArrayUtil.OBJECT_EMPTY;
View Full Code Here

  }

  public static synchronized UDF loadUDF(PageContext pc, String filename,Collection.Key name,boolean isweb) throws PageException {
    ConfigWebImpl config = (ConfigWebImpl) pc.getConfig();
    String key=isweb?name.getString()+config.getId():name.getString();
      UDF udf=config.getFromFunctionCache(key);
    if(udf!=null) return udf;
   
    Mapping mapping=isweb?config.getFunctionMapping():config.getServerFunctionMapping();
      PageSourceImpl ps = (PageSourceImpl) mapping.getPageSource(filename);
      Page p = ps.loadPage(pc)
View Full Code Here

    Component c=cfc;
    if(cfc instanceof ComponentAccess)c=ComponentWrap.toComponentWrap(methodAccessLevel,cfc);
   

    Property[] prop = cfc.getProperties(false);
    Object v; UDF udf;
      if(prop!=null)for(int i=0;i<prop.length;i++) {
        boolean remotingFetch = Caster.toBooleanValue(prop[i].getDynamicAttributes().get(REMOTING_FETCH,Boolean.TRUE),true);
        if(!remotingFetch) continue;
       
        v=cfc.get(prop[i].getName(),null);
        if(v==null){
          v=c.get("get"+prop[i].getName(),null);
          if(v instanceof UDF){
                udf=(UDF) v;
                if(udf.getReturnType()==CFTypes.TYPE_VOID) continue;
                if(udf.getFunctionArguments().length>0) continue;
               
                try {
            v=c.call(ThreadLocalPageContext.get(), udf.getFunctionName(), ArrayUtil.OBJECT_EMPTY);
          } catch (PageException e) {
            continue;
          }
              }
        }
View Full Code Here

    ArrayList<FunctionLibFunctionArg> args = function.getArg();
   
    String filename = Caster.toString(args.get(0).getDefaultValue());
    Key name = KeyImpl.toKey(args.get(1).getDefaultValue());
    boolean isWeb = Caster.toBooleanValue(args.get(2).getDefaultValue());
    UDF udf = CFFunction.loadUDF(pc, filename, name, isWeb);
   
    sct.set(KeyConstants._name,function.getName());
        sct.set(ARGUMENT_TYPE,"fixed");
        sct.set(KeyConstants._description,StringUtil.emptyIfNull(udf.getHint()));
        sct.set(RETURN_TYPE,StringUtil.emptyIfNull(udf.getReturnTypeAsString()));
        sct.set(KeyConstants._type,"cfml");
        sct.set(SOURCE,udf.getPageSource().getDisplayPath());
    sct.set(KeyConstants._status,"implemeted");
   
   
        FunctionArgument[] fas = udf.getFunctionArguments();
        Array _args=new ArrayImpl();
    sct.set(KeyConstants._arguments,_args);
        int min=0,max=0;
    for(int i=0;i<fas.length;i++) {
          FunctionArgument fa=fas[i];
View Full Code Here

   
    Iterator it = cfc.entrySet().iterator();
        Map.Entry entry;
        Object v;
        Collection.Key k;
        UDF udf;
        String name;
        while(it.hasNext()) {
            entry=(Entry) it.next();
            k=KeyImpl.toKey(entry.getKey());
            v=entry.getValue();
           
            // add getters
            if(v instanceof UDF){
              if(!doGetters) continue;
              udf=(UDF) v;
              name=udf.getFunctionName();
              if(!StringUtil.startsWithIgnoreCase(name, "get"))continue;
              if(udf.getReturnType()==CFTypes.TYPE_VOID) continue;
              if(udf.getFunctionArguments().length>0) continue;
             
              try {
          v=cfc.call(ThreadLocalPageContext.get(), name, ArrayUtil.OBJECT_EMPTY);
        } catch (PageException e) {
          continue;
View Full Code Here

TOP

Related Classes of railo.runtime.type.UDF

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.