diff --git a/README.adoc b/README.adoc old mode 100644 new mode 100755 diff --git a/adding_url_handlers_to_operating_system/linux/README.md b/adding_url_handlers_to_operating_system/linux/README.md new file mode 100755 index 00000000..300e8683 --- /dev/null +++ b/adding_url_handlers_to_operating_system/linux/README.md @@ -0,0 +1,5 @@ +# creating custom url handlers on linux: + +- Clone the files you see above (`ide-handler, ide-handler.desktop, install`) +- run `sudo bash install` in console +- That's it!! diff --git a/adding_url_handlers_to_operating_system/linux/ide-handler b/adding_url_handlers_to_operating_system/linux/ide-handler new file mode 100755 index 00000000..df2d45fd --- /dev/null +++ b/adding_url_handlers_to_operating_system/linux/ide-handler @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Delete first 22 characters (ide://open?url=file://) +request=${1:22} + +# Decode URL +request=$(echo $request | echo -e "$(sed 's/+/ /g; s/%/\\x/g')") + +# Replace &line= with : +request=${request/&line=/:} + +# Launch Starfish +/usr/bin/starfish -g -r $request diff --git a/adding_url_handlers_to_operating_system/linux/ide-handler.desktop b/adding_url_handlers_to_operating_system/linux/ide-handler.desktop new file mode 100755 index 00000000..5367f8e1 --- /dev/null +++ b/adding_url_handlers_to_operating_system/linux/ide-handler.desktop @@ -0,0 +1,11 @@ +#!/usr/bin/env xdg-open +[Desktop Entry] +Version=1.0 +Terminal=false +Type=Application +Name=IDE URL Handler +Comment=Handle URL Scheme ide:// +Icon=starfish +NoDisplay=true +Exec=starfish %u +MimeType=x-scheme-handler/ide diff --git a/adding_url_handlers_to_operating_system/linux/install b/adding_url_handlers_to_operating_system/linux/install new file mode 100755 index 00000000..8e2167a2 --- /dev/null +++ b/adding_url_handlers_to_operating_system/linux/install @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +sudo cp ide-handler.desktop /usr/share/applications +sudo update-desktop-database + +sudo cp ide-handler /usr/local/bin/ +sudo chmod +x /usr/local/bin/ide-handler diff --git a/adding_url_handlers_to_operating_system/windows/Starfish/starfish.cmd b/adding_url_handlers_to_operating_system/windows/Starfish/starfish.cmd new file mode 100644 index 00000000..544a3a9f --- /dev/null +++ b/adding_url_handlers_to_operating_system/windows/Starfish/starfish.cmd @@ -0,0 +1,3 @@ +@echo off +cd "C:\Users\Public\Starfish" +starfish.exe %1 \ No newline at end of file diff --git a/adding_url_handlers_to_operating_system/windows/Starfish/starfish.exe b/adding_url_handlers_to_operating_system/windows/Starfish/starfish.exe new file mode 100644 index 00000000..c9d477a6 Binary files /dev/null and b/adding_url_handlers_to_operating_system/windows/Starfish/starfish.exe differ diff --git a/adding_url_handlers_to_operating_system/windows/install.cmd b/adding_url_handlers_to_operating_system/windows/install.cmd new file mode 100644 index 00000000..c236a9cd --- /dev/null +++ b/adding_url_handlers_to_operating_system/windows/install.cmd @@ -0,0 +1,6 @@ +@echo off +cd %~dp0 +xcopy /s/i "%~dp0\Starfish" "C:\Users\Public\Starfish" +echo Please accept the upcoming Prompts to install successfully +"%~dp0\starfish.reg" +PAUSE \ No newline at end of file diff --git a/adding_url_handlers_to_operating_system/windows/starfish.reg b/adding_url_handlers_to_operating_system/windows/starfish.reg new file mode 100644 index 00000000..9be0adaf Binary files /dev/null and b/adding_url_handlers_to_operating_system/windows/starfish.reg differ diff --git a/basics_from _quarkus/.dockerignore b/basics_from _quarkus/.dockerignore new file mode 100755 index 00000000..b86c7ac3 --- /dev/null +++ b/basics_from _quarkus/.dockerignore @@ -0,0 +1,4 @@ +* +!target/*-runner +!target/*-runner.jar +!target/lib/* \ No newline at end of file diff --git a/basics_from _quarkus/.gitignore b/basics_from _quarkus/.gitignore new file mode 100755 index 00000000..087a1835 --- /dev/null +++ b/basics_from _quarkus/.gitignore @@ -0,0 +1,35 @@ +# Eclipse +.project +.classpath +.settings/ +bin/ + +# IntelliJ +.idea +*.ipr +*.iml +*.iws + +# NetBeans +nb-configuration.xml + +# Visual Studio Code +.vscode + +# OSX +.DS_Store + +# Vim +*.swp +*.swo + +# patch +*.orig +*.rej + +# Maven +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +release.properties \ No newline at end of file diff --git a/basics_from _quarkus/.mvn/wrapper/MavenWrapperDownloader.java b/basics_from _quarkus/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100755 index 00000000..b901097f --- /dev/null +++ b/basics_from _quarkus/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/basics_from _quarkus/.mvn/wrapper/maven-wrapper.jar b/basics_from _quarkus/.mvn/wrapper/maven-wrapper.jar new file mode 100755 index 00000000..2cc7d4a5 Binary files /dev/null and b/basics_from _quarkus/.mvn/wrapper/maven-wrapper.jar differ diff --git a/basics_from _quarkus/.mvn/wrapper/maven-wrapper.properties b/basics_from _quarkus/.mvn/wrapper/maven-wrapper.properties new file mode 100755 index 00000000..642d572c --- /dev/null +++ b/basics_from _quarkus/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/basics_from _quarkus/README.md b/basics_from _quarkus/README.md new file mode 100755 index 00000000..fe3cf184 --- /dev/null +++ b/basics_from _quarkus/README.md @@ -0,0 +1,53 @@ +# Starfish + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: +``` +./mvnw quarkus:dev +``` + +## Packaging and running the application + +The application can be packaged using `./mvnw package`. +It produces the `getting-started-1.0-SNAPSHOT-runner.jar` file in the `/target` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/lib` directory. + +The application is now runnable using `java -jar target/getting-started-1.0-SNAPSHOT-runner.jar`. + +## Creating a native executable + +You can create a native executable using: `./mvnw package -Pnative`. + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: `./mvnw package -Pnative -Dquarkus.native.container-build=true`. + +You can then execute your native executable with: `./target/getting-started-1.0-SNAPSHOT-runner` + + +## Creating a container + +By default, the native executable is tailored for your operating system (Linux, macOS, Windows etc). Because the container may not use the same executable format as the one produced by your operating system, +- we will instruct the Maven build to produce an executable from inside a container: + +`./mvnw package -Pnative -Dquarkus.native.container-build=true` + +- You can also select the container runtime to use with: + + ``` + # Docker + ./mvnw package -Pnative -Dquarkus.native.container-runtime=docker + # Podman + ./mvnw package -Pnative -Dquarkus.native.container-runtime=podman + ``` + +These are normal Quarkus config properties, so if you always want to build in a container it is recommended you add these to your `application.properties` so you do not need to specify them every time. + +- you can build the docker image with: +`docker build -f src/main/docker/Dockerfile.native -t quarkus-quickstart/getting-started` + +- And finally, run it with: +`docker run -i --rm -p 8080:8080 quarkus-quickstart/getting-started` diff --git a/basics_from _quarkus/mvnw b/basics_from _quarkus/mvnw new file mode 100755 index 00000000..41c0f0c2 --- /dev/null +++ b/basics_from _quarkus/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/basics_from _quarkus/mvnw.cmd b/basics_from _quarkus/mvnw.cmd new file mode 100755 index 00000000..86115719 --- /dev/null +++ b/basics_from _quarkus/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/basics_from _quarkus/pom.xml b/basics_from _quarkus/pom.xml new file mode 100755 index 00000000..19bcce09 --- /dev/null +++ b/basics_from _quarkus/pom.xml @@ -0,0 +1,111 @@ + + + 4.0.0 + org.acme + getting-started + 1.0-SNAPSHOT + + 3.8.1 + true + 1.8 + 1.8 + UTF-8 + UTF-8 + 1.3.0.Final + quarkus-universe-bom + io.quarkus + 1.3.0.Final + 2.22.1 + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus-plugin.version} + + + + build + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + + + + + + + + native + + + native + + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + + + + + + + + + native + + + + diff --git a/basics_from _quarkus/src/main/docker/Dockerfile.jvm b/basics_from _quarkus/src/main/docker/Dockerfile.jvm new file mode 100755 index 00000000..657a7dc2 --- /dev/null +++ b/basics_from _quarkus/src/main/docker/Dockerfile.jvm @@ -0,0 +1,47 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the docker image run: +# +# mvn package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/getting-started-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/getting-started-jvm +# +### +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1 + +ARG JAVA_PACKAGE=java-1.8.0-openjdk-headless +ARG RUN_JAVA_VERSION=1.3.5 + +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' + +# Install java and the run-java script +# Also set up permissions for user `1001` +RUN microdnf install openssl curl ca-certificates ${JAVA_PACKAGE} \ + && microdnf update \ + && microdnf clean all \ + && mkdir /deployments \ + && chown 1001 /deployments \ + && chmod "g+rwX" /deployments \ + && chown 1001:root /deployments \ + && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ + && chown 1001 /deployments/run-java.sh \ + && chmod 540 /deployments/run-java.sh \ + && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security + +# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. +ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" + +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/app.jar + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT [ "/deployments/run-java.sh" ] \ No newline at end of file diff --git a/basics_from _quarkus/src/main/docker/Dockerfile.native b/basics_from _quarkus/src/main/docker/Dockerfile.native new file mode 100755 index 00000000..b34ab6dc --- /dev/null +++ b/basics_from _quarkus/src/main/docker/Dockerfile.native @@ -0,0 +1,30 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode +# +# Before building the docker image run: +# +# mvn package -Pnative -Dquarkus.native.container-build=true +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/getting-started . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/getting-started +# +### +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1 +WORKDIR /work/ +COPY target/*-runner /work/application + +# set up permissions for user `1001` +RUN chmod 775 /work /work/application \ + && chown -R 1001 /work \ + && chmod -R "g+rwX" /work \ + && chown -R 1001:root /work + +EXPOSE 8080 +USER 1001 + +CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] \ No newline at end of file diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/GreetingResource.java b/basics_from _quarkus/src/main/java/org/acme/getting/started/GreetingResource.java new file mode 100755 index 00000000..40f576ff --- /dev/null +++ b/basics_from _quarkus/src/main/java/org/acme/getting/started/GreetingResource.java @@ -0,0 +1,33 @@ +/* +-Intended solely to test if the application is running +-Test it at http://localhost:8080/hello/greeting/anything_you_want + */ +package org.acme.getting.started; + +import javax.inject.Inject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.jboss.resteasy.annotations.jaxrs.PathParam; + +@Path("/hello") +public class GreetingResource { + + @Inject + GreetingService service; + + @GET + @Produces(MediaType.TEXT_PLAIN) + @Path("/greeting/{name}") + public String greeting(@PathParam String name) { + return service.greeting(name); + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String hello() { + return "hello"; + } +} diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/GreetingService.java b/basics_from _quarkus/src/main/java/org/acme/getting/started/GreetingService.java new file mode 100755 index 00000000..b0a9d138 --- /dev/null +++ b/basics_from _quarkus/src/main/java/org/acme/getting/started/GreetingService.java @@ -0,0 +1,12 @@ +package org.acme.getting.started; + +import javax.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class GreetingService { + + public String greeting(String name) { + return "hello " + name; + } + +} \ No newline at end of file diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/ide-handler b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide-handler new file mode 100755 index 00000000..df2d45fd --- /dev/null +++ b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide-handler @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Delete first 22 characters (ide://open?url=file://) +request=${1:22} + +# Decode URL +request=$(echo $request | echo -e "$(sed 's/+/ /g; s/%/\\x/g')") + +# Replace &line= with : +request=${request/&line=/:} + +# Launch Starfish +/usr/bin/starfish -g -r $request diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/ide-handler.desktop b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide-handler.desktop new file mode 100755 index 00000000..deb2973f --- /dev/null +++ b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide-handler.desktop @@ -0,0 +1,11 @@ +#!/usr/bin/env xdg-open +[Desktop Entry] +Version=1.0 +Terminal=false +Type=Application +Name=IDE URL Handler +Comment=Handle URL Scheme ide:// +Icon=ide-handler +NoDisplay=true +Exec=ide-handler %u +MimeType=x-scheme-handler/ide diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Info.plist b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Info.plist new file mode 100755 index 00000000..c9a0e8f9 --- /dev/null +++ b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Info.plist @@ -0,0 +1,63 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + English + CFBundleExecutable + applet + CFBundleIconFile + vscode + CFBundleIdentifier + com.apple.ScriptEditor.id.VS-Code-Handler + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + IDE Handler + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + aplt + CFBundleURLTypes + + + CFBundleURLName + Custom URI Handler for ide:// URIs + CFBundleURLSchemes + + starfish + + + + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + WindowState + + bundleDividerCollapsed + + bundlePositionOfDivider + 0.0 + dividerCollapsed + + eventLogLevel + 2 + name + ScriptWindowState + positionOfDivider + 421 + savedFrame + 50 78 700 672 0 0 1280 777 + selectedTab + description + + + diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/MacOS/applet b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/MacOS/applet new file mode 100755 index 00000000..25488180 Binary files /dev/null and b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/MacOS/applet differ diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/PkgInfo b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/PkgInfo new file mode 100755 index 00000000..3253614c --- /dev/null +++ b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/Scripts/main.scpt b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/Scripts/main.scpt new file mode 100755 index 00000000..10b30060 Binary files /dev/null and b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/Scripts/main.scpt differ diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/applet.rsrc b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/applet.rsrc new file mode 100755 index 00000000..df1db3ca Binary files /dev/null and b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/applet.rsrc differ diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/description.rtfd/TXT.rtf b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/description.rtfd/TXT.rtf new file mode 100755 index 00000000..e9c3bc1a --- /dev/null +++ b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/description.rtfd/TXT.rtf @@ -0,0 +1,4 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1348\cocoasubrtf170 +{\fonttbl} +{\colortbl;\red255\green255\blue255;} +} \ No newline at end of file diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/vscode.icns b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/vscode.icns new file mode 100755 index 00000000..f0e82fc7 Binary files /dev/null and b/basics_from _quarkus/src/main/java/org/acme/getting/started/ide_handler.app/Contents/Resources/vscode.icns differ diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/install b/basics_from _quarkus/src/main/java/org/acme/getting/started/install new file mode 100755 index 00000000..8e2167a2 --- /dev/null +++ b/basics_from _quarkus/src/main/java/org/acme/getting/started/install @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +sudo cp ide-handler.desktop /usr/share/applications +sudo update-desktop-database + +sudo cp ide-handler /usr/local/bin/ +sudo chmod +x /usr/local/bin/ide-handler diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/linux_url_handler.java b/basics_from _quarkus/src/main/java/org/acme/getting/started/linux_url_handler.java new file mode 100755 index 00000000..530bcd4e --- /dev/null +++ b/basics_from _quarkus/src/main/java/org/acme/getting/started/linux_url_handler.java @@ -0,0 +1,30 @@ +package org.acme.getting.started; +import java.io.*; +/*Adding Custom URL Handler to Linux for ide:// */ + public class linux_url_handler{ + public static void main(String[] args) throws Exception{ + + Runtime run = Runtime.getRuntime(); + //The best possible I found is to construct a command which you want to execute + //as a string and use that in exec. If the batch file takes command line arguments + //the command can be constructed a array of strings and pass the array as input to + //the exec method. The command can also be passed externally as input to the method. + + Process p = null; + String cmd = "sudo bash install"; + try { + p = run.exec(cmd); + + p.getErrorStream(); + p.waitFor(); + + } + catch (Exception e) { + e.printStackTrace(); + System.out.println("ERROR.RUNNING.CMD"); + + }finally{ + p.destroy(); + } + } + } \ No newline at end of file diff --git a/basics_from _quarkus/src/main/java/org/acme/getting/started/macos_url_handler.java b/basics_from _quarkus/src/main/java/org/acme/getting/started/macos_url_handler.java new file mode 100755 index 00000000..03434210 --- /dev/null +++ b/basics_from _quarkus/src/main/java/org/acme/getting/started/macos_url_handler.java @@ -0,0 +1,48 @@ +package org.acme.getting.started; +import java.io.*; +/*Adding Custom URL Handler to MacOS for ide:// */ + public class macos_url_handler{ + public static void main(String[] args) throws Exception{ + + Runtime run = Runtime.getRuntime(); + //The best possible I found is to construct a command which you want to execute + //as a string and use that in exec. If the batch file takes command line arguments + //the command can be constructed a array of strings and pass the array as input to + //the exec method. The command can also be passed externally as input to the method. + + Process p = null; + String cmd = "mv ide_handler.app ~/Applications"; //Moving to Applications + try { + p = run.exec(cmd); + + p.getErrorStream(); + p.waitFor(); + + } + catch (Exception e) { + e.printStackTrace(); + System.out.println("ERROR While Moving to Applications"); + + }finally{ + p.destroy(); + } + + cmd = "open -a ide_handler"; //Executing our Application + try { + p = run.exec(cmd); + + p.getErrorStream(); + p.waitFor(); + + } + catch (Exception e) { + e.printStackTrace(); + System.out.println("ERROR while executing application"); + + }finally{ + p.destroy(); + } + + + } + } \ No newline at end of file diff --git a/basics_from _quarkus/src/main/resources/META-INF/resources/index.html b/basics_from _quarkus/src/main/resources/META-INF/resources/index.html new file mode 100755 index 00000000..48145730 --- /dev/null +++ b/basics_from _quarkus/src/main/resources/META-INF/resources/index.html @@ -0,0 +1,152 @@ + + + + + getting-started - 1.0-SNAPSHOT + + + + + + +
+
+

