Package railo.runtime.listener

Examples of railo.runtime.listener.ApplicationContextPro


    getSessionFactory(pc,INIT_CFCS);
  }
   
  @Override
  public ORMSession createSession(PageContext pc) throws PageException {
    ApplicationContextPro appContext = (ApplicationContextPro) pc.getApplicationContext();
    Object o=appContext.getORMDataSource();
   
    DataSource ds=o instanceof DataSource?
        (DataSource)o:
        CommonUtil.getDataSource(pc,CommonUtil.toString(o));
   
View Full Code Here


  private SessionFactory getSessionFactory(PageContext pc,int initType) throws PageException {
    return getSessionFactoryData(pc, initType).getFactory();
  }

  private SessionFactoryData getSessionFactoryData(PageContext pc,int initType) throws PageException {
    ApplicationContextPro appContext = (ApplicationContextPro) pc.getApplicationContext();
    if(!appContext.isORMEnabled())
      throw ExceptionUtil.createException((ORMSession)null,null,"ORM is not enabled","");
   
   
    // datasource
    DataSource ds = ORMUtil.getDataSource(pc);
    ORMConfiguration ormConf=appContext.getORMConfiguration();
    String key = hash(ormConf,ds);
    SessionFactoryData data = factories.get(key);
    if(initType==INIT_ALL && data!=null) {
      data.reset();
      data=null;
View Full Code Here

   
    return list;
  }

  private static Object hash(PageContext pc) throws PageException {
    ApplicationContextPro appContext=(ApplicationContextPro) pc.getApplicationContext();
    Object o=appContext.getORMDataSource();
    DataSource ds;
    if(o instanceof DataSource) ds=(DataSource) o;
    else ds=CommonUtil.getDataSource(pc,CommonUtil.toString(o));
    return hash(appContext.getORMConfiguration(),ds);
  }
View Full Code Here

  }

  @Override
  public int doStartTag() throws PageException  {
       
        ApplicationContextPro ac;
        boolean initORM;
        if(action==ACTION_CREATE){
          ac=new ClassicApplicationContext(pageContext.getConfig(),name,false,
              pageContext.getCurrentPageSource().getResourceTranslated(pageContext));
          initORM=set(ac);
View Full Code Here

  public static Struct call(PageContext pc) {
    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(),","));
View Full Code Here

TOP

Related Classes of railo.runtime.listener.ApplicationContextPro

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.