Technical ideas: implementing collaboration in Freeplane, with Flower Platform

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Technical ideas: implementing collaboration in Freeplane, with Flower Platform

plewin
Hello Liam,

It looks like I'm working on a prototype with approximately the same specs.

My architecture is
 - N Freeplane clients + 2/3 init scripts
 - RabbitMQ
 - Spring boot + freeplane headless + Neo4j

The freeplane init scripts I use :
 - 1x Register a map listener to publish all events on a rabbitmq bus.
 - 1x Register a subscriber to a rabbitmq bus, it receives update messages and update the map in the freeplane.

Realtime collaboration works in freeplane. I could have several freeplane instances working in the same map and editing and seeing the changes in real time, even undo is working (limitation: security and no support of changes of styles or node positions. Only the content gets synchronized).

But the mind map must be opened in the exact same time/state. In order to do this, I'm working now on a webserver that will generate mind maps based on the current state of the map in neo4j. I'm using the freeplane jars (copied from the desktop app) in a spring boot application to generate mm files. I'm using the FreeplaneHeadlessStarter class from the jars with 2 little hacks to make it work (touch resources/xml/preferences.xml + replace default HeadlessMapViewController with one that doesn't generate an exception on getMapSelection) to make the MFileManager to generate the xml files.

When I will have all the pieces together, I plan to prototype a third script that will detect if the map is a collaborated map or not depending on the URL. If the map is opened with "Open map from URL" and the URL contains a configurated "map collaboration server" it will automatically switch in collaboration mode with no save button and all modifications pushed to the collaboration server.

I will share my experience with this project when I will get something demoable. meanwhile, I will be happy to read about your progress in this subject.

Best regards,
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Technical ideas: implementing collaboration in Freeplane, with Flower Platform

Dimitry Polivaev
Administrator
Hello Philippe,

I would like to know more about your approach.

1. Have I got it right that you use Freeplane not only on the server side but also as a client? If I am wrong, what clients do you use?

2. When and how you save Freeplane to neo4j. Generating a completely new xml content on each change seems to be expansive and ineffective, so you probably need to generate only parts. How do handle it?

3. How do you resolve conflicts which could occur if different user change the same value?

4. How do you serialize and deserialize the events?

5. May I have a look at your code?

Best regards,
Dimitry

> My architecture is - N Freeplane clients + 2/3 init scripts -
> RabbitMQ - Spring boot + freeplane headless + Neo4j
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Technical ideas: implementing collaboration in Freeplane, with Flower Platform

plewin

Hello Dimitry, 

1. Have I got it right that you use Freeplane not only on the server side but also as a client? If I am wrong, what clients do you use?
I use the standard freeplane desktop application from https://sourceforge.net/projects/freeplane/ version 1.5.18 as client
On the server side I use the jar librairies I obtained from the dekstop client, in the core\org.freeplane.core\lib directory. It was the easiest way I found to reuse code from freeplane in my spring boot application.  

2. When and how you save Freeplane to neo4j. Generating a completely new xml content on each change seems to be expansive and ineffective, so you probably need to generate only parts. How do handle it?
The server does handle .mm files and does not manage xml files. Neo4j doesn't know it handles freeplane maps. It is agnostic but offer export in .mm.
The only time I generate a XML file is when a freeplane client does "Open map from URL".
Freeplane make a http request to http://mapserver/root.mm for example, the spring boot application gets the request and generates on the fly a xml file. It is not saved on the server nor by the freeplane client.
Changes to the map are pushed as events in rabbitmq. 

3. How do you resolve conflicts which could occur if different user change the same value?
I do not support this. Last update wins. I thought about how to implement it but I don't want to complexify my prototype.
Actually, I want the realtime collaboration feature for a different use case than discussed earlier in this thread. In my use case, I am the only freeplane user, my collaborators are bots making modifying my mind maps in real time and they work on nodes I don't edit or if they do, in reaction to my modifications. 

4. How do you serialize and deserialize the events?
Events are serialized and deserialized using groovy's json classes.
Messages are constructed for each AMapChangeListenerAdapter's events where instances are replaced by IDs. Example of message : {event: "node_changed", property: "node_text", node: "ID_XXX", oldValue: "old", newValue: "new"} (my prototype currently only support one map)
For deserialization, messages are translated into org.freeplane.core.undo.IActor. 

5. May I have a look at your code?
It is in WIP but here some code to illustrate
Script to publish messages
Script to receive messages
How I generate mm files

Best regards 

Best regards,
Dimitry

> My architecture is - N Freeplane clients + 2/3 init scripts -
> RabbitMQ - Spring boot + freeplane headless + Neo4j



To unsubscribe from Technical ideas: implementing collaboration in Freeplane, with Flower Platform, click here.
NAML

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Technical ideas: implementing collaboration in Freeplane, with Flower Platform

Dimitry Polivaev
Administrator
Lovely!

Which node content do you support / want to support in the future?
Are you going to open source it?
Do you need anything in Freeplane to change?

Best regards,
Dimitry

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Technical ideas: implementing collaboration in Freeplane, with Flower Platform

plewin

Which node content do you support / want to support in the future?
It is too early, I can't answer these questions yet because I still have a lot to evaluate.
Are you going to open source it?
Not the dirty prototype of my feasibility study but if I develop a viable version, yes.
Do you need anything in Freeplane to change?
Too early to say. I will share my experience in a new thread when my mvp will be done.
 
Best regards,
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Technical ideas: implementing collaboration in Freeplane, with Flower Platform

Dimitry Polivaev
Administrator
Thank you very much for sharing your ideas and prototypes. I would like to encourage you to share your work in progress and to open it to contributions even at its early stages, but if you feel better working alone I can understand it too.

I am looking forward to see your work finished or to contribute to it.

Best regards,
Dimitry


>
>     Which node content do you support / want to support in the future?
>
> It is too early, I can't answer these questions yet because I still have a lot to evaluate.
>
>     Are you going to open source it?
>
> Not the dirty prototype of my feasibility study but if I develop a viable version, yes.
>
>     Do you need anything in Freeplane to change?
>
> Too early to say. I will share my experience in a new thread when my mvp will be done.
>
> Best regards,
>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> If you reply to this email, your message will be added to the discussion below:
> http://freeplane-developer.996965.n3.nabble.com/Technical-ideas-implementing-collaboration-in-Freeplane-with-Flower-Platform-tp384p1000.html
> To start a new topic under Freeplane Developer, email [hidden email]
> To unsubscribe from Freeplane Developer, click here <
> NAML <
http://freeplane-developer.996965.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Technical ideas: implementing collaboration in Freeplane, with Flower Platform

plewin
Hello Dimitry,

May I ask you for your advice on how I should share my work in progress and ideas ?

I believe I should create github repositories and call for contributions only when I will have documented answers to
 - why this project (what exactly I want to achieve, the problem I am solving)
 - how I plan to do it (draft roadmap, draft architecture, which license) // missing point i'm working on
 - what is this project (descriptions of features, and what this project is not)

Then, I was thinking about opening a discussion in the freeplane discussion forum with a video demo of the prototype. 

I am not confortable sharing code at this stage, I write and throw dirty undocumented code or librairies at high frequency at the moment.
I just got a working prototype but I am throwing the rabbitmq bus because I got a better idea : I'm going to script freeplane to connect to a websocket on the server of remote mind map instead of rabbitmq.
When opening a map with url "http://theserver/maps/mymap.mm", freeplane will open a websocket on ws://theserver to subscribe for changes and push updates. The stable minimum viable product will be less complex, it solves possible firewall problems when working on public networks, and the websocket will be available for updating a live web preview of the mind map hosted in the server.

Best regards,

On Sat, Feb 18, 2017 at 4:45 PM Dimitry Polivaev [via Freeplane Developer] <[hidden email]> wrote:
Thank you very much for sharing your ideas and prototypes. I would like to encourage you to share your work in progress and to open it to contributions even at its early stages, but if you feel better working alone I can understand it too.

I am looking forward to see your work finished or to contribute to it.

Best regards,
Dimitry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Technical ideas: implementing collaboration in Freeplane, with Flower Platform

Dimitry Polivaev
Administrator
Hello Philippe,

> May I ask you for your advice on how I should share my work in
> progress and ideas ?

