[GIS] Modifying the start/end points of a LineString and maintaining connectivity in OpenLayers

openlayers-2

I'm developing an application where the user can view and edit a street grid of a city. The streets are presented as features on a vector layer, and the user has to be able to modify the elements (both the attributes and the geometry – which is LineString – of the feature). The editing of a geometry is limited to dragging the end points of the LineString, at least for now.

The trick is that the new end points must intersect with the current geometry of the feature, so that the user cannot drag a road to start from outside of the street grid. Also, modifying the geometry should affect the neighbouring geometries, if any. That is, if another road begins where one ends, both should have their start/end point changed.

I don't suppose OpenLayers supports this out of the box so how should I begin to implement this?