PageRenderTime 34ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/src/org/fraught/neo4j/neo4j.cfc

http://github.com/bpanulla/cf_neo4j
ColdFusion CFScript | 68 lines | 44 code | 24 blank | 0 comment | 0 complexity | 9d0600f82e1fc4c71f91167c94ac8511 MD5 | raw file
  1. <cfcomponent output="false" displayname="Neo4J Graph Database FaŤade" hint="Provides simplified access to a Neo4j Graph Database to ColdFusion applications">
  2. <!--- Private properties --->
  3. <cfset variables.graphDb = CreateObject('java',"org.neo4j.kernel.EmbeddedGraphDatabase") />
  4. <cfset variables.relationshipTemplate = CreateObject("java", "org.neo4j.graphdb.DynamicRelationshipType")>
  5. <!--- Public methods --->
  6. <cffunction name="isInitialized" access="public" output="false" returntype="Boolean" hint="Tell if graph database connection has been initialized.">
  7. <cfset var status = true />
  8. <cfset var pathTest = "" />
  9. <cftry>
  10. <cfset pathTest = getPath() />
  11. <cfcatch type="any">
  12. <cfset status = false />
  13. </cfcatch>
  14. </cftry>
  15. <cfreturn status />
  16. </cffunction>
  17. <cffunction name="initialize" access="public" output="false" returntype="Any">
  18. <cfargument name="path" type="string" required="false" />
  19. <cfset var status = true />
  20. <cftry>
  21. <cfset variables.graphDb.init(arguments.path) />
  22. <cfcatch type="any">
  23. <cfset status = false />
  24. </cfcatch>
  25. </cftry>
  26. <cfreturn this />
  27. </cffunction>
  28. <cffunction name="getPath" access="public" output="false" returntype="string">
  29. <cfreturn graphDb.getStoreDir() />
  30. </cffunction>
  31. <cffunction name="createNode" access="public" output="false" returntype="any">
  32. <cfreturn graphDb.createNode() />
  33. </cffunction>
  34. <cffunction name="beginTx" access="public" output="false" returntype="any">
  35. <cfreturn graphDb.beginTx() />
  36. </cffunction>
  37. <cffunction name="getRelationship" access="public" output="false" returntype="any">
  38. <cfargument name="relName" type="string" required="true">
  39. <cfreturn variables.relationshipTemplate.withName( arguments.relName ) />
  40. </cffunction>
  41. <cffunction name="shutdown" access="public" output="false" returntype="any">
  42. <cfreturn graphDb.shutdown() />
  43. </cffunction>
  44. </cfcomponent>