{"id":44437163,"url":"https://github.com/levelfourab/otter-java","last_synced_at":"2026-02-12T14:01:25.948Z","repository":{"id":54327940,"uuid":"64587156","full_name":"LevelFourAB/otter-java","owner":"LevelFourAB","description":"Support library for Collaborative Realtime Editing via Operational Transformation","archived":false,"fork":false,"pushed_at":"2021-02-23T18:56:17.000Z","size":176,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-12T19:24:26.690Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LevelFourAB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-31T09:41:41.000Z","updated_at":"2023-11-19T13:55:31.000Z","dependencies_parsed_at":"2022-08-13T12:10:23.902Z","dependency_job_id":null,"html_url":"https://github.com/LevelFourAB/otter-java","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/LevelFourAB/otter-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LevelFourAB%2Fotter-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LevelFourAB%2Fotter-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LevelFourAB%2Fotter-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LevelFourAB%2Fotter-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LevelFourAB","download_url":"https://codeload.github.com/LevelFourAB/otter-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LevelFourAB%2Fotter-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29367814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-12T14:01:24.710Z","updated_at":"2026-02-12T14:01:25.927Z","avatar_url":"https://github.com/LevelFourAB.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Otter\n\nOtter is a library to support collaborative realtime editing using\n[Operational Transformation](https://en.wikipedia.org/wiki/Operational_transformation).\nThis repository contains the Java-implementation.\n\n## Using Otter\n\nOtter consists of three parts, the operations library, the editing engine and\na high level model. The high level model is what you usually want to use\nunless you are implementing something special.\n\n### Operations\n\nThe lowest level of Otter is the operational transformation algorithms. Otter\nsupports transformations on maps, lists and strings. There is also a combined\ntype that can be used to combine several other types based on unique\nidentifiers. All of these transformations are used together to create the\nhigher level model.\n\n### Engine\n\nThe engine contains editing control. It provides support for creating\neditors on top of any supported operational transformation.\n\n\n```java\nOperationSync\u003cOperation\u003cStringHandler\u003e\u003e sync = new YourOperationSync(new StringType(), ...);\nEditor\u003cOperation\u003cStringHandler\u003e\u003e editor = new DefaultEditor\u003c\u003e(uniqueSessionId, sync);\n\n// Get the initial content and register a listener\ntry(CloseableLock lock = editor.lock()) {\n  editor.getCurrent().apply( ... );\n  \n  editor.addEditorListener(new EditorEventHandler());\n}\n\n// Perform an operation\ntry(CloseableLock lock = editor.lock()) {\n  // Use a lock to safely be able to create a delta\n  editor.apply(StringDelta.builder()\n    .retain(currentStringLength)\n    .insert(\"abc\")\n    .done()\n  );\n}\n```\n\nEditors require a synchronization helper for sending and receiving operations\nfrom a server. There is intentionally no default implementation of such a sync\nas different applications will have different requirements here.\n\nIn the end all operations performed by an editor will end up being handled by\nan instance of `EditorControl`.\n\n```java\nEditorControl control = new DefaultEditorControl(historyStorage);\n\n// When a new editor connects you can get the latest version:\ncontrol.getLatest();\n\n// When an operation is received from a client it needs to be stored and\n// the result needs to be sent back to all clients\nTaggedOperation op = control.store(taggedOperation);\n```\n\n### Model\n\nThis is the high level API that makes it easier to work with shared editing.\nThe model provides shared objects of different types that are synchronized\nbetween all editors of the model.\n\nHere is a tiny example of working with the model:\n\n```java\nEditor editor = new DefaultEditor(uniqueSessionId, sync); \nModel model = Model.builder(editor)\n  .build();\n\n// Create a new string and store it in the root map\nSharedString title = model.newString();\ntitle.set(\"Cookies are tasty\");\nmodel.set(\"title\", title);\n\n// Set a primitive value in the map\nmodel.set(\"priority\", 10);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevelfourab%2Fotter-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevelfourab%2Fotter-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevelfourab%2Fotter-java/lists"}