Skip to content

Commit

Permalink
fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenek-jonas committed Dec 21, 2023
1 parent 5c60356 commit f1c5512
Showing 1 changed file with 23 additions and 25 deletions.
48 changes: 23 additions & 25 deletions storage/rest/service-sparkjava/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ sparkjava# Storage Viewer HowTo:
- [Usage](#2-usage)
- [Example](#3-example)
- [Routes](#4-available-routes)
- [typeDictionary](#4-1-typedictionary)
- [object](#4-2-object)
- [root](#4-3-root)
- [filesStatistics](#4-4-filesstatistics)
- [typeDictionary](#41-typedictionary)
- [object](#42-object)
- [root](#43-root)
- [filesStatistics](#44-filesstatistics)
- [Configuration](#5-configuration)
- [Server](#5-1-server)
- [URL](#5-1-1-url-root)
- [port](#5-1-2-port)
- [Logging](#5-2-logging)
- [Server](#51-server)
- [URL](#511-url-root)
- [port](#512-port)
- [Logging](#52-logging)

## 1. Setup:

### Maven Dependencies
```
```xml
<dependency>
<groupId>one.microstream</groupId>
<artifactId>microstream-storage-restservice-sparkjava</artifactId>
Expand All @@ -34,7 +34,7 @@ one.microstream.storage.restservice.types.StorageRestService
## 2. Usage

### 2.1. Start the Microstream storage as usual:
```
```java
EmbeddedStorageManager storage = EmbeddedStorage
.Foundation(storageDir)
.start();
Expand All @@ -44,19 +44,19 @@ EmbeddedStorageManager storage = EmbeddedStorage
- Start the server
By default the server will listen on port 4567

```
```java
final StorageRestService service = RestServiceResolver.getType(storage, StorageRestServiceSparkJava.class);
service.start();
```

### 2.3 Stoping the viewer server
```
```java
service.stop();
```
the EmbeddedStorageManager will not be stopped.

## 3. Example
```
```java
public class MainTestStorageRestService
{
public static void main(final String[] args)
Expand All @@ -81,7 +81,7 @@ public class MainTestStorageRestService
/[InstanceName]/ dictionary
Get the typeDictionary as String
```
http://localhost:4567/microstream/dictionary"
http://localhost:4567/microstream/dictionary
```

### 4.2 Object
Expand Down Expand Up @@ -134,15 +134,15 @@ optional, default is default is java.lang.Long.MAX_VALUE \
limit the number of returned resolved references to supplied count.\
requires “references=true”

### 4.3. Root
/[InstanceName]/root
### 4.3. Root
`/[InstanceName]/root`
Get Name and object ID of the current storage root element
```
http://localhost:4567/microstream/root
```

### 4.4. FilesStatistics
/[InstanceName]/maintenance/filesStatistics
`/[InstanceName]/maintenance/filesStatistics`
Get some statistics about the used storage files
```
http://localhost:4567/microstream/maintenance/filesStatistics
Expand All @@ -154,37 +154,35 @@ The Storage viewer uses the Spark micro framework from http://sparkjava.com/ as

To provide a custom configured server just create an Spark.service and initialize the StorageRestService with this Spark.service

```
```java
final Service service = Service.ignite().port(port);
final StorageRestServiceSparkJava service = RestServiceResolver.getType(storage, StorageRestServiceSparkJava.class);
service.setSparkService(sparkService);
service.start();
```

#### 5.1.1 Url Root
To set an other url root then 'microstream' use the constructor:
To set another url root then 'microstream' use the constructor:

```
```java
final StorageRestServiceSparkJava service = RestServiceResolver.getType(storage, StorageRestServiceSparkJava.class);
service.setInstanceName(storageName);
service.start();
```

#### 5.1.2 Port
To set an other port then the default port 4567 it is required to provide a custom configured Spark Server session to the StorageRestService constructor:
To set another port then the default port 4567 it is required to provide a custom configured Spark Server session to the StorageRestService constructor:

```
```java
final Service service = Service.ignite().port(port);
final StorageRestServiceSparkJava service = RestServiceResolver.getType(storage, StorageRestServiceSparkJava.class);
service.setSparkService(sparkService);
service.start();
```

### 5.2 Logging
To enable logging add the following dependency to the project:
```
```xml
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand Down

0 comments on commit f1c5512

Please sign in to comment.