We added PATCH semantics for Virgil.

This was fairly straight forward, except we need to add support for a @PATCH annotation and PatchMethod for HttpClient.


To do this, we created a PATCH annotation. Take a look at PATCH.java. The contents of which are shown below:
@Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME)
public @interface PATCH {
This then allows us to use @PATCH on an annotation on a REST service.
@Produces({ "application/json" })
public void patchRow(@PathParam("keyspace") String keyspace,
@PathParam("columnFamily") String columnFamily, @PathParam("key") String key,
@QueryParam("index") boolean index, String body) throws Exception
That worked like a charm. Then we needed to call it using HttpClient. To that, we created a PatchMethod class that extended PostMethod.  See below:

public class PatchMethod extends PostMethod {

        public PatchMethod(String url){                 super(url);         }         @Override         public String getName() {                 return "PATCH";         } }
Then we could use that just like any other HTTP method within HTTP client.
PatchMethod patch = new PatchMethod(BASE_URL + KEYSPACE + "/" + COLUMN_FAMILY + "/" + KEY);
requestEntity = new StringRequestEntity("{\"ADDR1\":\"1235 Fun St.\",\"COUNTY\":\"Montgomery\"}",
"appication/json", "UTF8");