Just as much as you like so that you always feel comfortable.
>
> I believe I should create github repositories and call for
> contributions only when I will have documented answers to - why this
> project (what exactly I want to achieve, the problem I am solving) -
> how I plan to do it (draft roadmap, draft architecture, which
> license) // missing point i'm working on - what is this project
> (descriptions of features, and what this project is not)
> Then, I was thinking about opening a discussion in the freeplane
> discussion forum with a video demo of the prototype.

If you prefer to find all answers on your own it is the right way.

If you want to get other opinions and let others give you ideas you can let people know what you think and what you try even if it far from being the final version.

For example I want to share with you one idea. I do not care if you want to use it or not. I just do not know if it is a good one. As I was thinking about how to synchronize two freeplane instances some years ago I thought that is does not require a special kind of nodeChanged  - Event for each kind of change. You can also transmit the whole node content (without children) or a diff so that the event subscriber can reconstruct the content and use the classes freeplane uses to save maps / nodes to xml and to read them. You could later move serializing / building diff / merging  to worker threads if it appears to be necessary. Freeplane itself almost never uses worker threads to be honest.

So whoever comes with suggestions you have the power to decide.
You have the power to share your progress and your code and to keep it hidden.
 

> I am not confortable sharing code at this stage, I write and throw
> dirty undocumented code or librairies at high frequency at the
> moment. I just got a working prototype but I am throwing the rabbitmq
> bus because I got a better idea : I'm going to script freeplane to
> connect to a websocket on the server of remote mind map instead of
> rabbitmq. When opening a map with url "http://theserver/maps/mymap.mm
> <http://server/maps/mymap.mm>", freeplane will open a websocket on
> ws://theserver to subscribe for changes and push updates. The stable
> minimum viable product will be less complex, it solves possible
> firewall problems when working on public networks, and the websocket
> will be available for updating a live web preview of the mind map
> hosted in the server.

I wish you have fun with it.

Currently freeplane can load maps from http and https web locations, and it does not assume collaboration.
What do you think about letting the server tell the client its collaboration url (e.g. ws://theserver/maps/mymap.mm/collaborate) as a xml attribute of the top level element? Freeplane would never save it in the map, but it could be used to indicate the collaboration option.

Best regards,
Dimitry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Technical ideas: implementing collaboration in Freeplane, with Flower Platform

plewin
Hello Dimitry, 

Thank your for your help and support, I really appreciate that.

For example I want to share with you one idea. I do not care if you want to use it or not. I just do not know if it is a good one. As I was thinking about how to synchronize two freeplane instances some years ago I thought that is does not require a special kind of nodeChanged  - Event for each kind of change. You can also transmit the whole node content (without children) or a diff so that the event subscriber can reconstruct the content and use the classes freeplane uses to save maps / nodes to xml and to read them. You could later move serializing / building diff / merging  to worker threads if it appears to be necessary. Freeplane itself almost never uses worker threads to be honest.
I do not want the subscribers to be coupled with freeplane classes, xml or the jvm. So it is not something I would do.
   
I'm going to script freeplane to
> connect to a websocket on the server of remote mind map instead of
> rabbitmq. When opening a map with url "http://theserver/maps/mymap.mm
> <http://server/maps/mymap.mm>", freeplane will open a websocket on
> ws://theserver to subscribe for changes and push updates. The stable
> minimum viable product will be less complex, it solves possible
> firewall problems when working on public networks, and the websocket
> will be available for updating a live web preview of the mind map
> hosted in the server.

I wish you have fun with it.
It works smoothly, I use spring sockjs websocket client + stomp subprotocol (suggested by spring doc) + jetty for transport. 


Currently freeplane can load maps from http and https web locations, and it does not assume collaboration.
What do you think about letting the server tell the client its collaboration url (e.g. ws://theserver/maps/mymap.mm/collaborate) as a xml attribute of the top level element? Freeplane would never save it in the map, but it could be used to indicate the collaboration option.
The problem with this is accessing the attribute from the script. I don't know how and if I can get this attribute starting from the MapModel. 
It is less flexible but constructing the collaboration url from the http url of the mind map seems better to me.
In a second stage, the mind map sent to freeplane could contain only collaboration settings as a mind map. The script will ask for the true mm file via the websocket so an authentication can be made.


Best regards,
12
Loading...