Congratulations, you have created a new Quarkus application.

+ +

Why do you see this?

+ +

This page is served by Quarkus. The source is in + src/main/resources/META-INF/resources/index.html.

+ +

What can I do from here?

+ +

If not already done, run the application in dev mode using: mvn compile quarkus:dev. +

+ + +

How do I get rid of this page?

+

Just delete the src/main/resources/META-INF/resources/index.html file.

+
+
+
+

Application

+
    +
  • GroupId: org.acme
  • +
  • ArtifactId: getting-started
  • +
  • Version: 1.0-SNAPSHOT
  • +
  • Quarkus Version: 1.3.0.Final
  • +
+
+ +
+
+ + + + \ No newline at end of file diff --git a/basics_from _quarkus/src/main/resources/application.properties b/basics_from _quarkus/src/main/resources/application.properties new file mode 100755 index 00000000..f3edd967 --- /dev/null +++ b/basics_from _quarkus/src/main/resources/application.properties @@ -0,0 +1,4 @@ +# Configuration file +# key = value +# Docker +./mvnw package -Pnative -Dquarkus.native.container-runtime=docker \ No newline at end of file diff --git a/basics_from _quarkus/src/test/java/org/acme/getting/started/GreetingResourceTest.java b/basics_from _quarkus/src/test/java/org/acme/getting/started/GreetingResourceTest.java new file mode 100755 index 00000000..9cb8115d --- /dev/null +++ b/basics_from _quarkus/src/test/java/org/acme/getting/started/GreetingResourceTest.java @@ -0,0 +1,21 @@ +package org.acme.getting.started; + +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.Test; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; + +@QuarkusTest +public class GreetingResourceTest { + + @Test + public void testHelloEndpoint() { + given() + .when().get("/hello") + .then() + .statusCode(200) + .body(is("hello")); + } + +} \ No newline at end of file diff --git a/basics_from _quarkus/src/test/java/org/acme/getting/started/NativeGreetingResourceIT.java b/basics_from _quarkus/src/test/java/org/acme/getting/started/NativeGreetingResourceIT.java new file mode 100755 index 00000000..2db74447 --- /dev/null +++ b/basics_from _quarkus/src/test/java/org/acme/getting/started/NativeGreetingResourceIT.java @@ -0,0 +1,9 @@ +package org.acme.getting.started; + +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +public class NativeGreetingResourceIT extends GreetingResourceTest { + + // Execute the same tests but in native mode. +} \ No newline at end of file diff --git a/chrome_extension_starfish_ide_from_scratch/README.md b/chrome_extension_starfish_ide_from_scratch/README.md new file mode 100755 index 00000000..e60d583a --- /dev/null +++ b/chrome_extension_starfish_ide_from_scratch/README.md @@ -0,0 +1,4 @@ +# Intended to Inject "Open in IDE" Button + +- Currently supports Github +- Gitlab Support Added \ No newline at end of file diff --git a/chrome_extension_starfish_ide_from_scratch/content.js b/chrome_extension_starfish_ide_from_scratch/content.js new file mode 100755 index 00000000..3cb80491 --- /dev/null +++ b/chrome_extension_starfish_ide_from_scratch/content.js @@ -0,0 +1,81 @@ +current_url = window.location.href; +var page_uri = "ide://" + window.location.href; + +if (current_url.indexOf("https://github.com/") != -1) + +{ //Code for Github Begins + + if (!localStorage.getItem("starfish")) { + navigator.registerProtocolHandler("web+ide", + "https://github.com/?ide=%s", + "ide"); + localStorage.setItem("starfish", "true"); + } + var link = document.createElement('a'); + link.setAttribute("title", "Open In IDE"); + //var page_uri ="ide://#"+window.location.href; + page_uri+=".git"; + link.setAttribute("href", page_uri); + + link.setAttribute("class", "btn btn-sm btn-primary dev") + link.innerHTML = "Open in IDE"; + + var starfish = document.createElement('div'); + //starfish.setAttribute("class","empty-icon position-relative gitpod-nav-btn float-right"); + starfish.appendChild(link); + var el = document.getElementsByClassName("file-navigation")[0]; + el.appendChild(starfish); + +} //Code for Github Ends here +else +if (current_url.indexOf("https://gitlab.com") != -1) { //Code for Gitlab begins here + if (!localStorage.getItem("starfish")) { + navigator.registerProtocolHandler("web+ide", + "https://gitlab.com/?ide=%s", + "ide"); + localStorage.setItem("starfish", "true"); + } + var link = document.createElement('a'); + link.setAttribute("title", "Open In IDE"); + + link.setAttribute("href", page_uri); + link.setAttribute("class", "btn btn-primary clone-dropdown-btn qa-clone-dropdown") + link.innerHTML = "Open in IDE"; + + var starfish = document.createElement('div'); + //starfish.setAttribute("class","empty-icon position-relative gitpod-nav-btn float-right"); + starfish.setAttribute("class", "git-clone-holder js-git-clone-holder margin-left-5") + starfish.appendChild(link); + var el = document.getElementsByClassName("tree-controls")[0]; + el.appendChild(starfish); + + +} +else +if (current_url.indexOf("https://gist.github.com/") != -1) { //Code for Gitlab begins here + if (!localStorage.getItem("starfish")) { + navigator.registerProtocolHandler("web+ide", + "https://gist.github.com/?ide=%s", + "ide"); + localStorage.setItem("starfish", "true"); + } + var link = document.createElement('a'); + link.setAttribute("title", "Open In IDE"); + + link.setAttribute("href", page_uri); + link.setAttribute("class", "btn btn-sm") + link.innerHTML = "Open in IDE"; + + var starfish = document.createElement('div'); + //starfish.setAttribute("class","empty-icon position-relative gitpod-nav-btn float-right"); + starfish.setAttribute("class", "file-navigation-option margin-left-5") + starfish.appendChild(link); + var el = document.getElementsByClassName("file-navigation-options")[0]; + el.appendChild(starfish); + + +} + + + +//document.getElementsByClassName("get-repo-select-menu")[0].insertAdjacentHTML("afterend",starfish); \ No newline at end of file diff --git a/chrome_extension_starfish_ide_from_scratch/manifest.json b/chrome_extension_starfish_ide_from_scratch/manifest.json new file mode 100755 index 00000000..3869fba5 --- /dev/null +++ b/chrome_extension_starfish_ide_from_scratch/manifest.json @@ -0,0 +1,14 @@ +{ + "manifest_version": 2, + + "name": "Starfish", + "version": "2", + "description": "Open in IDE", + + "content_scripts": [{ + "css": ["styles.css"], + "js": ["content.js"], + "matches": ["https://github.com/*/*","https://gitlab.com/*/*","https://gist.github.com/*/*"] + }] + +} diff --git a/chrome_extension_starfish_ide_from_scratch/styles.css b/chrome_extension_starfish_ide_from_scratch/styles.css new file mode 100755 index 00000000..0b8e9591 --- /dev/null +++ b/chrome_extension_starfish_ide_from_scratch/styles.css @@ -0,0 +1,15 @@ +.dev{ + margin-left: 5px !important; + background-color: #643ab0 !important; + background-image: linear-gradient(-180deg, #7e55c7 0%, #643ab0 90%) !important; +} +.dev:hover{ + background-color: #643ab0 !important; + background-image: linear-gradient(-180deg, #7e55c7 0%, #643ab0 90%) !important; +} +.tree-controls{ + display:flex !important; +} +.margin-left-5{ + margin-left: 5px !important; +} \ No newline at end of file diff --git a/custom_url_handlers_quarkus/.dockerignore b/custom_url_handlers_quarkus/.dockerignore new file mode 100755 index 00000000..b86c7ac3 --- /dev/null +++ b/custom_url_handlers_quarkus/.dockerignore @@ -0,0 +1,4 @@ +* +!target/*-runner +!target/*-runner.jar +!target/lib/* \ No newline at end of file diff --git a/custom_url_handlers_quarkus/.gitignore b/custom_url_handlers_quarkus/.gitignore new file mode 100755 index 00000000..087a1835 --- /dev/null +++ b/custom_url_handlers_quarkus/.gitignore @@ -0,0 +1,35 @@ +# Eclipse +.project +.classpath +.settings/ +bin/ + +# IntelliJ +.idea +*.ipr +*.iml +*.iws + +# NetBeans +nb-configuration.xml + +# Visual Studio Code +.vscode + +# OSX +.DS_Store + +# Vim +*.swp +*.swo + +# patch +*.orig +*.rej + +# Maven +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +release.properties \ No newline at end of file diff --git a/custom_url_handlers_quarkus/.mvn/wrapper/MavenWrapperDownloader.java b/custom_url_handlers_quarkus/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100755 index 00000000..b901097f --- /dev/null +++ b/custom_url_handlers_quarkus/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/custom_url_handlers_quarkus/.mvn/wrapper/maven-wrapper.jar b/custom_url_handlers_quarkus/.mvn/wrapper/maven-wrapper.jar new file mode 100755 index 00000000..2cc7d4a5 Binary files /dev/null and b/custom_url_handlers_quarkus/.mvn/wrapper/maven-wrapper.jar differ diff --git a/custom_url_handlers_quarkus/.mvn/wrapper/maven-wrapper.properties b/custom_url_handlers_quarkus/.mvn/wrapper/maven-wrapper.properties new file mode 100755 index 00000000..642d572c --- /dev/null +++ b/custom_url_handlers_quarkus/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/custom_url_handlers_quarkus/README.md b/custom_url_handlers_quarkus/README.md new file mode 100755 index 00000000..a606b6d4 --- /dev/null +++ b/custom_url_handlers_quarkus/README.md @@ -0,0 +1,35 @@ +# starfish project + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: +``` +./mvnw quarkus:dev + +``` +## Running the installation: + +After running application using `./mvnw quarkus:dev` you can either browse to http://localhost:8080/install or you may use the command `curl -w "\n" http://localhost:8080/install` + + +## Packaging and running the application + +The application can be packaged using `./mvnw package`. +It produces the `starfish-1.0.0-SNAPSHOT-runner.jar` file in the `/target` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/lib` directory. + +The application is now runnable using `java -jar target/starfish-1.0.0-SNAPSHOT-runner.jar`. + +## Creating a native executable + +You can create a native executable using: `./mvnw package -Pnative`. + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: `./mvnw package -Pnative -Dquarkus.native.container-build=true`. + +You can then execute your native executable with: `./target/starfish-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult https://quarkus.io/guides/building-native-image-guide. diff --git a/custom_url_handlers_quarkus/mvnw b/custom_url_handlers_quarkus/mvnw new file mode 100755 index 00000000..41c0f0c2 --- /dev/null +++ b/custom_url_handlers_quarkus/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/custom_url_handlers_quarkus/mvnw.cmd b/custom_url_handlers_quarkus/mvnw.cmd new file mode 100755 index 00000000..86115719 --- /dev/null +++ b/custom_url_handlers_quarkus/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/custom_url_handlers_quarkus/pom.xml b/custom_url_handlers_quarkus/pom.xml new file mode 100755 index 00000000..f0a4e13c --- /dev/null +++ b/custom_url_handlers_quarkus/pom.xml @@ -0,0 +1,111 @@ + + + 4.0.0 + org.fahad + starfish + 1.0.0-SNAPSHOT + + 3.8.1 + true + 11 + 11 + UTF-8 + UTF-8 + 1.3.1.Final + quarkus-universe-bom + io.quarkus + 1.3.1.Final + 2.22.1 + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus-plugin.version} + + + + build + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + + + + + + + + native + + + native + + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + + + + + + + + + native + + + + diff --git a/custom_url_handlers_quarkus/src/main/docker/Dockerfile.jvm b/custom_url_handlers_quarkus/src/main/docker/Dockerfile.jvm new file mode 100755 index 00000000..5aa3c8e9 --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/docker/Dockerfile.jvm @@ -0,0 +1,47 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the docker image run: +# +# mvn package +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/starfish-jvm . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/starfish-jvm +# +### +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1 + +ARG JAVA_PACKAGE=java-11-openjdk-headless +ARG RUN_JAVA_VERSION=1.3.5 + +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' + +# Install java and the run-java script +# Also set up permissions for user `1001` +RUN microdnf install openssl curl ca-certificates ${JAVA_PACKAGE} \ + && microdnf update \ + && microdnf clean all \ + && mkdir /deployments \ + && chown 1001 /deployments \ + && chmod "g+rwX" /deployments \ + && chown 1001:root /deployments \ + && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ + && chown 1001 /deployments/run-java.sh \ + && chmod 540 /deployments/run-java.sh \ + && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security + +# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. +ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" + +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/app.jar + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT [ "/deployments/run-java.sh" ] \ No newline at end of file diff --git a/custom_url_handlers_quarkus/src/main/docker/Dockerfile.native b/custom_url_handlers_quarkus/src/main/docker/Dockerfile.native new file mode 100755 index 00000000..616b2475 --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/docker/Dockerfile.native @@ -0,0 +1,30 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode +# +# Before building the docker image run: +# +# mvn package -Pnative -Dquarkus.native.container-build=true +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native -t quarkus/starfish . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/starfish +# +### +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1 +WORKDIR /work/ +COPY target/*-runner /work/application + +# set up permissions for user `1001` +RUN chmod 775 /work /work/application \ + && chown -R 1001 /work \ + && chmod -R "g+rwX" /work \ + && chown -R 1001:root /work + +EXPOSE 8080 +USER 1001 + +CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] \ No newline at end of file diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/ExampleResource.java b/custom_url_handlers_quarkus/src/main/java/org/fahad/ExampleResource.java new file mode 100755 index 00000000..d21c5d1e --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/java/org/fahad/ExampleResource.java @@ -0,0 +1,16 @@ +package org.fahad; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Path("/hello") +public class ExampleResource { + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String hello() { + return "hello"; + } +} \ No newline at end of file diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/config.properties b/custom_url_handlers_quarkus/src/main/java/org/fahad/config.properties new file mode 100644 index 00000000..13fe5252 --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/java/org/fahad/config.properties @@ -0,0 +1,3 @@ +test=Reading Configuration File +clonning_dir=/home/fahad/MyProjects/starfish_clonned/ +ide=code diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/ide-handler b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide-handler new file mode 100755 index 00000000..77de2236 --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide-handler @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +request="${1#*://}" # Remove schema from url (ide://) +echo $request +gnome-terminal -- /usr/bin/starfish $request diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/ide-handler.desktop b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide-handler.desktop new file mode 100755 index 00000000..deb2973f --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide-handler.desktop @@ -0,0 +1,11 @@ +#!/usr/bin/env xdg-open +[Desktop Entry] +Version=1.0 +Terminal=false +Type=Application +Name=IDE URL Handler +Comment=Handle URL Scheme ide:// +Icon=ide-handler +NoDisplay=true +Exec=ide-handler %u +MimeType=x-scheme-handler/ide diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Info.plist b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Info.plist new file mode 100755 index 00000000..c9a0e8f9 --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Info.plist @@ -0,0 +1,63 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + English + CFBundleExecutable + applet + CFBundleIconFile + vscode + CFBundleIdentifier + com.apple.ScriptEditor.id.VS-Code-Handler + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + IDE Handler + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + aplt + CFBundleURLTypes + + + CFBundleURLName + Custom URI Handler for ide:// URIs + CFBundleURLSchemes + + starfish + + + + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + WindowState + + bundleDividerCollapsed + + bundlePositionOfDivider + 0.0 + dividerCollapsed + + eventLogLevel + 2 + name + ScriptWindowState + positionOfDivider + 421 + savedFrame + 50 78 700 672 0 0 1280 777 + selectedTab + description + + + diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/MacOS/applet b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/MacOS/applet new file mode 100755 index 00000000..25488180 Binary files /dev/null and b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/MacOS/applet differ diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/PkgInfo b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/PkgInfo new file mode 100755 index 00000000..3253614c --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/Scripts/main.scpt b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/Scripts/main.scpt new file mode 100755 index 00000000..10b30060 Binary files /dev/null and b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/Scripts/main.scpt differ diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/applet.rsrc b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/applet.rsrc new file mode 100755 index 00000000..df1db3ca Binary files /dev/null and b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/applet.rsrc differ diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/description.rtfd/TXT.rtf b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/description.rtfd/TXT.rtf new file mode 100755 index 00000000..e9c3bc1a --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/description.rtfd/TXT.rtf @@ -0,0 +1,4 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1348\cocoasubrtf170 +{\fonttbl} +{\colortbl;\red255\green255\blue255;} +} \ No newline at end of file diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/vscode.icns b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/vscode.icns new file mode 100755 index 00000000..f0e82fc7 Binary files /dev/null and b/custom_url_handlers_quarkus/src/main/java/org/fahad/ide_handler.app/Contents/Resources/vscode.icns differ diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/install b/custom_url_handlers_quarkus/src/main/java/org/fahad/install new file mode 100755 index 00000000..ae6370b3 --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/java/org/fahad/install @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +sudo cp ide-handler.desktop /usr/share/applications +sudo update-desktop-database + +sudo cp ide-handler /usr/bin/ +sudo chmod +x /usr/bin/ide-handler + +sudo cp starfish /usr/bin +sudo chmod +x /usr/bin/starfish + +sudo cp starfish-config.yml /usr/bin +sudo chmod -R 777 /usr/bin/starfish-config.yml \ No newline at end of file diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/installer.java b/custom_url_handlers_quarkus/src/main/java/org/fahad/installer.java new file mode 100755 index 00000000..29bc24b4 --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/java/org/fahad/installer.java @@ -0,0 +1,101 @@ +package org.fahad; + +import java.io.*; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Path("/install") +public class installer { + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String install()throws Exception { + System.out.println("Welcome to Installer"); + String OS = System.getProperty("os.name").toLowerCase(); + System.out.println("Your Operating System is "+ OS); + + if(OS.indexOf("mac") >= 0){ + //MAC OS Detected + + Runtime run = Runtime.getRuntime(); + //The best possible I found is to construct a command which you want to execute + //as a string and use that in exec. If the batch file takes command line arguments + //the command can be constructed a array of strings and pass the array as input to + //the exec method. The command can also be passed externally as input to the method. + + Process p = null; + String cmd = "mv ide_handler.app ~/Applications"; //Moving to Applications + try { + p = run.exec(cmd); + + p.getErrorStream(); + p.waitFor(); + + } + catch (Exception e) { + e.printStackTrace(); + System.out.println("ERROR While Moving to Applications"); + return "unable to install"; + }finally{ + p.destroy(); + } + + cmd = "open -a ide_handler"; //Executing our Application + try { + p = run.exec(cmd); + + p.getErrorStream(); + p.waitFor(); + System.out.println("installation successful"); + return "Detected Operationg System is" + OS + "\nInstallation successful"; + } + catch (Exception e) { + e.printStackTrace(); + System.out.println("ERROR while executing application"); + return "Detected Operationg System is"+ OS +"\nSorry!!unable to install :( \nCheck logs to know more"; + }finally{ + p.destroy(); + } + + + } + + + + if(OS.indexOf("nux") >= 0){ + //Linux OS Detected + Runtime run = Runtime.getRuntime(); + //The best possible I found is to construct a command which you want to execute + //as a string and use that in exec. If the batch file takes command line arguments + //the command can be constructed a array of strings and pass the array as input to + //the exec method. The command can also be passed externally as input to the method. + + Process p = null; + String cmd = "sudo bash install"; + try { + p = run.exec(cmd); + + p.getErrorStream(); + p.waitFor(); + System.out.println("installation successful"); + return "Detected Operationg System is "+ OS +"\nInstallation Successful!!"; + } + catch (Exception e) { + e.printStackTrace(); + System.out.println("ERROR.RUNNING.CMD"); + return "Detected Operationg System is"+ OS + "\nSorry!!unable to install :( \nCheck logs for errors"; + }finally{ + p.destroy(); + } + + + } + else{ + return "Detected OS: "+OS +"\nYour OS Not Supported..We are working on it!! "; + } + + + } +} \ No newline at end of file diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish b/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish new file mode 100755 index 00000000..1e675e30 Binary files /dev/null and b/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish differ diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish$StreamGobbler.class b/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish$StreamGobbler.class new file mode 100644 index 00000000..cca0d6f7 Binary files /dev/null and b/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish$StreamGobbler.class differ diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish-config.yml b/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish-config.yml new file mode 100644 index 00000000..f0cc17f0 --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish-config.yml @@ -0,0 +1,2 @@ +ide: code +clonning_dir: /home/fahad/MyProjects diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish.class b/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish.class new file mode 100644 index 00000000..ccc5ffa0 Binary files /dev/null and b/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish.class differ diff --git a/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish.java b/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish.java new file mode 100755 index 00000000..f0d39507 --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/java/org/fahad/starfish.java @@ -0,0 +1,254 @@ +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Objects; +import java.util.Properties; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.util.*; +import org.simpleyaml.configuration.ConfigurationSection; +import org.simpleyaml.configuration.file.YamlFile; + +class starfish{ + public static void main(String[]args)throws Exception{ + for(String s:args) + System.out.println("\nTarget : "+s);//Printing Received Arguements for Debugging + + if(args[0].equalsIgnoreCase("config")){ + //Incase user wants to configure starfish + editConfig();//Calling function that enables to edit configuration + return; //Incase user typed "starfish config" we only want to edit configuration + } + + //Calling function for Fetching installed Packages + //fetch_installed_packages(); //This function will print all installed packages + + //Configuration identifiers + String clone_path="";//Holds path to destination Where the Repository Must Be Clonned + String ide=""; //Holds command for IDE to open upon + String userHome = System.getProperty( "user.home" ); //Get User Home Directory: /home/user_name + + YamlFile yamlFile = new YamlFile(userHome + "/starfish-config.yml"); //Loading YAML + + + + BufferedReader reader= new BufferedReader(new InputStreamReader(System.in)); + + + //Reading Configuration File + try { + if (!yamlFile.exists()) { + //Incase no config file exists + System.out.println("\nThis is the first time you're using starfish...You'll need to configure it"); + editConfig(); //Calling function that lets user to configure + } + + System.out.println("\nLoading configurations.....\n"); + yamlFile.load(); // Loads the entire file + ide=yamlFile.getString("ide"); + clone_path=yamlFile.getString("clonning_dir"); + if(ide==null||clone_path==null)editConfig(); //Incase of absence of configuration in file Launch Config + + + } + catch (Exception e) { + e.printStackTrace(); + System.out.print("Press any key to continue . . . "); + } + + + + //Clonnning Git Repo + //Expected parameter: https://github.com/user-name/repo-name.git + String repo_name=args[0].substring(args[0].lastIndexOf("/"),args[0].lastIndexOf(".")); //Extracts the Name of Repository + //String clone_path= "/home/fahad/MyProjects/starfish_clonned/"; + String cmd = "git clone "+args[0]; + String originUrl = args[0]; + Path directory = Paths.get(clone_path+repo_name); + gitClone(directory, originUrl); + + + + + //Launching Vscode on the Cloned Directory + System.out.println("Launching IDE Now"); + runCommand(directory.getParent(), ide,clone_path+repo_name); + + + } + + + //Function to edit configuration and serves for command line starfish config + public static void editConfig()throws Exception{ + System.out.println("\n------Starfish Configuration Editor------"); + String clone_path="";//Holds path to destination Where the Repository Must Be Clonned + String ide=""; //Holds command for IDE to open upon + String userHome = System.getProperty( "user.home" ); //Get User Home Directory: /home/user_name + + YamlFile yamlFile = new YamlFile(userHome + "/starfish-config.yml"); //Loading YAML + + BufferedReader reader= new BufferedReader(new InputStreamReader(System.in)); + + + //Reading Configuration File + try { + if (!yamlFile.exists()) { + //Incase no config file exists + System.out.println("\n-No configurations exist for starfish...You'll have to configure it"); + System.out.println("\n-New configuration file will be created at: " + yamlFile.getFilePath() + "\n"); + yamlFile.createNewFile(true); + } + + + //--------------------------First we'll input preferred IDE from user------------------------------ + + int id=0; + while(id!=1||id!=2||id!=3){ + System.out.println("\n--------Chose the preferred IDE --------\n 1.for vscode \n 2.for eclipse \n 3.for IntelliJ_IDEA "); + + id=Integer.parseInt(reader.readLine()); + + if(id==1){ide="code";System.out.println("Selected IDE:VsCode");break;} + else + if(id==2){ide="eclipse";System.out.println("Selected IDE:Eclipse");break;} + else + if(id==3){ide="idea";System.out.println("Selected IDE:IntelliJ_IDEA");break;} + else + System.out.println("--------Invalid Input Try Again--------"); + } + + //-----------Now we'll get preferred clone path on local file system from user-------------- + System.out.println("--------Enter preferred Clonning path--------"); + clone_path=reader.readLine(); + + //---------Save the received configurations in /home/user_name/starfish-config.yml + yamlFile.set("ide",ide); //Storing IDE configuration in YAML file + yamlFile.set("clonning_dir",clone_path ); //Storing Clone Path configuration in YAML + //--------Save the New Config in YML file------- + try{ + yamlFile.save(); + System.out.println("--------Configuration updated and saved successfully--------"); + } + catch(Exception e){ + e.printStackTrace(); + System.out.println("Couldn't save the configurations :("); + System.out.print("Press any key to continue . . . "); + reader.readLine(); + } + + + } + catch (Exception e) { + e.printStackTrace(); + System.out.print("Press any key to continue . . . "); + reader.readLine(); + } + + } + + public static void gitClone(Path directory, String originUrl) throws IOException, InterruptedException { + //Function for git clonning + runCommand(directory.getParent(), "git", "clone", originUrl, directory.getFileName().toString()); + } + + + + + public static void runCommand(Path directory, String... command) throws IOException, InterruptedException { + //Function to Run Commands using Process Builder + + Objects.requireNonNull(directory, "directory"); + if (!Files.exists(directory)) { + throw new RuntimeException("can't run command in non-existing directory '" + directory + "'"); + } + //String[] env = System.getenv("Path"); + + ProcessBuilder pb = new ProcessBuilder() + .command(command) + .directory(directory.toFile()); + Map env = pb.environment(); + for(String envName : env.keySet()) + System.out.println(envName +" "+ env.get(envName)); + System.out.println("------------------------------------------\n\n\n"); + Map systemEnv = System.getenv(); + for(String envName : systemEnv.keySet()){ + System.out.println(envName +" "+ systemEnv.get(envName)); + env.put(envName, systemEnv.get(envName)); + } + Process p = pb.start(); + StreamGobbler errorGobbler = new StreamGobbler(p.getErrorStream(), "E"); + StreamGobbler outputGobbler = new StreamGobbler(p.getInputStream(), "O"); + outputGobbler.start(); + errorGobbler.start(); + int exit = p.waitFor(); + errorGobbler.join(); + outputGobbler.join(); + if (exit != 0) { + throw new AssertionError(String.format("runCommand returned %d", exit)); + } + } + + + + private static class StreamGobbler extends Thread { + + private final InputStream is; + private final String type; + + private StreamGobbler(InputStream is, String type) { + this.is = is; + this.type = type; + } + + @Override + public void run() { + try (BufferedReader br = new BufferedReader(new InputStreamReader(is));) { + String line; + while ((line = br.readLine()) != null) { + System.out.println(type + "> " + line); + } + } catch (IOException ioe) { + ioe.printStackTrace(); + + } + } + } + + + //Function to fetch all installed packages on System + public static void fetch_installed_packages()throws Exception{ + + String [] extCmdArgs = new String[]{"dpkg-query", "-W", "-f=${Package} ${Version}\n"};// Fetches installed Packages on System + //String [] extCmdArgs = new String[]{"sudo apt list --installed}; + + Process fetchInstalledPackagesProcess = Runtime.getRuntime().exec(extCmdArgs); + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(fetchInstalledPackagesProcess.getInputStream())); + String line; + while(true){ + line = reader.readLine(); + if (line == null) + break; + System.out.println(line); + } + } catch (Exception e) { + e.printStackTrace(); + } + finally { + reader.close(); + } + + + } + + + + + +} \ No newline at end of file diff --git a/custom_url_handlers_quarkus/src/main/resources/META-INF/resources/index.html b/custom_url_handlers_quarkus/src/main/resources/META-INF/resources/index.html new file mode 100755 index 00000000..c12c0787 --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/resources/META-INF/resources/index.html @@ -0,0 +1,152 @@ + + + + + starfish - 1.0.0-SNAPSHOT + + + + + + +
+
+

