Java "Stored procedure" idea
<p>I have this rather "crazy" idea to have a "stored procedure" facility in my application. Basically, my app is data-centric and that it can access the datastore through some form of Restful interface. </p>

<p>I want to have the functionality to manipulate data (which is a <code>JSON</code> string) in many ways, like </p>

<ul>
<li>increment/decrement</li>
<li>hash/encrypt/decrypt and all sorts of stuff</li>
</ul>

<p>My initial 
implementation was to create a Java class that will do these operations. Typical.</p>

<p>However, I want to have the flexibility in doing such manipulations. That is, I can add a procedure to manipulate data on-the-fly, that is, like a 
<code>script</code> that can be selected and will process the retrieved data and then save it back 
again in the datastore.</p>

<p>For example:</p>

<pre><code>http://127.0.0.1:8888/resources?key=somekey&amp;operation=funkyops 
</code></pre>

<p><em>This will cause the server to internally fetch the Entity with such key then manipulate the data and save the Entity back to the datastore.</em></p>

<p>Retrieving and persisting logic can be hardcoded but the "stored procedure" must be 
stored in the datastore as a script or something like that and then when selected will 
be passed into some sort of processing block.</p>

<p>Here's a concrete example of what I am trying to do: <a href="https://bitbucket.org/kerbymart/whopper/src/7813a4ab917b/src/keyvalue/java/org/whopper/persistence/bend/types/HashBend.java" rel="nofollow">HashBend.java</a></p>

<p>Any ideas on how I can achieve this?</p>
