Package org.jboss.cache

Examples of org.jboss.cache.Modification


    * Stores the entire state.
    * This is processed asynchronously.
    */
   public void storeEntireState(byte[] state) throws Exception
   {
      Modification mod = new Modification(Modification.STORE_STATE, null, null, state);
      enqueue(mod);
   }
View Full Code Here


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

         {
            mods.addAll((List)o);
         }
         else
         {
            Modification mod = (Modification)o;
            if (mod.getType() == Modification.STORE_STATE)
            {
               log.trace("storeState");
               storeState(mod.getFqn(), (byte [])mod.getValue());
            }
            else
            {
               mods.add(mod);
            }
View Full Code Here

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

      checkOpen();
      checkNonNull(name, "name");

      Object oldVal;
      if (transactional) {
         Modification mod =
            new Modification(Modification.PUT_KEY_VALUE, name, key, value);
         commitModification(mod);
         oldVal = mod.getOldValue();
      } else {
         oldVal = doPut(null, name, key, value);
      }
      return oldVal;
   }
View Full Code Here

      checkOpen();
      checkNonNull(name, "name");

      if (transactional) {
         commitModification(
            new Modification(Modification.PUT_DATA, name, values));
      } else {
         doPut(null, name, values);
      }
   }
View Full Code Here

      /* This could be optimized by grouping modifications by Fqn, and
       * performing a single database operation for each Fqn (record). */

      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 = doPut(txn, name, mod.getKey(), mod.getValue());
               mod.setOldValue(oldVal);
               break;
            case Modification.PUT_DATA:
               doPut(txn, name, mod.getData());
               break;
            case Modification.PUT_DATA_ERASE:
               doPutErase(txn, name, mod.getData());
               break;
            case Modification.REMOVE_KEY_VALUE:
               oldVal = doRemove(txn, name, mod.getKey());
               mod.setOldValue(oldVal);
               break;
            case Modification.REMOVE_NODE:
               doRemove(txn, name);
               break;
            case Modification.REMOVE_DATA:
               doRemoveData(txn, name);
               break;
            default:
               throw new IllegalArgumentException(
                     "Unknown Modification type: " + mod.getType());
         }
      }
   }
View Full Code Here

      checkOpen();
      checkNonNull(name, "name");

      if (transactional) {
         commitModification(
            new Modification(Modification.REMOVE_NODE, name));
      } else {
         doRemove(null, name);
      }
   }
View Full Code Here

      checkOpen();
      checkNonNull(name, "name");

      Object oldVal;
      if (transactional) {
         Modification mod =
            new Modification(Modification.REMOVE_KEY_VALUE, name, key);
         commitModification(mod);
         oldVal = mod.getOldValue();
      } else {
         oldVal = doRemove(null, name, key);
      }
      return oldVal;
   }
View Full Code Here

      checkOpen();
      checkNonNull(name, "name");

      if (transactional) {
         commitModification(
            new Modification(Modification.REMOVE_DATA, name));
      } else {
         doRemoveData(null, name);
      }
   }
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.