Thanks Jason for the useful comments.
I was finally able to configure my graph properly and add a HashMap as a property value. But the problem is still not solved. When I am trying to access the value that I added, I get the following error.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Required size [1] exceeds actual remaining size [0]
For testing purposes I am doing this in Eclipse. Here is how I am adding the property value:
TitanFactory.Builder config = TitanFactory.build();
config.set("storage.backend", "cassandra");
config.set("storage.directory", "C:/XXXXXXXXX/titan-0.9.0-M2-hadoop1/db/cassandra/data/test");
TitanGraph graph = config.open();
TitanManagement mgmt = graph.openManagement();
mgmt.set("attributes.custom.attribute1.attribute-class", "java.util.HashMap");
mgmt.set("attributes.custom.attribute1.serializer-class", "com.graph.HashMapSerializer");
mgmt.commit();
graph.tx().commit();
TitanGraph graph1 = config.open();
HashMap<String,Integer> m = new HashMap<String,Integer>();
m.put("test", 45); // Tried with new Integer(45)
graph1.addVertex("map", m);
graph1.tx().commit();
GraphTraversalSource g = graph1.traversal();
Vertex v = g.V().has("map").next();
System.out.println(v);
All of the above stuff happens in the main() method. I can add the vertex and can see it being created. But when I try to retrieve it or see the value I added, I get the above mentioned error.
In the debug mode, I can see the serialization works correctly where the HashMap value is being serialized and de-serialized back again. Also, I'm able to add other vertices with primitive datatypes as property values and they work fine.
Not knowing where I am going wrong. In one of the posts where someone encountered the same error for a different reason, a solution of cleaning the database ( removing the keyspace ) and trying again was suggested. I tried that also but with no success.
Please comment on whether I'm doing anything wrong or if my approach is right. I am attaching the source of my 'HashMapSerializer' class and my Test class along with the stack trace. Please kindly take a look at them and leave any useful comments.
Lastly, I even tried this in the gremlin REPL using the tools that come along with Titan to make sure there are no cassandra or other versioning issues. But still no success.
Thanks for your time guys.