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

Accept and pass along Fedora base url #65

Merged
merged 9 commits into from
Dec 11, 2019
Merged

Conversation

whikloj
Copy link
Member

@whikloj whikloj commented Oct 24, 2019

GitHub Issue: Islandora/documentation#926

Related to:

What does this Pull Request do?

Instead of setting the Fedora base url in the microservice configuration we can instead provide it in the message. It is possible that we retain the configuration argument as a fall back, but if you have multiple containers for a multi-site you might want to dynamically change the base url per request.

This work relies on @Natkeeran's work in the above branches to send the event and receive the event.

I went with the header X-Islandora-Fedora-Endpoint but this could be a configuration parameter if we like.

How should this be tested?

I did not test this with the derivative connectors as that would require a full playbook setup which I did not have.

  • How I tested this was to stand up islandora-playbook.
  • I had a synced folder into my playbook.
    # Configure sync directory
    config.vm.synced_folder ".", home_dir + "/islandora"
    config.vm.synced_folder "/my/Alpaca/directory", home_dir + "/Alpaca"
    
  • In vagrant (vagrant ssh) I did
    cd /home/ubuntu/Alpaca
    sudo ./gradlew clean build install
    
  • Then I removed the old Alpaca and installed the new one.
    /opt/bin/karaf/client
    > feature:uninstall islandora-indexing-fcrepo islandora-indexing-triplestore
    > repo-remove islandora-karaf-1.0.1
    > logout
    sudo service karaf stop
    sudo rm -rf /opt/karaf/data/*
    sudo service karaf start
    /opt/karaf/bin/client
    > repo-add mvn:org.apache.camel.karaf/apache-camel/2.20.4/xml/features
    > repo-add mvn:org.apache.activemq/activemq-karaf/5.15.0/xml/features
    > repo-add mvn:org.fcrepo.camel/fcrepo-camel/5.0.0/xml/features
    > repo-add mvn:org.fcrepo.camel/toolbox-features/5.0.0/xml/features
    >  repo-add file:/home/ubuntu/Alpaca/karaf/build/resources/main/features.xml
    > feature:install fcrepo-service-activemq
    > feature:install fcrepo-service-camel
    > feature:install islandora-http-client
    > feature:install islandora-indexing-triplestore
    > feature:install islandora-indexing-fcrepo
    > feature:install islandora-connector-derivative
    > logout
    sudo service karaf stop
    sudo service karaf start
    
    This should restart the derivative routes as well.
  • I also edited the log configuration to see my logging messages.
    sudo vim /opt/karaf/etc/org.ops4j.pax.logging.cfg
    
    I edited the last line of the file
     - log4j.logger.ca.islandora.camel=DEBUG, islandora
     + log4j.logger.ca.islandora.alpaca=DEBUG, islandora
    
  • Now you need to replace your islandora with the branch above, go to the Islandora Settings form and add your Fedora base url.
  • Then you can create a Repository Item and you should see a line in your /opt/karaf/data/logs/islandora.log like:
    2019-10-24 15:07:27,849 | DEBUG | -fcrepo-content] | FcrepoIndexer                    | 56 - ca.islandora.alpaca.islandora-indexing-fcrepo - 1.0.2 | Received Node event for UUID (b096a183-6ca9-4aa8-95e5-d30a5a246e67, jsonld URL (http://localhost:8000/node/1?_format=jsonld, fedora base URL (http://127.0.0.1:8080/fcrepo/rest)
    

Interested parties

@Islandora/8-x-committers especially @Natkeeran

@codecov
Copy link

codecov bot commented Oct 24, 2019

Codecov Report

Merging #65 into dev will increase coverage by 4.42%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev      #65      +/-   ##
============================================
+ Coverage     85.33%   89.76%   +4.42%     
+ Complexity       98       73      -25     
============================================
  Files            16       10       -6     
  Lines           341      293      -48     
  Branches          1        1              
============================================
- Hits            291      263      -28     
+ Misses           49       29      -20     
  Partials          1        1
Impacted Files Coverage Δ Complexity Δ
...paca/connector/derivative/DerivativeConnector.java 100% <ø> (ø) 3 <0> (ø) ⬇️
.../islandora/alpaca/support/event/AS2Attachment.java 80% <ø> (ø) 5 <0> (?)
...lpaca/indexing/triplestore/TriplestoreIndexer.java 96.55% <ø> (ø) 9 <0> (ø) ⬇️
...java/ca/islandora/alpaca/support/event/AS2Url.java 75% <ø> (ø) 7 <0> (?)
...aca/http/client/StaticTokenRequestInterceptor.java 73.33% <ø> (ø) 6 <0> (ø) ⬇️
...va/ca/islandora/alpaca/support/event/AS2Actor.java 70% <100%> (ø) 4 <1> (?)
...va/ca/islandora/alpaca/support/event/AS2Event.java 81.81% <100%> (ø) 11 <2> (?)
...a/ca/islandora/alpaca/support/event/AS2Object.java 76.92% <100%> (ø) 7 <1> (?)
...slandora/alpaca/indexing/fcrepo/FcrepoIndexer.java 92.45% <100%> (+1.24%) 6 <1> (ø) ⬇️
...ora/alpaca/support/event/AS2AttachmentContent.java 100% <100%> (ø) 15 <4> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df45bd4...8d1fff7. Read the comment docs.

@@ -129,11 +132,15 @@ public void configure() {
.setProperty("event").simple("${body}")
.setProperty("uuid").simple("${exchangeProperty.event.object.id.replaceAll(\"urn:uuid:\",\"\")}")
.setProperty("jsonldUrl").simple("${exchangeProperty.event.object.url[2].href}")
.setProperty("fedoraUrl").simple("${exchangeProperty.event.target}")
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

@whikloj
Copy link
Member Author

whikloj commented Nov 1, 2019

@dannylamb your comments lead me to believe we need to make the differentiation between the "Base URL of a Fedora instance" and a "single Fedora resource URI" clearer or others will get confused. I'm still fighting with this and may end up backing out if these annotations don't help me out. But either way I'll try to make it clearer.

@whikloj
Copy link
Member Author

whikloj commented Nov 2, 2019

Okay, I think this is ready. I was able to get it working passing stuff around and still indexing in Fedora and creating derivatives. I updated the instructions at the top to get the various dynamic routes to regenerate after you install the new islandora-connector-derivative.

@Natkeeran
Copy link
Contributor

@whikloj
Sorry for lingering this one. Is is possible for you to rebase this one.

@dannylamb
Copy link
Contributor

I'm good with the changes you made @whikloj 👍

@elizoller
Copy link
Member

do you need someone to test this?

@whikloj
Copy link
Member Author

whikloj commented Dec 4, 2019

@elizoller sure, if you want to give it a test that would be great.

@dannylamb
Copy link
Contributor

I've managed to get this installed and working with all the other pieces. I'm happy to pull all this work in, but Travis is not happy 😢

@dannylamb
Copy link
Contributor

Also, if you want tests to pass on the main islandora repo, this'll need to get merged beforehand: Islandora/islandora#747

@whikloj
Copy link
Member Author

whikloj commented Dec 10, 2019

I feel like we should consider removing Oracle Java from our testing matrix, but I'll spin up a Travis box and see if this is a simple fix.

@dannylamb
Copy link
Contributor

@whikloj I'm fine with sticking to openjdk for testing

@whikloj
Copy link
Member Author

whikloj commented Dec 10, 2019

@dannylamb fixed

Copy link
Contributor

@dannylamb dannylamb left a comment

Choose a reason for hiding this comment

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

👍

@dannylamb dannylamb merged commit a1dab02 into Islandora:dev Dec 11, 2019
@whikloj whikloj deleted the issue-926 branch November 3, 2021 21:04
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.

4 participants