Package railo.runtime

Examples of railo.runtime.Component


      PageContext pc = ThreadLocalPageContext.get();
      PageException pe=null;
        // try to load as cfc
      if(pc!=null)  {
          try {
            Component c = pc.loadComponent(type);
            return ComponentUtil.getServerComponentPropertiesClass(pc,c);
        }
            catch (PageException e) {
              pe=e;
            }
View Full Code Here


          return trg; 
        }
       
       
        if(o instanceof Component) {
            Component comp=((Component)o);
            if(comp.instanceOf(type)) return o;
            // neo batch
            throw new ExpressionException("can't cast Component of Type ["+comp.getAbsName()+"] to ["+type+"]");
        }
        throw new CasterException(o,type);
    }
View Full Code Here

        else if(type==CFTypes.TYPE_VOID)           return toVoid(o);
        else if(type==CFTypes.TYPE_XML)            return toXML(o);
        else if(type==CFTypes.TYPE_FUNCTION)       return toFunction(o);

        if(o instanceof Component) {
            Component comp=((Component)o);
            if(comp.instanceOf(strType)) return o;
            throw new ExpressionException("can't cast Component of Type ["+comp.getAbsName()+"] to ["+strType+"]");
        }
       
        if(strType.endsWith("[]") && Decision.isArray(o)){
        String _strType=strType.substring(0,strType.length()-2);
        short _type=CFTypes.toShort(_strType, false, (short)-1);
View Full Code Here

      }
     
     
      pc.addPageSource(p.getPageSource(), true);
      try{
        Component cfc = pc.loadComponent(fullname);
        cfc.callWithNamedValues(pc, "output", args);
      }
      finally {
        pc.removeLastPageSource(true);
      }
        }
