[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo/util ...

Ben Wang bwang at jboss.com
Tue Sep 5 02:11:26 EDT 2006


  User: bwang   
  Date: 06/09/05 02:11:26

  Added:       src-50/org/jboss/cache/pojo/util  CacheApiUtil.java
  Log:
  First cuto of the using 2.0 Cache API
  
  Revision  Changes    Path
  1.1      date: 2006/09/05 06:11:25;  author: bwang;  state: Exp;JBossCache/src-50/org/jboss/cache/pojo/util/CacheApiUtil.java
  
  Index: CacheApiUtil.java
  ===================================================================
  /*
   * JBoss, Home of Professional Open Source
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package org.jboss.cache.pojo.util;
  
  import org.jboss.cache.DataNode;
  import org.jboss.cache.CacheSPI;
  import org.jboss.cache.Fqn;
  import org.jboss.cache.Node;
  
  import java.util.Map;
  
  /** Utility for the 2.0 Cache API
   *
   * @author Ben Wang
   * @version $Id: CacheApiUtil.java,v 1.1 2006/09/05 06:11:25 bwang Exp $
   */
  public class CacheApiUtil
  {
     public static Node getDataNode(CacheSPI cache, Fqn fqn)
     {
  //      cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(true);
        Node node = cache.getRoot().getChild(fqn);
        if(node == null) return null;
  
  //      cache.getInvocationContext().getOptionOverrides().setBypassInterceptorChain(false);
        return node;
     }
  
     public static boolean exists(CacheSPI cache, Fqn fqn, Object key)
     {
        Node node = cache.getRoot().getChild(fqn);
        if(node == null) return false;
        Map map = node.getData();
        return (map.values().contains(key)) ? true: false;
     }
  }
  
  
  



More information about the jboss-cvs-commits mailing list