Package org.jboss.cache

Examples of org.jboss.cache.Modification


   public void put(List modifications) throws Exception
   {
      for(int i = 0; i < modifications.size(); ++i)
      {
         Modification m = (Modification) modifications.get(i);
         switch(m.getType())
         {
            case Modification.PUT_DATA:
               put(m.getFqn(), m.getData());
               break;
            case Modification.PUT_DATA_ERASE:
               put(m.getFqn(), m.getData(), true);
               break;
            case Modification.PUT_KEY_VALUE:
               put(m.getFqn(), m.getKey(), m.getValue());
               break;
            case Modification.REMOVE_DATA:
               removeData(m.getFqn());
               break;
            case Modification.REMOVE_KEY_VALUE:
               remove(m.getFqn(), m.getKey());
               break;
            case Modification.REMOVE_NODE:
               remove(m.getFqn());
               break;
            default:
               throw new IllegalStateException("Unexpected modification code: " + m.getType());
         }
      }
   }
View Full Code Here


      delegate.put(name, attributes);
   }

   protected void delegatePut(List modifications) throws Exception {
      for(Iterator it=modifications.iterator(); it.hasNext();) {
         Modification m=(Modification)it.next();
         switch(m.getType()) {
            case Modification.PUT_DATA:
               put(m.getFqn(), m.getData());
               break;
            case Modification.PUT_DATA_ERASE:
               put(m.getFqn(), m.getData(), true);
               break;
            case Modification.PUT_KEY_VALUE:
               put(m.getFqn(), m.getKey(), m.getValue());
               break;
            case Modification.REMOVE_DATA:
               removeData(m.getFqn());
               break;
            case Modification.REMOVE_KEY_VALUE:
               remove(m.getFqn(), m.getKey());
               break;
            case Modification.REMOVE_NODE:
               remove(m.getFqn());
               break;
            default:
               log.error("modification type " + m.getType() + " not known");
               break;
         }
      }
   }
View Full Code Here

      this.cache.put(name, attributes);
   }

   public void put(List modifications) throws Exception, RemoteException {
      for(Iterator it=modifications.iterator(); it.hasNext();) {
         Modification m=(Modification)it.next();
         switch(m.getType()) {
            case Modification.PUT_DATA:
            case Modification.PUT_DATA_ERASE:
               cache.put(m.getFqn(), m.getData());
               break;
            case Modification.PUT_KEY_VALUE:
               cache.put(m.getFqn(), m.getKey(), m.getValue());
               break;
            case Modification.REMOVE_DATA:
               cache.removeData(m.getFqn());
               break;
            case Modification.REMOVE_KEY_VALUE:
               cache.remove(m.getFqn(), m.getKey());
               break;
            case Modification.REMOVE_NODE:
               cache.remove(m.getFqn());
               break;
            default:
               System.err.println("modification type " + m.getType() + " not known");
               break;
         }
      }

   }
View Full Code Here

   private void apply(List modifications)
      throws Exception
   {
      for (Iterator i = modifications.iterator(); i.hasNext();) {
         Modification mod = (Modification) i.next();
         Fqn name = mod.getFqn();
         Object oldVal;
         switch (mod.getType()) {
            case Modification.PUT_KEY_VALUE:
               oldVal = put0(name, mod.getKey(), mod.getValue());
               mod.setOldValue(oldVal);
               break;
            case Modification.PUT_DATA:
               put0(name, mod.getData());
               break;
            case Modification.PUT_DATA_ERASE:
               erase0(name);
               put0(name, mod.getData());
               break;
            case Modification.REMOVE_KEY_VALUE:
               oldVal = eraseKey0(name, mod.getKey());
               mod.setOldValue(oldVal);
               break;
            case Modification.REMOVE_NODE:
               erase0(name);
               break;
            case Modification.REMOVE_DATA:
               erase0(name, false);
               break;
            default:
               throw new IllegalArgumentException(
                     "Unknown Modification type: " + mod.getType());
         }
      }
   }
View Full Code Here

      if (log.isDebugEnabled()) log.debug("Did a put on " + name + ", data is " + n.data);
   }

   public void put(List modifications) throws Exception
   {
      Modification m;
      for(Iterator it = modifications.iterator(); it.hasNext();)
      {
         m = (Modification)it.next();
         switch (m.getType())
         {
            case Modification.PUT_DATA:
               put(m.getFqn(), m.getData());
               break;
            case Modification.PUT_DATA_ERASE:
               removeData(m.getFqn());
               put(m.getFqn(), m.getData());
               break;
            case Modification.PUT_KEY_VALUE:
               put(m.getFqn(), m.getKey(), m.getValue());
               break;
            case Modification.REMOVE_DATA:
               removeData(m.getFqn());
               break;
            case Modification.REMOVE_KEY_VALUE:
               remove(m.getFqn(), m.getKey());
               break;
            case Modification.REMOVE_NODE:
               remove(m.getFqn());
               break;
            default:
               throw new CacheException("Unknown modificatiobn " + m.getType());
         }
      }
   }
View Full Code Here

         else
         {
            fqn = nd.getFqn();
         }
         if (trace) log.trace("Storing state in Fqn " + fqn);
         mod.add(new Modification(ModificationType.PUT_DATA_ERASE, fqn, nd.getAttributes()));
      }
      prepare(null, mod, true);
   }
View Full Code Here

                  case TcpCacheOperations.PUT_LIST:
                     int length = input.readInt();
                     retval = Boolean.TRUE;
                     if (length > 0)
                     {
                        Modification mod;
                        List<Modification> mods = new ArrayList<Modification>(length);
                        for (int i = 0; i < length; i++)
                        {
                           mod = new Modification();
                           mod.readExternal(input);
                           mods.add(mod);
                        }
                        try
                        {
                           handleModifications(mods);
View Full Code Here

   public Object put(Fqn name, Object key, Object value) throws Exception
   {
      if (config.getUseAsyncPut())
      {
         Object oldValue = get(name, key);
         Modification mod = new Modification(Modification.ModificationType.PUT_KEY_VALUE, name, key, value);
         enqueue(mod);
         return oldValue;
      }
      else
      {
View Full Code Here

   {
      if (config.getUseAsyncPut())
      {
         // JBCACHE-769 -- make a defensive copy
         Map attrs = (attributes == null ? null : Immutables.immutableMapCopy(attributes));
         Modification mod = new Modification(Modification.ModificationType.PUT_DATA, name, attrs);
         enqueue(mod);
      }
      else
      {
         super.put(name, attributes); // Let delegate make its own defensive copy
View Full Code Here

   @Override
   public Object remove(Fqn name, Object key) throws Exception
   {
      Object oldValue = get(name, key);
      Modification mod = new Modification(Modification.ModificationType.REMOVE_KEY_VALUE, name, key);
      enqueue(mod);
      return oldValue;
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.Modification

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.