Skip to content

Commit

Permalink
Reverted API change
Browse files Browse the repository at this point in the history
  • Loading branch information
systay committed Jan 18, 2012
1 parent cc596cc commit 09bd6f5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Expand Up @@ -37,7 +37,7 @@ public class ExecutionEngine
* Creates an execution engine around the give graph database
* @param database The database to wrap
*/
public ExecutionEngine( AbstractGraphDatabase database )
public ExecutionEngine( GraphDatabaseService database )
{
inner = new org.neo4j.cypher.ExecutionEngine( database );
}
Expand Down
16 changes: 12 additions & 4 deletions cypher/src/main/scala/org/neo4j/cypher/ExecutionEngine.scala
Expand Up @@ -26,19 +26,27 @@ import java.lang.Error
import java.util.{Map => JavaMap}
import scala.deprecated
import org.neo4j.kernel.AbstractGraphDatabase
import org.neo4j.graphdb.GraphDatabaseService

class ExecutionEngine(graph: AbstractGraphDatabase) {
class ExecutionEngine(graph: GraphDatabaseService) {
checkScalaVersion()

require(graph != null, "Can't work with a null graph database")

val parser = createCorrectParser()

def createCorrectParser() = graph.getConfig.getParams.asScala.get("cypher_parser_version") match {
case None => new CypherParser()
case Some(v) => new CypherParser(v.toString)
def createCorrectParser() = if (graph.isInstanceOf[AbstractGraphDatabase]) {
val database = graph.asInstanceOf[AbstractGraphDatabase]
database.getConfig.getParams.asScala.get("cypher_parser_version") match {
case None => new CypherParser()
case Some(v) => new CypherParser(v.toString)
}
}
else {
new CypherParser()
}


@throws(classOf[SyntaxException])
def execute(query: String): ExecutionResult = execute(query, Map[String, Any]())

Expand Down

0 comments on commit 09bd6f5

Please sign in to comment.