Package railo.runtime.config

Examples of railo.runtime.config.ConfigImpl


  }


  public static HibernateORMEngine getORMEngine(PageContext pc) throws PageException {
    if(pc==null) pc=CommonUtil.pc();
    ConfigImpl config = (ConfigImpl) pc.getConfig();
    return (HibernateORMEngine) config.getORMEngine(pc);// TODO add this method to the public interface
  }
View Full Code Here


  public static ORMSession getSession(PageContext pc, boolean create) throws PageException {
    return ((PageContextImpl) pc).getORMSession(create);
  }

  public static ORMEngine getEngine(PageContext pc) throws PageException {
    ConfigImpl config=(ConfigImpl) pc.getConfig();
    return config.getORMEngine(pc);
  }
View Full Code Here

   * @param pc
   * @param force if set to false the engine is on loaded when the configuration has changed
   * @throws PageException
   */
  public static void resetEngine(PageContext pc, boolean force) throws PageException {
    ConfigImpl config=(ConfigImpl) pc.getConfig();
    config.resetORMEngine(pc,force);
  }
View Full Code Here

    }
    catch (Throwable t) {}
  }
 
  protected static Resource _loadResource(ConfigWeb config, int type,String name, String cfid) {
    ConfigImpl ci = (ConfigImpl)config;
    Resource dir= type==SCOPE_CLIENT?ci.getClientScopeDir():ci.getSessionScopeDir();
    return   dir.getRealResource(getFolderName(name,cfid,true));
  }
