The GraphFactory
interface we defined earlier creates a TinkerPop Graph implementation, where a Map
object represents a Storm configuration. The following code illustrates how to create TitanGraph
backed by Cassandra:
TitanGraphFactory.java public class TitanGraphFactory implements GraphFactory { public static final String STORAGE_BACKEND = "titan.storage.backend"; public static final String STORAGE_HOSTNAME = "titan.storage.hostname"; public Graph makeGraph(Map conf) { Configuration graphConf = new BaseConfiguration(); graphConf.setProperty("storage.backend", conf.get(STORAGE_BACKEND)); graphConf.setProperty("storage.hostname", conf.get(STORAGE_HOSTNAME)); return TitanFactory.open(graphConf); } }