Congratulations, you have created a new Quarkus application.

+ +

Why do you see this?

+ +

This page is served by Quarkus. The source is in + src/main/resources/META-INF/resources/index.html.

+ +

What can I do from here?

+ +

If not already done, run the application in dev mode using: mvn compile quarkus:dev. +

+
    +
  • Add REST resources, Servlets, functions and other services in src/main/java.
  • +
  • Your static assets are located in src/main/resources/META-INF/resources.
  • +
  • Configure your application in src/main/resources/application.properties. +
  • +
+ +

How do I get rid of this page?

+

Just delete the src/main/resources/META-INF/resources/index.html file.

+
+
+
+

Application

+
    +
  • GroupId: org.fahad
  • +
  • ArtifactId: starfish
  • +
  • Version: 1.0.0-SNAPSHOT
  • +
  • Quarkus Version: 1.3.1.Final
  • +
+
+ +
+
+ + + + \ No newline at end of file diff --git a/custom_url_handlers_quarkus/src/main/resources/application.properties b/custom_url_handlers_quarkus/src/main/resources/application.properties new file mode 100755 index 00000000..3c1ac56a --- /dev/null +++ b/custom_url_handlers_quarkus/src/main/resources/application.properties @@ -0,0 +1,2 @@ +# Configuration file +# key = value \ No newline at end of file diff --git a/custom_url_handlers_quarkus/src/test/java/org/fahad/ExampleResourceTest.java b/custom_url_handlers_quarkus/src/test/java/org/fahad/ExampleResourceTest.java new file mode 100755 index 00000000..68081b55 --- /dev/null +++ b/custom_url_handlers_quarkus/src/test/java/org/fahad/ExampleResourceTest.java @@ -0,0 +1,21 @@ +package org.fahad; + +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.Test; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; + +@QuarkusTest +public class ExampleResourceTest { + + @Test + public void testHelloEndpoint() { + given() + .when().get("/hello") + .then() + .statusCode(200) + .body(is("hello")); + } + +} \ No newline at end of file diff --git a/custom_url_handlers_quarkus/src/test/java/org/fahad/NativeExampleResourceIT.java b/custom_url_handlers_quarkus/src/test/java/org/fahad/NativeExampleResourceIT.java new file mode 100755 index 00000000..c41b9328 --- /dev/null +++ b/custom_url_handlers_quarkus/src/test/java/org/fahad/NativeExampleResourceIT.java @@ -0,0 +1,9 @@ +package org.fahad; + +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +public class NativeExampleResourceIT extends ExampleResourceTest { + + // Execute the same tests but in native mode. +} \ No newline at end of file diff --git a/starfish_demo_for_github/README.md b/starfish_demo_for_github/README.md new file mode 100755 index 00000000..d08e00cb --- /dev/null +++ b/starfish_demo_for_github/README.md @@ -0,0 +1,16 @@ +# starfish_demo_for_github + +Webpage: https://fahad-israr.github.io/starfish-demo/ + +Demonstrates open in IDE Option on Github for Starfish App at https://fahad-israr.github.io/starfish-demo/ + + +_As a mockup we open `apt` instead of starfish(as it is not developed yet)_ + +- on site load it prompts to add url handler extension:site wants to *`open web+apt links`* with two options *`block`* and *`allow`* +- click allow to register apt +- now click on open in starfish to launch apt +- it will prompt to `open xdg-open` +- click on `open-xdg-open` +- note that we are trigerring apt with the url for mockup +- ofcourse it is an invalid package so it will give error diff --git a/starfish_demo_for_github/_config.yml b/starfish_demo_for_github/_config.yml new file mode 100755 index 00000000..2f7efbea --- /dev/null +++ b/starfish_demo_for_github/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-minimal \ No newline at end of file diff --git a/starfish_demo_for_github/index.html b/starfish_demo_for_github/index.html new file mode 100755 index 00000000..9c46cffc --- /dev/null +++ b/starfish_demo_for_github/index.html @@ -0,0 +1,1066 @@ + + + + + + + + + + + + + + + + + + + + GitHub - fahad-israr/starfish: GSOC 2020 Starfish POC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+
+ +
+
+ +
+
+ + GSOC 2020 Starfish POC + +
+
+ +
+ +
+ C# + Shell +
+
+ +
+
+
+ + Branch: + master + + + +
+ + + +
+
+
+ + +
+ Find file +
+ + +
+ + Clone or download + + +
+ +
+
+
+
+
+ + + + Pull request + + + + Compare + + + This branch is 24 commits ahead, 1 commit behind maxandersen:master. +
+
+
+