View Full Code Here

 
 
 
 
  protected static Struct _loadData(PageContext pc, String datasourceName,String strType,int type, Log log, boolean mxStyle) throws PageException  {
    ConfigImpl config = (ConfigImpl)pc.getConfig();
    DatasourceConnectionPool pool = config.getDatasourceConnectionPool();
    DatasourceConnection dc=pool.getDatasourceConnection(pc,((PageContextImpl)pc).getDataSource(datasourceName),null,null);
    SQLExecutor executor=SQLExecutionFactory.getInstance(dc);
   
   
    Query query;
View Full Code Here

 
  public void store(Config config) {
    //if(!super.hasContent()) return;
   
    DatasourceConnection dc = null;
    ConfigImpl ci = (ConfigImpl)config;
    DatasourceConnectionPool pool = ci.getDatasourceConnectionPool();
    Log log=((ConfigImpl)config).getScopeLogger();
    try {
      PageContext pc = ThreadLocalPageContext.get();// FUTURE change method interface
      DataSource ds;
      if(pc!=null) ds=((PageContextImpl)pc).getDataSource(datasourceName);
View Full Code Here

      if(dc!=null) pool.releaseDatasourceConnection(dc);
    }
  }
 
  public void unstore(Config config) {
    ConfigImpl ci=(ConfigImpl) config;
    DatasourceConnection dc = null;
   
   
    DatasourceConnectionPool pool = ci.getDatasourceConnectionPool();
    Log log=((ConfigImpl)config).getScopeLogger();
    try {
      PageContext pc = ThreadLocalPageContext.get();// FUTURE change method interface
      DataSource ds;
      if(pc!=null) ds=((PageContextImpl)pc).getDataSource(datasourceName);
View Full Code Here

      return (Page)load(pc, child,rawPath, searchLocal, searchRoot,null,true);
    }
   
   
    private static Object load(PageContext pc,PageSource child,String rawPath, Boolean searchLocal, Boolean searchRoot, Map interfaceUDFs, boolean returnPage) throws PageException  {
      ConfigImpl config=(ConfigImpl) pc.getConfig();
      boolean doCache=config.useComponentPathCache();
     
      //print.o(rawPath);
      //app-String appName=pc.getApplicationContext().getName();
      rawPath=rawPath.trim().replace('\\','/');
      String path=(rawPath.indexOf("./")==-1)?rawPath.replace('.','/'):rawPath;
      String pathWithCFC=path.concat(".cfc");
      boolean isRealPath=!StringUtil.startsWith(pathWithCFC,'/');
      PageSource currPS = pc.getCurrentPageSource();
      Page currP=((PageSourceImpl)currPS).loadPage(pc,(Page)null);
     
      PageSource ps=null;
      Page page=null;
     
      if(searchLocal==null)
        searchLocal=Caster.toBoolean(config.getComponentLocalSearch());
      if(searchRoot==null)
        searchRoot=Caster.toBoolean(config.getComponentRootSearch());
     
      //boolean searchLocal=config.getComponentLocalSearch();
    // CACHE
      // check local in cache
      String localCacheName=null;
      if(searchLocal && isRealPath){
        localCacheName=currPS.getDisplayPath().replace('\\', '/');
        localCacheName=localCacheName.substring(0,localCacheName.lastIndexOf('/')+1).concat(pathWithCFC);
        if(doCache){
          page=config.getCachedPage(pc, localCacheName);
          if(page!=null) return returnPage?page:load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
        }
      }
     
      // check import cache
      if(doCache && isRealPath){
        ImportDefintion impDef = config.getComponentDefaultImport();
        ImportDefintion[] impDefs=currP==null?new ImportDefintion[0]:currP.getImportDefintions();
        int i=-1;
        do{
         
          if(impDef.isWildcard() || impDef.getName().equalsIgnoreCase(path)){
            page=config.getCachedPage(pc, "import:"+impDef.getPackageAsPath()+pathWithCFC);
            if(page!=null) return returnPage?page:load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
           
            //app-page=config.getCachedPage(pc, "import:"+appName+":"+impDef.getPackageAsPath()+pathWithCFC);
            //app-if(page!=null) return load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
          }
          impDef=++i<impDefs.length?impDefs[i]:null;
        }
        while(impDef!=null);
      }
     
      if(doCache) {
        // check global in cache
        page=config.getCachedPage(pc, pathWithCFC);
        if(page!=null) return returnPage?page:load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
       
        // get pages from application mappings
        //app-page=config.getCachedPage(pc, ":"+appName+":"+pathWithCFC);
        //app-if(page!=null) return load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
      }
     
    // SEARCH
      // search from local
      if(searchLocal && isRealPath)  {
        // check realpath
        PageSource[] arr = ((PageContextImpl)pc).getRelativePageSources(pathWithCFC);
        page=PageSourceImpl.loadPage(pc, arr,null);
      if(page!=null){
        if(doCache)config.putCachedPageSource(localCacheName, page.getPageSource());
        return returnPage?page:load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
      }
      }
     
      // search with imports
      Mapping[] cMappings = config.getComponentMappings();
     
      if(isRealPath){

        ImportDefintion impDef = config.getComponentDefaultImport();
        ImportDefintion[] impDefs=currP==null?new ImportDefintion[0]:currP.getImportDefintions();
        PageSource[] arr;

       
        int i=-1;
        do{
          if(impDef.isWildcard() || impDef.getName().equalsIgnoreCase(path)){
           
            // search from local first
            if(searchLocal){
              arr = ((PageContextImpl)pc).getRelativePageSources(impDef.getPackageAsPath()+pathWithCFC);
              page=PageSourceImpl.loadPage(pc, arr,null);
              if(page!=null)  {
                if(doCache)config.putCachedPageSource("import:"+impDef.getPackageAsPath()+pathWithCFC, page.getPageSource());
                return returnPage?page:load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
                }
            }
           
            // search local component mappings
            /*app-if(lcMappings!=null) {
              Mapping m;
                for(int y=0;y<lcMappings.length;y++){
                  m=lcMappings[y];
                  String key=appName+":"+impDef.getPackageAsPath()+pathWithCFC;
                  ps=m.getPageSource(impDef.getPackageAsPath()+pathWithCFC);
                  page=((PageSourceImpl)ps).loadPage(pc,pc.getConfig(),null);
                if(page!=null)  {   
                  if(doCache)config.putCachedPageSource("import:"+key, page.getPageSource());
                  return load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
                  }
                }
              }*/
           
            // search mappings and webroot
            page=PageSourceImpl.loadPage(pc, ((PageContextImpl)pc).getPageSources("/"+impDef.getPackageAsPath()+pathWithCFC), null);
            if(page!=null){
                String key=impDef.getPackageAsPath()+pathWithCFC;
                if(doCache && !((MappingImpl)page.getPageSource().getMapping()).isAppMapping())
                  config.putCachedPageSource("import:"+key, page.getPageSource());
              return returnPage?page:load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
              }
           
            // search component mappings
            Mapping m;
              for(int y=0;y<cMappings.length;y++){
                m=cMappings[y];
                ps=m.getPageSource(impDef.getPackageAsPath()+pathWithCFC);
                page=((PageSourceImpl)ps).loadPage(pc,(Page)null);
              if(page!=null)  {   
                if(doCache)config.putCachedPageSource("import:"+impDef.getPackageAsPath()+pathWithCFC, page.getPageSource());
                return returnPage?page:load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
                }
              }
          }
          impDef=++i<impDefs.length?impDefs[i]:null;
        }
        while(impDef!=null);
       
      }
           
    String p;
      if(isRealPathp='/'+pathWithCFC;
      else p=pathWithCFC;
     

   
      // search local component mappings
      /* app-if(lcMappings!=null) {
        Mapping m;
        for(int i=0;i<lcMappings.length;i++){
          m=lcMappings[i];
          ps=m.getPageSource(p);
          page=((PageSourceImpl)ps).loadPage(pc,pc.getConfig(),null);
          String key=":"+appName+":"+pathWithCFC;
          if(page!=null){
            if(doCache)config.putCachedPageSource(key, page.getPageSource());
            return load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
            }
        }
      }*/
     
      // search mappings and webroot
      page=PageSourceImpl.loadPage(pc,((PageContextImpl)pc).getPageSources(p),null);
      if(page!=null){
        String key=pathWithCFC;
        if(doCache && !((MappingImpl)page.getPageSource().getMapping()).isAppMapping())
          config.putCachedPageSource(key, page.getPageSource());
      return returnPage?page:load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
      }
   
      // search component mappings
      Mapping m;
      for(int i=0;i<cMappings.length;i++){
        m=cMappings[i];
        ps=m.getPageSource(p);
        page=((PageSourceImpl)ps).loadPage(pc,(Page)null);
       
        // recursive search
        if(page==null && config.doComponentDeepSearch() && m.hasPhysical() && path.indexOf('/')==-1) {
          String _path=getPagePath(pc, m.getPhysical(), null,pathWithCFC,DirectoryResourceFilter.FILTER);
          if(_path!=null) {
            ps=m.getPageSource(_path);
              page=((PageSourceImpl)ps).loadPage(pc,(Page)null);
              doCache=false;// do not cache this, it could be ambigous
          }
        }
       
        if(page!=null){
          if(doCache)config.putCachedPageSource(pathWithCFC, page.getPageSource());
          return returnPage?page:load(pc,page,page.getPageSource(),trim(path.replace('/', '.')),isRealPath,interfaceUDFs);
          }
      }
     

View Full Code Here

      TagLib tagLib=tagLibTag.getTagLib();
      ExprTransformer transformer;
      String text=ASMUtil.getAttributeString(tag, "condition");

      try {
        ConfigImpl config=(ConfigImpl) ThreadLocalPageContext.getConfig();
        transformer = tagLib.getExprTransfomer();
        Expression expr=transformer.transform(ASMUtil.getAncestorPage(tag),null,flibs,config.getCoreTagLib().getScriptTags(),new CFMLString(text,"UTF-8"),TransfomerSettings.toSetting(ThreadLocalPageContext.getConfig(),null));
        tag.addAttribute(new Attribute(false,"condition",CastBoolean.toExprBoolean(expr),"boolean"));
      }
      catch (Exception e) {
        throw new EvaluatorException(e.getMessage());
      }
View Full Code Here

  public static  QueryImpl __execute(PageContext pc, SQL sql, int maxrows, int fetchsize, int timeout,Stopwatch stopwatch,Set<String> tables, boolean doSimpleTypes) throws PageException {
    ArrayList<String> usedTables=new ArrayList<String>();
    synchronized(lock) {
         
      QueryImpl nqr=null;
      ConfigImpl config = (ConfigImpl)pc.getConfig();
      DatasourceConnectionPool pool = config.getDatasourceConnectionPool();
      DatasourceConnection dc=pool.getDatasourceConnection(pc,config.getDataSource(QOQ_DATASOURCE_NAME),"sa","");
        Connection conn = dc.getConnection();
        try {
          DBUtil.setAutoCommitEL(conn,false);

            //sql.setSQLString(HSQLUtil.sqlToZQL(sql.getSQLString(),false));
View Full Code Here

TOP

Related Classes of railo.runtime.config.ConfigImpl

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.