I would not use a Runtime shutdown hook from within Tomcat. I would use a ServletContextListener (override the contextInitialized and contextDestroyed events), and create singletons for the GraphDatabaseService/LuceneIndex when the webapp initializes, and shut them down when the webapp is destroyed. You can only have a single instance of the GraphDatabaseService active at a time.
Those changes should get you working. Rick -------- Original Message -------- Subject: Re: [Neo] Connecting to Neo4j DB from ActionScript From: Amir Hossein Jadidinejad <amir.jad...@yahoo.com> Date: Sat, April 10, 2010 2:48 pm To: Neo user discussions <user@lists.neo4j.org> Cc: rick.bullo...@burningskysoftware.com Hi, After a lot of try/miss attempts, finally I've created both the server and client sides. I have some problems: 1. I don't know how to manage shutting down stuffs (GraphDatabaseService and IndexService) in the client side. 2. When I run the flex page for the first time (after restarting the Tomcat), everything is ok. But when I run it again or refresh the page, I have a "Error: An unknown exception occurred while creating an instance of type 'wikipedia.wnng.Connector'." -> It maybe related to the first item! 3. The source codes are attached, would you please review them or share some codes that I can solve the problem? Kind regards, Amir --- On Sat, 3/13/10, Rick Bullotta <rick.bullo...@burningskysoftware.com> wrote: From: Rick Bullotta <rick.bullo...@burningskysoftware.com> Subject: Re: [Neo] Connecting to Neo4j DB from ActionScript To: "'Neo user discussions'" <user@lists.neo4j.org> Date: Saturday, March 13, 2010, 9:57 AM Hi, Amir. Most of what we're doing is fairly specific to our domain model (each node has a type and a name property) and technology landscape (WebORB backend, for example), but there are some guidelines I can share with you to help. 1) You'll want to create a viewer based on ExtendedFlexGraph, which brings with it a lot of very useful filtering/searching/layout capabilities that the base FlexGraph class does not have 2) You'll want to create a custom node renderer and a custom arc (relationship) renderer. We overrode the newInstance(), set data, and addToolTipValues() methods to allow us to display Neo node and relationship properties in the mouse-over event, and to provide custom text to display on each node/relationship. The Neo relationship model fits nicely with Flexviz in that an "arc" in Flexviz has a type that corresponds to the "RelationshipType" in neo. The Neo node model also fits reasonably well, with the concept of an "id" (arcs have id's also). 3) You'll need a back-end service (servlet or other) to get data to your Flex front end. We're using WebORB, which allows a high performance bridge to the Flex app using Flex remoting (and a binary protocol), but you could do the same thing with a Flex HTTPService and by outputting XML from a servlet, perhaps in some variant of GraphML. In the handler for a response for the server, you'll then want to parse the result and create the graph model inside Flexviz. Here's the code we use (realize that our result structure is a "native" object, but the same approach could be used with XML). neoModel = response.result as ArrayCollection; graph.nodeRenderer = new NeoNodeRenderer(); graph.arcRenderer = new NeoRelationshipRenderer(); model = new DefaultGraphModel(); var node:Object; var edge:Object; for each(node in neoModel) { var graphNode:DefaultGraphNode = new DefaultGraphNode(node.id, node.type, node.name, node); model.addNode(graphNode); } for each(node in neoModel) { for each(edge in node.edges) { var fromItem: IGraphNode = model.getNode(edge.fromNode); var toItem: IGraphNode = model.getNode(edge.toNode); var arc:DefaultGraphArc = new DefaultGraphArc(edge.id, fromItem, toItem, edge.type, edge, false, true); model.addArc(arc); } } graph.model = model; var layout:ILayoutAlgorithm = new RadialLayoutAlgorithm(); graph.runLayout(layout); 4) On the server side, we created a class that handles client requests, with a single parameter corresponding to the "root" node of the request. In our case, we don't want to display the entire Neo4J graph - only nodes one relationship away from a specified node (similar to Neoclipse's default behavior) 5) On the client, we created a double click handler for the graph so that double-clicking a node reinvokes the service with a new "root" node and redisplays the graph. It is easy to implement a "go back" function by keeping track of the previous root node id's in a stack. Hope that helps! Rick -----Original Message----- From: [1]user-boun...@lists.neo4j.org [mailto:[2]user-boun...@lists.neo4j.org] On Behalf Of Amir Hossein Jadidinejad Sent: Saturday, March 13, 2010 12:04 AM To: Neo user discussions Subject: Re: [Neo] Connecting to Neo4j DB from ActionScript Dear Rick, It's really interesting. Would you please share your experiments with us?, Some example, source code,... Greatly appreciate your help. Kind regards, Amir --- On Fri, 3/12/10, Rick Bullotta <[3]rick.bullo...@burningskysoftware.com> wrote: From: Rick Bullotta <[4]rick.bullo...@burningskysoftware.com> Subject: Re: [Neo] Connecting to Neo4j DB from ActionScript To: "'Neo user discussions'" <[5]u...@lists.neo4j.org> Date: Friday, March 12, 2010, 6:27 PM Amir, I'm doing something similar (also with Flexviz). I looked at a number of other Flex graph visualization libraries (Kapit, SpringGraph, YFiles, Raviz/Birdeye, Flare) and definitely preferred Flexviz to the others. It seems quite extensible/customizable as well. I'm using Flex/Flash remoting between the server and the client, and on the server side, I'm using WebORB Java. Rick -----Original Message----- From: [6]user-boun...@lists.neo4j.org [mailto:[7]user-boun...@lists.neo4j.org] On Behalf Of Amir Hossein Jadidinejad Sent: Friday, March 12, 2010 5:10 PM To: Neo user discussions Subject: Re: [Neo] Connecting to Neo4j DB from ActionScript Dear Todd, I'm not familiar with them. Would you please provide me a simple how-to or some source code example? In fact, I'm going to visualise the Neo4j DB using FlexViz. It's really beautiful and flexible. Thanks. Amir --- On Fri, 3/12/10, Todd Stavish <[8]toddstav...@gmail.com> wrote: From: Todd Stavish <[9]toddstav...@gmail.com> Subject: Re: [Neo] Connecting to Neo4j DB from ActionScript To: "Neo user discussions" <[10]u...@lists.neo4j.org> Date: Friday, March 12, 2010, 4:43 PM Hi Amir, I used GSON (google's json package) on the Neo side and Flex's json AS3 classes to make the connection. -Todd On Fri, Mar 12, 2010 at 4:31 PM, Amir Hossein Jadidinejad <[11]amir.jad...@yahoo.com> wrote: > Hi, > Is it possible to connect a Neo4j instance using ActionScript and Adobe Flex?! > Thanks. > > > > > _______________________________________________ > Neo mailing list > [12]u...@lists.neo4j.org > [13]https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo mailing list [14]u...@lists.neo4j.org [15]https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo mailing list [16]u...@lists.neo4j.org [17]https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo mailing list [18]u...@lists.neo4j.org [19]https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo mailing list [20]u...@lists.neo4j.org [21]https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo mailing list [22]u...@lists.neo4j.org [23]https://lists.neo4j.org/mailman/listinfo/user References 1. http://email02.secureserver.net/mc/compose?to=user-boun...@lists.neo4j.org 2. http://email02.secureserver.net/mc/compose?to=user-boun...@lists.neo4j.org 3. http://email02.secureserver.net/mc/compose?to=rick.bullo...@burningskysoftware.com 4. http://email02.secureserver.net/mc/compose?to=rick.bullo...@burningskysoftware.com 5. http://email02.secureserver.net/mc/compose?to=u...@lists.neo4j.org 6. http://email02.secureserver.net/mc/compose?to=user-boun...@lists.neo4j.org 7. http://email02.secureserver.net/mc/compose?to=user-boun...@lists.neo4j.org 8. http://email02.secureserver.net/mc/compose?to=toddstav...@gmail.com 9. http://email02.secureserver.net/mc/compose?to=toddstav...@gmail.com 10. http://email02.secureserver.net/mc/compose?to=u...@lists.neo4j.org 11. http://email02.secureserver.net/mc/compose?to=amir.jad...@yahoo.com 12. http://email02.secureserver.net/mc/compose?to=u...@lists.neo4j.org 13. https://lists.neo4j.org/mailman/listinfo/user 14. http://email02.secureserver.net/mc/compose?to=u...@lists.neo4j.org 15. https://lists.neo4j.org/mailman/listinfo/user 16. http://email02.secureserver.net/mc/compose?to=u...@lists.neo4j.org 17. https://lists.neo4j.org/mailman/listinfo/user 18. http://email02.secureserver.net/mc/compose?to=u...@lists.neo4j.org 19. https://lists.neo4j.org/mailman/listinfo/user 20. http://email02.secureserver.net/mc/compose?to=u...@lists.neo4j.org 21. https://lists.neo4j.org/mailman/listinfo/user 22. http://email02.secureserver.net/mc/compose?to=u...@lists.neo4j.org 23. https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user