Latest commit

+
+
+
+ + @fahad-israr + +
+
+ +
+ + + + Latest commit + + 20ab277 + + + Mar 11, 2020 + +
+
+
+

Files

+ + Permalink + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeNameLatest commit messageCommit time
+ + Failed to load latest commit information.
+ + + + + + adding_url_handlers_to_operating_system + + + + + +
+ + + + + + support_opening_files_through_url_handling_in_vscode + + + + + +
+ + + + + + README.adoc + + + + + +
+
+
+
+
+

+ + README.adoc +

+
+
+
+

+ + Project Starfish +

+
+
+
+

GSOC 2020 Starfish POC

+
+
+

This repo is mainly to have conversations/discussions around the Starfish GSOC idea under JBoss.org.

+
+
+

Below is an update of the original outline of the idea:

+
+
+
+
+

+ + Project Starfish - Open anything anywhere in any IDE/editor +

+
+
+

Summary of idea:

+
+
+
    +
  • +

    Implement a client side app that supports urlhandlers (i.e. ide://clone-url?url=https://github …​ , ide://open-file?, ide://open-debugger?port=..&project=url, etc.)

    +
  • +
  • +

    Then integrate these various actions to perform and setup in vscode, eclipse, intellij, emacs, vi, etc.

    +
  • +
  • +

    Make it work across Linux, OSX and Windows so it can be used from anywhere.

    +
  • +
  • +

    Possible make browser extensions to enable it on various websites like github, gitlab, etc.

    +
  • +
+
+
+

This project will need some level of research:

+
+
+
    +
  • +

    How to setup url handlers on all three major platforms

    +
  • +
  • +

    Understand the basic functionallity of at least three IDEs/Editors open/clone features to show it will work

    +
  • +
  • +

    Explore extendability of browers or IDE’s as needed

    +
  • +
  • +

    Possible tasks for this project:

    +
  • +
  • +

    Implement cross-platform app

    +
  • +
  • +

    Add tests

    +
  • +
  • +

    Write documentation

    +
  • +
  • +

    Prepare demos

    +
  • +
+
+
+

+ + Knowledge prerequisite: +

+
+
    +
  • +

    Open choice on language, but most likely Java, or Go based

    +
  • +
  • +

    Basic understanding of IDE and/or Browser extensions

    +
  • +
  • +

    Access to more than one of the Operating Systems, virtual machines okey.

    +
  • +
+
+
+
+

+ + Github repo: +

+
+

Since this is a new idea there are no direct current github repo for it - for now created https://github.com/maxandersen/starfish for having a place of discussion/conversion. If you want to explore/work in this area and show your experience/interest you can look into contributing to projects like https://github.com/maxandersen/jbang or any vscode-* repo under https://github.com/redhat-developer/ or for more advanced https://github.com/quarkusio. Basically any project that relates to developer tools, desktop tools, scripts or browser extensions will be useful experience.

+
+
+
+

+ + Slides: +

+
+
+
An outline of the idea with some screenshots/overview can be found https://docs.google.com/presentation/d/1AwWtUVz04b5u2I3QB-fEevzpyAJLSE1PzdS0JjnVoO0/edit#slide=id.pp[here] - feel free to comment.
+
+
+
+
    +
  • +

    Skill level: Beginner/Intermediate

    +
  • +
  • +

    Contact(s) / potential mentors(s): Max Rydahl Andersen (manderse@redhat.com)

    +
  • +
  • +

    Associated JBoss community project(s): Quarkus, vscode extensions, JBoss Tools

    +
  • +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + You can’t perform that action at this time. +
+ + + + + + + +
+ + + + diff --git a/support_opening_files_through_url_handling_in_vscode/README.md b/support_opening_files_through_url_handling_in_vscode/README.md new file mode 100755 index 00000000..db6edab4 --- /dev/null +++ b/support_opening_files_through_url_handling_in_vscode/README.md @@ -0,0 +1,66 @@ +# Support opening files through URL handling in Vscode + +## File Chages Required: + +### `src/vs/platform/windows/common/windows.ts` + `@@ export interface IWindowsService {` + +[+] `openFileForURI(filePath: String): TPromise;` + +***************************************************************** +### src/vs/platform/windows/common/windowsIpc.ts +`@@ export interface IWindowsChannel extends IChannel { +` + +[+] `call(command: 'openFileForURI', arg: string): TPromise;` + +----------------------------------------------------------------------- + +`@@ export class WindowsChannel implements IWindowsChannel {` + +[+] `case 'openFileForURI': return this.service.openFileForURI(arg);` + +--------------------------------------------------------------------------- +`@@ export class WindowsChannelClient implements IWindowsService {` + +`openFileForURI(filePath: string): TPromise { + return this.channel.call('openFileForURI', filePath); + }` + + -------------------------------------------------------------------------- + + ### src/vs/platform/windows/electron-main/windowsService.ts + + `@@ import { TPromise } from 'vs/base/common/winjs.base';` + + [+] `import Event, { chain } from 'vs/base/common/event';` + + ----------------------------------------------------------------------------- + `@@ export class WindowsService implements IWindowsService {` + + [+] + ```constructor( + @IWindowsMainService private windowsMainService: IWindowsMainService, + @IEnvironmentService private environmentService: IEnvironmentService, + @IURLService private urlService: IURLService + ) { + chain(urlService.onOpenURL) + .filter(uri => uri.authority === 'file') + .on(uri => this.openFileForURI(uri.path), this); + } + + + + openFileForURI(filePath: string): TPromise { + if (!filePath || !filePath.length) { + return TPromise.as(null); + } + + var envServiceArgs = this.environmentService.args; + envServiceArgs.goto = true; + + this.windowsMainService.open({ cli: envServiceArgs, pathsToOpen: [filePath] }); + return TPromise.as(null); + } + +