diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..63d2f1a --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ diff --git a/installAndRun.sh b/installAndRun.sh index 9a2f217..5195c82 100755 --- a/installAndRun.sh +++ b/installAndRun.sh @@ -1,39 +1,54 @@ cd "${0%/*}" || (echo "Could not chdir to this script's dir!" && exit) # Change the working directory to the script's directory, when running from other location. -cd libs || exit -git clone https://github.com/LSmyrnaios/PublicationsRetriever.git # We assume there is no previously source-code here, if so, it will be overwritten. +justInstall=0 -# Do not need to perform a string-replace in "build.gradle", since it automatically gets all ".jar" files. - -# Keep a backup of the existing JAR file. -mv ./publications_retriever-1.0-SNAPSHOT.jar ./publications_retriever-1.0-SNAPSHOT_BACKUP.jar - -cd PublicationsRetriever && mvn clean install - -# Copy the created JAR file to the top libs directory. -cp target/publications_retriever-1.0-SNAPSHOT.jar ../publications_retriever-1.0-SNAPSHOT.jar - -# Delete the directory with the source-code. -cd ../ && rm -rf PublicationsRetriever - -# Clean and (re)build and run the project. -cd ../ -echo -e "\nAsking for sudo, in order to verify the installation of 'gradle'..\n" +if [[ $# -eq 1 ]]; then + justInstall=$1 +elif [[ $# -gt 1 ]]; then + echo -e "Wrong number of arguments given: ${#}\nPlease execute it like: script.sh "; exit 1 +fi gradleVersion="7.2" -wget https://services.gradle.org/distributions/gradle-${gradleVersion}-bin.zip +if [[ justInstall -eq 0 ]]; then -sudo mkdir /opt/gradle -sudo unzip -d /opt/gradle gradle-${gradleVersion}-bin.zip -ls /opt/gradle/gradle-${gradleVersion} + cd libs || exit + git clone https://github.com/LSmyrnaios/PublicationsRetriever.git # We assume there is no previously source-code here, if so, it will be overwritten. -export PATH=$PATH:/opt/gradle/gradle-${gradleVersion}/bin -gradle wrapper --gradle-version=${gradleVersion} --distribution-type=bin + # Do not need to perform a string-replace in "build.gradle", since it automatically gets all ".jar" files. -#gradle tasks # For debugging installation -#gradle -v # For debugging installation + # Keep a backup of the existing JAR file. + mv ./publications_retriever-1.0-SNAPSHOT.jar ./publications_retriever-1.0-SNAPSHOT_BACKUP.jar + + cd PublicationsRetriever && mvn clean install + + # Copy the created JAR file to the top libs directory. + cp target/publications_retriever-1.0-SNAPSHOT.jar ../publications_retriever-1.0-SNAPSHOT.jar + + # Delete the directory with the source-code. + cd ../ && rm -rf PublicationsRetriever + + # Clean and (re)build and run the project. + cd ../ + echo -e "\nAsking for sudo, in order to verify the installation of 'gradle'..\n" + + wget https://services.gradle.org/distributions/gradle-${gradleVersion}-bin.zip + + sudo mkdir /opt/gradle + sudo unzip -d /opt/gradle gradle-${gradleVersion}-bin.zip + #ls /opt/gradle/gradle-${gradleVersion} # For debugging installation + + export PATH=$PATH:/opt/gradle/gradle-${gradleVersion}/bin + + gradle wrapper --gradle-version=${gradleVersion} --distribution-type=bin + + #gradle tasks # For debugging installation + #gradle -v # For debugging installation + + gradle clean + gradle build +else + export PATH=$PATH:/opt/gradle/gradle-${gradleVersion}/bin # Make sure the gradle is still accessible (it usually isn't without the "export"). +fi -gradle clean -gradle build gradle bootRun diff --git a/src/main/java/eu/openaire/urls_worker/plugins/PublicationsRetrieverPlugin.java b/src/main/java/eu/openaire/urls_worker/plugins/PublicationsRetrieverPlugin.java index 1cb809e..e956ebb 100644 --- a/src/main/java/eu/openaire/urls_worker/plugins/PublicationsRetrieverPlugin.java +++ b/src/main/java/eu/openaire/urls_worker/plugins/PublicationsRetrieverPlugin.java @@ -152,6 +152,7 @@ public class PublicationsRetrieverPlugin { for ( DataToBeLogged data_2 : FileUtils.dataToBeLoggedList ) { if ( data_2.getUrlId().equals(previousId) && data_2.getWasDocumentOrDatasetAccessible().equals("true") ) { fileLocation = data_2.getComment(); + mimeType = "application/pdf"; break; } }