{"id":36427243,"url":"https://github.com/mogilefs-moji/moji","last_synced_at":"2026-01-11T18:01:58.428Z","repository":{"id":47662087,"uuid":"2303255","full_name":"mogilefs-moji/moji","owner":"mogilefs-moji","description":"A file-like MogileFS client for Java","archived":false,"fork":false,"pushed_at":"2021-08-19T06:46:47.000Z","size":458,"stargazers_count":26,"open_issues_count":4,"forks_count":13,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-01-18T01:26:38.402Z","etag":null,"topics":["java","java-mogilefs","mogile","mogilefs","moji","storage"],"latest_commit_sha":null,"homepage":"","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/mogilefs-moji.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2011-08-31T18:29:11.000Z","updated_at":"2024-01-18T01:26:38.403Z","dependencies_parsed_at":"2022-09-07T09:31:57.516Z","dependency_job_id":null,"html_url":"https://github.com/mogilefs-moji/moji","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/mogilefs-moji/moji","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mogilefs-moji%2Fmoji","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mogilefs-moji%2Fmoji/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mogilefs-moji%2Fmoji/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mogilefs-moji%2Fmoji/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mogilefs-moji","download_url":"https://codeload.github.com/mogilefs-moji/moji/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mogilefs-moji%2Fmoji/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28317034,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"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":["java","java-mogilefs","mogile","mogilefs","moji","storage"],"created_at":"2026-01-11T18:01:57.726Z","updated_at":"2026-01-11T18:01:58.420Z","avatar_url":"https://github.com/mogilefs-moji.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\nA file-like [MogileFS](http://danga.com/mogilefs/ \"Danga Interactive - MogileFS\") client for Java.\n\n## Start using\nYou can obtain Moji from Maven Central: \n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/fm.last/moji/badge.svg?subject=fm.last:moji)](https://maven-badges.herokuapp.com/maven-central/fm.last/moji) ![GitHub license](https://img.shields.io/github/license/mogilefs-moji/moji.svg)\n[![Javadocs](http://javadoc.io/badge/fm.last/moji.svg)](http://javadoc.io/doc/fm.last/moji)\n\n# Features\n* `java.io.File` like API\n* Supports writing streams of unknown length\n* Unit/Integration tests\n* Spring friendly\n* Tracker connection pooling with balancing between hosts and strategies for dealing with failed nodes\n* Local file system implementation for faking in tests (`fm.last.moji.local.LocalFileSystemMoji`)\n\n# Configuration\n### Using plain-old-Java\n        SpringMojiBean moji = new SpringMojiBean();\n        moji.setAddressesCsv(\"192.168.0.1:7001,192.168.0.2:7001\");\n        moji.setDomain(\"testdomain\");\n        moji.initialise();\n        moji.setTestOnBorrow(true);\n### Using the Spring framework\nSet some properties for your context:\n\n        moji.tracker.address=192.168.0.1:7001,192.168.0.2:7001\n        moji.domain=testdomain\n        \nImport the Moji Spring context:\n\n        \u003cimport resource=\"moji-context.xml\" /\u003e\n  \n*Or* create a Moji spring bean:\n\n        \u003cbean id=\"moji\" class=\"fm.last.moji.spring.SpringMojiBean\"\u003e\n          \u003cproperty name=\"addressesCsv\" value=\"${moji.tracker.address}\" /\u003e\n          \u003cproperty name=\"domain\" value=\"${moji.domain}\" /\u003e\n          \u003cproperty name=\"maxActive\" value=\"${moji.pool.max.active:100}\" /\u003e\n          \u003cproperty name=\"maxIdle\" value=\"${moji.pool.max.idle:10}\" /\u003e\n          \u003cproperty name=\"testOnBorrow\" value=\"${moji.pool.test.on.borrow:true}\" /\u003e\n        \u003c/bean\u003e\n\n# Usage\n#### Create/update a remote file\n        MojiFile rickRoll = moji.getFile(\"rick-astley\");\n        moji.copyToMogile(new File(\"never-gonna-give-you-up.mp3\"), rickRoll);\n        \nOr in a given storage class:\n\n        MojiFile rickRoll = moji.getFile(\"rick-astley\", \"music-meme\");\n\n#### Get the remote file size\n        long length = rickRoll.length();\n#### Rename the remote file\n        rickRoll.rename(\"stairway-to-heaven\");\n#### Check the existence of a remote file\n        MojiFile abba = moji.getFile(\"voulez-vous\");\n        if (abba.exists()) {\n          ...\n#### Delete the remote file\n        abba.delete();\n#### Download a remote file\n        MojiFile fooFighters = moji.getFile(\"stacked-actors\");\n        fooFighters.copyToFile(new File(\"foo-fighters.mp3\"));\n#### Modify the storage class of a remote file\n        fooFighters.modifyStorageClass(\"awesome\");\n\n#### Stream from a remote file\n        InputStream stream = null;\n        try {\n          stream = fooFighters.getInputStream();\n          // Do something streamy\n          //   stream.read();\n        } finally {\n          stream.close();\n        }\n\n#### Stream to a remote file\nThis will either create a new file or overwrite an existing file's contents\n\n        OutputStream stream = null;\n        try {\n          stream = fooFighters.getOutputStream();\n          // Do something streamy\n          //   stream.write(...);\n          stream.flush();\n        } finally {\n          stream.close();\n        }\n#### List remote files by prefix\n        List\u003cMojiFile\u003e files = moji.list(\"abba-\");\n        for(MojiFile file : files) {\n          // abba-waterloo, abba-voulez-vous, abba-fernado, etc.\n        }\n\nImpose a limit on the number of items returned:\n\n        List\u003cMojiFile\u003e files = moji.list(\"abba-\", 10);\n        for(MojiFile file : files) {\n          // abba-waterloo, abba-voulez-vous, abba-fernado, etc. - maximum of 10\n        }\n\n#### Get the locations of a remote file\n        File fooFighters = moji.getFile(\"in-your-honour\"); \n        List\u003cURL\u003e paths = fooFighters.getPaths();\n        // http://192.168.0.2:7500/dev2/0/000/000/0000000819.fid, http://192.168.0.4:7500/dev3/0/000/000/0000000819.fid, etc\n\n#### Get the attributes of a remote file\nNote: this is only supported on more recent versions of MogileFS.\n\n        File fooFighters = moji.getFile(\"in-your-honour\"); \n        MojiFileAttributes attributes = fooFighters.getAttibutes();\n        \n        String storageClass = attributes.getStorageClass();\n        int deviceCount = attributes.getDeviceCount();\n        int fid = attributes.getFid();\n\n# Running the integration tests\nTo run the integration tests, you can make use of ready-to-use [docker image](https://hub.docker.com/r/hrchu/mogile-moji/), or setup the environment manually. For manual setup, you need:\n\n* A test MogileFS tracker and a storage node ([installation instructions](https://github.com/hrchu/mogilefs/blob/wiki/InstallHowTo.md))\n\nMogileFS integration test properties config:\n\n* These properties should be set in `/moji.properties` on the classpath.\n* Set your Tracker address with the property:\n\n        moji.tracker.hosts\n* Declare your Mogile domain with the property:\n\n        moji.domain\n* Declare two storage classes (class assigned here should have devcount=1 if there are multiple storage nodes in the environment) in your Mogile instance and assign them with these properties:\n\n        test.moji.class.a\n        test.moji.class.b\n* Choose a key prefix to avoid any key clashes with real data (you're using a test instance right?) or other tests. Otherwise we might get unexpected behaviour and file deletions:\n\n        test.moji.key.prefix\n\n# Building\nThis project uses the [Maven](http://maven.apache.org/) build system.\n\n# Contributing\nAll contributions are welcome. Please use the [Last.fm codeformatting profile](https://github.com/lastfm/lastfm-oss-config/blob/master/src/main/resources/fm/last/last.fm.eclipse-codeformatter-profile.xml) found in the `lastfm-oss-config` project for formatting your changes.\n\n# Legal\nCopyright 2012-2017 [Last.fm](http://www.last.fm/) \u0026 The \"mogilefs-moji\" committers.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n \n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n \nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmogilefs-moji%2Fmoji","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmogilefs-moji%2Fmoji","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmogilefs-moji%2Fmoji/lists"}