Skip to content

Commit

Permalink
Rdf Flushing Microservice (#29)
Browse files Browse the repository at this point in the history
* Committing before branch hopping

* First pass.  Needs tests and cleanup before PR.

* Using refactored PathMapper

* Manually tested and working.  Gave it tests.

* README

* Cleanup before PR

* README fixes and alignment with said README

* using yaml config and changede create exception to status code 409

* README update
  • Loading branch information
dannylamb authored and whikloj committed Apr 21, 2017
1 parent 78e5d2f commit 29dbba8
Show file tree
Hide file tree
Showing 13 changed files with 4,741 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Hypercube/src/Controller/HypercubeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class HypercubeController
*/
protected $cmd;

/**
* @var string
*/
protected $executable;

/**
Expand Down
72 changes: 72 additions & 0 deletions Milliner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Milliner

## Introduction

Microservice that converts Drupal entities into Fedora resources.

## Installation

Milliner requires a functioning [Drupal 8](https://www.drupal.org/docs/8/install) installation with the [jsonld](http://github.com/Islandora-CLAW/jsonld) module enabled.
It also requires a functioning [Fedora](http://fedorarepository.org/) repository.
You will also need an SQL database as needed for [Gemini](../Gemini)

- Clone this repository somewhere in your web root.
- Install `composer`. [Install instructions here.][4]
- `$ cd /path/to/Milliner` and run `$ composer install`
- Then either
- For production, configure your web server appropriately (e.g. add a VirtualHost for Milliner in Apache) OR
- For development, run the PHP built-in webserver `$ php -S localhost:8888 -t src` from Milliner root.

## Configuration

Make a copy of the [config file](cfg/config.example.yaml) and name it `config.yaml` in the `cfg` directory.
You will need to set the `fedora_base_url` entry to point to your Fedora installation.
You will also need to set up the `drupal_base_url` entry to point to your Drupal 8 installation.
The SQL db can be configured by following [Gemini's instructions](../Gemini).

## Usage

Milliner sets up a single endpoint, `/metadata/{drupal_path}`, which accepts POST, PUT, and DELETE requests.
If requests are successful, they return the response from the Fedora server. If the Drupal entity cannot be requested,
the error response from Drupal is returned. If there is an exception thrown during execution, a 500 response is returned
with the exception's message.


### POST

This retrieves a jsonld representation of the specified Drupal entity and inserts it in Fedora.

For example, suppose you create an entity at `http://localhost:8000/fedora_resource/1`. If running the PHP built-in server command described in the Installation section:
```
$ curl -X "POST" "localhost:8888/metadata/fedora_resource/1"
```
will return the uri to the created Fedora resource if successfully created.

### PUT

This retrieves a jsonld representation of the specified Drupal entity and updates it in Fedora.

For example, suppose you update an entity at `http://localhost:8000/fedora_resource/1`. If running the PHP built-in server command described in the Installation section:
```
$ curl -X "PUT" "localhost:8888/metadata/fedora_resource/1"
```
will return `204 No Content` if the resource is successfully updated.

### DELETE

This deletes the corresponding Fedora resource for the specified Drupal entity.

For example, suppose if you have an entity at `http://localhost:8000/fedora_resource/`. If running the PHP built-in server command described in the Installation section:
```
$ curl -X "PUT" "localhost:8888/metadata/fedora_resource/1"
```
will return `204 No Content` if the resource is successfully updated.

## Maintainers

Current maintainers:

* [Daniel Lamb](https://github.com/dannylamb)

[3]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square
[4]: https://getcomposer.org/download/
27 changes: 27 additions & 0 deletions Milliner/cfg/config.example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---

fedora_base_url: http://localhost:8080/fcrepo/rest
drupal_base_url: http://localhost:8000

db.options:
driver: pdo_mysql
host: 127.0.0.1
port: 3306
dbname: gemini
user: changeme
password: changeme

log:
# Valid log levels are:
# DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY, NONE
# log level none won't open logfile
level: NONE
file: ../gemini.log

syn:
# toggles JWT security for service
enable: false
# Path to the syn config file for authentication.
# example can be found here:
# https://github.com/Islandora-CLAW/Syn/blob/master/conf/syn-settings.example.xml
config: ../syn-settings.xml
44 changes: 44 additions & 0 deletions Milliner/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "islandora/milliner",
"description": "Microservice that puts Drupal content in Fedora",
"type": "project",
"require": {
"silex/silex": "^2.0",
"islandora/crayfish-commons": "dev-master"
},
"license": "MIT",
"authors": [
{
"name": "Islandora Foundation",
"email": "community@islandora.ca",
"role": "Owner"
},
{
"name": "Daniel Lamb",
"email": "dlamb@islandora.ca",
"role": "Maintainer"
}
],
"autoload": {
"psr-4": {
"Islandora\\Milliner\\": "src/"
}
},
"scripts": {
"check": [
"phpcs --standard=PSR2 src tests",
"phpcpd --names *.php src"
],
"test": [
"@check",
"phpunit"
]
},
"require-dev": {
"symfony/browser-kit": "^3.0",
"symfony/css-selector": "^3.0",
"phpunit/phpunit": "^5.0",
"squizlabs/php_codesniffer": "^2.0",
"sebastian/phpcpd": "^3.0"
}
}
Loading

0 comments on commit 29dbba8

Please sign in to comment.