Created
January 22, 2016 22:06
-
-
Save zeryx/dda25e7a5e95ff28187a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object TitanCon extends InMemory with InCassandra{ | |
lazy var Graph: TitanGraph | |
def connect(backendType: String): Unit = { | |
Graph = backendType match { | |
case "inMemory" => memoryConnect() | |
case "inCassandra" => cassandraConnect() | |
} | |
} | |
} | |
trait InMemory { | |
def memoryConnect(): TitanGraph = { | |
val conf = new BaseConfiguration() | |
conf.setProperty("storage.backend","inmemory") | |
TitanFactory.open(conf) | |
} | |
} | |
trait InCassandra { | |
def cassandraConnect(): TitanGraph = { | |
TitanFactory.open("titan-cassandra.properties") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment