Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example service #126

Closed
wants to merge 11 commits into from
Closed

Conversation

daniel-dgi
Copy link
Contributor

So here's the smallest thing I could think of that showcases what I've been trying to describe. It's pretty small, and shows that really all we're trying to do is hack info out of the request and return responses. This is what is meant by 'Thin Controllers'. All the heavy lifting is done elsewhere. In this case, it's Chullo.

As things grow, we can either have a lot of these little guys, or try and manage all of them in a single deployable project.

@daniel-dgi
Copy link
Contributor Author

To run:

$ cd /path/to/islandora/services/TransactionService
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install
$ cd src
$ php -S localhost:9999 index.php

$app['debug'] = true;

$app['fedora'] = function () use ($app) {
$client = new Client(['base_uri' => 'http://127.0.0.1:8080/fcrepo/rest']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still new to this stuff, is there a reason you didn't use the static constructor with the base_uri and get back the Chullo?
ie.

return Chullo::create('http://127.0.0.1:8080/fcrepo/rest');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason in particular. Doing it manually gives you a bit more control over the client, which in this case, is unneccessary.

"/islandora/transaction/{id}/rollback",
function (Application $app, $id) {
try {
return $app['fedora']->rollbackTransaction($id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should remove this 'return'

daniel-dgi and others added 8 commits December 11, 2015 09:29
for get route:
assuming it's running in 8181 (example php -S localhost:8181 -t src
src/index.php  )
then
http://localhost:8181/islandora/resource/7ef68f6f-72ab-4708-b0f4-8ec1f07
cd580
will get the resource for a resource that has nfo:uuid ->
7ef68f6f-72ab-4708-b0f4-8ec1f07cd580 in the triple store

and
http://localhost:8181/islandora/resource/7ef68f6f-72ab-4708-b0f4-8ec1f07
cd580/OBJ
will get the child resource for that one (in this case binary)

Accepts also a ?tx=transactionid

* if the transactionid does not exist if fails with 404
* if uuid is not uuid then it fails with 404
* if resource path is not in triple store if fails with 404
Main route for getting a resource accepts also a metadata argument
localhost:8181/islandora/resource/7ef68f6f-72ab-4708-b0f4-8ec1f07cd580/O
BJ/?metadata=true

In case of binary it will return triples instead of the binary resource
In case of an container i will get you the RDF (basically ignoring this
option)
Also moved some route parameters to query arguments (checksum) in all
routes: tx ,checksum and metadata (depending on what is used in each
route)
Did also a lot of coding cleanup.
Not sure if the Symphony coding standard as base is good enough?
Moved the ->abort for non existing resource path in triple store into
the middleware.
@ruebot
Copy link
Member

ruebot commented Jan 6, 2016

Superseded #131

@ruebot ruebot closed this Jan 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants