Package railo.runtime.cache

Examples of railo.runtime.cache.CacheConnection


    } catch (Throwable t) {
      return defaultValue;
   
  }
  public static CacheConnection getCacheConnection(Config config,String cacheName) throws IOException {
    CacheConnection cc= config.getCacheConnections().get(cacheName.toLowerCase().trim());
    if(cc==null) throw noCache(config,cacheName);
    return cc; 
  }
View Full Code Here


    if(cc==null) throw noCache(config,cacheName);
    return cc; 
  }

  public static CacheConnection getCacheConnection(Config config,String cacheName, CacheConnection defaultValue) {
    CacheConnection cc= config.getCacheConnections().get(cacheName.toLowerCase().trim());
    if(cc==null) return defaultValue;
    return cc; 
  }
View Full Code Here

  private void doGetCacheConnections() throws PageException  {
    Map conns = config.getCacheConnections();
    Iterator it = conns.entrySet().iterator();
    railo.runtime.type.Query qry=new QueryImpl(new String[]{"class","name","custom","default","readOnly","storage"}, 0, "connections");
        Map.Entry entry;
        CacheConnection cc;
        CacheConnection defObj=config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_OBJECT);
        CacheConnection defTmp=config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_TEMPLATE);
        CacheConnection defQry=config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_QUERY);
        CacheConnection defRes=config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_RESOURCE);
        CacheConnection defUDF=config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_FUNCTION);
        int row=0;
        String def;
    while(it.hasNext()){
      row++;
        entry=(Entry) it.next();
View Full Code Here

        else if(strType.equals("function"))
          type=ConfigImpl.CACHE_DEFAULT_FUNCTION;
        else
          throw new ApplicationException("inv,query,resourcealid type defintion, valid values are [object, template,query,resource,function]");
   
        CacheConnection cc = config.getCacheDefaultConnection(type);
        if(cc!=null){
          Struct sct=new StructImpl();
           
            sct.setEL(KeyConstants._name,cc.getName());
            sct.setEL("class",cc.getClazz().getName());
            sct.setEL("custom",cc.getCustom());
            sct.setEL("default",Caster.toBoolean(true));
            sct.setEL("readOnly",Caster.toBoolean(cc.isReadOnly()));
           
          pageContext.setVariable(getString("admin",action,"returnVariable"),sct);
        }
        else throw new ApplicationException("there is no cache default connection");
    }
View Full Code Here

  private void doGetCacheConnection() throws PageException {
       
        String name=getString("admin",action,"name");
        Map conns = config.getCacheConnections();
    Iterator it = conns.keySet().iterator();
    CacheConnection cc;
    CacheConnection dObj=config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_OBJECT);
    CacheConnection dTmp=config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_TEMPLATE);
    CacheConnection dQry=config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_QUERY);
    CacheConnection dRes=config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_RESOURCE);
    CacheConnection dUDF=config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_FUNCTION);
   
    Struct sct;
    String d;
        while(it.hasNext()) {
            String key=(String)it.next();
View Full Code Here

  protected void setCaches(Map<String,CacheConnection> caches) {
    this.caches=caches;
    Iterator<Entry<String, CacheConnection>> it = caches.entrySet().iterator();
    Entry<String, CacheConnection> entry;
    CacheConnection cc;
    while(it.hasNext()){
      entry = it.next();
      cc=entry.getValue();
      if(cc.getName().equalsIgnoreCase(cacheDefaultConnectionNameTemplate)){
        defaultCacheTemplate=cc;
      }
      else if(cc.getName().equalsIgnoreCase(cacheDefaultConnectionNameFunction)){
        defaultCacheFunction=cc;
      }
      else if(cc.getName().equalsIgnoreCase(cacheDefaultConnectionNameQuery)){
        defaultCacheQuery=cc;
      }
      else if(cc.getName().equalsIgnoreCase(cacheDefaultConnectionNameResource)){
        defaultCacheResource=cc;
      }
      else if(cc.getName().equalsIgnoreCase(cacheDefaultConnectionNameObject)){
        defaultCacheObject=cc;
      }
    }
  }
View Full Code Here

    // cache connections
    Element[] eConnections = getChildren(eCache, "connection");

    // if(hasAccess) {
    String name, clazzName;
    CacheConnection cc;
    Class cacheClazz;
    // caches
    if (hasAccess)
      for (int i = 0; i < eConnections.length; i++) {
        Element eConnection = eConnections[i];
        name = eConnection.getAttribute("name");
        clazzName = eConnection.getAttribute("class");
        if (clazzName != null)
          clazzName = clazzName.trim();

        //
        try {

          // Workaround for old EHCacheLite class defintion
          if ("railo.extension.io.cache.eh.EHCacheLite".equals(clazzName))
            cacheClazz = EHCacheLite.class;
          else
            cacheClazz = ClassUtil.loadClass(config.getClassLoader(), clazzName);

          cc = new CacheConnectionImpl(config, name, cacheClazz, toStruct(eConnection.getAttribute("custom")), Caster.toBooleanValue(
              eConnection.getAttribute("read-only"), false), Caster.toBooleanValue(eConnection.getAttribute("storage"), false));
          if (!StringUtil.isEmpty(name)) {
            caches.put(name.toLowerCase(), cc);
          }
          else
            SystemOut.print(config.getErrWriter(), "missing cache name");

        }
        catch (ClassException ce) {
          SystemOut.print(config.getErrWriter(), ExceptionUtil.getStacktrace(ce, true));
        }
        catch (IOException e) {
          SystemOut.print(config.getErrWriter(), ExceptionUtil.getStacktrace(e, true));
        }
      }
    // }

    // call static init once per driver
    {
      // group by classes
      Map _caches = new HashMap();
      Iterator it = caches.entrySet().iterator();
      Map.Entry entry;
      ArrayList list;
      while (it.hasNext()) {
        entry = (Entry) it.next();
        cc = (CacheConnection) entry.getValue();
        list = (ArrayList) _caches.get(cc.getClazz());
        if (list == null) {
          list = new ArrayList();
          _caches.put(cc.getClazz(), list);
        }
        list.add(cc);
      }

      // call
View Full Code Here

  }

  private static Struct[] _toArguments(ArrayList list) {
    Iterator it = list.iterator();
    Struct[] args = new Struct[list.size()];
    CacheConnection cc;
    int index = 0;
    while (it.hasNext()) {
      cc = (CacheConnection) it.next();
      args[index++] = cc.getCustom();
    }
    return args;
  }
View Full Code Here

  }

  private static String[] _toCacheNames(ArrayList list) {
    Iterator it = list.iterator();
    String[] names = new String[list.size()];
    CacheConnection cc;
    int index = 0;
    while (it.hasNext()) {
      cc = (CacheConnection) it.next();
      names[index++] = cc.getName();
    }
    return names;
  }
View Full Code Here

          if(client==null){
            // datasource not enabled for storage
            if(ds!=null)
              throw new ApplicationException("datasource ["+storage+"] is not enabled to be used as session/client storage, you have to enable it in the railo administrator.");
           
            CacheConnection cc = Util.getCacheConnection(pc.getConfig(),storage,null);
            if(cc!=null)
              throw new ApplicationException("cache ["+storage+"] is not enabled to be used  as a session/client storage, you have to enable it in the railo administrator.");
           
            throw new ApplicationException("there is no cache or datasource with name ["+storage+"] defined.");
          }
View Full Code Here

TOP

Related Classes of railo.runtime.cache.CacheConnection

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.