2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MarkLogicのJavaのサンプルを手っ取り早く動かす方法 (Eclipse編)

Posted at

MarkLogicというNoSQL製品では、製品のJavaインターフェースを呼び出すサンプル実装が公式から提供されています。ソースは、Java Client APIプロジェクトcom.marklogic.client.exampleパッケージ内にあります。利用手順は、GitHubのWikiにあります。Java Application Developer's Guideを読みながら理解すると良い感じです。

MarkLogicのサンプルスタックが大きすぎて、何やっているかわからない感がある方は、こちらの方がとっつきやすいかもしれません。

手順が色々なところに分散して書かれていたため、こちらにまとめてメモしておきます。

事前にインストールが必要なもの

MarkLogicサーバーの設定

  1. MarkLogicサーバーの管理コンソール( http://localhost:8001/ )に行き、右側のツリーからConfigure -> Security -> Users を選択
    userpane.png

  2. 左側でCreateタブを選択し、順に以下の3つのユーザーを作成

ユーザー名 パスワード 必要なRole
rest-reader x rest-reader
rest-writer x rest-writer
rest-admin x rest-admin

この表と違う内容でユーザーを作成しても良いです。その場合、src/main/resources/Example.propertiesの編集が必要となります。

サンプルプロジェクトのダウンロード

$ git clone --depth 1 https://github.com/marklogic/java-client-api

Eclipse上での実行

  1. Eclipseにjava-client-apiプロジェクトをインポート
  2. Package Explorerでjava-client-api-developを右クリック
    -> Run As -> Java Application (または実行-> Java アプリケーション)
  3. AllCookbookExamplesを選択
    sentaku.png

部分的に動かしたい場合は、ClientCreator等、個別の起動クラスを選択して実行することもできます。ただし、AllCookbookExamples.javamain()に書いてある順序通りに動かす必要があります。

コンソールの表示を確認

うまくいけば、Eclipseのコンソールにこのような表示が出るはずです。
https://gist.github.com/Makopo/6754f41b60a7260618441ea9fe3281dd

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?