View Full Code Here

  }
 
  public static Object _call(PageContext pc , Object oCFC,Object oInterfaces) throws PageException, IOException {
   
    // Component
    Component cfc;
    if(oCFC instanceof Component)
      cfc= (Component)oCFC;
    else
      cfc=pc.loadComponent(Caster.toString(oCFC));
   
View Full Code Here

    return call(pc, false);
  }
 
  public static Struct call(PageContext pc, boolean suppressFunctions) {
    ApplicationContextPro ac = (ApplicationContextPro) pc.getApplicationContext();
    Component cfc = null;
    if(ac instanceof ModernApplicationContext)cfc= ((ModernApplicationContext)ac).getComponent();
   
    Struct sct=new StructImpl();
    sct.setEL("applicationTimeout", ac.getApplicationTimeout());
    sct.setEL("clientManagement", Caster.toBoolean(ac.isSetClientManagement()));
    sct.setEL("clientStorage", ac.getClientstorage());
    sct.setEL("sessionStorage", ac.getSessionstorage());
    sct.setEL("customTagPaths", toArray(ac.getCustomTagMappings()));
    sct.setEL("loginStorage", AppListenerUtil.translateLoginStorage(ac.getLoginStorage()));
    sct.setEL(KeyConstants._mappings, toStruct(ac.getMappings()));
    sct.setEL(KeyConstants._name, ac.getName());
    sct.setEL("scriptProtect", AppListenerUtil.translateScriptProtect(ac.getScriptProtect()));
    sct.setEL("secureJson", Caster.toBoolean(ac.getSecureJson()));
    sct.setEL("secureJsonPrefix", ac.getSecureJsonPrefix());
    sct.setEL("sessionManagement", Caster.toBoolean(ac.isSetSessionManagement()));
    sct.setEL("sessionTimeout", ac.getSessionTimeout());
    sct.setEL("clientTimeout", ac.getClientTimeout());
    sct.setEL("setClientCookies", Caster.toBoolean(ac.isSetClientCookies()));
    sct.setEL("setDomainCookies", Caster.toBoolean(ac.isSetDomainCookies()));
    sct.setEL(KeyConstants._name, ac.getName());
    sct.setEL("localMode", ac.getLocalMode()==Undefined.MODE_LOCAL_OR_ARGUMENTS_ALWAYS?Boolean.TRUE:Boolean.FALSE);
    sct.setEL(KeyConstants._locale,LocaleFactory.toString(pc.getLocale()));
    sct.setEL(KeyConstants._timezone,TimeZoneUtil.toString(pc.getTimeZone()));
    sct.setEL("sessionType", ((PageContextImpl) pc).getSessionType()==ConfigImpl.SESSION_TYPE_CFML?"cfml":"j2ee");
    sct.setEL("serverSideFormValidation", Boolean.FALSE); // TODO impl

    sct.setEL("clientCluster", Caster.toBoolean(ac.getClientCluster()));
    sct.setEL("sessionCluster", Caster.toBoolean(ac.getSessionCluster()));
   

    sct.setEL("invokeImplicitAccessor", Caster.toBoolean(ac.getTriggerComponentDataMember()));
    sct.setEL("triggerDataMember", Caster.toBoolean(ac.getTriggerComponentDataMember()));
    sct.setEL("sameformfieldsasarray", Caster.toBoolean(ac.getSameFieldAsArray(Scope.SCOPE_FORM)));
    sct.setEL("sameurlfieldsasarray", Caster.toBoolean(ac.getSameFieldAsArray(Scope.SCOPE_URL)));
   
    Object ds = ac.getDefDataSource();
    if(ds instanceof DataSource) ds=_call((DataSource)ds);
    else ds=Caster.toString(ds,null);
    sct.setEL(KeyConstants._datasource, ds);
    sct.setEL("defaultDatasource", ds);
   
    Resource src = ac.getSource();
    if(src!=null)sct.setEL(KeyConstants._source,src.getAbsolutePath());
   
    // orm
    if(ac.isORMEnabled()){
      ORMConfiguration conf = ac.getORMConfiguration();
      if(conf!=null)sct.setEL(KeyConstants._orm, conf.toStruct());
    }
    // s3
    Properties props = ac.getS3();
    if(props!=null) {
      sct.setEL(KeyConstants._s3, props.toStruct());
    }
   
    // datasources
    DataSource[] sources = ac.getDataSources();
    if(!ArrayUtil.isEmpty(sources)){
      Struct _sources = new StructImpl(),s;
      sct.setEL(KeyConstants._datasources, _sources);
      for(int i=0;i<sources.length;i++){
        _sources.setEL(KeyImpl.init(sources[i].getName()), _call(sources[i]));
      }
     
    }
   
    //cache
    String func = ac.getDefaultCacheName(Config.CACHE_DEFAULT_FUNCTION);
    String obj = ac.getDefaultCacheName(Config.CACHE_DEFAULT_OBJECT);
    String qry = ac.getDefaultCacheName(Config.CACHE_DEFAULT_QUERY);
    String res = ac.getDefaultCacheName(Config.CACHE_DEFAULT_RESOURCE);
    String tmp = ac.getDefaultCacheName(Config.CACHE_DEFAULT_TEMPLATE);
    if(func!=null || obj!=null || qry!=null || res!=null || tmp!=null) {
      Struct cache=new StructImpl();
      sct.setEL(KeyConstants._cache, cache);
      if(func!=null)cache.setEL(KeyConstants._function, func);
      if(obj!=null)cache.setEL(KeyConstants._object, obj);
      if(qry!=null)cache.setEL(KeyConstants._query, qry);
      if(res!=null)cache.setEL(KeyConstants._resource, res);
      if(tmp!=null)cache.setEL(KeyConstants._template, tmp);
    }
   
    // java settings
    JavaSettings js = ac.getJavaSettings();
    StructImpl jsSct = new StructImpl();
    jsSct.put("loadCFMLClassPath",js.loadCFMLClassPath());
    jsSct.put("reloadOnChange",js.reloadOnChange());
    jsSct.put("watchInterval",new Double(js.watchInterval()));
    jsSct.put("watchExtensions",ListUtil.arrayToList(js.watchedExtensions(),","));
    Resource[] reses = js.getResources();
    StringBuilder sb=new StringBuilder();
    for(int i=0;i<reses.length;i++){
      if(i>0)sb.append(',');
      sb.append(reses[i].getAbsolutePath());
    }
    jsSct.put("loadCFMLClassPath",sb.toString());
    sct.put("javaSettings",jsSct);
    // REST Settings
    // MUST
   
    if(cfc!=null){
      sct.setEL(KeyConstants._component, cfc.getPageSource().getDisplayPath());
     
      try {
        ComponentWrap cw=ComponentWrap.toComponentWrap(Component.ACCESS_PRIVATE, cfc);
        Iterator<Key> it = cw.keyIterator();
        Collection.Key key;
View Full Code Here

  public static Object call(PageContext pc, String name, String md5, Struct sctThis, Struct sctVariables) throws PageException {
    return invoke(pc, name, md5, sctThis, sctVariables);
  }
  public static Component invoke(PageContext pc, String name, String md5, Struct sctThis, Struct sctVariables) throws PageException {
    // Load comp
    Component comp=null;
    try {
      comp = pc.loadComponent(name);
      if(!ComponentUtil.md5(comp).equals(md5)){ 
        SystemOut.printDate(pc.getConfig().getErrWriter(),"component ["+name+"] in this enviroment has not the same interface as the component to load, it is possible that one off the components has Functions added dynamicly.");
        //throw new ExpressionException("component ["+name+"] in this enviroment has not the same interface as the component to load");
View Full Code Here

 
  public static Object call(PageContext pc, String name,Struct properties) throws PageException {
    ORMSession session=ORMUtil.getSession(pc);
    if(properties==null)return session.create(pc,name);
   
    Component entity = session.create(pc,name);
    setPropeties(pc,entity,properties,false);
    return entity;
   
  }
View Full Code Here

      if(page.metaData!=null && page.metaData.get()!=null) return page.metaData.get();
    }catch(Throwable t){}*/

    // load the cfc when metadata was not defined before
    try{
      Component cfc = CreateObject.doComponent(pc, Caster.toString(obj));
      return cfc.getMetaData(pc);
    }
    // TODO better solution
    catch(ApplicationException ae){
      try{
        InterfaceImpl inter = ComponentLoader.loadInterface(pc,((PageContextImpl)pc).getCurrentPageSource(null), Caster.toString(obj), new HashMap());
View Full Code Here

  private static final long serialVersionUID = -3787469574373656167L;

  // TODO support enties more deeply
  public static Object call(PageContext pc ) throws PageException {
        Component ac = pc.getActiveComponent();
        if(ac!=null) {
          return call(pc , ac);
      }
     
    return new StructImpl();
View Full Code Here

TOP

Related Classes of railo.runtime.Component

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.